| @@ -206,7 +206,7 @@ void BtPhysTest::InitApp() | |||||
| } | } | ||||
| #endif //USE_WALL | #endif //USE_WALL | ||||
| PhysicsObject* BasePhyobj = NULL; | |||||
| PhysicsObject* BasePhyobj = nullptr; | |||||
| #if USE_PLATFORM | #if USE_PLATFORM | ||||
| { | { | ||||
| quat NewRotation = quat::fromeuler_xyz(0.f, 0.f, 0.f); | quat NewRotation = quat::fromeuler_xyz(0.f, 0.f, 0.f); | ||||
| @@ -617,7 +617,7 @@ void BtPhysTest::TickGame(float seconds) | |||||
| if (m_simulation->RayHits(HitResult, ERT_Closest, Character->GetTransform()[3].xyz, (Character->GetTransform()[3].xyz + vec3(.0f, -1.f, .0f)), Character)) | if (m_simulation->RayHits(HitResult, ERT_Closest, Character->GetTransform()[3].xyz, (Character->GetTransform()[3].xyz + vec3(.0f, -1.f, .0f)), Character)) | ||||
| Character->AttachTo(HitResult.m_collider_list[0], true, true); | Character->AttachTo(HitResult.m_collider_list[0], true, true); | ||||
| else | else | ||||
| Character->AttachTo(NULL); | |||||
| Character->AttachTo(nullptr); | |||||
| } | } | ||||
| } | } | ||||
| #endif //USE_CHARACTER | #endif //USE_CHARACTER | ||||
| @@ -690,7 +690,7 @@ void BtPhysTest::TickDraw(float seconds, Scene &scene) | |||||
| m_cat_sdata->m_tex_uniform = m_cat_texture->GetTexture()->GetTextureUniform(); | m_cat_sdata->m_tex_uniform = m_cat_texture->GetTexture()->GetTextureUniform(); | ||||
| m_cat_sdata->m_sprite_flip = ((rand(2) == 1)?(1.f):(0.f)) / (float)(NB_SPRITE * PARTICLE_SIZE); | m_cat_sdata->m_sprite_flip = ((rand(2) == 1)?(1.f):(0.f)) / (float)(NB_SPRITE * PARTICLE_SIZE); | ||||
| PhysObj->SetCustomShaderData(m_cat_sdata); | PhysObj->SetCustomShaderData(m_cat_sdata); | ||||
| m_cat_sdata = NULL; | |||||
| m_cat_sdata = nullptr; | |||||
| } | } | ||||
| #endif //USE_BODIES | #endif //USE_BODIES | ||||
| #endif //CAT_MODE | #endif //CAT_MODE | ||||
| @@ -1,12 +1,14 @@ | |||||
| // | // | ||||
| // Lol Engine | |||||
| // Lol Engine | |||||
| // | // | ||||
| // Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net> | |||||
| // (c) 2009-2013 Benjamin "Touky" Huet <huet.benjamin@gmail.com> | |||||
| // This program is free software; you can redistribute it and/or | |||||
| // modify it under the terms of the Do What The Fuck You Want To | |||||
| // Public License, Version 2, as published by Sam Hocevar. See | |||||
| // http://www.wtfpl.net/ for more details. | |||||
| // Copyright © 2009—2015 Benjamin “Touky” Huet <huet.benjamin@gmail.com> | |||||
| // © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||||
| // | |||||
| // This library is free software. It comes without any warranty, to | |||||
| // the extent permitted by applicable law. You can redistribute it | |||||
| // and/or modify it under the terms of the Do What the Fuck You Want | |||||
| // to Public License, Version 2, as published by the WTFPL Task Force. | |||||
| // See http://www.wtfpl.net/ for more details. | |||||
| // | // | ||||
| #pragma once | #pragma once | ||||
| @@ -40,8 +42,8 @@ class EasyCharacterController : public EasyPhysic, | |||||
| public: | public: | ||||
| EasyCharacterController(WorldEntity* NewOwnerEntity) : | EasyCharacterController(WorldEntity* NewOwnerEntity) : | ||||
| EasyPhysic(NewOwnerEntity), | EasyPhysic(NewOwnerEntity), | ||||
| m_pair_caching_object(NULL), | |||||
| m_character(NULL), | |||||
| m_pair_caching_object(nullptr), | |||||
| m_character(nullptr), | |||||
| m_step_height(.0f), | m_step_height(.0f), | ||||
| m_base_is_updating(false), | m_base_is_updating(false), | ||||
| m_base_cached_movement(vec3(0.f)), | m_base_cached_movement(vec3(0.f)), | ||||
| @@ -36,15 +36,15 @@ class EasyConstraint | |||||
| public: | public: | ||||
| EasyConstraint() : | EasyConstraint() : | ||||
| m_typed_constraint(NULL), | |||||
| m_p2p_constraint(NULL), | |||||
| m_hinge_constraint(NULL), | |||||
| m_slider_constraint(NULL), | |||||
| m_cone_twist_constraint(NULL), | |||||
| m_6dof_constraint(NULL), | |||||
| m_owner_simulation(NULL), | |||||
| m_a_physobj(NULL), | |||||
| m_b_physobj(NULL), | |||||
| m_typed_constraint(nullptr), | |||||
| m_p2p_constraint(nullptr), | |||||
| m_hinge_constraint(nullptr), | |||||
| m_slider_constraint(nullptr), | |||||
| m_cone_twist_constraint(nullptr), | |||||
| m_6dof_constraint(nullptr), | |||||
| m_owner_simulation(nullptr), | |||||
| m_a_physobj(nullptr), | |||||
| m_b_physobj(nullptr), | |||||
| m_a_transform(lol::mat4(1.f)), | m_a_transform(lol::mat4(1.f)), | ||||
| m_b_transform(lol::mat4(1.f)), | m_b_transform(lol::mat4(1.f)), | ||||
| m_using_ref_a(false), | m_using_ref_a(false), | ||||
| @@ -55,11 +55,11 @@ public: | |||||
| ~EasyConstraint() | ~EasyConstraint() | ||||
| { | { | ||||
| delete m_typed_constraint; | delete m_typed_constraint; | ||||
| m_p2p_constraint = NULL; | |||||
| m_hinge_constraint = NULL; | |||||
| m_slider_constraint = NULL; | |||||
| m_cone_twist_constraint = NULL; | |||||
| m_6dof_constraint = NULL; | |||||
| m_p2p_constraint = nullptr; | |||||
| m_hinge_constraint = nullptr; | |||||
| m_slider_constraint = nullptr; | |||||
| m_cone_twist_constraint = nullptr; | |||||
| m_6dof_constraint = nullptr; | |||||
| } | } | ||||
| void AddToSimulation(class Simulation* current_simulation); | void AddToSimulation(class Simulation* current_simulation); | ||||
| @@ -30,26 +30,26 @@ namespace phys | |||||
| //-- | //-- | ||||
| EasyPhysic::EasyPhysic(WorldEntity* NewOwnerEntity) : | EasyPhysic::EasyPhysic(WorldEntity* NewOwnerEntity) : | ||||
| m_collision_object(NULL), | |||||
| m_ghost_object(NULL), | |||||
| m_rigid_body(NULL), | |||||
| m_collision_object(nullptr), | |||||
| m_ghost_object(nullptr), | |||||
| m_rigid_body(nullptr), | |||||
| m_local_inertia(btVector3(.0f, .0f, .0f)), | m_local_inertia(btVector3(.0f, .0f, .0f)), | ||||
| m_collision_shape(NULL), | |||||
| m_convex_shape(NULL), | |||||
| m_motion_state(NULL), | |||||
| m_collision_shape(nullptr), | |||||
| m_convex_shape(nullptr), | |||||
| m_motion_state(nullptr), | |||||
| m_mass(.0f), | m_mass(.0f), | ||||
| m_hit_restitution(.0f), | m_hit_restitution(.0f), | ||||
| m_collision_group(1), | m_collision_group(1), | ||||
| m_collision_mask(1), | m_collision_mask(1), | ||||
| m_owner_entity(NewOwnerEntity), | m_owner_entity(NewOwnerEntity), | ||||
| m_owner_simulation(NULL), | |||||
| m_base_physic(NULL) | |||||
| m_owner_simulation(nullptr), | |||||
| m_base_physic(nullptr) | |||||
| { | { | ||||
| } | } | ||||
| EasyPhysic::~EasyPhysic() | EasyPhysic::~EasyPhysic() | ||||
| { | { | ||||
| m_rigid_body = NULL; | |||||
| m_rigid_body = nullptr; | |||||
| delete m_collision_object; | delete m_collision_object; | ||||
| delete m_collision_shape; | delete m_collision_shape; | ||||
| delete m_motion_state; | delete m_motion_state; | ||||
| @@ -46,7 +46,7 @@ public: | |||||
| virtual void SetShapeToCylinder(lol::vec3& cyl_size); | virtual void SetShapeToCylinder(lol::vec3& cyl_size); | ||||
| virtual void SetShapeToCapsule(float radius, float height); | virtual void SetShapeToCapsule(float radius, float height); | ||||
| virtual bool CanChangeCollisionChannel() { return (m_rigid_body == NULL); } | |||||
| virtual bool CanChangeCollisionChannel() { return (m_rigid_body == nullptr); } | |||||
| virtual mat4 GetTransform(); | virtual mat4 GetTransform(); | ||||
| virtual void SetTransform(const vec3& base_location, const quat& base_rotation = quat(mat3(1.0f))); | virtual void SetTransform(const vec3& base_location, const quat& base_rotation = quat(mat3(1.0f))); | ||||
| protected: | protected: | ||||
| @@ -130,7 +130,7 @@ public: | |||||
| for (int i = 0; i < m_base_physic->m_based_physic_list.count(); ++i) | for (int i = 0; i < m_base_physic->m_based_physic_list.count(); ++i) | ||||
| if (m_base_physic->m_based_physic_list[i] == this) | if (m_base_physic->m_based_physic_list[i] == this) | ||||
| m_base_physic->m_based_physic_list.remove(i--); | m_base_physic->m_based_physic_list.remove(i--); | ||||
| m_base_physic = NULL; | |||||
| m_base_physic = nullptr; | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,8 +1,14 @@ | |||||
| // | // | ||||
| // LolPhysics | |||||
| // Lol Engine | |||||
| // | // | ||||
| // Copyright: (c) 2009-2013 Benjamin "Touky" Huet <huet.benjamin@gmail.com> | |||||
| // (c) 2012 Sam Hocevar <sam@hocevar.net> | |||||
| // Copyright © 2012—2015 Sam Hocevar <sam@hocevar.net> | |||||
| // © 2009—2013 Benjamin “Touky” Huet <huet.benjamin@gmail.com> | |||||
| // | |||||
| // This library is free software. It comes without any warranty, to | |||||
| // the extent permitted by applicable law. You can redistribute it | |||||
| // and/or modify it under the terms of the Do What the Fuck You Want | |||||
| // to Public License, Version 2, as published by the WTFPL Task Force. | |||||
| // See http://www.wtfpl.net/ for more details. | |||||
| // | // | ||||
| #pragma once | #pragma once | ||||
| @@ -154,11 +160,11 @@ public: | |||||
| }; | }; | ||||
| //Returns true when hitting something. If SourceCaster is set, it will be ignored by Raycast. | //Returns true when hitting something. If SourceCaster is set, it will be ignored by Raycast. | ||||
| bool RayHits(RayCastResult& HitResult, eRaycastType RaycastType, const vec3& RayFrom, const vec3& RayTo, EasyPhysic* SourceCaster=NULL) | |||||
| bool RayHits(RayCastResult& HitResult, eRaycastType RaycastType, const vec3& RayFrom, const vec3& RayTo, EasyPhysic* SourceCaster = nullptr) | |||||
| { | { | ||||
| bool bResult = false; | bool bResult = false; | ||||
| btCollisionWorld::RayResultCallback* BtRayResult = NULL; | |||||
| btCollisionWorld::RayResultCallback* BtRayResult = nullptr; | |||||
| btCollisionWorld::ClosestRayResultCallback* BtRayResult_Closest; | btCollisionWorld::ClosestRayResultCallback* BtRayResult_Closest; | ||||
| btCollisionWorld::AllHitsRayResultCallback* BtRayResult_AllHits; | btCollisionWorld::AllHitsRayResultCallback* BtRayResult_AllHits; | ||||
| @@ -334,7 +340,7 @@ private: | |||||
| //Adds the given EasyPhysic to the correct list. | //Adds the given EasyPhysic to the correct list. | ||||
| void ObjectRegistration(bool AddObject, EasyPhysic* NewEP, eEasyPhysicType CurType) | void ObjectRegistration(bool AddObject, EasyPhysic* NewEP, eEasyPhysicType CurType) | ||||
| { | { | ||||
| array<EasyPhysic*>* SearchList = NULL; | |||||
| array<EasyPhysic*>* SearchList = nullptr; | |||||
| switch(CurType) | switch(CurType) | ||||
| { | { | ||||
| case EEPT_Dynamic: | case EEPT_Dynamic: | ||||
| @@ -375,13 +381,13 @@ private: | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| NewEP->m_owner_simulation = NULL; | |||||
| NewEP->m_owner_simulation = nullptr; | |||||
| SearchList->remove_item(NewEP); | SearchList->remove_item(NewEP); | ||||
| } | } | ||||
| } | } | ||||
| void ObjectRegistration(bool AddObject, EasyConstraint* NewEC) | void ObjectRegistration(bool AddObject, EasyConstraint* NewEC) | ||||
| { | { | ||||
| array<EasyConstraint*>* SearchList = NULL; | |||||
| array<EasyConstraint*>* SearchList = nullptr; | |||||
| SearchList = &m_constraint_list; | SearchList = &m_constraint_list; | ||||
| if (AddObject) | if (AddObject) | ||||
| @@ -391,7 +397,7 @@ private: | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| NewEC->m_owner_simulation = NULL; | |||||
| NewEC->m_owner_simulation = nullptr; | |||||
| SearchList->remove_item(NewEC); | SearchList->remove_item(NewEC); | ||||
| } | } | ||||
| } | } | ||||
| @@ -106,15 +106,15 @@ public: | |||||
| } | } | ||||
| #if !defined __native_client__ | #if !defined __native_client__ | ||||
| m_centertext = new Text(NULL, "data/font/ascii.png"); | |||||
| m_centertext = new Text(nullptr, "data/font/ascii.png"); | |||||
| m_centertext->SetPos(vec3(5, (float)m_window_size.y - 15, 1)); | m_centertext->SetPos(vec3(5, (float)m_window_size.y - 15, 1)); | ||||
| Ticker::Ref(m_centertext); | Ticker::Ref(m_centertext); | ||||
| m_mousetext = new Text(NULL, "data/font/ascii.png"); | |||||
| m_mousetext = new Text(nullptr, "data/font/ascii.png"); | |||||
| m_mousetext->SetPos(vec3(5, (float)m_window_size.y - 29, 1)); | m_mousetext->SetPos(vec3(5, (float)m_window_size.y - 29, 1)); | ||||
| Ticker::Ref(m_mousetext); | Ticker::Ref(m_mousetext); | ||||
| m_zoomtext = new Text(NULL, "data/font/ascii.png"); | |||||
| m_zoomtext = new Text(nullptr, "data/font/ascii.png"); | |||||
| m_zoomtext->SetPos(vec3(5, (float)m_window_size.y - 43, 1)); | m_zoomtext->SetPos(vec3(5, (float)m_window_size.y - 43, 1)); | ||||
| Ticker::Ref(m_zoomtext); | Ticker::Ref(m_zoomtext); | ||||
| #endif | #endif | ||||
| @@ -1,7 +1,7 @@ | |||||
| // | // | ||||
| // MY CLASS TYPE | // MY CLASS TYPE | ||||
| // | // | ||||
| // Copyright © 2009-2015 Benjamin "Touky" Huet <huet.benjamin@gmail.com> | |||||
| // Copyright © 2009-2015 Benjamin "Touky" Huet <huet.benjamin@gmail.com> | |||||
| // | // | ||||
| // This program is free software. It comes without any warranty, to | // This program is free software. It comes without any warranty, to | ||||
| // the extent permitted by applicable law. You can redistribute it | // the extent permitted by applicable law. You can redistribute it | ||||
| @@ -252,7 +252,7 @@ class PortalRoom | |||||
| friend class PortalDoor<TE>; | friend class PortalDoor<TE>; | ||||
| public: | public: | ||||
| PortalRoom(TE* element=nullptr) | |||||
| PortalRoom(TE* element = nullptr) | |||||
| { | { | ||||
| m_element = element; | m_element = element; | ||||
| } | } | ||||
| @@ -1,12 +1,14 @@ | |||||
| // | // | ||||
| // Lol Engine | |||||
| // Lol Engine | |||||
| // | // | ||||
| // Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net> | |||||
| // (c) 2010-2013 Benjamin "Touky" Huet <huet.benjamin@gmail.com> | |||||
| // This program is free software; you can redistribute it and/or | |||||
| // modify it under the terms of the Do What The Fuck You Want To | |||||
| // Public License, Version 2, as published by Sam Hocevar. See | |||||
| // http://www.wtfpl.net/ for more details. | |||||
| // Copyright © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||||
| // © 2010—2015 Benjamin "Touky" Huet <huet.benjamin@gmail.com> | |||||
| // | |||||
| // This library is free software. It comes without any warranty, to | |||||
| // the extent permitted by applicable law. You can redistribute it | |||||
| // and/or modify it under the terms of the Do What the Fuck You Want | |||||
| // to Public License, Version 2, as published by the WTFPL Task Force. | |||||
| // See http://www.wtfpl.net/ for more details. | |||||
| // | // | ||||
| #pragma once | #pragma once | ||||
| @@ -277,7 +279,7 @@ typedef SafeEnum<RayIntersectBase> RayIntersect; | |||||
| int TestRayVsRay(vec3 const &ray_p00, vec3 const &ray_p01, | int TestRayVsRay(vec3 const &ray_p00, vec3 const &ray_p01, | ||||
| vec3 const &ray_p10, vec3 const &ray_p11, | vec3 const &ray_p10, vec3 const &ray_p11, | ||||
| vec3 &isec_p); | vec3 &isec_p); | ||||
| bool TestPointVsFrustum(const vec3& point, const mat4& frustum, vec3* result_point=nullptr); | |||||
| bool TestPointVsFrustum(const vec3& point, const mat4& frustum, vec3* result_point = nullptr); | |||||
| //Ray/Plane : Normal must be given normalized. returns 1 if succeeded. | //Ray/Plane : Normal must be given normalized. returns 1 if succeeded. | ||||
| template <typename TV> | template <typename TV> | ||||