Beispiel #1
0
	void iEntity3D::SaveDataSetup(cSaveObjectHandler *apSaveObjectHandler, cGame *apGame)
	{
		kSaveData_SetupBegin(iEntity3D);
		
		//Log("-------- Setup %s --------------\n",msName.c_str());

		//kSaveData_LoadObject(mpParent,mlParentId,iEntity3D*);
		//kSaveData_LoadIdList(mlstChildren,mlstChildren,iEntity3D*);
		if(pData->mlParentId!=-1 && mpParent == NULL)
		{
			iEntity3D *pParentEntity = static_cast<iEntity3D*>(apSaveObjectHandler->Get(pData->mlParentId));
			if(pParentEntity)
				pParentEntity->AddChild(this);
			else
				Error("Couldn't find parent entity id %d for '%s'\n",pData->mlParentId,GetName().c_str());
		}

		cContainerListIterator<int> it = pData->mlstChildren.GetIterator();
		while(it.HasNext())
		{
			int mlId = it.Next();
			if(mlId != -1)
			{
				iEntity3D *pChildEntity = static_cast<iEntity3D*>(apSaveObjectHandler->Get(mlId));
				if(pChildEntity)
					AddChild(pChildEntity);
				else
					Error("Couldn't find child entity id %d for '%s'\n",mlId,GetName().c_str());
			}
		}


		SetTransformUpdated(true);
	}
Beispiel #2
0
	void iEntity3D::SetPosition(const cVector3f& avPos)
	{
		m_mtxLocalTransform.m[0][3] = avPos.x;
		m_mtxLocalTransform.m[1][3] = avPos.y;
		m_mtxLocalTransform.m[2][3] = avPos.z;

		SetTransformUpdated();
	}
Beispiel #3
0
	void iLight3D::SetFarAttenuation(float afX)
	{
		mfFarAttenuation = afX;

		mbUpdateBoundingVolume = true;

		//This is so that the render container is updated.
		SetTransformUpdated();
	}
	void cLight3DSpot::SaveDataSetup(cSaveObjectHandler *apSaveObjectHandler, cGame *apGame)
	{
		kSaveData_SetupBegin(cLight3DSpot);

		//Make sure all is updated.
		SetTransformUpdated();
		mbProjectionUpdated = true;
		mbViewProjUpdated = true;
		mbFrustumUpdated = true;
	}
	void cLight3DSpot::SetFarAttenuation(float afX)
	{
		mfFarAttenuation = afX;

		UpdateBoundingVolume();

		//This is so that the render container is updated.
		SetTransformUpdated();
		mbProjectionUpdated = true;
	}
Beispiel #6
0
	void iLight3D::UpdateLogic(float afTimeStep)
	{
		UpdateLight(afTimeStep);
		if(mfFadeTime>0 || mbFlickering)
		{
			mbUpdateBoundingVolume = true;

			//This is so that the render container is updated.
			SetTransformUpdated();
		}
	}
Beispiel #7
0
void cBillboard::SetAxis(const cVector3f& avAxis)
{
    mvAxis = avAxis;
    mvAxis.Normalise();

    //This is a quick fix so the bounding box is correct for non up-pointing axises
    if(mType == eBillboardType_Axis && mvAxis != cVector3f(0,1,0))
        {
            float fMax = mvSize.x;
            if(fMax < mvSize.y) fMax = mvSize.y;

            fMax *= kSqrt2f;

            mBoundingVolume.SetSize(fMax);

            SetTransformUpdated();
        }
}
Beispiel #8
0
	void iEntity3D::SetMatrix(const cMatrixf& a_mtxTransform)
	{
		m_mtxLocalTransform = a_mtxTransform;

		SetTransformUpdated();
	}