Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/*
   Copyright (c) 2014 DIVIDE-Studio
   Copyright (c) 2009 Ionut Cava

   This file is part of DIVIDE Framework.

   Permission is hereby granted, free of charge, to any person obtaining a copy of this software
   and associated documentation files (the "Software"), to deal in the Software without restriction,
   including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
   and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
   subject to the following conditions:

   The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
   INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
   WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
   OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

 */

#ifndef _PHYSICS_API_WRAPPER_H_
#define _PHYSICS_API_WRAPPER_H_

#include "core.h"
#include "Hardware/Platform/Headers/PlatformDefines.h"

namespace Divide {

enum PhysicsCollisionGroup{
    GROUP_NON_COLLIDABLE,
    GROUP_COLLIDABLE_NON_PUSHABLE,
    GROUP_COLLIDABLE_PUSHABLE,
};

enum PhysicsActorMask{
    MASK_RIGID_STATIC,
    MASK_RIGID_DYNAMIC
};

enum PhysicsAPI {
    PHYSX,
    ODE,
    BULLET,
    PX_PLACEHOLDER
};

class Scene;
class SceneGraphNode;

class PhysicsAsset {
public:
    PhysicsAsset();
    virtual ~PhysicsAsset();

protected:
    friend class PhysicsComponent;
    inline bool resetTransforms()            const { return _resetTransforms; }
    inline void resetTransforms(const bool state)  { _resetTransforms = state; }
    
    void setParent(PhysicsComponent* parent);
    PhysicsComponent* getComponent() { return _parentComponent; }

protected:
    bool _resetTransforms;
    PhysicsComponent* _parentComponent;
};

class PhysicsSceneInterface;
class PhysicsAPIWrapper {
protected:
    friend class PXDevice;
    PhysicsAPIWrapper() : _apiId(PX_PLACEHOLDER){}
    inline void setId(PhysicsAPI api) {_apiId = api;}
    inline PhysicsAPI getId() { return _apiId;}

    virtual ErrorCode initPhysicsApi(U8 targetFrameRate) = 0;
    virtual bool      closePhysicsApi() = 0;
    virtual void updateTimeStep(U8 timeStepFactor)  = 0;
    virtual void updateTimeStep()  = 0;
    virtual void update(const U64 deltaTime) = 0;
    virtual void process(const U64 deltaTime) = 0;
    virtual void idle() = 0;
    virtual PhysicsSceneInterface* NewSceneInterface(Scene* scene) = 0;

    virtual bool createPlane(const vec3<F32>& position = VECTOR3_ZERO, U32 size = 1) = 0;
    virtual bool createBox(const vec3<F32>& position = VECTOR3_ZERO, F32 size = 1.0f) = 0;
    virtual bool createActor(SceneGraphNode* const node, 
                             const stringImpl& sceneName,
                             PhysicsActorMask mask,
                             PhysicsCollisionGroup group) = 0;
    virtual void setPhysicsScene(PhysicsSceneInterface* const targetScene) = 0;
    virtual void initScene() = 0;

 private:
    PhysicsAPI _apiId;
};

}; //namespace Divide

#endif

Commits for Divide-Framework/trunk/Source Code/Dynamics/Physics/Headers/PhysicsAPIWrapper.h

Diff revisions: vs.
Revision Author Commited Message
331 Diff Diff IonutCava picture IonutCava Sat 06 Dec, 2014 20:53:45 +0000

[Ionut]
- Limited line length to 132 characters to improve readability and diff-comparisons
- Refactored memory allocation/deallocation functions
- Fixed a few compatibility issues with HashMap.h
- Fixed a bug in GPU Skinning shaders (cast a float to int)

324 Diff Diff IonutCava picture IonutCava Sun 14 Sep, 2014 14:01:39 +0000

[Ionut]
- New memory management system (no custom allocators in this commit)
— Memory tracer to detect memory leaks on shutdown (from: https://www.relisoft.com/book/tech/9new.html)
— SAFE_DELETE_XYZ are now inline template functions not macros
— ASSERTION system now supports logging and message boxes and continue on error configurable for each build type
— Fixed a lot of memory leaks detected by the new system (some still remain)

- Added SRGB support (part 1)
— Albedo textures are loaded as SRGB (make sure resources are SRGB)
— Shaders output gamma corrected colors
— Moved terrain textures back to 2 array system (albedo and normal maps, albedo maps using a SRGB sampler)

- Sky is now loaded via the ResourceCache system
- Added include safeguards in shader atoms

321 Diff Diff IonutCava picture IonutCava Wed 03 Sep, 2014 22:05:15 +0000

[Ionut]
- Added support (and enabled by default) for the EASTL library (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2271.html / https://github.com/paulhodge/EASTL)
— Strings, vectors and hash_maps can be combined from EASTL, STL and Boost (not all combinations work. e.g. EASTL strings with STL/Boost containers due to the lack of a proper hash function)

318 Diff Diff IonutCava picture IonutCava Sat 30 Aug, 2014 17:35:53 +0000

[Ionut]
- Wrapped the entire code in a “Divide” namespace
- VertexBuffers now call “shrink_to_fit” on all internal data storage
- Improved some vector performance by preferring “emplace_back” instead of “push_back” + proepr usage of reserve / resize
- Wrapped OIS specific types and classes in Divide::Input namespace
- Added the messageBox.layout file (forgot it in the previous few commits)

314 Diff Diff IonutCava picture IonutCava Sun 24 Aug, 2014 19:54:33 +0000

[Ionut]
- More AI work
- Added some needed audio dlls

308 Diff Diff IonutCava picture IonutCava Sat 16 Aug, 2014 19:49:31 +0000

[Ionut]
- Moved Transform from SceneGraphNode to PhysicsComponent and modified BoundingBox update system based on transform update
- Added PhysicsAsset to PhysicsComponent for interfacing with PshysicsAPIs (e.g. PhysXActor inherits PhysicsAsset)
- PhysicsAsset keeps track of the parent PhysicsComponent to have direct access to a node’s transform
- Rewrote GUIConsole to only print items when visible, and use a single circular buffer for entries.
- Updated GUI input system to match the interface that both Kernel and SceneManager share (should probably abstract all the input methods in a class and have Kernel, SceneManager, Scene and GUI inherit from that. In next commit.)
- Updated CEGUI to probably match the OIS states(mouse, keyboard, etc) and properly inject time inputs.

296 Diff Diff k1ngp1n picture k1ngp1n Sun 03 Aug, 2014 14:54:21 +0000

[Ionut]
- nVidia compatibility fixes (GUI, shadows, post-processing)
- Texture bind slots are now part of ShaderProgram class
- Renamed ForwardRenderer class to ForwardPlusRenderer and moved ligh grid creation to it
- More code cleanups and comments

293 Diff Diff k1ngp1n picture k1ngp1n Tue 29 Jul, 2014 20:01:28 +0000

[Ionut]
- Code cleanup and comments in GLFWWrapper (for starters. more to follow)
- Reworked main loop logic (no more delegates and rendering api querying)
- Replaced all GLvoid with regular void
- replaced all boost::this_thread::sleep (deprecated calls) with boost::this_thread::sleep_for

235 Diff Diff k1ngp1n picture k1ngp1n Thu 16 Jan, 2014 22:31:48 +0000

[Ionut] [[BR]]
- W.I.P. anti-stuck system for agents [[BR]]
- Fixed lerp functions in math classes [[BR]]
- Used lerp-based translation for Character class [[BR]]
- Code cleanups and utility functions [[BR]]

221 k1ngp1n picture k1ngp1n Wed 08 Jan, 2014 18:50:02 +0000

[Ionut] [[BR]]
- Merged branch “Shadows And Animations” back into trunk [[BR]]
- Added DoxygenGUI project file [[BR]]

  • Buggy *