/*********************************************************** operator * ***********************************************************/ LbaQuaternion LbaQuaternion::operator *(const LbaQuaternion & q) const { return LbaQuaternion( W*q.X + q.W*X + Y*q.Z - q.Y*Z, W*q.Y + q.W*Y + Z*q.X - q.Z*X, W*q.Z + q.W*Z + X*q.Y - q.X*Y, W*q.W - X*q.X - Y*q.Y - Z*q.Z); }
/*********************************************************** Constructor ***********************************************************/ PhysicalDescriptionTriangleMesh::PhysicalDescriptionTriangleMesh(float posX, float posY, float posZ, const std::string &FileName) :PhysicalDescriptionWithShape(posX, posY, posZ, 1, 0, LbaQuaternion()), MeshInfoDataFileName(FileName) { }
/*********************************************************** update model ***********************************************************/ void OsgObjectHandler::UpdateModel(const LbaNet::ModelInfo &mInfo) { if(_uselight) { if(_OsgObject) OsgHandler::getInstance()->RemoveActorNode(_sceneidx, _OsgObject, true); } else { if(_OsgObjectNoLight) OsgHandler::getInstance()->RemoveActorNode(_sceneidx, _OsgObjectNoLight, false); } osg::ref_ptr<osg::MatrixTransform> node; boost::shared_ptr<DisplayTransformation> Tr(new DisplayTransformation());; Tr->translationX = mInfo.TransX; Tr->translationY = mInfo.TransY; Tr->translationZ = mInfo.TransZ; Tr->rotation = LbaQuaternion(mInfo.RotX, mInfo.RotY, mInfo.RotZ); Tr->scaleX = mInfo.ScaleX; Tr->scaleY = mInfo.ScaleY; Tr->scaleZ = mInfo.ScaleZ; if(mInfo.TypeRenderer == LbaNet::RenderSprite) { node = OsgHandler::getInstance()->CreateSpriteObject(_sceneidx, mInfo.ModelName, mInfo.ColorR, mInfo.ColorG, mInfo.ColorB, mInfo.ColorA, Tr, mInfo.UseLight, mInfo.CastShadow, mInfo.UseBillboard); } else { if(mInfo.ModelName != "") node = OsgHandler::getInstance()->CreateSimpleObject(_sceneidx, mInfo.ModelName, Tr, mInfo.UseLight, mInfo.CastShadow); } if(_uselight) _OsgObject = node; else _OsgObjectNoLight = node; UpdateMatrix(); RefreshText(); }
/*********************************************************** build description into a reald physic object ***********************************************************/ boost::shared_ptr<PhysicalObjectHandlerBase> PhysicalDescriptionNoShape::BuildSelf( boost::shared_ptr<PhysXEngine> _PEngine) const { return boost::shared_ptr<PhysicalObjectHandlerBase>( new SimplePhysicalObjectHandler(positionX, positionY, positionZ, LbaQuaternion())); }