67 VL_DEBUG_SET_OBJECT_NAME()
84 unsigned int de_indices[] =
86 0,1,2, 0,2,3, 1,5,6, 1,6,2, 5,4,7, 5,7,6, 4,0,3, 4,3,7, 3,2,6, 3,6,7, 4,5,1, 4,1,0
89 memcpy( de->
indexBuffer()->
ptr(), de_indices,
sizeof( de_indices ) );
94 fvec3( 0,0,0 ),
fvec3( 1,0,0 ),
fvec3( 1,1,0 ),
fvec3( 0,1,0 ),
95 fvec3( 0,0,1 ),
fvec3( 1,0,1 ),
fvec3( 1,1,1 ),
fvec3( 0,1,1 )
97 memcpy(
mTexCoord->ptr(), texc,
sizeof( texc ) );
122 fvec4 light_position;
125 for( ; ilight < 4 && ilight < (int)
mLights.size(); ++ilight )
141 light_position = inv_mat * light_position;
151 for( ; ilight < 4; ++ilight ) {
217 if ( ! img_size.
x() || ! img_size.
y() || ! img_size.
z() )
219 Log::error(
"RaycastVolume::generateTextureCoordinates(): failed! The size passed does not represent a 3D image.\n" );
223 float dx = 0.5f / img_size.
x();
224 float dy = 0.5f / img_size.
y();
225 float dz = 0.5f / img_size.
z();
227 float x0 = 0.0f + dx;
228 float x1 = 1.0f - dx;
229 float y0 = 0.0f + dy;
230 float y1 = 1.0f - dy;
231 float z0 = 0.0f + dz;
232 float z1 = 1.0f - dz;
236 fvec3( x0,y0,z1 ),
fvec3( x1,y0,z1 ),
fvec3( x1,y1,z1 ),
fvec3( x0,y1,z1 ),
237 fvec3( x0,y0,z0 ),
fvec3( x1,y0,z0 ),
fvec3( x1,y1,z0 ),
fvec3( x0,y1,z0 ),
239 memcpy(
mTexCoord->ptr(), texc,
sizeof( texc ) );
254 fvec3( x0,y0,z1 ),
fvec3( x1,y0,z1 ),
fvec3( x1,y1,z1 ),
fvec3( x0,y1,z1 ),
255 fvec3( x0,y0,z0 ),
fvec3( x1,y0,z0 ),
fvec3( x1,y1,z0 ),
fvec3( x0,y1,z0 ),
257 memcpy(
mVertCoord->ptr(), box_verts,
sizeof( box_verts ) );
Associates a Renderable object to an Effect and Transform.
int height() const
The vertical dimension of the texture in texels.
virtual void updateUniforms(Actor *actor, real clock, const Camera *camera, Renderable *rend, const Shader *shader)
Updates the uniforms used by the GLSLProgram to render the volume each time the onActorRenderStarted(...
Vector3< float > fvec3
A 3 components vector with float precision.
Transform * transform()
Returns the Transform bound tho an Actor.
Vector3< T_Scalar > getZ() const
int getUniformLocation(const char *name) const
Returns the binding index of the given uniform.
const T_Scalar & z() const
ref< Geometry > mGeometry
static void error(const String &message)
Use this function to provide information about run-time errors: file not found, out of memory...
Wraps a GLSL program to which you can bind vertex, fragment and geometry shaders. ...
Wraps an OpenGL texture object representing and managing all the supported texture types...
const Collection< ActorEventCallback > * actorEventCallbacks() const
Returns the list of ActorEventCallback bound to an Actor.
void generateTextureCoordinates(const ivec3 &img_size)
Generates a default set of texture coordinates for the 8 box corners of the volume based on the given...
The Geometry class is a Renderable that implements a polygonal mesh made of polygons, lines and points.
Visualization Library main namespace.
const fvec4 & diffuse() const
void setBox(const AABB &box)
Defines the dimensions of the box in model coordinates enclosing the volume and generates the actual ...
std::vector< ref< Light > > mLights
const unsigned char * ptr() const
Returns the pointer to the first element of the local buffer. Equivalent to bufferObject()->ptr() ...
Texture * texture()
The texture sampler by a texture unit.
T_Scalar getInverse(Matrix4 &dest) const
The AABB class implements an axis-aligned bounding box using vl::real precision.
const vec3 & maxCorner() const
Returns the corner of the AABB with the maximum x y z coordinates.
An abstract class that represents all the objects that can be rendered.
const mat4 & modelingMatrix() const
Returns the Camera's modelingMatrix() (inverse of the view matrix).
void onActorRenderStarted(Actor *actor, real frame_clock, const Camera *cam, Renderable *renderable, const Shader *shader, int pass)
Event generated just before an Actor is rendered but after the render states are ready and setup...
ref< ArrayFloat3 > mVertCoord
Transform * boundTransform()
const T_Scalar & y() const
const TextureImageUnit * getTextureImageUnit(int unit_index) const
const AABB & box() const
The dimensions of the box enclosing the volume.
Manages most of the OpenGL rendering states responsible of the final aspect of the rendered objects...
arr_type * indexBuffer()
The BufferObject containing the indices used to render.
Uniform * gocUniform(const char *name)
Equivalent to getUniformSet()->getUniform(name, get_mode)
const vec3 & minCorner() const
Returns the corner of the AABB with the minimum x y z coordinates.
const GLSLProgram * getGLSLProgram() const
Returns a GLSLProgram if it exists or NULL otherwise.
Vector3< T_Scalar > getT() const
const fvec4 & specular() const
fvec3 vec3
Defined as: 'typedef fvec3 vec3'. See also VL_PIPELINE_PRECISION.
void bindActor(Actor *)
Binds a RaycastVolume to an Actor.
const fvec4 & position() const
The position or direction of a light.
void setLod(int lod_index, Renderable *renderable)
Sets the Renderable object representing the LOD level specifed by lod_index.
Wraps the OpenGL function glLight().
const T_Scalar & x() const
The ref<> class is used to reference-count an Object.
Matrix4< float > fmat4
A 4x4 matrix using float precision.
ref< ArrayFloat3 > mTexCoord
Represents a virtual camera defining, among other things, the point of view from which scenes can be ...
static String printf(const char *fmt,...)
Returns a formatted string using the legacy printf syntax. The resulting string can be maximum 1024 +...
int depth() const
The z dimension of the texture in texels.
const fvec4 & ambient() const
int width() const
The horizontal dimension of the texture in texels.