Views |
|
OneTetrahedron
[edit] How to implement an animation model different from the visual model ?[edit] The codeThe code relative to this example is located in :
There is just a Main.ccp with less than 100 lines. Open and observe it.
[edit] The scene graph
[edit] More comments
Sofa::Components::Graph::GNode* groot = new sofa::Components::Graph::GNode; ...
Sofa::Components::CGImplicitSolver* solver = new Sofa::Components::CGImplicitSolver; ...
Sofa::Components::Gravity* gravity = new Sofa::Components::Gravity; ...
Sofa::Core::MechanicalObject<MyTypes>* DOF = new Sofa::Core::MechanicalObject<MyTypes>; ...
Sofa::Components::UniformMass<MyTypes,double>* mass = new Sofa::Components::UniformMass<MyTypes,double>(DOF); ...
Sofa::Components::MeshTopology* topology = new Sofa::Components::MeshTopology; ...
Sofa::Components::FixedConstraint<MyTypes>* constraints = new Sofa::Components::FixedConstraint<MyTypes>(DOF); ...
Sofa::Components::TetrahedronFEMForceField<MyTypes>* spring = new Sofa::Components::TetrahedronFEMForceField<MyTypes>(DOF); ...
Sofa::Components::Graph::GNode* skin = new Sofa::Components::Graph::GNode; ...
Sofa::Components::GL::OglModel* visual = new Sofa::Components::GL::OglModel();
visual->load("../../../Data/VisualModels/liver-smooth.obj", "", "");
MyMapping* mapping = new MyMapping(DOF, visual); ...
[edit] The mapping type between the visual and animation modelsHere a BarycentricMapping is used to map the visual model to the animation model.
This type is templated and you can find some examples of uses at the end of the file By analogy, we have built MyMapping type :
typedef Sofa::Components::BarycentricMapping<
Sofa::Core::Mapping<
Sofa::Core::MechanicalModel<MyTypes>,
Sofa::Core::MappedModel<
Sofa::Components::Common::ExtVectorTypes<
Sofa::Components::Common::Vec<3,GLfloat>,
Sofa::Components::Common::Vec<3,GLfloat>
>
>
>
> MyMapping;
|
|
| This page was last modified 15:38, 2 January 2007. |