DD::Image::GeoInfo Class Reference

Contains a list of points and geometric primitives. More...

List of all members.

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 Primitiveprimitive (unsigned n) const
const Box3bbox () 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 Vector3point_array () const
DrawListsPtr callLists () const
const Cacheget_cache_pointer () const
void setVertexCount (int vertices)
const Hashsrc_id () const
const Hashout_id () const
void set_out_id (DD::Image::Hash newId)
unsigned size (int group) const
const Attributeget_attribute (const char *name) const
const Attributeget_typed_attribute (const char *name, int type) const
const Attributeget_group_attribute (int group, const char *name) const
const Attributeget_typed_group_attribute (int group, const char *name, int type) const
int get_attribcontext_count () const
const AttribContextget_attribcontext (int index) const
const AttribContextget_attribcontext (const char *name) const
const AttribContextget_typed_attribcontext (const char *name, int type) const
const AttribContextget_group_attribcontext (int group, const char *name) const
const AttribContextget_typed_group_attribcontext (int group, const char *name, int type) const
void delete_group_attribute (int group, const char *name, int type=INVALID_ATTRIB)
PrimitiveContextgetPrimitiveContext ()
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.
Iopmaterial
 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
GeoOpsource_geo
 Last non-merge GeoOp.
GeoOpfinal_geo
 Last GeoOp before a merge.
GeoOpselect_geo
 Last selectable GeoOp.
GeoOprecursion_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 AttribContextUV_ref
 Reference to the primary UV.
const AttribContextN_ref
 Reference to the primary normal.
const AttribContextCf_ref
 Reference to the primary surface color.
const AttribContextPW_ref
 Reference to the world-space point.
const AttribContextVEL_ref
 Reference to the point velocity.
Attributeselections [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


Detailed Description

Contains a list of points and geometric primitives.

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.


Constructor & Destructor Documentation

GeoInfo::GeoInfo (  ) 


Member Function Documentation

void GeoInfo::copy ( const GeoInfo b  ) 

Point data is duplicated and every primitive is copied.

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 
)

bool GeoInfo::orient_normals ( int  group,
Attribute normals,
const Vector3 P,
bool  invert = false 
) const

void GeoInfo::draw ( ViewerContext ctx  ) 

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  ) 


Member Data Documentation

OpenGL call list management.

Referenced by DD::Image::GeoOp::build_scene(), draw_selected_items(), and GeoInfo().



©2009 The Foundry Visionmongers, Ltd. All Rights Reserved.
www.thefoundry.co.uk