32 #ifndef Actor_INCLUDE_ONCE 33 #define Actor_INCLUDE_ONCE 90 virtual void onActorRenderStarted(
Actor* actor, real frame_clock,
const Camera* cam,
Renderable* renderable,
const Shader* shader,
int pass) = 0;
93 virtual void onActorDelete(
Actor* actor) = 0;
143 mEffect(effect), mTransform(transform), mRenderBlock(block), mRenderRank(rank),
144 mTransformUpdateTick(-1), mBoundsUpdateTick(-1), mEnableMask(0xFFFFFFFF), mOcclusionQuery(0), mOcclusionQueryTick(0xFFFFFFFF), mIsOccludee(true), mEnabled(true)
146 VL_DEBUG_SET_OBJECT_NAME()
147 mActorEventCallbacks.setAutomaticDelete(
false);
148 setLod(0,renderable);
150 #ifdef VL_USER_DATA_ACTOR 151 mActorUserData =
NULL;
161 mRenderables[lod_index] = renderable;
166 mBoundsUpdateTick = -1;
173 const Renderable*
lod(
int lod_index)
const {
return mRenderables[lod_index].get(); }
184 mTransform = transform;
185 mTransformUpdateTick = -1;
186 mBoundsUpdateTick = -1;
217 void computeBounds();
220 bool boundsDirty()
const;
260 int evaluateLOD(
Camera* camera);
284 void setUniform(
Uniform* uniform);
289 const std::vector< ref<Uniform> >& uniforms()
const;
294 std::vector< ref<Uniform> >& uniforms();
299 void eraseUniform(
const char* name);
304 void eraseUniform(
const Uniform* uniform);
309 void eraseAllUniforms();
314 Uniform* gocUniform(
const char* name);
319 Uniform* getUniform(
const char* name);
324 const Uniform* getUniform(
const char* name)
const;
378 for(
size_t i=0; i<actorEventCallbacks()->size(); ++i)
389 for(
size_t i=0; i<actorEventCallbacks()->size(); ++i)
431 void createOcclusionQuery();
435 void deleteOcclusionQuery();
447 #ifdef VL_USER_DATA_ACTOR 449 const Object* actorUserData()
const {
return mActorUserData.get(); }
450 Object* actorUserData() {
return mActorUserData.get(); }
451 void setActorUserData(
Object* user_data) { mActorUserData = user_data; }
Associates a Renderable object to an Effect and Transform.
const Renderable * lod(int lod_index) const
Returns the Renderable object representing the LOD level specifed by lod_index.
void setEffect(Effect *effect)
Binds an Effect to an Actor.
bool isEnabled() const
Whether an Actor should be considered for rendering, picking, scene bounding box calculation etc...
const Effect * effect() const
Returns the Effect bound to an Actor.
Transform * transform()
Returns the Transform bound tho an Actor.
GLuint occlusionQuery() const
For internal use only.
Collection< ActorEventCallback > mActorEventCallbacks
Collection< ActorEventCallback > * actorEventCallbacks()
Returns the list of ActorEventCallback bound to an Actor.
const Transform * transform() const
Returns the Transform bound tho an Actor.
long long mTransformUpdateTick
int renderBlock() const
Returns the rendering block of an Actor.
const Collection< ActorEventCallback > * actorEventCallbacks() const
Returns the list of ActorEventCallback bound to an Actor.
UniformSet * gocUniformSet()
Creates and/or returns the installed UniformSet.
void dispatchOnActorDelete()
Calls all the onActorDelete() of all the ActorEventCallback installed on this Actor.
const UniformSet * getUniformSet() const
Returns the installed UniformSet.
ref< Transform > mTransform
const Sphere & boundingSphere() const
Returns the bounding sphere (not guaranteed to be up to date) that contains this Actor.
void setEnableMask(unsigned int mask)
The enable mask of an Actor is usually used to defines whether the actor should be rendered or not de...
#define VL_INSTRUMENT_CLASS(ClassName, BaseClass)
Actor(Renderable *renderable=NULL, Effect *effect=NULL, Transform *transform=NULL, int block=0, int rank=0)
Constructor.
unsigned int enableMask() const
The enable mask of an Actor is usually used to defines whether the actor should be rendered or not de...
Visualization Library main namespace.
virtual void onActorDelete(Actor *actor)=0
Event notifying that an Actor is being deleted.
long long mBoundsUpdateTick
Renderable * lod(int lod_index)
Returns the Renderable object representing the LOD level specifed by lod_index.
UniformSet * getUniformSet()
Returns the installed UniformSet.
bool isOccludee() const
If is_occludee equals true an occlusion test will be performed before the rendering of the Actor (if ...
const Scissor * scissor() const
Returns the Scissor used when rendering an Actor.
The AABB class implements an axis-aligned bounding box using vl::real precision.
const LODEvaluator * lodEvaluator() const
Returns the installed LODEvaluator (if any) or NULL.
The base class for all the reference counted objects.
void setRenderRank(int rank)
Modifies the rendering rank of an Actor.
An abstract class that represents all the objects that can be rendered.
int renderRank() const
Returns the rendering rank of an Actor.
LODEvaluator * lodEvaluator()
Returns the installed LODEvaluator (if any) or NULL.
void setTransform(Transform *transform)
Binds a Transform to an Actor.
void setOccludee(bool is_occludee)
If is_occludee equals true an occlusion test will be performed before the rendering of the Actor (if ...
Scissor * scissor()
Returns the Scissor used when rendering an Actor.
virtual void onActorRenderStarted(Actor *actor, real frame_clock, const Camera *cam, Renderable *renderable, const Shader *shader, int pass)=0
Event generated just before an Actor is rendered but after the render states are ready and setup...
void dispatchOnActorRenderStarted(real frame_clock, const Camera *camera, Renderable *renderable, const Shader *shader, int pass)
Calls all the onActorRenderStarted() of all the ActorEventCallback installed on this Actor...
const AABB & boundingBox() const
Returns the bounding box (not guaranteed to be up to date) that contains this Actor.
void setOcclusionQueryTick(unsigned tick)
For internal use only.
void setEnabled(bool enabled)
Whether an Actor should be considered for rendering, picking, scene bounding box calculation etc...
The ActorEventCallback class defines a callback object to react to Actor-related events.
Manages most of the OpenGL rendering states responsible of the final aspect of the rendered objects...
The Sphere class defines a sphere using a center and a radius using vl::real precision.
Abstract class to compute the appropriate LOD of an Actor or Effect.
#define VLGRAPHICS_EXPORT
void setUniformSet(UniformSet *uniforms)
Installs a new UniformSet.
Defines the sequence of Shader objects used to render an Actor.
Effect * effect()
Returns the Effect bound to an Actor.
Defined as a simple subclass of Collection<Actor>, see Collection for more information.
unsigned occlusionQueryTick() const
For internal use only.
#define VL_INSTRUMENT_ABSTRACT_CLASS(ClassName, BaseClass)
void setLODEvaluator(LODEvaluator *lod_evaluator)
Installs the LODEvaluator used to compute the current LOD at rendering time.
const AABB & boundingBoxSafe()
Returns the bounding box (guaranteed to be up to date) that contains this Actor.
It's basically an std::vector for Objects that is itself an Object so it can be reference counted and...
ref< UniformSet > mUniformSet
void setLod(int lod_index, Renderable *renderable)
Sets the Renderable object representing the LOD level specifed by lod_index.
void setEnabled(bool enabled)
void setScissor(Scissor *scissor)
Sets the Scissor to be used when rendering an Actor.
The ref<> class is used to reference-count an Object.
const Sphere & boundingSphereSafe()
Returns the bounding sphere (guaranteed to be up to date) that contains this Actor.
Represents a virtual camera defining, among other things, the point of view from which scenes can be ...
The Scissor class wraps the OpenGL function glScissor(), see http://www.opengl.org/sdk/docs/man/xhtml...
ref< LODEvaluator > mLODEvaluator
unsigned mOcclusionQueryTick
void setRenderBlock(int block)
Modifies the rendering block of an Actor.