コード例 #1
0
Pnt3f LineParticleSystemDrawer::getLineEndpoint(ParticleSystemUnrecPtr System,
                                                UInt32 Index) const
{
	Vec3f Direction;

	//Calculate Direction
	switch(getLineDirectionSource())
	{
	case DIRECTION_POSITION_CHANGE:
		Direction = System->getPositionChange(Index);
		break;
	case DIRECTION_VELOCITY_CHANGE:
		Direction = System->getVelocityChange(Index);
		break;
	case DIRECTION_VELOCITY:
		Direction = System->getVelocity(Index);
		break;
	case DIRECTION_ACCELERATION:
		Direction = System->getAcceleration(Index);
		break;
	case DIRECTION_STATIC:
		Direction = getLineDirection();
		break;
	case DIRECTION_NORMAL:
	default:
		Direction = System->getNormal(Index);
		break;
	}


	//Calculate Length
	Real32 LineLength;

	switch(getLineLengthSource())
	{
	case LENGTH_SIZE_X:
		LineLength = System->getSize(Index).x();
		break;
	case LENGTH_SIZE_Y:
		LineLength = System->getSize(Index).y();
		break;
	case LENGTH_SIZE_Z:
		LineLength = System->getSize(Index).z();
		break;
	case LENGTH_SPEED:
		LineLength = System->getVelocity(Index).length();
		break;
	case LENGTH_ACCELERATION:
		LineLength = System->getAcceleration(Index).length();
		break;
	case LENGTH_STATIC:
		default:
		LineLength = getLineLength();   ///could not find anything, line length field
		break;
		}
    LineLength *= getLineLengthScaling();
		
	return System->getPosition(Index)+(LineLength*Direction);

}
コード例 #2
0
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;
}
コード例 #3
0
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;
}
コード例 #4
0
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;
}