Inherits DD::Image::Op, and DD::Image::GeneralInfoProvider.
Inherited by DD::Image::ModifyGeo, DD::Image::NullGeo, DD::Image::ParticleRender, DD::Image::TransformGeo, and DD::Image::WriteGeo.
Public Member Functions | |
virtual | ~GeoOp () |
Scene * | scene () const |
void | build_scene (Scene &scene) |
void | get_geometry (Scene &, GeometryList &out) |
void | setupScene () |
bool | evaluate_transform (int obj, GeometryList &out, bool transform_normals=true) |
int | minimum_inputs () const override |
int | maximum_inputs () const override |
Op * | default_input (int input) const override |
bool | test_input (int input, Op *op) const override |
GeoOp * | input (int n) const |
GeoOp * | input0 () const |
GeoOp * | input1 () const |
const char * | node_shape () const override |
unsigned | node_color () const override |
void | knobs (Knob_Callback) override |
void | shadow_knobs (Knob_Callback f) |
void | knobs (Knob_Callback, bool sourcegeo, bool geoselectSaves=false) |
int | knob_changed (Knob *k) override |
virtual void | print_info (std::ostream &o) |
unsigned | objects () const |
unsigned | vertices (int obj) const |
std::vector< GeoInfo::Cache > & | getCacheList () |
HandlesMode | doAnyHandles (ViewerContext *) override |
void | build_matrix_handles (ViewerContext *ctx, const Matrix4 *localMatrix=NULL) |
void | build_handles (ViewerContext *ctx) override |
virtual void | select_geometry (ViewerContext *, GeometryList &scene_objects) |
void | assign_drawlists (int obj, GeoInfo &info) |
Display3DMode | display3d () const |
RenderMode | render_mode () const |
bool | selectable () const |
virtual bool | selection3DChanged (ViewerContext *ctx) |
virtual bool | selection3DCleared () |
virtual bool | selection3DMouseDown (ViewerContext *ctx) |
virtual bool | selection3DMouseUp (ViewerContext *ctx) |
virtual bool | selection3DMouseDrag (ViewerContext *ctx) |
const Hash & | hash (int i) const |
const GeometryMask & | rebuild_mask () const |
bool | rebuild (const GeometryMask &m=GeometryMask(Mask_All_Geometry)) const |
void | set_rebuild (const GeometryMask &m) |
void | clear_rebuild (const GeometryMask &m) |
const GeneralInfo & | generalInfo () const override |
GeoOp * | geoOp () override |
Cast to a GeoOp. This is much cheaper and safer than using dynamic_cast. | |
const GeoOp * | geoOp () const override |
Static Public Member Functions | |
static void | transform_points (PointList *out, const PointList *in, const Matrix4 &) |
static void | transform_points (PointList *out, const PointList *in, int start, int end, const Matrix4 &) |
static void | clear_drawlist_trashbin () |
Protected Member Functions | |
GeoOp (Node *) | |
Base class constructor. | |
void | _validate (bool for_real) override |
virtual void | updateGeneralInfo () |
void | display3d (Display3DMode v) |
void | selectable (bool v) |
void | render_mode (RenderMode v) |
void | backface_culling (int v) |
void | update_geometry_hashes () |
virtual void | get_geometry_hash () |
void | delete_cache () |
void | synchronize_cache (GeometryList &out) |
void | delete_allocations (GeoInfo::Cache &cache) |
virtual void | geometry_engine (Scene &, GeometryList &out) |
void | add_draw_geometry (ViewerContext *) |
Protected Attributes | |
Hash | geo_hash [Group_Last] |
Scene * | scene_ |
Points to scene if it is turned on. | |
GeneralInfo | info_ |
std::vector< GeoInfo::Cache > | cache_list |
Geometry cache structures. | |
Hash | cache_hash [Group_Last] |
Cache out-of-dateness hashes. | |
GeometryMask | rebuild_mask_ |
What groups need updating. | |
bool | cache_resursive |
Hash | cache_build_hash |
int | display3d_ |
GUI display setting. | |
bool | selectable_ |
GUI selectable checkmark. | |
int | render_mode_ |
Render setting. | |
int | backface_culling_ |
Backface cull setting. | |
bool | cast_shadow_ |
bool | receive_shadow_ |
Static Protected Attributes | |
static Hash | sInitialGeoHash |
static Hash | sInitialCacheHash |
Friends | |
class | GeometryList |
std::ostream & | operator<< (std::ostream &, const GeoOp &) |
Base class for an Op that produces a GeoInfo. The data is accessed by calling geometry_engine() and passing it a Scene to add a new GeoInfo to.
GeoOp::~GeoOp | ( | ) | [virtual] |
Base class destructor destroys the cache if there is one.
References delete_cache(), and scene_.
GeoOp::GeoOp | ( | Node * | node | ) | [protected] |
Base class constructor.
Only subclasses can create an instance.
References backface_culling_, cache_hash, cache_list, display3d_, geo_hash, rebuild_mask_, render_mode_, scene_, and selectable_.
void GeoOp::build_scene | ( | Scene & | scene | ) |
Start the geometry construction process. This would typically be called directly by a viewer, renderer or write node. If the scene's hash are different than the geo's, rebuild the scene. The output object list/cache is filled in by the GeoOp tree during the geometry_engine() call. To reduce having to constantly recalculate primitive structures, we only rebuild those geometry groups whose rebuild flag is set in the cache's rebuild_mask.
References DD::Image::GeoInfo::Cache::attributes, cache_list, DD::Image::Op::Class(), DD::Image::Scene::clear_lights(), DD::Image::Box3::empty(), geo_hash, get_geometry(), DD::Image::Mask_Attributes, DD::Image::Mask_Matrix, DD::Image::Mask_Object, DD::Image::Mask_Points, DD::Image::Mask_Primitives, DD::Image::GeoInfo::matrix, DD::Image::Scene::object_list_, DD::Image::GeoInfo::Cache::points, DD::Image::GeoInfo::Cache::primitives, rebuild_mask_, DD::Image::GeoInfo::recursion_geo, DD::Image::GeoInfo::selected_items_list, DD::Image::GeoInfo::source_geo, DD::Image::GeometryList::synchronize_objects(), DD::Image::Box3::transform(), and DD::Image::GeoInfo::validate().
Referenced by DD::Image::Render::_validate(), and setupScene().
void GeoOp::get_geometry | ( | Scene & | scene, |
GeometryList & | out | ||
) |
Constructs GeoInfo structures and adds them to the passed-in Scene.
References DD::Image::GeoInfo::Cache::attributes, DD::Image::GeoInfo::Cache::bbox, cache_hash, cache_list, DD::Image::GeoInfo::Cache::call_lists, DD::Image::Op::Class(), DD::Image::RefCountedPtr< T >::clear(), DD::Image::GeoInfo::display3d, display3d_, DD::Image::GeoInfo::final_geo, DD::Image::GeometryList::geo(), geo_hash, geometry_engine(), DD::Image::Mask_Attributes, DD::Image::Mask_Object, DD::Image::Mask_Points, DD::Image::Mask_Primitives, DD::Image::Op::node_gl_color(), DD::Image::GeoInfo::Cache::points, DD::Image::GeoInfo::Cache::primitives, rebuild_mask(), rebuild_mask_, DD::Image::GeoInfo::Cache::recursion_mask, DD::Image::GeoInfo::render_mode, render_mode_, DD::Image::Hash::reset(), DD::Image::GeoInfo::selectable, selectable_, DD::Image::GeometryList::size(), DD::Image::GeoInfo::source_node_gl_color, DD::Image::GeometryList::synchronize_objects(), DD::Image::GeoInfo::Cache::type, DD::Image::GeoInfo::valid_source_node_gl_color, and DD::Image::GeoInfo::Cache::vertices.
Referenced by build_scene(), DD::Image::TransformGeo::geometry_engine(), DD::Image::ModifyGeo::geometry_engine(), and geometry_engine().
void GeoOp::setupScene | ( | ) |
Create a scene if necessary and do prerequisite setup to allow drawing
References assign_drawlists(), build_scene(), DD::Image::Scene::object_list_, scene_, and DD::Image::GeometryList::size().
Referenced by add_draw_geometry().
bool GeoOp::evaluate_transform | ( | int | obj, |
GeometryList & | out, | ||
bool | transform_normals = true |
||
) |
Check if matrix is non-identity and if so, apply it to all the points. This 'cooks' the matrix into the points so that subsequent modifiers get the points in the correct space. The matrix is reset to identity.
References DD::Image::Attribute::array(), DD::Image::Matrix4::inverse(), DD::Image::Matrix4::makeIdentity(), DD::Image::Mask_Points, DD::Image::GeoInfo::matrix, DD::Image::NORMAL_ATTRIB, DD::Image::Matrix4::ntransform(), and transform_points().
Referenced by DD::Image::ModifyGeo::geometry_engine().
void GeoOp::transform_points | ( | PointList * | out, |
const PointList * | in, | ||
const Matrix4 & | m | ||
) | [static] |
Transform all points by a matrix.
Referenced by evaluate_transform().
void GeoOp::transform_points | ( | PointList * | out, |
const PointList * | in, | ||
int | start, | ||
int | end, | ||
const Matrix4 & | m | ||
) | [static] |
Transform a range of points by a matrix.
References DD::Image::Matrix4::transform().
Op * GeoOp::default_input | ( | int | input | ) | const [override, virtual] |
Return a default op for input0.
Reimplemented from DD::Image::Op.
Reimplemented in DD::Image::TransformGeo.
bool GeoOp::test_input | ( | int | input, |
Op * | op | ||
) | const [override, virtual] |
const char * GeoOp::node_shape | ( | ) | const [override, virtual] |
Draw a round sided box.
Reimplemented from DD::Image::Op.
int GeoOp::knob_changed | ( | Knob * | k | ) | [override, virtual] |
Forces tile_color & gl_color knob changes to update op.
Reimplemented from DD::Image::Op.
Reimplemented in DD::Image::ReadGeo.
References DD::Image::Op::invalidate(), DD::Image::Op::knob(), DD::Image::Knob::NO_KNOB_CHANGED, and DD::Image::Knob::showPanel.
void GeoOp::print_info | ( | std::ostream & | o | ) | [virtual] |
void GeoOp::build_matrix_handles | ( | ViewerContext * | ctx, |
const Matrix4 * | localMatrix = NULL |
||
) |
Tree-climbing call. pass localMatrix if you're op contains it's own transform knob so that nodes up the tree are displayed correctly
References add_draw_geometry(), DD::Image::Op::add_input_handle(), DD::Image::Op::build_input_handles(), DD::Image::Op::build_knob_handles(), DD::Image::CONNECTED, DD::Image::ViewerContext::connected(), DD::Image::CameraOp::from_format(), DD::Image::IopInfoOwner::info(), DD::Image::Op::input(), DD::Image::Op::inputs(), DD::Image::Op::iop(), DD::Image::ViewerContext::modelmatrix, DD::Image::Op::node_disabled(), DD::Image::Matrix4::scale(), DD::Image::SHOW_OBJECT, DD::Image::SHOW_PUSHED_OBJECT, DD::Image::ViewerContext::transform_mode(), DD::Image::Op::validate(), DD::Image::VIEWER_2D, and DD::Image::ViewerContext::viewer_mode().
Referenced by build_handles().
void GeoOp::build_handles | ( | ViewerContext * | ctx | ) | [override, virtual] |
Internally this calls build_matrix_handles with a NULL matrix
Reimplemented from DD::Image::Op.
Reimplemented in DD::Image::TransformGeo.
References build_matrix_handles().
void GeoOp::select_geometry | ( | ViewerContext * | ctx, |
GeometryList & | scene_objects | ||
) | [virtual] |
Search up the tree to set the selected nodes and bounding box based on whether user has nodes selected and/or open.
References DD::Image::GeoInfo::display3d, DD::Image::Op::input(), DD::Image::Op::node_selected(), DD::Image::GeoInfo::select_geo, select_geometry(), DD::Image::GeoInfo::selectable, and DD::Image::GeoInfo::selected.
Referenced by add_draw_geometry(), and select_geometry().
void GeoOp::assign_drawlists | ( | int | obj, |
GeoInfo & | info | ||
) |
Assigns the current drawlist allocation for object obj to the GeoInfo. If it doesn't exist yet create it.
References cache_list.
Referenced by setupScene().
const GeometryMask& DD::Image::GeoOp::rebuild_mask | ( | ) | const [inline] |
What groups need updating.
Referenced by get_geometry().
void GeoOp::_validate | ( | bool | for_real | ) | [override, protected, virtual] |
GeoOp subclass-dependent portion of validate(). This builds
Reimplemented from DD::Image::Op.
Reimplemented in DD::Image::ReadGeo, and DD::Image::TransformGeo.
References update_geometry_hashes().
void GeoOp::update_geometry_hashes | ( | ) | [protected] |
Calculate the geometry hashes. If the hashes are different from the cache's, set the cache rebuild flags.
References cache_hash, display3d_, geo_hash, get_geometry_hash(), DD::Image::Op::node(), DD::Image::Op::node_gl_color(), rebuild_mask_, render_mode_, and selectable_.
Referenced by DD::Image::TransformGeo::_validate(), and _validate().
void GeoOp::get_geometry_hash | ( | ) | [protected, virtual] |
Return a hash value which indicates the out-of-dateness of the object's primitives. The default implementation validates the passed-in GeoOp and copies its hashes. If the GeoOp depends on an input's geometry this should be called prior to other knob hashes being applied.
Reimplemented in DD::Image::NullGeo, DD::Image::ReadGeo, DD::Image::SourceGeo, and DD::Image::TransformGeo.
References geo_hash, DD::Image::Hash::reset(), and DD::Image::Op::validate().
Referenced by update_geometry_hashes().
void GeoOp::delete_cache | ( | ) | [protected] |
Delete all locally allocated geometry and clear the cache.
References cache_list, and delete_allocations().
Referenced by DD::Image::GeometryList::delete_objects(), and ~GeoOp().
void GeoOp::synchronize_cache | ( | GeometryList & | out | ) | [protected] |
Synchronize the local cache objects with the output GeometryList. For an empty output this simply means adding objects to it, otherwise if a higher up GeoOp has already added objects we must compare our cache objects against the output objects and resolve any differences.
For each object in the local cache find the corresponding object in the output list. Rearrange, add or delete if different. Two pieces of information are needed for this: 1) The unique hash id derived from the originating GeoOp Node and the index of the object. 2) The version number, or copy number, incremented at each split. We must handle cases of an object disappearing from the output as well as new objects appearing. There are two distinct update phases we must handle: The cache being brand new and the cache already existing but objects are in a different order.
References DD::Image::GeoInfo::Cache::bbox, cache_list, DD::Image::GeoInfo::Cache::call_lists, DD::Image::GeoInfoRenderState::castShadow, delete_allocations(), DD::Image::GeoInfo::display3d, DD::Image::GeoInfo::final_geo, DD::Image::GeoInfo::Cache::out_id, DD::Image::GeoInfo::Cache::points, DD::Image::GeoInfo::Cache::primitives, DD::Image::GeoInfoRenderState::receiveShadow, DD::Image::GeoInfo::Cache::recursion_mask, DD::Image::GeoInfo::render_mode, DD::Image::GeoInfo::selectable, selectable_, DD::Image::GeoInfo::source_node_gl_color, DD::Image::GeoInfo::Cache::src_id, DD::Image::GeoInfo::Cache::type, DD::Image::GeoInfo::valid_source_node_gl_color, DD::Image::GeoInfo::Cache::version, DD::Image::version(), and DD::Image::GeoInfo::Cache::vertices.
Referenced by DD::Image::GeometryList::synchronize_objects().
void GeoOp::delete_allocations | ( | GeoInfo::Cache & | cache | ) | [protected] |
Delete any allocated pointers in cache. You better be the owner of the cache!
References DD::Image::GeoInfo::Cache::attributes, DD::Image::GeoInfo::Cache::call_lists, DD::Image::RefCountedPtr< T >::clear(), DD::Image::GeoInfo::Cache::points, DD::Image::GeoInfo::Cache::primitives, and DD::Image::GeoInfo::Cache::vertices.
Referenced by delete_cache(), and synchronize_cache().
void GeoOp::geometry_engine | ( | Scene & | scene, |
GeometryList & | out | ||
) | [protected, virtual] |
Sub-class dependent portion of get_geometry(). This should be implemented on plugins to construct geometry. The default implementation gets the input's geometry.
Reimplemented in DD::Image::ModifyGeo, DD::Image::NullGeo, DD::Image::ReadGeo, DD::Image::SourceGeo, and DD::Image::TransformGeo.
References get_geometry().
Referenced by get_geometry().
void GeoOp::add_draw_geometry | ( | ViewerContext * | ctx | ) | [protected] |
Subclasses can call this in build_handles(). It will construct the output geometry and add callbacks to draw it in the viewer. You should only call this if ctx->connected is >= SHOW_OBJECT and should then set ctx->connected to CONNECTED before calling any inputs, so that objects are not drawn more than once. Also you must call validate(false) before this.
References DD::Image::ViewerContext::add_draw_handle(), DD::Image::Box3::empty(), DD::Image::ViewerContext::expand_bbox(), DD::Image::Matrix4::makeIdentity(), DD::Image::GeoInfo::matrix, DD::Image::ViewerContext::modelmatrix, DD::Image::Op::node(), DD::Image::Op::node_selected(), DD::Image::Scene::object_list_, scene_, DD::Image::GeoInfo::select_geo, select_geometry(), DD::Image::GeoInfo::selected, setupScene(), DD::Image::SHOW_BBOX, DD::Image::GeoInfo::source_geo, and DD::Image::Box3::transform().
Referenced by DD::Image::TransformGeo::build_handles(), and build_matrix_handles().
Hash DD::Image::GeoOp::geo_hash[Group_Last] [protected] |
Out-of-dateness hashes.
Referenced by build_scene(), GeoOp(), get_geometry(), DD::Image::TransformGeo::get_geometry_hash(), DD::Image::SourceGeo::get_geometry_hash(), DD::Image::ReadGeo::get_geometry_hash(), get_geometry_hash(), print_info(), and update_geometry_hashes().