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
/*�Copyright 2009-2012 DIVIDE-Studio�*/
/* This file is part of DIVIDE Framework.

   DIVIDE Framework is free software: you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   DIVIDE Framework is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public License
   along with DIVIDE Framework.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef _TRIGGER_H_
#define _TRIGGER_H_

#include "core.h"
#include "Graphs/Headers/SceneNode.h"

class Unit;
class Event;
class Impostor;
/// When a unit touches the circle described by
class Trigger  : public SceneNode {

	typedef std::tr1::shared_ptr<Event> Event_ptr;

public:
	Trigger();
	~Trigger();

	/// Checks if the unit has activated this trigger and launches the event
	/// If we receive a NULL unit as a param, we use the camera position
	bool check(Unit* const unit,const vec3<F32>& camEyePos = vec3<F32>(0,0,0));
	/// Sets a new event for this trigger
	void updateTriggeredEvent(Event_ptr triggeredEvent);
	/// Trigger's the event regardless of position
	bool trigger();
	///Draw a sphere at the trigger's position
	///The impostor has the radius of the trigger's radius
	inline void  setDrawImpostor(bool state) {_drawImpostor = state;}
	///Enable or disable the trigger
	inline void  setEnabled(bool state) {_enabled = state;}
    /// Set the callback, the position and the radius of the trigger
	void setParams(Event_ptr triggeredEvent, const vec3<F32>& triggerPosition, F32 radius);
	/// Just update the callback
	inline void setParams(Event_ptr triggeredEvent) {setParams(triggeredEvent,_triggerPosition,_radius);}

	///Dummy function from SceneNode;
	void onDraw() {};

	///SceneNode concrete implementations
	bool unload();
	void postLoad(SceneGraphNode* const sgn);	

	///When the SceneGraph calls the trigger's render function, we draw the impostor if needed
	virtual void render(SceneGraphNode* const sgn);

	///SceneNode test
	bool isInView(bool distanceCheck,BoundingBox& boundingBox){return _drawImpostor;}

private:
	/// The event to be launched when triggered
	Event_ptr _triggeredEvent;
	/// The trigger circle's center position
	vec3<F32> _triggerPosition;
	/// The trigger's radius
	F32 _radius;
	/// Draw the impostor?
	bool _drawImpostor;
	Impostor* _triggerImpostor; ///< used for debug rendering / editing - Ionut

	SceneGraphNode *_triggerSGN, *_impostorSGN;
	bool _enabled;
};

#endif

Commits for Divide-Framework/trunk/Source Code/Dynamics/Entities/Triggers/Headers/Trigger.h

Diff revisions: vs.
Revision Author Commited Message
117 Diff Diff k1ngp1n picture k1ngp1n Tue 05 Jun, 2012 17:30:40 +0000

[Ionut] [[BR]]
-Separated responsibilities between “Application” and “Kernel” [[BR]]
--“Application” handles data such as window dimensions, logs, “ParamHandler” etc [[BR]]
--“Kernel” handles the main loop, SFX, GFX, physics, sceneManager etc updates [[BR]]
---“Kernel” is now a “Core” component [[BR]]
-Reduced coupling between some classes by passing more info via parameters rather than relying on singleton access [[BR]]
--Ex: eyePos in “Terrain”,“Water” and “Trigger” classes is now passed as a "vec3<F32>" on render call rather than querying “CameraManager” [[BR]]
-Reworked “GLWrapper” shutdown routine [[BR]]
Singleton witch hunt [[BR]]
-“Kernel” is no longer a singleton and it’s initialized on application startup in the “Application” class[[BR]]
-“CameraManager” is no longer a singleton and it’s instantiated in the kernel [[BR]]

116 Diff Diff k1ngp1n picture k1ngp1n Mon 04 Jun, 2012 22:27:07 +0000

[Ionut] [[BR]]
-Removed now useless “BaseCache” class as a simple unordered_map in each manager-type class is all that’s needed [[BR]]
-Moved loading responsibility from each Resource implementation to each "ImplResourceLoader<T>" class (defaults via macro’s are available for convenience) [[BR]]
--Resources now have a “setInitialData” method for setting post-load values [[BR]]
--Also added a loader for Particle Emitters [[BR]]
-Added a new class, “HardwareResource” (for textures, shaders, etc) that needs special loading routines to facilitate future multi-threaded asset streaming [[BR]]
--HardwareResource’s have a “generateHWResource” that should be called after threaded loading routines join with main thread [[BR]]
-Renamed “Guardian” class to “Kernel” as that’s what it’s new responsibility will be in future revisions [[BR]]
-Added the “threadpool” library from here: http://threadpool.sourceforge.net/ (not used yet) [[BR]]
-Added some more macro’s and cleanups [[BR]]

114 Diff Diff k1ngp1n picture k1ngp1n Sat 02 Jun, 2012 13:03:01 +0000

[Ionut][[BR]]
-First steps in moving away from a generalized “ResourceManager”: [[BR]]
--Added templated resource loaders (Core\Resources\ConcreteLoaders). Just add a new loader for a new resource type and it’s ready for use [[BR]]
---Next step involves moving loading responsibility from the resource itself to the resource loader that handles it’s creation [[BR]]
--Renamed the ResourceManager to ResourceCache and limited it’s responsibility from general resource operations to a more standard abstract template factory with cache [[BR]]
---Manager base class is renamed to BaseCache as it’s a wrapper for a cache map in essence [[BR]]
---Next step involves adding a ResourceCache per scene (dropping Singleton status) with the possibility of sharing resources between them (to avoid reloading existing resources for a new scene) [[BR]]
-Translated AITenisScene and PingPongScene source code to english [[BR]]

106 Diff Diff k1ngp1n picture k1ngp1n Wed 28 Mar, 2012 21:50:23 +0000

[Ionut] [[BR]]
Unstable revision – New animation code is not yet optimized and loading performance is low [[BR]]
[[BR]]
-Added animation loading and bone matrix calculations (actual skinning not implemented yet)[[BR]]
-Modified VBO classes to support dynamic data and faster updates [[BR]]
-Templatized Math classes (vec2,vec3,vec4,mat3,mat4) for greater flexibility [[BR]]
-Separated Rendering API from Rendering API version [[BR]]
-Fixed buggy GL error checking [[BR]]
-Small bugs fixed in Projectile and Weapon classes [[BR]]

104 k1ngp1n picture k1ngp1n Tue 13 Mar, 2012 19:33:49 +0000

[Ionut] [[BR]]
-Added base classes for the game logic part of the framework (just the backbone. main logic will be added iteratively): [[BR]]
--Unit class and it’s derived classes: Character [with derived: Player, NPC] and Vehicle [[BR]]
--Particle system: ParticleEmitter and Particle (with ParticleEmitterDescriptor and ParticleDescriptor) [[BR]]
--Triggers (launches an event when a unit is in range of it’s influence sphere) [[BR]]
--Weapon System: Weapon class, Projectile class and Ammunition class [[BR]]
[[BR]]
Improvements: [[BR]]
-Added more defines and template inline functions to help with various operations (integer bit conversion, XYZ to XZY coordinate conversion etc) [[BR]]
-Removed LightImpostor class and added a global Impostor class now used by lights, triggers and particle emitters [[BR]]
[[BR]]
Bug fixes: [[BR]]
-Removed some (weird) characters added by accident from terrain shader [[BR]]
-Use sqrtf for Floats and sqrt for Doubles[[BR]]