HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RE_Material.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: Render Library (C++)
7  *
8  * COMMENTS: Material definition for lit geometry
9  *
10  */
11 
12 #ifndef __RE_Material_h__
13 #define __RE_Material_h__
14 
15 #include "RE_API.h"
16 #include <DEP/DEP_MicroNode.h>
17 #include <SYS/SYS_AtomicInt.h>
18 #include <UT/UT_Color.h>
19 #include <UT/UT_IntArray.h>
20 #include <UT/UT_NonCopyable.h>
21 #include <UT/UT_Options.h>
22 #include <UT/UT_Rect.h>
23 #include <UT/UT_String.h>
24 #include <UT/UT_UniquePtr.h>
25 #include <UT/UT_Vector3.h>
26 #include <UT/UT_ValArray.h>
27 #include <UT/UT_XformOrder.h>
28 #include "RE_Types.h"
29 #include "RE_TextureTypes.h"
30 #include "RE_TextureMap.h"
31 #include "RE_UniformBlock.h"
32 
33 class RE_OGLRender;
34 class RE_OGLTexture;
35 class RE_Render;
36 class RE_Shader;
37 class RE_Texture2DMap;
38 class RE_TextureMap;
39 class RE_TextureCubeMap;
40 
42 {
43 public:
44  explicit RE_Material(const char *materialName);
45 
46  const UT_StringHolder &
47  getMaterialName() const { return myMaterialName; }
48  int getUniqueId() const { return myUniqueId; }
49 
50  int64 getVersion() const { return myVersion; }
51  void setVersion(int64 v) { myVersion = v; }
52 
53  void dirty(bool dirty = true) { myDirtyFlag = dirty; }
54  bool isDirty(fpreal time) const
55  {
56  if(myDirtyFlag || myDepNode.isDirty())
57  return true;
58  if(myTimeDep && !SYSisEqual(time, myTime))
59  return true;
60  return false;
61  }
62 
63  void setTimeDependent(bool timedep, fpreal t = 0.0)
64  {
65  myTimeDep = timedep;
66  myTime = timedep ? t : 0.0;
67  }
68  bool isTimeDependent() const { return myTimeDep; }
69  fpreal getCurrentTime() const { return myTime; }
70 
71  void incref() { myRefCount.add(1); }
72  void decref()
73  {
74  if (!myRefCount.add(-1))
75  delete this;
76  }
77 
78  void setNodePath(UT_StringHolder path, int node_id);
79  const UT_StringHolder &
80  getNodePath() const { return myNodePath; }
81  int getNodeId() const { return myNodeID; }
82 
83  // Name of the material network
84  void setMatNetName(const UT_StringRef &mat_path)
85  { myMatNetName = mat_path; }
86  const UT_StringRef &getMatNetName() const
87  { return myMatNetName; }
88  void setMatXNodeVersion(int64 version) { myMatXVersion = version; }
89  int64 getMatXNodeVersion() const { return myMatXVersion; }
90  void dirtyMatNet(bool dirty = true) { myMatNetDirty = dirty; }
91  bool isMatNetDirty() const { return myMatNetDirty; }
92 
93 
94  // Parameter overrides
95  void setOverrides(const UT_Options *overrides);
96  const UT_Options &getOverrides() const { return myOverrides; }
97  bool hasOverrides() const { return myOverrides.getNumOptions()>0; }
98 
99  // Vertex array overrides
101  { myVertexOverrides = ovr; }
103  { return myVertexOverrides; }
104 
106  {
111  MATX_SURFACE
112  };
113  void setMaterialType(RE_MaterialType type);
114  RE_MaterialType getMaterialType() const { return myMaterialType; }
115 
116  void markDefaultShader(bool def) { myDefaultShader = def; }
117  bool isDefaultShader() const { return myDefaultShader; }
118 
119  // Assign a shader by its program ID from RE_Shader::getProgram()
120  void assignShaderRef(int shader_program_id,
122  void assignShader(RE_Shader *sh,
124  bool owned = true);
125  void assignShader(UT_UniquePtr<RE_Shader> &&sh,
127 
128  int getShaderRefID(RE_ShaderTarget ptype=RE_SHADER_TARGET_TRIANGLE) const;
129 
130  // methods to deal with textures
131  void clearTexture(RE_Render *r);
132  void clearDiffuseMap();
133 
134  void reserveDiffuseLayers(int nlayers);
135 
137  {
152 
158 
160 
161  NUM_TEXMAP_TYPES
162  };
163 
164  // General diffuse texture, 1 allowed per layer.
165  RE_TextureHolder getDiffuseMap(RE_Render *r,
166  int layer,
167  bool preload=false,
168  bool mat_changed = true);
169 
170  // Extra textures, only 1 allowed for the first layer.
171  RE_TextureHolder getSpecularMap(RE_Render *r, bool preload = false,
172  bool mat_change = true);
173  RE_TextureHolder getBumpMap(RE_Render *r, bool preload = false,
174  bool mat_change = true);
175  RE_TextureHolder getNormalMap(RE_Render *r, bool preload = false,
176  bool mat_change = true);
177  RE_TextureHolder getOpacityMap(RE_Render *r, bool preload = false,
178  bool mat_change = true);
179  RE_TextureHolder getDisplaceMap(RE_Render *r, bool preload = false,
180  bool mat_change = true);
181  RE_TextureHolder getEmissionMap(RE_Render *r, bool preload = false,
182  bool mat_change = true);
183  RE_TextureHolder getRoughnessMap(RE_Render *r, bool preload = false,
184  bool mat_change = true);
185  RE_TextureHolder getOcclusionMap(RE_Render *r, bool preload = false,
186  bool mat_change = true);
187  RE_TextureHolder getMetallicMap(RE_Render *r, bool preload = false,
188  bool mat_change = true);
189  RE_TextureHolder getCoatIntensityMap(RE_Render *r, bool preload = false,
190  bool mat_change = true);
191  RE_TextureHolder getCoatRoughnessMap(RE_Render *r, bool preload = false,
192  bool mat_change = true);
193  RE_TextureHolder getReflectionAmountMap(RE_Render *r, bool preload = false,
194  bool mat_change = true);
195 
196  RE_TextureHolder getHairDiffuseMap(RE_Render *r, bool preload = false);
197  RE_TextureHolder getHairSpecularMap(RE_Render *r, bool preload = false);
198  RE_TextureHolder getHairDiffuseRamp(RE_Render *r, bool preload = false);
199  RE_TextureHolder getHairSpecularRamp(RE_Render *r, bool preload = false);
200  RE_TextureHolder getHairAlphaRamp(RE_Render *r, bool preload = false);
201 
202  // Environment map to affect specular reflection. One allowed for layer 0.
203  RE_TextureHolder getEnvMap(RE_Render *r, bool preload = false);
204 
205  // Returns the explicit texture unit binding for the given texture uniform
206  // or RE_MATTEX_NONE if there is no explicit binding.
208  getMaterialTextureBinding(const UT_StringRef &texname);
209 
210  // Determine if the texture file is a regular texture (2D map) or a UDIM
211  // (2D Array map)
212  static bool fetchRegOrUDIM(const UT_StringRef &tex_name,
213  const UT_StringRef &node_path,
214  RE_TextureMap *&map,
215  bool allow_preload = false,
216  const char *uvtile_marker = nullptr);
217 
218  bool areTexturesPending() { return myTextureLoadPending; }
219 
220  void clearTextureLayer(int layer);
221 
222  // In order for these to return the correct value, the corresponding
223  // get..() method must be called first.
224  bool hasSpecularMap() const { return mySpecMap.myTex.isValid(); }
225  bool hasBumpMap() const { return myBumpMap.myTex.isValid(); }
226  bool hasNormalMap() const { return myNormalMap.myTex.isValid(); }
227  bool hasOpacityMap() const{ return myOpacityMap.myTex.isValid(); }
228  bool hasDisplaceMap() const{return myDisplaceMap.myTex.isValid();}
229  bool hasEnvMap() const { return myEnvMap.myTex.isValid(); }
230  bool hasEmissionMap() const
231  { return myEmissionMap.myTex.isValid(); }
232  bool hasRoughnessMap() const
233  { return myRoughMap.myTex.isValid(); }
234  bool hasOcclusionMap() const
235  { return myOcclusionMap.myTex.isValid(); }
236  bool hasMetallicMap() const
237  { return myMetallicMap.myTex.isValid(); }
238  bool hasCoatRoughnessMap() const
239  { return myCoatRoughMap.myTex.isValid(); }
240  bool hasCoatIntensityMap() const
241  { return myCoatIntMap.myTex.isValid(); }
243  { return myReflectAmountMap.myTex.isValid(); }
244 
245  bool hasHairDiffuseMap() const
246  { return myHairDiffMap.myTex.isValid(); }
247  bool hasHairSpecularMap() const
248  { return myHairSpecMap.myTex.isValid(); }
249  bool hasHairDiffuseRamp() const
250  { return myHairDiffRamp.myTex.isValid(); }
251  bool hasHairSpecularRamp() const
252  { return myHairSpecRamp.myTex.isValid(); }
253  bool hasHairAlphaRamp() const
254  { return myHairAlphaRamp.myTex.isValid(); }
255 
256  // Query the material if it is opaque or transparent. 'check_diffuse_alpha'
257  // will check the diffuse texture's alpha channel.
258  bool isTransparent(bool check_diffuse_alpha) const;
259 
260  void setTransparent(bool alpha) { myIsTransparent = alpha; }
261 
262  // Returns true if this material has a texture map (diffuse, bump, etc).
263  bool isTextured() const { return myTexturedFlag; }
264  void setTextured(bool has_tex) { myTexturedFlag = has_tex; }
265 
266  // Requires UVs outside of texturing
267  bool needsUVs() const { return myNeedsUVs; }
268  void setNeedsUVs(bool uvs) { myNeedsUVs = uvs; }
269  //
270  void needTextureUpdate() { myNeedsTexUpdate = true; }
271  bool needsTextureUpdate() const { return myNeedsTexUpdate; }
272 
273  void setNumMatXTextures(int num);
274  void setMatXTexture(RE_TextureMap *map, int index);
275  RE_TextureMap *getMatXTexture(int index) const;
276 
277  // Call after all texure parms and textures are set up.
278  void finishTextureSetup(RE_Render *r, bool preload);
279  bool checkForCacheUpdate(int cache_serial,fpreal t); //inline below
280 
281  bool isMatCapTextured() const { return myEmissionMatCap; }
282 
283  // Returns true if textures are used, and the uvsets used by all layers of
284  // the material.
285  const UT_Map<UT_StringHolder, int> &getUVSets();
286 
287  void clearUVSets();
288  void addUVSet(const UT_StringRef &uv);
289 
290  // Return the texture coord set used by 'layer'
291  const UT_StringHolder &getLayerUVSet(int layer) const;
292 
293  void setTextureFormat(RE_TextureCompress format);
294  RE_TextureCompress getTextureFormat() const { return myTexFormat; }
295 
296  void limitTextureSize(bool limit, int w, int h);
297  bool limitTextureSize() const { return myLimitTextureSize; }
298  void getMaxTextureSize(int &w,int &h)
299  { myMaxTextureW = w;
300  myMaxTextureH = h; }
301 
302  void setTextureScale(float sc);
303  float getTextureScale() const { return myTextureScale; }
304 
305  void setTextureMemLimitMB(int mem);
306  int getTextureMemLimitMB() const { return myTextureMemLimitMB; }
307 
308  void mipMapTextures(bool yes);
309  bool mipMapTextures() const { return myMipMapTextures; }
310 
311  void setAnisotropySamples(int samp);
312  int getAnisotropySamples() const { return myTextureAnisotropy; }
313 
314  void allowShaders(bool yes) { myAllowShaders = yes; }
315  bool allowShaders() const { return myAllowShaders; }
316 
317  // methods to deal with lighting
318  void doLighting(bool yes );
319  bool isLit() const { return myDoLighting; }
320 
322  const char *name = nullptr,
327  { return myOwnShader[sht]; }
328 
329  /// caches the source for the shader in the material.
330  void setShaderSource(const char *vert_src,
331  const char *geom_src,
332  const char *frag_src,
333  RE_ShaderTarget ptype
335 
336  /// checks this materials' shader against the source, and returns true if
337  /// it matches.
338  bool hasShaderSource(const char *vert_src,
339  const char *geom_src,
340  const char *frag_src,
341  RE_ShaderTarget ptype
343 
344  void setShaderProgram(const char *program_file);
345  bool hasShaderProgram(const char *program_file) const;
348  { return myShaderProgramFile.isstring() ||
349  myVertexSource[ptype].isstring() ||
350  myGeometrySource[ptype].isstring() ||
351  myFragmentSource[ptype].isstring(); }
352  bool customShaderDirty() const { return myCustomShaderDirty; }
353 
354  void removeShader();
355 
356  // methods to access and change the material information
357  float amb( unsigned idx ) const { return myAmb[idx]; }
358  UT_Vector3F amb() const { return myAmb; }
359  float diff( unsigned idx ) const { return myDiff[idx]; }
360  UT_Vector3F diff() const { return myDiff; }
361  float spec( unsigned idx ) const { return mySpec[idx]; }
362  UT_Vector3F spec() const { return mySpec; }
363  float emit( unsigned idx ) const { return myEmit[idx]; }
364  UT_Vector3F emit() const { return myEmit; }
365  UT_Vector3F metallicEdgeTint() const { return myMetallicEdge; }
366  float metallic() const { return myMetallic; }
367  float alpha() const { return myAlpha; }
368  float roughness() const { return myRoughness; }
369  float reflection() const { return myReflection; }
370  float coatRoughness() const { return myCoatRough; }
371  float coatIntensity() const { return myCoatIntensity; }
372  float diffuseRoughness() const { return myDiffRoughness; }
373 
374  /// Sets the perpendicular and parallel alpha factors. If the parallel
375  /// alpha is less than zero, they are assumed to be the same.
376  void setAlpha( float alpha_perp, float alpha_para = -1.0 );
377 
378  // Alpha blend/cutout modes.
380  {
381  ALPHA_BLEND = 0, // normal alpha blending C*A + Cbg*(1-A)
382  CUTOUT_ALPHA, // (A >= cutoff) ? C : 0
384  };
385  void setAlphaMode(AlphaMode mode);
387  { return myAlphaMode; }
388 
389  void setAlphaCutoff(fpreal alpha_val);
391  {
392  return (myAlphaMode != IGNORE_ALPHA) ? myAlphaCutoff : 0.0;
393  }
394 
395 
396  /// If true, the shader generates its own alpha independent of the material
397  /// parameters. This indicates that the material requires a transparency
398  /// pass, since the renderer can otherwise not determine this from the
399  /// shader code.
401  { myShaderAlphaFlag = enabled; }
402  bool hasShaderAlpha() const { return myShaderAlphaFlag; }
403 
404  // give roughness: this method will calculate shininess needed by OGL
405  void setRoughness( float r );
406 
407  // give shininess: this method will enforce sh within [0.001, 1e10]
408  void setShininess( float sh );
409 
410  void setDiffuseRoughness(fpreal r);
411 
412  void setAmb( float r, float g, float b );
413  void setDiff( float r, float g, float b );
414  void setSpec( float r, float g, float b );
415  void setEmit( float r, float g, float b );
416  void setMetallic(float metal);
417  void setMetallicEdge(const UT_Vector3F &metal);
418 
419  void setAmbient( UT_Color col );
420  void setDiffuse( UT_Color col );
421  void setSpecular( UT_Color col );
422  void setEmission( UT_Color col );
423 
424  void setAmbient( const UT_Vector3F &col );
425  void setDiffuse( const UT_Vector3F &col );
426  void setSpecular( const UT_Vector3F &col );
427  void setEmission( const UT_Vector3F &col );
428 
429  void setSpecularTint(fpreal t);
430  fpreal getSpecularTint() const { return mySpecTint; }
431 
432  enum { PHONG=0, BLINN=1, GGX=2, SPEC_ANGLE=3 };
433  void setSpecularModel(int spec_model);
434  int getSpecularModel() const { return mySpecModel; }
435  void setCoatSpecularModel(int spec_model);
436  int getCoatSpecuarModel() const { return myCoatModel; }
437  void setCoatIntensity(fpreal i);
438  fpreal getCoatIntensity() const { return myCoatIntensity; }
439  void setCoatRoughness(fpreal r);
440  fpreal getCoatRoughness() const { return myCoatRough; }
441 
442  void setIOR(float ior);
443  fpreal getIOR() const { return myIOR; }
444 
445  void setReflection(float r, bool explicit_r);
446  fpreal getReflection() const;
447 
448  void usePackedColor(bool enable);
449  void useGeometryColor(bool enable);
450  bool usePackedColor() const { return myUsePackedColor; }
451  bool useGeometryColor() const { return myUseGeoColor; }
452 
453  // returns true if reflection was explicity set, not derived from IoR.
454  bool hasExplicitReflection() const { return myExplicitReflection; }
455 
456  void setNeedsTangentSpace(bool b) { myNeedsTangentSpace = b; }
457  bool needsTangentSpace() const
458  {
459  return myNeedsTangentSpace ||
460  (myNormalMap.myMap &&
461  myNormalMapType == NMLMAP_TANGENT);
462  }
463 
464  // Parameters for the bump, spec, opac, env, disp and normal maps.
465  enum re_NormalMapType { NMLMAP_TANGENT=0, NMLMAP_WORLD=1, NMLMAP_OBJECT=2 };
466 
467  void setOpacityMapParms(bool invert, int component);
468  void setNormalParms(re_NormalMapType type, bool bias,
470  bool flip_x, bool flip_y, bool flip_z);
471  void setEnvParms(float scale, const UT_Vector3 &rot,
472  const UT_XformOrder &rord);
473 
474  enum re_Displace {
478  DISPLACE_VECTOR_OBJECT };
479  void setDisplaceParms(float scale, float offset, float quality,
480  re_Displace vector_space, bool y_up);
481  void setDisplaceLOD(float lod) { myDisplaceLOD = lod; }
482  float getDisplaceLOD() const { return myDisplaceLOD; }
483  void setRoughParms(bool invert_map, int component);
484  void setOcclusionParms(int component);
485  void setMetallicParms(int component);
486  void setCoatRoughnessParms(int component);
487  void setCoatIntensityParms(int component);
488  void setReflectionAmountParms(int component, bool affect_ior);
489  void setEmissionParms(bool use_matcap);
490 
491  bool hasDisplacement() const;
492 
493  void setUVTransform(RE_TexMapType maptype,
494  const UT_Matrix3F &xform,
495  int layer = 0);
496  void clearUVTransform(RE_TexMapType maptype,
497  int layer = 0);
498 
499  // Hair parameters
500  void enableHairParameters(bool e) { myHairMaterialEnabled = e; }
501 
502  void setHairDiffuse(float intensity,
503  UT_Vector3F root_col,
504  UT_Vector3F tip_col,
505  bool use_map,
506  bool use_ramp);
507 
508  void setHairSpecular(float intensity,
509  float angle,
510  float shift,
511  UT_Vector3F root_col,
512  UT_Vector3F tip_col,
513  bool use_map,
514  bool use_ramp);
515  void setHairAlpha(float alpha,
516  bool use_alpha_ramp);
517 
518  // randomize hue, sat, and intensity of diffuse (and specular intensity)
519  void setHairRandomize(bool random_hue, UT_Vector2F hue_range,
520  bool random_sat, UT_Vector2F sat_range,
521  bool random_int, UT_Vector2F int_range,
522  bool random_spec_int,
523  UT_Vector2F spec_int_range);
524 
525  // Game shader
526 
527  // Use a transformed UV set.
528  void setUVTransform(int layer,
529  UT_Vector2F t,
530  fpreal r,
531  UT_Vector2F s);
532  void getUVTransform(int layer,
533  UT_Vector2F &t,
534  fpreal &r,
535  UT_Vector2F &s ) const;
536  void setUVLayerTint(int layer, bool use_tint, UT_Vector4F tint,
537  fpreal rough);
538 
539  // Use triplanar projection.
540  void setUVTriplanar(int layer,
541  fpreal scale = 1.0,
542  fpreal sharp = 1.0,
545  bool isUVTriplanar(int layer) const;
546  fpreal getUVTriplanarSharp(int layer) const;
547  fpreal getUVTriplanarScale(int layer) const;
548  UT_Vector3F getUVTriplanarBlend(int layer) const;
549  UT_Vector3F getUVTriplanarOffset(int layer) const;
550  bool getUVLayerUseTint(int layer) const;
551  UT_Vector4F getUVLayerTint(int layer) const;
552  fpreal getUVLayerRough(int layer) const;
553 
554 
555  // For environment lights, which temporarily apply their map to any
556  // materials that don't already have an env map.
557  static void setEnvMapOverride(RE_TextureHolder env_map,
558  const UT_Matrix3F &rot,
559  const UT_Vector3F &col);
560  static void clearEnvMapOverride();
561  static RE_TextureHolder getEnvMapOverride();
562 
563  void setReflectionMap(RE_Texture *map) { myReflectMap = map; }
564  void clearReflectionMap() { myReflectMap = nullptr; }
565 
566 #ifdef UT_DEBUG
567  // debug output
568  void output();
569 #endif
570 
571  RE_MaterialPtr cloneWithoutTexture() const;
572 
573  bool loadTextureMaps(RE_Render *r, bool preload_only = false);
574 
575  // Maps can only be preloaded with loadTextureMaps(), not on the fly during
576  // the render.
577  void preloadMapsOnly(bool preload) { myPreloadMaps = preload; }
578 
579  // Adds an explicit map to 'maptype'. Will be overriden by setTextureMap()
580  // if that has/is called on the material.
581  // nullptr is acceptable (blocks the RE_TextureCB map).
582  void assignTextureMap(RE_Texture *tex,
583  RE_TexMapType maptype,
584  int index = 0);
585  // Remove the explicit map from 'maptype'.
586  void removeTextureMap(RE_TexMapType maptype,
587  int index = 0);
588 
589  void setTextureMap(RE_TextureMap *map,
590  bool give_ownership,
591  RE_TexMapType maptype,
592  const UT_StringRef &uv_set,
593  int index = 0);
594  void clearTextureMap(RE_TexMapType maptype,
595  int index = 0);
596  RE_TextureMap *getTextureMap(RE_TexMapType maptype,
597  int index = 0);
598 
599 
601  { return myMaterialType==FILM_SURFACE ?myNumDiffuseLayers :1; }
602 
603  bool updateShaderForMaterial(
604  RE_Render *r,
605  int layer,
606  bool textured,
608  RE_Shader *shader = nullptr,
609  bool allow_partial = false);
610  void restoreShader(RE_Render *r,
612 
613  /// Returns the amount of main memory (NOT graphics memory!)
614  /// owned by this RE_Material.
615  int64 getMemoryUsage(bool inclusive) const;
616 
617 
618  void writeMaterialParmsToBlockGL4(RE_Render *r,
619  RE_UniformBlock *block,
620  int material_idx,
621  int layer,
622  bool lit,
623  bool textured);
624  // For bindless texturing.
625  void makeTexturesResident(RE_Render *r);
626  void removeTexturesFromResident(RE_Render *r);
627 
628  DEP_MicroNode &dependencies() { return myDepNode; }
629 
630  void updateMaterialBlock(int layer);
631 
633  { return myMaterialBlock; }
635  { return myHairMaterialBlock; }
637  { return myGameMaterialBlock; }
638 private:
639 
640  void loadShaderAttribNames();
641 
642  class re_MaterialTextureMap
643  {
644  public:
645  re_MaterialTextureMap()
646  : myMap(nullptr), myMapIndex(-1),
647  myArrayMapIndex(-1), myTexCoords(0), myComponent(0),
648  myExplicitMap(false), myOwnMap(false) {}
649  ~re_MaterialTextureMap()
650  {
651  if(myOwnMap)
652  delete myMap;
653  }
654  RE_TextureMap *myMap;
655  RE_TextureHolder myTex;
656  RE_CacheVersion myTexVersion;
657  UT_StringHolder myUVSet;
658  UT_DimRect myUDIMArea;
659  int myMapIndex;
660  int myArrayMapIndex;
661  int myTexCoords;
662  int myComponent;
663  bool myExplicitMap;
664  bool myOwnMap;
665  };
666  re_MaterialTextureMap *fetchMapInfo(RE_TexMapType t,
667  int index);
668 
669  RE_TextureHolder fetchTexture(RE_Render *r, RE_TextureMap *map,
670  bool preload_only = false,
671  bool mipmap = true);
672  RE_TextureHolder fetchMap(RE_Render *r,
673  RE_TexMapType map_target,
674  re_MaterialTextureMap &map,
675  bool preload,
676  bool promote_1chan_to_rgb = false);
677 
678  bool bindTextureMap(RE_Render *r, re_MaterialTextureMap &map,
679  const char *udim_stride_name,
680  RE_TexMapType type,
681  const char *component_name = nullptr);
682  void bindUVTransform(RE_TexMapType type,
683  int layer = 0);
684  void bindComponentAndUDIM(re_MaterialTextureMap &map,
685  const char *udim_area_name,
686  const char *component_name = nullptr);
687  void bindTextureMaps(RE_Render *r, int layer);
688 private:
689  ~RE_Material(); // No subclassing
690 
691  void updateHairMaterialForShader(RE_Render *r,
692  bool textured,
693  RE_ShaderTarget sht,
694  RE_Shader *sh);
695  void updateGameMaterialForShader(RE_Render *r,
696  bool textured,
697  RE_ShaderTarget sht,
698  RE_Shader *sh);
699 
700  // -- Bindless texturing support
701  void makeResident(RE_Render *r, RE_TextureHolder texmap);
702  void removeResident(RE_Render *r, RE_TextureHolder texmap);
703  bool bindTextureHandle(RE_Render *r,
704  re_MaterialTextureMap &map,
705  RE_UniformBlock *material_block,
706  int material_index,
707  const char *texture_name);
708  // --
709 
710  UT_Vector4F getComponentVector(int comp,
711  const re_MaterialTextureMap &map) const;
712 
713  DEP_MicroNode myDepNode;
714  UT_Vector3F myAmb;
715  UT_Vector3F myDiff;
716  UT_Vector3F mySpec;
717  UT_Vector3F myEmit;
718  UT_Vector3F myMetallicEdge;
719  float myMetallic;
720  float myAlpha;
721  float myRoughness;
722  float myDiffRoughness;
723  float mySpecTint;
724  RE_MaterialType myMaterialType;
725  AlphaMode myAlphaMode;
726  float myAlphaCutoff;
727 
728  // I own map if if I created my RE_OGLTex
730 
731  RE_Texture *myReflectMap; // always temporary during a render
732 
733  re_MaterialTextureMap mySpecMap;
734  re_MaterialTextureMap myOpacityMap;
735  re_MaterialTextureMap myBumpMap;
736  re_MaterialTextureMap myRoughMap;
737  re_MaterialTextureMap myEmissionMap;
738  re_MaterialTextureMap myNormalMap;
739  re_MaterialTextureMap myDisplaceMap;
740  re_MaterialTextureMap myOcclusionMap;
741  re_MaterialTextureMap myMetallicMap;
742  re_MaterialTextureMap myCoatRoughMap;
743  re_MaterialTextureMap myCoatIntMap;
744  re_MaterialTextureMap myReflectAmountMap;
745  re_MaterialTextureMap myGameBlendMap;
746  re_MaterialTextureMap myEnvMap;
747  re_MaterialTextureMap myHairDiffMap;
748  re_MaterialTextureMap myHairSpecMap;
749  re_MaterialTextureMap myHairDiffRamp;
750  re_MaterialTextureMap myHairSpecRamp;
751  re_MaterialTextureMap myHairAlphaRamp;
752 
753  UT_Array<RE_TextureMap *> myMatXTextures;
754 
755  UT_IntArray mySamplerBindings;
756 
757  // The above maps are only valid pointers if myRenderCount is equal to
758  // RE_OGLRender::getRenderCount.
759  int64 myRenderCount;
760 
761 
762  UT_StringHolder myMaterialName;
763  UT_StringHolder myNodePath;
764  UT_StringHolder myMatNetName;
765  int myNodeID;
766  UT_Options myOverrides;
767  UT_StringMap<UT_StringHolder> myVertexOverrides;
768  unsigned myDoLighting:1,
769  myMipMapTextures:1,
770  myLimitTextureSize:1,
771  myDefaultShader:1,
772  myAllowShaders:1,
773  myTrivialTextureAlpha:1,
774  myInvertRoughMap:1,
775  myPreloadMaps:1,
776  myTextureLoadPending:1,
777  myCustomShaderDirty:1,
778  myNeedsTexUpdate:1,
779  myNeedsTexCheck:1,
780  myTextureSetup:1,
781  myMatNetDirty:1,
782  myIsTransparent:1,
783  myNeedsTangentSpace:1;
784  int myTextureAnisotropy;
785  int myNumDiffuseLayers;
786 
787  RE_TextureCompress myTexFormat;
788  int myMaxTextureW, myMaxTextureH;
789  float myTextureScale;
790  int myTextureMemLimitMB;
791  float myAlphaPara;
792  bool myShaderAlphaFlag;
793  bool myUseGeoColor;
794  bool myUsePackedColor;
795  bool myDirtyFlag;
796 
797  // Specular parms
798  fpreal myIOR;
799  fpreal32 myReflection;
800  int mySpecModel;
801  bool myReflectAsIOR;
802  bool myExplicitReflection;
803 
804  // Coat parms
805  fpreal myCoatRough;
806  fpreal myCoatIntensity;
807  int myCoatModel;
808 
809  // normal map parms
810  bool myNormalBias;
811  bool myNormalFlipX;
812  bool myNormalFlipY;
813  bool myNormalFlipZ;
814  UT_Vector2F myNormalScale;
815  re_NormalMapType myNormalMapType;
816 
817  // environment map parms
818  UT_Vector3 myEnvRotation;
819  float myEnvScale;
820  UT_XformOrder myEnvRotOrder;
821 
822  // displacement map parms
823  float myDisplaceScale;
824  float myDisplaceOffset;
825  float myDisplaceQuality;
826  re_Displace myDisplaceSpace;
827  bool myDisplaceYUp;
828  float myDisplaceLOD;
829 
830  bool myOpacityMapInvert;
831  int myRoughComp;
832  int myOcclusionComp;
833  int myMetallicComp;
834  bool myEmissionMatCap;
835 
836  RE_Shader *myShader[RE_SHADER_NUM_TARGETS];
837  bool myOwnShader[RE_SHADER_NUM_TARGETS];
838  UT_String myVertexSource[RE_SHADER_NUM_TARGETS];
839  UT_String myGeometrySource[RE_SHADER_NUM_TARGETS];
840  UT_String myFragmentSource[RE_SHADER_NUM_TARGETS];
841  UT_String myShaderProgramFile;
842  int myShaderRef[RE_SHADER_NUM_TARGETS];
843 
844  RE_UniformBlockHandle myMaterialBlock;
845  int myMaterialOverride;
846  bool myMatBlockDirty;
847  bool myMatBlockHasEnvMapTexture;
848  bool myMatBlockHasReflectMapTexture;
849  bool myMatBlockHasDiffuseTexture;
850  bool myTexturedFlag;
851  bool myNeedsUVs;
852  int myTextureCacheSerial;
853 
854  // Hair parameters
855  class re_HairCompParms
856  {
857  public:
858  re_HairCompParms() : intensity(0.5), shift(0.0), angle(1.0),
859  root_col(1,1,1), tip_col(1,1,1),
860  use_ramp(false), use_map(false) {}
861  float intensity;
862  float angle;
863  float shift;
864  UT_Vector3F root_col;
865  UT_Vector3F tip_col;
866  bool use_ramp;
867  bool use_map;
868  };
869  struct re_HairRandomParms
870  {
871  re_HairRandomParms() : randomize(false) {}
872  bool randomize;
874  };
875 
876  bool myHairMaterialEnabled;
877  re_HairCompParms myHairDiffuse;
878  re_HairCompParms myHairSpecular;
879  float myHairAlpha;
880  bool myHairUseAlphaRamp;
881  re_HairRandomParms myHairRandomDiffHue;
882  re_HairRandomParms myHairRandomDiffSat;
883  re_HairRandomParms myHairRandomDiffInt;
884  re_HairRandomParms myHairRandomSpecInt;
885  RE_UniformBlockHandle myHairMaterialBlock;
886  int myHairMatBlockIndex;
887  int myHairRandomTextureIndex;
888  int myHairDiffBaseMapIndex;
889  UT_DimRect myHairDiffBaseMapUDIMArea;
890  UT_DimRect myHairSpecBaseMapUDIMArea;
891 
892  RE_TextureHolder myRandomTexture;
893 
894  // cached texture units for 'myLastMatShader'.
895 
896  int myMatBlockDiffuseIndex;
897  int myMatBlockDiffuseArrayIndex;
898 
899  int myMatBlockEnvMapIndex;
900  int myMatBlockReflectMapIndex;
901  int myMatBlockIndex;
902  int myHairMaterialOverride;
903 
904  // hair material block.
905  void *myLastHairShader;
906  int myLastHairShaderSerial;
907  int myHairDiffIndex;
908  int myHairDiffArrayIndex;
909  int myHairSpecIndex;
910  int myHairSpecArrayIndex;
911  int myHairDiffRampIndex;
912  int myHairSpecRampIndex;
913  int myHairAlphaRampIndex;
914  int myMatBlockHairIndex;
915 
916  // game shader material block
917  RE_UniformBlockHandle myGameMaterialBlock;
918  int myGameMaterialOverride;
919 
920  struct re_GameLayer
921  {
922  re_GameLayer() : triplanar(false), scale(1,1), trans(0,0), rot(0),
923  sharp(1), tpscale(1), transform(1.0),
924  tpblend(1,1,1), tpoff(0,0,0), use_tint(false),
925  tint(1.0, 1.0, 1.0, 1.0), rough(1.0) {}
926  bool triplanar;
929  float rot;
930  float sharp;
931  float tpscale;
932  UT_Vector3F tpblend;
933  UT_Vector3F tpoff;
935  bool use_tint;
936  UT_Vector4F tint;
937  float rough;
938  };
939  UT_Array<re_GameLayer> myGameLayers;
940  const RE_Shader *myLastGameShader;
941  int myLastGameShaderSerial;
942  int myGameBlendIndex;
943  int myGameMatBlockIndex;
944 
945  int myPrevSeamlessCubeMap;
946 
947  bool myTimeDep;
948  fpreal myTime;
949 
950  SYS_AtomicInt32 myRefCount;
951  int64 myUniqueId;
952  int64 myVersion;
953  int64 myTexVersion;
954  int64 myMatXVersion;
955  UT_StringMap<int> myUVSets;
956 
957  class re_UVTransform
958  {
959  public:
960  re_UVTransform() : transform(1.0), identity(true) {}
961  re_UVTransform(const UT_Matrix3F &t, bool i)
962  : transform(t), identity(i) {}
964  bool identity;
965  };
966  UT_Array<re_UVTransform> myTexUVTransform;
967  UT_Array<re_UVTransform> myDiffuseUVTransform;
968 };
969 
970 static inline void intrusive_ptr_add_ref(RE_Material *m) { m->incref(); }
971 static inline void intrusive_ptr_release(RE_Material *m) { m->decref(); }
972 
973 inline void
975 {
976  setAmb(col.x(), col.y(), col.z());
977 }
978 inline void
980 {
981  setDiff(col.x(), col.y(), col.z());
982 }
983 inline void
985 {
986  setSpec(col.x(), col.y(), col.z());
987 }
988 inline void
990 {
991  setEmit(col.x(), col.y(), col.z());
992 }
993 
994 inline bool
996 {
997  if(cache_serial != myTextureCacheSerial)
998  {
999  myTextureCacheSerial = cache_serial;
1000  myNeedsTexUpdate = true;
1001  return true;
1002  }
1003  if(myTimeDep && !SYSisEqual(t, myTime))
1004  {
1005  myNeedsTexUpdate = true;
1006  return true;
1007  }
1008  return false;
1009 }
1010 
1011 inline bool
1013 {
1015  if(sh)
1016  return sh->hasTessellation();
1017 
1018  return false;
1019 }
1020 
1021 inline RE_Shader*
1023 {
1024  if(myShader[sht])
1025  return myShader[sht];
1026  if(myShaderRef[sht] != 0)
1027  return RE_Shader::lookupProgram(myShaderRef[sht]);
1028  return nullptr;
1029 }
1030 
1031 
1032 inline int
1034 {
1035  return myShaderRef[sht];
1036 }
1037 
1038 // This contains a list of materials for drawing a given geometry, and is
1039 // normally used as a transient list of materials during a redraw.
1040 // This class does not own the materials as they are also held in
1041 // a higher-level cache as well.
1042 class RE_API RE_MaterialAtlas : public UT_Map<int,RE_MaterialPtr>
1043 {
1044 public:
1045  // Default material for unassigned prims.
1047  { return myDefault; }
1048 
1049  // Factory default material if materials are disabled.
1051  { return myFactory; }
1052 
1053  bool isDirty(fpreal time) const;
1054 
1055  RE_MaterialPtr get(int material_id) const
1056  {
1057  if(material_id == -1)
1058  return myDefault ? myDefault : myFactory;
1059  const_iterator entry = find(material_id);
1060  if(entry != end())
1061  return entry->second;
1062 
1063  return nullptr;
1064  }
1065 
1066 
1067  // Add a new material to the atlas
1068  void add(const RE_MaterialPtr &material)
1069  { (*this)[ material->getUniqueId() ] = material; }
1070 
1071  // Set the default material, which will be used if no other material
1072  // assignments are present.
1073  void setDefaultMaterial(const RE_MaterialPtr &material,bool add_list=true)
1074  { myDefault = material; if(add_list && material) add(material); }
1075 
1076  // Sets the factory default material, which is used when all materials
1077  // are turned off (as the default material may be the object material).
1078  void setFactoryMaterial(const RE_MaterialPtr &material,bool add_list=true)
1079  { myFactory = material; if(add_list && material) add(material); }
1080 
1081 private:
1082  RE_MaterialPtr myDefault;
1083  RE_MaterialPtr myFactory;
1084 };
1085 
1086 #endif
void setDiffuse(UT_Color col)
bool mipMapTextures() const
Definition: RE_Material.h:309
void setTextured(bool has_tex)
Definition: RE_Material.h:264
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1222
UT_Vector3F spec() const
Definition: RE_Material.h:362
GLboolean enable
Definition: glew.h:2750
bool hasOverrides() const
Definition: RE_Material.h:97
bool hasHairDiffuseMap() const
Definition: RE_Material.h:245
void setNeedsUVs(bool uvs)
Definition: RE_Material.h:268
float alpha() const
Definition: RE_Material.h:367
void setVersion(int64 v)
Definition: RE_Material.h:51
float getDisplaceLOD() const
Definition: RE_Material.h:482
bool hasOpacityMap() const
Definition: RE_Material.h:227
GLenum GLenum GLenum GLenum GLenum scale
Definition: glew.h:14163
int64 getVersion() const
Definition: RE_Material.h:50
float reflection() const
Definition: RE_Material.h:369
Unsorted map container.
Definition: UT_Map.h:107
const UT_StringHolder & getNodePath() const
Definition: RE_Material.h:80
void dirty(bool dirty=true)
Definition: RE_Material.h:53
GLenum GLuint GLint GLint layer
Definition: glcorearb.h:1299
void incref()
Definition: RE_Material.h:71
#define RE_API
Definition: RE_API.h:10
bool isTimeDependent() const
Definition: RE_Material.h:68
void setMatNetName(const UT_StringRef &mat_path)
Definition: RE_Material.h:84
GLboolean invert
Definition: glcorearb.h:549
GA_API const UT_StringHolder uv
bool hasBumpMap() const
Definition: RE_Material.h:225
GT_API const UT_StringHolder time
UT_Vector3F diff() const
Definition: RE_Material.h:360
Transformation order of scales, rotates, and translates.
Definition: UT_XformOrder.h:23
float roughness() const
Definition: RE_Material.h:368
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
const RE_UniformBlockHandle & hairBlock() const
Definition: RE_Material.h:634
GLboolean GLboolean g
Definition: glcorearb.h:1222
GA_API const UT_StringHolder rot
bool isMatCapTextured() const
Definition: RE_Material.h:281
void setEmit(float r, float g, float b)
float metallic() const
Definition: RE_Material.h:366
int getSpecularModel() const
Definition: RE_Material.h:434
constexpr SYS_FORCE_INLINE T & z() noexcept
Definition: UT_Vector3.h:656
bool areTexturesPending()
Definition: RE_Material.h:218
void setShaderAlpha(bool enabled)
Definition: RE_Material.h:400
bool hasShaderAlpha() const
Definition: RE_Material.h:402
const RE_MaterialPtr & getDefaultMaterial() const
Definition: RE_Material.h:1046
void decref()
Definition: RE_Material.h:72
bool hasTessellation() const
Definition: RE_Shader.h:765
void setSpecular(UT_Color col)
bool hasCoatIntensityMap() const
Definition: RE_Material.h:240
const UT_Options & getOverrides() const
Definition: RE_Material.h:96
void setSpec(float r, float g, float b)
GLenum GLenum GLsizei const GLuint GLboolean enabled
Definition: glcorearb.h:2539
bool hasRoughnessMap() const
Definition: RE_Material.h:232
GLuint const GLchar * name
Definition: glcorearb.h:786
fpreal getCurrentTime() const
Definition: RE_Material.h:69
int getTextureMemLimitMB() const
Definition: RE_Material.h:306
const UT_StringMap< UT_StringHolder > & vertexOverrides() const
Definition: RE_Material.h:102
bool needsUVs() const
Definition: RE_Material.h:267
void setAmb(float r, float g, float b)
float fpreal32
Definition: SYS_Types.h:200
GLdouble GLdouble t
Definition: glew.h:1403
int getAnisotropySamples() const
Definition: RE_Material.h:312
bool isShaderOwned(RE_ShaderTarget sht=RE_SHADER_TARGET_TRIANGLE) const
Definition: RE_Material.h:325
static RE_Shader * lookupProgram(int id)
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_UniquePtr.h:39
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:857
bool needsTangentSpace() const
Definition: RE_Material.h:457
bool isMatNetDirty() const
Definition: RE_Material.h:91
GLuint GLenum GLenum transform
Definition: glew.h:15055
vint4 blend(const vint4 &a, const vint4 &b, const vbool4 &mask)
Definition: simd.h:4784
RE_MaterialType getMaterialType() const
Definition: RE_Material.h:114
bool hasHairSpecularRamp() const
Definition: RE_Material.h:251
float amb(unsigned idx) const
Definition: RE_Material.h:357
DEP_MicroNode & dependencies()
Definition: RE_Material.h:628
void setFactoryMaterial(const RE_MaterialPtr &material, bool add_list=true)
Definition: RE_Material.h:1078
GLfloat bias
Definition: glew.h:10316
const RE_UniformBlockHandle & materialBlock() const
Definition: RE_Material.h:632
void intrusive_ptr_release(T *x)
Definition: refcnt.h:217
bool hasDisplaceMap() const
Definition: RE_Material.h:228
GLint limit
Definition: glew.h:13230
int getCoatSpecuarModel() const
Definition: RE_Material.h:436
const RE_UniformBlockHandle & gameMatBlock() const
Definition: RE_Material.h:636
GA_API const UT_StringHolder trans
bool hasHairDiffuseRamp() const
Definition: RE_Material.h:249
bool hasReflectionAmountMap() const
Definition: RE_Material.h:242
void setMatXNodeVersion(int64 version)
Definition: RE_Material.h:88
const GLdouble * v
Definition: glcorearb.h:837
bool hasNormalMap() const
Definition: RE_Material.h:226
void setReflectionMap(RE_Texture *map)
Definition: RE_Material.h:563
bool usePackedColor() const
Definition: RE_Material.h:450
GLuint GLuint end
Definition: glcorearb.h:475
bool limitTextureSize() const
Definition: RE_Material.h:297
fpreal getIOR() const
Definition: RE_Material.h:443
GLuint num
Definition: glew.h:2695
void setTimeDependent(bool timedep, fpreal t=0.0)
Definition: RE_Material.h:63
RE_Shader * getShader(RE_ShaderTarget sht=RE_SHADER_TARGET_TRIANGLE) const
Definition: RE_Material.h:1022
bool customShaderDirty() const
Definition: RE_Material.h:352
bool hasMetallicMap() const
Definition: RE_Material.h:236
bool hasDisplacement() const
Definition: RE_Material.h:1012
long long int64
Definition: SYS_Types.h:116
void needTextureUpdate()
Definition: RE_Material.h:270
const UT_StringRef & getMatNetName() const
Definition: RE_Material.h:86
void setEmission(UT_Color col)
bool isLit() const
Definition: RE_Material.h:319
fpreal getCoatIntensity() const
Definition: RE_Material.h:438
bool hasOcclusionMap() const
Definition: RE_Material.h:234
void markDefaultShader(bool def)
Definition: RE_Material.h:116
int getUniqueId() const
Definition: RE_Material.h:48
bool hasSpecularMap() const
Definition: RE_Material.h:224
bool allowShaders() const
Definition: RE_Material.h:315
void enableHairParameters(bool e)
Definition: RE_Material.h:500
GLenum mode
Definition: glcorearb.h:99
float diff(unsigned idx) const
Definition: RE_Material.h:359
GT_API const UT_StringHolder version
void setDefaultMaterial(const RE_MaterialPtr &material, bool add_list=true)
Definition: RE_Material.h:1073
UT_Vector3T< fpreal32 > UT_Vector3F
GLint GLint GLsizei GLint GLenum format
Definition: glcorearb.h:108
float emit(unsigned idx) const
Definition: RE_Material.h:363
float coatRoughness() const
Definition: RE_Material.h:370
GLfloat GLfloat GLfloat GLfloat h
Definition: glcorearb.h:2002
GLuint shader
Definition: glcorearb.h:785
A map of string to various well defined value types.
Definition: UT_Options.h:84
AlphaMode getAlphaMode() const
Definition: RE_Material.h:386
float diffuseRoughness() const
Definition: RE_Material.h:372
bool hasCoatRoughnessMap() const
Definition: RE_Material.h:238
float spec(unsigned idx) const
Definition: RE_Material.h:361
float coatIntensity() const
Definition: RE_Material.h:371
void intrusive_ptr_add_ref(T *x)
Definition: refcnt.h:208
void setDiff(float r, float g, float b)
void clearReflectionMap()
Definition: RE_Material.h:564
bool hasEnvMap() const
Definition: RE_Material.h:229
const RE_MaterialPtr & getFactoryMaterial() const
Definition: RE_Material.h:1050
bool useGeometryColor() const
Definition: RE_Material.h:451
bool checkForCacheUpdate(int cache_serial, fpreal t)
Definition: RE_Material.h:995
void setVertexOverrides(const UT_StringMap< UT_StringHolder > &ovr)
Definition: RE_Material.h:100
UT_Vector3F metallicEdgeTint() const
Definition: RE_Material.h:365
fpreal64 fpreal
Definition: SYS_Types.h:277
bool hasHairAlphaRamp() const
Definition: RE_Material.h:253
void setDisplaceLOD(float lod)
Definition: RE_Material.h:481
bool hasEmissionMap() const
Definition: RE_Material.h:230
GLuint index
Definition: glcorearb.h:786
void preloadMapsOnly(bool preload)
Definition: RE_Material.h:577
RE_TextureCompress getTextureFormat() const
Definition: RE_Material.h:294
void setAmbient(UT_Color col)
UT_Vector3F amb() const
Definition: RE_Material.h:358
void dirtyMatNet(bool dirty=true)
Definition: RE_Material.h:90
void setNeedsTangentSpace(bool b)
Definition: RE_Material.h:456
const GLdouble * m
Definition: glew.h:9166
const UT_StringHolder & getMaterialName() const
Definition: RE_Material.h:47
GLfloat f
Definition: glcorearb.h:1926
MX_RENDER_API ShaderPtr createShader(const string &shaderName, GenContext &context, ElementPtr elem)
Create a shader for a given element.
GLenum GLint * range
Definition: glcorearb.h:1925
fpreal getAlphaCutoff() const
Definition: RE_Material.h:390
int getNodeId() const
Definition: RE_Material.h:81
GLdouble angle
Definition: glew.h:9177
Simple class for a mutli-integer cache tag.
UT_Vector3F emit() const
Definition: RE_Material.h:364
void add(const RE_MaterialPtr &material)
Definition: RE_Material.h:1068
GLintptr offset
Definition: glcorearb.h:665
int64 getMatXNodeVersion() const
Definition: RE_Material.h:89
ImageBuf OIIO_API add(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
void getMaxTextureSize(int &w, int &h)
Definition: RE_Material.h:298
RE_ShaderTarget
Definition: RE_Types.h:250
bool hasExplicitReflection() const
Definition: RE_Material.h:454
RE_TextureCompress
type
Definition: core.h:1059
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector3.h:654
GLboolean r
Definition: glcorearb.h:1222
GLfloat GLfloat GLfloat alpha
Definition: glcorearb.h:112
bool isDirty(fpreal time) const
Definition: RE_Material.h:54
fpreal getCoatRoughness() const
Definition: RE_Material.h:440
Base::const_iterator const_iterator
Definition: UT_Map.h:118
GLdouble s
Definition: glew.h:1395
bool isTextured() const
Definition: RE_Material.h:263
int getNumDiffuseLayers() const
Definition: RE_Material.h:600
GLint lod
Definition: glcorearb.h:2765
bool hasHairSpecularMap() const
Definition: RE_Material.h:247
void setTransparent(bool alpha)
Definition: RE_Material.h:260
float getTextureScale() const
Definition: RE_Material.h:303
RE_MaterialTextureBinding
bool needsTextureUpdate() const
Definition: RE_Material.h:271
bool isDefaultShader() const
Definition: RE_Material.h:117
fpreal getSpecularTint() const
Definition: RE_Material.h:430
void allowShaders(bool yes)
Definition: RE_Material.h:314
FMT_CONSTEXPR auto find(Ptr first, Ptr last, T value, Ptr &out) -> bool
Definition: core.h:2089
int getShaderRefID(RE_ShaderTarget ptype=RE_SHADER_TARGET_TRIANGLE) const
Definition: RE_Material.h:1033
bool hasCustomShader(RE_ShaderTarget ptype=RE_SHADER_TARGET_TRIANGLE) const
Definition: RE_Material.h:346
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector3.h:652