Vec3f QuadParticleSystemDrawer::getQuadUpDir(DrawEnv *pEnv,
                                             ParticleSystemUnrecPtr System,
                                             UInt32 Index,
                                             const Matrix& CameraToObject )
{
    Vec3f Direction;

    switch(getUpSource())
    {
        case UP_POSITION_CHANGE:
            Direction = System->getPositionChange(Index);
            Direction.normalize();
            break;
        case UP_VELOCITY_CHANGE:
            Direction = System->getVelocityChange(Index);
            Direction.normalize();
            break;
        case UP_VELOCITY:
            Direction = System->getVelocity(Index);
            Direction.normalize();
            break;
        case UP_ACCELERATION:
            Direction = System->getAcceleration(Index);
            Direction.normalize();
            break;
        case UP_PARTICLE_NORMAL:
            Direction = System->getNormal(Index);
            break;
        case UP_STATIC:
            Direction = getUp();
            break;
        case UP_VIEW_DIRECTION:
        default:
            {
                Direction.setValues(CameraToObject[1][0],CameraToObject[1][1],CameraToObject[1][2]);
                break;
            }
    }

    return Direction;
}
Vec3f QuadParticleSystemDrawer::getQuadUpDir(DrawEnv *pEnv, ParticleSystemUnrecPtr System, UInt32 Index)
{
	Vec3f Direction;
	
	switch(getUpSource())
	{
	case UP_POSITION_CHANGE:
		Direction = System->getPositionChange(Index);
		break;
	case UP_VELOCITY_CHANGE:
		Direction = System->getVelocityChange(Index);
		break;
	case UP_VELOCITY:
		Direction = System->getVelocity(Index);
		break;
	case UP_ACCELERATION:
		Direction = System->getAcceleration(Index);
		break;
	case UP_PARTICLE_NORMAL:
		Direction = System->getNormal(Index);
		break;
	case UP_STATIC:
		Direction = getUp();
		break;
	case UP_VIEW_DIRECTION:
	default:
		{
            Matrix ModelView(pEnv->getCameraViewing()); 
            ModelView.mult(pEnv->getObjectToWorld());
			Direction.setValues(ModelView[0][1],ModelView[1][1],ModelView[2][1]);
		break;
		}
	}

	return Direction;
}