diff --git a/Changes b/Changes
index 56e2adbc4f..2b7dc19b6c 100644
--- a/Changes
+++ b/Changes
@@ -12,6 +12,13 @@ Fixes
Breaking Changes
----------------
+- Renderable : Removed `render()` method.
+- CoordinateSystem : Removed transform.
+- Font : Removed `meshGroup()` method.
+- Options, Group, Transform, MatrixTransform, MatrixMotionTransform, AttributeState, Light, MotionPrimitive : Removed.
+- CurveExtrudeOp, IDXReader : Removed.
+- PreWorldRenderable, StateRenderable : Removed. All derived classes now derive directly from Renderable.
+- Renderer, AttributeBlock, EditBlock, MotionBlock, TransformBlock, WorldBlock : Removed.
- IECoreHoudini : Removed.
- IECoreMaya : Removed.
- IECoreNuke : Removed.
diff --git a/contrib/IECoreAlembic/src/IECoreAlembic/CameraReader.cpp b/contrib/IECoreAlembic/src/IECoreAlembic/CameraReader.cpp
index c7687fce52..e900794212 100644
--- a/contrib/IECoreAlembic/src/IECoreAlembic/CameraReader.cpp
+++ b/contrib/IECoreAlembic/src/IECoreAlembic/CameraReader.cpp
@@ -36,7 +36,6 @@
#include "IECoreAlembic/ObjectReader.h"
#include "IECoreScene/Camera.h"
-#include "IECoreScene/Transform.h"
#include "IECore/SimpleTypedData.h"
diff --git a/include/IECoreGL/Renderer.h b/include/IECoreGL/Renderer.h
deleted file mode 100644
index 028b746ab5..0000000000
--- a/include/IECoreGL/Renderer.h
+++ /dev/null
@@ -1,501 +0,0 @@
-//////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2007-2013, Image Engine Design Inc. All rights reserved.
-// Copyright (c) 2011, John Haddon. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// * Neither the name of Image Engine Design nor the names of any
-// other contributors to this software may be used to endorse or
-// promote products derived from this software without specific prior
-// written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-//////////////////////////////////////////////////////////////////////////
-
-#ifndef IECOREGL_RENDERER_H
-#define IECOREGL_RENDERER_H
-
-#include "IECoreGL/Export.h"
-#include "IECoreGL/TypeIds.h"
-
-#include "IECoreScene/Renderer.h"
-
-namespace IECoreGL
-{
-
-IE_CORE_FORWARDDECLARE( Scene );
-IE_CORE_FORWARDDECLARE( TextureLoader );
-IE_CORE_FORWARDDECLARE( ShaderLoader );
-
-/// \addtogroup environmentGroup
-///
-/// IECOREGL_SHADER_PATHS
-/// IECOREGL_SHADER_INCLUDE_PATHS
-/// IECOREGL_TEXTURE_PATHS
-/// IECORE_FONT_PATHS
-/// Used to specify default resource locations for the IECoreGL::Renderer.
-
-/// The IECoreGL::Renderer class implements the IECore::Renderer interface to
-/// allow rendering to OpenGL. Immediate mode rendering allows the generation of
-/// images and deferred mode rendering allows scenes to be captured for later interactive
-/// display.
-/// \ingroup renderingGroup
-class IECOREGL_API Renderer : public IECoreScene::Renderer
-{
- public :
-
- Renderer();
- ~Renderer() override;
-
- IE_CORE_DECLARERUNTIMETYPEDEXTENSION( IECoreGL::Renderer, RendererTypeId, IECoreScene::Renderer );
-
- /// \par Standard options supported :
- ///
- /// \li "searchPath:font"
- ///
- /// \par Implementation specific options supported :
- ///
- /// "gl:mode" StringData
- /// Valid values are "immediate" or "deferred". In immediate mode rendering is
- /// performed in a streaming fashion, drawing each primitive as it is
- /// specified. In deferred mode rendering is performed by building a Scene
- /// object which can be retrieved for further use by using the scene() method
- /// after the render is complete. Future versions may support advanced features
- /// such as motion blur and depth of field when in deferred mode but not in immediate mode.
- ///
- /// "searchPath:shader" StringData
- /// "gl:searchPath:shader" StringData
- /// Specifies a set of colon separated paths on which to search for GLSL shaders. The default
- /// value is obtained from the environment variable IECOREGL_SHADER_PATHS.
- ///
- /// "searchPath:shaderInclude" StringData
- /// "gl:searchPath:shaderInclude" StringData
- /// Specifies a set of colon separated paths on which to search for include files for GLSL shaders. The default
- /// value is obtained from the environment variable IECOREGL_SHADER_INCLUDE_PATHS.
- ///
- /// "searchPath:texture" StringData
- /// "gl:searchPath:texture" StringData
- /// Specifies a set of colon separated paths on which to search for textures. The default
- /// value is obtained from the environment variable IECOREGL_TEXTURE_PATHS. Any image file format
- /// for which an IECore::Reader is available is suitable for use as a texture.
- ///
- /// "shutter" V2fData
- ///
- /// "gl:drawCoordinateSystems" BoolData false
- /// When this is true, coordinate systems created with the coordinateSystem() method
- /// will be visualised.
- void setOption( const std::string &name, IECore::ConstDataPtr value ) override;
- IECore::ConstDataPtr getOption( const std::string &name ) const override;
-
- void camera( const std::string &unusedName, const IECore::CompoundDataMap ¶meters ) override;
- void display( const std::string &name, const std::string &type, const std::string &data, const IECore::CompoundDataMap ¶meters ) override;
-
- void worldBegin() override;
- void worldEnd() override;
- /// When in deferred mode (see setOption above), this method will return the Scene that
- /// was generated.
- /// \threading The Renderer tries very hard not to need a GL context to operate in when in deferred mode. This allows it to evaluate multiple
- /// procedurals concurrently in separate threads (GL wants only one threading talking to a context). When the scene is rendered for the first
- /// time it will instantiate various OpenGL resources (textures and shaders and the like) in the current GL context. It is therefore important that
- /// the scene is destroyed from the same thread that renders it, so that the resources are released in the correct context. As the resources are
- /// also shared by caches (TextureLoaders and ShaderLoaders) in the Renderer, it is also important that the renderer is destroyed from this same
- /// thread.
- ScenePtr scene();
-
- void transformBegin() override;
- void transformEnd() override;
- void setTransform( const Imath::M44f &m ) override;
- void setTransform( const std::string &coordinateSystem ) override;
- Imath::M44f getTransform() const override;
- Imath::M44f getTransform( const std::string &coordinateSystem ) const override;
- void concatTransform( const Imath::M44f &m ) override;
- void coordinateSystem( const std::string &name ) override;
-
- void attributeBegin() override;
- void attributeEnd() override;
- /// \par Standard attributes supported :
- ////////////////////////////////////////////////////////////
- ///
- /// \li "color"
- /// Sets the rgb components of the current OpenGL
- /// color.
- /// \li "opacity"
- /// Sets the alpha component of the current OpenGL
- /// color to the average of the rgb components of
- /// opacity.
- ///
- /// \li "doubleSided"
- /// \li "rightHandedOrientation"
- /// \li "name"
- ///
- /// \li "user:*"
- ///
- /// \par Implementation specific attributes :
- ////////////////////////////////////////////////////////////
- ///
- /// \li "gl:color" Color4fData Color4f( 1.0f )
- /// Sets the current OpenGL color including the
- /// alpha component.
- ///
- /// \par Implementation specific shading attributes :
- ////////////////////////////////////////////////////////////
- ///
- /// \li "gl:shade:transparent" BoolData false
- /// Signifies that shading may result in
- /// transparent results. This is necessary as
- /// it's nontrivial to determine this
- /// information by querying the shader, and
- /// other parts of the system may need to
- /// know when transparency is present - for
- /// example to trigger depth sorting.
- ///
- /// \par Implementation specific primitive style attributes :
- ////////////////////////////////////////////////////////////
- ///
- /// \li "gl:primitive:wireframe" BoolData false
- /// Draw a wireframe for each primitive.
- ///
- /// \li "gl:primitive:wireframeWidth" FloatData 1.0f
- /// The line width of the wireframe of the primitive.
- ///
- /// \li "gl:primitive:wireframeColor" Color4fData
- /// The color of the wireframes drawn.
- ///
- /// \li "gl:primitive:bound" BoolData false
- /// Draw a bounding box for each primitive.
- ///
- /// \li "gl:primitive:boundColor" Color4fData
- /// The color of the bounding boxes drawn.
- ///
- /// \li "gl:primitive:solid" BoolData true
- /// Draw each primitive solid.
- ///
- /// \li "gl:primitive:outline" BoolData false
- /// Draw an outline for each primitive. Note that the results
- /// of having this on with filled mode off will probably be
- /// undesirable.
- ///
- /// \li "gl:primitive:outlineColor" Color4fData
- /// The color of the outlines drawn.
- ///
- /// \li "gl:primitive:outlineWidth" FloatData 1.0f
- /// The line width of the outlines of the primitive.
- ///
- /// \li "gl:primitive:points" BoolData false
- /// Draw the vertices of each primitive as points.
- ///
- /// \li "gl:primitive:pointWidth" FloatData 1.0f
- /// The width of the points used to draw vertices.
- ///
- /// \li "gl:primitive:pointColor" Color4fData
- /// The color of the points drawn.
- ///
- /// \li "gl:primitive:selectable" BoolData true
- /// Allow the primitive to be selected. ( ie. it will be drawn when we render for selection purposes )
- ///
- /// \li "gl:primitive:sortForTransparency" BoolData true
- /// Causes the individual components of a
- /// primitive to be sorted in depth when the "gl:shade:transparent"
- /// attribute is true.
- /// This is currently supported only by the
- /// points primitive.
- ///
- /// \par Implementation specific points primitive attributes :
- ////////////////////////////////////////////////////////////
- ///
- /// \li "gl:pointsPrimitive:useGLPoints" StringData "forGLPoints"
- /// Can be used to force the use of lightweight glPoints
- /// representation of points primitives with types other than "gl:point".
- /// Valid values are :
- /// "forGLPoints"
- /// Use lightweight points only if type is "gl:point"
- /// "forParticlesAndDisks"
- /// Use lightweight points as a stand in for particle and disk types.
- /// "forAll"
- /// Use lightweight points as a stand in for all point types.
- ///
- /// \li "gl:pointsPrimitive:glPointWidth" FloatData 1.0f
- /// The size of the points (in pixels) used when rendering lightweight
- /// points.
- ///
- /// \par Implementation specific curves primitive attributes :
- ////////////////////////////////////////////////////////////
- ///
- /// \li "gl:curvesPrimitive:useGLLines" BoolData false
- /// When this is true then lightweight OpenGL line primitives are used
- /// for representing curves.
- ///
- /// \li "gl:curvesPrimitive:glLineWidth" FloatData 1.0f
- /// Specifies the line width (in pixels) which is used when
- /// rendering lightweight line primitives.
- ///
- /// \li "gl:curvesPrimitive:ignoreBasis" BoolData false
- /// When this is true, all curves are rendered as if they were linear.
- ///
- /// \par Implementation specific text primitive attributes :
- ////////////////////////////////////////////////////////////
- ///
- /// \li "gl:textPrimitive:type" StringData "mesh"
- /// Controls the basic method used for text rendering. A value
- /// of "mesh" specifies that text primitives are rendered as
- /// triangulated meshes, and a value of "sprite" specifies rendering
- /// as textured planes. The former allows completely customisable shading
- /// using the current shader, whereas the latter is shaded constantly
- /// using the current colour, but may offer better anti-aliasing and/or
- /// speed.
- ///
- /// \par Implementation specific blending attributes :
- ////////////////////////////////////////////////////////////
- ///
- /// \li "gl:blend:srcFactor" StringData "srcAlpha"
- /// \li "gl:blend:dstFactor" StringData "oneMinusSrcAlpha"
- /// These attributes are mapped onto calls to glBlendFunc.
- /// They accept only the values below, which
- /// correspond directly to one of the GLenum blending
- /// values.
- /// "zero"
- /// "one"
- /// "srcColor"
- /// "oneMinusSrcColor"
- /// "dstColor"
- /// "oneMinusDstColor"
- /// "srcAlpha"
- /// "oneMinusSrcAlpha"
- /// "dstAlpha"
- /// "oneMinusDstAlpha"
- /// "constantColor"
- /// "oneMinusConstantColor"
- /// "constantAlpha"
- /// "oneMinusConstantAlpha"
- ///
- /// \li "gl:blend:color" Color4fData 1 1 1 1
- /// Used to specify glBlendColor(), only taking effect when using
- /// either "constantColor" or "oneMinusConstantColor" for one or
- /// other of the blend factors above.
- ///
- /// \li "gl:blend:equation" StringData "add"
- /// Controls how the src and dst values are combined after being weighted
- /// by srcFactor and dstFactor - this maps onto a call to glBlendEquation.
- /// Valid values are listed below, and map directly onto the corresponding
- /// GLenum values.
- /// "add"
- /// "subtract"
- /// "reverseSubtract"
- /// "min"
- /// "max"
- ///
- /// \li "gl:alphaTest" BoolData false
- /// When this is true, gl alpha testing will be enabled.
- ///
- /// \li "gl:alphaTest:value" FloatData 0
- /// Alpha test comparison value for glAlphaFunc
- ///
- /// \li "gl:alphaTest:mode" StringData "always"
- /// Alpha test comparison mode for glAlphaFunc.
- /// Valid values are listed below, and map directly onto the corresponding
- /// GLenum values.
- /// "never"
- /// "less"
- /// "equal"
- /// "lequal"
- /// "greater"
- /// "notequal"
- /// "gequal"
- /// "always"
- ///
- /// \par Implementation specific antialiasing attributes :
- ///////////////////////////////////////////////////////////
- ///
- /// \li "gl:smoothing:points" BoolData false
- /// \li "gl:smoothing:lines" BoolData false
- /// \li "gl:smoothing:polygons" BoolData false
- /// These attributes enable GL_POINT_SMOOTH, GL_LINE_SMOOTH and
- /// GL_POLYGON_SMOOTH respectively.
- ///
- /// \par Implementation specific procedural attributes :
- ////////////////////////////////////////////////////////////
- ///
- /// \li "gl:procedural:reentrant" BoolData true
- /// When true, procedurals may be evaluated in multiple parallel threads.
- /// When false they will be evaluated from the same thread they were specified
- /// from.
- /// \par Implementation specific depth buffer attributes :
- ////////////////////////////////////////////////////////////
- ///
- /// \li "gl:depthTest" BoolData true
- /// Maps to glEnable/Disable GL_DEPTH_TEST
- ///
- /// \li "gl:depthMask" BoolData true
- /// Maps to glDepthMask GL_TRUE/GL_FALSE
- ///
- /// \par Implementation specific visibility attributes :
- ////////////////////////////////////////////////////////////
- ///
- /// \li "gl:visibility:camera" BoolData true
- /// Specifies whether or not objects are visible to the camera.
- /// If a procedural is not visible then it will not be opened
- /// to discover if it's contents might turn visibility back on.
- ///
- /// \par Instancing attributes :
- ////////////////////////////////////////////////////////////
- ///
- /// \li "automaticInstancing" BoolData true
- /// \li "gl:automaticInstancing" BoolData true
- /// Specifies that instances are automatically created if
- /// identical primitives are passed to the renderer
- /// repeatedly. This is currently implemented only for the
- /// mesh, points and curves primitive types.
- ////////////////////////////////////////////////////////////
- void setAttribute( const std::string &name, IECore::ConstDataPtr value ) override;
- IECore::ConstDataPtr getAttribute( const std::string &name ) const override;
- /// Supports only shader type "surface" or "gl:surface", looking for "name.vert" and "name.frag" GLSL source files
- /// in the paths defined by the "searchPath:shader" option. Alternatively if the parameter list contains
- /// "gl:vertexSource" and/or a "gl:fragmentSource" StringData then a new shader is created using the source provided.
- /// For shaders with sampler2D parameters, texture files for these parameters may be specified by passing the filename
- /// to an image as StringData.
- /// \todo Add support for "textureParameterName:filter" and "textureParameterName:wrap" parameters which set wrapping
- /// and filtering on a ShaderStateComponent.
- void shader( const std::string &type, const std::string &name, const IECore::CompoundDataMap ¶meters ) override;
- void light( const std::string &name, const std::string &handle, const IECore::CompoundDataMap ¶meters ) override;
- void illuminate( const std::string &lightHandle, bool on ) override;
-
- void motionBegin( const std::set × ) override;
- void motionEnd() override;
-
- /// Supports the following primitive variables :
- ///
- /// Vertex V3fVectorData "P"
- ///
- /// Uniform StringData "type"
- /// Used to determine how the points are rendered. Supported types are :
- ///
- /// "gl:point"
- /// Rendered as GL_POINTS
- ///
- /// "particle" (the default)
- /// "disk"
- /// "blobby"
- /// Rendered as camera facing disks. The "width" and "constantwidth" variables are supported.
- /// Blobby is provided for vague compatibility with the IECoreRI::RIRenderer and 3delight.
- ///
- /// "patch"
- /// Rendered as camera facing patches. Supports the "width" and "constantwidth" variables
- /// and in addition the "patchaspectratio" and "patchrotation" variables. See the 3delight
- /// documentation for a description of how these can be used.
- ///
- /// "sphere"
- /// Rendered as spheres. Supports "width" and "constantwidth" variables to define the
- /// sizes of the spheres.
- ///
- /// Constant FloatData "constantwidth"
- ///
- /// Vertex|Varying FloatVectorData "width"
- ///
- /// Constant|Vertex|Varying FloatData|FloatVectorData "patchaspectratio"
- /// Constant|Vertex|Varying FloatData|FloatVectorData "patchrotation"
- /// These two are used only by the "patch" type.
- void points( size_t numPoints, const IECoreScene::PrimitiveVariableMap &primVars ) override;
- void disk( float radius, float z, float thetaMax, const IECoreScene::PrimitiveVariableMap &primVars ) override;
- /// Supports the following primitive variables :
- ///
- /// Vertex V3fVectorData "P"
- /// Constant FloatData "width"
- void curves( const IECore::CubicBasisf &basis, bool periodic, IECore::ConstIntVectorDataPtr numVertices, const IECoreScene::PrimitiveVariableMap &primVars ) override;
- void text( const std::string &font, const std::string &text, float kerning = 1.0f, const IECoreScene::PrimitiveVariableMap &primVars=IECoreScene::PrimitiveVariableMap() ) override;
- void sphere( float radius, float zMin, float zMax, float thetaMax, const IECoreScene::PrimitiveVariableMap &primVars ) override;
- /// Supports the following image formats specified as primitive variables :
- ///
- /// "R", "G", "B", "A" : UCharVectorData
- /// "R", "G", "B", "A" : CharVectorData
- /// "R", "G", "B", "A" : UIntVectorData
- /// "R", "G", "B", "A" : IntVectorData
- /// "R", "G", "B", "A" : HalfVectorData
- /// "R", "G", "B", "A" : FloatVectorData
- /// "R", "G", "B", "A" : DoubleVectorData
- ///
- /// As a convenience the names "r", "g", "b", "a" or "red", "green", "blue", "alpha" can
- /// appear in place of "R", "G", "B", "A".
- ///
- /// Currently assumes dataWindow==displayWindow.
- void image( const Imath::Box2i &dataWindow, const Imath::Box2i &displayWindow, const IECoreScene::PrimitiveVariableMap &primVars ) override;
- /// All meshes are treated as having interpolation=="linear".
- /// \todo Support normals and st.
- void mesh( IECore::ConstIntVectorDataPtr vertsPerFace, IECore::ConstIntVectorDataPtr vertIds, const std::string &interpolation, const IECoreScene::PrimitiveVariableMap &primVars ) override;
- /// Not implemented
- void nurbs( int uOrder, IECore::ConstFloatVectorDataPtr uKnot, float uMin, float uMax, int vOrder, IECore::ConstFloatVectorDataPtr vKnot, float vMin, float vMax, const IECoreScene::PrimitiveVariableMap &primVars ) override;
- /// Not implemented
- void patchMesh( const IECore::CubicBasisf &uBasis, const IECore::CubicBasisf &vBasis, int nu, bool uPeriodic, int nv, bool vPeriodic, const IECoreScene::PrimitiveVariableMap &primVars ) override;
- /// Not implemented
- void geometry( const std::string &type, const IECore::CompoundDataMap &topology, const IECoreScene::PrimitiveVariableMap &primVars ) override;
- void procedural( IECoreScene::Renderer::ProceduralPtr proc ) override;
-
- void instanceBegin( const std::string &name, const IECore::CompoundDataMap ¶meters ) override;
- void instanceEnd() override;
- void instance( const std::string &name ) override;
-
- /// \par Commands implemented
- ///
- /// "removeObject"
- /// Expects a StringData parameter named "name", which specifies the name of an object to remove from the scene.
- /// This only has any effect in deferred mode.
- /// "editBegin"
- /// This parameter-less command marks the start of an edit to an existing scene, and should be called before
- /// any other changes are made when re-using an existing renderer, that has already reached worldEnd.
- /// "editEnd"
- /// This parameter-less command marks the end of an edit to an existing scene, and should be called after
- /// other changes have been made when re-using an existing renderer. Note that if a scene has been drawn
- /// with renderer->scene()->render() prior to this edit, then it is essential that editEnd is called by the
- /// same thread on which drawing was performed, so that GL resources can be released in the appropriate context.
- /// "editQuery"
- /// This parameter-less command returns BoolData( true ) if an edit is in progress, and BoolData( false )
- /// otherwise.
- /// \todo Consider generalising an interface for scene edits and making it a standard part of the documentation
- /// in IECore. Any such interface should take into account support for PRMan's new rerendering API.
- IECore::DataPtr command( const std::string &name, const IECore::CompoundDataMap ¶meters ) override;
-
- /// \todo Implement the existing editing commands in this new form.
- void editBegin( const std::string &name, const IECore::CompoundDataMap ¶meters ) override;
- void editEnd() override;
-
- /// Returns the internal ShaderLoader object used to load the shaders for this renderer.
- /// If called before worldBegin it returns 0.
- ShaderLoader *shaderLoader();
-
- /// Returns the internal TextureLoader object.
- /// If called before worldBegin it returns 0.
- TextureLoader *textureLoader();
-
- struct MemberData;
-
- private :
-
- MemberData *m_data;
-
-};
-
-IE_CORE_DECLAREPTR( Renderer );
-
-} // namespace IECoreGL
-
-#endif // IECOREGL_RENDERER_H
diff --git a/include/IECoreGL/TypeIds.h b/include/IECoreGL/TypeIds.h
index 7645b9b97c..aadcadc37c 100644
--- a/include/IECoreGL/TypeIds.h
+++ b/include/IECoreGL/TypeIds.h
@@ -49,7 +49,7 @@ enum TypeId
RenderableTypeId = 105006,
BindableTypeId = 105007,
TextureTypeId = 105008,
- RendererTypeId = 105009,
+ RendererTypeId = 105009, // Obsolete, available for reuse
ShaderTypeId = 105010,
PrimitiveTypeId = 105011,
PointsPrimitiveTypeId = 105012,
@@ -58,8 +58,8 @@ enum TypeId
QuadPrimitiveTypeId = 105015,
SpherePrimitiveTypeId = 105016,
BoxPrimitiveTypeId = 105017,
- RendererImplementationTypeId = 105018,
- DeferredRendererImplementationTypeId = 105019,
+ RendererImplementationTypeId = 105018, // Obsolete, available for reuse
+ DeferredRendererImplementationTypeId = 105019, // Obsolete, available for reuse
PrimitiveWireframeWidthTypeId = 105020,
PrimitiveOutlineWidthTypeId = 105021,
PrimitivePointsTypeId = 105022,
@@ -69,7 +69,7 @@ enum TypeId
FrameBufferTypeId = 105026,
DepthTextureTypeId = 105027,
ColorTextureTypeId = 105028,
- ImmediateRendererImplementationTypeId = 105029,
+ ImmediateRendererImplementationTypeId = 105029, // Obsolete, available for reuse
BlendFuncStateComponentTypeId = 105030,
BlendColorStateComponentTypeId = 105031,
BlendEquationStateComponentTypeId = 105032,
diff --git a/include/IECoreGL/bindings/RendererBinding.h b/include/IECoreGL/bindings/RendererBinding.h
deleted file mode 100644
index 6ec9dea621..0000000000
--- a/include/IECoreGL/bindings/RendererBinding.h
+++ /dev/null
@@ -1,45 +0,0 @@
-//////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2007, Image Engine Design Inc. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// * Neither the name of Image Engine Design nor the names of any
-// other contributors to this software may be used to endorse or
-// promote products derived from this software without specific prior
-// written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-//////////////////////////////////////////////////////////////////////////
-
-#ifndef IE_COREGL_RENDERERBINDING_H
-#define IE_COREGL_RENDERERBINDING_H
-
-namespace IECoreGL
-{
-
-void bindRenderer();
-
-}
-
-#endif // IE_COREGL_RENDERERBINDING_H
diff --git a/include/IECoreGL/private/RendererImplementation.h b/include/IECoreGL/private/RendererImplementation.h
deleted file mode 100644
index f5d6b4ccd7..0000000000
--- a/include/IECoreGL/private/RendererImplementation.h
+++ /dev/null
@@ -1,118 +0,0 @@
-//////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2007-2013, Image Engine Design Inc. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// * Neither the name of Image Engine Design nor the names of any
-// other contributors to this software may be used to endorse or
-// promote products derived from this software without specific prior
-// written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-//////////////////////////////////////////////////////////////////////////
-
-#ifndef IECOREGL_RENDERERIMPLEMENTATION_H
-#define IECOREGL_RENDERERIMPLEMENTATION_H
-
-#include "IECoreGL/TypeIds.h"
-
-#include "IECoreScene/Renderer.h"
-
-#include "IECore/Data.h"
-#include "IECore/Export.h"
-#include "IECore/InternedString.h"
-#include "IECore/RunTimeTyped.h"
-
-IECORE_PUSH_DEFAULT_VISIBILITY
-#include "Imath/ImathMatrix.h"
-IECORE_POP_DEFAULT_VISIBILITY
-
-namespace IECoreGL
-{
-
-IE_CORE_FORWARDDECLARE( StateComponent );
-IE_CORE_FORWARDDECLARE( Primitive );
-IE_CORE_FORWARDDECLARE( Camera );
-IE_CORE_FORWARDDECLARE( Display );
-IE_CORE_FORWARDDECLARE( Group );
-
-/// RendererImplementation classes are used by the Renderer
-/// class to do some of it's work.
-class RendererImplementation : public IECore::RunTimeTyped
-{
-
- public :
-
- IE_CORE_DECLARERUNTIMETYPEDEXTENSION( RendererImplementation, RendererImplementationTypeId, IECore::RunTimeTyped )
-
- RendererImplementation();
- ~RendererImplementation() override;
-
- /// Guaranteed to be called at least once before worldBegin(),
- /// and never after worldBegin().
- virtual void addCamera( CameraPtr camera ) = 0;
- /// Never called after worldBegin().
- virtual void addDisplay( ConstDisplayPtr display ) = 0;
-
- virtual void worldBegin() = 0;
- virtual void worldEnd() = 0;
-
- /// Transform calls guaranteed only to be called after worldBegin().
- virtual void transformBegin() = 0;
- virtual void transformEnd() = 0;
-
- virtual void setTransform( const Imath::M44f &m ) = 0;
- virtual Imath::M44f getTransform() const = 0;
- virtual void concatTransform( const Imath::M44f &matrix ) = 0;
-
- virtual void attributeBegin() = 0;
- virtual void attributeEnd() = 0;
-
- virtual void addState( StateComponentPtr state ) = 0;
- virtual StateComponent *getState( IECore::TypeId type ) = 0;
- template
- T *getState();
-
- // Set a custom state
- virtual void addUserAttribute( const IECore::InternedString &name, IECore::DataPtr value ) = 0;
- // Get a custom state or 0 if not defined.
- virtual IECore::Data *getUserAttribute( const IECore::InternedString &name ) = 0;
- // Get a casted custom state or 0 if not present or incompatible type.
- template
- T *getUserAttribute( const IECore::InternedString &name );
-
- virtual void addPrimitive( ConstPrimitivePtr primitive ) = 0;
-
- virtual void addProcedural( IECoreScene::Renderer::ProceduralPtr proc, IECoreScene::RendererPtr renderer ) = 0;
-
- virtual void addInstance( IECoreGL::GroupPtr grp ) = 0;
-};
-
-IE_CORE_DECLAREPTR( RendererImplementation );
-
-} // namespace IECoreGL
-
-#include "IECoreGL/private/RendererImplementation.inl"
-
-#endif // IECOREGL_RENDERERIMPLEMENTATION_H
diff --git a/include/IECoreGL/private/RendererImplementation.inl b/include/IECoreGL/private/RendererImplementation.inl
deleted file mode 100644
index e5670912df..0000000000
--- a/include/IECoreGL/private/RendererImplementation.inl
+++ /dev/null
@@ -1,55 +0,0 @@
-//////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2007-2010, Image Engine Design Inc. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// * Neither the name of Image Engine Design nor the names of any
-// other contributors to this software may be used to endorse or
-// promote products derived from this software without specific prior
-// written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-//////////////////////////////////////////////////////////////////////////
-
-#ifndef IECOREGL_RENDERERIMPLEMENTATION_INL
-#define IECOREGL_RENDERERIMPLEMENTATION_INL
-
-namespace IECoreGL
-{
-
-template
-T *RendererImplementation::getState()
-{
- return IECore::assertedStaticCast( getState( T::staticTypeId() ) );
-}
-
-template
-T *RendererImplementation::getUserAttribute( const IECore::InternedString &name )
-{
- return IECore::runTimeCast( getUserAttribute( name ) );
-}
-
-} // namespace IECoreGL
-
-#endif // IECOREGL_RENDERERIMPLEMENTATION_H
diff --git a/include/IECoreScene/AttributeBlock.h b/include/IECoreScene/AttributeBlock.h
deleted file mode 100644
index 08a5306dbf..0000000000
--- a/include/IECoreScene/AttributeBlock.h
+++ /dev/null
@@ -1,69 +0,0 @@
-//////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2009-2011, Image Engine Design Inc. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// * Neither the name of Image Engine Design nor the names of any
-// other contributors to this software may be used to endorse or
-// promote products derived from this software without specific prior
-// written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-//////////////////////////////////////////////////////////////////////////
-
-#ifndef IECORESCENE_ATTRIBUTEBLOCK_H
-#define IECORESCENE_ATTRIBUTEBLOCK_H
-
-#include "IECoreScene/Export.h"
-#include "IECoreScene/Renderer.h"
-
-#include "boost/noncopyable.hpp"
-
-namespace IECoreScene
-{
-
-/// The AttributeBlock class provides a simple means of ensuring that renderer->attributeBegin()
-/// calls are matched by renderer->attributeEnd() calls, even in the face of exceptions and
-/// multiple return statements from a function.
-/// \ingroup renderingGroup
-class IECORESCENE_API AttributeBlock : public boost::noncopyable
-{
- public :
-
- /// Starts a new attribute block, calling renderer->attributeBegin(). If active is false
- /// then nothing is done.
- AttributeBlock( RendererPtr renderer, bool active=true );
- /// Closes the attribute block by calling renderer->attributeEnd(). If active was false
- /// in the constructor then nothing is done.
- ~AttributeBlock();
-
- private :
-
- RendererPtr m_renderer;
-
-};
-
-} // namespace IECoreScene
-
-#endif // IECORESCENE_ATTRIBUTEBLOCK_H
diff --git a/include/IECoreScene/AttributeState.h b/include/IECoreScene/AttributeState.h
deleted file mode 100644
index e641d784d9..0000000000
--- a/include/IECoreScene/AttributeState.h
+++ /dev/null
@@ -1,81 +0,0 @@
-//////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2007-2010, Image Engine Design Inc. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// * Neither the name of Image Engine Design nor the names of any
-// other contributors to this software may be used to endorse or
-// promote products derived from this software without specific prior
-// written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-//////////////////////////////////////////////////////////////////////////
-
-#ifndef IECORESCENE_ATTRIBUTESTATE_H
-#define IECORESCENE_ATTRIBUTESTATE_H
-
-#include "IECoreScene/Export.h"
-#include "IECoreScene/StateRenderable.h"
-
-namespace IECoreScene
-{
-
-/// A class to manipulate the attribute state of a Renderer.
-/// \todo Make order of rendering match order of addition - there are cases where
-/// 3delight cares very much what order attributes are specified in (subsurface attributes in particular).
-/// \ingroup renderingGroup
-class IECORESCENE_API AttributeState : public StateRenderable
-{
- public:
-
- /// Attributes is referenced directly rather than copied.
- AttributeState( IECore::CompoundDataPtr attributes );
- AttributeState( const IECore::CompoundDataMap &attributes = IECore::CompoundDataMap() );
- ~AttributeState() override;
-
- IE_CORE_DECLAREEXTENSIONOBJECT( AttributeState, AttributeStateTypeId, StateRenderable );
-
- IECore::CompoundDataMap &attributes();
- const IECore::CompoundDataMap &attributes() const;
- /// This is mostly of use for the binding - the attributes()
- /// function gives more direct access to the contents of the CompoundData
- /// (it calls readable() or writable() for you).
- IECore::CompoundDataPtr attributesData();
-
- /// Calls renderer->setAttribute() for each name, data pair in attributes()
- void render( Renderer *renderer ) const override;
-
- private:
-
- IECore::CompoundDataPtr m_attributes;
-
- static const unsigned int m_ioVersion;
-};
-
-IE_CORE_DECLAREPTR( AttributeState );
-
-} // namespace IECoreScene
-
-
-#endif // IECORESCENE_ATTRIBUTESTATE_H
diff --git a/include/IECoreScene/Camera.h b/include/IECoreScene/Camera.h
index d9d2b88efe..8c009a7136 100644
--- a/include/IECoreScene/Camera.h
+++ b/include/IECoreScene/Camera.h
@@ -36,12 +36,12 @@
#define IECORESCENE_CAMERA_H
#include "IECoreScene/Export.h"
-#include "IECoreScene/PreWorldRenderable.h"
+#include "IECoreScene/Renderable.h"
namespace IECoreScene
{
-class IECORESCENE_API Camera : public PreWorldRenderable
+class IECORESCENE_API Camera : public Renderable
{
public:
enum FilmFit
@@ -56,7 +56,7 @@ class IECORESCENE_API Camera : public PreWorldRenderable
Camera( IECore::CompoundDataPtr parameters = new IECore::CompoundData );
~Camera() override;
- IE_CORE_DECLAREEXTENSIONOBJECT( Camera, CameraTypeId, PreWorldRenderable );
+ IE_CORE_DECLAREEXTENSIONOBJECT( Camera, CameraTypeId, Renderable );
IECore::CompoundDataMap ¶meters();
const IECore::CompoundDataMap ¶meters() const;
@@ -242,9 +242,6 @@ class IECORESCENE_API Camera : public PreWorldRenderable
/// horizontal field of view ( in degrees )
void setFocalLengthFromFieldOfView( float horizontalFOV );
- void render( Renderer *renderer ) const override;
-
-
private:
Imath::Box2f defaultApertureRect() const;
diff --git a/include/IECoreScene/ClippingPlane.h b/include/IECoreScene/ClippingPlane.h
index becd091639..168dbab625 100644
--- a/include/IECoreScene/ClippingPlane.h
+++ b/include/IECoreScene/ClippingPlane.h
@@ -36,21 +36,19 @@
#define IECORESCENE_CLIPPINGPLANE_H
#include "IECoreScene/Export.h"
-#include "IECoreScene/PreWorldRenderable.h"
+#include "IECoreScene/Renderable.h"
namespace IECoreScene
{
-class IECORESCENE_API ClippingPlane : public PreWorldRenderable
+class IECORESCENE_API ClippingPlane : public Renderable
{
public:
ClippingPlane();
~ClippingPlane() override;
- IE_CORE_DECLAREEXTENSIONOBJECT( ClippingPlane, ClippingPlaneTypeId, PreWorldRenderable );
-
- void render( Renderer *renderer ) const override;
+ IE_CORE_DECLAREEXTENSIONOBJECT( ClippingPlane, ClippingPlaneTypeId, Renderable );
};
diff --git a/include/IECoreScene/CoordinateSystem.h b/include/IECoreScene/CoordinateSystem.h
index 66d25cd4a7..fc627f4393 100644
--- a/include/IECoreScene/CoordinateSystem.h
+++ b/include/IECoreScene/CoordinateSystem.h
@@ -36,48 +36,28 @@
#define IECORESCENE_COORDINATESYSTEM_H
#include "IECoreScene/Export.h"
-#include "IECoreScene/StateRenderable.h"
+#include "IECoreScene/Renderable.h"
namespace IECoreScene
{
-IE_CORE_FORWARDDECLARE( Transform )
-
-/// This calls allows the specification of coordinate systems to
-/// Renderers.
+/// Allows the specification of coordinate systems to Renderers.
/// \ingroup renderingGroup
-class IECORESCENE_API CoordinateSystem : public StateRenderable
+class IECORESCENE_API CoordinateSystem : public Renderable
{
public:
- CoordinateSystem();
- CoordinateSystem( const std::string &name, TransformPtr transform=nullptr );
+ CoordinateSystem( const std::string &name = "unspecified" );
~CoordinateSystem() override;
- IE_CORE_DECLAREEXTENSIONOBJECT( CoordinateSystem, CoordinateSystemTypeId, StateRenderable );
+ IE_CORE_DECLAREEXTENSIONOBJECT( CoordinateSystem, CoordinateSystemTypeId, Renderable );
const std::string &getName() const;
void setName( const std::string &name );
- /// Returns the Transform applied to the coordinate system.
- /// This is the local transform relative to the parent of
- /// the coordinate system (usually a Group). May return 0
- /// if no transform has been applied.
- Transform *getTransform();
- const Transform *getTransform() const;
- /// Sets the Transform applied to the coordinate system.
- void setTransform( TransformPtr transform );
-
- /// Calls renderer->coordinateSystem( name ). If a transform
- /// has been applied then also scopes this in a
- /// transformBegin/transformEnd with the appropriate
- /// transformation.
- void render( Renderer *renderer ) const override;
-
private:
std::string m_name;
- TransformPtr m_transform;
static const unsigned int m_ioVersion;
};
diff --git a/include/IECoreScene/CurveExtrudeOp.h b/include/IECoreScene/CurveExtrudeOp.h
deleted file mode 100644
index 9256dc9042..0000000000
--- a/include/IECoreScene/CurveExtrudeOp.h
+++ /dev/null
@@ -1,92 +0,0 @@
-//////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2009-2011, Image Engine Design Inc. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// * Neither the name of Image Engine Design nor the names of any
-// other contributors to this software may be used to endorse or
-// promote products derived from this software without specific prior
-// written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-//////////////////////////////////////////////////////////////////////////
-
-#ifndef IECORESCENE_CURVEEXTRUDEOP_H
-#define IECORESCENE_CURVEEXTRUDEOP_H
-
-#include "IECoreScene/CurvesPrimitive.h"
-#include "IECoreScene/Export.h"
-#include "IECoreScene/PatchMeshPrimitive.h"
-#include "IECoreScene/TypedPrimitiveParameter.h"
-
-#include "IECore/NumericParameter.h"
-#include "IECore/Op.h"
-#include "IECore/SimpleTypedParameter.h"
-
-#include
-
-namespace IECoreScene
-{
-
-/// The CurveExtrudeOp lofts RiCurves into RiPatchMesh cylinders, obeying any width primvars present.
-/// \ingroup geometryProcessingGroup
-class IECORESCENE_API CurveExtrudeOp : public IECore::Op
-{
- public :
-
- IE_CORE_DECLARERUNTIMETYPEDEXTENSION( CurveExtrudeOp, CurveExtrudeOpTypeId, IECore::Op );
-
- CurveExtrudeOp();
- ~CurveExtrudeOp() override;
-
- CurvesPrimitiveParameter *curvesParameter();
- const CurvesPrimitiveParameter *curvesParameter() const;
-
- IECore::V2iParameter *resolutionParameter();
- const IECore::V2iParameter *resolutionParameter() const;
-
- protected :
-
- IECore::ObjectPtr doOperation( const IECore::CompoundObject *operands ) override;
-
- void buildReferenceFrames( const std::vector< Imath::V3f > &points, std::vector< Imath::V3f > &tangents, std::vector< Imath::M44f > &frames ) const;
-
- PatchMeshPrimitivePtr buildPatchMesh( const CurvesPrimitive * curves, unsigned curveIndex, unsigned vertexOffset, unsigned varyingOffset ) const;
-
- private :
-
- CurvesPrimitiveParameterPtr m_curvesParameter;
- IECore::V2iParameterPtr m_resolutionParameter;
-
- struct VaryingFn;
- struct VertexFn;
- struct UniformFn;
-
-};
-
-IE_CORE_DECLAREPTR( CurveExtrudeOp );
-
-} // namespace IECoreScene
-
-#endif // IECORESCENE_CURVEEXTRUDEOP_H
diff --git a/include/IECoreScene/CurvesPrimitive.h b/include/IECoreScene/CurvesPrimitive.h
index 808773d8d2..835028c740 100644
--- a/include/IECoreScene/CurvesPrimitive.h
+++ b/include/IECoreScene/CurvesPrimitive.h
@@ -64,7 +64,6 @@ class IECORESCENE_API CurvesPrimitive : public Primitive
bool periodic() const;
void setTopology( IECore::ConstIntVectorDataPtr verticesPerCurve, const IECore::CubicBasisf &basis, bool periodic );
- void render( Renderer *renderer ) const override;
/// Follows the RenderMan specification for variable sizes.
size_t variableSize( PrimitiveVariable::Interpolation interpolation ) const override;
/// Returns the variable size for a single curve.
diff --git a/include/IECoreScene/DiskPrimitive.h b/include/IECoreScene/DiskPrimitive.h
index fa1a50190a..eb2d6bcfa7 100644
--- a/include/IECoreScene/DiskPrimitive.h
+++ b/include/IECoreScene/DiskPrimitive.h
@@ -67,7 +67,6 @@ class IECORESCENE_API DiskPrimitive : public Primitive
size_t variableSize( PrimitiveVariable::Interpolation interpolation ) const override;
Imath::Box3f bound() const override;
- void render( Renderer *renderer ) const override;
void topologyHash( IECore::MurmurHash &h ) const override;
diff --git a/include/IECoreScene/EditBlock.h b/include/IECoreScene/EditBlock.h
deleted file mode 100644
index 2cf2126a68..0000000000
--- a/include/IECoreScene/EditBlock.h
+++ /dev/null
@@ -1,73 +0,0 @@
-//////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2014, Image Engine Design Inc. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// * Neither the name of Image Engine Design nor the names of any
-// other contributors to this software may be used to endorse or
-// promote products derived from this software without specific prior
-// written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-//////////////////////////////////////////////////////////////////////////
-
-#ifndef IECORESCENE_EDITBLOCK_H
-#define IECORESCENE_EDITBLOCK_H
-
-#include "IECoreScene/Export.h"
-
-#include "IECore/CompoundData.h"
-
-#include "boost/noncopyable.hpp"
-
-namespace IECoreScene
-{
-
-class Renderer;
-
-/// The EditBlock class provides a simple means of ensuring that renderer->editBegin()
-/// calls are matched by renderer->editEnd() calls, even in the face of exceptions and
-/// multiple return statements from a function.
-/// \ingroup renderingGroup
-class IECORESCENE_API EditBlock : public boost::noncopyable
-{
-
- public :
-
- /// Starts a new edit block, calling renderer->editBegin(). If renderer is NULL
- /// then nothing is done, otherwise it is the responsibility of the caller to
- /// ensure the renderer remains alive for the lifetime of this object.
- EditBlock( Renderer *renderer, const std::string &editType, const IECore::CompoundDataMap ¶meters );
- /// Closes the edit block by calling renderer->editEnd().
- ~EditBlock();
-
- private :
-
- Renderer *m_renderer;
-
-};
-
-} // namespace IECoreScene
-
-#endif // IECORESCENE_EDITBLOCK_H
diff --git a/include/IECoreScene/ExternalProcedural.h b/include/IECoreScene/ExternalProcedural.h
index 4e33c248c6..b7f418ada1 100644
--- a/include/IECoreScene/ExternalProcedural.h
+++ b/include/IECoreScene/ExternalProcedural.h
@@ -65,7 +65,6 @@ class IECORESCENE_API ExternalProcedural : public VisibleRenderable
IECore::CompoundData *parameters();
const IECore::CompoundData *parameters() const;
- void render( Renderer *renderer ) const override;
Imath::Box3f bound() const override;
private :
diff --git a/include/IECoreScene/Font.h b/include/IECoreScene/Font.h
index e28477787a..4dda266ac6 100644
--- a/include/IECoreScene/Font.h
+++ b/include/IECoreScene/Font.h
@@ -50,7 +50,6 @@ namespace IECoreScene
{
IE_CORE_FORWARDDECLARE( MeshPrimitive );
-IE_CORE_FORWARDDECLARE( Group );
/// The Font class allows the loading of fonts and their
/// conversion to MeshPrimitives.
@@ -91,9 +90,6 @@ class IECORESCENE_API Font : public IECore::RunTimeTyped
/// Returns a mesh representing the specified string,
/// using the current curve tolerance and kerning.
MeshPrimitivePtr mesh( const std::string &text ) const;
- /// Returns a group representing the specified string,
- /// using the current curve tolerance and kerning.
- GroupPtr meshGroup( const std::string &text ) const;
/// Returns the necessary appropriate offset between the
/// origins of the first and second characters, taking
/// into account the current kerning.
diff --git a/include/IECoreScene/Group.h b/include/IECoreScene/Group.h
deleted file mode 100644
index 3f0b52be10..0000000000
--- a/include/IECoreScene/Group.h
+++ /dev/null
@@ -1,155 +0,0 @@
-//////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2007-2011, Image Engine Design Inc. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// * Neither the name of Image Engine Design nor the names of any
-// other contributors to this software may be used to endorse or
-// promote products derived from this software without specific prior
-// written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-//////////////////////////////////////////////////////////////////////////
-
-#ifndef IECORESCENE_GROUP_H
-#define IECORESCENE_GROUP_H
-
-#include "IECoreScene/Export.h"
-#include "IECoreScene/StateRenderable.h"
-#include "IECoreScene/Transform.h"
-#include "IECoreScene/VisibleRenderable.h"
-
-namespace IECoreScene
-{
-
-IE_CORE_FORWARDDECLARE( Group );
-
-/// This class allows the grouping and rendering of a set
-/// of VisibleRenderables, applying a specific set of Transforms
-/// and StateRenderables to them.
-/// \ingroup renderingGroup
-class IECORESCENE_API Group : public VisibleRenderable
-{
-
- public:
-
- typedef std::vector ChildContainer;
- typedef std::vector StateContainer;
-
- /// \todo Add a constructor taking a list of children and state
- /// and an optional transform, and bind it.
- Group();
- ~Group() override;
-
- IE_CORE_DECLAREEXTENSIONOBJECT( Group, GroupTypeId, VisibleRenderable );
-
- /// Returns the Transform applied to the children of
- /// this Group. This is the local transform for the Group
- /// and takes no account of any transforms in the parents
- /// of the Group. May return 0 if no transform has been
- /// applied.
- Transform *getTransform();
- const Transform *getTransform() const;
- /// Sets the local transform applied to the children
- /// of this Group.
- void setTransform( TransformPtr transform );
- /// Returns the actual local transform matrix applied
- /// to this Group, evaluated at the specified time.
- Imath::M44f transformMatrix( float time = 0 ) const;
- /// Returns the final transform applied to the children
- /// of this Group when all parent transforms have been
- /// concatenated together with the local transform.
- Imath::M44f globalTransformMatrix( float time = 0 ) const;
-
- /// Adds some state to the Group. Throws an Exception if
- /// an attempt is made to add something deriving from Transform -
- /// setTransform() should be used for that.
- void addState( StateRenderablePtr state );
- /// Removes some state from the Group. If the state
- /// is not present already then an Exception is thrown.
- void removeState( StateRenderablePtr state );
- /// Removes all state from the Group.
- void clearState();
- /// Const access to the internal data structure used
- /// to hold the state.
- const StateContainer &state() const;
- /// Query an attribute from the group's scope. Tries to
- /// find the attribute in the group's state, then traverses
- /// the group's parents
- const IECore::Data *getAttribute( const std::string &name ) const;
- /// Set an attribute on this group.
- void setAttribute( const std::string &name, IECore::ConstDataPtr value );
-
- /// Adds a child to this Group. If the child is a Group itself
- /// and already has a parent then it will be removed from that
- /// parent before being added. Other VisibleRenderables may be
- /// parented under many Groups to provide instancing capabilities.
- void addChild( VisibleRenderablePtr child );
- /// Removes a child from the Group - has no effect if child is currently
- /// not a child. If the child is not a member of the group then
- /// an Exception is thrown.
- void removeChild( VisibleRenderablePtr child );
- /// Removes all children from the Group.
- void clearChildren();
- /// Const access to the internal data structure used to hold
- /// the children.
- const ChildContainer &children() const;
-
- /// Returns the parent for this Group, returning 0 if no
- /// parent exists.
- Group *parent();
- const Group *parent() const;
-
- /// Renders all the children in an attribute block along
- /// with the transform and state.
- void render( Renderer *renderer ) const override;
- /// As above, but can optionally omit the
- /// attribute block scoping.
- void render( Renderer *renderer, bool inAttributeBlock ) const;
- /// Renders all the held state, without any attributeBegin/End.
- /// Doesn't render the transform.
- void renderState( Renderer *renderer ) const;
- /// Renders all the held children, without any attributeBegin/End.
- void renderChildren( Renderer *renderer ) const;
-
- /// Returns the union of the bounds of the children, transformed
- /// by transformMatrix().
- Imath::Box3f bound() const override;
-
- private:
-
- static bool entryListCompare( const IECore::IndexedIO::EntryID& a, const IECore::IndexedIO::EntryID& b );
-
- static const unsigned int m_ioVersion;
-
- TransformPtr m_transform;
- Group *m_parent; // not a smart pointer to avoid cylic references
- StateContainer m_state;
- ChildContainer m_children;
-
-};
-
-} // namespace IECoreScene
-
-#endif // IECORESCENE_GROUP_H
diff --git a/include/IECoreScene/Light.h b/include/IECoreScene/Light.h
deleted file mode 100644
index a8dd8b355b..0000000000
--- a/include/IECoreScene/Light.h
+++ /dev/null
@@ -1,90 +0,0 @@
-//////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2010-2011, Image Engine Design Inc. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// * Neither the name of Image Engine Design nor the names of any
-// other contributors to this software may be used to endorse or
-// promote products derived from this software without specific prior
-// written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-//////////////////////////////////////////////////////////////////////////
-
-#ifndef IECORESCENE_LIGHT_H
-#define IECORESCENE_LIGHT_H
-
-#include "IECoreScene/Export.h"
-#include "IECoreScene/StateRenderable.h"
-
-namespace IECoreScene
-{
-
-/// A class to represent lights.
-/// \ingroup renderingGroup
-class IECORESCENE_API Light : public StateRenderable
-{
- public:
-
- Light( const std::string &name="distantlight", const std::string &handle="", const IECore::CompoundDataMap ¶meters = IECore::CompoundDataMap() );
- ~Light() override;
-
- IE_CORE_DECLAREEXTENSIONOBJECT( Light, LightTypeId, StateRenderable );
-
- const std::string &getName() const;
- void setName( const std::string &name );
-
- const std::string &getHandle() const;
- void setHandle( const std::string &handle );
-
- IECore::CompoundDataMap ¶meters();
- const IECore::CompoundDataMap ¶meters() const;
- /// This is mostly of use for the binding - the parameters()
- /// function gives more direct access to the contents of the CompoundData
- /// (it calls readable() or writable() for you).
- /// \todo: Should return raw pointer to CompoundData, and we should probably remove the
- /// parameters() methods since the helper methods on ParametersData make it more useful
- IECore::CompoundDataPtr parametersData();
- const IECore::CompoundDataPtr parametersData() const;
-
- /// Sets this light in Renderer.
- void render( Renderer *renderer ) const override;
-
- private:
-
- static TypeDescription m_description;
-
- std::string m_name;
- std::string m_handle;
- IECore::CompoundDataPtr m_parameters;
-
- static const unsigned int m_ioVersion;
-};
-
-IE_CORE_DECLAREPTR( Light );
-
-} // namespace IECoreScene
-
-
-#endif // IECORESCENE_LIGHT_H
diff --git a/include/IECoreScene/MatrixMotionTransform.h b/include/IECoreScene/MatrixMotionTransform.h
deleted file mode 100644
index e653780043..0000000000
--- a/include/IECoreScene/MatrixMotionTransform.h
+++ /dev/null
@@ -1,79 +0,0 @@
-//////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2007-2010, Image Engine Design Inc. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// * Neither the name of Image Engine Design nor the names of any
-// other contributors to this software may be used to endorse or
-// promote products derived from this software without specific prior
-// written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-//////////////////////////////////////////////////////////////////////////
-
-#ifndef IECORESCENE_MATRIXMOTIONTRANSFORM_H
-#define IECORESCENE_MATRIXMOTIONTRANSFORM_H
-
-#include "IECoreScene/Export.h"
-#include "IECoreScene/Transform.h"
-
-namespace IECoreScene
-{
-
-class IECORESCENE_API MatrixMotionTransform : public Transform
-{
- public:
-
- /// A type to map between points in time and
- /// corresponding matrices.
- typedef std::map SnapshotMap;
-
- IE_CORE_DECLAREEXTENSIONOBJECT( MatrixMotionTransform, MatrixMotionTransformTypeId, Transform );
-
- MatrixMotionTransform();
- ~MatrixMotionTransform() override;
-
- void render( Renderer *renderer ) const override;
- Imath::M44f transform( float time = 0 ) const override;
-
- //! @name Snapshots
- ////////////////////////////////////////////
- //@{
- const SnapshotMap &snapshots() const;
- SnapshotMap &snapshots();
- //@}
-
- private:
-
- static const unsigned int m_ioVersion;
-
- SnapshotMap m_snapshots;
-
-};
-
-IE_CORE_DECLAREPTR( MatrixMotionTransform );
-
-}
-
-#endif // IECORESCENE_MATRIXMOTIONTRANSFORM_H
diff --git a/include/IECoreScene/MatrixTransform.h b/include/IECoreScene/MatrixTransform.h
deleted file mode 100644
index 63b28a8b88..0000000000
--- a/include/IECoreScene/MatrixTransform.h
+++ /dev/null
@@ -1,70 +0,0 @@
-//////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2007-2010, Image Engine Design Inc. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// * Neither the name of Image Engine Design nor the names of any
-// other contributors to this software may be used to endorse or
-// promote products derived from this software without specific prior
-// written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-//////////////////////////////////////////////////////////////////////////
-
-#ifndef IECORESCENE_MATRIXTRANSFORM_H
-#define IECORESCENE_MATRIXTRANSFORM_H
-
-#include "IECoreScene/Export.h"
-#include "IECoreScene/Transform.h"
-
-namespace IECoreScene
-{
-
-class IECORESCENE_API MatrixTransform : public Transform
-{
- public:
-
- IE_CORE_DECLAREEXTENSIONOBJECT( MatrixTransform, MatrixTransformTypeId, Transform );
-
- MatrixTransform( const Imath::M44f &matrix = Imath::M44f() );
- ~MatrixTransform() override;
-
- void render( Renderer *renderer ) const override;
- Imath::M44f transform( float time = 0 ) const override;
-
- /// The transform this object applies. It can
- /// be modified freely.
- Imath::M44f matrix;
-
- private:
-
- static const unsigned int m_ioVersion;
-
-};
-
-IE_CORE_DECLAREPTR( MatrixTransform );
-
-}
-
-#endif // IECORESCENE_MATRIXTRANSFORM_H
diff --git a/include/IECoreScene/MeshPrimitive.h b/include/IECoreScene/MeshPrimitive.h
index 649b724e91..e5f916f81d 100644
--- a/include/IECoreScene/MeshPrimitive.h
+++ b/include/IECoreScene/MeshPrimitive.h
@@ -152,9 +152,6 @@ class IECORESCENE_API MeshPrimitive : public Primitive
size_t variableSize( PrimitiveVariable::Interpolation interpolation ) const override;
- /// Render the mesh
- void render( Renderer *renderer ) const override;
-
/// Creates a box mesh.
/// \todo Add subdivisions and texture coordinates.
static MeshPrimitivePtr createBox( const Imath::Box3f &b );
diff --git a/include/IECoreScene/MotionBlock.h b/include/IECoreScene/MotionBlock.h
deleted file mode 100644
index f63903a101..0000000000
--- a/include/IECoreScene/MotionBlock.h
+++ /dev/null
@@ -1,69 +0,0 @@
-//////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2011, Image Engine Design Inc. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// * Neither the name of Image Engine Design nor the names of any
-// other contributors to this software may be used to endorse or
-// promote products derived from this software without specific prior
-// written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-//////////////////////////////////////////////////////////////////////////
-
-#ifndef IECORESCENE_MOTIONBLOCK_H
-#define IECORESCENE_MOTIONBLOCK_H
-
-#include "IECoreScene/Export.h"
-#include "IECoreScene/Renderer.h"
-
-#include "boost/noncopyable.hpp"
-
-namespace IECoreScene
-{
-
-/// The MotionBlock class provides a simple means of ensuring that renderer->motionBegin()
-/// calls are matched by renderer->motionEnd() calls, even in the face of exceptions and
-/// multiple return statements from a function.
-/// \ingroup renderingGroup
-class IECORESCENE_API MotionBlock : public boost::noncopyable
-{
- public :
-
- /// Starts a new motion block, calling renderer->motionBegin(). If active is false
- /// or times.size() < 2 then nothing is done.
- MotionBlock( RendererPtr renderer, const std::set ×, bool active=true );
- /// Closes the motion block by calling renderer->motionEnd(), unless no block was
- /// created in the constructor for any reason.
- ~MotionBlock();
-
- private :
-
- RendererPtr m_renderer;
-
-};
-
-} // namespace IECoreScene
-
-#endif // IECORESCENE_MOTIONBLOCK_H
diff --git a/include/IECoreScene/MotionPrimitive.h b/include/IECoreScene/MotionPrimitive.h
deleted file mode 100644
index 5ca95817e9..0000000000
--- a/include/IECoreScene/MotionPrimitive.h
+++ /dev/null
@@ -1,95 +0,0 @@
-//////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2007-2011, Image Engine Design Inc. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// * Neither the name of Image Engine Design nor the names of any
-// other contributors to this software may be used to endorse or
-// promote products derived from this software without specific prior
-// written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-//////////////////////////////////////////////////////////////////////////
-
-#ifndef IECORESCENE_PRIMITIVEMOTION_H
-#define IECORESCENE_PRIMITIVEMOTION_H
-
-#include "IECoreScene/Export.h"
-#include "IECoreScene/Primitive.h"
-
-namespace IECoreScene
-{
-
-/// The MotionPrimitive is a simple means of constructing and rendering a
-/// motionBegin/motionEnd block containing a Primitive. There's nothing to
-/// stop you from calling motionBegin/motionEnd to construct motion blocks yourself
-/// but this form is simple, and loadable and savable and copyable and all that.
-/// \ingroup renderingGroup
-class IECORESCENE_API MotionPrimitive : public VisibleRenderable
-{
- public:
-
- /// A type to map between points in time and corresponding
- /// Primitives.
- typedef std::map SnapshotMap;
-
- MotionPrimitive();
- ~MotionPrimitive() override;
-
- IE_CORE_DECLAREEXTENSIONOBJECT( MotionPrimitive, MotionPrimitiveTypeId, VisibleRenderable );
-
- //! @name Snapshots
- ////////////////////////////////////////////////////
- //@{
- /// Gives const access to the internal snapshot data.
- const SnapshotMap &snapshots() const;
- /// Gives access to the internal snapshot data. This can
- /// be modified freely - it'll be validated in render().
- SnapshotMap &snapshots();
- /// Utility function to insert a time,primitive pair
- /// into snapshots().
- void addSnapshot( float time, PrimitivePtr primitive );
- /// Utility function to remove a snapshot.
- void removeSnapshot( float time );
- void removeSnapshot( PrimitivePtr primitive );
- //@}
-
- /// May throw an Exception if the contained Primitives are not
- /// compatible with each other.
- void render( Renderer *renderer ) const override;
- Imath::Box3f bound() const override;
-
- private:
-
- static const unsigned int m_ioVersion;
-
- SnapshotMap m_snapshots;
-
-};
-
-IE_CORE_DECLAREPTR( MotionPrimitive );
-
-} // namespace IECoreScene
-
-#endif // IECORESCENE_PRIMITIVEMOTION_H
diff --git a/include/IECoreScene/NURBSPrimitive.h b/include/IECoreScene/NURBSPrimitive.h
index 9dab831af1..c149c0061d 100644
--- a/include/IECoreScene/NURBSPrimitive.h
+++ b/include/IECoreScene/NURBSPrimitive.h
@@ -81,8 +81,6 @@ class IECORESCENE_API NURBSPrimitive : public Primitive
size_t variableSize( PrimitiveVariable::Interpolation interpolation ) const override;
- void render( Renderer *renderer ) const override;
-
void topologyHash( IECore::MurmurHash &h ) const override;
private:
diff --git a/include/IECoreScene/Options.h b/include/IECoreScene/Options.h
deleted file mode 100644
index 1710c81fde..0000000000
--- a/include/IECoreScene/Options.h
+++ /dev/null
@@ -1,78 +0,0 @@
-//////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2012, John Haddon. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// * Neither the name of Image Engine Design nor the names of any
-// other contributors to this software may be used to endorse or
-// promote products derived from this software without specific prior
-// written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-//////////////////////////////////////////////////////////////////////////
-
-#ifndef IECORESCENE_OPTIONS_H
-#define IECORESCENE_OPTIONS_H
-
-#include "IECoreScene/Export.h"
-#include "IECoreScene/PreWorldRenderable.h"
-
-namespace IECoreScene
-{
-
-/// A class to manipulate the options of a Renderer.
-/// \ingroup renderingGroup
-class IECORESCENE_API Options : public PreWorldRenderable
-{
- public:
-
- /// Options is referenced directly rather than copied.
- Options( IECore::CompoundDataPtr options );
- Options( const IECore::CompoundDataMap &options = IECore::CompoundDataMap() );
- ~Options() override;
-
- IE_CORE_DECLAREEXTENSIONOBJECT( Options, OptionsTypeId, PreWorldRenderable );
-
- IECore::CompoundDataMap &options();
- const IECore::CompoundDataMap &options() const;
- /// This is mostly of use for the binding - the options()
- /// function gives more direct access to the contents of the CompoundData
- /// (it calls readable() or writable() for you).
- IECore::CompoundDataPtr optionsData();
-
- /// Calls renderer->setOptions() for each name, data pair in options()
- void render( Renderer *renderer ) const override;
-
- private:
-
- IECore::CompoundDataPtr m_options;
-
- static const unsigned int m_ioVersion;
-};
-
-IE_CORE_DECLAREPTR( Options );
-
-} // namespace IECoreScene
-
-#endif // IECORESCENE_OPTIONS_H
diff --git a/include/IECoreScene/Output.h b/include/IECoreScene/Output.h
index 952514e2d7..4d1c73a524 100644
--- a/include/IECoreScene/Output.h
+++ b/include/IECoreScene/Output.h
@@ -36,21 +36,21 @@
#define IECORESCENE_OUTPUT_H
#include "IECoreScene/Export.h"
-#include "IECoreScene/PreWorldRenderable.h"
+#include "IECoreScene/Renderable.h"
namespace IECoreScene
{
/// Describes an output image to be rendered.
/// \ingroup renderingGroup
-class IECORESCENE_API Output : public PreWorldRenderable
+class IECORESCENE_API Output : public Renderable
{
public:
Output( const std::string &name="default", const std::string &type="exr", const std::string &data="rgba", IECore::CompoundDataPtr parameters = new IECore::CompoundData );
~Output() override;
- IE_CORE_DECLAREEXTENSIONOBJECT( Output, OutputTypeId, PreWorldRenderable );
+ IE_CORE_DECLAREEXTENSIONOBJECT( Output, OutputTypeId, Renderable );
void setName( const std::string &name );
const std::string &getName() const;
@@ -69,8 +69,6 @@ class IECORESCENE_API Output : public PreWorldRenderable
IECore::CompoundData *parametersData();
const IECore::CompoundData *parametersData() const;
- void render( Renderer *renderer ) const override;
-
private:
std::string m_name;
diff --git a/include/IECoreScene/PatchMeshPrimitive.h b/include/IECoreScene/PatchMeshPrimitive.h
index 7fc99c4431..1bb8473880 100644
--- a/include/IECoreScene/PatchMeshPrimitive.h
+++ b/include/IECoreScene/PatchMeshPrimitive.h
@@ -82,8 +82,6 @@ class IECORESCENE_API PatchMeshPrimitive : public Primitive
bool uPeriodic() const;
bool vPeriodic() const;
- void render( Renderer *renderer ) const override;
-
/// Follows the RenderMan specification for variable sizes.
size_t variableSize( PrimitiveVariable::Interpolation interpolation ) const override;
diff --git a/include/IECoreScene/PointsPrimitive.h b/include/IECoreScene/PointsPrimitive.h
index 6d4adc5779..30db1058b1 100644
--- a/include/IECoreScene/PointsPrimitive.h
+++ b/include/IECoreScene/PointsPrimitive.h
@@ -74,8 +74,6 @@ class IECORESCENE_API PointsPrimitive : public Primitive
/// and 1 for all other types.
size_t variableSize( PrimitiveVariable::Interpolation interpolation ) const override;
- void render( Renderer *renderer ) const override;
-
void topologyHash( IECore::MurmurHash &h ) const override;
private:
diff --git a/include/IECoreScene/PreWorldRenderable.h b/include/IECoreScene/PreWorldRenderable.h
deleted file mode 100644
index 03676322d7..0000000000
--- a/include/IECoreScene/PreWorldRenderable.h
+++ /dev/null
@@ -1,65 +0,0 @@
-//////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2007, Image Engine Design Inc. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// * Neither the name of Image Engine Design nor the names of any
-// other contributors to this software may be used to endorse or
-// promote products derived from this software without specific prior
-// written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-//////////////////////////////////////////////////////////////////////////
-
-#ifndef IECORESCENE_PREWORLDRENDERABLE_H
-#define IECORESCENE_PREWORLDRENDERABLE_H
-
-#include "IECoreScene/Export.h"
-#include "IECoreScene/Renderable.h"
-
-namespace IECoreScene
-{
-
-/// The PreWorldRenderable class is an abstract base class for all Renderables
-/// which set things which are constant across a whole worldBegin()/worldEnd()
-/// block, and must therefore be called before worldBegin().
-class IECORESCENE_API PreWorldRenderable : public Renderable
-{
- public:
-
- PreWorldRenderable();
- ~PreWorldRenderable() override;
-
- IE_CORE_DECLAREEXTENSIONOBJECT( PreWorldRenderable, PreWorldRenderableTypeId, Renderable );
-
- private:
-
- static const unsigned int m_ioVersion;
-};
-
-IE_CORE_DECLAREPTR( PreWorldRenderable );
-
-}
-
-#endif // IECORESCENE_PREWORLDRENDERABLE_H
diff --git a/include/IECoreScene/Renderable.h b/include/IECoreScene/Renderable.h
index ac275bebd1..4cb26d6398 100644
--- a/include/IECoreScene/Renderable.h
+++ b/include/IECoreScene/Renderable.h
@@ -43,8 +43,6 @@
namespace IECoreScene
{
-IE_CORE_FORWARDDECLARE( Renderer );
-
/// An abstract class to define objects which are renderable
/// \ingroup renderingGroup
class IECORESCENE_API Renderable : public IECore::BlindDataHolder
@@ -56,9 +54,6 @@ class IECORESCENE_API Renderable : public IECore::BlindDataHolder
IE_CORE_DECLAREEXTENSIONOBJECT( Renderable, RenderableTypeId, IECore::BlindDataHolder );
- /// Render the object held by this instance via the given renderer.
- virtual void render( Renderer *renderer ) const = 0;
-
private:
static const unsigned int m_ioVersion;
diff --git a/include/IECoreScene/Renderer.h b/include/IECoreScene/Renderer.h
deleted file mode 100644
index 85a46526dc..0000000000
--- a/include/IECoreScene/Renderer.h
+++ /dev/null
@@ -1,415 +0,0 @@
-//////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2007-2013, Image Engine Design Inc. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// * Neither the name of Image Engine Design nor the names of any
-// other contributors to this software may be used to endorse or
-// promote products derived from this software without specific prior
-// written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-//////////////////////////////////////////////////////////////////////////
-
-#ifndef IECORESCENE_RENDERER_H
-#define IECORESCENE_RENDERER_H
-
-#include "IECoreScene/Export.h"
-#include "IECoreScene/PrimitiveVariable.h"
-#include "IECoreScene/TypeIds.h"
-
-#include "IECore/CompoundData.h"
-#include "IECore/CubicBasis.h"
-#include "IECore/Export.h"
-#include "IECore/MurmurHash.h"
-#include "IECore/RunTimeTyped.h"
-#include "IECore/VectorTypedData.h"
-
-IECORE_PUSH_DEFAULT_VISIBILITY
-#include "Imath/ImathBox.h"
-#include "Imath/ImathMatrix.h"
-IECORE_POP_DEFAULT_VISIBILITY
-
-#include
-
-namespace IECoreScene
-{
-
-IE_CORE_FORWARDDECLARE( Renderer );
-
-/// The Renderer class provides a means of describing scenes for rendering. Its
-/// interface is modelled closely on OpenGL/Renderman with an attribute and
-/// transform stack etc. Renderer implementations should flag errors and warnings
-/// using the MessageHandler class rather than by throwing Exceptions - it's often
-/// more useful to have an incomplete image for diagnosis of the problem than to
-/// have an Exception thrown.
-///
-/// \par Naming conventions
-///
-/// Many of the calls in the Renderer interface associate a name with a piece of
-/// data. Both the setOption() and setAttribute() calls take a name to specify what
-/// is being modified and a DataPtr to specify the new value. Many other calls
-/// accept either a CompoundDataMap or a PrimitiveVariableMap, both of which may
-/// contain many named pieces of Data.
-///
-/// A naming convention exists to specify that particular data is intended only
-/// for a particular Renderer implementation. This allows rendering to be
-/// customised for a particular implementation without causing other implementations
-/// to error due to unsupported features. The convention for each name is as
-/// follows :
-///
-/// \li "name"
-/// Should be supported by all Renderer implementations. For instance, the "doubleSided"
-/// attribute should be supported by all Renderers. A warning message should be
-/// output if the name is not recognised and supported.
-///
-/// \li "prefix:name"
-/// Used to specify data intended only for a particular implementation. Implementations
-/// silently ignore all data destined for other implementations. For instance, the
-/// "gl:primitive:wireframe" attribute is used by the GL renderer implementation but
-/// silently ignored by other implementations.
-///
-/// \li "user:name"
-/// Used to specify data for the purposes of users. The renderer should store the value
-/// and make it available for query, but otherwise it should have no effect. This applies
-/// mostly to the attribute and option calls.
-/// \ingroup renderingGroup
-class IECORESCENE_API Renderer : public IECore::RunTimeTyped
-{
-
- public :
-
- IE_CORE_DECLARERUNTIMETYPEDEXTENSION( Renderer, RendererTypeId, IECore::RunTimeTyped );
-
- Renderer();
- ~Renderer() override;
-
- //! @name Options
- /// Options are named items of data which control some global aspect of the
- /// render. These functions allow their setting and getting. All options must
- /// be set before a call to worldBegin() - it is invalid to change an option
- /// after worldBegin().
- ///
- /// \par Standard SearchPath Options
- ///
- /// \li "searchPath:font" StringData
- /// A colon separated list of paths to search for fonts on - these are used
- /// by the text() primitive. The default value should come from the
- /// IECORE_FONT_PATHS environment variable if set.
- ///
- /// \par Rerendering Options
- ///
- /// \li "editable" BoolData
- /// This option must be set to enable the use of the interactive rerendering
- /// methods defined below.
- ///////////////////////////////////////////////////////////////////////////
- //@{
- /// Set an option. Must not be called after worldBegin().
- virtual void setOption( const std::string &name, IECore::ConstDataPtr value ) = 0;
- /// Get the value of a previously set option.
- virtual IECore::ConstDataPtr getOption( const std::string &name ) const = 0;
- //@}
-
- /// This renderer interface is now pretty heavily deprecated, in favor of the new
- /// interface in Gaffer.
- /// The camera name is now unused, since the only use of this interface
- /// is now IECoreGL's renderers, which only support one camera anyway.
- ///
- /// We now have nice accessors on IECoreScene::Camera, so I would recommend using those
- /// rather than manually setting parameter names here. If you have to use this
- /// interface for some reason, I would recommend creating an IECoreScene::Camera,
- /// using the accessors to set it up, and then calling
- /// camera->render( renderer );
- virtual void camera( const std::string &unusedName, const IECore::CompoundDataMap ¶meters ) = 0;
-
- /// Specifies an image to be output from the renderer. In the case of file outputs name
- /// specified the filename. type specifies the type of output to create and data specifies
- /// the data to be output, for instance "rgba". parameters provides an implementation specific
- /// set of parameters to control other aspects of the image created. It is only valid to call this
- /// before worldBegin.
- virtual void display( const std::string &name, const std::string &type, const std::string &data, const IECore::CompoundDataMap ¶meters ) = 0;
-
- //! @name World block
- /// Once all options, cameras and displays are specified, a world block
- /// is created in which the visible elements of the scene are described.
- ///////////////////////////////////////////////////////////////////////////
- //@{
- /// Starts the world block and resets the current transform to the
- /// identity.
- virtual void worldBegin() = 0;
- /// Finishes the world block.
- virtual void worldEnd() = 0;
- //@}
-
- //! @name Transforms
- /// The Renderer manages a hierarchical set of transforms, applying the
- /// current transform to all cameras and primitives that are created.
- ///////////////////////////////////////////////////////////////////////////
- //@{
- /// Push a new transform state identical to the current one. Modifications
- /// can then be made locally before calling transformEnd() to return to the
- /// previous transform state.
- virtual void transformBegin() = 0;
- /// Returns to the transform state saved by the last transformBegin() call.
- virtual void transformEnd() = 0;
- /// Sets the current transform.
- virtual void setTransform( const Imath::M44f &m ) = 0;
- /// Sets the current transform to a coordinate system previously
- /// created with a call to coordinateSystem().
- virtual void setTransform( const std::string &coordinateSystem ) = 0;
- /// Returns the current transform.
- virtual Imath::M44f getTransform() const = 0;
- /// Returns the transform associated with the named coordinate system.
- virtual Imath::M44f getTransform( const std::string &coordinateSystem ) const = 0;
- /// Concatenates the specified transform onto the current transform.
- virtual void concatTransform( const Imath::M44f &m ) = 0;
- /// Creates a named coordinate system from the current transform. Coordinate systems
- /// are scoped by attributeBegin/attributeEnd blocks.
- virtual void coordinateSystem( const std::string &name ) = 0;
- //@}
-
- //! @name Attributes
- /// Attributes are named items of data which control some per-object aspect
- /// of the render. Attributes may be set both before and after worldBegin(),
- /// and are scoped between attributeBegin(), attributeEnd() calls.
- ////////////////////////////////////////////////////////////////////////////
- //@{
- /// Push a new attribute state onto the attribute stack. This is identical
- /// to the current state, but subsequent calls to setAttribute() will be
- /// discarded by the matching attributeEnd().
- virtual void attributeBegin() = 0;
- /// Return to the attribute state saved by the last call to attributeBegin().
- virtual void attributeEnd() = 0;
- /// Sets the named attribute to the specified value.
- ///
- /// \par Standard Attributes
- ///
- /// The following standard attributes should be supported by all implementations
- /// wherever possible :
- ///
- /// \li "color" Color3fData
- /// The color of primitives. Defaults to 1, 1, 1 if not specified.
- ///
- /// \li "opacity" Color3fData
- /// The opacity of primitives. Defaults to 1, 1, 1 if not specified.
- ///
- /// \li "doubleSided" BoolData
- /// When true both sides of a primitive are rendered, when false
- /// only one side is. Defaults to true.
- ///
- /// \li "rightHandedOrientation" BoolData
- /// Controls which side of a primitive
- /// is forward facing. This attribute starts with a value of true,
- /// because the camera is specified in a right handed coordinate system -
- /// a value of false specifies that the current orientation is left handed.
- /// The renderer will automatically toggle the value whenever a transformation
- /// flips the sense of the current object space coordinate system (this
- /// happens when a transform has a negative determinant - typically a
- /// negative scaling in some axis). You can change the interpretation of
- /// "forward facing" by flipping the attribute value at any time - see
- /// the documentation for the various primitives below for how orientation
- /// affects the way their front face is defined.
- ///
- /// \li "name" StringData "unnamed"\li
- /// A descriptive name for the object.
- ///
- /// \li "user:*"
- /// Should be stored for later query, but have no other effect upon the
- /// rendering process.
- virtual void setAttribute( const std::string &name, IECore::ConstDataPtr value ) = 0;
- /// Return the value of the named attribute.
- virtual IECore::ConstDataPtr getAttribute( const std::string &name ) const = 0;
- /// Specifies a shader to be applied to subsequent primitives.
- virtual void shader( const std::string &type, const std::string &name, const IECore::CompoundDataMap ¶meters ) = 0;
- /// Specifies a light to apply to subsequent primitives.
- virtual void light( const std::string &name, const std::string &handle, const IECore::CompoundDataMap ¶meters ) = 0;
- /// Turns the specified light on or off for the current attribute state.
- virtual void illuminate( const std::string &lightHandle, bool on ) = 0;
- //@}
-
- //! @name Motion blur
- ////////////////////////////////////////////////////////////////////////////
- //@{
- /// Starts a new motion block. You should then make times.size() calls
- /// to one of the primitive or transform functions to specify the motion
- /// for the block.
- virtual void motionBegin( const std::set × ) = 0;
- /// Ends a motion block. Should be called when times.size() calls to an
- /// appropriate primitive or transform function have been made following
- /// a motionBegin() call.
- virtual void motionEnd() = 0;
- //@}
-
- //! @name Primitives
- /// Primitives specify actual visible objects to be rendered. Each primitive
- /// has a topology which is usually specified in a manner unique to that type,
- /// and a set of PrimitiveVariables which is specified in the same manner
- /// for all primitives - these specify data to vary over the surface of the
- /// primitive.
- /// \todo Better documentation for the calls below, particularly in relation
- /// to the rightHandedOrientation attribute.
- ////////////////////////////////////////////////////////////////////////////
- //@{
- /// Renders a set of points.
- virtual void points( size_t numPoints, const PrimitiveVariableMap &primVars ) = 0;
- /// Renders a disk of the specified radius on the xy plane, at the specified z value.
- /// If the "rightHandedOrientation" attribute is true then the normal faces down
- /// positive z, otherwise it faces down negative z.
- virtual void disk( float radius, float z, float thetaMax, const PrimitiveVariableMap &primVars ) = 0;
- /// Renders a set of curves.
- virtual void curves( const IECore::CubicBasisf &basis, bool periodic, IECore::ConstIntVectorDataPtr numVertices, const PrimitiveVariableMap &primVars ) = 0;
- /// Renders some text.
- virtual void text( const std::string &font, const std::string &text, float kerning = 1.0f, const PrimitiveVariableMap &primVars=PrimitiveVariableMap() ) = 0;
- /// Renders a sphere of the specified radius. zMin and zMax are measured as a proportion of the radius - so no matter
- /// what the radius, the default values will always give a full sphere. If the "rightHandedOrientation"
- /// attribute is true then the normals point outwards, otherwise they point inwards.
- /// \todo Give this the default values it talks about.
- virtual void sphere( float radius, float zMin, float zMax, float thetaMax, const PrimitiveVariableMap &primVars ) = 0;
- /// Renders an image.
- /// \todo Clarify the intended use of dataWindow and displayWindow.
- virtual void image( const Imath::Box2i &dataWindow, const Imath::Box2i &displayWindow, const PrimitiveVariableMap &primVars ) = 0;
- /// Renders a mesh. The geometric normal of a face will be facing camera if the winding order of its vertices is anticlockwise from
- /// the point of view of the camera and the "rightHandedOrientation" attribute is true. If the "rightHandedOrientation" attribute
- /// is false then faces whose vertices wind /clockwise/ with respect to the camera are considered forward facing instead.
- virtual void mesh( IECore::ConstIntVectorDataPtr vertsPerFace, IECore::ConstIntVectorDataPtr vertIds, const std::string &interpolation, const PrimitiveVariableMap &primVars ) = 0;
- /// Renders a nurbs surface.
- virtual void nurbs( int uOrder, IECore::ConstFloatVectorDataPtr uKnot, float uMin, float uMax, int vOrder, IECore::ConstFloatVectorDataPtr vKnot, float vMin, float vMax, const PrimitiveVariableMap &primVars ) = 0;
- /// Render a patch mesh.
- virtual void patchMesh( const IECore::CubicBasisf &uBasis, const IECore::CubicBasisf &vBasis, int nu, bool uPeriodic, int nv, bool vPeriodic, const PrimitiveVariableMap &primVars ) = 0;
- /// Generic call for specifying renderer specify geometry types.
- virtual void geometry( const std::string &type, const IECore::CompoundDataMap &topology, const PrimitiveVariableMap &primVars ) = 0;
- //@}
-
- /// The Procedural class defines an interface via which the Renderer can
- /// ask for geometry to be generated in a deferred fashion, at a time
- /// which is convenient to it.
- class IECORESCENE_API Procedural : public IECore::RefCounted
- {
- public :
-
- IE_CORE_DECLAREMEMBERPTR( Procedural );
-
- Procedural();
- ~Procedural() override;
-
- /// Returns a bounding box guaranteed to completely
- /// contain the geometry generated by the render()
- /// method.
- virtual Imath::Box3f bound() const = 0;
- /// Called when the renderer is ready to receive the procedural
- /// geometry. Any relevant methods of renderer may be called, but
- /// the geometry generated must be contained within the
- /// box returned by bound().
- virtual void render( Renderer *renderer ) const = 0;
- /// Implement this to return a hash for procedural level instancing.
- /// Procedurals with the same hash will be reused by renderers that
- /// support this feature. If computing a sensible hash is difficult
- /// or impossible, return IECore::MurmurHash() from this function
- /// and this feature will be disabled.
- virtual IECore::MurmurHash hash() const = 0;
-
- /// Sentinel value which may be returned by bound()
- /// implementations if a bound is not available, or
- /// computing one would be prohibitively expensive.
- /// Renderers should expand such procedurals
- /// unconditionally.
- static const Imath::Box3f noBound;
-
- };
- IE_CORE_DECLAREPTR( Procedural );
-
- /// A placeholder for specifying a procedural which the Renderer
- /// must load from a file on disk.
- class IECORESCENE_API ExternalProcedural : public Procedural
- {
- public :
-
- IE_CORE_DECLAREMEMBERPTR( ExternalProcedural )
-
- ExternalProcedural( const std::string &fileName, const Imath::Box3f &bound, const IECore::CompoundDataMap ¶meters );
- ~ExternalProcedural() override;
-
- const std::string &fileName() const;
- const IECore::CompoundDataMap ¶meters() const;
-
- Imath::Box3f bound() const override;
- void render( Renderer *renderer ) const override;
- IECore::MurmurHash hash() const override;
-
- private :
-
- std::string m_fileName;
- Imath::Box3f m_bound;
- IECore::CompoundDataMap m_parameters;
-
- };
- IE_CORE_DECLAREPTR( ExternalProcedural );
-
- /// Renders a piece of procedural geometry.
- virtual void procedural( ProceduralPtr proc ) = 0;
-
- //! @name Instancing
- /// These methods provide a means of describing a portion of a scene once and reusing
- /// it many times.
- ///////////////////////////////////////////////////////////////////////////////////////
- //@{
- /// Starts the description of a portion of a scene to be instanced.
- virtual void instanceBegin( const std::string &name, const IECore::CompoundDataMap ¶meters ) = 0;
- /// Ends the description of an instance.
- virtual void instanceEnd() = 0;
- /// Instantiates a previously described instance at the current transform position, and
- /// using the current attribute state.
- virtual void instance( const std::string &name ) = 0;
- //@}
-
- /// Generic call for executing arbitrary renderer commands. This is intended to allow
- /// derived classes to support calls such as RiMakeTexture via calls of the form
- /// renderer->command( "ri:makeTexture", ... ).
- ///
- /// Renderers supporting arbitrary clipping planes should implement a "clippingPlane"
- /// command which must be issued before worldBegin(), and which makes a clipping plane
- /// using the current transformation.
- ///
- /// \todo Make a dedicated virtual clippingPlane() method for the next major version.
- virtual IECore::DataPtr command( const std::string &name, const IECore::CompoundDataMap ¶meters ) = 0;
-
- //! @name Interactive rerendering
- /// These methods provide a means of upating the scene following a call to worldEnd(),
- /// causing the renderer to interactively rerender the scene.
- ///////////////////////////////////////////////////////////////////////////////////////
- //@{
- /// Starts a new scene edit of the specified type. The standard functions above for
- /// declaring the scene can then be used to perform the edit.
- /// \todo Better define the semantics of this function as we implement it for different
- /// renderers.
- virtual void editBegin( const std::string &editType, const IECore::CompoundDataMap ¶meters ) = 0;
- /// Ends the current scene edit.
- virtual void editEnd() = 0;
- //@}
-
-};
-
-}
-
-#endif // IECORESCENE_RENDERER_H
diff --git a/include/IECoreScene/Shader.h b/include/IECoreScene/Shader.h
index d0d45074fa..8d8b952a39 100644
--- a/include/IECoreScene/Shader.h
+++ b/include/IECoreScene/Shader.h
@@ -36,14 +36,14 @@
#define IECORESCENE_SHADER_H
#include "IECoreScene/Export.h"
-#include "IECoreScene/StateRenderable.h"
+#include "IECoreScene/Renderable.h"
namespace IECoreScene
{
/// A class to represent shaders.
/// \ingroup renderingGroup
-class IECORESCENE_API Shader : public StateRenderable
+class IECORESCENE_API Shader : public Renderable
{
public:
@@ -56,7 +56,7 @@ class IECORESCENE_API Shader : public StateRenderable
~Shader() override;
- IE_CORE_DECLAREEXTENSIONOBJECT( Shader, ShaderTypeId, StateRenderable );
+ IE_CORE_DECLAREEXTENSIONOBJECT( Shader, ShaderTypeId, Renderable );
const std::string &getName() const;
void setName( const std::string &name );
@@ -72,9 +72,6 @@ class IECORESCENE_API Shader : public StateRenderable
IECore::CompoundData *parametersData();
const IECore::CompoundData *parametersData() const;
- /// Sets this shader as the current shader in Renderer.
- void render( Renderer *renderer ) const override;
-
private:
std::string m_name;
diff --git a/include/IECoreScene/SpherePrimitive.h b/include/IECoreScene/SpherePrimitive.h
index c3594b413a..52118edb1e 100644
--- a/include/IECoreScene/SpherePrimitive.h
+++ b/include/IECoreScene/SpherePrimitive.h
@@ -84,8 +84,6 @@ class IECORESCENE_API SpherePrimitive : public Primitive
size_t variableSize( PrimitiveVariable::Interpolation interpolation ) const override;
Imath::Box3f bound() const override;
- /// Render the sphere
- void render( Renderer *renderer ) const override;
void topologyHash( IECore::MurmurHash &h ) const override;
diff --git a/include/IECoreScene/StateRenderable.h b/include/IECoreScene/StateRenderable.h
deleted file mode 100644
index 5816cd3aa5..0000000000
--- a/include/IECoreScene/StateRenderable.h
+++ /dev/null
@@ -1,66 +0,0 @@
-//////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2007-2011, Image Engine Design Inc. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// * Neither the name of Image Engine Design nor the names of any
-// other contributors to this software may be used to endorse or
-// promote products derived from this software without specific prior
-// written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-//////////////////////////////////////////////////////////////////////////
-
-#ifndef IECORESCENE_STATERENDERABLE_H
-#define IECORESCENE_STATERENDERABLE_H
-
-#include "IECoreScene/Export.h"
-#include "IECoreScene/Renderable.h"
-
-namespace IECoreScene
-{
-
-/// The StateRenderable class is an abstract base class for all Renderables
-/// which modify RendererState (current attributes, shaders, transforms etc)
-/// but do not cause any objects to be rendered.
-/// \ingroup renderingGroup
-class IECORESCENE_API StateRenderable : public Renderable
-{
- public:
-
- StateRenderable();
- ~StateRenderable() override;
-
- IE_CORE_DECLAREEXTENSIONOBJECT( StateRenderable, StateRenderableTypeId, Renderable );
-
- private:
-
- static const unsigned int m_ioVersion;
-};
-
-IE_CORE_DECLAREPTR( StateRenderable );
-
-}
-
-#endif // IECORESCENE_STATERENDERABLE_H
diff --git a/include/IECoreScene/Transform.h b/include/IECoreScene/Transform.h
deleted file mode 100644
index 31e53e2866..0000000000
--- a/include/IECoreScene/Transform.h
+++ /dev/null
@@ -1,76 +0,0 @@
-//////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2007-2011, Image Engine Design Inc. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// * Neither the name of Image Engine Design nor the names of any
-// other contributors to this software may be used to endorse or
-// promote products derived from this software without specific prior
-// written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-//////////////////////////////////////////////////////////////////////////
-
-#ifndef IECORESCENE_TRANSFORM_H
-#define IECORESCENE_TRANSFORM_H
-
-#include "IECoreScene/Export.h"
-#include "IECoreScene/StateRenderable.h"
-
-#include "IECore/Export.h"
-
-IECORE_PUSH_DEFAULT_VISIBILITY
-#include "Imath/ImathMatrix.h"
-IECORE_POP_DEFAULT_VISIBILITY
-
-namespace IECoreScene
-{
-
-/// An abstract class to define objects which apply a transform to the
-/// state of a Renderer.
-/// \ingroup renderingGroup
-class IECORESCENE_API Transform : public StateRenderable
-{
- public:
-
- Transform();
- ~Transform() override;
-
- IE_CORE_DECLAREEXTENSIONOBJECT( Transform, TransformTypeId, StateRenderable );
-
- /// Returns the transform this object represents,
- /// evaluated at the requested time.
- virtual Imath::M44f transform( float time = 0 ) const = 0;
-
- private:
-
- static const unsigned int m_ioVersion;
-
-};
-
-IE_CORE_DECLAREPTR( Transform );
-
-}
-
-#endif // IECORESCENE_TRANSFORM_H
diff --git a/include/IECoreScene/TransformBlock.h b/include/IECoreScene/TransformBlock.h
deleted file mode 100644
index 6278917360..0000000000
--- a/include/IECoreScene/TransformBlock.h
+++ /dev/null
@@ -1,69 +0,0 @@
-//////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2010-2011, Image Engine Design Inc. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// * Neither the name of Image Engine Design nor the names of any
-// other contributors to this software may be used to endorse or
-// promote products derived from this software without specific prior
-// written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-//////////////////////////////////////////////////////////////////////////
-
-#ifndef IECORESCENE_TRANSFORMBLOCK_H
-#define IECORESCENE_TRANSFORMBLOCK_H
-
-#include "IECoreScene/Export.h"
-#include "IECoreScene/Renderer.h"
-
-#include "boost/noncopyable.hpp"
-
-namespace IECoreScene
-{
-
-/// The TransformBlock class provides a simple means of ensuring that renderer->transformBegin()
-/// calls are matched by renderer->transformEnd() calls, even in the face of exceptions and
-/// multiple return statements from a function.
-/// \ingroup renderingGroup
-class IECORESCENE_API TransformBlock : public boost::noncopyable
-{
- public :
-
- /// Starts a new transform block, calling renderer->transformBegin(). If active is false
- /// then nothing is done.
- TransformBlock( RendererPtr renderer, bool active=true );
- /// Closes the transform block by calling renderer->transformEnd(). If active was false
- /// in the constructor then nothing is done.
- ~TransformBlock();
-
- private :
-
- RendererPtr m_renderer;
-
-};
-
-} // namespace IECoreScene
-
-#endif // IECORESCENE_TRANSFORMBLOCK_H
diff --git a/include/IECoreScene/TypeIds.h b/include/IECoreScene/TypeIds.h
index bfb8e42538..fd7fba984f 100644
--- a/include/IECoreScene/TypeIds.h
+++ b/include/IECoreScene/TypeIds.h
@@ -47,35 +47,35 @@ enum TypeId
ShaderTypeId = 108004,
PDCParticleReaderTypeId = 108005,
PDCParticleWriterTypeId = 108006,
- RendererTypeId = 108007,
+ RendererTypeId = 108007, // Obsolete, available for reuse
PrimitiveOpTypeId = 108008,
ParticleReaderTypeId = 108009,
ParticleWriterTypeId = 108010,
- MotionPrimitiveTypeId = 108011,
- TransformTypeId = 108012,
- MatrixTransformTypeId = 108013,
- MotionTransformTypeId = 108014,
- MatrixMotionTransformTypeId = 108015,
- GroupTypeId = 108016,
- AttributeStateTypeId = 108017,
+ MotionPrimitiveTypeId = 108011, // Obsolete, available for reuse
+ TransformTypeId = 108012, // Obsolete, available for reuse
+ MatrixTransformTypeId = 108013, // Obsolete, available for reuse
+ MotionTransformTypeId = 108014, // Obsolete, available for reuse
+ MatrixMotionTransformTypeId = 108015, // Obsolete, available for reuse
+ GroupTypeId = 108016, // Obsolete, available for reuse
+ AttributeStateTypeId = 108017, // Obsolete, available for reuse
VisibleRenderableTypeId = 108018,
- StateRenderableTypeId = 108019,
+ StateRenderableTypeId = 108019, // Obsolete, available for reuse
OBJReaderTypeId = 108020,
PointNormalsOpTypeId = 108021, // Obsolete, available for reuse
PointDensitiesOpTypeId = 108022, // Obsolete, available for reuse
- StateRenderableParameterTypeId = 108023,
- AttributeStateParameterTypeId = 108024,
+ StateRenderableParameterTypeId = 108023, // Obsolete, available for reuse
+ AttributeStateParameterTypeId = 108024, // Obsolete, available for reuse
ShaderParameterTypeId = 108025,
- TransformParameterTypeId = 108026,
- MatrixMotionTransformParameterTypeId = 108027,
- MatrixTransformParameterTypeId = 108028,
+ TransformParameterTypeId = 108026, // Obsolete, available for reuse
+ MatrixMotionTransformParameterTypeId = 108027, // Obsolete, available for reuse
+ MatrixTransformParameterTypeId = 108028, // Obsolete, available for reuse
VisibleRenderableParameterTypeId = 108029,
- GroupParameterTypeId = 108030,
- MotionPrimitiveParameterTypeId = 108031,
+ GroupParameterTypeId = 108030, // Obsolete, available for reuse
+ MotionPrimitiveParameterTypeId = 108031, // Obsolete, available for reuse
PrimitiveParameterTypeId = 108032,
MeshPrimitiveParameterTypeId = 108033,
PointsPrimitiveParameterTypeId = 108034,
- PreWorldRenderableTypeId = 108035,
+ PreWorldRenderableTypeId = 108035, // Obsolete, available for reuse
CameraTypeId = 108036,
NURBSPrimitiveTypeId = 108037,
PointBoundsOpTypeId = 108038, // Obsolete, available for reuse
@@ -98,7 +98,7 @@ enum TypeId
MeshTangentsOpTypeId = 108055,
PatchMeshPrimitiveTypeId = 108056,
CurvesPrimitiveParameterTypeId = 108057,
- CurveExtrudeOpTypeId = 108058,
+ CurveExtrudeOpTypeId = 108058, // Obsolete, available for reuse
ParameterisedProceduralTypeId = 108059,
NParticleReaderTypeId = 108060,
CurvesMergeOpTypeId = 108061,
@@ -124,12 +124,12 @@ enum TypeId
PointsPrimitiveEvaluatorTypeId = 108081,
PointsMotionOpTypeId = 108082, // Obsolete, available for reuse
ShaderNetworkTypeId = 108083,
- LightTypeId = 108084,
+ LightTypeId = 108084, // Obsolete, available for reuse
ContrastSmoothSkinningWeightsOpTypeId = 108085,
PointDistributionOpTypeId = 108086,
DiskPrimitiveTypeId = 108087,
MeshFaceFilterOpTypeId = 108088,
- OptionsTypeId = 108089,
+ OptionsTypeId = 108089, // Obsolete, available for reuse
SceneInterfaceTypeId = 108090,
SampledSceneInterfaceTypeId = 108091,
LinkedSceneTypeId = 108092,
diff --git a/include/IECoreScene/TypedObjectParameter.h b/include/IECoreScene/TypedObjectParameter.h
index d51057619b..3f2ca49831 100644
--- a/include/IECoreScene/TypedObjectParameter.h
+++ b/include/IECoreScene/TypedObjectParameter.h
@@ -41,36 +41,18 @@ namespace IECoreScene
{
IE_CORE_FORWARDDECLARE( Renderable )
-IE_CORE_FORWARDDECLARE( StateRenderable )
-IE_CORE_FORWARDDECLARE( AttributeState )
IE_CORE_FORWARDDECLARE( Shader )
-IE_CORE_FORWARDDECLARE( Transform )
-IE_CORE_FORWARDDECLARE( MatrixMotionTransform )
-IE_CORE_FORWARDDECLARE( MatrixTransform )
IE_CORE_FORWARDDECLARE( VisibleRenderable )
-IE_CORE_FORWARDDECLARE( Group )
IE_CORE_FORWARDDECLARE( SmoothSkinningData )
typedef IECore::TypedObjectParameter RenderableParameter;
-typedef IECore::TypedObjectParameter StateRenderableParameter;
-typedef IECore::TypedObjectParameter AttributeStateParameter;
typedef IECore::TypedObjectParameter ShaderParameter;
-typedef IECore::TypedObjectParameter TransformParameter;
-typedef IECore::TypedObjectParameter MatrixMotionTransformParameter;
-typedef IECore::TypedObjectParameter MatrixTransformParameter;
typedef IECore::TypedObjectParameter VisibleRenderableParameter;
-typedef IECore::TypedObjectParameter GroupParameter;
typedef IECore::TypedObjectParameter SmoothSkinningDataParameter;
IE_CORE_DECLAREPTR( RenderableParameter );
-IE_CORE_DECLAREPTR( StateRenderableParameter );
-IE_CORE_DECLAREPTR( AttributeStateParameter );
IE_CORE_DECLAREPTR( ShaderParameter );
-IE_CORE_DECLAREPTR( TransformParameter );
-IE_CORE_DECLAREPTR( MatrixMotionTransformParameter );
-IE_CORE_DECLAREPTR( MatrixTransformParameter );
IE_CORE_DECLAREPTR( VisibleRenderableParameter );
-IE_CORE_DECLAREPTR( GroupParameter );
IE_CORE_DECLAREPTR( SmoothSkinningDataParameter );
} // namespace IECoreScene
diff --git a/include/IECoreScene/TypedPrimitiveParameter.h b/include/IECoreScene/TypedPrimitiveParameter.h
index c2263c1869..aa32b19b8e 100644
--- a/include/IECoreScene/TypedPrimitiveParameter.h
+++ b/include/IECoreScene/TypedPrimitiveParameter.h
@@ -40,19 +40,16 @@
namespace IECoreScene
{
-IE_CORE_FORWARDDECLARE( MotionPrimitive )
IE_CORE_FORWARDDECLARE( Primitive )
IE_CORE_FORWARDDECLARE( MeshPrimitive )
IE_CORE_FORWARDDECLARE( CurvesPrimitive )
IE_CORE_FORWARDDECLARE( PointsPrimitive )
-typedef IECore::TypedObjectParameter MotionPrimitiveParameter;
typedef IECore::TypedObjectParameter PrimitiveParameter;
typedef IECore::TypedObjectParameter MeshPrimitiveParameter;
typedef IECore::TypedObjectParameter CurvesPrimitiveParameter;
typedef IECore::TypedObjectParameter PointsPrimitiveParameter;
-IE_CORE_DECLAREPTR( MotionPrimitiveParameter );
IE_CORE_DECLAREPTR( PrimitiveParameter );
IE_CORE_DECLAREPTR( MeshPrimitiveParameter );
IE_CORE_DECLAREPTR( CurvesPrimitiveParameter );
diff --git a/include/IECoreScene/WorldBlock.h b/include/IECoreScene/WorldBlock.h
deleted file mode 100644
index a3ad413f8c..0000000000
--- a/include/IECoreScene/WorldBlock.h
+++ /dev/null
@@ -1,69 +0,0 @@
-//////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2010-2011, Image Engine Design Inc. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// * Neither the name of Image Engine Design nor the names of any
-// other contributors to this software may be used to endorse or
-// promote products derived from this software without specific prior
-// written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-//////////////////////////////////////////////////////////////////////////
-
-#ifndef IECORESCENE_WORLDBLOCK_H
-#define IECORESCENE_WORLDBLOCK_H
-
-#include "IECoreScene/Export.h"
-#include "IECoreScene/Renderer.h"
-
-#include "boost/noncopyable.hpp"
-
-namespace IECoreScene
-{
-
-/// The WorldBlock class provides a simple means of ensuring that renderer->worldBegin()
-/// calls are matched by renderer->worldEnd() calls, even in the face of exceptions and
-/// multiple return statements from a function.
-/// \ingroup renderingGroup
-class IECORESCENE_API WorldBlock : public boost::noncopyable
-{
- public :
-
- /// Starts a new world block, calling renderer->worldBegin(). If active is false
- /// then nothing is done.
- WorldBlock( RendererPtr renderer, bool active=true );
- /// Closes the world block by calling renderer->worldEnd(). If active was false
- /// in the constructor then nothing is done.
- ~WorldBlock();
-
- private :
-
- RendererPtr m_renderer;
-
-};
-
-} // namespace IECoreScene
-
-#endif // IECORESCENE_WORLDBLOCK_H
diff --git a/include/IECoreVDB/VDBObject.h b/include/IECoreVDB/VDBObject.h
index 699d03cf52..3bc9e5f516 100644
--- a/include/IECoreVDB/VDBObject.h
+++ b/include/IECoreVDB/VDBObject.h
@@ -81,7 +81,6 @@ class IECOREVDB_API VDBObject : public IECoreScene::VisibleRenderable
std::vector gridNames() const;
Imath::Box3f bound() const override;
- void render( IECoreScene::Renderer *renderer ) const override;
IECore::CompoundObjectPtr metadata( const std::string &name );
diff --git a/python/IECoreScene/AttributeBlock.py b/python/IECoreScene/AttributeBlock.py
deleted file mode 100644
index 6c8dc382ca..0000000000
--- a/python/IECoreScene/AttributeBlock.py
+++ /dev/null
@@ -1,51 +0,0 @@
-##########################################################################
-#
-# Copyright (c) 2008, Image Engine Design Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#
-# * Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# * Neither the name of Image Engine Design nor the names of any
-# other contributors to this software may be used to endorse or
-# promote products derived from this software without specific prior
-# written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-##########################################################################
-
-## A context object intended for use with python's "with" syntax. It calls
-# renderer.attributeBegin() in enter and renderer.attributeEnd() in exit.
-class AttributeBlock :
-
- def __init__( self, renderer ) :
-
- self.__renderer = renderer
-
- def __enter__( self ) :
-
- self.__renderer.attributeBegin()
-
- def __exit__( self, type, value, traceBack ) :
-
- self.__renderer.attributeEnd()
-
-
diff --git a/python/IECoreScene/EditBlock.py b/python/IECoreScene/EditBlock.py
deleted file mode 100644
index 4cb188e676..0000000000
--- a/python/IECoreScene/EditBlock.py
+++ /dev/null
@@ -1,51 +0,0 @@
-##########################################################################
-#
-# Copyright (c) 2014, Image Engine Design Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#
-# * Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# * Neither the name of Image Engine Design nor the names of any
-# other contributors to this software may be used to endorse or
-# promote products derived from this software without specific prior
-# written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-##########################################################################
-
-class EditBlock :
-
- def __init__( self, renderer, editType, parameters ) :
-
- self.__renderer = renderer
- self.__editType = editType
- self.__parameters = parameters
-
- def __enter__( self ) :
-
- if self.__renderer is not None :
- self.__renderer.editBegin( self.__editType, self.__parameters )
-
- def __exit__( self, type, value, traceBack ) :
-
- if self.__renderer is not None :
- self.__renderer.editEnd()
diff --git a/python/IECoreScene/IDXReader.py b/python/IECoreScene/IDXReader.py
deleted file mode 100644
index 9f67d9fa4b..0000000000
--- a/python/IECoreScene/IDXReader.py
+++ /dev/null
@@ -1,257 +0,0 @@
-##########################################################################
-#
-# Copyright (c) 2010, Image Engine Design Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#
-# * Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# * Neither the name of Image Engine Design nor the names of any
-# other contributors to this software may be used to endorse or
-# promote products derived from this software without specific prior
-# written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-##########################################################################
-
-import re
-import imath
-
-import IECore
-import IECoreScene
-
-class IDXReader( IECore.Reader ) :
-
- def __init__( self, fileName=None ) :
-
- IECore.Reader.__init__(
- self,
- "Reads Leica Geosystems IDX files"
- )
-
- if fileName is not None :
- self["fileName"].setTypedValue( fileName )
-
- @staticmethod
- def canRead( fileName ) :
-
- try :
- f = open( fileName, "r" )
- return f.read( 6 )=="HEADER"
- except :
- return False
-
- def doOperation( self, args ) :
-
- f = open( args["fileName"].value, "r" )
-
- l = "".join( f.readlines() )
-
- dbMatch = re.search( "^DATABASE(.*)END DATABASE", l, re.MULTILINE | re.DOTALL )
- if dbMatch is None :
- raise RuntimeError( "Unable to find database block in file \"%s\"" % args["fileName"].value )
-
- headerMatch = re.search( "^HEADER(.*)END HEADER", l, re.MULTILINE | re.DOTALL )
- if headerMatch is None :
- raise RuntimeError( "Unable to find header block in file \"%s\"" % args["fileName"].value )
-
- projMatch = re.search( "PROJECT(.*?)END PROJECT", headerMatch.group( 1 ), re.MULTILINE | re.DOTALL )
- if projMatch is None :
- raise RuntimeError( "Unable to find project block in file \"%s\"" % args["fileName"].value )
-
- theoMatch = re.search( "^THEODOLITE(.*?)END THEODOLITE", l, re.MULTILINE | re.DOTALL )
- if theoMatch is None :
- raise RuntimeError( "Unable to find theodolite block in file \"%s\"" % args["fileName"].value )
-
- pointsMatch = re.search( r"POINTS\(([^)]*)\)(.*?)END POINTS", dbMatch.group( 1 ), re.MULTILINE | re.DOTALL )
- if pointsMatch is None :
- raise RuntimeError( "Unable to find points block in file \"%s\"" % args["fileName"].value )
-
- annotationMatch = re.search( r"ANNOTATIONS\(([^)]*)\)(.*?)END ANNOTATIONS", dbMatch.group( 1 ), re.MULTILINE | re.DOTALL )
- if annotationMatch is None :
- raise RuntimeError( "Unable to find annotation block in file \"%s\"" % args["fileName"].value )
-
- setupSlopeMatch = re.finditer( r"SETUP(.*?)END SETUP.*?SLOPE\(([^)]*)\)(.*?)END SLOPE", theoMatch.group( 1 ), re.MULTILINE | re.DOTALL )
- if setupSlopeMatch is None :
- raise RuntimeError( "Unable to setup/slope block in file \"%s\"" % args["fileName"].value )
-
- # Extract the Points from the database, these all have 'absolute' positions based on where the
- # Station was registered as being.
- points = self.__extractRows( pointsMatch.group(1), pointsMatch.group(2), "PointNo" )
- if not points :
- raise ValueError( "No points in file..." )
-
- # Extract any annotations in the points database
- annotations = self.__extractRows( annotationMatch.group(1), annotationMatch.group(2), "PointNo" )
-
- # Find out a little about our project
- projInfo = self.__extractFields( projMatch.group(1) )
-
- # We're going to return a group of PointsPrimitives, one for each station.
- g = IECoreScene.Group()
-
- for s in setupSlopeMatch:
-
- try:
- members = self.__extractRows( s.group(2), s.group(3), "TgtNo" )
- except ValueError :
- continue
-
- p = IECore.V3fVectorData()
- ids = IECore.StringVectorData()
- nos = IECore.IntVectorData()
- dates = IECore.StringVectorData()
- codes = IECore.StringVectorData()
- annotations = IECore.StringVectorData()
-
- for k in members.keys() :
-
- if k not in points :
- continue
-
- if "East" not in points[k] or "North" not in points[k] or "Elevation" not in points[k]:
- # some rows seem to have missing data - not much we can do about that
- continue
-
- try :
- x = float( points[k]["East"] )
- y = float( points[k]["Elevation"] )
- z = -float( points[k]["North"] ) # Handedness...
- except ValueError:
- continue;
-
- p.append( imath.V3f( x, y, z ) )
-
- nos.append( int(points[k]["PointNo"]) )
-
- ids.append( points[k]["PointID"] if "PointID" in points[k] else "" )
- dates.append( points[k]["Date"] if "Date" in points[k] else "" )
- codes.append( points[k]["Code"] if "Code" in points[k] else "" )
-
- if k in annotations :
- annotations.append( annotations[k]["Annotation"] )
- else :
- annotations.append( "" )
-
- primitive = IECoreScene.PointsPrimitive( p )
-
- # Extract any available station info from the SETUP block
- stnInfo = self.__extractFields( s.group(1) )
- for d in stnInfo.keys() :
- primitive.blindData()[d] = IECore.StringData( stnInfo[d] )
-
- # Store our station information on the primitive
- if "STN_NO" in stnInfo:
-
- stnNo = stnInfo["STN_NO"]
-
- if stnNo in points :
- tx = float( points[ stnNo ]["East"] )
- ty = float( points[ stnNo ]["Elevation"] )
- tz = -float( points[ stnNo ]["North"] ) # Handedness...
- primitive.blindData()["STN_POSITION"] = IECore.V3fData( imath.V3f( tx, ty, tz ) )
-
- if stnNo in annotations:
- primitive.blindData()["STN_ANNOTATION"] = IECore.StringData( annotations[stnNo]["Annotation"] )
-
- # copy Project Information to the primitive
- for f in projInfo:
- primitive.blindData()["PROJECT_%s" % f] = IECore.StringData( projInfo[f] )
-
- primitive["PointID"] = IECoreScene.PrimitiveVariable( IECoreScene.PrimitiveVariable.Interpolation.Vertex, ids )
- primitive["PointNo"] = IECoreScene.PrimitiveVariable( IECoreScene.PrimitiveVariable.Interpolation.Vertex, nos )
- primitive["Date"] = IECoreScene.PrimitiveVariable( IECoreScene.PrimitiveVariable.Interpolation.Vertex, dates )
- primitive["Code"] = IECoreScene.PrimitiveVariable( IECoreScene.PrimitiveVariable.Interpolation.Vertex, codes )
- primitive["Annotation"] = IECoreScene.PrimitiveVariable( IECoreScene.PrimitiveVariable.Interpolation.Vertex, annotations )
-
- if primitive.numPoints > 0 :
- g.addChild( primitive )
-
- return g
-
- # Extracts a row into a dictionary, or list, depending on wether a keyColumns name is specified
- # \param columnString A comma separated list of column names
- # \param rows A string containing all the rows of data
- # \paran keyColumn (optional) The string name of a column to use as a key in the output. If specified
- # a dictionary will be returned, rather than an ordered list.
- def __extractRows( self, columnString, rows, keyColumn=None ) :
-
- columnNames = [ x.strip() for x in columnString.split( "," ) ]
- numColumns = len( columnNames )
-
- if keyColumn and keyColumn not in columnNames :
- raise ValueError( "Unable to find the requested key column '%s' (%s)" % ( keyColumn, columnNames ) )
-
- if keyColumn:
- keyIndex = columnNames.index( keyColumn )
- output = {}
- else :
- output = []
-
- rows = rows.split( "\n" )
- for row in rows :
-
- thisRow = {}
-
- columns = [ x.strip( " \t\r;\"\'" ) for x in row.split( "," ) ]
- if len( columns ) != numColumns :
- continue
-
- try :
- for i in range(numColumns):
- thisRow[ columnNames[i] ] = columns[i]
- except ValueError :
- # some rows seem to have missing data - not much we can do about that
- continue
-
- if keyColumn:
- output[ columns[keyIndex] ] = thisRow
- else:
- output.append( thisRow )
-
- return output
-
- # Extracts fields from a simple NAME VALUE line.
- # \param data A string containing the field block
- # \prarm names A list of field NAMEs to extract. Any missing names will be omitted from the
- # returned dictionary.
- # \return A dictionary of NAME : VALUE pairs. All data remains as strings.
- def __extractFields( self, data, names=None ) :
-
- fields = {}
-
- if names:
- for n in names:
- match = re.search( n+r'[\s]+"{0,1}?([:\\/\-,.\w.]+)"{0,1}?', data, re.MULTILINE | re.DOTALL )
- if match:
- fields[n] = match.group(1)
- else:
-
- lines = data.split( "\n" )
- for l in lines:
- match = re.search( r'([\w.]+)[\s]+"{0,1}?([:\\/\-,.\w. ]+)"{0,1}?', l.strip( " \t\r;\"\'" ), re.MULTILINE | re.DOTALL )
- if match:
- fields[match.group(1)] = match.group(2)
-
- return fields
-
-IECore.registerRunTimeTyped( IDXReader )
-IECore.Reader.registerReader( "idx", IDXReader.canRead, IDXReader, IDXReader.staticTypeId() )
diff --git a/python/IECoreScene/MotionBlock.py b/python/IECoreScene/MotionBlock.py
deleted file mode 100644
index c5a0b17fe0..0000000000
--- a/python/IECoreScene/MotionBlock.py
+++ /dev/null
@@ -1,52 +0,0 @@
-##########################################################################
-#
-# Copyright (c) 2009, Image Engine Design Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#
-# * Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# * Neither the name of Image Engine Design nor the names of any
-# other contributors to this software may be used to endorse or
-# promote products derived from this software without specific prior
-# written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-##########################################################################
-
-## A context object intended for use with python's "with" syntax. It calls
-# renderer.motionBegin() in enter and renderer.motionEnd() in exit.
-class MotionBlock :
-
- def __init__( self, renderer, times ) :
-
- self.__renderer = renderer
- self.__times = times
-
- def __enter__( self ) :
-
- self.__renderer.motionBegin( self.__times )
-
- def __exit__( self, type, value, traceBack ) :
-
- self.__renderer.motionEnd()
-
-
diff --git a/python/IECoreScene/TransformBlock.py b/python/IECoreScene/TransformBlock.py
deleted file mode 100644
index ef500308fd..0000000000
--- a/python/IECoreScene/TransformBlock.py
+++ /dev/null
@@ -1,51 +0,0 @@
-##########################################################################
-#
-# Copyright (c) 2008, Image Engine Design Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#
-# * Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# * Neither the name of Image Engine Design nor the names of any
-# other contributors to this software may be used to endorse or
-# promote products derived from this software without specific prior
-# written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-##########################################################################
-
-## A context object intended for use with python's "with" syntax. It calls
-# renderer.transformBegin() in enter and renderer.transformEnd() in exit.
-class TransformBlock :
-
- def __init__( self, renderer ) :
-
- self.__renderer = renderer
-
- def __enter__( self ) :
-
- self.__renderer.transformBegin()
-
- def __exit__( self, type, value, traceBack ) :
-
- self.__renderer.transformEnd()
-
-
diff --git a/python/IECoreScene/WorldBlock.py b/python/IECoreScene/WorldBlock.py
deleted file mode 100644
index 543a2c5bba..0000000000
--- a/python/IECoreScene/WorldBlock.py
+++ /dev/null
@@ -1,51 +0,0 @@
-##########################################################################
-#
-# Copyright (c) 2008, Image Engine Design Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#
-# * Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# * Neither the name of Image Engine Design nor the names of any
-# other contributors to this software may be used to endorse or
-# promote products derived from this software without specific prior
-# written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-##########################################################################
-
-## A context object intended for use with python's "with" syntax. It calls
-# renderer.worldBegin() in enter and renderer.worldEnd() in exit.
-class WorldBlock :
-
- def __init__( self, renderer ) :
-
- self.__renderer = renderer
-
- def __enter__( self ) :
-
- self.__renderer.worldBegin()
-
- def __exit__( self, type, value, traceBack ) :
-
- self.__renderer.worldEnd()
-
-
diff --git a/python/IECoreScene/__init__.py b/python/IECoreScene/__init__.py
index bdb7e1d134..c54763bd3a 100644
--- a/python/IECoreScene/__init__.py
+++ b/python/IECoreScene/__init__.py
@@ -38,12 +38,6 @@
from .RemovePrimitiveVariables import RemovePrimitiveVariables
from .RenamePrimitiveVariables import RenamePrimitiveVariables
-from .AttributeBlock import AttributeBlock
-from .TransformBlock import TransformBlock
-from .WorldBlock import WorldBlock
-from .EditBlock import EditBlock
-from .MotionBlock import MotionBlock
-from .IDXReader import IDXReader
from .SWAReader import SWAReader
__import__( "IECore" ).loadConfig( "CORTEX_STARTUP_PATHS", subdirectory = "IECoreScene" )
diff --git a/src/IECoreGL/DeferredRendererImplementation.cpp b/src/IECoreGL/DeferredRendererImplementation.cpp
deleted file mode 100644
index 13bc67b499..0000000000
--- a/src/IECoreGL/DeferredRendererImplementation.cpp
+++ /dev/null
@@ -1,532 +0,0 @@
-//////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2007-2012, Image Engine Design Inc. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// * Neither the name of Image Engine Design nor the names of any
-// other contributors to this software may be used to endorse or
-// promote products derived from this software without specific prior
-// written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-//////////////////////////////////////////////////////////////////////////
-
-#include "IECoreGL/private/DeferredRendererImplementation.h"
-
-#include "IECoreGL/Camera.h"
-#include "IECoreGL/Group.h"
-#include "IECoreGL/Primitive.h"
-#include "IECoreGL/Scene.h"
-#include "IECoreGL/State.h"
-#include "IECoreGL/StateComponent.h"
-#include "IECoreGL/Texture.h"
-#include "IECoreGL/private/Display.h"
-
-#include "IECore/MessageHandler.h"
-
-#include "boost/noncopyable.hpp"
-
-#include "tbb/task.h"
-#include "tbb/task_scheduler_init.h"
-
-#include
-
-using namespace IECoreGL;
-using namespace Imath;
-using namespace std;
-
-DeferredRendererImplementation::DeferredRendererImplementation()
-{
-
- m_defaultContext = new RenderContext();
- m_defaultContext->transformStack.push( M44f() );
-
- m_scene = new Scene;
-}
-
-DeferredRendererImplementation::~DeferredRendererImplementation()
-{
-}
-
-void DeferredRendererImplementation::addCamera( CameraPtr camera )
-{
- m_scene->setCamera( camera );
-}
-
-void DeferredRendererImplementation::addDisplay( ConstDisplayPtr display )
-{
- IECore::msg( IECore::Msg::Error, "DeferredRendererImplementation::addDisplay", "Not implemented" );
-}
-
-void DeferredRendererImplementation::worldBegin()
-{
- if( m_defaultContext->transformStack.size()>1 )
- {
- IECore::msg( IECore::Msg::Error, "DeferredRendererImplementation::worldBegin", "Mismatched transformBegin/transformEnd detected." );
- }
- if( m_defaultContext->stateStack.size()>0 )
- {
- IECore::msg( IECore::Msg::Error, "DeferredRendererImplementation::worldBegin", "Mismatched attributeBegin/attributeEnd detected." );
- }
-
- m_defaultContext->localTransform = M44f();
- m_defaultContext->transformStack = TransformStack();
- m_defaultContext->transformStack.push( M44f() );
-
- m_defaultContext->stateStack.push_back( new State( false ) );
-
- m_defaultContext->groupStack.push( m_scene->root() ); /// \todo this group should have the attribute state accumulated before worldBegin
-}
-
-void DeferredRendererImplementation::worldEnd()
-{
- // check if no procedural threads are running.
- if ( m_threadContextPool.size() != 0 )
- {
- IECore::msg( IECore::Msg::Error, "DeferredRendererImplementation::worldEnd", "Detected threads for procedural rendering that are still running!" );
- }
-
- if( m_defaultContext->transformStack.size()!=1 )
- {
- IECore::msg( IECore::Msg::Error, "DeferredRendererImplementation::worldEnd", "Bad nesting of transformBegin/transformEnd detected." );
- }
-
- if( m_defaultContext->stateStack.size()!=1 )
- {
- IECore::msg( IECore::Msg::Error, "DeferredRendererImplementation::worldEnd", "Bad nesting of attributeBegin/attributeEnd detected." );
- }
-
- m_defaultContext->localTransform = M44f();
- m_defaultContext->transformStack = TransformStack();
- m_defaultContext->transformStack.push( M44f() );
-
- /// \todo This is where we would do our rendering and saving of images.
-}
-
-void DeferredRendererImplementation::transformBegin()
-{
- RenderContext *curContext = currentContext();
-
- GroupPtr g = new Group;
- g->setTransform( curContext->localTransform );
- {
- std::lock_guard lock( curContext->groupStack.top()->mutex() );
- curContext->groupStack.top()->addChild( g );
- }
- curContext->groupStack.push( g );
-
- curContext->transformStack.push( curContext->localTransform * curContext->transformStack.top() );
- curContext->localTransform = Imath::M44f();
-}
-
-void DeferredRendererImplementation::transformEnd()
-{
- RenderContext *curContext = currentContext();
-
- if( curContext->transformStack.size()<=1 )
- {
- IECore::msg( IECore::Msg::Warning, "DeferredRendererImplementation::transformEnd", "Bad nesting." );
- return;
- }
-
- // recover local transform from group and remove group from stack
- curContext->transformStack.pop();
- curContext->localTransform = curContext->groupStack.top()->getTransform();
- curContext->groupStack.pop();
-
-}
-
-void DeferredRendererImplementation::setTransform( const Imath::M44f &m )
-{
- RenderContext *curContext = currentContext();
-
- // figure out the local transformation from the last group that lead us to the given matrix.
- curContext->localTransform = m * curContext->transformStack.top().inverse();
-
-}
-
-Imath::M44f DeferredRendererImplementation::getTransform() const
-{
- const RenderContext *curContext = currentContext();
- // return the current world matrix
- return curContext->localTransform * curContext->transformStack.top();
-}
-
-void DeferredRendererImplementation::concatTransform( const Imath::M44f &matrix )
-{
- RenderContext *curContext = currentContext();
-
- curContext->localTransform = matrix * curContext->localTransform;
-}
-
-void DeferredRendererImplementation::attributeBegin()
-{
- RenderContext *curContext = currentContext();
-
- GroupPtr g = new Group;
- g->setTransform( curContext->localTransform );
- g->setState( new State( **(curContext->stateStack.rbegin()) ) );
- {
- std::lock_guard lock( curContext->groupStack.top()->mutex() );
- curContext->groupStack.top()->addChild( g );
- }
- curContext->groupStack.push( g );
-
- curContext->transformStack.push( curContext->localTransform * curContext->transformStack.top() );
- curContext->localTransform = Imath::M44f();
- curContext->stateStack.push_back( new State( false ) );
-}
-
-void DeferredRendererImplementation::attributeEnd()
-{
- RenderContext *curContext = currentContext();
-
- if( curContext->stateStack.size()<=1 )
- {
- IECore::msg( IECore::Msg::Warning, "DeferredRendererImplementation::attributeEnd", "Bad nesting." );
- return;
- }
- curContext->stateStack.pop_back();
-
- // recover local transform from group and remove group from stack
- curContext->transformStack.pop();
- curContext->localTransform = curContext->groupStack.top()->getTransform();
- curContext->groupStack.pop();
-}
-
-void DeferredRendererImplementation::addState( StateComponentPtr state )
-{
- RenderContext *curContext = currentContext();
-
- (*(curContext->stateStack).rbegin())->add( state );
-}
-
-StateComponent *DeferredRendererImplementation::getState( IECore::TypeId type )
-{
- RenderContext *curContext = currentContext();
-
- for( StateStack::reverse_iterator it=curContext->stateStack.rbegin(); it!=curContext->stateStack.rend(); it++ )
- {
- StateComponentPtr c = (*it)->get( type );
- if( c )
- {
- return c.get();
- }
- }
- return const_cast( State::defaultState()->get( type ) );
-}
-
-void DeferredRendererImplementation::addUserAttribute( const IECore::InternedString &name, IECore::DataPtr value )
-{
- RenderContext *curContext = currentContext();
-
- (*(curContext->stateStack).rbegin())->userAttributes()->writable()[ name ] = value;
-}
-
-IECore::Data *DeferredRendererImplementation::getUserAttribute( const IECore::InternedString &name )
-{
- RenderContext *curContext = currentContext();
-
- for( StateStack::reverse_iterator it=curContext->stateStack.rbegin(); it!=curContext->stateStack.rend(); it++ )
- {
- IECore::CompoundDataMap &attrs = (*it)->userAttributes()->writable();
- IECore::CompoundDataMap::iterator attrIt = attrs.find( name );
- if( attrIt != attrs.end() )
- {
- return attrIt->second.get();
- }
- }
- return nullptr;
-}
-
-void DeferredRendererImplementation::addPrimitive( ConstPrimitivePtr primitive )
-{
- bool visible = static_cast( getState( CameraVisibilityStateComponent::staticTypeId() ) )->value();
- if( !visible )
- {
- return;
- }
-
- RenderContext *curContext = currentContext();
-
- GroupPtr g = new Group;
- g->setTransform( curContext->localTransform );
- g->setState( new State( **(curContext->stateStack.rbegin()) ) );
- /// \todo Make Groups have only const access to children and we won't need this
- /// cast. This is going to be particularly important going forwards, as the key
- /// to decent speed and memory usage is going to be automatically instanced primitives,
- /// each referencing potentially shared vertex buffer objects. Modifying one of those
- /// could have bad consequences for the others.
- g->addChild( boost::const_pointer_cast( primitive ) );
-
- {
- std::lock_guard lock( curContext->groupStack.top()->mutex() );
- curContext->groupStack.top()->addChild( g );
- }
-}
-
-void DeferredRendererImplementation::addInstance( GroupPtr grp )
-{
- bool visible = static_cast( getState( CameraVisibilityStateComponent::staticTypeId() ) )->value();
- if( !visible )
- {
- return;
- }
-
- RenderContext *curContext = currentContext();
-
- GroupPtr g = new Group;
- g->setTransform( curContext->localTransform );
- g->setState( new State( **(curContext->stateStack.rbegin()) ) );
- g->addChild( grp );
-
- {
- std::lock_guard lock( curContext->groupStack.top()->mutex() );
- curContext->groupStack.top()->addChild( g );
- }
-}
-
-// Class that sets the scope of a RenderContext on the renderer thread.
-struct DeferredRendererImplementation::ScopedRenderContext : private boost::noncopyable
-{
- public:
-
- // Sets the context on the given renderer, to be reverted on the destructor.
- // context should be a RenderContext with just one element on each stack.
- // msgContext is used on error messages only.
- ScopedRenderContext( RenderContextPtr context, DeferredRendererImplementation &renderer, const char *msgContext ) : m_renderer(renderer), m_context( context ), m_msgContext( msgContext )
- {
- if ( m_context->transformStack.size() != 1 ||
- m_context->stateStack.size() != 1 ||
- m_context->groupStack.size() != 1 )
- {
- throw IECore::Exception( "The given context must have just one element at each stack member!" );
- }
-
- renderer.pushContext( context );
- }
-
- ~ScopedRenderContext()
- {
- // unregisters this thread context.
- RenderContextPtr removedContext = m_renderer.popContext();
-
- if ( m_context.get() != removedContext.get() )
- {
- IECore::msg( IECore::Msg::Error, m_msgContext, "Corrupted render context stack!" );
- }
-
- if ( m_context->transformStack.size() != 1 )
- {
- IECore::msg( IECore::Msg::Error, m_msgContext, "Bad nesting of transformBegin/transformEnd detected." );
- }
- if ( m_context->stateStack.size() != 1 )
- {
- IECore::msg( IECore::Msg::Error, m_msgContext, "Bad nesting of attributeBegin/attributeEnd detected." );
- }
- }
-
- private:
-
- DeferredRendererImplementation &m_renderer;
- RenderContextPtr m_context;
- const char *m_msgContext;
-};
-
-class DeferredRendererImplementation::ProceduralTask : public tbb::task, private boost::noncopyable
-{
- public:
-
- ProceduralTask( DeferredRendererImplementation &renderer, IECoreScene::Renderer::ProceduralPtr proc, IECoreScene::RendererPtr param ) :
- m_renderer(renderer), m_procedural(proc), m_param(param), m_taskList(nullptr)
- {
- m_numSubtasks = 0;
- RenderContext *curContext = m_renderer.currentContext();
-
- // create a RenderContext for a new Procedural based on the current context
- StatePtr completeState = new State( false );
- for ( StateStack::iterator it = curContext->stateStack.begin(); it != curContext->stateStack.end(); it++ )
- {
- completeState->add( *it );
- }
- m_proceduralContext = new RenderContext();
- m_proceduralContext->localTransform = curContext->localTransform;
- m_proceduralContext->transformStack.push( curContext->transformStack.top() );
- m_proceduralContext->stateStack.push_back( completeState );
- m_proceduralContext->groupStack.push( curContext->groupStack.top() );
- }
-
- ~ProceduralTask() override
- {
- }
-
- task* execute() override
- {
- tbb::task_list taskList;
-
- m_taskList = &taskList;
-
- // activates the render context on the task's thread.
- ScopedRenderContext scopedProceduralContext( m_proceduralContext, m_renderer, "DeferredRendererImplementation::ProceduralTask::execute" );
- m_procedural->render( m_param.get() );
- set_ref_count( m_numSubtasks + 1 );
- spawn_and_wait_for_all(taskList);
- taskList.clear();
- m_taskList = nullptr;
- return nullptr;
- }
-
- void addSubtask( ProceduralTask& subtask )
- {
- if ( !m_taskList )
- {
- IECore::msg( IECore::Msg::Error, "DeferredRendererImplementation::ProceduralTask::addSubtask", "No tasklist!" );
- return;
- }
- m_taskList->push_back( subtask );
- m_numSubtasks++;
- }
-
- private :
-
- std::atomic m_numSubtasks;
- RenderContextPtr m_proceduralContext;
- DeferredRendererImplementation &m_renderer;
- IECoreScene::Renderer::ProceduralPtr m_procedural;
- IECoreScene::RendererPtr m_param;
- tbb::task_list *m_taskList;
-};
-
-
-
-void DeferredRendererImplementation::addProcedural( IECoreScene::Renderer::ProceduralPtr proc, IECoreScene::RendererPtr renderer )
-{
- bool visible = static_cast( getState( CameraVisibilityStateComponent::staticTypeId() ) )->value();
- if( !visible )
- {
- return;
- }
-
- bool withThreads = static_cast( getState( ProceduralThreadingStateComponent::staticTypeId() ) )->value();
- if( withThreads )
- {
- bool mainProcedural = ( m_threadContextPool.size() == 0 );
-
- if ( mainProcedural )
- {
- // the init is necessary for tbb < 2.2, whereas it is automatically
- // created for us in tbb >= 2.2. tbb documentation indicates that it is
- // fine to create multiple instances though so we create one just in case.
- tbb::task_scheduler_init init;
-
- // create root task.
- tbb::task_group_context taskGroupContext( tbb::task_group_context::isolated );
- ProceduralTask& a = *new( ProceduralTask::allocate_root( taskGroupContext ) ) ProceduralTask( *this, proc, renderer );
- tbb::task::spawn_root_and_wait(a);
- // check if all contexts were cleared
- for ( ThreadRenderContext::const_iterator it = m_threadContextPool.begin(); it != m_threadContextPool.end(); it++ )
- {
- if ( (*it).size() )
- {
- IECore::msg( IECore::Msg::Error, "DeferredRendererImplementation::procedural", "Non empty thread render context detected!" );
- }
- }
- m_threadContextPool.clear();
- }
- else
- {
- ProceduralTask *parentTask = dynamic_cast< ProceduralTask *>(&ProceduralTask::self());
- if ( parentTask )
- {
- // add a child task to the current task
- ProceduralTask& a = *new(parentTask->allocate_child()) ProceduralTask( *this, proc, renderer );
- // register this class on the parent task
- parentTask->addSubtask( a );
- }
- else
- {
- // Somehow the parent task is not ProceduralTask...
- IECore::msg( IECore::Msg::Error, "DeferredRendererImplementation::procedural", "Incompatible parent task type!" );
- }
- }
- }
- else
- {
- // threading not wanted - just execute immediately
- proc->render( renderer.get() );
- }
-}
-
-ScenePtr DeferredRendererImplementation::scene()
-{
- return m_scene;
-}
-
-const DeferredRendererImplementation::RenderContext *DeferredRendererImplementation::currentContext() const
-{
- if ( m_threadContextPool.size() == 0 )
- {
- // If no thread context created so far than there's no procedural being rendered. Returns the default context.
- return m_defaultContext.get();
- }
-
- ThreadRenderContext::reference myThreadContext = m_threadContextPool.local();
- if ( myThreadContext.size() == 0 )
- {
- // The user created a new thread from the procedural render call...
- // there's no way to know which context it should be using.
- throw IECore::Exception( "Invalid thread used on deferred render! Procedurals should not instantiate threads!" );
- }
-
- return myThreadContext.top().get();
-}
-
-DeferredRendererImplementation::RenderContext *DeferredRendererImplementation::currentContext()
-{
- // get the const version of current context and avoid code duplication.
- return const_cast< RenderContext * >(
- static_cast< const DeferredRendererImplementation & >(*this).currentContext()
- );
-}
-
-void DeferredRendererImplementation::pushContext( RenderContextPtr context )
-{
- ThreadRenderContext::reference myThreadContext = m_threadContextPool.local();
-
- myThreadContext.push( context );
-}
-
-DeferredRendererImplementation::RenderContextPtr DeferredRendererImplementation::popContext()
-{
- ThreadRenderContext::reference myThreadContext = m_threadContextPool.local();
- if ( myThreadContext.size() == 0 )
- {
- throw IECore::Exception( "Corrupted thread context stack!" );
- }
- RenderContextPtr top = myThreadContext.top();
-
- myThreadContext.pop();
-
- return top;
-}
diff --git a/src/IECoreGL/ImmediateRendererImplementation.cpp b/src/IECoreGL/ImmediateRendererImplementation.cpp
deleted file mode 100644
index 7446306c30..0000000000
--- a/src/IECoreGL/ImmediateRendererImplementation.cpp
+++ /dev/null
@@ -1,225 +0,0 @@
-//////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2007-2012, Image Engine Design Inc. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// * Neither the name of Image Engine Design nor the names of any
-// other contributors to this software may be used to endorse or
-// promote products derived from this software without specific prior
-// written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-//////////////////////////////////////////////////////////////////////////
-
-#include "IECoreGL/private/ImmediateRendererImplementation.h"
-
-#include "IECoreGL/ColorTexture.h"
-#include "IECoreGL/DepthTexture.h"
-#include "IECoreGL/Exception.h"
-#include "IECoreGL/FrameBuffer.h"
-#include "IECoreGL/Group.h"
-#include "IECoreGL/Camera.h"
-#include "IECoreGL/Primitive.h"
-#include "IECoreGL/ShaderStateComponent.h"
-#include "IECoreGL/State.h"
-#include "IECoreGL/StateComponent.h"
-#include "IECoreGL/private/Display.h"
-
-#include "IECore/MessageHandler.h"
-#include "IECore/Writer.h"
-
-#include
-
-using namespace IECoreGL;
-using namespace Imath;
-using namespace std;
-
-ImmediateRendererImplementation::ImmediateRendererImplementation()
-{
- m_stateStack.push( new State( true ) );
-}
-
-ImmediateRendererImplementation::~ImmediateRendererImplementation()
-{
-}
-
-void ImmediateRendererImplementation::addCamera( CameraPtr camera )
-{
- m_camera = camera;
-}
-
-void ImmediateRendererImplementation::addDisplay( ConstDisplayPtr display )
-{
- m_displays.push_back( display );
-}
-
-void ImmediateRendererImplementation::worldBegin()
-{
- unsigned int width = m_camera->getResolution().x;
- unsigned int height = m_camera->getResolution().y;
- try
- {
- m_frameBuffer = new FrameBuffer;
- m_frameBuffer->setColor( new ColorTexture( width, height ) );
- IECoreGL::Exception::throwIfError();
- m_frameBuffer->setDepth( new DepthTexture( width, height ) );
- IECoreGL::Exception::throwIfError();
- m_frameBuffer->validate();
- m_frameBufferBinding = new FrameBuffer::ScopedBinding( *m_frameBuffer );
- }
- catch( const std::exception &e )
- {
- IECore::msg( IECore::Msg::Error, "Renderer::worldBegin", boost::format( "Unable to make framebuffer (%s)." ) % e.what() );
- }
-
- glPushAttrib( GL_ALL_ATTRIB_BITS );
-
- m_camera->render( m_stateStack.top().get() );
-
- glViewport( 0, 0, width, height );
- glClearColor( 0.0, 0.0, 0.0, 0.0 );
- glClearDepth( 1.0 );
- glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
-
- m_stateStack.push( new State( *(m_stateStack.top()) ) );
-
- State::bindBaseState();
- m_stateStack.top()->bind();
-}
-
-void ImmediateRendererImplementation::worldEnd()
-{
- m_stateStack.pop();
- glPopAttrib();
- if( m_frameBuffer )
- {
- for( unsigned int i=0; idisplay( m_frameBuffer );
- }
- }
-
- delete m_frameBufferBinding;
- m_frameBufferBinding = nullptr;
-}
-
-void ImmediateRendererImplementation::transformBegin()
-{
- glPushMatrix();
-}
-
-void ImmediateRendererImplementation::transformEnd()
-{
- glPopMatrix();
-}
-
-void ImmediateRendererImplementation::setTransform( const Imath::M44f &m )
-{
- // assumes world coordinate system is the identity matrix.
- glLoadMatrixf( ( m * m_camera->getTransform().inverse() ).getValue() );
-}
-
-Imath::M44f ImmediateRendererImplementation::getTransform() const
-{
- // get the current open GL model-view matrix and take the camera out of it to return the world space matrix.
- return Camera::matrix() * m_camera->getTransform();
-}
-
-void ImmediateRendererImplementation::concatTransform( const Imath::M44f &matrix )
-{
- glMultMatrixf( matrix.getValue() );
-}
-
-void ImmediateRendererImplementation::attributeBegin()
-{
- transformBegin();
- m_stateStack.push( new State( *(m_stateStack.top()) ) );
-}
-
-void ImmediateRendererImplementation::attributeEnd()
-{
- if( m_stateStack.size()<=1 )
- {
- IECore::msg( IECore::Msg::Warning, "ImmediateRendererImplementation::attributeEnd", "Bad nesting." );
- return;
- }
- m_stateStack.pop();
- m_stateStack.top()->bind();
- transformEnd();
-}
-
-void ImmediateRendererImplementation::addState( StateComponentPtr state )
-{
- m_stateStack.top()->add( state );
- state->bind();
-}
-
-StateComponent *ImmediateRendererImplementation::getState( IECore::TypeId type )
-{
- return m_stateStack.top()->get( type );
-}
-
-void ImmediateRendererImplementation::addUserAttribute( const IECore::InternedString &name, IECore::DataPtr value )
-{
- m_stateStack.top()->userAttributes()->writable()[ name ] = value;
-}
-
-IECore::Data *ImmediateRendererImplementation::getUserAttribute( const IECore::InternedString &name )
-{
- State *curState = m_stateStack.top().get();
- IECore::CompoundDataMap &attrs = curState->userAttributes()->writable();
- IECore::CompoundDataMap::iterator attrIt = attrs.find( name );
- if( attrIt != attrs.end() )
- {
- return attrIt->second.get();
- }
- return nullptr;
-}
-
-void ImmediateRendererImplementation::addPrimitive( ConstPrimitivePtr primitive )
-{
- bool visible = static_cast( getState( CameraVisibilityStateComponent::staticTypeId() ) )->value();
- if( visible )
- {
- primitive->render( m_stateStack.top().get() );
- }
-}
-
-void ImmediateRendererImplementation::addProcedural( IECoreScene::Renderer::ProceduralPtr proc, IECoreScene::RendererPtr renderer )
-{
- bool visible = static_cast( getState( CameraVisibilityStateComponent::staticTypeId() ) )->value();
- if( visible )
- {
- proc->render( renderer.get() );
- }
-}
-
-void ImmediateRendererImplementation::addInstance( GroupPtr grp )
-{
- bool visible = static_cast( getState( CameraVisibilityStateComponent::staticTypeId() ) )->value();
- if( visible )
- {
- grp->render( m_stateStack.top().get() );
- }
-}
diff --git a/src/IECoreGL/Renderer.cpp b/src/IECoreGL/Renderer.cpp
deleted file mode 100644
index 7730e1b994..0000000000
--- a/src/IECoreGL/Renderer.cpp
+++ /dev/null
@@ -1,2078 +0,0 @@
-//////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2007-2013, Image Engine Design Inc. All rights reserved.
-// Copyright (c) 2011, John Haddon. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// * Neither the name of Image Engine Design nor the names of any
-// other contributors to this software may be used to endorse or
-// promote products derived from this software without specific prior
-// written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-//////////////////////////////////////////////////////////////////////////
-
-#include "IECoreGL/Renderer.h"
-
-#include "IECoreGL/CachedConverter.h"
-#include "IECoreGL/ColorTexture.h"
-#include "IECoreGL/CurvesPrimitive.h"
-#include "IECoreGL/DiskPrimitive.h"
-#include "IECoreGL/Font.h"
-#include "IECoreGL/FontLoader.h"
-#include "IECoreGL/GL.h"
-#include "IECoreGL/Group.h"
-#include "IECoreGL/LuminanceTexture.h"
-#include "IECoreGL/MeshPrimitive.h"
-#include "IECoreGL/NameStateComponent.h"
-#include "IECoreGL/Camera.h"
-#include "IECoreGL/PointsPrimitive.h"
-#include "IECoreGL/QuadPrimitive.h"
-#include "IECoreGL/Scene.h"
-#include "IECoreGL/Shader.h"
-#include "IECoreGL/ShaderLoader.h"
-#include "IECoreGL/ShaderStateComponent.h"
-#include "IECoreGL/SpherePrimitive.h"
-#include "IECoreGL/State.h"
-#include "IECoreGL/TextPrimitive.h"
-#include "IECoreGL/TextureLoader.h"
-#include "IECoreGL/ToGLCameraConverter.h"
-#include "IECoreGL/ToGLMeshConverter.h"
-#include "IECoreGL/TypedStateComponent.h"
-#include "IECoreGL/private/DeferredRendererImplementation.h"
-#include "IECoreGL/private/Display.h"
-#include "IECoreGL/private/ImmediateRendererImplementation.h"
-
-#include "IECoreScene/Camera.h"
-#include "IECoreScene/CurvesPrimitive.h"
-#include "IECoreScene/MeshNormalsOp.h"
-#include "IECoreScene/MeshPrimitive.h"
-#include "IECoreScene/PointsPrimitive.h"
-#include "IECoreScene/Transform.h"
-
-#include "IECore/BoxOps.h"
-#include "IECore/MatrixAlgo.h"
-#include "IECore/MessageHandler.h"
-#include "IECore/SimpleTypedData.h"
-#include "IECore/SplineData.h"
-
-#include "Imath/ImathBoxAlgo.h"
-
-#include
-#include
-
-// Windows defines SearchPath, breaking our use of `IECore::SearchPath`.
-#ifdef SearchPath
-#undef SearchPath
-#endif
-
-using namespace IECore;
-using namespace IECoreScene;
-using namespace IECoreGL;
-using namespace Imath;
-using namespace std;
-
-IE_CORE_DEFINERUNTIMETYPED( IECoreGL::Renderer );
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////////
-// static utility functions
-/////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-template
-typename T::ConstPtr castWithWarning( ConstDataPtr data, const std::string &name, const std::string &context )
-{
- typename T::ConstPtr c = runTimeCast( data );
- if( !c )
- {
- msg( Msg::Warning, context, boost::format( "Expected \"%s\" to be of type \"%s\"." ) % name % T::staticTypeName() );
- }
- return c;
-}
-
-template
-T parameterValue( const char *name, const CompoundDataMap ¶meters, T defaultValue )
-{
- CompoundDataMap::const_iterator it = parameters.find( name );
- if( it!=parameters.end() )
- {
- typename TypedData::ConstPtr p = runTimeCast >( it->second );
- if( p )
- {
- return p->readable();
- }
- }
- return defaultValue;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////////
-// member data held in a single structure
-/////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-/// \todo Now we're adding methods to this, we should probably rename it to Impl
-/// or Implementation. We should perhaps also rename the RendererImplementation
-/// classes to RendererBackend or something to avoid confusion.
-struct IECoreGL::Renderer::MemberData
-{
- enum Mode
- {
- Immediate,
- Deferred
- };
-
- struct
- {
- Mode mode;
- V2f shutter;
- IECore::CompoundDataMap user;
- string fontSearchPath;
- string fontSearchPathDefault;
- string shaderSearchPath;
- string shaderSearchPathDefault;
- string shaderIncludePath;
- string shaderIncludePathDefault;
- string textureSearchPath;
- string textureSearchPathDefault;
- vector cameras;
- vector displays;
- bool drawCoordinateSystems;
- } options;
-
- /// This is used only before worldBegin, so we can correctly get the transforms for cameras.
- /// After worldBegin the transform stack is taken care of by the backend implementations.
- std::stack transformStack;
-
- bool inWorld;
- bool inEdit;
- RendererImplementationPtr implementation;
- ShaderLoaderPtr shaderLoader;
- TextureLoaderPtr textureLoader;
-#ifdef IECORE_WITH_FREETYPE
- FontLoaderPtr fontLoader;
-#endif // IECORE_WITH_FREETYPE
-
- typedef std::map InstanceMap;
- InstanceMap instances;
- Group *currentInstance;
-
- CachedConverterPtr cachedConverter;
-
- // we don't want to just destroy objects in the removeObject command, as we could be in
- // any thread at the time, and we can only destroy gl resources on the thread which has
- // the gl context. so we stash them in here until the editEnd command, and then destroy
- // them. the implication is therefore that editEnd must be called on the main gl thread,
- // but that procedurals are free to call removeObject regardless of which thread they're
- // being called from.
- std::set removedObjects;
- std::mutex removedObjectsMutex;
-
- void addPrimitive( const IECoreScene::Primitive *corePrimitive )
- {
- ConstPrimitivePtr glPrimitive;
- if( implementation->getState()->value() )
- {
- glPrimitive = IECore::runTimeCast( cachedConverter->convert( corePrimitive ) );
- }
- else
- {
- ToGLConverterPtr converter = ToGLConverter::create( corePrimitive, IECoreGL::Primitive::staticTypeId() );
- glPrimitive = IECore::runTimeCast( converter->convert() );
- }
-
- addPrimitive( glPrimitive );
- }
-
- void addPrimitive( IECoreGL::ConstPrimitivePtr glPrimitive )
- {
- if( currentInstance )
- {
- addCurrentInstanceChild( glPrimitive );
- }
- else if( checkCulling( glPrimitive->bound() ) )
- {
- implementation->addPrimitive( glPrimitive );
- }
- }
-
- void addCurrentInstanceChild( IECoreGL::ConstRenderablePtr child )
- {
- IECoreGL::GroupPtr childGroup = new IECoreGL::Group();
- childGroup->setTransform( transformStack.top() );
- /// \todo See todo in DeferredRendererImplementation::addPrimitive().
- childGroup->addChild( boost::const_pointer_cast( child ) );
- currentInstance->addChild( childGroup );
- }
-
- bool checkCulling( const Imath::Box3f &bound )
- {
- const Imath::Box3f &cullBox = implementation->getState()->value();
- if( cullBox.isEmpty() )
- {
- // culling is disabled... p should be rendered.
- return true;
- }
-
- if( bound == Procedural::noBound )
- {
- return true;
- }
-
- Imath::Box3f b = bound;
- switch( implementation->getState()->value() )
- {
- case ObjectSpace :
- // if in local space we don't have to transform bounding box of p.
- break;
- case WorldSpace :
- // transform procedural bounding box to world space to match culling box space.
- b = Imath::transform( b, implementation->getTransform() );
- break;
- default :
- msg( Msg::Warning, "Renderer::checkCulling", "Unnexpected culling space!" );
- return true;
- }
- return cullBox.intersects( b );
- }
-
-};
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////////
-// structors
-/////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-IECoreGL::Renderer::Renderer()
-{
- m_data = new MemberData;
-
- m_data->options.mode = MemberData::Immediate;
- m_data->options.shutter = V2f( 0 );
-
- const char *fontPath = getenv( "IECORE_FONT_PATHS" );
- m_data->options.fontSearchPath = m_data->options.fontSearchPathDefault = fontPath ? fontPath : "";
- const char *shaderPath = getenv( "IECOREGL_SHADER_PATHS" );
- m_data->options.shaderSearchPath = m_data->options.shaderSearchPathDefault = shaderPath ? shaderPath : "";
- const char *shaderIncludePath = getenv( "IECOREGL_SHADER_INCLUDE_PATHS" );
- m_data->options.shaderIncludePath = m_data->options.shaderIncludePathDefault = shaderIncludePath ? shaderIncludePath : "";
- const char *texturePath = getenv( "IECOREGL_TEXTURE_PATHS" );
- m_data->options.textureSearchPath = m_data->options.textureSearchPathDefault = texturePath ? texturePath : "";
- m_data->options.drawCoordinateSystems = false;
-
- m_data->transformStack.push( M44f() );
-
- m_data->inWorld = false;
- m_data->inEdit = false;
- m_data->currentInstance = nullptr;
- m_data->implementation = nullptr;
- m_data->shaderLoader = nullptr;
-
- m_data->cachedConverter = CachedConverter::defaultCachedConverter();
-}
-
-IECoreGL::Renderer::~Renderer()
-{
- delete m_data;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////////
-// options etc
-/////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-typedef void (*OptionSetter)( const std::string &name, IECore::ConstDataPtr value, IECoreGL::Renderer::MemberData *memberData );
-typedef std::map OptionSetterMap;
-
-typedef IECore::DataPtr (*OptionGetter)( const std::string &name, IECoreGL::Renderer::MemberData *memberData );
-typedef std::map OptionGetterMap;
-
-static void modeOptionSetter( const std::string &name, IECore::ConstDataPtr value, IECoreGL::Renderer::MemberData *memberData )
-{
- if( ConstStringDataPtr s = castWithWarning( value, name, "Renderer::setOption" ) )
- {
- if( s->readable()=="immediate" )
- {
- memberData->options.mode = IECoreGL::Renderer::MemberData::Immediate;
- }
- else if( s->readable()=="deferred" )
- {
- memberData->options.mode = IECoreGL::Renderer::MemberData::Deferred;
- }
- else
- {
- msg( Msg::Warning, "Renderer::setOption", boost::format( "Unsuppported mode value \"%s\"." ) % s->readable() );
- }
- }
- return;
-}
-
-static IECore::DataPtr modeOptionGetter( const std::string &name, IECoreGL::Renderer::MemberData *memberData )
-{
- switch( memberData->options.mode )
- {
- case IECoreGL::Renderer::MemberData::Immediate :
- return new StringData( "immediate" );
- default :
- return new StringData( "deferred" );
- }
-}
-
-static void shutterOptionSetter( const std::string &name, IECore::ConstDataPtr value, IECoreGL::Renderer::MemberData *memberData )
-{
- if( ConstV2fDataPtr s = castWithWarning( value, name, "Renderer::setOption" ) )
- {
- memberData->options.shutter = s->readable();
- }
-}
-
-static IECore::DataPtr shutterOptionGetter( const std::string &name, IECoreGL::Renderer::MemberData *memberData )
-{
- return new V2fData( memberData->options.shutter );
-}
-
-static void fontSearchPathOptionSetter( const std::string &name, IECore::ConstDataPtr value, IECoreGL::Renderer::MemberData *memberData )
-{
- if( ConstStringDataPtr s = castWithWarning( value, name, "Renderer::setOption" ) )
- {
- memberData->options.fontSearchPath = s->readable();
- }
-}
-
-static IECore::DataPtr fontSearchPathOptionGetter( const std::string &name, IECoreGL::Renderer::MemberData *memberData )
-{
- return new StringData( memberData->options.fontSearchPath );
-}
-
-static void shaderSearchPathOptionSetter( const std::string &name, IECore::ConstDataPtr value, IECoreGL::Renderer::MemberData *memberData )
-{
- if( ConstStringDataPtr s = castWithWarning( value, name, "Renderer::setOption" ) )
- {
- memberData->options.shaderSearchPath = s->readable();
- }
-}
-
-static IECore::DataPtr shaderSearchPathOptionGetter( const std::string &name, IECoreGL::Renderer::MemberData *memberData )
-{
- return new StringData( memberData->options.shaderSearchPath );
-}
-
-static void shaderIncludePathOptionSetter( const std::string &name, IECore::ConstDataPtr value, IECoreGL::Renderer::MemberData *memberData )
-{
- if( ConstStringDataPtr s = castWithWarning( value, name, "Renderer::setOption" ) )
- {
- memberData->options.shaderIncludePath = s->readable();
- }
-}
-
-static IECore::DataPtr shaderIncludePathOptionGetter( const std::string &name, IECoreGL::Renderer::MemberData *memberData )
-{
- return new StringData( memberData->options.shaderIncludePath );
-}
-
-static void textureSearchPathOptionSetter( const std::string &name, IECore::ConstDataPtr value, IECoreGL::Renderer::MemberData *memberData )
-{
- if( ConstStringDataPtr s = castWithWarning( value, name, "Renderer::setOption" ) )
- {
- memberData->options.textureSearchPath = s->readable();
- }
-}
-
-static IECore::DataPtr textureSearchPathOptionGetter( const std::string &name, IECoreGL::Renderer::MemberData *memberData )
-{
- return new StringData( memberData->options.textureSearchPath );
-}
-
-static void drawCoordinateSystemsOptionSetter( const std::string &name, IECore::ConstDataPtr value, IECoreGL::Renderer::MemberData *memberData )
-{
- if( ConstBoolDataPtr b = castWithWarning( value, name, "Renderer::setOption" ) )
- {
- memberData->options.drawCoordinateSystems = b->readable();
- }
-}
-
-static IECore::DataPtr drawCoordinateSystemsOptionGetter( const std::string &name, IECoreGL::Renderer::MemberData *memberData )
-{
- return new BoolData( memberData->options.drawCoordinateSystems );
-}
-
-static const OptionSetterMap *optionSetters()
-{
- static OptionSetterMap *o = new OptionSetterMap;
- if( !o->size() )
- {
- (*o)["gl:mode"] = modeOptionSetter;
- (*o)["shutter"] = shutterOptionSetter;
- (*o)["searchPath:font"] = fontSearchPathOptionSetter;
- (*o)["gl:searchPath:shader"] = shaderSearchPathOptionSetter;
- (*o)["searchPath:shader"] = shaderSearchPathOptionSetter;
- (*o)["gl:searchPath:shaderInclude"] = shaderIncludePathOptionSetter;
- (*o)["searchPath:shaderInclude"] = shaderIncludePathOptionSetter;
- (*o)["gl:searchPath:texture"] = textureSearchPathOptionSetter;
- (*o)["searchPath:texture"] = textureSearchPathOptionSetter;
- (*o)["gl:drawCoordinateSystems"] = drawCoordinateSystemsOptionSetter;
- }
- return o;
-}
-
-static const OptionGetterMap *optionGetters()
-{
- static OptionGetterMap *o = new OptionGetterMap;
- if( !o->size() )
- {
- (*o)["gl:mode"] = modeOptionGetter;
- (*o)["shutter"] = shutterOptionGetter;
- (*o)["searchPath:font"] = fontSearchPathOptionGetter;
- (*o)["gl:searchPath:shader"] = shaderSearchPathOptionGetter;
- (*o)["searchPath:shader"] = shaderSearchPathOptionGetter;
- (*o)["gl:searchPath:shaderInclude"] = shaderIncludePathOptionGetter;
- (*o)["searchPath:shaderInclude"] = shaderIncludePathOptionGetter;
- (*o)["gl:searchPath:texture"] = textureSearchPathOptionGetter;
- (*o)["searchPath:texture"] = textureSearchPathOptionGetter;
- (*o)["gl:drawCoordinateSystems"] = drawCoordinateSystemsOptionGetter;
- }
- return o;
-}
-
-void IECoreGL::Renderer::setOption( const std::string &name, IECore::ConstDataPtr value )
-{
- if( m_data->inWorld )
- {
- msg( Msg::Warning, "Renderer::setOption", "Cannot call setOption after worldBegin()." );
- return;
- }
-
- const OptionSetterMap *o = optionSetters();
- OptionSetterMap::const_iterator it = o->find( name );
- if( it!=o->end() )
- {
- it->second( name, value, m_data );
- }
- else if( name.compare( 0, 5, "user:" )==0 )
- {
- m_data->options.user[name] = value->copy();
- }
- else if( name.compare( 0, 3, "gl:" )==0 || name.find( ':' )==string::npos )
- {
- msg( Msg::Warning, "Renderer::setOption", boost::format( "Unsuppported option \"%s\"." ) % name );
- return;
- }
-}
-
-IECore::ConstDataPtr IECoreGL::Renderer::getOption( const std::string &name ) const
-{
- const OptionGetterMap *o = optionGetters();
- OptionGetterMap::const_iterator it = o->find( name );
- if( it!=o->end() )
- {
- return it->second( name, m_data );
- }
- else if( name.compare( 0, 5, "user:" )==0 )
- {
- IECore::CompoundDataMap::const_iterator optionIt = m_data->options.user.find( name );
- if( optionIt!=m_data->options.user.end() )
- {
- return optionIt->second;
- }
- else
- {
- return nullptr;
- }
- }
- else if( name.compare( 0, 3, "gl:" )==0 || name.find( ':' )==string::npos )
- {
- msg( Msg::Warning, "Renderer::getOption", boost::format( "Unsuppported option \"%s\"." ) % name );
- return nullptr;
- }
-
- return nullptr;
-}
-
-
-void IECoreGL::Renderer::camera( const std::string &unusedName, const IECore::CompoundDataMap ¶meters )
-{
- if( m_data->inWorld )
- {
- msg( Msg::Warning, "IECoreGL::Renderer::camera", "Cameras can not be specified after worldBegin." );
- return;
- }
- if ( m_data->currentInstance )
- {
- msg( Msg::Warning, "IECoreGL::Renderer::camera", "Cameras can not be specified during instance definition." );
- return;
- }
-
- try
- {
- IECoreScene::CameraPtr coreCamera = new IECoreScene::Camera( new CompoundData( parameters ) );
-
- IECoreGL::CameraPtr camera = IECore::runTimeCast( ToGLCameraConverter( coreCamera ).convert() );
-
- // TODO delete this
- // Cortex cameras are now driven by physical parameters, not a screenWindow
- // But for compatibility with the deprecated GL stuff, if someone tries to override the computed
- // frustum, then stomp that straight onto the GL camera
- /*auto screenWindowParm = parameters.find( "screenWindow" );
- if( screenWindowParm != parameters.end() )
- {
- Box2fData *screenWindowData = runTimeCast< Box2fData >( screenWindowParm->second.get() );
- if( screenWindowData )
- {
- camera->setNormalizedScreenWindow( screenWindowData->readable() );
- }
- }*/
-
- // we have to store these till worldBegin, as only then are we sure what sort of renderer backend we have
- if( camera )
- {
- camera->setTransform( m_data->transformStack.top() );
- m_data->options.cameras.push_back( camera );
- }
- }
- catch( const std::exception &e )
- {
- msg( Msg::Error, "IECoreGL::Renderer::camera", e.what() );
- return;
- }
-}
-
-
-void IECoreGL::Renderer::display( const std::string &name, const std::string &type, const std::string &data, const IECore::CompoundDataMap ¶meters )
-{
- // we store displays till worldbegin, as until that point we don't have a renderer implementation to pass
- // them to
- if( m_data->inWorld )
- {
- msg( Msg::Warning, "IECoreGL::Renderer::display", "Displays can not be specified after worldBegin." );
- return;
- }
- if ( m_data->currentInstance )
- {
- msg( Msg::Warning, "IECoreGL::Renderer::display", "Displays can not be specified during instance definition." );
- return;
- }
- m_data->options.displays.push_back( new Display( name, type, data, parameters ) );
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////////
-// world begin/end
-/////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-void IECoreGL::Renderer::worldBegin()
-{
- if( m_data->inWorld )
- {
- msg( Msg::Warning, "Renderer::worldBegin", "Cannot call worldBegin() again before worldEnd()." );
- return;
- }
- if ( m_data->currentInstance )
- {
- msg( Msg::Warning, "IECoreGL::Renderer::worldBegin", "worldBegin can not be called during instance definition." );
- return;
- }
-
- m_data->inWorld = true;
-
- if( m_data->options.mode==MemberData::Deferred )
- {
- m_data->implementation = new DeferredRendererImplementation;
- }
- else
- {
- m_data->implementation = new ImmediateRendererImplementation;
- }
-
- if( m_data->options.shaderSearchPath==m_data->options.shaderSearchPathDefault && m_data->options.shaderIncludePath==m_data->options.shaderIncludePathDefault )
- {
- // use the shared default cache if we can
- m_data->shaderLoader = ShaderLoader::defaultShaderLoader();
- }
- else
- {
- IECore::SearchPath includePaths( m_data->options.shaderIncludePath );
- m_data->shaderLoader = new ShaderLoader( IECore::SearchPath( m_data->options.shaderSearchPath ), &includePaths );
- }
-
- if( m_data->options.textureSearchPath==m_data->options.textureSearchPathDefault )
- {
- // use the shared default cache if we can
- m_data->textureLoader = TextureLoader::defaultTextureLoader();
- }
- else
- {
- m_data->textureLoader = new TextureLoader( IECore::SearchPath( m_data->options.textureSearchPath ) );
- }
-
-#ifdef IECORE_WITH_FREETYPE
- if( m_data->options.fontSearchPath==m_data->options.fontSearchPathDefault )
- {
- // use the shared default cache if we can
- m_data->fontLoader = FontLoader::defaultFontLoader();
- }
- else
- {
- m_data->fontLoader = new FontLoader( IECore::SearchPath( m_data->options.fontSearchPath ) );
- }
-#endif // IECORE_WITH_FREETYPE
-
- if( m_data->options.cameras.size() )
- {
- for( unsigned int i=0; ioptions.cameras.size(); i++ )
- {
- m_data->implementation->addCamera( m_data->options.cameras[i] );
- }
- }
- else
- {
- // specify the default camera
- IECoreScene::ConstCameraPtr defaultCamera = new IECoreScene::Camera();
- IECoreGL::CameraPtr camera = IECore::runTimeCast( ToGLCameraConverter( defaultCamera ).convert() );
- m_data->implementation->addCamera( camera );
- }
-
- for( unsigned int i=0; ioptions.displays.size(); i++ )
- {
- m_data->implementation->addDisplay( m_data->options.displays[i] );
- }
- m_data->implementation->worldBegin();
-
- ShaderStateComponentPtr defaultShaderState = new ShaderStateComponent( m_data->shaderLoader, m_data->textureLoader, "", "", "", new CompoundObject );
- m_data->implementation->addState( defaultShaderState );
-}
-
-void IECoreGL::Renderer::worldEnd()
-{
- if( !m_data->inWorld )
- {
- msg( Msg::Warning, "Renderer::worldEnd", "Cannot call worldEnd() before worldBegin()." );
- return;
- }
- if ( m_data->currentInstance )
- {
- msg( Msg::Warning, "IECoreGL::Renderer::worldEnd", "worldEnd can not be called during instance definition." );
- return;
- }
- m_data->implementation->worldEnd();
- m_data->inWorld = false;
- m_data->cachedConverter->clearUnused();
-}
-
-ScenePtr IECoreGL::Renderer::scene()
-{
- DeferredRendererImplementationPtr r = runTimeCast( m_data->implementation );
- if( r )
- {
- return r->scene();
- }
- return nullptr;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////////
-// transforms
-/////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-void IECoreGL::Renderer::transformBegin()
-{
- if( m_data->inWorld )
- {
- m_data->implementation->transformBegin();
- }
- else
- {
- m_data->transformStack.push( m_data->transformStack.top() );
- }
-}
-
-void IECoreGL::Renderer::transformEnd()
-{
- if( m_data->inWorld )
- {
- bool wasRight = ( determinant( m_data->implementation->getTransform() ) >= 0 );
- m_data->implementation->transformEnd();
- bool isRight = ( determinant( m_data->implementation->getTransform() ) >= 0 );
-
- if ( wasRight != isRight )
- {
- bool l = m_data->implementation->getState()->value();
- m_data->implementation->addState( new RightHandedOrientationStateComponent( !l ) );
- }
- }
- else
- {
- if( m_data->transformStack.size() )
- {
- m_data->transformStack.pop();
- }
- else
- {
- msg( Msg::Error, "IECoreGL::Renderer::transformEnd", "Bad nesting detected." );
- }
- }
-}
-
-void IECoreGL::Renderer::setTransform( const Imath::M44f &m )
-{
- if( m_data->inWorld )
- {
- m_data->implementation->setTransform( m );
-
- if( determinant( m ) < 0.0f )
- {
- bool l = m_data->implementation->getState()->value();
- m_data->implementation->addState( new RightHandedOrientationStateComponent( !l ) );
- }
- }
- else
- {
- m_data->transformStack.top() = m;
- }
-}
-
-void IECoreGL::Renderer::setTransform( const std::string &coordinateSystem )
-{
- msg( Msg::Warning, "Renderer::setTransform", "Not implemented" );
-}
-
-Imath::M44f IECoreGL::Renderer::getTransform() const
-{
- if( m_data->inWorld )
- {
- return m_data->implementation->getTransform();
- }
- else
- {
- return m_data->transformStack.top();
- }
-}
-
-Imath::M44f IECoreGL::Renderer::getTransform( const std::string &coordinateSystem ) const
-{
- msg( Msg::Warning, "Renderer::getTransform", "Not implemented" );
- return M44f();
-}
-
-void IECoreGL::Renderer::concatTransform( const Imath::M44f &m )
-{
- if( m_data->inWorld )
- {
- m_data->implementation->concatTransform( m );
- if( determinant( m ) < 0.0f )
- {
- bool l = m_data->implementation->getState()->value();
- m_data->implementation->addState( new RightHandedOrientationStateComponent( !l ) );
- }
- }
- else
- {
- m_data->transformStack.top() = m * m_data->transformStack.top();
- }
-}
-
-void IECoreGL::Renderer::coordinateSystem( const std::string &name )
-{
- if( m_data->options.drawCoordinateSystems )
- {
- IntVectorDataPtr numVerticesData = new IntVectorData;
- std::vector &numVertices = numVerticesData->writable();
- numVertices.push_back( 2 );
- numVertices.push_back( 2 );
- numVertices.push_back( 2 );
-
- V3fVectorDataPtr pointsData = new V3fVectorData();
- std::vector &points = pointsData->writable();
- points.push_back( V3f( 0 ) );
- points.push_back( V3f( 1, 0, 0 ) );
- points.push_back( V3f( 0 ) );
- points.push_back( V3f( 0, 1, 0 ) );
- points.push_back( V3f( 0 ) );
- points.push_back( V3f( 0, 0, 1 ) );
-
- PrimitiveVariableMap primVars;
- primVars["P"] = PrimitiveVariable( PrimitiveVariable::Vertex, pointsData );
-
- attributeBegin();
- setAttribute( "name", new StringData( "coordinateSystem:" + name ) );
- setAttribute( "gl:curvesPrimitive:useGLLines", new BoolData( true ) );
- setAttribute( "gl:curvesPrimitive:glLineWidth", new FloatData( 2 ) );
- curves( CubicBasisf::linear(), false, numVerticesData, primVars );
- attributeEnd();
- }
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////////
-// attribute state
-/////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-typedef void (*AttributeSetter)( const std::string &name, IECore::ConstDataPtr value, IECoreGL::Renderer::MemberData *memberData );
-typedef std::map AttributeSetterMap;
-typedef IECore::ConstDataPtr (*AttributeGetter)( const std::string &name, const IECoreGL::Renderer::MemberData *memberData );
-typedef std::map AttributeGetterMap;
-
-template
-static void typedAttributeSetter( const std::string &name, IECore::ConstDataPtr value, IECoreGL::Renderer::MemberData *memberData )
-{
- typedef IECore::TypedData DataType;
- typename DataType::ConstPtr d = runTimeCast( value );
- if( !d )
- {
- msg( Msg::Warning, "Renderer::setAttribute", boost::format( "Expected data of type \"%s\" for attribute \"%s\"." ) % DataType::staticTypeName() % name );
- return;
- }
- memberData->implementation->addState( new T( d->readable() ) );
-}
-
-template
-static IECore::ConstDataPtr typedAttributeGetter( const std::string &name, const IECoreGL::Renderer::MemberData *memberData )
-{
- typedef IECore::TypedData DataType;
- const T *a = memberData->implementation->template getState();
- return new DataType( a->value() );
-}
-
-static void colorAttributeSetter( const std::string &name, IECore::ConstDataPtr value, IECoreGL::Renderer::MemberData *memberData )
-{
- ConstColor3fDataPtr d = castWithWarning( value, name, "Renderer::setAttribute" );
- if( d )
- {
- Color::ConstPtr c = memberData->implementation->getState();
- Color4f cc = c->value();
- cc[0] = d->readable()[0];
- cc[1] = d->readable()[1];
- cc[2] = d->readable()[2];
- memberData->implementation->addState( new Color( cc ) );
- }
-}
-
-static IECore::ConstDataPtr colorAttributeGetter( const std::string &name, const IECoreGL::Renderer::MemberData *memberData )
-{
- const IECoreGL::Color *a = memberData->implementation->getState();
- Color4f c = a->value();
- return new Color3fData( Color3f( c[0], c[1], c[2] ) );
-}
-
-static IECore::ConstDataPtr opacityAttributeGetter( const std::string &name, const IECoreGL::Renderer::MemberData *memberData )
-{
- const IECoreGL::Color *a = memberData->implementation->getState();
- Color4f c = a->value();
- return new Color3fData( Color3f( c[3] ) );
-}
-
-static void opacityAttributeSetter( const std::string &name, IECore::ConstDataPtr value, IECoreGL::Renderer::MemberData *memberData )
-{
- ConstColor3fDataPtr d = castWithWarning( value, name, "Renderer::setAttribute" );
- if( d )
- {
- const Color *c = memberData->implementation->getState();
- Color4f cc = c->value();
- cc[3] = (d->readable()[0] + d->readable()[1] + d->readable()[2]) / 3.0f;
- memberData->implementation->addState( new Color( cc ) );
- }
-}
-
-static IECore::ConstDataPtr blendFactorGetter( const std::string &name, const IECoreGL::Renderer::MemberData *memberData )
-{
- const BlendFuncStateComponent *b = memberData->implementation->getState();
- GLenum f = name=="gl:blend:srcFactor" ? b->value().src : b->value().dst;
- switch( f )
- {
- case GL_ZERO :
- return new StringData( "zero" );
- case GL_ONE :
- return new StringData( "one" );
- case GL_SRC_COLOR :
- return new StringData( "srcColor" );
- case GL_ONE_MINUS_SRC_COLOR :
- return new StringData( "oneMinusSrcColor" );
- case GL_DST_COLOR :
- return new StringData( "dstColor" );
- case GL_ONE_MINUS_DST_COLOR :
- return new StringData( "oneMinusDstColor" );
- case GL_SRC_ALPHA :
- return new StringData( "srcAlpha" );
- case GL_ONE_MINUS_SRC_ALPHA :
- return new StringData( "oneMinusSrcAlpha" );
- case GL_DST_ALPHA :
- return new StringData( "dstAlpha" );
- case GL_ONE_MINUS_DST_ALPHA :
- return new StringData( "oneMinusDstAlpha" );
- case GL_CONSTANT_COLOR :
- return new StringData( "constantColor" );
- case GL_ONE_MINUS_CONSTANT_COLOR :
- return new StringData( "oneMinusConstantColor" );
- case GL_CONSTANT_ALPHA :
- return new StringData( "constantAlpha" );
- case GL_ONE_MINUS_CONSTANT_ALPHA :
- return new StringData( "oneMinusConstantAlpha" );
- default :
- msg( Msg::Warning, "Renderer::getAttribute", boost::format( "Invalid state for \"%s\"." ) % name );
- return new StringData( "invalid" );
- }
-}
-
-static void blendFactorSetter( const std::string &name, IECore::ConstDataPtr value, IECoreGL::Renderer::MemberData *memberData )
-{
- ConstStringDataPtr d = castWithWarning( value, name, "Renderer::setAttribute" );
- if( !d )
- {
- return;
- }
-
- GLenum f;
- const std::string &v = d->readable();
- if( v=="zero" )
- {
- f = GL_ZERO;
- }
- else if( v=="one" )
- {
- f = GL_ONE;
- }
- else if( v=="srcColor" )
- {
- f = GL_SRC_COLOR;
- }
- else if( v=="oneMinusSrcColor" )
- {
- f = GL_ONE_MINUS_SRC_COLOR;
- }
- else if( v=="dstColor" )
- {
- f = GL_DST_COLOR;
- }
- else if( v=="oneMinusDstColor" )
- {
- f = GL_ONE_MINUS_DST_COLOR;
- }
- else if( v=="srcAlpha" )
- {
- f = GL_SRC_ALPHA;
- }
- else if( v=="oneMinusSrcAlpha" )
- {
- f = GL_ONE_MINUS_SRC_ALPHA;
- }
- else if( v=="dstAlpha" )
- {
- f = GL_DST_ALPHA;
- }
- else if( v=="oneMinusDstAlpha" )
- {
- f = GL_ONE_MINUS_DST_ALPHA;
- }
- else if( v=="constantColor" )
- {
- f = GL_CONSTANT_COLOR;
- }
- else if( v=="oneMinusConstantColor" )
- {
- f = GL_ONE_MINUS_CONSTANT_COLOR;
- }
- else if( v=="constantAlpha" )
- {
- f = GL_CONSTANT_ALPHA;
- }
- else if( v=="oneMinusConstantAlpha" )
- {
- f = GL_ONE_MINUS_CONSTANT_ALPHA;
- }
- else
- {
- msg( Msg::Error, "Renderer::setAttribute", boost::format( "Unsupported value \"%s\" for attribute \"%s\"." ) % v % name );
- return;
- }
- const BlendFuncStateComponent *b = memberData->implementation->getState();
- BlendFactors bf = b->value();
- if( name=="gl:blend:srcFactor" )
- {
- bf.src = f;
- }
- else
- {
- bf.dst = f;
- }
- memberData->implementation->addState( new BlendFuncStateComponent( bf ) );
-}
-
-static void alphaFuncSetter( const std::string &name, IECore::ConstDataPtr value, IECoreGL::Renderer::MemberData *memberData )
-{
-
- const AlphaFuncStateComponent *a = memberData->implementation->getState();
- AlphaFunc af = a->value();
-
- if( name == "gl:alphaTest:mode" )
- {
- ConstStringDataPtr d = castWithWarning( value, name, "Renderer::setAttribute" );
- if( !d )
- {
- return;
- }
-
- GLenum m;
- const std::string &v = d->readable();
- if( v=="never" )
- {
- m = GL_NEVER;
- }
- else if( v=="less" )
- {
- m = GL_LESS;
- }
- else if( v=="equal" )
- {
- m = GL_EQUAL;
- }
- else if( v=="lequal" )
- {
- m = GL_LEQUAL;
- }
- else if( v=="greater" )
- {
- m = GL_GREATER;
- }
- else if( v=="notequal" )
- {
- m = GL_NOTEQUAL;
- }
- else if( v=="gequal" )
- {
- m = GL_GEQUAL;
- }
- else if( v=="always" )
- {
- m = GL_ALWAYS;
- }
- else
- {
- msg( Msg::Error, "Renderer::setAttribute", boost::format( "Unsupported value \"%s\" for attribute \"%s\"." ) % v % name );
- return;
- }
- af.mode = m;
- }
- else if( name == "gl:alphaTest:value" )
- {
- ConstFloatDataPtr d = castWithWarning( value, name, "Renderer::setAttribute" );
- if( !d )
- {
- return;
- }
- af.value = d->readable();
- }
- else
- {
- return;
- }
-
- memberData->implementation->addState( new AlphaFuncStateComponent( af ) );
-}
-
-static IECore::ConstDataPtr alphaFuncGetter( const std::string &name, const IECoreGL::Renderer::MemberData *memberData )
-{
- const AlphaFuncStateComponent *b = memberData->implementation->getState();
-
- if( name == "gl:alphaTest:mode" )
- {
- GLenum m = b->value().mode;
- switch( m )
- {
- case GL_NEVER:
- return new StringData( "never" );
- case GL_LESS:
- return new StringData( "less" );
- case GL_EQUAL:
- return new StringData( "equal" );
- case GL_LEQUAL:
- return new StringData( "lequal" );
- case GL_GREATER:
- return new StringData( "greater" );
- case GL_NOTEQUAL:
- return new StringData( "notequal" );
- case GL_GEQUAL:
- return new StringData( "gequal" );
- case GL_ALWAYS:
- return new StringData( "always" );
- default :
- msg( Msg::Warning, "Renderer::getAttribute", boost::format( "Invalid state for \"%s\"." ) % name );
- return new StringData( "invalid" );
- }
- }
- else if( name == "gl:alphaTest:value" )
- {
- return new FloatData( b->value().value );
- }
-
- msg( Msg::Warning, "Renderer::getAttribute", boost::format( "Invalid state for \"%s\"." ) % name );
- return nullptr;
-}
-
-static IECore::ConstDataPtr blendEquationGetter( const std::string &name, const IECoreGL::Renderer::MemberData *memberData )
-{
- const BlendEquationStateComponent *b = memberData->implementation->getState();
- switch( b->value() )
- {
- case GL_FUNC_ADD :
- return new StringData( "add" );
- case GL_FUNC_SUBTRACT :
- return new StringData( "subtract" );
- case GL_FUNC_REVERSE_SUBTRACT :
- return new StringData( "reverseSubtract" );
- case GL_MIN :
- return new StringData( "min" );
- case GL_MAX :
- return new StringData( "max" );
- default :
- msg( Msg::Warning, "Renderer::getAttribute", boost::format( "Invalid state for \"%s\"." ) % name );
- return new StringData( "invalid" );
- }
-}
-
-static void blendEquationSetter( const std::string &name, IECore::ConstDataPtr value, IECoreGL::Renderer::MemberData *memberData )
-{
- ConstStringDataPtr d = castWithWarning( value, name, "Renderer::setAttribute" );
- if( !d )
- {
- return;
- }
-
- GLenum f;
- const std::string &v = d->readable();
- if( v=="add" )
- {
- f = GL_FUNC_ADD;
- }
- else if( v=="subtract" )
- {
- f = GL_FUNC_SUBTRACT;
- }
- else if( v=="reverseSubtract" )
- {
- f = GL_FUNC_REVERSE_SUBTRACT;
- }
- else if( v=="min" )
- {
- f = GL_MIN;
- }
- else if( v=="max" )
- {
- f = GL_MAX;
- }
- else
- {
- msg( Msg::Error, "Renderer::setAttribute", boost::format( "Unsupported value \"%s\" for attribute \"%s\"." ) % v % name );
- return;
- }
-
- memberData->implementation->addState( new BlendEquationStateComponent( f ) );
-}
-
-static IECore::ConstDataPtr pointsPrimitiveUseGLPointsGetter( const std::string &name, const IECoreGL::Renderer::MemberData *memberData )
-{
- const IECoreGL::PointsPrimitive::UseGLPoints *b = memberData->implementation->getState();
- switch( b->value() )
- {
- case ForPointsOnly :
- return new StringData( "forGLPoints" );
- case ForPointsAndDisks :
- return new StringData( "forParticlesAndDisks" );
- case ForAll :
- return new StringData( "forAll" );
- default :
- msg( Msg::Warning, "Renderer::getAttribute", boost::format( "Invalid state for \"%s\"." ) % name );
- return new StringData( "invalid" );
- }
-
-}
-
-static void pointsPrimitiveUseGLPointsSetter( const std::string &name, IECore::ConstDataPtr value, IECoreGL::Renderer::MemberData *memberData )
-{
- ConstStringDataPtr d = castWithWarning( value, name, "Renderer::setAttribute" );
- if( !d )
- {
- return;
- }
- GLPointsUsage u;
- const std::string &v = d->readable();
- if( v=="forGLPoints" )
- {
- u = ForPointsOnly;
- }
- else if( v=="forParticlesAndDisks" )
- {
- u = ForPointsAndDisks;
- }
- else if( v=="forAll" )
- {
- u = ForAll;
- }
- else
- {
- msg( Msg::Error, "Renderer::setAttribute", boost::format( "Unsupported value \"%s\" for attribute \"%s\"." ) % v % name );
- return;
- }
- memberData->implementation->addState( new IECoreGL::PointsPrimitive::UseGLPoints( u ) );
-}
-
-static IECore::ConstDataPtr nameGetter( const std::string &name, const IECoreGL::Renderer::MemberData *memberData )
-{
- const NameStateComponent *n = memberData->implementation->getState();
- return new StringData( n->name() );
-}
-
-static void nameSetter( const std::string &name, IECore::ConstDataPtr value, IECoreGL::Renderer::MemberData *memberData )
-{
- ConstStringDataPtr d = castWithWarning( value, name, "Renderer::setAttribute" );
- if( !d )
- {
- return;
- }
- memberData->implementation->addState( new NameStateComponent( d->readable() ) );
-}
-
-static IECore::ConstDataPtr textPrimitiveTypeGetter( const std::string &name, const IECoreGL::Renderer::MemberData *memberData )
-{
-
-#ifdef IECORE_WITH_FREETYPE
-
- const TextPrimitive::Type *b = memberData->implementation->getState();
- switch( b->value() )
- {
- case TextPrimitive::Mesh :
- return new StringData( "mesh" );
- case TextPrimitive::Sprite :
- return new StringData( "sprite" );
- default :
- msg( Msg::Warning, "Renderer::getAttribute", boost::format( "Invalid state for \"%s\"." ) % name );
- return new StringData( "invalid" );
- }
-
-#else
-
- IECore::msg( IECore::Msg::Warning, "Renderer::getAttribute", "IECore was not built with FreeType support." );
- return 0;
-
-#endif // IECORE_WITH_FREETYPE
-
-}
-
-static void textPrimitiveTypeSetter( const std::string &name, IECore::ConstDataPtr value, IECoreGL::Renderer::MemberData *memberData )
-{
-
-#ifdef IECORE_WITH_FREETYPE
-
- ConstStringDataPtr d = castWithWarning( value, name, "Renderer::setAttribute" );
- if( !d )
- {
- return;
- }
- TextPrimitive::RenderType t;
- const std::string &v = d->readable();
- if( v=="mesh" )
- {
- t = TextPrimitive::Mesh;
- }
- else if( v=="sprite" )
- {
- t = TextPrimitive::Sprite;
- }
- else
- {
- msg( Msg::Error, "Renderer::setAttribute", boost::format( "Unsupported value \"%s\" for attribute \"%s\"." ) % v % name );
- return;
- }
- memberData->implementation->addState( new TextPrimitive::Type( t ) );
-
-#else
-
- IECore::msg( IECore::Msg::Warning, "Renderer::setAttribute", "IECore was not built with FreeType support." );
-
-#endif // IECORE_WITH_FREETYPE
-
-}
-
-template
-static IECore::ConstDataPtr rendererSpaceGetter( const std::string &name, const IECoreGL::Renderer::MemberData *memberData )
-{
- typename T::ConstPtr b = memberData->implementation->getState< T >();
- switch( b->value() )
- {
- case ObjectSpace :
- return new StringData( "object" );
- case WorldSpace :
- return new StringData( "world" );
- default :
- msg( Msg::Warning, "Renderer::getAttribute", boost::format( "Invalid state for \"%s\"." ) % name );
- return new StringData( "invalid" );
- }
-}
-
-template
-static void rendererSpaceSetter( const std::string &name, IECore::ConstDataPtr value, IECoreGL::Renderer::MemberData *memberData )
-{
- ConstStringDataPtr d = castWithWarning( value, name, "Renderer::setAttribute" );
- if( !d )
- {
- return;
- }
- RendererSpace s;
- const std::string &v = d->readable();
- if( v=="object" )
- {
- s = ObjectSpace;
- }
- else if ( v == "world" )
- {
- s = WorldSpace;
- }
- else
- {
- msg( Msg::Error, "Renderer::setAttribute", boost::format( "Unsupported value \"%s\" for attribute \"%s\"." ) % v % name );
- return;
- }
- memberData->implementation->addState( new T( s ) );
-}
-
-static const AttributeSetterMap *attributeSetters()
-{
- static AttributeSetterMap *a = new AttributeSetterMap;
- if( !a->size() )
- {
- (*a)["gl:primitive:wireframe"] = typedAttributeSetter;
- (*a)["gl:primitive:wireframeWidth"] = typedAttributeSetter;
- (*a)["gl:primitive:bound"] = typedAttributeSetter;
- (*a)["gl:primitive:solid"] = typedAttributeSetter;
- (*a)["gl:primitive:outline"] = typedAttributeSetter;
- (*a)["gl:primitive:outlineWidth"] = typedAttributeSetter;
- (*a)["gl:primitive:points"] = typedAttributeSetter;
- (*a)["gl:primitive:pointWidth"] = typedAttributeSetter;
- (*a)["gl:primitive:sortForTransparency"] = typedAttributeSetter;
- (*a)["gl:primitive:wireframeColor"] = typedAttributeSetter;
- (*a)["gl:primitive:boundColor"] = typedAttributeSetter;
- (*a)["gl:primitive:outlineColor"] = typedAttributeSetter;
- (*a)["gl:primitive:pointColor"] = typedAttributeSetter;
- (*a)["gl:primitive:selectable"] = typedAttributeSetter;
- (*a)["gl:color"] = typedAttributeSetter;
- (*a)["color"] = colorAttributeSetter;
- (*a)["opacity"] = opacityAttributeSetter;
- (*a)["gl:blend:color"] = typedAttributeSetter;
- (*a)["gl:blend:srcFactor"] = blendFactorSetter;
- (*a)["gl:blend:dstFactor"] = blendFactorSetter;
- (*a)["gl:blend:equation"] = blendEquationSetter;
- (*a)["gl:shade:transparent"] = typedAttributeSetter;
- (*a)["gl:pointsPrimitive:useGLPoints"] = pointsPrimitiveUseGLPointsSetter;
- (*a)["gl:pointsPrimitive:glPointWidth"] = typedAttributeSetter;
- (*a)["name"] = nameSetter;
- (*a)["doubleSided"] = typedAttributeSetter;
- (*a)["rightHandedOrientation"] = typedAttributeSetter;
- (*a)["gl:curvesPrimitive:useGLLines"] = typedAttributeSetter;
- (*a)["gl:curvesPrimitive:glLineWidth"] = typedAttributeSetter;
- (*a)["gl:curvesPrimitive:ignoreBasis"] = typedAttributeSetter;
- (*a)["gl:smoothing:points"] = typedAttributeSetter;
- (*a)["gl:smoothing:lines"] = typedAttributeSetter;
- (*a)["gl:smoothing:polygons"] = typedAttributeSetter;
- (*a)["gl:textPrimitive:type"] = textPrimitiveTypeSetter;
- (*a)["gl:cullingSpace"] = rendererSpaceSetter;
- (*a)["gl:cullingBox"] = typedAttributeSetter;
- (*a)["gl:procedural:reentrant"] = typedAttributeSetter;
- (*a)["gl:visibility:camera"] = typedAttributeSetter;
- (*a)["gl:depthTest"] = typedAttributeSetter;
- (*a)["gl:depthMask"] = typedAttributeSetter;
- (*a)["gl:alphaTest"] = typedAttributeSetter;
- (*a)["gl:alphaTest:mode"] = alphaFuncSetter;
- (*a)["gl:alphaTest:value"] = alphaFuncSetter;
- (*a)["automaticInstancing"] = typedAttributeSetter;
- (*a)["gl:automaticInstancing"] = typedAttributeSetter;
- }
- return a;
-}
-
-static const AttributeGetterMap *attributeGetters()
-{
- static AttributeGetterMap *a = new AttributeGetterMap;
- if( !a->size() )
- {
- (*a)["gl:primitive:wireframe"] = typedAttributeGetter;
- (*a)["gl:primitive:wireframeWidth"] = typedAttributeGetter;
- (*a)["gl:primitive:bound"] = typedAttributeGetter;
- (*a)["gl:primitive:solid"] = typedAttributeGetter;
- (*a)["gl:primitive:outline"] = typedAttributeGetter;
- (*a)["gl:primitive:outlineWidth"] = typedAttributeGetter;
- (*a)["gl:primitive:points"] = typedAttributeGetter;
- (*a)["gl:primitive:pointWidth"] = typedAttributeGetter;
- (*a)["gl:primitive:sortForTransparency"] = typedAttributeGetter;
- (*a)["gl:primitive:wireframeColor"] = typedAttributeGetter;
- (*a)["gl:primitive:boundColor"] = typedAttributeGetter;
- (*a)["gl:primitive:outlineColor"] = typedAttributeGetter;
- (*a)["gl:primitive:pointColor"] = typedAttributeGetter;
- (*a)["gl:primitive:selectable"] = typedAttributeGetter;
- (*a)["gl:color"] = typedAttributeGetter;
- (*a)["color"] = colorAttributeGetter;
- (*a)["opacity"] = opacityAttributeGetter;
- (*a)["gl:blend:color"] = typedAttributeGetter;
- (*a)["gl:blend:srcFactor"] = blendFactorGetter;
- (*a)["gl:blend:dstFactor"] = blendFactorGetter;
- (*a)["gl:blend:equation"] = blendEquationGetter;
- (*a)["gl:shade:transparent"] = typedAttributeGetter;
- (*a)["gl:pointsPrimitive:useGLPoints"] = pointsPrimitiveUseGLPointsGetter;
- (*a)["gl:pointsPrimitive:glPointWidth"] = typedAttributeGetter;
- (*a)["name"] = nameGetter;
- (*a)["doubleSided"] = typedAttributeGetter;
- (*a)["rightHandedOrientation"] = typedAttributeGetter;
- (*a)["gl:curvesPrimitive:useGLLines"] = typedAttributeGetter;
- (*a)["gl:curvesPrimitive:glLineWidth"] = typedAttributeGetter;
- (*a)["gl:curvesPrimitive:ignoreBasis"] = typedAttributeGetter;
- (*a)["gl:smoothing:points"] = typedAttributeGetter;
- (*a)["gl:smoothing:lines"] = typedAttributeGetter;
- (*a)["gl:smoothing:polygons"] = typedAttributeGetter;
- (*a)["gl:textPrimitive:type"] = textPrimitiveTypeGetter;
- (*a)["gl:cullingSpace"] = rendererSpaceGetter;
- (*a)["gl:cullingBox"] = typedAttributeGetter;
- (*a)["gl:procedural:reentrant"] = typedAttributeGetter;
- (*a)["gl:visibility:camera"] = typedAttributeGetter;
- (*a)["gl:depthTest"] = typedAttributeGetter;
- (*a)["gl:depthMask"] = typedAttributeGetter;
- (*a)["gl:alphaTest"] = typedAttributeGetter;
- (*a)["gl:alphaTest:mode"] = alphaFuncGetter;
- (*a)["gl:alphaTest:value"] = alphaFuncGetter;
- (*a)["automaticInstancing"] = typedAttributeGetter;
- (*a)["gl:automaticInstancing"] = typedAttributeGetter;
- }
- return a;
-}
-
-void IECoreGL::Renderer::attributeBegin()
-{
- if ( !m_data->inWorld )
- {
- msg( Msg::Warning, "Renderer::attributeBegin", "Unsupported attributeBegin outside world begin/end blocks." );
- return;
- }
- m_data->implementation->attributeBegin();
-}
-
-void IECoreGL::Renderer::attributeEnd()
-{
- if ( !m_data->inWorld )
- {
- msg( Msg::Warning, "Renderer::attributeBegin", "Unsupported attributeBegin outside world begin/end blocks." );
- return;
- }
- m_data->implementation->attributeEnd();
-}
-
-void IECoreGL::Renderer::setAttribute( const std::string &name, IECore::ConstDataPtr value )
-{
- if ( !m_data->inWorld )
- {
- msg( Msg::Warning, "Renderer::setAttribute", "Unsupported setAttribute outside world begin/end blocks." );
- return;
- }
- const AttributeSetterMap *s = attributeSetters();
- AttributeSetterMap::const_iterator it = s->find( name );
- if( it!=s->end() )
- {
- it->second( name, value, m_data );
- }
- else if( name.compare( 0, 5, "user:" )==0 )
- {
- m_data->implementation->addUserAttribute( name, value->copy() );
- }
- else if( name.find_first_of( ":" )!=string::npos )
- {
- // prefixed for some other renderer, so we can ignore it
- }
- else
- {
- msg( Msg::Warning, "Renderer::setAttribute", boost::format( "Unsupported attribute \"%s\"." ) % name );
- }
-}
-
-IECore::ConstDataPtr IECoreGL::Renderer::getAttribute( const std::string &name ) const
-{
- if ( !m_data->inWorld )
- {
- msg( Msg::Warning, "Renderer::getAttribute", "Unsupported getAttribute outside world begin/end blocks." );
- return nullptr;
- }
-
- const AttributeGetterMap *g = attributeGetters();
- AttributeGetterMap::const_iterator it = g->find( name );
- if( it!=g->end() )
- {
- return it->second( name, m_data );
- }
- else if( name.compare( 0, 5, "user:" )==0 )
- {
- return m_data->implementation->getUserAttribute( name );
- }
- else if( name.find_first_of( ":" )!=string::npos )
- {
- // prefixed for some other renderer, so we can ignore it
- return nullptr;
- }
- else
- {
- msg( Msg::Warning, "Renderer::getAttribute", boost::format( "Unsupported attribute \"%s\"." ) % name );
- }
- return nullptr;
-}
-
-void IECoreGL::Renderer::shader( const std::string &type, const std::string &name, const IECore::CompoundDataMap ¶meters )
-{
- if ( !m_data->inWorld )
- {
- msg( Msg::Warning, "Renderer::shader", "Unsupported shader call outside world begin/end blocks." );
- return;
- }
-
- if( type=="surface" || type=="gl:surface" )
- {
- string vertexSource = parameterValue( "gl:vertexSource", parameters, "" );
- string geometrySource = parameterValue( "gl:geometrySource", parameters, "" );
- string fragmentSource = parameterValue( "gl:fragmentSource", parameters, "" );
-
- if( vertexSource == "" && geometrySource == "" && fragmentSource == "" )
- {
- m_data->shaderLoader->loadSource( name, vertexSource, geometrySource, fragmentSource );
- }
-
- CompoundObjectPtr parametersData = new CompoundObject;
- for( CompoundDataMap::const_iterator it=parameters.begin(); it!=parameters.end(); it++ )
- {
- if( it->first!="gl:fragmentSource" && it->first!="gl:geometrySource" && it->first!="gl:vertexSource" )
- {
- parametersData->members()[it->first] = it->second;
- }
- }
-
- ShaderStateComponentPtr shaderState = new ShaderStateComponent( m_data->shaderLoader, m_data->textureLoader, vertexSource, geometrySource, fragmentSource, parametersData );
- m_data->implementation->addState( shaderState );
- }
- else if( type.find( "gl:" ) == 0 || type.find_first_of( ":" ) == string::npos )
- {
- msg( Msg::Warning, "Renderer::shader", boost::format( "Unsupported shader type \"%s\"." ) % type );
- }
-}
-
-void IECoreGL::Renderer::light( const std::string &name, const std::string &handle, const IECore::CompoundDataMap ¶meters )
-{
- msg( Msg::Warning, "Renderer::light", "Not implemented" );
-}
-
-void IECoreGL::Renderer::illuminate( const std::string &lightHandle, bool on )
-{
- msg( Msg::Warning, "Renderer::illuminate", "Not implemented" );
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////////
-// motion
-/////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-void IECoreGL::Renderer::motionBegin( const std::set × )
-{
- msg( Msg::Warning, "Renderer::motionBegin", "Not implemented" );
-}
-
-void IECoreGL::Renderer::motionEnd()
-{
- msg( Msg::Warning, "Renderer::motionEnd", "Not implemented" );
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////////
-// primitives
-/////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-static void addPrimVarsToPrimitive( IECoreGL::PrimitivePtr primitive, const IECoreScene::PrimitiveVariableMap &primVars )
-{
- // add primVars to the gl primitive
- for( IECoreScene::PrimitiveVariableMap::const_iterator it=primVars.begin(); it!=primVars.end(); it++ )
- {
- try
- {
- primitive->addPrimitiveVariable( it->first, it->second );
- }
- catch( const std::exception &e )
- {
- IECore::msg( IECore::Msg::Error, "Renderer::addPrimitive", boost::format( "Failed to add primitive variable %s (%s)." ) % it->first % e.what() );
- }
- }
-}
-
-void IECoreGL::Renderer::points( size_t numPoints, const IECoreScene::PrimitiveVariableMap &primVars )
-{
- try
- {
- IECoreScene::PointsPrimitivePtr p = new IECoreScene::PointsPrimitive( numPoints );
- p->variables = primVars;
- m_data->addPrimitive( p.get() );
- }
- catch( const std::exception &e )
- {
- msg( Msg::Warning, "Renderer::points", e.what() );
- return;
- }
-}
-
-void IECoreGL::Renderer::disk( float radius, float z, float thetaMax, const IECoreScene::PrimitiveVariableMap &primVars )
-{
- DiskPrimitivePtr prim = new DiskPrimitive( radius, z, thetaMax );
- addPrimVarsToPrimitive( prim, primVars );
- m_data->addPrimitive( prim );
-}
-
-void IECoreGL::Renderer::curves( const IECore::CubicBasisf &basis, bool periodic, IECore::ConstIntVectorDataPtr numVertices, const IECoreScene::PrimitiveVariableMap &primVars )
-{
- try
- {
- IECoreScene::CurvesPrimitivePtr c = new IECoreScene::CurvesPrimitive( numVertices, basis, periodic );
- c->variables = primVars;
- m_data->addPrimitive( c.get() );
- }
- catch( const std::exception &e )
- {
- msg( Msg::Warning, "Renderer::curves", e.what() );
- return;
- }
-}
-
-void IECoreGL::Renderer::text( const std::string &font, const std::string &text, float kerning, const IECoreScene::PrimitiveVariableMap &primVars )
-{
-
-#ifdef IECORE_WITH_FREETYPE
- FontPtr f = m_data->fontLoader->load( font );
-
- if( !f )
- {
- IECore::msg( IECore::Msg::Warning, "Renderer::text", boost::format( "Font \"%s\" not found." ) % font );
- return;
- }
-
- f->coreFont()->setKerning( kerning );
-
- TextPrimitivePtr prim = new TextPrimitive( text, f );
- addPrimVarsToPrimitive( prim, primVars );
- m_data->addPrimitive( prim );
-#else
- IECore::msg( IECore::Msg::Warning, "Renderer::text", "IECore was not built with FreeType support." );
-#endif // IECORE_WITH_FREETYPE
-}
-
-void IECoreGL::Renderer::sphere( float radius, float zMin, float zMax, float thetaMax, const IECoreScene::PrimitiveVariableMap &primVars )
-{
- SpherePrimitivePtr prim = new SpherePrimitive( radius, zMin, zMax, thetaMax );
- addPrimVarsToPrimitive( prim, primVars );
- m_data->addPrimitive( prim );
-}
-
-static const std::string &imageFragmentShader()
-{
- // fragment shader
- static const std::string shaderCode =
- "uniform sampler2D texture;"
- ""
- "varying vec2 fragmentuv;"
- ""
- "void main()"
- "{"
- " gl_FragColor = texture2D( texture, fragmentuv );"
- "}";
- return shaderCode;
-}
-
-/// \todo This positions images incorrectly when dataWindow!=displayWindow. This is because the texture
-/// contains only the dataWindow contents, but we've positioned the card as if it will contain the whole
-/// displayWindow.
-void IECoreGL::Renderer::image( const Imath::Box2i &dataWindow, const Imath::Box2i &displayWindow, const IECoreScene::PrimitiveVariableMap &primVars )
-{
- if ( m_data->currentInstance )
- {
- IECore::msg( IECore::Msg::Warning, "Renderer::image", "Images currently not supported inside instances." );
- return;
- }
-
- IECoreImage::ImagePrimitivePtr image = new IECoreImage::ImagePrimitive( dataWindow, displayWindow );
- Imath::V3f boxMin( displayWindow.min.x, displayWindow.min.y, 0.0 );
- Imath::V3f boxMax( 1.0f + displayWindow.max.x, 1.0f + displayWindow.max.y, 0.0 );
- Imath::V3f center = (boxMin + boxMax) / 2.0;
- Imath::Box3f bound( boxMin - center, boxMax - center );
-
- if( !m_data->checkCulling( bound ) )
- {
- return;
- }
-
- for( const auto &primVar : primVars )
- {
- if(
- primVar.second.interpolation == PrimitiveVariable::Vertex ||
- primVar.second.interpolation == PrimitiveVariable::Varying ||
- primVar.second.interpolation == PrimitiveVariable::FaceVarying
- )
- {
- image->channels[primVar.first] = primVar.second.data;
- }
- }
-
- IECore::CompoundObjectPtr params = new IECore::CompoundObject();
- params->members()[ "texture" ] = image;
-
- ShaderStateComponentPtr shaderState = new ShaderStateComponent( m_data->shaderLoader, m_data->textureLoader, "", "", imageFragmentShader(), params );
-
- m_data->implementation->transformBegin();
-
- M44f xform;
- xform[3][0] = center.x;
- xform[3][1] = center.y;
- xform[3][2] = center.z;
-
- xform[0][0] = boxSize( bound ).x ;
- xform[1][1] = boxSize( bound ).y ;
- xform[2][2] = 1.0;
-
- m_data->implementation->concatTransform( xform );
- m_data->implementation->attributeBegin();
- m_data->implementation->addState( shaderState );
- QuadPrimitivePtr quad = new QuadPrimitive( 1.0, 1.0 );
- m_data->implementation->addPrimitive( quad );
- m_data->implementation->attributeEnd();
-
- m_data->implementation->transformEnd();
-}
-
-void IECoreGL::Renderer::mesh( IECore::ConstIntVectorDataPtr vertsPerFace, IECore::ConstIntVectorDataPtr vertIds, const std::string &interpolation, const IECoreScene::PrimitiveVariableMap &primVars )
-{
- try
- {
- IECoreScene::MeshPrimitivePtr m = new IECoreScene::MeshPrimitive;
- IECoreScene::PrimitiveVariableMap::const_iterator it = primVars.find( "P" );
- if( it == primVars.end() )
- {
- throw IECore::Exception( "Trying to render a mesh without \"P\"" );
- }
-
- IECore::V3fVectorDataPtr pData = runTimeCast< IECore::V3fVectorData >( it->second.data );
- if( !pData )
- {
- throw IECore::Exception( "Mesh \"P\" variable has incorrect type" );
- }
-
- m->setTopologyUnchecked( vertsPerFace, vertIds, pData->readable().size(), interpolation );
- m->variables = primVars;
- m_data->addPrimitive( m.get() );
- }
- catch( const std::exception &e )
- {
- msg( Msg::Warning, "Renderer::mesh", e.what() );
- return;
- }
-}
-
-void IECoreGL::Renderer::nurbs( int uOrder, IECore::ConstFloatVectorDataPtr uKnot, float uMin, float uMax, int vOrder, IECore::ConstFloatVectorDataPtr vKnot, float vMin, float vMax, const IECoreScene::PrimitiveVariableMap &primVars )
-{
- msg( Msg::Warning, "Renderer::nurbs", "Not implemented" );
-}
-
-void IECoreGL::Renderer::patchMesh( const IECore::CubicBasisf &uBasis, const IECore::CubicBasisf &vBasis, int nu, bool uPeriodic, int nv, bool vPeriodic, const IECoreScene::PrimitiveVariableMap &primVars )
-{
- msg( Msg::Warning, "Renderer::patchMesh", "Not implemented" );
-}
-
-void IECoreGL::Renderer::geometry( const std::string &type, const IECore::CompoundDataMap &topology, const IECoreScene::PrimitiveVariableMap &primVars )
-{
- msg( Msg::Warning, "Renderer::geometry", boost::format( "Geometry type \"%s\" not implemented." ) % type );
-}
-
-void IECoreGL::Renderer::procedural( IECoreScene::Renderer::ProceduralPtr proc )
-{
- if ( m_data->currentInstance )
- {
- IECore::msg( IECore::Msg::Warning, "Renderer::procedural", "Procedurals currently not supported inside instances." );
- return;
- }
- if ( m_data->checkCulling( proc->bound() ) )
- {
- if( ExternalProcedural *externalProcedural = dynamic_cast( proc.get() ) )
- {
- attributeBegin();
- setAttribute( "gl:primitive:wireframe", new BoolData( true ) );
- setAttribute( "gl:primitive:solid", new BoolData( false ) );
- setAttribute( "gl:curvesPrimitive:useGLLines", new BoolData( true ) );
- IECoreScene::CurvesPrimitive::createBox( externalProcedural->bound() )->render( this );
- attributeEnd();
- }
- else
- {
- m_data->implementation->addProcedural( proc, this );
- }
- }
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////////
-// instancing
-/////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-void IECoreGL::Renderer::instanceBegin( const std::string &name, const IECore::CompoundDataMap ¶meters )
-{
- if ( m_data->inWorld )
- {
- msg( Msg::Warning, "Renderer::instanceBegin", "Unsupported instanceBegin call after worldBegin." );
- return;
- }
- if ( m_data->currentInstance )
- {
- IECore::msg( IECore::Msg::Warning, "Renderer::instanceBegin", "Instance already being defined!" );
- return;
- }
- MemberData::InstanceMap::const_iterator it = m_data->instances.find( name );
- if ( it != m_data->instances.end() )
- {
- msg( Msg::Warning, "Renderer::instance", boost::format( "Overwriting instance named \"%s\"." ) % name );
- return;
- }
- m_data->currentInstance = new Group();
- m_data->instances[ name ] = m_data->currentInstance;
-}
-
-void IECoreGL::Renderer::instanceEnd()
-{
- if ( m_data->inWorld )
- {
- msg( Msg::Warning, "Renderer::instanceEnd", "Unsupported instanceEnd call after worldBegin." );
- return;
- }
- if ( !m_data->currentInstance )
- {
- IECore::msg( IECore::Msg::Warning, "Renderer::instanceEnd", "instanceEnd called when no instances are being defined!" );
- return;
- }
- m_data->currentInstance = nullptr;
-}
-
-void IECoreGL::Renderer::instance( const std::string &name )
-{
- MemberData::InstanceMap::iterator it = m_data->instances.find( name );
- if ( it == m_data->instances.end() )
- {
- msg( Msg::Warning, "Renderer::instance", boost::format( "No instance named \"%s\" was found." ) % name );
- return;
- }
- if ( m_data->currentInstance )
- {
- // instance called within another instance
- m_data->addCurrentInstanceChild( it->second );
- }
- else if ( m_data->inWorld )
- {
- m_data->implementation->addInstance( it->second );
- }
- else
- {
- msg( Msg::Warning, "Renderer::instance", "Unsupported call to instance outside world and instance block!" );
- }
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////////
-// commands
-/////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-typedef IECore::DataPtr (*Command)( const std::string &name, const IECore::CompoundDataMap ¶meters, IECoreGL::Renderer::MemberData *memberData );
-typedef std::map CommandMap;
-
-bool removeObjectWalk( IECoreGL::GroupPtr parent, IECoreGL::GroupPtr child, const std::string &objectName, IECoreGL::Renderer::MemberData *memberData )
-{
- const NameStateComponent *stateName = child->getState()->get();
- if( stateName && stateName->name()==objectName )
- {
- if( parent )
- {
- {
- std::lock_guard lock( parent->mutex() );
- parent->removeChild( child.get() );
- }
- {
- std::lock_guard lock2( memberData->removedObjectsMutex );
- memberData->removedObjects.insert( child );
- }
- }
- else
- {
- // no parent, ie we're at the root of the Scene. just remove all the children.
- std::lock_guard lock( child->mutex() );
- std::lock_guard lock2( memberData->removedObjectsMutex );
- for( IECoreGL::Group::ChildContainer::const_iterator it=child->children().begin(); it!=child->children().end(); it++ )
- {
- memberData->removedObjects.insert( *it );
- }
- child->clearChildren();
- }
- return true;
- }
-
- bool result = false;
- std::lock_guard lock( child->mutex() );
- IECoreGL::Group::ChildContainer::const_iterator it = child->children().begin();
- while( it!=child->children().end() )
- {
- IECoreGL::GroupPtr g = IECore::runTimeCast( *it );
- it++;
- if( g )
- {
- result = result | removeObjectWalk( child, g, objectName, memberData );
- }
- }
- if ( result && child->children().size() == 0 && parent )
- {
- // group after removal became empty, remove it too.
- {
- std::lock_guard parentLock( parent->mutex() );
- parent->removeChild( child.get() );
- }
- {
- std::lock_guard lock2( memberData->removedObjectsMutex );
- memberData->removedObjects.insert( child );
- }
- }
- return result;
-}
-
-IECore::DataPtr removeObjectCommand( const std::string &name, const IECore::CompoundDataMap ¶meters, IECoreGL::Renderer::MemberData *memberData )
-{
- DeferredRendererImplementationPtr r = runTimeCast( memberData->implementation );
- if( !r )
- {
- msg( Msg::Warning, "Renderer::command", "removeObject command operates only in deferred mode" );
- return nullptr;
- }
-
- if( !memberData->inEdit )
- {
- msg( Msg::Warning, "Renderer::command", "removeObject command operates only within an editBegin/editEnd block" );
- return nullptr;
- }
-
- string objectName = parameterValue( "name", parameters, "" );
- if( objectName=="" )
- {
- msg( Msg::Warning, "Renderer::command", "removeObject command expects StringData parameter \"name\"" );
- return nullptr;
- }
-
- ScenePtr scene = r->scene();
- bool result = removeObjectWalk( nullptr, r->scene()->root(), objectName, memberData );
-
- return new IECore::BoolData( result );
-}
-
-IECore::DataPtr editBeginCommand( const std::string &name, const IECore::CompoundDataMap ¶meters, IECoreGL::Renderer::MemberData *memberData )
-{
- DeferredRendererImplementationPtr r = runTimeCast( memberData->implementation );
- if( !r )
- {
- msg( Msg::Warning, "Renderer::command", "editBegin command operates only in deferred mode" );
- return nullptr;
- }
-
- memberData->inWorld = true;
- memberData->inEdit = true;
- return new IECore::BoolData( true );
-}
-
-IECore::DataPtr editEndCommand( const std::string &name, const IECore::CompoundDataMap ¶meters, IECoreGL::Renderer::MemberData *memberData )
-{
- DeferredRendererImplementationPtr r = runTimeCast( memberData->implementation );
- if( !r )
- {
- msg( Msg::Warning, "Renderer::command", "editEnd command operates only in deferred mode" );
- return nullptr;
- }
-
- memberData->inWorld = false;
- memberData->inEdit = false;
- // we defer final destruction of objects till now, so we don't destroy gl resources directly in removeObjectCommand.
- // we could be on any thread in removeObjectCommand (it can be called from procedurals) but we require that editEnd
- // is called on the GL thread, so this is therefore the only safe place to do the destruction.
- memberData->removedObjects.clear();
- return new IECore::BoolData( true );
-}
-
-IECore::DataPtr editQueryCommand( const std::string &name, const IECore::CompoundDataMap ¶meters, IECoreGL::Renderer::MemberData *memberData )
-{
- DeferredRendererImplementationPtr r = runTimeCast( memberData->implementation );
- if( !r )
- {
- msg( Msg::Warning, "Renderer::command", "editQuery command operates only in deferred mode" );
- return nullptr;
- }
-
- return new IECore::BoolData( memberData->inEdit );
-}
-
-static const CommandMap &commands()
-{
- static CommandMap c;
- if( !c.size() )
- {
- c["removeObject"] = removeObjectCommand;
- c["editBegin"] = editBeginCommand;
- c["editEnd"] = editEndCommand;
- c["editQuery"] = editQueryCommand;
- }
- return c;
-}
-
-IECore::DataPtr IECoreGL::Renderer::command( const std::string &name, const IECore::CompoundDataMap ¶meters )
-{
- if ( m_data->currentInstance )
- {
- IECore::msg( IECore::Msg::Warning, "Renderer::command", "Commands not supported inside instances." );
- return nullptr;
- }
- const CommandMap &c = commands();
- CommandMap::const_iterator it = c.find( name );
- if( it!=c.end() )
- {
- return it->second( name, parameters, m_data );
- }
-
- if( name.compare( 0, 3, "gl:" )==0 || name.find( ':' )==string::npos )
- {
- msg( Msg::Warning, "Renderer::command", boost::format( "Unsuppported command \"%s\"." ) % name );
- return nullptr;
- }
-
- return nullptr;
-}
-
-void IECoreGL::Renderer::editBegin( const std::string &name, const IECore::CompoundDataMap ¶meters )
-{
- msg( Msg::Warning, "Renderer::editBegin", "Not implemented" );
-}
-
-void IECoreGL::Renderer::editEnd()
-{
- msg( Msg::Warning, "Renderer::editEnd", "Not implemented" );
-}
-
-IECoreGL::ShaderLoader *IECoreGL::Renderer::shaderLoader()
-{
- return m_data->shaderLoader.get();
-}
-
-IECoreGL::TextureLoader *IECoreGL::Renderer::textureLoader()
-{
- return m_data->textureLoader.get();
-}
diff --git a/src/IECoreGL/RendererImplementation.cpp b/src/IECoreGL/RendererImplementation.cpp
deleted file mode 100644
index e5beac4e93..0000000000
--- a/src/IECoreGL/RendererImplementation.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-//////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2007, Image Engine Design Inc. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// * Neither the name of Image Engine Design nor the names of any
-// other contributors to this software may be used to endorse or
-// promote products derived from this software without specific prior
-// written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-//////////////////////////////////////////////////////////////////////////
-
-#include "IECoreGL/private/RendererImplementation.h"
-
-using namespace IECoreGL;
-
-RendererImplementation::RendererImplementation()
-{
-}
-
-RendererImplementation::~RendererImplementation()
-{
-}
diff --git a/src/IECoreGL/ToGLCameraConverter.cpp b/src/IECoreGL/ToGLCameraConverter.cpp
index 736bd0d6b9..412bd500c0 100644
--- a/src/IECoreGL/ToGLCameraConverter.cpp
+++ b/src/IECoreGL/ToGLCameraConverter.cpp
@@ -37,7 +37,6 @@
#include "IECoreGL/Camera.h"
#include "IECoreScene/Camera.h"
-#include "IECoreScene/Transform.h"
#include "IECore/CompoundParameter.h"
#include "IECore/Exception.h"
diff --git a/src/IECoreGL/bindings/IECoreGLBinding.cpp b/src/IECoreGL/bindings/IECoreGLBinding.cpp
index ff4a979eec..255cb88109 100644
--- a/src/IECoreGL/bindings/IECoreGLBinding.cpp
+++ b/src/IECoreGL/bindings/IECoreGLBinding.cpp
@@ -55,7 +55,6 @@
#include "IECoreGL/bindings/PointsPrimitiveBinding.h"
#include "IECoreGL/bindings/PrimitiveBinding.h"
#include "IECoreGL/bindings/RenderableBinding.h"
-#include "IECoreGL/bindings/RendererBinding.h"
#include "IECoreGL/bindings/SceneBinding.h"
#include "IECoreGL/bindings/SelectorBinding.h"
#include "IECoreGL/bindings/ShaderBinding.h"
@@ -80,7 +79,6 @@ using namespace boost::python;
BOOST_PYTHON_MODULE( _IECoreGL )
{
- bindRenderer();
bindBindable();
bindShader();
bindTexture();
diff --git a/src/IECoreGL/bindings/RendererBinding.cpp b/src/IECoreGL/bindings/RendererBinding.cpp
deleted file mode 100644
index a623b4c0e7..0000000000
--- a/src/IECoreGL/bindings/RendererBinding.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-//////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2007-2012, Image Engine Design Inc. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// * Neither the name of Image Engine Design nor the names of any
-// other contributors to this software may be used to endorse or
-// promote products derived from this software without specific prior
-// written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-//////////////////////////////////////////////////////////////////////////
-
-#include "boost/python.hpp"
-
-#include "IECoreGL/bindings/RendererBinding.h"
-
-#include "IECoreGL/Renderer.h"
-#include "IECoreGL/Scene.h"
-#include "IECoreGL/ShaderLoader.h"
-#include "IECoreGL/TextureLoader.h"
-
-#include "IECorePython/RunTimeTypedBinding.h"
-
-#include "IECore/SimpleTypedData.h"
-
-using namespace boost::python;
-using namespace IECore;
-
-namespace IECoreGL
-{
-
-static ShaderLoaderPtr shaderLoader( Renderer &r )
-{
- return r.shaderLoader();
-}
-
-static TextureLoaderPtr textureLoader( Renderer &r )
-{
- return r.textureLoader();
-}
-
-static void worldBegin( Renderer &r )
-{
- if ( boost::static_pointer_cast(r.getOption( "gl:mode" ))->readable() == "deferred" )
- {
- // The deferred render uses multiple threads when rendering procedurals. So we enable threads for python here.
- // \todo Consider moving this to IECore::Renderer::worldBegin binding (assuming all decent renderers are multithreaded).
-#if PY_VERSION_HEX < 0x03090000
- if ( !PyEval_ThreadsInitialized() )
- {
- PyEval_InitThreads();
- }
-#endif
- }
- r.worldBegin();
-}
-
-void bindRenderer()
-{
- IECorePython::RunTimeTypedClass()
- .def( init<>() )
- .def( "worldBegin", &worldBegin )
- .def( "scene", &Renderer::scene )
- .def( "shaderLoader", &shaderLoader )
- .def( "textureLoader", &textureLoader )
- ;
-}
-
-}
diff --git a/src/IECoreScene/AttributeBlock.cpp b/src/IECoreScene/AttributeBlock.cpp
deleted file mode 100644
index ea9843462f..0000000000
--- a/src/IECoreScene/AttributeBlock.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-//////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2009-2010, Image Engine Design Inc. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// * Neither the name of Image Engine Design nor the names of any
-// other contributors to this software may be used to endorse or
-// promote products derived from this software without specific prior
-// written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-//////////////////////////////////////////////////////////////////////////
-
-#include "IECoreScene/AttributeBlock.h"
-
-using namespace IECore;
-using namespace IECoreScene;
-
-AttributeBlock::AttributeBlock( RendererPtr renderer, bool active )
- : m_renderer( active ? renderer : nullptr )
-{
- if( m_renderer )
- {
- m_renderer->attributeBegin();
- }
-}
-
-AttributeBlock::~AttributeBlock()
-{
- if( m_renderer )
- {
- m_renderer->attributeEnd();
- }
-}
-
diff --git a/src/IECoreScene/AttributeState.cpp b/src/IECoreScene/AttributeState.cpp
deleted file mode 100644
index 63616ee038..0000000000
--- a/src/IECoreScene/AttributeState.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-//////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2007-2013, Image Engine Design Inc. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// * Neither the name of Image Engine Design nor the names of any
-// other contributors to this software may be used to endorse or
-// promote products derived from this software without specific prior
-// written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-//////////////////////////////////////////////////////////////////////////
-
-#include "IECoreScene/AttributeState.h"
-
-#include "IECoreScene/Renderer.h"
-
-using namespace IECore;
-using namespace IECoreScene;
-using namespace boost;
-
-static IndexedIO::EntryID g_attributesEntry("attributes");
-const unsigned int AttributeState::m_ioVersion = 0;
-IE_CORE_DEFINEOBJECTTYPEDESCRIPTION( AttributeState );
-
-AttributeState::AttributeState( CompoundDataPtr attributes )
- : m_attributes( attributes ? attributes : CompoundDataPtr( new CompoundData() ) )
-{
-}
-
-AttributeState::AttributeState( const CompoundDataMap &attributes )
- : m_attributes( new CompoundData( attributes ) )
-{
-}
-
-AttributeState::~AttributeState()
-{
-}
-
-CompoundDataMap &AttributeState::attributes()
-{
- return m_attributes->writable();
-}
-
-const CompoundDataMap &AttributeState::attributes() const
-{
- return m_attributes->readable();
-}
-
-CompoundDataPtr AttributeState::attributesData()
-{
- return m_attributes;
-}
-
-void AttributeState::render( Renderer *renderer ) const
-{
- for( CompoundDataMap::const_iterator it=attributes().begin(); it!=attributes().end(); it++ )
- {
- renderer->setAttribute( it->first, it->second );
- }
-}
-
-bool AttributeState::isEqualTo( const Object *other ) const
-{
- if( !StateRenderable::isEqualTo( other ) )
- {
- return false;
- }
- const AttributeState *s = static_cast( other );
- return m_attributes->isEqualTo( s->m_attributes.get() );
-}
-
-void AttributeState::memoryUsage( Object::MemoryAccumulator &a ) const
-{
- StateRenderable::memoryUsage( a );
- a.accumulate( m_attributes.get() );
-}
-
-void AttributeState::copyFrom( const Object *other, CopyContext *context )
-{
- StateRenderable::copyFrom( other, context );
- const AttributeState *s = static_cast( other );
- m_attributes = context->copy( s->m_attributes.get() );
-}
-
-void AttributeState::save( SaveContext *context ) const
-{
- StateRenderable::save( context );
- IndexedIOPtr container = context->container( staticTypeName(), m_ioVersion );
- context->save( m_attributes.get(), container.get(), g_attributesEntry );
-}
-
-void AttributeState::load( LoadContextPtr context )
-{
- StateRenderable::load( context );
- unsigned int v = m_ioVersion;
- ConstIndexedIOPtr container = context->container( staticTypeName(), v );
- m_attributes = context->load( container.get(), g_attributesEntry );
-}
-
-void AttributeState::hash( MurmurHash &h ) const
-{
- StateRenderable::hash( h );
- m_attributes->hash( h );
-}
diff --git a/src/IECoreScene/Camera.cpp b/src/IECoreScene/Camera.cpp
index 727a8ae689..67ef1d0d31 100644
--- a/src/IECoreScene/Camera.cpp
+++ b/src/IECoreScene/Camera.cpp
@@ -36,8 +36,6 @@
#include "IECore/AngleConversion.h"
-#include "IECoreScene/Renderer.h"
-
#include "IECore/MurmurHash.h"
#include "IECore/SimpleTypedData.h"
@@ -96,21 +94,21 @@ Camera::~Camera()
void Camera::copyFrom( const Object *other, CopyContext *context )
{
- PreWorldRenderable::copyFrom( other, context );
+ Renderable::copyFrom( other, context );
const Camera *tOther = static_cast( other );
m_parameters = context->copy( tOther->m_parameters.get() );
}
void Camera::save( SaveContext *context ) const
{
- PreWorldRenderable::save( context );
+ Renderable::save( context );
IndexedIOPtr container = context->container( staticTypeName(), m_ioVersion );
context->save( m_parameters.get(), container.get(), g_parametersEntry );
}
void Camera::load( LoadContextPtr context )
{
- PreWorldRenderable::load( context );
+ Renderable::load( context );
unsigned int v = m_ioVersion;
ConstIndexedIOPtr container = context->container( staticTypeName(), v );
@@ -119,7 +117,7 @@ void Camera::load( LoadContextPtr context )
bool Camera::isEqualTo( const Object *other ) const
{
- if( !PreWorldRenderable::isEqualTo( other ) )
+ if( !Renderable::isEqualTo( other ) )
{
return false;
}
@@ -137,13 +135,13 @@ bool Camera::isEqualTo( const Object *other ) const
void Camera::memoryUsage( Object::MemoryAccumulator &a ) const
{
- PreWorldRenderable::memoryUsage( a );
+ Renderable::memoryUsage( a );
a.accumulate( m_parameters.get() );
}
void Camera::hash( MurmurHash &h ) const
{
- PreWorldRenderable::hash( h );
+ Renderable::hash( h );
m_parameters->hash( h );
}
@@ -438,9 +436,3 @@ void Camera::setFocalLengthFromFieldOfView( float horizontalFOV )
{
setFocalLength( getAperture()[0] * 0.5f / tan( 0.5f * IECore::degreesToRadians( horizontalFOV ) ) );
}
-
-void Camera::render( Renderer *renderer ) const
-{
- // The old renderer interface takes unused name parameter
- renderer->camera( "", m_parameters->readable() );
-}
diff --git a/src/IECoreScene/ClippingPlane.cpp b/src/IECoreScene/ClippingPlane.cpp
index 470893c09a..bdc96dbf93 100644
--- a/src/IECoreScene/ClippingPlane.cpp
+++ b/src/IECoreScene/ClippingPlane.cpp
@@ -34,8 +34,6 @@
#include "IECoreScene/ClippingPlane.h"
-#include "IECoreScene/Renderer.h"
-
using namespace IECore;
using namespace IECoreScene;
@@ -51,35 +49,30 @@ ClippingPlane::~ClippingPlane()
void ClippingPlane::copyFrom( const Object *other, CopyContext *context )
{
- PreWorldRenderable::copyFrom( other, context );
+ Renderable::copyFrom( other, context );
}
void ClippingPlane::save( SaveContext *context ) const
{
- PreWorldRenderable::save( context );
+ Renderable::save( context );
}
void ClippingPlane::load( LoadContextPtr context )
{
- PreWorldRenderable::load( context );
+ Renderable::load( context );
}
bool ClippingPlane::isEqualTo( const Object *other ) const
{
- return PreWorldRenderable::isEqualTo( other );
+ return Renderable::isEqualTo( other );
}
void ClippingPlane::memoryUsage( Object::MemoryAccumulator &a ) const
{
- PreWorldRenderable::memoryUsage( a );
+ Renderable::memoryUsage( a );
}
void ClippingPlane::hash( MurmurHash &h ) const
{
- PreWorldRenderable::hash( h );
-}
-
-void ClippingPlane::render( Renderer *renderer ) const
-{
- renderer->command( "clippingPlane", CompoundDataMap() );
+ Renderable::hash( h );
}
diff --git a/src/IECoreScene/CoordinateSystem.cpp b/src/IECoreScene/CoordinateSystem.cpp
index edf175705f..e5e27833a6 100644
--- a/src/IECoreScene/CoordinateSystem.cpp
+++ b/src/IECoreScene/CoordinateSystem.cpp
@@ -34,10 +34,6 @@
#include "IECoreScene/CoordinateSystem.h"
-#include "IECoreScene/Renderer.h"
-#include "IECoreScene/Transform.h"
-#include "IECoreScene/TransformBlock.h"
-
#include "IECore/MurmurHash.h"
using namespace IECore;
@@ -49,13 +45,8 @@ static IndexedIO::EntryID g_transformEntry("transform");
const unsigned int CoordinateSystem::m_ioVersion = 0;
IE_CORE_DEFINEOBJECTTYPEDESCRIPTION( CoordinateSystem );
-CoordinateSystem::CoordinateSystem()
- : m_name( "unspecified" ), m_transform( nullptr )
-{
-}
-
-CoordinateSystem::CoordinateSystem( const std::string &name, TransformPtr transform )
- : m_name( name ), m_transform( transform )
+CoordinateSystem::CoordinateSystem( const std::string &name )
+ : m_name( name )
{
}
@@ -73,36 +64,9 @@ void CoordinateSystem::setName( const std::string &name )
m_name = name;
}
-Transform *CoordinateSystem::getTransform()
-{
- return m_transform.get();
-}
-
-const Transform *CoordinateSystem::getTransform() const
-{
- return m_transform.get();
-}
-
-void CoordinateSystem::setTransform( TransformPtr transform )
-{
- m_transform = transform;
-}
-
-void CoordinateSystem::render( Renderer *renderer ) const
-{
- TransformBlock transformBlock( renderer, static_cast( m_transform ) );
-
- if( m_transform )
- {
- m_transform->render( renderer );
- }
-
- renderer->coordinateSystem( m_name );
-}
-
bool CoordinateSystem::isEqualTo( const Object *other ) const
{
- if( !StateRenderable::isEqualTo( other ) )
+ if( !Renderable::isEqualTo( other ) )
{
return false;
}
@@ -111,75 +75,39 @@ bool CoordinateSystem::isEqualTo( const Object *other ) const
{
return false;
}
- if( (bool)m_transform != (bool)c->m_transform )
- {
- return false;
- }
- if( m_transform )
- {
- return m_transform->isEqualTo( c->m_transform.get() );
- }
return true;
}
void CoordinateSystem::memoryUsage( Object::MemoryAccumulator &a ) const
{
- StateRenderable::memoryUsage( a );
+ Renderable::memoryUsage( a );
a.accumulate( m_name.capacity() + sizeof( m_name ) );
- if( m_transform )
- {
- a.accumulate( m_transform.get() );
- }
}
void CoordinateSystem::copyFrom( const Object *other, CopyContext *context )
{
- StateRenderable::copyFrom( other, context );
+ Renderable::copyFrom( other, context );
const CoordinateSystem *c = static_cast( other );
m_name = c->m_name;
- if( c->m_transform )
- {
- m_transform = context->copy( c->m_transform.get() );
- }
- else
- {
- m_transform = nullptr;
- }
}
void CoordinateSystem::save( SaveContext *context ) const
{
- StateRenderable::save( context );
+ Renderable::save( context );
IndexedIOPtr container = context->container( staticTypeName(), m_ioVersion );
container->write( g_nameEntry, m_name );
- if( m_transform )
- {
- context->save( m_transform.get(), container.get(), g_transformEntry );
- }
}
void CoordinateSystem::load( LoadContextPtr context )
{
- StateRenderable::load( context );
+ Renderable::load( context );
unsigned int v = m_ioVersion;
ConstIndexedIOPtr container = context->container( staticTypeName(), v );
container->read( g_nameEntry, m_name );
- m_transform = nullptr;
- try
- {
- m_transform = context->load( container.get(), g_transformEntry );
- }
- catch( ... )
- {
- }
}
void CoordinateSystem::hash( MurmurHash &h ) const
{
- StateRenderable::hash( h );
+ Renderable::hash( h );
h.append( m_name );
- if( m_transform )
- {
- m_transform->hash( h );
- }
}
diff --git a/src/IECoreScene/CurveExtrudeOp.cpp b/src/IECoreScene/CurveExtrudeOp.cpp
deleted file mode 100644
index 439312b8a2..0000000000
--- a/src/IECoreScene/CurveExtrudeOp.cpp
+++ /dev/null
@@ -1,593 +0,0 @@
-//////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2009-2010, Image Engine Design Inc. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// * Neither the name of Image Engine Design nor the names of any
-// other contributors to this software may be used to endorse or
-// promote products derived from this software without specific prior
-// written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-//////////////////////////////////////////////////////////////////////////
-
-#include "IECoreScene/CurveExtrudeOp.h"
-
-#include "IECoreScene/CurvesPrimitive.h"
-#include "IECoreScene/Group.h"
-#include "IECoreScene/PatchMeshPrimitive.h"
-#include "IECoreScene/TypedObjectParameter.h"
-
-#include "IECore/CompoundParameter.h"
-#include "IECore/DespatchTypedData.h"
-#include "IECore/Interpolator.h"
-#include "IECore/Math.h"
-#include "IECore/MessageHandler.h"
-#include "IECore/Object.h"
-#include "IECore/SimpleTypedData.h"
-#include "IECore/TypedObjectParameter.h"
-#include "IECore/VectorTypedData.h"
-
-#include "Imath/ImathFrame.h"
-
-#include
-#include
-#include
-
-#include
-
-using namespace IECore;
-using namespace IECoreScene;
-using namespace Imath;
-using namespace std;
-
-IE_CORE_DEFINERUNTIMETYPED( CurveExtrudeOp );
-
-CurveExtrudeOp::CurveExtrudeOp()
- : Op(
- "The CurveExtrudeOp creates a group of PatchMesh geometries by lofting a circle along each given CurvesPrimitive.",
- new GroupParameter(
- "result",
- "Resulting group of patch meshes.",
- new Group()
- )
- )
-{
- m_curvesParameter = new CurvesPrimitiveParameter(
- "curves",
- "The curves to convert into patch meshes.",
- new CurvesPrimitive()
- );
-
- m_resolutionParameter = new V2iParameter(
- "resolution",
- "The resolution in U and V for each generated PatchMesh. U goes around the curve, V goes along the curve.",
- V2i( 6, 30 )
- );
-
- parameters()->addParameter( m_curvesParameter );
- parameters()->addParameter( m_resolutionParameter );
-}
-
-CurveExtrudeOp::~CurveExtrudeOp()
-{
-}
-
-CurvesPrimitiveParameter * CurveExtrudeOp::curvesParameter()
-{
- return m_curvesParameter.get();
-}
-
-const CurvesPrimitiveParameter * CurveExtrudeOp::curvesParameter() const
-{
- return m_curvesParameter.get();
-}
-
-void CurveExtrudeOp::buildReferenceFrames( const std::vector< Imath::V3f > &points, std::vector< Imath::V3f > &tangents, std::vector< M44f > &frames ) const
-{
- /// \todo This disregads the "N" primvar which is possibly specified on the CurvesPrimitive
- std::vector< Imath::V3f >::size_type numPoints = points.size();
- assert( tangents.size() == numPoints );
-
- frames.resize( numPoints );
-
- frames[ 0 ] = Imath::firstFrame(
- points[ 0 ],
- points[ 1 ],
- points[ 2 ]
- );
-
- for( unsigned int i = 1; i < numPoints - 1; i++ )
- {
- frames[ i ] = Imath::nextFrame(
- frames[ i - 1 ],
- points[ i - 1 ],
- points[ i ],
- tangents[ i - 1 ],
- tangents[ i ]
- );
- }
-
- frames[ numPoints - 1 ] = Imath::lastFrame(
- frames[ numPoints - 2 ],
- points[ numPoints - 2 ],
- points[ numPoints - 1 ]
- );
-}
-
-struct CurveExtrudeOp::VaryingFn
-{
- typedef DataPtr ReturnType;
-
- const std::string &m_primVarName;
- ConstCurvesPrimitivePtr m_curves;
- const unsigned m_curveIndex;
- const unsigned m_varyingOffset;
- const V2i &m_resolution;
-
- VaryingFn( const std::string &primVarName, ConstCurvesPrimitivePtr curves, unsigned curveIndex, unsigned varyingOffset, const V2i &resolution ) : m_primVarName( primVarName ), m_curves( curves ), m_curveIndex( curveIndex ), m_varyingOffset( varyingOffset ), m_resolution( resolution )
- {
- }
-
- template
- DataPtr operator() ( T *data ) const
- {
- assert( data );
- typedef typename T::ValueType::value_type Value;
-
- const unsigned vPoints = m_resolution.y;
- const unsigned uPoints = m_resolution.x;
-
- typename T::Ptr newData = new T();
- newData->writable().reserve( ( vPoints ) * uPoints );
-
- for ( unsigned int v = 0; v < vPoints; v++ )
- {
- int iSeg;
- float fSeg;
-
- if ( v == vPoints - 1 )
- {
- iSeg = m_curves->numSegments( m_curveIndex ) - 1;
- fSeg = 0.9999f;
- }
- else
- {
- float curveParam = float(v) / ( vPoints - 1 );
- fSeg = curveParam * m_curves->numSegments( m_curveIndex );
- iSeg = (int)floor( fSeg );
- fSeg = fSeg - iSeg;
- }
-
- for ( unsigned u = 0; u < uPoints ; u ++)
- {
- Value value;
- LinearInterpolator()(
- data->readable()[ m_varyingOffset + iSeg ],
- data->readable()[ m_varyingOffset + iSeg + 1],
- fSeg,
- value
- );
- newData->writable().push_back( value );
- }
- }
-
- return newData;
- }
-
- struct ErrorHandler
- {
- template
- void operator()( const T *data, const F& functor )
- {
- assert( data );
- throw InvalidArgumentException( ( boost::format( "CurveExtrudeOp: Invalid data type \"%s\" for primitive variable \"%s\"." ) % Object::typeNameFromTypeId( data->typeId() ) % functor.m_primVarName ).str() );
- }
- };
-};
-
-struct CurveExtrudeOp::VertexFn
-{
- typedef DataPtr ReturnType;
-
- const std::string &m_primVarName;
- const CurvesPrimitive * m_curves;
- const unsigned m_curveIndex;
- const unsigned m_varyingOffset;
- const V2i &m_resolution;
-
- VertexFn( const std::string &primVarName, const CurvesPrimitive * curves, unsigned curveIndex, unsigned varyingOffset, const V2i &resolution ) : m_primVarName( primVarName ), m_curves( curves ), m_curveIndex( curveIndex ), m_varyingOffset( varyingOffset ), m_resolution( resolution )
- {
- }
-
- template
- DataPtr operator() ( T * data ) const
- {
- assert( data );
- typedef typename T::ValueType::value_type Value;
-
- const unsigned vPoints = m_resolution.y;
- const unsigned uPoints = m_resolution.x;
-
- typename T::Ptr newData = new T();
- newData->writable().reserve( ( vPoints + 2 ) * uPoints );
-
- for ( unsigned int v = 0; v < vPoints; v++ )
- {
- size_t iSeg;
- float fSeg;
-
- if ( v == vPoints - 1 )
- {
- iSeg = m_curves->numSegments( m_curveIndex ) - 1;
- fSeg = 0.9999f;
- }
- else
- {
- float curveParam = float(v) / ( vPoints - 1 );
- fSeg = curveParam * m_curves->numSegments( m_curveIndex );
- iSeg = (size_t)floor( fSeg );
- fSeg = fSeg - iSeg;
- }
-
- const int num = v == 0 || v == vPoints - 1 ? 2 : 1;
-
- const size_t i0 = iSeg;
- const size_t i1 = std::min( iSeg + 1, m_curves->variableSize( PrimitiveVariable::Varying, m_curveIndex ) );
-
- for ( int x = 0; x < num; x++)
- {
- for ( unsigned u = 0; u < uPoints ; u ++)
- {
- Value value;
- LinearInterpolator()(
- data->readable()[ m_varyingOffset + i0 ],
- data->readable()[ m_varyingOffset + i1],
- fSeg,
- value
- );
- newData->writable().push_back( value );
- }
- }
- }
-
- return newData;
- }
-
- struct ErrorHandler
- {
- template
- void operator()( const T *data, const F& functor )
- {
- assert( data );
- throw InvalidArgumentException( ( boost::format( "CurveExtrudeOp: Invalid data type \"%s\" for vertex primitive variable \"%s\"." ) % Object::typeNameFromTypeId( data->typeId() ) % functor.m_primVarName ).str() );
- }
- };
-};
-
-
-struct CurveExtrudeOp::UniformFn
-{
- typedef DataPtr ReturnType;
-
- const std::string &m_primVarName;
- const CurvesPrimitive * m_curves;
- const unsigned m_curveIndex;
-
- UniformFn( const std::string &primVarName, const CurvesPrimitive * curves, unsigned curveIndex ) : m_primVarName( primVarName ), m_curves( curves ), m_curveIndex( curveIndex )
- {
- }
-
- template
- DataPtr operator() ( T *data ) const
- {
- assert( data );
- return new TypedData< typename T::ValueType::value_type >( data->readable()[ m_curveIndex ] );
- }
-
- struct ErrorHandler
- {
- template
- void operator()( const T *data, const F& functor )
- {
- assert( data );
- throw InvalidArgumentException( ( boost::format( "CurveExtrudeOp: Invalid data type \"%s\" for uniform primitive variable \"%s\"." ) % Object::typeNameFromTypeId( data->typeId() ) % functor.m_primVarName ).str() );
- }
- };
-};
-
-
-PatchMeshPrimitivePtr CurveExtrudeOp::buildPatchMesh( const CurvesPrimitive * curves, unsigned curveIndex, unsigned vertexOffset, unsigned varyingOffset ) const
-{
- if ( curves->periodic() )
- {
- throw InvalidArgumentException( "CurveExtrudeOp: Cannot convert periodic curves" );
- }
-
- PrimitiveVariableMap::const_iterator it = curves->variables.find( "P" );
- if ( it == curves->variables.end() )
- {
- throw InvalidArgumentException( "CurveExtrudeOp: Input curve has no 'P' primvar" );
- }
- ConstV3fVectorDataPtr pData = runTimeCast< const V3fVectorData >( it->second.data );
- if ( !pData )
- {
- throw InvalidArgumentException( "CurveExtrudeOp: Input curve has no 'P' primvar of type V3fVectorData" );
- }
-
- float width = 1.0f;
- it = curves->variables.find( "constantwidth" );
- if ( it != curves->variables.end() )
- {
- ConstFloatDataPtr widthData = nullptr;
- if ( it->second.interpolation == PrimitiveVariable::Constant )
- {
- widthData = runTimeCast< const FloatData >( it->second.data );
- }
-
- if ( widthData )
- {
- width = widthData->readable();
- }
- else
- {
- msg( Msg::Warning, "CurveExtrudeOp", "Ignoring malformed primvar 'constantwidth'" );
- }
- }
-
- ConstFloatVectorDataPtr varyingWidthData = nullptr;
- ConstFloatVectorDataPtr vertexWidthData = nullptr;
- it = curves->variables.find( "width" );
- if ( it != curves->variables.end() )
- {
- if ( it->second.interpolation == PrimitiveVariable::Varying )
- {
- varyingWidthData = runTimeCast< const FloatVectorData >( it->second.data );
- }
- else if ( it->second.interpolation == PrimitiveVariable::Vertex )
- {
- vertexWidthData = runTimeCast< const FloatVectorData >( it->second.data );
- }
-
- if ( !varyingWidthData && !vertexWidthData)
- {
- msg( Msg::Warning, "CurveExtrudeOp", "Ignoring malformed primvar 'width'" );
- }
- }
-
- const V2i &resolution = m_resolutionParameter->getTypedValue();
-
- const unsigned int vPoints = resolution.y;
- const unsigned int uPoints = resolution.x;
-
- PatchMeshPrimitivePtr patchMesh = new PatchMeshPrimitive(
- uPoints,
- vPoints + 2, // End points are duplicated
- CubicBasisf::catmullRom(),
- CubicBasisf::catmullRom(),
- true,
- false
- );
-
- for ( PrimitiveVariableMap::const_iterator vIt = curves->variables.begin(); vIt != curves->variables.end(); ++vIt )
- {
- if ( vIt->second.interpolation == PrimitiveVariable::FaceVarying || vIt->second.interpolation == PrimitiveVariable::Varying )
- {
- VaryingFn varyingFn( vIt->first, curves, curveIndex, varyingOffset, resolution );
- assert( vIt->second.data );
-
- patchMesh->variables[ vIt->first ] = PrimitiveVariable(
- vIt->second.interpolation,
- despatchTypedData( vIt->second.data.get(), varyingFn )
- );
-
- }
- else if ( vIt->second.interpolation == PrimitiveVariable::Vertex )
- {
- VertexFn vertexFn( vIt->first, curves, curveIndex, vertexOffset, resolution );
- assert( vIt->second.data );
-
- patchMesh->variables[ vIt->first ] = PrimitiveVariable(
- vIt->second.interpolation,
- despatchTypedData( vIt->second.data.get(), vertexFn )
- );
-
- }
- else if ( vIt->second.interpolation == PrimitiveVariable::Constant )
- {
- patchMesh->variables[ vIt->first ] = PrimitiveVariable( vIt->second.interpolation, vIt->second.data->copy() );
- }
- else if ( vIt->second.interpolation == PrimitiveVariable::Uniform )
- {
- UniformFn uniformFn( vIt->first, curves, curveIndex );
- patchMesh->variables[ vIt->first ] = PrimitiveVariable(
- PrimitiveVariable::Constant,
- despatchTypedData( vIt->second.data.get(), uniformFn )
- );
- }
- }
-
- if ( varyingWidthData )
- {
- assert( !vertexWidthData );
- PrimitiveVariableMap::const_iterator vIt = patchMesh->variables.find( "width" );
- assert( vIt != patchMesh->variables.end() );
-
- varyingWidthData = runTimeCast< const FloatVectorData >( vIt->second.data );
- assert( varyingWidthData );
- }
- else if ( vertexWidthData )
- {
- PrimitiveVariableMap::const_iterator vIt = patchMesh->variables.find( "width" );
- assert( vIt != patchMesh->variables.end() );
-
- vertexWidthData = runTimeCast< const FloatVectorData >( vIt->second.data );
- assert( vertexWidthData );
- }
-
- const V3fVectorData::ValueType &p = pData->readable();
-
- V3fVectorData::ValueType resampledPoints;
- resampledPoints.reserve( vPoints );
-
- V3fVectorData::ValueType resampledTangents;
- resampledPoints.reserve( vPoints );
-
- /// \todo Make adaptive
- for ( unsigned v = 0; v < vPoints; v ++)
- {
- size_t iSeg;
- float fSeg;
-
- /// Make sure we don't fall off the end of the curve
- if ( v == vPoints - 1 )
- {
- iSeg = curves->numSegments( curveIndex ) - 1;
- fSeg = 1.0f - std::numeric_limits::epsilon();
- }
- else
- {
- float curveParam = float(v) / ( vPoints - 1 );
- fSeg = curveParam * curves->numSegments( curveIndex );
- iSeg = (size_t)floor( fSeg );
- fSeg = fSeg - iSeg;
- }
-
- size_t segmentStart = iSeg;
-
- size_t i0 = std::min( segmentStart + 0, curves->variableSize( PrimitiveVariable::Vertex, curveIndex ) );
- size_t i1 = std::min( segmentStart + 1, curves->variableSize( PrimitiveVariable::Vertex, curveIndex ) );
- size_t i2 = std::min( segmentStart + 2, curves->variableSize( PrimitiveVariable::Vertex, curveIndex ) );
- size_t i3 = std::min( segmentStart + 3, curves->variableSize( PrimitiveVariable::Vertex, curveIndex ) );
-
- const Imath::V3f &p0 = p[ vertexOffset + i0 ];
- const Imath::V3f &p1 = p[ vertexOffset + i1 ];
- const Imath::V3f &p2 = p[ vertexOffset + i2 ];
- const Imath::V3f &p3 = p[ vertexOffset + i3 ];
-
- Imath::V3f pt = curves->basis()(
- fSeg,
- p0, p1, p2, p3
- );
-
- resampledPoints.push_back( pt );
-
- resampledTangents.push_back(
- curves->basis().derivative(
- fSeg,
- p0, p1, p2, p3
- ).normalized()
- );
-
- }
- assert( resampledPoints.size() == vPoints );
- assert( resampledTangents.size() == vPoints );
-
- std::vector< M44f > frames;
-
- buildReferenceFrames( resampledPoints, resampledTangents, frames );
- assert( frames.size() == vPoints );
-
- std::vector< V3f > patchP;
- patchP.reserve( uPoints * ( vPoints + 2 ) );
-
- for ( unsigned int v = 0; v < vPoints; v++ )
- {
- if ( varyingWidthData )
- {
- assert( !vertexWidthData );
- assert( v * uPoints < varyingWidthData->readable().size() );
- width = varyingWidthData->readable()[v * uPoints];
- }
- else if ( vertexWidthData )
- {
- assert( (v+1) * uPoints < vertexWidthData->readable().size() );
- width = vertexWidthData->readable()[(v+1) * uPoints];
- }
-
- const float radius = width / 2.0f;
-
- /// Double up end points
- const int num = v == 0 || v == vPoints - 1 ? 2 : 1;
-
- for ( int x = 0; x < num; x++)
- {
- for( unsigned int u = 0; u < uPoints; u++ )
- {
- /// We're periodic in 'u', so no need to close the curve.
- /// Go from -PI to PI, in order to make the periodicity work, and to give the
- /// surface the correct orientation.
- float theta = -2.0 * M_PI * float(u) / float(uPoints) - M_PI;
-
- V3f circlePoint(
- 0.0,
- radius * cos( theta ),
- radius * sin( theta )
- );
-
- circlePoint = circlePoint * frames[v];
-
- patchP.push_back( circlePoint );
- }
- }
- }
-
- patchMesh->variables["P"] = PrimitiveVariable( PrimitiveVariable::Vertex, new V3fVectorData( patchP ) );
-
- assert( patchMesh->arePrimitiveVariablesValid() );
-
- return patchMesh;
-}
-
-ObjectPtr CurveExtrudeOp::doOperation( const CompoundObject * operands )
-{
- CurvesPrimitive * curves = m_curvesParameter->getTypedValue();
- assert( curves );
- assert( curves->arePrimitiveVariablesValid() );
-
- GroupPtr group = new Group();
-
- const IntVectorData * verticesPerCurve = curves->verticesPerCurve();
- assert( verticesPerCurve );
-
- unsigned numCurves = verticesPerCurve->readable().size();
- unsigned vertexOffset = 0;
- unsigned varyingOffset = 0;
- for ( unsigned curveIndex = 0; curveIndex < numCurves; curveIndex++ )
- {
- int numVertices = curves->variableSize( PrimitiveVariable::Vertex, curveIndex );
-
- PatchMeshPrimitivePtr patchMesh = buildPatchMesh( curves, curveIndex, vertexOffset, varyingOffset );
- assert( patchMesh );
-
- group->addChild( patchMesh );
-
- vertexOffset += numVertices;
- varyingOffset += curves->variableSize( PrimitiveVariable::Varying, curveIndex );
- }
-
- assert( group->children().size() == numCurves );
-
- return group;
-}
diff --git a/src/IECoreScene/CurvesPrimitive.cpp b/src/IECoreScene/CurvesPrimitive.cpp
index 7e2c712160..6ac82db2be 100644
--- a/src/IECoreScene/CurvesPrimitive.cpp
+++ b/src/IECoreScene/CurvesPrimitive.cpp
@@ -34,8 +34,6 @@
#include "IECoreScene/CurvesPrimitive.h"
-#include "IECoreScene/Renderer.h"
-
#include "IECore/MurmurHash.h"
using namespace IECore;
@@ -215,11 +213,6 @@ void CurvesPrimitive::setTopology( ConstIntVectorDataPtr verticesPerCurve, const
}
}
-void CurvesPrimitive::render( Renderer *renderer ) const
-{
- renderer->curves( m_basis, m_periodic, m_vertsPerCurve, variables );
-}
-
size_t CurvesPrimitive::variableSize( PrimitiveVariable::Interpolation interpolation ) const
{
switch( interpolation )
diff --git a/src/IECoreScene/DiskPrimitive.cpp b/src/IECoreScene/DiskPrimitive.cpp
index 410aded8cb..e36ddf8277 100644
--- a/src/IECoreScene/DiskPrimitive.cpp
+++ b/src/IECoreScene/DiskPrimitive.cpp
@@ -34,8 +34,6 @@
#include "IECoreScene/DiskPrimitive.h"
-#include "IECoreScene/Renderer.h"
-
#include "IECore/Exception.h"
#include "IECore/MurmurHash.h"
@@ -126,12 +124,6 @@ Imath::Box3f DiskPrimitive::bound() const
);
}
-void DiskPrimitive::render( Renderer *renderer ) const
-{
- assert( renderer );
- renderer->disk( m_radius, m_z, m_thetaMax, variables );
-}
-
void DiskPrimitive::copyFrom( const Object *other, IECore::Object::CopyContext *context )
{
Primitive::copyFrom( other, context );
diff --git a/src/IECoreScene/EditBlock.cpp b/src/IECoreScene/EditBlock.cpp
deleted file mode 100644
index e045e0fda0..0000000000
--- a/src/IECoreScene/EditBlock.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-//////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2014, Image Engine Design Inc. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// * Neither the name of Image Engine Design nor the names of any
-// other contributors to this software may be used to endorse or
-// promote products derived from this software without specific prior
-// written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-//////////////////////////////////////////////////////////////////////////
-
-#include "IECoreScene/EditBlock.h"
-
-#include "IECoreScene/Renderer.h"
-
-using namespace IECore;
-using namespace IECoreScene;
-
-EditBlock::EditBlock( Renderer *renderer, const std::string &editType, const CompoundDataMap ¶meters )
- : m_renderer( renderer )
-{
- if( m_renderer )
- {
- m_renderer->editBegin( editType, parameters );
- }
-}
-
-EditBlock::~EditBlock()
-{
- if( m_renderer )
- {
- m_renderer->editEnd();
- }
-}
-
diff --git a/src/IECoreScene/ExternalProcedural.cpp b/src/IECoreScene/ExternalProcedural.cpp
index f403131ccd..04cf3e65ea 100644
--- a/src/IECoreScene/ExternalProcedural.cpp
+++ b/src/IECoreScene/ExternalProcedural.cpp
@@ -34,8 +34,6 @@
#include "IECoreScene/ExternalProcedural.h"
-#include "IECoreScene/Renderer.h"
-
using namespace IECore;
using namespace IECoreScene;
@@ -86,11 +84,6 @@ const CompoundData *ExternalProcedural::parameters() const
return m_parameters.get();
}
-void ExternalProcedural::render( Renderer *renderer ) const
-{
- renderer->procedural( new Renderer::ExternalProcedural( m_fileName, m_bound, m_parameters->readable() ) );
-}
-
Imath::Box3f ExternalProcedural::bound() const
{
return m_bound;
diff --git a/src/IECoreScene/Font.cpp b/src/IECoreScene/Font.cpp
index 56d6b2b577..ce2241fc4a 100644
--- a/src/IECoreScene/Font.cpp
+++ b/src/IECoreScene/Font.cpp
@@ -34,8 +34,6 @@
#include "IECoreScene/Font.h"
-#include "IECoreScene/Group.h"
-#include "IECoreScene/MatrixTransform.h"
#include "IECoreScene/MeshAlgo.h"
#include "IECoreScene/MeshPrimitive.h"
#include "IECoreScene/TransformOp.h"
@@ -397,44 +395,6 @@ class Font::Implementation : public IECore::RefCounted
return MeshAlgo::merge( meshes );
}
- GroupPtr meshGroup( const std::string &text ) const
- {
- GroupPtr result = new Group;
-
- if( !text.size() )
- {
- return result;
- }
-
- V3f translate( 0.0f );
- for( unsigned i=0; iprimitive->variableSize( PrimitiveVariable::Uniform ) )
- {
- GroupPtr g = new Group;
- g->addChild( character->primitive->copy() );
- g->setTransform( new MatrixTransform( M44f().setTranslation( translate ) ) );
- result->addChild( g );
- }
-
- if( iadvance;
@@ -642,11 +602,6 @@ MeshPrimitivePtr Font::mesh( const std::string &text ) const
return m_implementation->mesh( text );
}
-GroupPtr Font::meshGroup( const std::string &text ) const
-{
- return m_implementation->meshGroup( text );
-}
-
Imath::V2f Font::advance( char first, char second ) const
{
return m_implementation->advance( first, second );
diff --git a/src/IECoreScene/Group.cpp b/src/IECoreScene/Group.cpp
deleted file mode 100644
index 430fe73c97..0000000000
--- a/src/IECoreScene/Group.cpp
+++ /dev/null
@@ -1,486 +0,0 @@
-//////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2007-2013, Image Engine Design Inc. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// * Neither the name of Image Engine Design nor the names of any
-// other contributors to this software may be used to endorse or
-// promote products derived from this software without specific prior
-// written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-//////////////////////////////////////////////////////////////////////////
-
-#include "IECoreScene/Group.h"
-
-#include "IECoreScene/AttributeBlock.h"
-#include "IECoreScene/AttributeState.h"
-#include "IECoreScene/Renderer.h"
-
-#include "IECore/MurmurHash.h"
-
-#include "Imath/ImathBoxAlgo.h"
-
-#include "boost/format.hpp"
-#include "boost/lexical_cast.hpp"
-
-#include
-
-using namespace IECore;
-using namespace IECoreScene;
-using namespace std;
-using namespace Imath;
-
-static IndexedIO::EntryID g_transformEntry("transform");
-static IndexedIO::EntryID g_stateEntry("state");
-static IndexedIO::EntryID g_childrenEntry("children");
-const unsigned int Group::m_ioVersion = 0;
-
-IE_CORE_DEFINEOBJECTTYPEDESCRIPTION( Group );
-
-Group::Group()
- : m_transform( nullptr ), m_parent( nullptr )
-{
-}
-
-Group::~Group()
-{
- clearChildren();
-}
-
-Transform *Group::getTransform()
-{
- return m_transform.get();
-}
-
-const Transform *Group::getTransform() const
-{
- return m_transform.get();
-}
-
-void Group::setTransform( TransformPtr transform )
-{
- m_transform = transform;
-}
-
-Imath::M44f Group::transformMatrix( float time ) const
-{
- ConstTransformPtr t = getTransform();
- if( t )
- {
- return t->transform( time );
- }
- return Imath::M44f(); // identity
-}
-
-Imath::M44f Group::globalTransformMatrix( float time ) const
-{
- if( m_parent )
- {
- return transformMatrix( time ) * m_parent->globalTransformMatrix( time );
- }
- return transformMatrix( time );
-}
-
-void Group::addState( StateRenderablePtr state )
-{
- if( !state )
- {
- throw InvalidArgumentException( "Cannot add null state object." );
- }
- if( state->isInstanceOf( Transform::staticTypeId() ) )
- {
- throw Exception( "Transforms cannot be added as state." );
- }
- m_state.push_back( state );
-}
-
-void Group::removeState( StateRenderablePtr state )
-{
- StateContainer::iterator it = find( m_state.begin(), m_state.end(), state );
- if( it==m_state.end() )
- {
- throw Exception( "State not present in Group" );
- }
- m_state.erase( it );
-}
-
-void Group::clearState()
-{
- m_state.clear();
-}
-
-const Group::StateContainer &Group::state() const
-{
- return m_state;
-}
-
-const Data *Group::getAttribute( const std::string &name ) const
-{
- StateContainer::const_reverse_iterator it = m_state.rbegin();
- for( ; it != m_state.rend(); ++it )
- {
- if( ConstAttributeStatePtr attr = runTimeCast< const AttributeState >( *it ) )
- {
- CompoundDataMap::const_iterator attrIt = attr->attributes().find( name );
- if( attrIt != attr->attributes().end() )
- {
- return attrIt->second.get();
- }
- }
- }
-
- if( m_parent )
- {
- return m_parent->getAttribute( name );
- }
-
- return nullptr;
-}
-
-void Group::setAttribute( const std::string &name, ConstDataPtr value )
-{
- // find existing attribute/override it ?
- StateContainer::iterator it = m_state.begin();
- AttributeStatePtr attrFound;
- for( ; it != m_state.end(); ++it )
- {
- if( AttributeStatePtr attr = runTimeCast< AttributeState >( *it ) )
- {
- attrFound = attr;
- CompoundDataMap::iterator attrIt = attr->attributes().find( name );
- if( attrIt != attr->attributes().end() )
- {
- attr->attributes()[ name ] = value->copy();
- return;
- }
- }
- }
-
- if( !attrFound )
- {
- attrFound = new AttributeState;
- addState( attrFound );
- }
-
- attrFound->attributes()[ name ] = value->copy();
-}
-
-void Group::addChild( VisibleRenderablePtr child )
-{
- if( !child )
- {
- throw InvalidArgumentException( "Cannot add null child object." );
- }
-
- GroupPtr gChild = runTimeCast( child );
- if( gChild )
- {
- GroupPtr gChildParent = gChild->parent();
- if( gChildParent )
- {
- gChildParent->removeChild( gChild );
- }
- gChild->m_parent = this;
- }
- m_children.push_back( child );
-}
-
-void Group::removeChild( VisibleRenderablePtr child )
-{
- ChildContainer::iterator it = find( m_children.begin(), m_children.end(), child );
-
- if( it==m_children.end() )
- {
- throw Exception( "Child is not a member of Group" );
- }
-
- GroupPtr gChild = runTimeCast( child );
- if( gChild )
- {
- gChild->m_parent = nullptr;
- }
-
- m_children.erase( it );
-}
-
-void Group::clearChildren()
-{
- while( m_children.size() )
- {
- removeChild( m_children[0] );
- }
-}
-
-const Group::ChildContainer &Group::children() const
-{
- return m_children;
-}
-
-Group *Group::parent()
-{
- return m_parent;
-}
-
-const Group *Group::parent() const
-{
- return m_parent;
-}
-
-void Group::copyFrom( const Object *other, CopyContext *context )
-{
- VisibleRenderable::copyFrom( other, context );
- const Group *tOther = static_cast( other );
- if( tOther->m_transform )
- {
- m_transform = context->copy( tOther->m_transform.get() );
- }
- else
- {
- m_transform = nullptr;
- }
- clearState();
- for( StateContainer::const_iterator it=tOther->state().begin(); it!=tOther->state().end(); it++ )
- {
- addState( context->copy( it->get() ) );
- }
- clearChildren();
- for( ChildContainer::const_iterator it=tOther->children().begin(); it!=tOther->children().end(); it++ )
- {
- addChild( context->copy( it->get() ) );
- }
-}
-
-void Group::save( SaveContext *context ) const
-{
- VisibleRenderable::save( context );
- IndexedIOPtr container = context->container( staticTypeName(), m_ioVersion );
- if( m_transform )
- {
- context->save( m_transform.get(), container.get(), g_transformEntry );
- }
- IndexedIOPtr stateContainer = container->subdirectory( g_stateEntry, IndexedIO::CreateIfMissing );
- int i = 0;
- for( StateContainer::const_iterator it=state().begin(); it!=state().end(); it++ )
- {
- string name = str( boost::format( "%d" ) % i );
- context->save( it->get(), stateContainer.get(), name );
- i++;
- }
- IndexedIOPtr childrenContainer = container->subdirectory( g_childrenEntry, IndexedIO::CreateIfMissing );
- i = 0;
- for( ChildContainer::const_iterator it = children().begin(); it!=children().end(); it++ )
- {
- string name = str( boost::format( "%d" ) % i );
- context->save( it->get(), childrenContainer.get(), name );
- i++;
- }
-}
-
-bool Group::entryListCompare( const IndexedIO::EntryID& a, const IndexedIO::EntryID& b )
-{
- int a_idx( 0 );
- int b_idx( 0 );
-
- try
- {
- a_idx = boost::lexical_cast( a.value() );
- }
- catch (...)
- {
- }
- try
- {
- b_idx = boost::lexical_cast( b.value() );
- }
- catch (...)
- {
- }
-
- return a_idx < b_idx;
-}
-
-void Group::load( LoadContextPtr context )
-{
- VisibleRenderable::load( context );
- unsigned int v = m_ioVersion;
-
- ConstIndexedIOPtr container = context->container( staticTypeName(), v );
- m_transform = nullptr;
- try
- {
- m_transform = context->load( container.get(), g_transformEntry );
- }
- catch( ... )
- {
- }
- clearState();
-
- ConstIndexedIOPtr stateContainer = container->subdirectory( g_stateEntry );
- IndexedIO::EntryIDList l;
- stateContainer->entryIds( l );
- sort( l.begin(), l.end(), entryListCompare );
- for( IndexedIO::EntryIDList::const_iterator it=l.begin(); it!=l.end(); it++ )
- {
- addState( context->load( stateContainer.get(), *it ) );
- }
- clearChildren();
- ConstIndexedIOPtr childrenContainer = container->subdirectory( g_childrenEntry );
- childrenContainer->entryIds( l );
- sort( l.begin(), l.end(), entryListCompare );
- for( IndexedIO::EntryIDList::const_iterator it=l.begin(); it!=l.end(); it++ )
- {
- addChild( context->load( childrenContainer.get(), *it ) );
- }
-}
-
-bool Group::isEqualTo( const Object *other ) const
-{
- if( !VisibleRenderable::isEqualTo( other ) )
- {
- return false;
- }
-
- const Group *tOther = static_cast( other );
-
- // check transform
- if( (bool)m_transform != (bool)tOther->m_transform )
- {
- return false;
- }
-
- if( m_transform && !tOther->m_transform->isEqualTo( m_transform.get() ) )
- {
- return false;
- }
-
- // check state
- if( m_state.size()!=tOther->m_state.size() )
- {
- return false;
- }
- for( size_t i=0; iisEqualTo( tOther->m_state[i].get() ) )
- {
- return false;
- }
- }
-
- // check children
- if( m_children.size()!=tOther->m_children.size() )
- {
- return false;
- }
- for( size_t i=0; iisEqualTo( tOther->m_children[i].get() ) )
- {
- return false;
- }
- }
-
- return true;
-}
-
-void Group::memoryUsage( Object::MemoryAccumulator &a ) const
-{
- VisibleRenderable::memoryUsage( a );
- if( m_transform )
- {
- a.accumulate( m_transform.get() );
- }
- for( StateContainer::const_iterator it=state().begin(); it!=state().end(); it++ )
- {
- a.accumulate( it->get() );
- }
- for( ChildContainer::const_iterator it=children().begin(); it!=children().end(); it++ )
- {
- a.accumulate( it->get() );
- }
-}
-
-void Group::hash( MurmurHash &h ) const
-{
- VisibleRenderable::hash( h );
- if( m_transform )
- {
- m_transform->hash( h );
- }
-
- for( StateContainer::const_iterator it=state().begin(); it!=state().end(); it++ )
- {
- (*it)->hash( h );
- }
-
- for( ChildContainer::const_iterator it=children().begin(); it!=children().end(); it++ )
- {
- (*it)->hash( h );
- }
-}
-
-void Group::render( Renderer *renderer ) const
-{
- render( renderer, true );
-}
-
-void Group::render( Renderer *renderer, bool inAttributeBlock ) const
-{
- /// \todo I wonder if this should just use a transform block if
- /// the Group doesn't have any state?
- AttributeBlock attributeBlock( renderer, inAttributeBlock );
-
- if( m_transform )
- {
- m_transform->render( renderer );
- }
- renderState( renderer );
- renderChildren( renderer );
-}
-
-void Group::renderState( Renderer *renderer ) const
-{
- for( StateContainer::const_iterator it=state().begin(); it!=state().end(); it++ )
- {
- (*it)->render( renderer );
- }
-}
-
-void Group::renderChildren( Renderer *renderer ) const
-{
- for( ChildContainer::const_iterator it=children().begin(); it!=children().end(); it++ )
- {
- (*it)->render( renderer );
- }
-}
-
-Imath::Box3f Group::bound() const
-{
- Box3f result;
- for( ChildContainer::const_iterator it=children().begin(); it!=children().end(); it++ )
- {
- result.extendBy( (*it)->bound() );
- }
- return transform( result, transformMatrix() );
-}
diff --git a/src/IECoreScene/Light.cpp b/src/IECoreScene/Light.cpp
deleted file mode 100644
index ecd463704a..0000000000
--- a/src/IECoreScene/Light.cpp
+++ /dev/null
@@ -1,174 +0,0 @@
-//////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2010-2013, Image Engine Design Inc. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// * Neither the name of Image Engine Design nor the names of any
-// other contributors to this software may be used to endorse or
-// promote products derived from this software without specific prior
-// written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-//////////////////////////////////////////////////////////////////////////
-
-#include "IECoreScene/Light.h"
-
-#include "IECoreScene/Renderer.h"
-
-#include "IECore/MurmurHash.h"
-
-#include "boost/format.hpp"
-
-using namespace IECore;
-using namespace IECoreScene;
-using namespace boost;
-
-static IndexedIO::EntryID g_nameEntry("name");
-static IndexedIO::EntryID g_handleEntry("handle");
-static IndexedIO::EntryID g_parametersEntry("parameters");
-
-
-const unsigned int Light::m_ioVersion = 0;
-Object::TypeDescription