Subversion Repository Public Repository

Divide-Framework

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

Diff Revisions 330 vs 331 for /trunk/Source Code/Core/Resources/Headers/Resource.h

Diff revisions: vs.
  @@ -29,17 +29,23 @@
29 29
30 30 namespace Divide {
31 31
32 - ///When "CreateResource" is called, the resource is in "RES_UNKNOWN" state. Once it has been instantiated it will move to the "RES_CREATED" state.
33 - ///Calling "load" on a non-created resource will fail. After "load" is called, the resource is move to the "RES_LOADING" state
34 - ///Nothing can be done to the resource when it's in "RES_LOADING" state!
35 - ///Once loading is complete, preferably in another thread, the resource state will become "RES_LOADED" and ready to be used (e.g. added to the SceneGraph)
36 - ///Calling "unload" is only available for "RES_LOADED" state resources. Calling this method will set the state to "RES_LOADING"
37 - ///Once unloading is complete, the resource will become "RES_CREATED". It will still exist, but won't contain any data.
38 - ///RES_UNKNOWN and RES_CREATED are safe to delete
32 + /// When "CreateResource" is called, the resource is in "RES_UNKNOWN" state.
33 + /// Once it has been instantiated it will move to the "RES_CREATED" state.
34 + /// Calling "load" on a non-created resource will fail.
35 + /// After "load" is called, the resource is move to the "RES_LOADING" state
36 + /// Nothing can be done to the resource when it's in "RES_LOADING" state!
37 + /// Once loading is complete, preferably in another thread,
38 + /// the resource state will become "RES_LOADED" and ready to be used (e.g. added to the SceneGraph)
39 + /// Calling "unload" is only available for "RES_LOADED" state resources.
40 + /// Calling this method will set the state to "RES_LOADING"
41 + /// Once unloading is complete, the resource will become "RES_CREATED".
42 + /// It will still exist, but won't contain any data.
43 + /// RES_UNKNOWN and RES_CREATED are safe to delete
44 +
39 45 enum ResourceState{
40 46 RES_UNKNOWN = 0, //<The resource exists, but it's state is undefined
41 47 RES_CREATED = 1, //<The pointer has been created and instantiated, but no data has been loaded
42 - RES_LOADING = 2, //<The resource is in loading or unloading stage, creating or deleting data, parsing scripts, etc
48 + RES_LOADING = 2, //<The resource is loading or unloading, creating or deleting data, parsing scripts, etc
43 49 RES_LOADED = 3 //<The resource is loaded and available
44 50 };
45 51
  @@ -64,19 +70,40 @@
64 70 virtual bool unload() = 0;
65 71
66 72 ///Name management
67 - const stringImpl& getName() const {return _name;}
68 - inline void setName(const stringImpl& name) {_name = name;}
73 + const stringImpl& getName() const {
74 + return _name;
75 + }
76 +
77 + inline void setName(const stringImpl& name) {
78 + _name = name;
79 + }
80 +
69 81 ///Physical file location
70 - const stringImpl& getResourceLocation() const {return _resourceLocation;}
71 - void setResourceLocation(const stringImpl& resourceLocation) {_resourceLocation = resourceLocation;}
82 + const stringImpl& getResourceLocation() const {
83 + return _resourceLocation;
84 + }
85 +
86 + void setResourceLocation(const stringImpl& resourceLocation) {
87 + _resourceLocation = resourceLocation;
88 + }
89 +
90 + inline ResourceState getState() const {
91 + return _resourceState;
92 + }
72 93
73 - inline ResourceState getState() const {return _resourceState;}
74 94 ///Toggle loading in background thread
75 - inline void enableThreadedLoading(const bool enableThreadedLoading) {_threadedLoading = enableThreadedLoading;}
76 - virtual void threadedLoad(const stringImpl& name) {_threadedLoadComplete = true;}
95 + inline void enableThreadedLoading(const bool enableThreadedLoading) {
96 + _threadedLoading = enableThreadedLoading;
97 + }
98 +
99 + virtual void threadedLoad(const stringImpl& name) {
100 + _threadedLoadComplete = true;
101 + }
77 102
78 103 protected:
79 - inline void setState(const ResourceState& currentState) {_resourceState = currentState;}
104 + inline void setState(const ResourceState& currentState) {
105 + _resourceState = currentState;
106 + }
80 107
81 108 protected:
82 109 stringImpl _name;
  @@ -108,16 +135,24 @@
108 135 F32 version;
109 136 bool castsShadows;
110 137 bool receivesShadows;
111 - bool staticUsage; //<Used to determine if it's a static object or dynamic. Affects lighting, navigation, etc.
112 - bool navigationUsage; //< Used to determine if the object should be added to the nav mesh generation process or not
113 - bool physicsUsage; //< Used to determine if the object should be added to physics simulations
114 - bool physicsPushable; //< If physicsUsage is true, this determines if the node can be pushed around by other actors or if it is a static(fixed in space) actor
115 - bool useHighDetailNavMesh; //< Used to force a geometry level parsing for nav mesh creation instead of the default bounding-box level
138 + /// Used to determine if it's a static object or dynamic. Affects lighting, navigation, etc.
139 + bool staticUsage;
140 + /// Used to determine if the object should be added to the nav mesh generation process or not
141 + bool navigationUsage;
142 + /// Used to determine if the object should be added to physics simulations
143 + bool physicsUsage;
144 + /// If physicsUsage is true, this determines if the node can be pushed around by other actors
145 + /// or if it is a static(fixed in space) actor
146 + bool physicsPushable;
147 + /// Used to force a geometry level parsing for nav mesh creation instead of the default
148 + /// bounding-box level
149 + bool useHighDetailNavMesh;
116 150 };
117 151
118 152 struct TerrainInfo {
119 153 TerrainInfo(){position.set(0,0,0);}
120 - ///"variables" contains the various strings needed for each terrain such as texture names, terrain name etc.
154 + /// "variables" contains the various strings needed for each terrain such as texture names,
155 + /// terrain name etc.
121 156 hashMapImpl<stringImpl,stringImpl> variables;
122 157 F32 grassDensity;
123 158 F32 treeDensity;