Vec3f QuadParticleSystemDrawer::getQuadNormal(DrawEnv *pEnv, ParticleSystemUnrecPtr System, UInt32 Index) { Vec3f Direction; switch(getNormalSource()) { case NORMAL_POSITION_CHANGE: Direction = System->getPositionChange(Index); Direction.normalize(); break; case NORMAL_VELOCITY_CHANGE: Direction = System->getVelocityChange(Index); Direction.normalize(); break; case NORMAL_VELOCITY: Direction = System->getVelocity(Index); Direction.normalize(); break; case NORMAL_ACCELERATION: Direction = System->getAcceleration(Index); Direction.normalize(); break; case NORMAL_PARTICLE_NORMAL: Direction = System->getNormal(Index); break; case NORMAL_VIEW_POSITION: { //TODO: make this more efficient Matrix ModelView(pEnv->getCameraViewing()); Pnt3f Position(ModelView[0][3],ModelView[1][3],ModelView[2][3]); Direction = Position - System->getPosition(Index); Direction.normalize(); break; } case NORMAL_STATIC: Direction = getNormal(); break; case NORMAL_VIEW_DIRECTION: default: { Matrix ModelView(pEnv->getCameraViewing()); ModelView.mult(pEnv->getObjectToWorld()); Direction.setValues(ModelView[0][2],ModelView[1][2],ModelView[2][2]); break; } } return Direction; }
Vec3f QuadParticleSystemDrawer::getQuadNormal(DrawEnv *pEnv, ParticleSystemUnrecPtr System, UInt32 Index, const Matrix& CameraToObject ) { Vec3f Direction; switch(getNormalSource()) { case NORMAL_POSITION_CHANGE: Direction = System->getPositionChange(Index); Direction.normalize(); break; case NORMAL_VELOCITY_CHANGE: Direction = System->getVelocityChange(Index); Direction.normalize(); break; case NORMAL_VELOCITY: Direction = System->getVelocity(Index); Direction.normalize(); break; case NORMAL_ACCELERATION: Direction = System->getAcceleration(Index); Direction.normalize(); break; case NORMAL_PARTICLE_NORMAL: Direction = System->getNormal(Index); break; case NORMAL_VIEW_POSITION: { Direction = Pnt3f(CameraToObject[3][0],CameraToObject[3][1],CameraToObject[3][2]) - System->getPosition(Index); Direction.normalize(); break; } case NORMAL_STATIC: Direction = getNormal(); break; case NORMAL_VIEW_DIRECTION: default: { Direction.setValues(CameraToObject[2][0],CameraToObject[2][1],CameraToObject[2][2]); break; } } return Direction; }