Changeset 1599 for trunk/test


Ignore:
Timestamp:
Jul 8, 2012, 8:26:36 PM (8 years ago)
Author:
touky
Message:

EasyMesh : Fixed normals on disc when one of the radius == 0
EasyPhysics : Added Cone primitive.

Location:
trunk/test
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/PhysicObject.h

    r1597 r1599  
    5454                MeshRand << "[sc#aad asph16 2 2 2]";
    5555
     56                int ConeLimit = MeshRand.Count();
     57
     58                MeshRand << "[sc#add scb#add ad16 2 0 rx180 ty-1 ac16 2 2 0 0 0]";
     59                MeshRand << "[sc#dad scb#dad ad16 2 0 rx180 ty-1 ac16 2 2 0 0 0]";
     60                MeshRand << "[sc#dda scb#dda ad16 2 0 rx180 ty-1 ac16 2 2 0 0 0]";
     61                MeshRand << "[sc#daa scb#daa ad16 2 0 rx180 ty-1 ac16 2 2 0 0 0]";
     62                MeshRand << "[sc#ada scb#ada ad16 2 0 rx180 ty-1 ac16 2 2 0 0 0]";
     63                MeshRand << "[sc#aad scb#aad ad16 2 0 rx180 ty-1 ac16 2 2 0 0 0]";
    5664
    5765                int RandValue = (int)(lol::RandF() * (MeshRand.Count() - 1));
     
    5967                m_mesh.Compile(MeshRand[RandValue]);
    6068                vec3 BoxSize = vec3(2.0f);
    61                 if (RandValue >= SphereLimit)
     69                if (RandValue >= SphereLimit && RandValue < ConeLimit)
    6270                        m_physics.SetShapeToSphere(BoxSize.x);
     71                else if (RandValue >= ConeLimit)
     72                        m_physics.SetShapeToCone(BoxSize.x, BoxSize.y);
    6373                else
    6474                        m_physics.SetShapeToBox(BoxSize);
  • trunk/test/Physics/EasyPhysics.cpp

    r1597 r1599  
    7272{
    7373        SetShapeTo(new btSphereShape(radius * LOL2BT_UNIT * LOL2BT_SIZE));
     74}
     75
     76void EasyPhysics::SetShapeToCone(float radius, float height)
     77{
     78        SetShapeTo(new btConeShape(     radius * LOL2BT_UNIT,
     79                                                                height * LOL2BT_UNIT));
    7480}
    7581
  • trunk/test/Physics/EasyPhysics.h

    r1597 r1599  
    3838        void SetShapeToBox(lol::vec3& box_size);
    3939        void SetShapeToSphere(float radius);
     40        void SetShapeToCone(float radius, float height);
    4041        void SetBaseTransform(const lol::vec3& base_location, const lol::quat& base_rotation=lol::quat(lol::mat4(1.0f)));
    4142        void SetMass(float mass);
     
    6364
    6465        void SetShapeToBox(lol::vec3& BoxSize) { }
     66        void SetShapeToSphere(float radius) { }
    6567        void SetBaseTransform(const lol::vec3& base_location, const lol::quat& base_rotation=lol::quat(lol::mat4(1.0f))) { }
    6668        void SetMass(float mass) { }
Note: See TracChangeset for help on using the changeset viewer.