Cortex  10.0.0-a4
GR_CortexPrimitive.h
1 //
3 // Copyright (c) 2013-2015, 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 
37 #include "UT/UT_Version.h"
38 #if UT_MAJOR_VERSION_INT > 12 || UT_MINOR_VERSION_INT >= 5
39 
40 #ifndef IECOREHOUDINI_GRCORTEXPRIMITIVE_H
41 #define IECOREHOUDINI_GRCORTEXPRIMITIVE_H
42 
43 #include "GR/GR_Primitive.h"
44 
45 #include "IECore/Renderable.h"
46 
47 // We can't include any IECoreGL files here, because it
48 // causes an issue with gl/glew initialization order.
49 namespace IECoreGL
50 {
51 
52 IE_CORE_FORWARDDECLARE( Scene );
53 IE_CORE_FORWARDDECLARE( State );
54 
55 }
56 
57 namespace IECoreHoudini
58 {
59 
61 class GR_CortexPrimitive : public GR_Primitive
62 {
63  public :
64 
65  GR_CortexPrimitive( const GR_RenderInfo *info, const char *cache_name, const GEO_Primitive *prim );
66  virtual ~GR_CortexPrimitive();
67 
68  virtual const char *className() const
69  {
70  return "GR_CortexPrimitive";
71  };
72 
73  virtual GR_PrimAcceptResult acceptPrimitive( GT_PrimitiveType t, int geo_type, const GT_PrimitiveHandle &ph, const GEO_Primitive *prim );
74  virtual void resetPrimitives();
75 
76  protected :
77 
78  virtual void update( RE_Render *r, const GT_PrimitiveHandle &primh, const GR_UpdateParms &p );
79 
80 #if UT_MAJOR_VERSION_INT >= 16
81 
82  virtual void render( RE_Render *r, GR_RenderMode render_mode, GR_RenderFlags flags, GR_DrawParms parms);
83 
84 #else
85 
86  virtual void render( RE_Render *r, GR_RenderMode render_mode, GR_RenderFlags flags, const GR_DisplayOption *opt, const UT_Array<RE_MaterialPtr> *materials );
87 
88 #endif
89 
90  virtual void renderInstances( RE_Render *r, GR_RenderMode render_mode, GR_RenderFlags flags, const GR_DisplayOption *opt, const UT_Array<RE_MaterialPtr> *materials, int render_instance );
91  virtual int renderPick( RE_Render *r, const GR_DisplayOption *opt, unsigned int pick_type, GR_PickStyle pick_style, bool has_pick_map );
92 
93  private :
94 
95  GA_Index m_primId;
96  IECoreGL::ScenePtr m_scene;
97  const IECore::Renderable *m_renderable;
98 
99  IECoreGL::State *getState( GR_RenderMode mode, GR_RenderFlags flags, const GR_DisplayOption *opt );
100 
101  const std::string &pickFragmentSource();
102 
103  static IECoreGL::StatePtr g_lit;
104  static IECoreGL::StatePtr g_shaded;
105  static IECoreGL::StatePtr g_wire;
106  static IECoreGL::StatePtr g_wireLit;
107  static IECoreGL::StatePtr g_wireShaded;
108  static IECoreGL::StatePtr g_wireConstGhost;
109  static IECoreGL::StatePtr g_wireConstBG;
110  static IECoreGL::StatePtr g_pick;
111  static IECoreGL::StatePtr g_selected;
112  static IECoreGL::StatePtr g_wireSelected;
113  static IECoreGL::StatePtr g_wireConstBGSelected;
114  static IECoreGL::StatePtr g_wireConstGhostSelected;
115 
116 };
117 
118 } // namespace IECoreHoudini
119 
120 #endif // IECOREHOUDINI_GRCORTEXPRIMITIVE_H
121 
122 #endif // 12.5 or later
The namespace within which all CoreGL functionality is defined.
Definition: AlphaTexture.h:41
The IECoreHoudini namespace holds all the functionality of libIECoreHoudini.
Definition: CoreHoudini.h:51
Definition: Renderable.h:48