Game Development Community

New Uniform Variables

by Anthony Rosenbaum · in Torque Game Engine Advanced · 09/04/2004 (6:36 am) · 6 replies

Where does one include new uniform variabes?
After viewing the HLSL online docs it seems that uniforms can be considered constants and in turn are loaded from the registeries. . . am I right?

#1
09/04/2004 (12:49 pm)
Dont you do it with setVertexShaderConstF?

e.g

GFXD3DDevice::setVertexShaderConstF( U32 reg, const float *data, U32 size )
GFX->setPixelShaderConstF( PC_AMBIENT_COLOR, (float*)&sgData.lights[0].mAmbient, 1 );


Seems logical place to do this is in Material::setShaderConstants(). materials/material.cpp
#2
09/04/2004 (2:05 pm)
Yup, that's right.
#3
09/04/2004 (2:36 pm)
In openGL the uniform variable are tied to a unique shader program. Is Direct X the same?

Reason being couldn't I run out of registery space?
#4
09/06/2004 (11:58 am)
You certainly could.

In DX the paradigm is that there is a global set of registers that you set and that are accessible from the shader.
#5
09/06/2004 (12:09 pm)
I have sucessfully made constants via register and have exposed those to the customMaterial class as a datablock variable, my next attempt will be to have the shader datablock be loaded into the mission editor as part of the inspector and allow it to chnage the variables from within the editor.
#6
09/07/2004 (2:11 pm)
Nice.