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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
/*
   Copyright (c) 2017 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 _GUI_EDITOR_H_
#define _GUI_EDITOR_H_

#include "Platform/Headers/PlatformDefines.h"

namespace CEGUI {
class Font;
class Window;
class Editbox;
class EventArgs;
class ToggleButton;
};

namespace Divide {

class ResourceCache;
class PlatformContext;
FWD_DECLARE_MANAGED_CLASS(SceneGraphNode);

/// Our world editor interface
class GUIEditor {
public:
    explicit GUIEditor(PlatformContext& context, ResourceCache& cache);
    ~GUIEditor();
    bool init();
    void setVisible(bool visible);  //< Hide or show the editor
    bool isVisible();  //< Return true if editor is visible, false if is hidden
    bool update(const U64 deltaTime);  //< Used to update time dependent elements
    bool Handle_ChangeSelection(SceneGraphNode_wptr newNode);

    /// Returns true if the last click was in one of the editor's windows
    inline bool wasControlClick() { return _wasControlClick; }

private:
    void RegisterHandlers();
    void UpdateControls();
    void TrackSelection();

    bool Handle_MenuBarClickOn(const CEGUI::EventArgs &e);
    bool Handle_EditFieldClick(const CEGUI::EventArgs &e);
    bool Handle_CreateNavMesh(const CEGUI::EventArgs &e);
    bool Handle_SaveScene(const CEGUI::EventArgs &e);
    bool Handle_SaveSelection(const CEGUI::EventArgs &e);
    bool Handle_DeleteSelection(const CEGUI::EventArgs &e);
    bool Handle_ReloadScene(const CEGUI::EventArgs &e);
    bool Handle_WireframeToggle(const CEGUI::EventArgs &e);
    bool Handle_DepthPreviewToggle(const CEGUI::EventArgs &e);
    bool Handle_ShadowMappingToggle(const CEGUI::EventArgs &e);
    bool Handle_FogToggle(const CEGUI::EventArgs &e);
    bool Handle_PostFXToggle(const CEGUI::EventArgs &e);
    bool Handle_BoundingBoxesToggle(const CEGUI::EventArgs &e);
    bool Handle_DrawNavMeshToggle(const CEGUI::EventArgs &e);
    bool Handle_SkeletonsToggle(const CEGUI::EventArgs &e);
    bool Handle_PositionXChange(const CEGUI::EventArgs &e);
    bool Handle_PositionYChange(const CEGUI::EventArgs &e);
    bool Handle_PositionZChange(const CEGUI::EventArgs &e);
    bool Handle_PositionGranularityChange(const CEGUI::EventArgs &e);
    bool Handle_RotationXChange(const CEGUI::EventArgs &e);
    bool Handle_RotationYChange(const CEGUI::EventArgs &e);
    bool Handle_RotationZChange(const CEGUI::EventArgs &e);
    bool Handle_RotationGranularityChange(const CEGUI::EventArgs &e);
    bool Handle_ScaleXChange(const CEGUI::EventArgs &e);
    bool Handle_ScaleYChange(const CEGUI::EventArgs &e);
    bool Handle_ScaleZChange(const CEGUI::EventArgs &e);
    bool Handle_ScaleGranularityChange(const CEGUI::EventArgs &e);
    bool Handle_IncrementPositionX(const CEGUI::EventArgs &e);
    bool Handle_DecrementPositionX(const CEGUI::EventArgs &e);
    bool Handle_IncrementPositionY(const CEGUI::EventArgs &e);
    bool Handle_DecrementPositionY(const CEGUI::EventArgs &e);
    bool Handle_IncrementPositionZ(const CEGUI::EventArgs &e);
    bool Handle_DecrementPositionZ(const CEGUI::EventArgs &e);
    bool Handle_IncrementPositionGranularity(const CEGUI::EventArgs &e);
    bool Handle_DecrementPositionGranularity(const CEGUI::EventArgs &e);
    bool Handle_IncrementRotationX(const CEGUI::EventArgs &e);
    bool Handle_DecrementRotationX(const CEGUI::EventArgs &e);
    bool Handle_IncrementRotationY(const CEGUI::EventArgs &e);
    bool Handle_DecrementRotationY(const CEGUI::EventArgs &e);
    bool Handle_IncrementRotationZ(const CEGUI::EventArgs &e);
    bool Handle_DecrementRotationZ(const CEGUI::EventArgs &e);
    bool Handle_IncrementRotationGranularity(const CEGUI::EventArgs &e);
    bool Handle_DecrementRotationGranularity(const CEGUI::EventArgs &e);
    bool Handle_IncrementScaleX(const CEGUI::EventArgs &e);
    bool Handle_DecrementScaleX(const CEGUI::EventArgs &e);
    bool Handle_IncrementScaleY(const CEGUI::EventArgs &e);
    bool Handle_DecrementScaleY(const CEGUI::EventArgs &e);
    bool Handle_IncrementScaleZ(const CEGUI::EventArgs &e);
    bool Handle_DecrementScaleZ(const CEGUI::EventArgs &e);
    bool Handle_IncrementScaleGranularity(const CEGUI::EventArgs &e);
    bool Handle_DecrementScaleGranularity(const CEGUI::EventArgs &e);

private:
    enum class ToggleButtons : U32 {
        TOGGLE_WIREFRAME = 0,
        TOGGLE_DEPTH_PREVIEW = 1,
        TOGGLE_SHADOW_MAPPING = 2,
        TOGGLE_FOG = 3,
        TOGGLE_POST_FX = 4,
        TOGGLE_BOUNDING_BOXES = 5,
        TOGGLE_NAV_MESH_DRAW = 6,
        TOGGLE_SKELETONS = 7,
        COUNT
    };
    enum class ControlFields : U32 {
        CONTROL_FIELD_X = 0,
        CONTROL_FIELD_Y = 1,
        CONTROL_FIELD_Z = 2,
        CONTROL_FIELD_GRANULARITY = 3,
        COUNT
    };
    enum class TransformFields : U32 {
        TRANSFORM_POSITION = 0,
        TRANSFORM_ROTATION = 1,
        TRANSFORM_SCALE = 2,
        COUNT
    };

    F32& currentValues(TransformFields transform, ControlFields control) {
        assert(transform < TransformFields::COUNT &&
            control < ControlFields::COUNT);
        return _currentValues[to_uint(transform)][to_uint(control)];
    }

    CEGUI::Editbox*& valuesField(TransformFields transform, ControlFields control) {
        assert(transform < TransformFields::COUNT &&
            control < ControlFields::COUNT);
        return _valuesField[to_uint(transform)][to_uint(control)];
    }

    CEGUI::ToggleButton*& toggleButton(ToggleButtons button) {
        assert(button < ToggleButtons::COUNT);
        return _toggleButtons[to_uint(button)];
    }

    CEGUI::Window*& transformButtonsInc(TransformFields transform, ControlFields control) {
        assert(transform < TransformFields::COUNT &&
            control < ControlFields::COUNT);
        return _transformButtonsInc[to_uint(transform)][to_uint(control)];
    }

    CEGUI::Window*& transformButtonsDec(TransformFields transform, ControlFields control) {
        assert(transform < TransformFields::COUNT &&
            control < ControlFields::COUNT);
        return _transformButtonsDec[to_uint(transform)][to_uint(control)];
    }
private:
    PlatformContext& _context;
    ResourceCache& _resCache;
    bool _init;
    bool _wasControlClick;
    bool _createNavMeshQueued;
    bool _pauseSelectionTracking;
    SceneGraphNode_wptr _currentSelection;
    CEGUI::Window *
        _editorWindow;  //< This will be a pointer to the EditorRoot window.
    CEGUI::Window *_saveSelectionButton;
    CEGUI::Window *_deleteSelectionButton;
    std::array<CEGUI::ToggleButton *, to_const_uint(ToggleButtons::COUNT)>
        _toggleButtons;
    std::array<
        std::array<CEGUI::Window *, to_const_uint(ControlFields::COUNT)>,
        to_const_uint(TransformFields::COUNT)> _transformButtonsInc;
    std::array<
        std::array<CEGUI::Window *, to_const_uint(ControlFields::COUNT)>,
        to_const_uint(TransformFields::COUNT)> _transformButtonsDec;
    std::array<
        std::array<CEGUI::Editbox *, to_const_uint(ControlFields::COUNT)>,
        to_const_uint(TransformFields::COUNT)> _valuesField;
    std::array<std::array<F32, to_const_uint(ControlFields::COUNT)>,
        to_const_uint(TransformFields::COUNT)> _currentValues;

};

};  // namespace Divide
#endif

Commits for Divide-Framework/trunk/Source Code/GUI/GUIEditor/Headers/GUIEditor.h

Diff revisions: vs.
Revision Author Commited Message
836 Diff Diff IonutCava picture IonutCava Fri 27 Jan, 2017 14:59:56 +0000

[IonutCava]
- Update copyright notice

804 Diff Diff IonutCava picture IonutCava Thu 01 Dec, 2016 17:20:59 +0000

[IonutCava]
- Singleton elimination update Part I: get it to compile
— The following classes are no longer Singletons: GFXDevice, GL_API, DX_API, SFXWrapper, FmodWrapper, SDLWrapper, ALWrapper, PXDevice, InputInterface, RenderPassManager, SceneManager and ResourceManager;
— Refactor system to a Context / Component based implementation (Pass relevant context to objects: e.g. GFXDevice object to Textures, GUI to GUIElements, etc)
— Make devices and managers components of the kernel
— Allow multiple Resource caches to co-exist. This may prove useful for later when a more fragmented memory model is need (per frame / per scene / global caches / etc)

  • next steps: part II – cleanup/refactor new code, part III – optimise code, part IV – remove remaining Singletons (e.g. Application, ParamHandler, FrameListenerManager, Recast, PostFX and DebugInterface)
802 Diff Diff IonutCava picture IonutCava Tue 29 Nov, 2016 17:15:38 +0000

[IonutCava]
- GUI class is no longer a Singleton
- Reduced usage of GFXDevice::instance()

710 Diff Diff IonutCava picture IonutCava Fri 20 May, 2016 16:24:40 +0000

[IonutCava]
- Code cleanup
- Initial work on Scene loading and unloading with and without unloading assets:
— Need to change AIManager from a Singleton to a per-scene component

709 Diff Diff IonutCava picture IonutCava Thu 19 May, 2016 16:21:46 +0000

[IonutCava]
- Massive rewrite of the resource system:
— ResourceCache now uses a map of weak pointers and passes shared pointers to the call point of CreateResource
— RemoveResource is no longer needed, but resource based smart pointers use a custom deleter that calls unload()
— Keep a shared_ptr of the resource in the entity that needs it and pass shared_ptr references from getter methods
-— All of this removed the need for calls to RemoveResource, REGISTER_TRACKED_DEPENDENCY and UNREGISTER_TRACKED_DEPENDENCY reducing the number of mutex locks and atomic exchanges
- Singleton cleanup:
— Removed ShaderManager singleton and merged it’s data and responsibilities in static methods in both ShaderProgram and Shader classes.
Explanation: Due to the complex interdependency chains in the system, copying, updating, tracking the cache in a thread safe way became a lot more slower than a straight forward smart pointer based implementation. (e.g. scene graph nodes have 3d objects and material instances, 3d objects have materials, materials have textures and shaders, etc)

648 Diff Diff IonutCava picture IonutCava Sun 21 Feb, 2016 16:32:52 +0000

[IonutCava]
- Update copyright notice
- Move BoundingBox and BoundingSphere to a new BoundsComponent
— Add a temp hack in SceneGraphNode to update these

540 Diff Diff IonutCava picture IonutCava Wed 28 Oct, 2015 19:06:28 +0000

[IonutCava]
- Remove the “Platform” folder from the Platform project as the name is redundant. Move files one level up

524 Diff Diff IonutCava picture IonutCava Thu 08 Oct, 2015 16:14:58 +0000

[IonutCava]
- Profiler guided optimizations:
— Replace most hashMaps with vectors where the common access pattern is linear (e.g. SceneGraphNode’s child list)
— Specify ShaderBuffer access patters at creation time to properly inform the rendering API
— Fix and optimise the LockManager & BufferLockManager classes
— Add a AtomicWrapper class that allows assignment and copy-constructions for atomic variables
-— This allows us to use vector of atomic bools for BB creation for SkinnedSubMesh objects

478 Diff Diff IonutCava picture IonutCava Thu 06 Aug, 2015 15:51:03 +0000

[Ionut]
- Migrated to vc140
- Fixed some code analysis issues
- Added some missing Eclipse files

442 IonutCava picture IonutCava Wed 20 May, 2015 15:25:02 +0000

[Ionut]
- Better platform handling:
— All platform specific code moved in 3 separate files: PlatformDefinesWindows / PlatformDefinesUnix / PlatformDefinesApple
— Added CPU and RAM check at startup to make sure we meet minimum requirements to run properly
- Smart pointers should never used MemoryManager_NEW for allocating memory (MemoryManager_NEW tracks allocations but must be matched with a DELETE call in order to no report leaks). Corrected.
- Zombification of Singletons is only enabled in Debug builds
- Fixed a bug in Task.cpp (nowTime check) that prevented some tasks to run on the first call (changed a ‘>’ check to a ‘>=’)
— This also fixed bounding box computations for skinned submeshes
- Improved dead zone handling for joysticks