Cortex  10.0.0-a4
SXRenderer.h
1 //
3 // Copyright (c) 2010-2013, Image Engine Design Inc. All rights reserved.
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 //
12 // * Redistributions in binary form must reproduce the above copyright
13 // notice, this list of conditions and the following disclaimer in the
14 // documentation and/or other materials provided with the distribution.
15 //
16 // * Neither the name of Image Engine Design nor the names of any
17 // other contributors to this software may be used to endorse or
18 // promote products derived from this software without specific prior
19 // written permission.
20 //
21 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
22 // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23 // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
25 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 //
34 
35 #ifndef IECORERI_SXRENDERER_H
36 #define IECORERI_SXRENDERER_H
37 
38 #include "IECoreRI/TypeIds.h"
39 
40 #include "IECore/Renderer.h"
41 
42 #include "IECoreImage/ImagePrimitive.h"
43 
44 #include "IECoreRI/Export.h"
45 
46 namespace IECoreRI
47 {
48 
49 IE_CORE_FORWARDDECLARE( SXRendererImplementation );
50 
51 class IECORERI_API SXRenderer : public IECore::Renderer
52 {
53 
54  public :
55 
56  SXRenderer();
57  ~SXRenderer() override;
58 
59  IE_CORE_DECLARERUNTIMETYPEDEXTENSION( IECoreRI::SXRenderer, SXRendererTypeId, IECore::Renderer );
60 
61  void setOption( const std::string &name, IECore::ConstDataPtr value ) override;
62  IECore::ConstDataPtr getOption( const std::string &name ) const override;
63 
64  void camera( const std::string &name, const IECore::CompoundDataMap &parameters ) override;
65  void display( const std::string &name, const std::string &type, const std::string &data, const IECore::CompoundDataMap &parameters ) override;
66 
67  void worldBegin() override;
68  void worldEnd() override;
69 
70  void transformBegin() override;
71  void transformEnd() override;
72  void setTransform( const Imath::M44f &m ) override;
73  void setTransform( const std::string &coordinateSystem ) override;
74  Imath::M44f getTransform() const override;
75  Imath::M44f getTransform( const std::string &coordinateSystem ) const override;
76  void concatTransform( const Imath::M44f &m ) override;
77  void coordinateSystem( const std::string &name ) override;
78 
79  void attributeBegin() override;
80  void attributeEnd() override;
81 
82  void setAttribute( const std::string &name, IECore::ConstDataPtr value ) override;
83  IECore::ConstDataPtr getAttribute( const std::string &name ) const override;
84 
85  void shader( const std::string &type, const std::string &name, const IECore::CompoundDataMap &parameters ) override;
86  void light( const std::string &name, const std::string &handle, const IECore::CompoundDataMap &parameters ) override;
87  void illuminate( const std::string &lightHandle, bool on ) override;
88 
89  void motionBegin( const std::set<float> &times ) override;
90  void motionEnd() override;
91 
92  void points( size_t numPoints, const IECore::PrimitiveVariableMap &primVars ) override;
93  void disk( float radius, float z, float thetaMax, const IECore::PrimitiveVariableMap &primVars ) override;
94 
95  void curves( const IECore::CubicBasisf &basis, bool periodic, IECore::ConstIntVectorDataPtr numVertices, const IECore::PrimitiveVariableMap &primVars ) override;
96 
97  void text( const std::string &font, const std::string &text, float kerning = 1.0f, const IECore::PrimitiveVariableMap &primVars=IECore::PrimitiveVariableMap() ) override;
98  void sphere( float radius, float zMin, float zMax, float thetaMax, const IECore::PrimitiveVariableMap &primVars ) override;
99 
100  void image( const Imath::Box2i &dataWindow, const Imath::Box2i &displayWindow, const IECore::PrimitiveVariableMap &primVars ) override;
101  void mesh( IECore::ConstIntVectorDataPtr vertsPerFace, IECore::ConstIntVectorDataPtr vertIds, const std::string &interpolation, const IECore::PrimitiveVariableMap &primVars ) override;
102 
103  void nurbs( int uOrder, IECore::ConstFloatVectorDataPtr uKnot, float uMin, float uMax, int vOrder, IECore::ConstFloatVectorDataPtr vKnot, float vMin, float vMax, const IECore::PrimitiveVariableMap &primVars ) override;
104 
105  void patchMesh( const IECore::CubicBasisf &uBasis, const IECore::CubicBasisf &vBasis, int nu, bool uPeriodic, int nv, bool vPeriodic, const IECore::PrimitiveVariableMap &primVars ) override;
106 
107  void geometry( const std::string &type, const IECore::CompoundDataMap &topology, const IECore::PrimitiveVariableMap &primVars ) override;
108 
109  void procedural( IECore::Renderer::ProceduralPtr proc ) override;
110 
111  void instanceBegin( const std::string &name, const IECore::CompoundDataMap &parameters ) override;
112  void instanceEnd() override;
113  void instance( const std::string &name ) override;
114 
115  IECore::DataPtr command( const std::string &name, const IECore::CompoundDataMap &parameters ) override;
116 
117  void editBegin( const std::string &editType, const IECore::CompoundDataMap &parameters ) override;
118  void editEnd() override;
119 
126 
127  IECore::CompoundDataPtr shade( const IECore::CompoundData *points ) const;
128  IECore::CompoundDataPtr shade( const IECore::CompoundData *points, const Imath::V2i &gridSize ) const;
131  IECore::CompoundDataPtr shadePlane( const Imath::V2i &resolution ) const;
133  IECoreImage::ImagePrimitivePtr shadePlaneToImage( const Imath::V2i &resolution ) const;
135 
136  private :
137 
138  IECoreRI::SXRendererImplementationPtr m_implementation;
139 
140 };
141 
142 IE_CORE_DECLAREPTR( SXRenderer );
143 
144 } // namespace IECoreRI
145 
146 #endif // IECORERI_SXRENDERER_H
Definition: CompoundData.h:47
The IECoreRI namespace holds all the functionality implemented in libIECoreRI.
Definition: IECoreRI.h:41
Definition: Renderer.h:93
std::map< InternedString, DataPtr > CompoundDataMap
The type of Data held by the CompoundData typedef.
Definition: CompoundDataBase.h:46
std::map< std::string, PrimitiveVariable > PrimitiveVariableMap
A simple type to hold named PrimitiveVariables.
Definition: PrimitiveVariable.h:107