void makeShadowMatrix(sgMat4 sm, float x, float y)
{
  sgVec4  plane, light;
  (void)Global::scenery->getHeightAndPlane(x, y, plane);

  light[0] = lightposn[0];
  light[1] = lightposn[1];
  light[2] = lightposn[2];
  light[3] = 0;

  sgNormaliseVec4(light);
  ShadowMatrix(plane, light, sm);
}
Beispiel #2
0
bool MyShape::setKineticEnergy(float newKineticEnergy)
{
    bool moving;
    sgVec4 curVelocity;
    getVelocity( curVelocity );
    if ( sgLengthVec4( curVelocity ) == 0 )
    {
        moving = false;
    }
    else
    {
        sgVec4 newVelocity;
        sgNormaliseVec4(newVelocity, curVelocity );

        float totalVelocity = sqrt( newKineticEnergy ) / mass * 2;
        sgScaleVec4( newVelocity, totalVelocity );
        setVelocity( newVelocity );
        moving = true;
    }

    return moving;
}