Cortex  10.0.0-a4
Renderer.h
1 //
3 // Copyright (c) 2007-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 IE_CORE_RENDERER_H
36 #define IE_CORE_RENDERER_H
37 
38 #include "IECore/Export.h"
39 #include "IECore/RunTimeTyped.h"
40 #include "IECore/PrimitiveVariable.h"
41 #include "IECore/VectorTypedData.h"
42 #include "IECore/CompoundData.h"
43 #include "IECore/CubicBasis.h"
44 #include "IECore/MurmurHash.h"
45 
46 #include "OpenEXR/ImathMatrix.h"
47 #include "OpenEXR/ImathBox.h"
48 
49 #include <set>
50 
51 namespace IECore
52 {
53 
54 IE_CORE_FORWARDDECLARE( Renderer );
55 
93 class IECORE_API Renderer : public RunTimeTyped
94 {
95 
96  public :
97 
98  IE_CORE_DECLARERUNTIMETYPED( Renderer, RunTimeTyped );
99 
100  Renderer();
101  ~Renderer() override;
102 
122 
123  virtual void setOption( const std::string &name, ConstDataPtr value ) = 0;
126  virtual ConstDataPtr getOption( const std::string &name ) const = 0;
128 
172  virtual void camera( const std::string &name, const CompoundDataMap &parameters ) = 0;
173 
179  virtual void display( const std::string &name, const std::string &type, const std::string &data, const CompoundDataMap &parameters ) = 0;
180 
185 
186  virtual void worldBegin() = 0;
190  virtual void worldEnd() = 0;
192 
197 
198  virtual void transformBegin() = 0;
203  virtual void transformEnd() = 0;
205  virtual void setTransform( const Imath::M44f &m ) = 0;
208  virtual void setTransform( const std::string &coordinateSystem ) = 0;
210  virtual Imath::M44f getTransform() const = 0;
212  virtual Imath::M44f getTransform( const std::string &coordinateSystem ) const = 0;
214  virtual void concatTransform( const Imath::M44f &m ) = 0;
217  virtual void coordinateSystem( const std::string &name ) = 0;
219 
225 
226  virtual void attributeBegin() = 0;
231  virtual void attributeEnd() = 0;
268  virtual void setAttribute( const std::string &name, ConstDataPtr value ) = 0;
270  virtual ConstDataPtr getAttribute( const std::string &name ) const = 0;
272  virtual void shader( const std::string &type, const std::string &name, const CompoundDataMap &parameters ) = 0;
274  virtual void light( const std::string &name, const std::string &handle, const CompoundDataMap &parameters ) = 0;
276  virtual void illuminate( const std::string &lightHandle, bool on ) = 0;
278 
281 
282  virtual void motionBegin( const std::set<float> &times ) = 0;
289  virtual void motionEnd() = 0;
291 
301 
302  virtual void points( size_t numPoints, const PrimitiveVariableMap &primVars ) = 0;
307  virtual void disk( float radius, float z, float thetaMax, const PrimitiveVariableMap &primVars ) = 0;
309  virtual void curves( const CubicBasisf &basis, bool periodic, ConstIntVectorDataPtr numVertices, const IECore::PrimitiveVariableMap &primVars ) = 0;
311  virtual void text( const std::string &font, const std::string &text, float kerning = 1.0f, const PrimitiveVariableMap &primVars=PrimitiveVariableMap() ) = 0;
316  virtual void sphere( float radius, float zMin, float zMax, float thetaMax, const PrimitiveVariableMap &primVars ) = 0;
319  virtual void image( const Imath::Box2i &dataWindow, const Imath::Box2i &displayWindow, const PrimitiveVariableMap &primVars ) = 0;
323  virtual void mesh( ConstIntVectorDataPtr vertsPerFace, ConstIntVectorDataPtr vertIds, const std::string &interpolation, const PrimitiveVariableMap &primVars ) = 0;
325  virtual void nurbs( int uOrder, ConstFloatVectorDataPtr uKnot, float uMin, float uMax, int vOrder, ConstFloatVectorDataPtr vKnot, float vMin, float vMax, const PrimitiveVariableMap &primVars ) = 0;
327  virtual void patchMesh( const CubicBasisf &uBasis, const CubicBasisf &vBasis, int nu, bool uPeriodic, int nv, bool vPeriodic, const PrimitiveVariableMap &primVars ) = 0;
329  virtual void geometry( const std::string &type, const CompoundDataMap &topology, const PrimitiveVariableMap &primVars ) = 0;
331 
335  class IECORE_API Procedural : public RefCounted
336  {
337  public :
338 
339  IE_CORE_DECLAREMEMBERPTR( Procedural );
340 
341  Procedural();
342  ~Procedural() override;
343 
347  virtual Imath::Box3f bound() const = 0;
352  virtual void render( Renderer *renderer ) const = 0;
358  virtual MurmurHash hash() const = 0;
359 
365  static const Imath::Box3f noBound;
366 
367  };
368  IE_CORE_DECLAREPTR( Procedural );
369 
372  class IECORE_API ExternalProcedural : public Procedural
373  {
374  public :
375 
376  IE_CORE_DECLAREMEMBERPTR( ExternalProcedural )
377 
378  ExternalProcedural( const std::string &fileName, const Imath::Box3f &bound, const CompoundDataMap &parameters );
379  ~ExternalProcedural() override;
380 
381  const std::string &fileName() const;
382  const CompoundDataMap &parameters() const;
383 
384  Imath::Box3f bound() const override;
385  void render( Renderer *renderer ) const override;
386  MurmurHash hash() const override;
387 
388  private :
389 
390  std::string m_fileName;
391  Imath::Box3f m_bound;
392  CompoundDataMap m_parameters;
393 
394  };
395  IE_CORE_DECLAREPTR( ExternalProcedural );
396 
398  virtual void procedural( ProceduralPtr proc ) = 0;
399 
404 
405  virtual void instanceBegin( const std::string &name, const CompoundDataMap &parameters ) = 0;
408  virtual void instanceEnd() = 0;
411  virtual void instance( const std::string &name ) = 0;
413 
423  virtual DataPtr command( const std::string &name, const CompoundDataMap &parameters ) = 0;
424 
429 
430  virtual void editBegin( const std::string &editType, const CompoundDataMap &parameters ) = 0;
436  virtual void editEnd() = 0;
438 
439 };
440 
441 }
442 
443 #endif // IE_CORE_RENDERER_H
static const Imath::Box3f noBound
Definition: Renderer.h:365
Definition: Renderer.h:335
Definition: MurmurHash.h:64
Definition: Renderer.h:93
std::map< InternedString, DataPtr > CompoundDataMap
The type of Data held by the CompoundData typedef.
Definition: CompoundDataBase.h:46
Definition: Renderer.h:372
Definition: RefCounted.h:124
Definition: RunTimeTyped.h:211
This namespace contains all components of the core library.
Definition: AddSmoothSkinningInfluencesOp.h:43
std::map< std::string, PrimitiveVariable > PrimitiveVariableMap
A simple type to hold named PrimitiveVariables.
Definition: PrimitiveVariable.h:107