コード例 #1
0
ファイル: PhysicsMgr.cpp プロジェクト: RileyA/LD21
void PhysicsMgr::update(Real delta)
{
	if(started)
	{
		mAccumulation += delta;

		while(mAccumulation>=mTimeStep)
		{
			mDynamicsWorld->stepSimulation(mTimeStep,0);

			for(unsigned int i=0;i<mObjects.size();++i)
			{
				if(!mObjects[i]->readyForDelete())
				{
					mObjects[i]->update(true,0,getLocalGravity(mObjects[i]->getPosition()));
				}
				else
				{
					delete mObjects[i];
					mObjects[i] = 0;
					mObjects.erase(mObjects.begin()+i);
					--i;
				}
			}
			mAccumulation -= mTimeStep;
		}

		mInterpolation = mAccumulation/mTimeStep;

		for(unsigned int i=0;i<mObjects.size();++i)
		{
			mObjects[i]->update(false,mInterpolation,mGlobalGravity);
		}
	}
}
コード例 #2
0
void ParticleEffectEntityItem::appendSubclassData(OctreePacketData* packetData, EncodeBitstreamParams& params,
                                                  EntityTreeElementExtraEncodeData* modelTreeElementExtraEncodeData,
                                                  EntityPropertyFlags& requestedProperties,
                                                  EntityPropertyFlags& propertyFlags,
                                                  EntityPropertyFlags& propertiesDidntFit,
                                                  int& propertyCount,
                                                  OctreeElement::AppendState& appendState) const {

    bool successPropertyFits = true;
    APPEND_ENTITY_PROPERTY(PROP_COLOR, getColor());
    APPEND_ENTITY_PROPERTY(PROP_ANIMATION_FPS, getAnimationFPS());
    APPEND_ENTITY_PROPERTY(PROP_ANIMATION_FRAME_INDEX, getAnimationFrameIndex());
    APPEND_ENTITY_PROPERTY(PROP_ANIMATION_PLAYING, getAnimationIsPlaying());
    APPEND_ENTITY_PROPERTY(PROP_ANIMATION_SETTINGS, getAnimationSettings());
    APPEND_ENTITY_PROPERTY(PROP_SHAPE_TYPE, (uint32_t)getShapeType());
    APPEND_ENTITY_PROPERTY(PROP_MAX_PARTICLES, getMaxParticles());
    APPEND_ENTITY_PROPERTY(PROP_LIFESPAN, getLifespan());
    APPEND_ENTITY_PROPERTY(PROP_EMIT_RATE, getEmitRate());
    APPEND_ENTITY_PROPERTY(PROP_EMIT_DIRECTION, getEmitDirection());
    APPEND_ENTITY_PROPERTY(PROP_EMIT_STRENGTH, getEmitStrength());
    APPEND_ENTITY_PROPERTY(PROP_LOCAL_GRAVITY, getLocalGravity());
    APPEND_ENTITY_PROPERTY(PROP_PARTICLE_RADIUS, getParticleRadius());
    APPEND_ENTITY_PROPERTY(PROP_TEXTURES, getTextures());
}