Game Development Reference
In-Depth Information
The PolyParticleEx constructor calls the Object3d constructor and then initializes class member
variables. (See Listing 7-32.)
Listing 7-32. The PolyParticleEx Constructor
public PolyParticleEx(Context iContext, Mesh iMesh, MeshEx iMeshEx, Texture[] iTextures,
Material iMaterial, Shader iShader)
{
super(iContext, iMesh, iMeshEx, iTextures, iMaterial, iShader);
m_Color.Clear();
m_TimeStamp = 0;
m_TimeDelay = 1000;
m_Locked = false;
m_Active = false;
m_ColorBrightness = 1;
m_OriginalColor.Clear();
m_FadeDelta = 0.0000f;
}
The SetColor() function sets the color of the particle, including the particle's material, in terms of the
material's ambient, diffuse, and emissive properties. (See Listing 7-33.)
Listing 7-33. Setting the Particle's Color
void SetColor(Vector3 value)
{
m_Color.x = value.x;
m_Color.y = value.y;
m_Color.z = value.z;
GetMaterial().SetAmbient(value.x, value.y, value.z);
GetMaterial().SetDiffuse(value.x, value.y, value.z);
GetMaterial().SetEmissive(value.x, value.y, value.z);
}
The SetActiveStatus() function sets the active status of the particle and also resets the particle's
color brightness level to 100%. (See Listing 7-34.)
Listing 7-34. Setting the Active Status
void SetActiveStatus(boolean value)
{
m_Active = value;
// Reset Brightness Level
m_ColorBrightness= 1;
}
The Destroy() function resets the particle to its initial state. (See Listing 7-35.)
 
Search WWH ::




Custom Search