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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/*
   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.

 */
/*
    OgreCrowd
    ---------

    Copyright (c) 2012 Jonas Hauquier

    Additional contributions by:

    - mkultra333
    - Paul Wilson

    Sincere thanks and to:

    - Mikko Mononen (developer of Recast navigation libraries)

    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 _CHARACTER_H_
#define _CHARACTER_H_

#include "Unit.h"

namespace Divide {

/// Basic character class.
/// Use the internally calculated position to update the attached node's transform!
class Character : public Unit {
public:
    /// Currently supported character types
    enum CharacterType{
        /// user controlled character
        CHARACTER_TYPE_PLAYER,
        /// non-user(player) character
        CHARACTER_TYPE_NPC,
        /// placeholder
        CHARACTER_TYPE_PLACEHOLDER
    };

    Character(CharacterType type, SceneGraphNode* const node);
    virtual ~Character();

    /// Set unit type
    inline void setCharacterType(CharacterType type)      {_type = type;}
    /// Get unit type
    inline CharacterType getCharacterType()           const  {return _type;}
    /**
      * Update this character for drawing a new frame.
      * Updates one tick in the render loop.
      * In order for the agents to be updated, you first need to call the detourCrowd
      * update function.
      * What is updated specifically is up to a specific implementation of Character,
      * but at the very least the position in the scene should be updated to reflect
      * the detour agent position (possibly with additional physics engine clipping
      * and collision testing).
      **/
    virtual void update(const U64 deltaTime);
    /// Set the curent position of this charater
    virtual void      setPosition(const vec3<F32>& newPosition);
    /// Update character velocity
    virtual void      setVelocity(const vec3<F32>& newVelocity);
    /// The current position of this character
    virtual vec3<F32> getPosition() const; 
    /// The direction in which the character is currently looking.
    virtual vec3<F32> getLookingDirection();
    /// Rotate the character to look at another character
    virtual void lookAt(const vec3<F32>& targetPos);
     /// Just before we render the frame
    virtual bool frameRenderingQueued(const FrameEvent& evt);

    inline const vec3<F32>& getRelativeLookingDirection()                           const {return _lookingDirection;}
    inline const void       setRelativeLookingDirection(const vec3<F32>& direction)       {_lookingDirection = direction;}

private:
    CharacterType _type;
    vec3<F32> _lookingDirection;
    vec3<F32> _newPosition, _oldPosition, _curPosition;
    vec3<F32> _newVelocity, _curVelocity;
    std::atomic_bool _positionDirty;
    std::atomic_bool _velocityDirty;
};

}; //namespace Divide

#endif

Commits for Divide-Framework/trunk/Source Code/Dynamics/Entities/Units/Headers/Character.h

Diff revisions: vs.
Revision Author Commited Message
337 Diff Diff IonutCava picture IonutCava Wed 17 Dec, 2014 17:25:16 +0000

[Ionut]
- Replaced all tabs with 4 spaces (some spacing may be off now. no way to check all the files.)
- Moved implementation details for ParamHandler, BoundingBox, BoundingSphere and ProfileTimer to proper .inl and .cpp files. (more to follow)
- Update all forward declared enums with the required storage type (as requested by the C++11 standard)

322 Diff Diff IonutCava picture IonutCava Sat 06 Sep, 2014 20:33:47 +0000

[Ionut]
- Refactored most of Boost related code to be C++11 based
— Boost is only used for ThreadPool, Mutex handling, XML parsing and networking (ASIO)
— Function binds, threads, regex, NonCopyable base, Hashing algorithms and more are now using C++11 libraries
- Replaced all FOR_EACH calls with standard, range, “for” calls

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)

242 Diff Diff k1ngp1n picture k1ngp1n Mon 03 Feb, 2014 21:05:28 +0000

[Ionut] [[BR]]
- Smoother third person camera [[BR]]
- Smoother Character movement [[BR]]
- Limit third person camera rotations (-179 ... + 179 yaw, -31.5 ... +60 pitch) [[BR]]
- Character and third person camera performance optimizations [[BR]]

240 Diff Diff k1ngp1n picture k1ngp1n Sat 01 Feb, 2014 21:20:42 +0000

- Moved WarScene pathfinding logic from the WarScene class to WarScene’s ActionList [[BR]]
- Changed AI behavior (1 team moves randomly, the other follows the first. When 2 enemies meet, they look at each-other and stop moving) [[BR]]
- Added lookAt(target) method to the Character class [[BR]]

231 Diff Diff k1ngp1n picture k1ngp1n Mon 13 Jan, 2014 21:44:55 +0000

[Ionut] [[BR]]
- ReCast/Detour <--> AIEntity sync [[BR]]
— Pathfinding, position and orientation updates working [[BR]]
- Fixed an AIManager timing issue [[BR]]
- Fixed double update calls from different threads on AIEntities [[BR]]
- Updated Transform class with better quaternion rotations [[BR]]

229 Diff Diff k1ngp1n picture k1ngp1n Sun 12 Jan, 2014 16:37:32 +0000

[Ionut] [[BR]]
- AIEntity, NPC, Character and ActionList cleanups and shuffling around to keep in line with basic OOP principles and improve flexibility and expandability [[BR]]

221 Diff Diff 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 *
186 Diff Diff k1ngp1n picture k1ngp1n Sun 24 Nov, 2013 19:14:54 +0000

[Ionut] [[BR]]
- Increased precision of internal timers (delta time stored as double and computed by the kernel) [[BR]]
- Some thread sync fixes [[BR]]
- More work on the profile timers. Added a main loop timer as an example (Kernel.cpp -> mainLoopApp) [[BR]]
- Physics update <-> SceneGraphNode transform update sync (rather primitive, but it works) [[BR]]
— Setting a position or rotation manually was overridden by the physics engine. Now, manual transform updates have a higher priority [[BR]]

185 k1ngp1n picture k1ngp1n Sat 23 Nov, 2013 19:18:16 +0000

[Ionut] [[BR]]
- More AI <-> NavMesh/Crowd integration [[BR]]
- Fixed object selection [[BR]]
— Every SceneGraphNode that has the “_isSelectable” flag set to true can now be selected with the mouse and highlighted with increased ambient [[BR]]
- Various performance optimizations [[BR]]
- Slight shadow offset modification to reduce peter-panning [[BR]]
- Added a debug-only profiling (ProfileTimer) class (unused for now) [[BR]]