commit x64 compilation from lulu cause the other branch dont seems to compile properly at home
This commit is contained in:
69
include/engine/physic/physic_wheel.cpp
Normal file
69
include/engine/physic/physic_wheel.cpp
Normal file
@ -0,0 +1,69 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
GSFramework
|
||||
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
|
||||
----------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
#include "physic/physic_wheel.h"
|
||||
#include "math/matrix4.h"
|
||||
#include "metafile/nml.h"
|
||||
#include "log/log.h"
|
||||
|
||||
using namespace GS::S3D;
|
||||
using GS::NML::Tag;
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool PhysicWheel::FromMetaTag(Tag &tag)
|
||||
{
|
||||
if (tag.name != "PhysicWheel")
|
||||
__ERR__(__LOG_E__ << "Could not parse physic wheel, incorrect root tag (" << tag.name << ").\n", false)
|
||||
|
||||
// Parse root tags.
|
||||
NMLTagForeach(pt, tag)
|
||||
{
|
||||
if (pt->name == "Friction") friction = pt->GetReal();
|
||||
else if (pt->name == "Radius") radius = pt->GetReal();
|
||||
|
||||
else if (pt->name == "RefMatrix") ref_matrix.FromMetaTag(*pt);
|
||||
|
||||
else if (pt->name == "RestLength") rest_length = pt->GetReal();
|
||||
else if (pt->name == "MaxCompression") max_compression = pt->GetReal();
|
||||
else if (pt->name == "Stiffness") stiffness = pt->GetReal();
|
||||
else if (pt->name == "Damping") damping = pt->GetReal();
|
||||
|
||||
else __LOG_W__ << "Unknown tag '" << pt->name << "' in <PhysicWheel>.\n";
|
||||
}
|
||||
return true;
|
||||
}
|
||||
Tag *PhysicWheel::AsMetaTag() const
|
||||
{
|
||||
Tag *root = new Tag("PhysicWheel");
|
||||
if (!root)
|
||||
__ERR__(__LOG_E__ << "Could not create physic wheel root tag to serialize.\n", NULL)
|
||||
|
||||
root->AddChild("Friction", friction);
|
||||
root->AddChild("Radius", radius);
|
||||
|
||||
root->AddChild(ref_matrix.AsMetaTag("RefMatrix"));
|
||||
|
||||
root->AddChild("RestLength", rest_length);
|
||||
root->AddChild("MaxCompression", max_compression);
|
||||
root->AddChild("Stiffness", stiffness);
|
||||
root->AddChild("Damping", damping);
|
||||
return root;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
PhysicWheel::PhysicWheel()
|
||||
{
|
||||
ref_matrix = Matrix4::IdentityMatrix();
|
||||
|
||||
friction = 50.f;
|
||||
radius = 0.3f;
|
||||
|
||||
rest_length = 1.0f;
|
||||
max_compression = 2.0f;
|
||||
stiffness = 30.f;
|
||||
damping = 0.25f;
|
||||
}
|
||||
Reference in New Issue
Block a user