More Related Content Similar to WaveEngine 3D components (20) WaveEngine 3D components4. Components 3D
Components Behavior Drawable
• Transform3D
• Model
• SkinnedModel
• MaterialsMap
• ParticleSystem3D
• Joint3D
• Collider3D
• Animation3D
• Spinner
• RigidBody3D
• ModelRenderer
• SkinedModelRenderer
• ParticleSystemRenderer3d
6. To draw a primitive cube
Entity cube = new Entity(“mycube")
.AddComponent(new Transform3D())
.AddComponent(new MaterialsMap())
.AddComponent(Model.CreateCube())
.AddComponent(new ModelRenderer());
EntityManager.Add(cube);
7. Transfom3D
.AddComponent(new Transform3D()
{
Position = new Vector3(0, 10, 0), // Default: (0,0,0)
Rotation = new Vector3(0, (float)Math.PI, 0), //Default: (0,0,0)
Scale = new Vector3(3, 3, 3), // Default: (1,1,1)
})
9. MaterialsMap - BasicMaterial
Entity cube = new Entity(“mycube")
.AddComponent(new Transform3D())
.AddComponent(new MaterialsMap(
new BasicMaterial("Context/mytexture.wpk"))
)
.AddComponent(Model.CreateCube())
.AddComponent(new ModelRenderer());
EntityManager.Add(cube);
10. MaterialsMap - BasicMaterial
Entity cube = new Entity(“mycube")
.AddComponent(new Transform3D())
.AddComponent(new MaterialsMap(
new NormalMappingMaterial(“difuse.wpk", "normal.wpk"))
)
.AddComponent(Model.CreateCube())
.AddComponent(new ModelRenderer());
EntityManager.Add(cube);
11. Model - Primitives
• Primitives
• Cube
• Cone
• Cylinder
• Pyramid
• Sphere
• Torus
• Capsule
• Plane
• Teapot
12. Model – From file
• Load from File .DAE, .FBX, .Obj, .3DS y .X
13. Model – From file
Entity car = new Entity(“myCar")
.AddComponent(new Transform3D())
.AddComponent(new MaterialsMap()
.AddComponent(new Model(“Content/Car.wpk”))
.AddComponent(new ModelRenderer());
EntityManager.Add(cube);
15. Animated Model – From file
Entity player = new Entity(“myplayer")
.AddComponent(new Transform3D())
.AddComponent(new MaterialsMap()
.AddComponent(new SkinnedModel("Content/model.wpk"))
.AddComponent(new Animation3D("Content/animation.wpk"))
.AddComponent(new SkinnedModelRenderer());
EntityManager.Add(cube);
17. Collision detection
Entity cube = new Entity(“mycube")
.AddComponent(new Transform3D())
.AddComponent(new BoxCollider())
.AddComponent(new MaterialsMap())
.AddComponent(Model.CreateCube())
.AddComponent(new ModelRenderer());
EntityManager.Add(cube);
BoxCollider collider = cube.FindComponent<BoxCollider>();
collider.Intersects(...);
19. 3D Particle System
Entity smokeParticles = new Entity(“myParticles")
.AddComponent(new Transform3D())
.AddComponent(new ParticleSystem3D() { //Parameters })
.AddComponent(new MaterialsMap(
new BasicMaterial("Content/particleTexture.wpk“,
DefaultLayers.Alpha)))
.AddComponent(new ParticleSystemRenderer3D());
EntityManager.Add(smokeParticles);
20. 3D Particle System
.AddComponent(new ParticleSystem3D()
{ //Parameters
NumParticles = 100,
EmitRate = 1500,
MinLife = TimeSpan.FromSeconds(1f), MaxLife = TimeSpan.FromSeconds(3f),
LocalVelocity = new Vector3(0f, 0f,0f),
RandomVelocity = new Vector3(3f, 2.5f,0f),
MinSize = 15, MaxSize = 40,
MinRotateSpeed = 0.03f, MaxRotateSpeed = -0.03f,
EndDeltaScale = 0f,
EmitterSize = new Vector2(30),
Gravity = new Vector2(0, 0.03f),
EmitterShape = ParticleSystem2D.Shape.FillCircle,
Emit = false,
})
21. 3D Physic components
• Wave engine integrates the Bepu physic engine.
• Offers a component based interface.
22. 3D Physic components
Entity cube = new Entity("myCube")
.AddComponent(new Transform3D())
.AddComponent(new BoxCollider())
.AddComponent(new RigidBody3D() { //Parameters})
.AddComponent(new MaterialsMap())
.AddComponent(Model.CreateCube())
.AddComponent(new ModelRenderer());
EntityManager.Add(cube);
23. 3D Physic components
.AddComponent(new RigidBody3D()
{ //Parameters
EnableContinuousContact = true, // Default : false
Mass = 4f, // Default: 1f
IsKinematic = true, // Default: false
KineticFriction = 4f, // Default: 0.3f
StaticFriction = 4f, // Default: 0.6f
LinearVelocity = new Vector3(1, 0, 0), // Default (0,0,0)
AngularVelocity = Vector3.Zero, // Default (0,0,0)
Rotation = new Vector3(0, (float)Math.PI, 0), // Default (0,0,0)
Restitution = 4f, // Default: 0
})
24. 3D Physic components
Joint3D
• BallSocketJoint
• FixedJoint
• HingeJoint
• LineSliderJoint
• MotorizedGrabSpring3D
• PlaneSliderJoint
• PrismaticJoint
• SwivelHingeJoint
• UniversalJoint