Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


What Does This Mean "$modelViewProj"


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 monkeyboi   Members   -  Reputation: 188

Like
0Likes
Like

Posted 04 December 2012 - 10:24 AM

Basically I am trying to compile cg shader file with DX. A char* pointer is used to store the name of a variable in cg. But, here is the question, I don't know why I have to type "$modelViewProj" instead of "modelViewProj". Otherwise the function constanttable->SetValue() will not success. In the cg file that variable's name is just modelViewProj as

void vertextransform(float4 position : POSITION,
float3 Normal : NORMAL,
float2 texCoord : TEXCOORD0,
out float4 oPosition : POSITION,
out float2 otexCoord : TEXCOORD0,
uniform float4x4 modelViewProj)
{
// Transform position from object space to clip space
oPosition = mul(modelViewProj, position);
Normal= float3(0,0,-1);
otexCoord = texCoord;
}

Thanks in advance

Jerry

Sponsor:

#2 frob   Moderators   -  Reputation: 22222

Like
0Likes
Like

Posted 04 December 2012 - 11:47 AM

So the question is: Why do I need to use the dollar sign?

There is already a global input named modelViewProj.

The people who wrote the system decided that when the same name comes from both sources, the function parameter would be prepended with $ to avoid duplicate names.


So:
modelViewProj is the global input
$modelViewProj is the parameter.

Check out my book, Game Development with Unity, aimed at beginners who want to build fun games fast.

Also check out my personal website at bryanwagstaff.com, where I write about assorted stuff.


#3 monkeyboi   Members   -  Reputation: 188

Like
0Likes
Like

Posted 04 December 2012 - 12:11 PM

So:
modelViewProj is the global input


But I did not write any input named modelViewProj, or it is just default input written by program?

The people who wrote the system decided that when the same name comes from both sources

What do both sources mean here? global input and parameter?
What if I put uniform float4x4 modelViewProj out of the funcion as an global input, I would only need "modelViewProj"?




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS