Game Development Reference
In-Depth Information
The Return statement:
return (expression);
The If and If…Else statements:
if( condition )
{
statement(s);
}
if( condition )
{
statement(s);
}
else
{
statement(s);
}
The for statement:
for(initial; condition; increment)
{
statement(s);
}
The while statement:
while( condition )
{
statement(s);
}
The do ... while statement:
do
{
statement(s);
}while( condition );
16.4.3 Casting
HLSL supports a very flexible casting scheme. The casting syntax in
HLSL is the same as in the C programming language. For example, to
cast a float to a matrix , we write:
float f = 5.0f;
matrix m = (matrix)f;
For the examples in this topic, you will be able to deduce the meaning
of the cast from the syntax. However, if you want more detailed infor-
mation on the supported casts, in the DirectX SDK documentation,
under the Contents tab, see DirectX Graphics\Reference\Shader Refer-
ence\High Level Shading Language\Type.
Search WWH ::




Custom Search