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 clearGameLayers();
529  void setUVTransform(int layer,
530  UT_Vector2F t,
531  fpreal r,
532  UT_Vector2F s);
533  void getUVTransform(int layer,
534  UT_Vector2F &t,
535  fpreal &r,
536  UT_Vector2F &s ) const;
537  void setUVLayerTint(int layer, bool use_tint, UT_Vector4F tint,
538  fpreal rough);
539 
540  // Use triplanar projection.
541  void setUVTriplanar(int layer,
542  fpreal scale = 1.0,
543  fpreal sharp = 1.0,
546  bool isUVTriplanar(int layer) const;
547  fpreal getUVTriplanarSharp(int layer) const;
548  fpreal getUVTriplanarScale(int layer) const;
549  UT_Vector3F getUVTriplanarBlend(int layer) const;
550  UT_Vector3F getUVTriplanarOffset(int layer) const;
551  bool getUVLayerUseTint(int layer) const;
552  UT_Vector4F getUVLayerTint(int layer) const;
553  fpreal getUVLayerRough(int layer) const;
554 
555 
556  // For environment lights, which temporarily apply their map to any
557  // materials that don't already have an env map.
558  static void setEnvMapOverride(RE_TextureHolder env_map,
559  const UT_Matrix3F &rot,
560  const UT_Vector3F &col);
561  static void clearEnvMapOverride();
562  static RE_TextureHolder getEnvMapOverride();
563 
564  void setReflectionMap(RE_Texture *map) { myReflectMap = map; }
565  void clearReflectionMap() { myReflectMap = nullptr; }
566 
567 #ifdef UT_DEBUG
568  // debug output
569  void output();
570 #endif
571 
572  RE_MaterialPtr cloneWithoutTexture() const;
573 
574  bool loadTextureMaps(RE_Render *r, bool preload_only = false);
575 
576  // Maps can only be preloaded with loadTextureMaps(), not on the fly during
577  // the render.
578  void preloadMapsOnly(bool preload) { myPreloadMaps = preload; }
579 
580  // Adds an explicit map to 'maptype'. Will be overriden by setTextureMap()
581  // if that has/is called on the material.
582  // nullptr is acceptable (blocks the RE_TextureCB map).
583  void assignTextureMap(RE_Texture *tex,
584  RE_TexMapType maptype,
585  int index = 0);
586  // Remove the explicit map from 'maptype'.
587  void removeTextureMap(RE_TexMapType maptype,
588  int index = 0);
589 
590  void setTextureMap(RE_TextureMap *map,
591  bool give_ownership,
592  RE_TexMapType maptype,
593  const UT_StringRef &uv_set,
594  int index = 0);
595  void clearTextureMap(RE_TexMapType maptype,
596  int index = 0);
597  RE_TextureMap *getTextureMap(RE_TexMapType maptype,
598  int index = 0);
599 
600 
602  { return myMaterialType==FILM_SURFACE ?myNumDiffuseLayers :1; }
603 
604  bool updateShaderForMaterial(
605  RE_Render *r,
606  int layer,
607  bool textured,
609  RE_Shader *shader = nullptr,
610  bool allow_partial = false);
611  void restoreShader(RE_Render *r,
613 
614  /// Returns the amount of main memory (NOT graphics memory!)
615  /// owned by this RE_Material.
616  int64 getMemoryUsage(bool inclusive) const;
617 
618 
619  void writeMaterialParmsToBlockGL4(RE_Render *r,
620  RE_UniformBlock *block,
621  int material_idx,
622  int layer,
623  bool lit,
624  bool textured);
625  // For bindless texturing.
626  void makeTexturesResident(RE_Render *r);
627  void removeTexturesFromResident(RE_Render *r);
628 
629  DEP_MicroNode &dependencies() { return myDepNode; }
630 
631  void updateMaterialBlock(int layer);
632 
634  { return myMaterialBlock; }
636  { return myHairMaterialBlock; }
638  { return myGameMaterialBlock; }
639 private:
640 
641  void loadShaderAttribNames();
642 
643  class re_MaterialTextureMap
644  {
645  public:
646  re_MaterialTextureMap()
647  : myMap(nullptr), myMapIndex(-1),
648  myArrayMapIndex(-1), myTexCoords(0), myComponent(0),
649  myExplicitMap(false), myOwnMap(false) {}
650  ~re_MaterialTextureMap()
651  {
652  if(myOwnMap)
653  delete myMap;
654  }
655  RE_TextureMap *myMap;
656  RE_TextureHolder myTex;
657  RE_CacheVersion myTexVersion;
658  UT_StringHolder myUVSet;
659  UT_DimRect myUDIMArea;
660  int myMapIndex;
661  int myArrayMapIndex;
662  int myTexCoords;
663  int myComponent;
664  bool myExplicitMap;
665  bool myOwnMap;
666  };
667  re_MaterialTextureMap *fetchMapInfo(RE_TexMapType t,
668  int index);
669 
670  RE_TextureHolder fetchTexture(RE_Render *r, RE_TextureMap *map,
671  bool preload_only = false,
672  bool mipmap = true);
673  RE_TextureHolder fetchMap(RE_Render *r,
674  RE_TexMapType map_target,
675  re_MaterialTextureMap &map,
676  bool preload,
677  bool promote_1chan_to_rgb = false);
678 
679  bool bindTextureMap(RE_Render *r, re_MaterialTextureMap &map,
680  const char *udim_stride_name,
681  RE_TexMapType type,
682  const char *component_name = nullptr);
683  void bindUVTransform(RE_TexMapType type,
684  int layer = 0);
685  void bindComponentAndUDIM(re_MaterialTextureMap &map,
686  const char *udim_area_name,
687  const char *component_name = nullptr);
688  void bindTextureMaps(RE_Render *r, int layer);
689 private:
690  ~RE_Material(); // No subclassing
691 
692  void updateHairMaterialForShader(RE_Render *r,
693  bool textured,
694  RE_ShaderTarget sht,
695  RE_Shader *sh);
696  void updateGameMaterialForShader(RE_Render *r,
697  bool textured,
698  RE_ShaderTarget sht,
699  RE_Shader *sh);
700 
701  // -- Bindless texturing support
702  void makeResident(RE_Render *r, RE_TextureHolder texmap);
703  void removeResident(RE_Render *r, RE_TextureHolder texmap);
704  bool bindTextureHandle(RE_Render *r,
705  re_MaterialTextureMap &map,
706  RE_UniformBlock *material_block,
707  int material_index,
708  const char *texture_name);
709  // --
710 
711  UT_Vector4F getComponentVector(int comp,
712  const re_MaterialTextureMap &map) const;
713 
714  DEP_MicroNode myDepNode;
715  UT_Vector3F myAmb;
716  UT_Vector3F myDiff;
717  UT_Vector3F mySpec;
718  UT_Vector3F myEmit;
719  UT_Vector3F myMetallicEdge;
720  float myMetallic;
721  float myAlpha;
722  float myRoughness;
723  float myDiffRoughness;
724  float mySpecTint;
725  RE_MaterialType myMaterialType;
726  AlphaMode myAlphaMode;
727  float myAlphaCutoff;
728 
729  // I own map if if I created my RE_OGLTex
731 
732  RE_Texture *myReflectMap; // always temporary during a render
733 
734  re_MaterialTextureMap mySpecMap;
735  re_MaterialTextureMap myOpacityMap;
736  re_MaterialTextureMap myBumpMap;
737  re_MaterialTextureMap myRoughMap;
738  re_MaterialTextureMap myEmissionMap;
739  re_MaterialTextureMap myNormalMap;
740  re_MaterialTextureMap myDisplaceMap;
741  re_MaterialTextureMap myOcclusionMap;
742  re_MaterialTextureMap myMetallicMap;
743  re_MaterialTextureMap myCoatRoughMap;
744  re_MaterialTextureMap myCoatIntMap;
745  re_MaterialTextureMap myReflectAmountMap;
746  re_MaterialTextureMap myGameBlendMap;
747  re_MaterialTextureMap myEnvMap;
748  re_MaterialTextureMap myHairDiffMap;
749  re_MaterialTextureMap myHairSpecMap;
750  re_MaterialTextureMap myHairDiffRamp;
751  re_MaterialTextureMap myHairSpecRamp;
752  re_MaterialTextureMap myHairAlphaRamp;
753 
754  UT_Array<RE_TextureMap *> myMatXTextures;
755 
756  UT_IntArray mySamplerBindings;
757 
758  // The above maps are only valid pointers if myRenderCount is equal to
759  // RE_OGLRender::getRenderCount.
760  int64 myRenderCount;
761 
762 
763  UT_StringHolder myMaterialName;
764  UT_StringHolder myNodePath;
765  UT_StringHolder myMatNetName;
766  int myNodeID;
767  UT_Options myOverrides;
768  UT_StringMap<UT_StringHolder> myVertexOverrides;
769  unsigned myDoLighting:1,
770  myMipMapTextures:1,
771  myLimitTextureSize:1,
772  myDefaultShader:1,
773  myAllowShaders:1,
774  myTrivialTextureAlpha:1,
775  myInvertRoughMap:1,
776  myPreloadMaps:1,
777  myTextureLoadPending:1,
778  myCustomShaderDirty:1,
779  myNeedsTexUpdate:1,
780  myNeedsTexCheck:1,
781  myTextureSetup:1,
782  myMatNetDirty:1,
783  myIsTransparent:1,
784  myNeedsTangentSpace:1;
785  int myTextureAnisotropy;
786  int myNumDiffuseLayers;
787 
788  RE_TextureCompress myTexFormat;
789  int myMaxTextureW, myMaxTextureH;
790  float myTextureScale;
791  int myTextureMemLimitMB;
792  float myAlphaPara;
793  bool myShaderAlphaFlag;
794  bool myUseGeoColor;
795  bool myUsePackedColor;
796  bool myDirtyFlag;
797 
798  // Specular parms
799  fpreal myIOR;
800  fpreal32 myReflection;
801  int mySpecModel;
802  bool myReflectAsIOR;
803  bool myExplicitReflection;
804 
805  // Coat parms
806  fpreal myCoatRough;
807  fpreal myCoatIntensity;
808  int myCoatModel;
809 
810  // normal map parms
811  bool myNormalBias;
812  bool myNormalFlipX;
813  bool myNormalFlipY;
814  bool myNormalFlipZ;
815  UT_Vector2F myNormalScale;
816  re_NormalMapType myNormalMapType;
817 
818  // environment map parms
819  UT_Vector3 myEnvRotation;
820  float myEnvScale;
821  UT_XformOrder myEnvRotOrder;
822 
823  // displacement map parms
824  float myDisplaceScale;
825  float myDisplaceOffset;
826  float myDisplaceQuality;
827  re_Displace myDisplaceSpace;
828  bool myDisplaceYUp;
829  float myDisplaceLOD;
830 
831  bool myOpacityMapInvert;
832  int myRoughComp;
833  int myOcclusionComp;
834  int myMetallicComp;
835  bool myEmissionMatCap;
836 
837  RE_Shader *myShader[RE_SHADER_NUM_TARGETS];
838  bool myOwnShader[RE_SHADER_NUM_TARGETS];
839  UT_String myVertexSource[RE_SHADER_NUM_TARGETS];
840  UT_String myGeometrySource[RE_SHADER_NUM_TARGETS];
841  UT_String myFragmentSource[RE_SHADER_NUM_TARGETS];
842  UT_String myShaderProgramFile;
843  int myShaderRef[RE_SHADER_NUM_TARGETS];
844 
845  RE_UniformBlockHandle myMaterialBlock;
846  int myMaterialOverride;
847  bool myMatBlockDirty;
848  bool myMatBlockHasEnvMapTexture;
849  bool myMatBlockHasReflectMapTexture;
850  bool myMatBlockHasDiffuseTexture;
851  bool myTexturedFlag;
852  bool myNeedsUVs;
853  int myTextureCacheSerial;
854 
855  // Hair parameters
856  class re_HairCompParms
857  {
858  public:
859  re_HairCompParms() : intensity(0.5), shift(0.0), angle(1.0),
860  root_col(1,1,1), tip_col(1,1,1),
861  use_ramp(false), use_map(false) {}
862  float intensity;
863  float angle;
864  float shift;
865  UT_Vector3F root_col;
866  UT_Vector3F tip_col;
867  bool use_ramp;
868  bool use_map;
869  };
870  struct re_HairRandomParms
871  {
872  re_HairRandomParms() : randomize(false) {}
873  bool randomize;
875  };
876 
877  bool myHairMaterialEnabled;
878  re_HairCompParms myHairDiffuse;
879  re_HairCompParms myHairSpecular;
880  float myHairAlpha;
881  bool myHairUseAlphaRamp;
882  re_HairRandomParms myHairRandomDiffHue;
883  re_HairRandomParms myHairRandomDiffSat;
884  re_HairRandomParms myHairRandomDiffInt;
885  re_HairRandomParms myHairRandomSpecInt;
886  RE_UniformBlockHandle myHairMaterialBlock;
887  int myHairMatBlockIndex;
888  int myHairRandomTextureIndex;
889  int myHairDiffBaseMapIndex;
890  UT_DimRect myHairDiffBaseMapUDIMArea;
891  UT_DimRect myHairSpecBaseMapUDIMArea;
892 
893  RE_TextureHolder myRandomTexture;
894 
895  // cached texture units for 'myLastMatShader'.
896 
897  int myMatBlockDiffuseIndex;
898  int myMatBlockDiffuseArrayIndex;
899 
900  int myMatBlockEnvMapIndex;
901  int myMatBlockReflectMapIndex;
902  int myMatBlockIndex;
903  int myHairMaterialOverride;
904 
905  // hair material block.
906  void *myLastHairShader;
907  int myLastHairShaderSerial;
908  int myHairDiffIndex;
909  int myHairDiffArrayIndex;
910  int myHairSpecIndex;
911  int myHairSpecArrayIndex;
912  int myHairDiffRampIndex;
913  int myHairSpecRampIndex;
914  int myHairAlphaRampIndex;
915  int myMatBlockHairIndex;
916 
917  // game shader material block
918  RE_UniformBlockHandle myGameMaterialBlock;
919  int myGameMaterialOverride;
920 
921  struct re_GameLayer
922  {
923  re_GameLayer() : triplanar(false), scale(1,1), trans(0,0), rot(0),
924  sharp(1), tpscale(1), transform(1.0),
925  tpblend(1,1,1), tpoff(0,0,0), use_tint(false),
926  tint(1.0, 1.0, 1.0, 1.0), rough(1.0) {}
927  bool triplanar;
930  float rot;
931  float sharp;
932  float tpscale;
933  UT_Vector3F tpblend;
934  UT_Vector3F tpoff;
936  bool use_tint;
937  UT_Vector4F tint;
938  float rough;
939  };
940  UT_Array<re_GameLayer> myGameLayers;
941  const RE_Shader *myLastGameShader;
942  int myLastGameShaderSerial;
943  int myGameBlendIndex;
944  int myGameMatBlockIndex;
945 
946  int myPrevSeamlessCubeMap;
947 
948  bool myTimeDep;
949  fpreal myTime;
950 
951  SYS_AtomicInt32 myRefCount;
952  int64 myUniqueId;
953  int64 myVersion;
954  int64 myTexVersion;
955  int64 myMatXVersion;
956  UT_StringMap<int> myUVSets;
957 
958  class re_UVTransform
959  {
960  public:
961  re_UVTransform() : transform(1.0), identity(true) {}
962  re_UVTransform(const UT_Matrix3F &t, bool i)
963  : transform(t), identity(i) {}
965  bool identity;
966  };
967  UT_Array<re_UVTransform> myTexUVTransform;
968  UT_Array<re_UVTransform> myDiffuseUVTransform;
969 };
970 
971 static inline void intrusive_ptr_add_ref(RE_Material *m) { m->incref(); }
972 static inline void intrusive_ptr_release(RE_Material *m) { m->decref(); }
973 
974 inline void
976 {
977  setAmb(col.x(), col.y(), col.z());
978 }
979 inline void
981 {
982  setDiff(col.x(), col.y(), col.z());
983 }
984 inline void
986 {
987  setSpec(col.x(), col.y(), col.z());
988 }
989 inline void
991 {
992  setEmit(col.x(), col.y(), col.z());
993 }
994 
995 inline bool
997 {
998  if(cache_serial != myTextureCacheSerial)
999  {
1000  myTextureCacheSerial = cache_serial;
1001  myNeedsTexUpdate = true;
1002  return true;
1003  }
1004  if(myTimeDep && !SYSisEqual(t, myTime))
1005  {
1006  myNeedsTexUpdate = true;
1007  return true;
1008  }
1009  return false;
1010 }
1011 
1012 inline bool
1014 {
1016  if(sh)
1017  return sh->hasTessellation();
1018 
1019  return false;
1020 }
1021 
1022 inline RE_Shader*
1024 {
1025  if(myShader[sht])
1026  return myShader[sht];
1027  if(myShaderRef[sht] != 0)
1028  return RE_Shader::lookupProgram(myShaderRef[sht]);
1029  return nullptr;
1030 }
1031 
1032 
1033 inline int
1035 {
1036  return myShaderRef[sht];
1037 }
1038 
1039 // This contains a list of materials for drawing a given geometry, and is
1040 // normally used as a transient list of materials during a redraw.
1041 // This class does not own the materials as they are also held in
1042 // a higher-level cache as well.
1043 class RE_API RE_MaterialAtlas : public UT_Map<int,RE_MaterialPtr>
1044 {
1045 public:
1046  // Default material for unassigned prims.
1048  { return myDefault; }
1049 
1050  // Factory default material if materials are disabled.
1052  { return myFactory; }
1053 
1054  bool isDirty(fpreal time) const;
1055 
1056  RE_MaterialPtr get(int material_id) const
1057  {
1058  if(material_id == -1)
1059  return myDefault ? myDefault : myFactory;
1060  const_iterator entry = find(material_id);
1061  if(entry != end())
1062  return entry->second;
1063 
1064  return nullptr;
1065  }
1066 
1067 
1068  // Add a new material to the atlas
1069  void add(const RE_MaterialPtr &material)
1070  { (*this)[ material->getUniqueId() ] = material; }
1071 
1072  // Set the default material, which will be used if no other material
1073  // assignments are present.
1074  void setDefaultMaterial(const RE_MaterialPtr &material,bool add_list=true)
1075  { myDefault = material; if(add_list && material) add(material); }
1076 
1077  // Sets the factory default material, which is used when all materials
1078  // are turned off (as the default material may be the object material).
1079  void setFactoryMaterial(const RE_MaterialPtr &material,bool add_list=true)
1080  { myFactory = material; if(add_list && material) add(material); }
1081 
1082 private:
1083  RE_MaterialPtr myDefault;
1084  RE_MaterialPtr myFactory;
1085 };
1086 
1087 #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:635
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:657
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:1047
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:629
void setFactoryMaterial(const RE_MaterialPtr &material, bool add_list=true)
Definition: RE_Material.h:1079
GLfloat bias
Definition: glew.h:10316
const RE_UniformBlockHandle & materialBlock() const
Definition: RE_Material.h:633
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:637
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:564
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:1023
bool customShaderDirty() const
Definition: RE_Material.h:352
bool hasMetallicMap() const
Definition: RE_Material.h:236
bool hasDisplacement() const
Definition: RE_Material.h:1013
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:1074
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:565
bool hasEnvMap() const
Definition: RE_Material.h:229
const RE_MaterialPtr & getFactoryMaterial() const
Definition: RE_Material.h:1051
bool useGeometryColor() const
Definition: RE_Material.h:451
bool checkForCacheUpdate(int cache_serial, fpreal t)
Definition: RE_Material.h:996
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:578
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:1069
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:655
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:601
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:1034
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:653