Computational Embodied Neuroscience Simulator
1.1
3D simulation library
|
Graphic processing of an object. More...
#include <cens_graphics_shape.h>
Public Member Functions | |
CENSGraphicsShape () | |
CENSGraphicsShape (const CENSGraphicsShape ©) | |
~CENSGraphicsShape () | |
void | buildAsPlane (const Vector3f &orig, const Vector3f &v1, const Vector3f &v2, const Vector3f &color=CENS_NULL_COLOR, CENSPixelMap pixmap=CENS_NULL_PIXMAP) |
void | buildAsBox (const Vector3f &halfExtents, const Vector3f &color=CENS_NULL_COLOR, CENSPixelMap pixmap=CENS_NULL_PIXMAP) |
void | buildAsSphere (float radius, const Vector3f &color=CENS_NULL_COLOR, CENSPixelMap pixmap=CENS_NULL_PIXMAP) |
void | buildAsConvex (const Vertices &vertices, const unsigned int *idx, int nvtxs, int nidxs, int ntrns, const TexCoords &texCoords=CENS_NULL_TEXCOORDS, const Vector3f &color=CENS_NULL_COLOR, CENSPixelMap pixmap=CENS_NULL_PIXMAP) |
void | buildAsSoft (int numTriangles, const TexCoords &texCoords=CENS_NULL_TEXCOORDS, const Vector3f &color=CENS_NULL_COLOR, CENSPixelMap pixmap=CENS_NULL_PIXMAP) |
void | draw (const Vector3f &org, const Matrix3f &rot) |
void | drawSoft () |
void | copyimage (const GLubyte *source) |
void | setTexture () |
void | initTexture () |
int | getType () |
const Vector3f & | getColor () |
Vertices & | getVertices () |
Vector3f & | getVertex (int vertex_index) |
Vertices & | getNormals () |
Vector3f & | getNormal (int normal_index) |
TexCoords & | getTexCoords () |
Vector2f & | getTexCoord (int texCoord_index) |
void | setType (int type) |
void | setColor (const Vector3f &color) |
void | setVertices (const Vertices &vertices) |
void | addVertex (const Vector3f &vertex) |
void | setNormals (const Vertices &normals) |
void | addNormal (const Vector3f &normal) |
void | setTexCoords (const TexCoords &texCoords) |
void | addTexCoord (const Vector2f &texCoord) |
Private Attributes | |
int | m_gsType |
Vector3f | m_gsColor |
Vertices | m_gsVertices |
Vertices | m_gsNormals |
TexCoords | m_gsTexCoords |
GLuint | m_gsTexture |
GLubyte * | m_gsTextureImage |
int | m_gsTextureWidth |
int | m_gsTextureHeight |
Graphic processing of an object.
It manages rendering of shape, texture and color of an object.
Definition at line 50 of file cens_graphics_shape.h.
|
inline |
Definition at line 55 of file cens_graphics_shape.h.
References cens::GS_NULL.
|
inline |
Definition at line 65 of file cens_graphics_shape.h.
References m_gsColor, m_gsTexture, m_gsTextureHeight, m_gsTextureImage, m_gsTextureWidth, m_gsType, and m_gsVertices.
cens::CENSGraphicsShape::~CENSGraphicsShape | ( | ) |
Definition at line 74 of file cens_graphics_shape.cpp.
References m_gsTextureImage.
void cens::CENSGraphicsShape::addNormal | ( | const Vector3f & | normal | ) |
Definition at line 671 of file cens_graphics_shape.cpp.
References m_gsNormals.
void cens::CENSGraphicsShape::addTexCoord | ( | const Vector2f & | texCoord | ) |
Add an UV texture coordinate
texCoord | an UV coordinate |
Definition at line 685 of file cens_graphics_shape.cpp.
References m_gsTexCoords.
Referenced by buildAsBox(), and buildAsSphere().
void cens::CENSGraphicsShape::addVertex | ( | const Vector3f & | vertex | ) |
vertex | an XYZ position |
Definition at line 657 of file cens_graphics_shape.cpp.
References m_gsVertices.
Referenced by buildAsPlane(), and buildAsSphere().
void cens::CENSGraphicsShape::buildAsBox | ( | const Vector3f & | halfExtents, |
const Vector3f & | color = CENS_NULL_COLOR , |
||
CENSPixelMap | pixmap = CENS_NULL_PIXMAP |
||
) |
Builds a box.
halfExtents | halves of box dimentions. |
color | color of the box. |
pixmap | picture for the texture. |
Definition at line 102 of file cens_graphics_shape.cpp.
References addTexCoord(), copyimage(), cens::CENSPixelMap::getData(), cens::CENSPixelMap::getHeight(), cens::CENSPixelMap::getWidth(), cens::GS_BOX, m_gsColor, m_gsTextureHeight, m_gsTextureWidth, m_gsType, and setVertices().
Referenced by cens::CENSEngine::localCreateRigidBody(), and cens::CENSEngine::localImportRigidBody().
void cens::CENSGraphicsShape::buildAsConvex | ( | const Vertices & | vertices, |
const unsigned int * | idx, | ||
int | nvtxs, | ||
int | nidxs, | ||
int | ntrns, | ||
const TexCoords & | texCoords = CENS_NULL_TEXCOORDS , |
||
const Vector3f & | color = CENS_NULL_COLOR , |
||
CENSPixelMap | pixmap = CENS_NULL_PIXMAP |
||
) |
Builds a convex hull.
vertices | a vector containing all the vertices of the hull. |
idx | a vector containing a sequences of indexes to the vertices vector. Vertices are indexed in order to form the triangles of the mesh. |
nvtxs | number of vertices. |
nidxs | number of indices. |
ntrns | number of triangles. |
texCoords | UV cordinates for texture. |
color | color of the hull. |
pixmap | picture for the texture. |
Definition at line 215 of file cens_graphics_shape.cpp.
References copyimage(), cens::CENSPixelMap::getData(), cens::CENSPixelMap::getHeight(), cens::CENSPixelMap::getWidth(), cens::GS_CONVEX, m_gsColor, m_gsTexCoords, m_gsTextureHeight, m_gsTextureWidth, m_gsType, m_gsVertices, and setTexCoords().
Referenced by cens::CENSEngine::localCreateRigidBody(), and cens::CENSEngine::localImportRigidBody().
void cens::CENSGraphicsShape::buildAsPlane | ( | const Vector3f & | orig, |
const Vector3f & | v1, | ||
const Vector3f & | v2, | ||
const Vector3f & | color = CENS_NULL_COLOR , |
||
CENSPixelMap | pixmap = CENS_NULL_PIXMAP |
||
) |
Builds a plane.
orig | up versor of the plane. |
v1 | first orthogonal versor. |
v2 | second orthogonal versor. |
color | color of the plane. |
pixmap | picture for the texture. |
Definition at line 86 of file cens_graphics_shape.cpp.
References addVertex(), copyimage(), cens::CENSPixelMap::getData(), cens::CENSPixelMap::getHeight(), cens::CENSPixelMap::getWidth(), cens::GS_PLANE, m_gsColor, m_gsTextureHeight, m_gsTextureWidth, and m_gsType.
Referenced by cens::CENSEngine::localCreateRigidBody(), and cens::CENSEngine::localImportRigidBody().
void cens::CENSGraphicsShape::buildAsSoft | ( | int | numTriangles, |
const TexCoords & | texCoords = CENS_NULL_TEXCOORDS , |
||
const Vector3f & | color = CENS_NULL_COLOR , |
||
CENSPixelMap | pixmap = CENS_NULL_PIXMAP |
||
) |
Builds a soft body
numTriangles | number of triangles. |
texCoords | UV cordinates for texture. |
color | color of the soft body. |
pixmap | picture for the texture. |
Definition at line 284 of file cens_graphics_shape.cpp.
References copyimage(), cens::CENSPixelMap::getData(), cens::CENSPixelMap::getHeight(), cens::CENSPixelMap::getWidth(), cens::GS_SOFT, m_gsColor, m_gsNormals, m_gsTextureHeight, m_gsTextureWidth, m_gsType, m_gsVertices, and setTexCoords().
Referenced by cens::CENSEngine::localCreateSoftBody(), and cens::CENSEngine::localLinkSoftBody().
void cens::CENSGraphicsShape::buildAsSphere | ( | float | radius, |
const Vector3f & | color = CENS_NULL_COLOR , |
||
CENSPixelMap | pixmap = CENS_NULL_PIXMAP |
||
) |
Builds a sphere.
radius | radius of the sphere. |
color | color of the sphere. |
pixmap | picture for the texture. |
Definition at line 170 of file cens_graphics_shape.cpp.
References addTexCoord(), addVertex(), copyimage(), cens::CENSPixelMap::getData(), cens::CENSPixelMap::getHeight(), cens::CENSPixelMap::getWidth(), cens::GS_SPHERE, cens::GS_SPHERE_LATS, cens::GS_SPHERE_LONGS, m_gsColor, m_gsTextureHeight, m_gsTextureWidth, and m_gsType.
Referenced by cens::CENSEngine::localCreateRigidBody(), and cens::CENSEngine::localImportRigidBody().
void cens::CENSGraphicsShape::copyimage | ( | const GLubyte * | source | ) |
Copy the texture picture.
source | array of unsigned bytes where the image is stored. |
Definition at line 33 of file cens_graphics_shape.cpp.
References m_gsTextureHeight, m_gsTextureImage, and m_gsTextureWidth.
Referenced by buildAsBox(), buildAsConvex(), buildAsPlane(), buildAsSoft(), and buildAsSphere().
void cens::CENSGraphicsShape::draw | ( | const Vector3f & | org, |
const Matrix3f & | rot | ||
) |
Rendering of rigid objects.
org | position of the center of mass of the object. |
rot | rotation from inittial position of the object. |
Definition at line 312 of file cens_graphics_shape.cpp.
References cens::GS_BOX, cens::GS_CONVEX, cens::GS_PLANE, cens::GS_SPHERE, cens::GS_SPHERE_LATS, cens::GS_SPHERE_LONGS, m_gsColor, m_gsTexCoords, m_gsType, m_gsVertices, and setTexture().
void cens::CENSGraphicsShape::drawSoft | ( | ) |
Rendering of soft bodies.
Definition at line 483 of file cens_graphics_shape.cpp.
References m_gsColor, m_gsNormals, m_gsTexCoords, m_gsVertices, and setTexture().
const Vector3f & cens::CENSGraphicsShape::getColor | ( | ) |
Definition at line 584 of file cens_graphics_shape.cpp.
References m_gsColor.
Vector3f & cens::CENSGraphicsShape::getNormal | ( | int | normal_index | ) |
normal_index | index of a normal |
Definition at line 613 of file cens_graphics_shape.cpp.
References m_gsNormals.
Vertices & cens::CENSGraphicsShape::getNormals | ( | ) |
Definition at line 606 of file cens_graphics_shape.cpp.
References m_gsNormals.
Vector2f & cens::CENSGraphicsShape::getTexCoord | ( | int | texCoord_index | ) |
An UV texture coordinate
texCoord_index | index of the UV coordinate |
Definition at line 627 of file cens_graphics_shape.cpp.
References m_gsTexCoords.
TexCoords & cens::CENSGraphicsShape::getTexCoords | ( | ) |
Get UV texture coordinates
Definition at line 620 of file cens_graphics_shape.cpp.
References m_gsTexCoords.
int cens::CENSGraphicsShape::getType | ( | ) |
Definition at line 577 of file cens_graphics_shape.cpp.
References m_gsType.
Vector3f & cens::CENSGraphicsShape::getVertex | ( | int | vertex_index | ) |
vertex_index | the index of a vertex |
Definition at line 599 of file cens_graphics_shape.cpp.
References m_gsVertices.
Vertices & cens::CENSGraphicsShape::getVertices | ( | ) |
Definition at line 592 of file cens_graphics_shape.cpp.
References m_gsVertices.
void cens::CENSGraphicsShape::initTexture | ( | ) |
Initialize texturing for the object.
Definition at line 548 of file cens_graphics_shape.cpp.
References m_gsTexture, m_gsTextureHeight, m_gsTextureImage, and m_gsTextureWidth.
void cens::CENSGraphicsShape::setColor | ( | const Vector3f & | color | ) |
color | a RGB vector with 0.0 to 1.0 elements |
Definition at line 643 of file cens_graphics_shape.cpp.
References m_gsColor.
void cens::CENSGraphicsShape::setNormals | ( | const Vertices & | normals | ) |
normals | a vector of normals |
Definition at line 664 of file cens_graphics_shape.cpp.
References m_gsNormals.
void cens::CENSGraphicsShape::setTexCoords | ( | const TexCoords & | texCoords | ) |
Set UV texture coordinates
texCoords | a vector of UV coordinates |
Definition at line 678 of file cens_graphics_shape.cpp.
References m_gsTexCoords.
Referenced by buildAsConvex(), and buildAsSoft().
void cens::CENSGraphicsShape::setTexture | ( | ) |
Set texturing for the object.
Definition at line 539 of file cens_graphics_shape.cpp.
References m_gsTexture.
Referenced by draw(), and drawSoft().
void cens::CENSGraphicsShape::setType | ( | int | type | ) |
The object type
type | one of GS_NULL, GS_PLANE, GS_BOX, GS_SPHERE, GS_CONVEX or GS_SOFT; |
Definition at line 636 of file cens_graphics_shape.cpp.
References m_gsType.
void cens::CENSGraphicsShape::setVertices | ( | const Vertices & | vertices | ) |
vertices | a vector of XYZ positions |
Definition at line 650 of file cens_graphics_shape.cpp.
References m_gsVertices.
Referenced by buildAsBox().
|
private |
Definition at line 259 of file cens_graphics_shape.h.
Referenced by buildAsBox(), buildAsConvex(), buildAsPlane(), buildAsSoft(), buildAsSphere(), CENSGraphicsShape(), draw(), drawSoft(), getColor(), and setColor().
|
private |
Definition at line 261 of file cens_graphics_shape.h.
Referenced by addNormal(), buildAsSoft(), drawSoft(), getNormal(), getNormals(), and setNormals().
|
private |
Definition at line 262 of file cens_graphics_shape.h.
Referenced by addTexCoord(), buildAsConvex(), draw(), drawSoft(), getTexCoord(), getTexCoords(), and setTexCoords().
|
private |
Definition at line 263 of file cens_graphics_shape.h.
Referenced by CENSGraphicsShape(), initTexture(), and setTexture().
|
private |
Definition at line 266 of file cens_graphics_shape.h.
Referenced by buildAsBox(), buildAsConvex(), buildAsPlane(), buildAsSoft(), buildAsSphere(), CENSGraphicsShape(), copyimage(), and initTexture().
|
private |
Definition at line 264 of file cens_graphics_shape.h.
Referenced by CENSGraphicsShape(), copyimage(), initTexture(), and ~CENSGraphicsShape().
|
private |
Definition at line 265 of file cens_graphics_shape.h.
Referenced by buildAsBox(), buildAsConvex(), buildAsPlane(), buildAsSoft(), buildAsSphere(), CENSGraphicsShape(), copyimage(), and initTexture().
|
private |
Definition at line 258 of file cens_graphics_shape.h.
Referenced by buildAsBox(), buildAsConvex(), buildAsPlane(), buildAsSoft(), buildAsSphere(), CENSGraphicsShape(), draw(), getType(), and setType().
|
private |
Definition at line 260 of file cens_graphics_shape.h.
Referenced by addVertex(), buildAsConvex(), buildAsSoft(), CENSGraphicsShape(), draw(), drawSoft(), getVertex(), getVertices(), and setVertices().