Classes | |
struct | Cache |
Public Types | |
enum | GeoFlags { DEFAULT, NO_RAY_CAST, POLYGON_OFFSET } |
typedef RefCountedPtr< DrawLists > | DrawListsPtr |
Public Member Functions | |
GeoInfo () | |
void | copy (const GeoInfo *b) |
void | validate () |
Get primitives and attributes ready for display/rendering. | |
void | update_bbox () |
Calculate axis-aligned bounding box. | |
bool | ignoreForRayCasting () const |
void | setGeoInfoFlag (unsigned int flags) |
void | clearGeoInfoFlag (unsigned int flags) |
const Primitive * | primitive (unsigned n) const |
const Box3 & | bbox () const |
unsigned | output_index () const |
unsigned | primitives () const |
const Primitive ** | primitive_array () const |
unsigned | vertices () const |
unsigned | points () const |
const PointList * | point_list () const |
const Vector3 * | point_array () const |
DrawListsPtr | callLists () const |
const Cache * | get_cache_pointer () const |
void | setVertexCount (int vertices) |
const Hash & | src_id () const |
const Hash & | out_id () const |
void | set_out_id (DD::Image::Hash newId) |
unsigned | size (int group) const |
const Attribute * | get_attribute (const char *name) const |
const Attribute * | get_typed_attribute (const char *name, int type) const |
const Attribute * | get_group_attribute (int group, const char *name) const |
const Attribute * | get_typed_group_attribute (int group, const char *name, int type) const |
int | get_attribcontext_count () const |
const AttribContext * | get_attribcontext (int index) const |
const AttribContext * | get_attribcontext (const char *name) const |
const AttribContext * | get_typed_attribcontext (const char *name, int type) const |
const AttribContext * | get_group_attribcontext (int group, const char *name) const |
const AttribContext * | get_typed_group_attribcontext (int group, const char *name, int type) const |
void | delete_group_attribute (int group, const char *name, int type=INVALID_ATTRIB) |
PrimitiveContext * | getPrimitiveContext () |
bool | construct_normals (int group, Attribute *, float threshold=0.0f) const |
bool | orient_normals (int group, Attribute *, const Vector3 &P, bool invert=false) const |
void | draw (ViewerContext *) |
void | draw_icons (ViewerContext *) |
void | draw_bbox (ViewerContext *) |
bool | draw_wireframe (ViewerContext *) |
bool | draw_solid (ViewerContext *) |
bool | draw_pick_ids (ViewerContext *ctx, unsigned int offset) |
bool | draw_selectable_items (ViewerContext *ctx) |
bool | draw_selected_items (ViewerContext *ctx, const GeoSelection &selection) |
void | print_info (std::ostream &o) |
void | trash_display_list (bool trash=true) |
void | trash_selected_display_list () |
Box3 | getTransformedBBox () |
Public Attributes | |
Matrix4 | matrix |
Transformation matrix. | |
Iop * | material |
Overall material assignment. | |
bool | useMaterialContext |
Use OutputContext with material. | |
DD::Image::OutputContext | materialContext |
OutputContext for material. | |
RenderMode | render_mode |
Turn Render output on/off. | |
Display3DMode | display3d |
How to draw (see ViewerContext style3d). | |
bool | selected |
Draw with selected wireframe. | |
bool | selectable |
Object can be selected. | |
GeoInfoRenderState | renderState |
GeoOp * | source_geo |
Last non-merge GeoOp. | |
GeoOp * | final_geo |
Last GeoOp before a merge. | |
GeoOp * | select_geo |
Last selectable GeoOp. | |
GeoOp * | recursion_geo |
GeoOp which started a recursing loop. | |
bool | valid_source_node_gl_color |
true if gl node color is valid | |
unsigned | source_node_gl_color |
Source gl node color for drawing. | |
const AttribContext * | UV_ref |
Reference to the primary UV. | |
const AttribContext * | N_ref |
Reference to the primary normal. | |
const AttribContext * | Cf_ref |
Reference to the primary surface color. | |
const AttribContext * | PW_ref |
Reference to the world-space point. | |
const AttribContext * | VEL_ref |
Reference to the point velocity. | |
Attribute * | selections [Group_Last] |
Group selection attributes. | |
unsigned | selected_items_list |
unsigned int | selected_items_IB |
unsigned int | selected_indices_count |
Friends | |
class | GeoOp |
class | GeometryList |
class | Primitive |
3D data is stored in a Scene object. The Scene contains a vector of these, each one describes a single geometric object that is shaded with a single set of shaders and transformed by a single matrix.
GeoInfo::GeoInfo | ( | ) |
Constructor clears all the geometry lists and nulls the materials.
References DD::Image::GeoInfoRenderState::castShadow, display3d, final_geo, DD::Image::Matrix4::makeIdentity(), material, matrix, DD::Image::GeoInfoRenderState::preMultiplierAlphaComp, DD::Image::GeoInfoRenderState::receiveShadow, recursion_geo, render_mode, select_geo, selectable, selected, selected_items_list, source_geo, source_node_gl_color, useMaterialContext, and valid_source_node_gl_color.
void GeoInfo::validate | ( | ) |
Get primitives and attributes ready for display/rendering.
Append another GeoInfo's geometry into this one. Point data is duplicated and every primitive is copied.
Re-assign the standard attribute references from the current list.
References Cf_ref, DD::Image::PrimitiveContext::geoinfo_, get_group_attribute(), DD::Image::PrimitiveContext::indices_, N_ref, DD::Image::PrimitiveContext::primitive_, DD::Image::GeoInfo::Cache::primitives, PW_ref, selections, UV_ref, DD::Image::Primitive::validate(), and VEL_ref.
Referenced by DD::Image::GeoOp::build_scene(), DD::Image::Scene::generate_render_primitives(), DD::Image::ModifyGeo::geometry_engine(), and DD::Image::Scene::validate().
void GeoInfo::update_bbox | ( | ) |
Calculate axis-aligned bounding box.
Get the GeoInfo's bounding-box up-to-date by finding a bounding volume that fits around all points. Alternate bounding geometry such as spheres can be calculated at this time. Produces bounding-box by adding each point to the local bounding box.
References DD::Image::GeoInfo::Cache::bbox, DD::Image::Box3::clear(), DD::Image::Box3::expand(), matrix, DD::Image::GeoInfo::Cache::points, and DD::Image::Matrix4::transform().
const Primitive* DD::Image::GeoInfo::primitive | ( | unsigned | n | ) | const [inline] |
Get primitive.
void DD::Image::GeoInfo::setVertexCount | ( | int | vertices | ) | [inline] |
Allows cache vertex count to be manually overridden to keep attributes in sync with primitives. Some Primitive types do not have vertex counts that can be predicted at the moment the primitive is added to the GeoInfo leading to a difference in total vertex count causing vertex Attributes to have incorrect sizes.
const Hash& DD::Image::GeoInfo::src_id | ( | ) | const [inline] |
Return the object ids.
unsigned GeoInfo::size | ( | int | group | ) | const |
Returns the size of the group list.
const Attribute * GeoInfo::get_attribute | ( | const char * | name | ) | const |
Find a valid attribute by name at each level of possible assignment in this order of importance: Vertex, Point, Material, Primitive, then Object. If found return a pointer to the Attribute, otherwise NULL.
References DD::Image::AttribContext::attribute.
const Attribute * GeoInfo::get_typed_attribute | ( | const char * | name, | |
int | type | |||
) | const |
Search for an attribute by name and type, returning its pointer if found.
References DD::Image::GeoInfo::Cache::attributes.
const Attribute * GeoInfo::get_group_attribute | ( | int | group, | |
const char * | name | |||
) | const |
Search for an attribute by name and group, returning its pointer if found.
References DD::Image::GeoInfo::Cache::attributes.
Referenced by DD::Image::Render::_request(), and validate().
const Attribute * GeoInfo::get_typed_group_attribute | ( | int | group, | |
const char * | name, | |||
int | type | |||
) | const |
Search for an attribute by name, group and type, returning its pointer if found.
References DD::Image::GeoInfo::Cache::attributes.
const AttribContext * GeoInfo::get_attribcontext | ( | const char * | name | ) | const |
Find a valid attribute by name at each level of possible assignment in this order of importance: Vertex, Point, Material, Primitive, then Object. If found return a pointer to the AttribContext structure which has the attribute pointer and it's group info.
References DD::Image::GeoInfo::Cache::attributes.
const AttribContext * GeoInfo::get_typed_attribcontext | ( | const char * | name, | |
int | type | |||
) | const |
Search for an attribute by name and type and return a const reference to it if found.
References DD::Image::GeoInfo::Cache::attributes.
const AttribContext * GeoInfo::get_group_attribcontext | ( | int | group, | |
const char * | name | |||
) | const |
Search for an attribute by name and group and return a const reference to it if found.
References DD::Image::GeoInfo::Cache::attributes.
Referenced by delete_group_attribute().
const AttribContext * GeoInfo::get_typed_group_attribcontext | ( | int | group, | |
const char * | name, | |||
int | type | |||
) | const |
Search for an attribute by name, group and type, returning its pointer if found.
References DD::Image::GeoInfo::Cache::attributes.
Referenced by delete_group_attribute().
void GeoInfo::delete_group_attribute | ( | int | group, | |
const char * | name, | |||
int | type = INVALID_ATTRIB | |||
) |
Clears the reference pointer to the attribute, effectively deleting it.
References DD::Image::AttribContext::attribute, DD::Image::RefCountedPtr< T >::clear(), get_group_attribcontext(), get_typed_group_attribcontext(), and DD::Image::INVALID_ATTRIB.
bool GeoInfo::orient_normals | ( | int | group, | |
Attribute * | normals, | |||
const Vector3 & | P, | |||
bool | invert = false | |||
) | const |
Point the normals of the passed in attribute at point Pl. Returns true if successful.
References DD::Image::Vector3::fast_normalize(), DD::Image::Matrix4::inverse(), matrix, DD::Image::Attribute::normal(), DD::Image::GeoInfo::Cache::points, DD::Image::GeoInfo::Cache::primitives, DD::Image::Attribute::size(), DD::Image::Matrix4::transform(), DD::Image::Matrix4::transpose(), DD::Image::Primitive::vertex(), DD::Image::Primitive::vertex_offset(), DD::Image::Primitive::vertices(), and DD::Image::Matrix4::vtransform().
void GeoInfo::draw | ( | ViewerContext * | ctx | ) |
Draw the GeoInfo's geometry in OpenGL.
References DD::Image::Op::Class(), DD::Image::ViewerContext::display3d(), display3d, DD::Image::ViewerContext::draw_lines(), DD::Image::ViewerContext::draw_solid(), draw_solid(), DD::Image::ViewerContext::draw_transparent(), draw_wireframe(), DD::Image::Op::EXECUTABLE_SKIP, DD::Image::PrimitiveContext::geoinfo_, DD::Image::glColor(), DD::Image::ViewerContext::lights(), material, materialContext, matrix, DD::Image::ViewerContext::node_color(), DD::Image::Op::node_gl_color(), DD::Image::Op::node_input(), DD::Image::GeoInfo::Cache::primitives, selected, DD::Image::ViewerContext::selected_color(), DD::Image::ViewerContext::set_node_color(), DD::Image::MatrixArray::set_object_matrix(), DD::Image::Iop::set_texturemap(), DD::Image::PrimitiveContext::set_transforms(), DD::Image::Iop::shade_GL(), source_geo, source_node_gl_color, DD::Image::style_needs_wireframe(), DD::Image::Iop::unset_texturemap(), useMaterialContext, valid_source_node_gl_color, and DD::Image::Op::validate().
void GeoInfo::draw_bbox | ( | ViewerContext * | ctx | ) |
Draw the surrounding bbox. This is drawn separately from the object primitives because the bbox has already been transformed by the matrix.
References DD::Image::GeoInfo::Cache::bbox, DD::Image::Box3::max(), DD::Image::Box3::min(), DD::Image::Vector3::x, DD::Image::Vector3::y, and DD::Image::Vector3::z.
bool GeoInfo::draw_wireframe | ( | ViewerContext * | ctx | ) |
Draw wireframe of the object, by calling draw_wireframe on all the primitives. This compiles an OpenGL call list, which is reused until invalidate() is called. Returns false if there is some problem creating the call list (though everything ignores this)
References DD::Image::GeoInfo::Cache::call_lists, DD::Image::Primitive::draw_wireframe(), DD::Image::PrimitiveContext::geoinfo_, DD::Image::Primitive::getPrimitiveType(), DD::Image::PrimitiveContext::indices_, DD::Image::PrimitiveContext::primitive_, DD::Image::GeoInfo::Cache::primitives, and DD::Image::Primitive::vertex().
Referenced by draw().
bool GeoInfo::draw_solid | ( | ViewerContext * | ctx | ) |
Draw shaded version the object, by calling draw_solid on all the primitives. This compiles an OpenGL call list, which is reused until invalidate() is called. Returns false if there is some problem creating the call list (though everything ignores this)
References DD::Image::GeoInfo::Cache::call_lists, DD::Image::Primitive::draw_solid(), DD::Image::DRAW_TRANSPARENT, DD::Image::ViewerContext::event(), DD::Image::PrimitiveContext::geoinfo_, DD::Image::PrimitiveContext::indices_, DD::Image::PrimitiveContext::primitive_, DD::Image::GeoInfo::Cache::primitives, and UV_ref.
Referenced by draw(), and DD::Image::Black::shade_GL().
bool GeoInfo::draw_pick_ids | ( | ViewerContext * | ctx, | |
unsigned int | offset | |||
) |
Draw selectable parts of the object. This compiles an OpenGL call list, which is reused until invalidate() is called. Returns false if there is some problem creating the call list (though everything ignores this).
References DD::Image::GeoInfo::Cache::call_lists, and DD::Image::ViewerContext::getSelectionMode3D().
bool GeoInfo::draw_selected_items | ( | ViewerContext * | ctx, | |
const GeoSelection & | selection | |||
) |
Draw selected parts of the object. This compiles an OpenGL call list, which is reused until invalidate() is called. Returns false if there is some problem creating the call list (though everything ignores this).
References DD::Image::GeoInfo::Cache::call_lists, DD::Image::ViewerContext::getSelectionMode3D(), and selected_items_list.
void GeoInfo::print_info | ( | std::ostream & | o | ) |
Primary use is to print GeoInfo information into Nuke's info box.
References DD::Image::AttribContext::attribute, DD::Image::GeoInfo::Cache::attributes, DD::Image::GeoInfo::Cache::bbox, DD::Image::Op::Class(), DD::Image::Box3::d(), DD::Image::Box3::f(), DD::Image::AttribContext::group, DD::Image::group_names, DD::Image::Box3::h(), material, DD::Image::Box3::n(), DD::Image::AttribContext::name, DD::Image::Box3::r(), DD::Image::Box3::radius(), DD::Image::AttribContext::recursive, DD::Image::Box3::t(), DD::Image::Box3::w(), DD::Image::Box3::x(), and DD::Image::Box3::y().
Referenced by DD::Image::GeoOp::print_info().
OpenGL call list management.
Referenced by DD::Image::GeoOp::build_scene(), draw_selected_items(), and GeoInfo().
©2009 The Foundry Visionmongers, Ltd. All Rights Reserved. |