40 using namespace HDK_Sample;
66 :
GR_Primitive(info, cache_name, GA_PrimCompat::TypeMask(0))
106 const char *posname =
"P";
107 const char *nmlname =
"N";
117 getGEOPrimFromGT<GEO_PrimTetra>(primh, tet);
119 const int num_tets = tet ? 1 : 0;
132 for(
int v=0;
v<4;
v++)
167 for(
int t=0;
t<num_tets;
t++)
170 pdata[1] = pt(
t*4+1);
171 pdata[2] = pt(
t*4+2);
174 pdata[4] = pt(
t*4+2);
175 pdata[5] = pt(
t*4+3);
177 pdata[6] = pt(
t*4+1);
178 pdata[7] = pt(
t*4+2);
179 pdata[8] = pt(
t*4+3);
182 pdata[10] = pt(
t*4+3);
183 pdata[11] = pt(
t*4+1);
212 for(
int t=0;
t<num_tets;
t++)
219 ndata[0] = ndata[1] = ndata[2] = n0;
220 ndata[3] = ndata[4] = ndata[5] = n1;
221 ndata[6] = ndata[7] = ndata[8] = n2;
222 ndata[9] = ndata[10] = ndata[11] = n3;
237 fpreal32 col[3] = { 1.0, 1.0, 1.0 };
264 static RE_ShaderHandle theNQFlatShader(
"material/GL32/beauty_flat_lit.prog");
265 static RE_ShaderHandle theNQUnlitShader(
"material/GL32/beauty_unlit.prog");
266 static RE_ShaderHandle theHQShader(
"material/GL32/beauty_material.prog");
270 static RE_ShaderHandle theZLinearShader(
"basic/GL32/depth_linear.prog");
363 mat->updateShaderForMaterial(r, 0,
true,
377 if(need_wire && !polyoff)
411 unsigned int pick_type,
void unmap(RE_Render *r, int array_index=0)
GR_DecorationRender * myDecorRender
GA_API const UT_StringHolder uv
GU_ConstDetailHandle geometry
const GR_DisplayOption * opts
RE_CacheVersion geo_version
A collection of vertex arrays defining a geometry object. This class acts as a wrapper around multipl...
GT_API const UT_StringHolder cache_name
void draw(RE_Render *r, int connect_idx, RE_PrimType prim_type=RE_PRIM_AS_IS, RE_OverrideList *attrib_overrides=nullptr)
const RE_MaterialPtr & getDefaultMaterial() const
SYS_FORCE_INLINE const GA_PrimitiveTypeId & getTypeId() const
void drawInstanceGroup(RE_Render *r, int connect_idx, int instance_group, RE_PrimType prim_type=RE_PRIM_AS_IS, RE_OverrideList *attrib_over=nullptr)
Draw an instance group using a given connectivity.
void renderDecoration(RE_RenderContext r, GR_Decoration decor, const GR_DecorationParms &parms) override
SYS_FORCE_INLINE UT_Vector3 getPos3(GA_Offset ptoff) const
The ptoff passed is the point offset.
RE_CacheVersion instance_version
Temporary container for either a RV_Render and an RE_Render.
const char * getCacheName() const
The base GL cache name assigned to this primitive.
SIM_DerVector3 normalize() const
set of parameters sent to GR_Primitive::update()
GR_PrimAcceptResult acceptPrimitive(GT_PrimitiveType t, int geo_type, const GT_PrimitiveHandle &ph, const GEO_Primitive *prim) override
~GR_PrimTetraHook() override
const GR_DisplayOption & dopts
GR_DecorRenderFlags render_flags
const GR_DisplayOption * opts
int renderPick(RE_RenderContext r, const GR_DisplayOption *opt, unsigned int pick_type, GR_PickStyle pick_style, bool has_pick_map) override
const GR_LightList * getLightList() const
void bindForShader(RE_Render *r, RE_Shader *sh) const
constexpr enabler dummy
An instance to use in EnableIf.
GR_API bool buildInstanceObjectMatrix(RE_Render *r, const GT_PrimitiveHandle &h, const GR_UpdateParms &p, RE_Geometry *geo, RE_CacheVersion version, int instance_group=0, UT_Matrix4D *transform=NULL)
GLfloat GLfloat GLfloat alpha
SYS_FORCE_INLINE int get() const
SYS_FORCE_INLINE GA_Offset vertexPoint(GA_Offset vertex) const
Given a vertex, return the point it references.
RE_CacheVersion getCacheVersion() const
void polygonOffset(bool onoff)
#define RE_GEO_SHADED_IDX
void render(RE_RenderContext r, GR_RenderMode render_mode, GR_RenderFlags flags, GR_DrawParms dp) override
const RE_MaterialAtlas * materials
void setCacheVersion(RE_CacheVersion v)
GR_API void buildInstanceIndex(RE_Render *r, RE_Geometry *geo, bool has_partial_visibility, const UT_IntArray &inst_indices, int instance_group, int max_capacity)
int connectAllPrims(RE_Render *r, int connect_index, RE_PrimType prim, const RE_MaterialPtr &mat=nullptr, bool replace=false, int vertices_per_patch=0)
Primitive Connectivity .
RE_VertexArray * createConstAttribute(RE_Render *r, const char *attrib_name, RE_GPUType data_format, int vectorsize, const void *data)
Create a constant attribute value Only RE_GPU_FLOAT32 and _FLOAT64 are supported for constant data...
const RE_MaterialPtr & getFactoryMaterial() const
void update(RE_RenderContext r, const GT_PrimitiveHandle &primh, const GR_UpdateParms &p) override
GR_Primitive * createPrimitive(const GT_PrimitiveHandle >_prim, const GEO_Primitive *geo_prim, const GR_RenderInfo *info, const char *cache_name, GR_PrimAcceptResult &processed) override
virtual void removeOverrideBlocks()
Remove all override blocks from the shader.
GR_DecorationOverride required_dec
SYS_FORCE_INLINE GA_Offset getVertexOffset(GA_Size primvertexnum) const
void * map(RE_Render *r, RE_BufferAccess access=RE_BUFFER_WRITE_ONLY, int array_index=0)
GR_PrimTetra(const GR_RenderInfo *info, const char *cache_name, const GEO_Primitive *prim)
bool cacheBuffers(const char *name)
Caching .
void setupFromDisplayOptions(const GR_DisplayOption &opts, GR_DecorationOverride select_dec, GR_UpdateParms &parms, const GR_Decoration *supported, GR_AttribMask mask)
void drawDecorationForGeo(RE_RenderContext r, RE_Geometry *geo, GR_Decoration dec, const GR_DisplayOption *opts, GR_DecorRenderFlags flags, bool overlay, bool override_vis, int instance_group, GR_SelectMode smode, GR_DecorationRender::PrimitiveType t=GR_DecorationRender::PRIM_TRIANGLE, RE_OverrideList *override_list=NULL)
bool setNumPoints(int num)
Number of points in the geometry. Number of points for the arrays declared as RE_ARRAY_POINT. This will clear the data in all point arrays and reset the connectivty.
RE_VertexArray * findCachedAttrib(RE_Render *r, const char *attrib_name, RE_GPUType data_format, int vectorsize, RE_ArrayType array_type, bool create_if_missing=false, int random_array_size=-1, const RE_CacheVersion *cv=nullptr, RE_BufferUsageHint h=RE_BUFFER_WRITE_FREQUENT, const char *cache_prefix=nullptr, int capacity=-1)
Find an attribute or array in the GL cache, possibly creating it Returns the cached array...
SIM_DerVector3 cross(const SIM_DerVector3 &lhs, const SIM_DerVector3 &rhs)
const GU_Detail * getGdp() const
void popShader(int *nest=nullptr)
void bindShader(RE_Shader *s)
Simple interface to building a shader from a .prog file.
const RE_LightList * glLights() const