Visualization Library 2.0.0

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
RaycastVolume.hpp
Go to the documentation of this file.
1 /**************************************************************************************/
2 /* */
3 /* Visualization Library */
4 /* http://visualizationlibrary.org */
5 /* */
6 /* Copyright (c) 2005-2020, Michele Bosi */
7 /* All rights reserved. */
8 /* */
9 /* Redistribution and use in source and binary forms, with or without modification, */
10 /* are permitted provided that the following conditions are met: */
11 /* */
12 /* - Redistributions of source code must retain the above copyright notice, this */
13 /* list of conditions and the following disclaimer. */
14 /* */
15 /* - Redistributions in binary form must reproduce the above copyright notice, this */
16 /* list of conditions and the following disclaimer in the documentation and/or */
17 /* other materials provided with the distribution. */
18 /* */
19 /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND */
20 /* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED */
21 /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
22 /* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR */
23 /* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
24 /* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
25 /* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON */
26 /* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
27 /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
28 /* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
29 /* */
30 /**************************************************************************************/
31 
32 #include <vlVolume/link_config.hpp>
33 #include <vlGraphics/Geometry.hpp>
34 #include <vlGraphics/Actor.hpp>
35 
36 #ifndef RaycastVolume_INCLUDE_ONCE
37 #define RaycastVolume_INCLUDE_ONCE
38 
39 namespace vl
40 {
42  {
44 
45  public:
46  RaycastVolume();
47 
48  void onActorRenderStarted( Actor* actor, real frame_clock, const Camera* cam, Renderable* renderable, const Shader* shader, int pass );
49 
50  void onActorDelete( Actor* ) {}
51 
53  void bindActor( Actor* );
54 
56  virtual void updateUniforms( Actor* actor, real clock, const Camera* camera, Renderable* rend, const Shader* shader );
57 
59  Geometry* geometry() { return mGeometry.get(); }
60 
62  const Geometry* geometry() const { return mGeometry.get(); }
63 
65  void setBox( const AABB& box );
66 
68  const AABB& box() const { return mBox; }
69 
71  const fvec3* vertCoords() const { return mVertCoord->begin(); }
72 
74  fvec3* vertCoords() { return mVertCoord->begin(); }
75 
77  const fvec3* texCoords() const { return mTexCoord->begin(); }
78 
80  fvec3* texCoords() { return mTexCoord->begin(); }
81 
84  void generateTextureCoordinates( const ivec3& img_size );
85 
86  const std::vector< ref<Light> >& lights() const { return mLights; }
87  std::vector< ref<Light> >& lights() { return mLights; }
88 
89  protected:
94  std::vector< ref<Light> > mLights;
95  };
96 }
97 
98 #endif
Associates a Renderable object to an Effect and Transform.
Definition: Actor.hpp:130
ref< Geometry > mGeometry
Geometry * geometry()
Returns the Geometry associated to a RaycastVolume and its bound Actor.
#define VL_INSTRUMENT_CLASS(ClassName, BaseClass)
Definition: TypeInfo.hpp:122
The Geometry class is a Renderable that implements a polygonal mesh made of polygons, lines and points.
Definition: Geometry.hpp:66
Visualization Library main namespace.
void onActorDelete(Actor *)
Event notifying that an Actor is being deleted.
std::vector< ref< Light > > mLights
const fvec3 * texCoords() const
Returns the texture coordinates assigned to each of the 8 box corners of the volume.
const Geometry * geometry() const
Returns the Geometry associated to a RaycastVolume and its bound Actor.
The AABB class implements an axis-aligned bounding box using vl::real precision.
Definition: AABB.hpp:44
fvec3 * texCoords()
Returns the texture coordinates assigned to each of the 8 box corners of the volume.
std::vector< ref< Light > > & lights()
An abstract class that represents all the objects that can be rendered.
Definition: Renderable.hpp:58
fvec3 * vertCoords()
Returns the coordinates assigned to each of the 8 box corners of the volume.
ref< ArrayFloat3 > mVertCoord
const AABB & box() const
The dimensions of the box enclosing the volume.
const std::vector< ref< Light > > & lights() const
The ActorEventCallback class defines a callback object to react to Actor-related events.
Definition: Actor.hpp:75
Manages most of the OpenGL rendering states responsible of the final aspect of the rendered objects...
Definition: Shader.hpp:1830
The ref<> class is used to reference-count an Object.
Definition: Object.hpp:55
ref< ArrayFloat3 > mTexCoord
Represents a virtual camera defining, among other things, the point of view from which scenes can be ...
Definition: Camera.hpp:50
A ActorEventCallback used to render a volume using GPU raycasting.
const fvec3 * vertCoords() const
Returns the coordinates assigned to each of the 8 box corners of the volume.