Game Development Reference
In-Depth Information
True specifies that the entire currently set texture should be
mapped to the point sprite.
False specifies that the texel specified by the texture coordi-
nate of the point sprite (if it has a texture coordinate in the ver-
tex structure) should be used to texture the point sprite.
_device->SetRenderState(D3DRS_POINTSPRITEENABLE, true);
D3DRS_POINTSCALEENABLE —A Boolean value. The default value
is false.
True specifies that the point size will be interpreted as view
space units. View space units simply refer to 3D points in cam-
era space. The point sprite's size will then be scaled accord-
ingly, depending on how far away it is, like other objects so that
particles farther away will appear smaller than particles close
to the camera.
False specifies that the point size will be interpreted as screen
space units. Screen space units are pixel units on the screen.
So if you specify false and, for example, set the size of the point
sprite to 3, the point sprite will be 3x3 pixels in area on the
screen.
_device->SetRenderState(D3DRS_POINTSCALEENABLE, true);
D3DRS_POINTSIZE —Used to specify the size of the point sprites.
This value is either interpreted as the point sprite's size in view
space or in screen space, depending on how the D3DRS_POINT-
SCALEENABLE state is set. The following code snippet sets the
point size to 2.5 units:
_device->SetRenderState( D3DRS_POINTSIZE, d3d::FtoDw(2.5f) );
The function d3d::FtoDw is a function that we have added to the
d3dUtility.h/cpp files that casts a float to a DWORD . We must do this
because the general call to IDirect3DDevice9::SetRender-
State expects a DWORD value and not a float.
DWORD d3d::FtoDw(float f)
{
return *((DWORD*)&f);
}
D3DRS_POINTSIZE_MIN —Specifies the minimum size that a
point sprite can be. Here is an example of setting the minimum to
0.2:
_device->SetRenderState(D3DRS_POINTSIZE_MIN, d3d::FtoDw(0.2f));
Search WWH ::




Custom Search