//---------------------------------------------------------------------------- Character::Character() : mAnimType(AT_SKELETON), mDefaultAnimID(0), mBaseHPCurLevel(0.0f), mIsDieDoDelete(true), mBaseAPCurLevel(0.0f), mIsDead(false), mIsMovableAutoWorldBound(true), mMovableAutoWorldBoundRadius(2.0f) { SetName("Chara"); PX2_INIT_PM_F(HP); PX2_INIT_PM_F(AP); VertexFormat *vf = PX2_GR.GetVertexFormat(GraphicsRoot::VFT_PC); StandardMesh stdMesh(vf); stdMesh.SetVertexColor(Float4(1.0f, 0.0f, 0.0f, 1.0f)); TriMesh *mesh = stdMesh.Box(0.5f, 0.5f, 0.5f); PX2::VertexColor4MaterialPtr mtl = new0 VertexColor4Material(); mtl->GetWireProperty(0, 0)->Enabled = true; mtl->GetCullProperty(0, 0)->Enabled = false; mesh->LocalTransform.SetUniformScale(0.5f); mesh->SetMaterialInstance(mtl->CreateInstance()); CreateGetHelpNode()->DetachAllChildren(); CreateGetHelpNode()->AttachChild(mesh); CreateGetHelpNode()->SetParentTransformIngore(false, false, true); }
//---------------------------------------------------------------------------- LightActor::LightActor () : mLightType(LT_POINT), mRange(2.0f), mColor(Float3::MakeColor(128, 128, 128)) { mLight = new0 Light(Light::LT_POINT); LightNode *lightNode = new0 LightNode(mLight); SetMovable(lightNode); VertexFormat *vf = VertexFormat::Create(3, VertexFormat::AU_POSITION, VertexFormat::AT_FLOAT3, 0, VertexFormat::AU_NORMAL, VertexFormat::AT_FLOAT3, 0, VertexFormat::AU_COLOR, VertexFormat::AT_FLOAT3, 0); Node *helpNode = new0 Node (); PX2::VertexColor4MaterialPtr mtl = new0 VertexColor4Material(); mtl->GetWireProperty(0, 0)->Enabled = true; mtl->GetCullProperty(0, 0)->Enabled = false; MaterialInstancePtr mtlInst = mtl->CreateInstance(); StandardMesh stdMesh(vf); stdMesh.SetVertexColor(Float4(0.0f,1.0f,0.0f,1.0f)); TriMesh *mesh = stdMesh.Octahedron(); mesh->LocalTransform.SetUniformScale(0.5f); mesh->SetMaterialInstance(mtlInst); helpNode->AttachChild(mesh); TriMesh *box = stdMesh.Box(0.005f, 0.005f, 5.0f); box->LocalTransform.SetTranslate(APoint(0.0f, 0.0f, -5.5f)); box->SetMaterialInstance(mtlInst); helpNode->AttachChild(box); SetHelpMovable(helpNode); ShowHelpMovable(true); SetColor(mColor); }
//---------------------------------------------------------------------------- LightActor::LightActor() { SetName("LightActor"); mLight = new0 Light(Light::LT_POINT); mLightNode = new0 LightNode(mLight); SetMovable(mLightNode); Node *helpNode = new0 Node(); VertexFormat *vf = PX2_GR.GetVertexFormat(GraphicsRoot::VFT_PC); PX2::VertexColor4MaterialPtr mtl = new0 VertexColor4Material(); mtl->GetWireProperty(0, 0)->Enabled = true; mtl->GetCullProperty(0, 0)->Enabled = false; MaterialInstancePtr mtlInst = mtl->CreateInstance(); StandardMesh stdMesh(vf); stdMesh.SetVertexColor(Float4(1.0f, 1.0f, 0.0f, 1.0f)); TriMesh *mesh = stdMesh.Octahedron(); mesh->LocalTransform.SetUniformScale(0.5f); mesh->SetMaterialInstance(mtlInst); helpNode->AttachChild(mesh); TriMesh *box = stdMesh.Box(0.005f, 0.005f, 5.0f); box->LocalTransform.SetTranslate(APoint(0.0f, 0.0f, -5.5f)); box->SetMaterialInstance(mtlInst); helpNode->AttachChild(box); CreateGetHelpNode()->AttachChild(helpNode); CreateGetHelpNode()->SetParentTransformIngore(false, false, true); WorldBoundIsCurrent = true; SetRadius(1.0f); }