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,
279  bool preload,
280  bool draw_textured);
281  bool checkForCacheUpdate(int cache_serial,fpreal t); //inline below
282 
283  bool isMatCapTextured() const { return myEmissionMatCap; }
284 
285  // Returns true if textures are used, and the uvsets used by all layers of
286  // the material.
287  const UT_Map<UT_StringHolder, int> &getUVSets();
288 
289  void clearUVSets();
290  void addUVSet(const UT_StringRef &uv);
291 
292  // Return the texture coord set used by 'layer'
293  const UT_StringHolder &getLayerUVSet(int layer) const;
294 
295  void setTextureFormat(RE_TextureCompress format);
296  RE_TextureCompress getTextureFormat() const { return myTexFormat; }
297 
298  void limitTextureSize(bool limit, int w, int h);
299  bool limitTextureSize() const { return myLimitTextureSize; }
300  void getMaxTextureSize(int &w,int &h)
301  { myMaxTextureW = w;
302  myMaxTextureH = h; }
303 
304  void setTextureScale(float sc);
305  float getTextureScale() const { return myTextureScale; }
306 
307  void setTextureMemLimitMB(int mem);
308  int getTextureMemLimitMB() const { return myTextureMemLimitMB; }
309 
310  void mipMapTextures(bool yes);
311  bool mipMapTextures() const { return myMipMapTextures; }
312 
313  void setAnisotropySamples(int samp);
314  int getAnisotropySamples() const { return myTextureAnisotropy; }
315 
316  void allowShaders(bool yes) { myAllowShaders = yes; }
317  bool allowShaders() const { return myAllowShaders; }
318 
319  // methods to deal with lighting
320  void doLighting(bool yes );
321  bool isLit() const { return myDoLighting; }
322 
324  const char *name = nullptr,
329  { return myOwnShader[sht]; }
330 
331  /// caches the source for the shader in the material.
332  void setShaderSource(const char *vert_src,
333  const char *geom_src,
334  const char *frag_src,
335  RE_ShaderTarget ptype
337 
338  /// checks this materials' shader against the source, and returns true if
339  /// it matches.
340  bool hasShaderSource(const char *vert_src,
341  const char *geom_src,
342  const char *frag_src,
343  RE_ShaderTarget ptype
345 
346  void setShaderProgram(const char *program_file);
347  bool hasShaderProgram(const char *program_file) const;
350  { return myShaderProgramFile.isstring() ||
351  myVertexSource[ptype].isstring() ||
352  myGeometrySource[ptype].isstring() ||
353  myFragmentSource[ptype].isstring(); }
354  bool customShaderDirty() const { return myCustomShaderDirty; }
355 
356  void removeShader();
357 
358  // methods to access and change the material information
359  float amb( unsigned idx ) const { return myAmb[idx]; }
360  UT_Vector3F amb() const { return myAmb; }
361  float diff( unsigned idx ) const { return myDiff[idx]; }
362  UT_Vector3F diff() const { return myDiff; }
363  float spec( unsigned idx ) const { return mySpec[idx]; }
364  UT_Vector3F spec() const { return mySpec; }
365  float emit( unsigned idx ) const { return myEmit[idx]; }
366  UT_Vector3F emit() const { return myEmit; }
367  UT_Vector3F metallicEdgeTint() const { return myMetallicEdge; }
368  float metallic() const { return myMetallic; }
369  float alpha() const { return myAlpha; }
370  float roughness() const { return myRoughness; }
371  float reflection() const { return myReflection; }
372  float coatRoughness() const { return myCoatRough; }
373  float coatIntensity() const { return myCoatIntensity; }
374  float diffuseRoughness() const { return myDiffRoughness; }
375 
376  /// Sets the perpendicular and parallel alpha factors. If the parallel
377  /// alpha is less than zero, they are assumed to be the same.
378  void setAlpha( float alpha_perp, float alpha_para = -1.0 );
379 
380  // Alpha blend/cutout modes.
382  {
383  ALPHA_BLEND = 0, // normal alpha blending C*A + Cbg*(1-A)
384  CUTOUT_ALPHA, // (A >= cutoff) ? C : 0
386  };
387  void setAlphaMode(AlphaMode mode);
389  { return myAlphaMode; }
390 
391  void setAlphaCutoff(fpreal alpha_val);
393  {
394  return (myAlphaMode != IGNORE_ALPHA) ? myAlphaCutoff : 0.0;
395  }
396 
397 
398  /// If true, the shader generates its own alpha independent of the material
399  /// parameters. This indicates that the material requires a transparency
400  /// pass, since the renderer can otherwise not determine this from the
401  /// shader code.
403  { myShaderAlphaFlag = enabled; }
404  bool hasShaderAlpha() const { return myShaderAlphaFlag; }
405 
406  // give roughness: this method will calculate shininess needed by OGL
407  void setRoughness( float r );
408 
409  // give shininess: this method will enforce sh within [0.001, 1e10]
410  void setShininess( float sh );
411 
412  void setDiffuseRoughness(fpreal r);
413 
414  void setAmb( float r, float g, float b );
415  void setDiff( float r, float g, float b );
416  void setSpec( float r, float g, float b );
417  void setEmit( float r, float g, float b );
418  void setMetallic(float metal);
419  void setMetallicEdge(const UT_Vector3F &metal);
420 
421  void setAmbient( UT_Color col );
422  void setDiffuse( UT_Color col );
423  void setSpecular( UT_Color col );
424  void setEmission( UT_Color col );
425 
426  void setAmbient( const UT_Vector3F &col );
427  void setDiffuse( const UT_Vector3F &col );
428  void setSpecular( const UT_Vector3F &col );
429  void setEmission( const UT_Vector3F &col );
430 
431  void setSpecularTint(fpreal t);
432  fpreal getSpecularTint() const { return mySpecTint; }
433 
434  enum { PHONG=0, BLINN=1, GGX=2, SPEC_ANGLE=3 };
435  void setSpecularModel(int spec_model);
436  int getSpecularModel() const { return mySpecModel; }
437  void setCoatSpecularModel(int spec_model);
438  int getCoatSpecuarModel() const { return myCoatModel; }
439  void setCoatIntensity(fpreal i);
440  fpreal getCoatIntensity() const { return myCoatIntensity; }
441  void setCoatRoughness(fpreal r);
442  fpreal getCoatRoughness() const { return myCoatRough; }
443 
444  void setIOR(float ior);
445  fpreal getIOR() const { return myIOR; }
446 
447  void setReflection(float r, bool explicit_r);
448  fpreal getReflection() const;
449 
450  void usePackedColor(bool enable);
451  void useGeometryColor(bool enable);
452  bool usePackedColor() const { return myUsePackedColor; }
453  bool useGeometryColor() const { return myUseGeoColor; }
454 
455  // returns true if reflection was explicity set, not derived from IoR.
456  bool hasExplicitReflection() const { return myExplicitReflection; }
457 
458  void setNeedsTangentSpace(bool b) { myNeedsTangentSpace = b; }
459  bool needsTangentSpace() const
460  {
461  return myNeedsTangentSpace ||
462  (myNormalMap.myMap &&
463  myNormalMapType == NMLMAP_TANGENT);
464  }
465 
466  // Parameters for the bump, spec, opac, env, disp and normal maps.
467  enum re_NormalMapType { NMLMAP_TANGENT=0, NMLMAP_WORLD=1, NMLMAP_OBJECT=2 };
468 
469  void setOpacityMapParms(bool invert, int component);
470  void setNormalParms(re_NormalMapType type, bool bias,
472  bool flip_x, bool flip_y, bool flip_z);
473  void setEnvParms(float scale, const UT_Vector3 &rot,
474  const UT_XformOrder &rord);
475 
476  enum re_Displace {
480  DISPLACE_VECTOR_OBJECT };
481  void setDisplaceParms(float scale, float offset, float quality,
482  re_Displace vector_space, bool y_up);
483  void setDisplaceLOD(float lod) { myDisplaceLOD = lod; }
484  float getDisplaceLOD() const { return myDisplaceLOD; }
485  void setRoughParms(bool invert_map, int component);
486  void setOcclusionParms(int component);
487  void setMetallicParms(int component);
488  void setCoatRoughnessParms(int component);
489  void setCoatIntensityParms(int component);
490  void setReflectionAmountParms(int component, bool affect_ior);
491  void setEmissionParms(bool use_matcap);
492 
493  bool hasDisplacement() const;
494 
495  void setUVTransform(RE_TexMapType maptype,
496  const UT_Matrix3F &xform,
497  int layer = 0);
498  void clearUVTransform(RE_TexMapType maptype,
499  int layer = 0);
500 
501  // Hair parameters
502  void enableHairParameters(bool e) { myHairMaterialEnabled = e; }
503 
504  void setHairDiffuse(float intensity,
505  UT_Vector3F root_col,
506  UT_Vector3F tip_col,
507  bool use_map,
508  bool use_ramp);
509 
510  void setHairSpecular(float intensity,
511  float angle,
512  float shift,
513  UT_Vector3F root_col,
514  UT_Vector3F tip_col,
515  bool use_map,
516  bool use_ramp);
517  void setHairAlpha(float alpha,
518  bool use_alpha_ramp);
519 
520  // randomize hue, sat, and intensity of diffuse (and specular intensity)
521  void setHairRandomize(bool random_hue, UT_Vector2F hue_range,
522  bool random_sat, UT_Vector2F sat_range,
523  bool random_int, UT_Vector2F int_range,
524  bool random_spec_int,
525  UT_Vector2F spec_int_range);
526 
527  // Game shader
528 
529  // Use a transformed UV set.
530  void clearGameLayers();
531  void setUVTransform(int layer,
532  UT_Vector2F t,
533  fpreal r,
534  UT_Vector2F s);
535  void getUVTransform(int layer,
536  UT_Vector2F &t,
537  fpreal &r,
538  UT_Vector2F &s ) const;
539  void setUVLayerTint(int layer, bool use_tint, UT_Vector4F tint,
540  fpreal rough);
541 
542  // Use triplanar projection.
543  void setUVTriplanar(int layer,
544  fpreal scale = 1.0,
545  fpreal sharp = 1.0,
548  bool isUVTriplanar(int layer) const;
549  fpreal getUVTriplanarSharp(int layer) const;
550  fpreal getUVTriplanarScale(int layer) const;
551  UT_Vector3F getUVTriplanarBlend(int layer) const;
552  UT_Vector3F getUVTriplanarOffset(int layer) const;
553  bool getUVLayerUseTint(int layer) const;
554  UT_Vector4F getUVLayerTint(int layer) const;
555  fpreal getUVLayerRough(int layer) const;
556 
557 
558  // For environment lights, which temporarily apply their map to any
559  // materials that don't already have an env map.
560  static void setEnvMapOverride(RE_TextureHolder env_map,
561  const UT_Matrix3F &rot,
562  const UT_Vector3F &col);
563  static void clearEnvMapOverride();
564  static RE_TextureHolder getEnvMapOverride();
565 
566  // Set a diffuse map override. This is just a reference; you manage the tex.
567  void setDiffuseOverride(RE_Texture *diffuse);
568 
569  void setReflectionMap(RE_Texture *map) { myReflectMap = map; }
570  void clearReflectionMap() { myReflectMap = nullptr; }
571 
572 #ifdef UT_DEBUG
573  // debug output
574  void output();
575 #endif
576 
577  RE_MaterialPtr cloneWithoutTexture() const;
578 
579  bool loadTextureMaps(RE_Render *r, bool preload_only = false);
580 
581  // Maps can only be preloaded with loadTextureMaps(), not on the fly during
582  // the render.
583  void preloadMapsOnly(bool preload) { myPreloadMaps = preload; }
584 
585  // Adds an explicit map to 'maptype'. Will be overriden by setTextureMap()
586  // if that has/is called on the material.
587  // nullptr is acceptable (blocks the RE_TextureCB map).
588  void assignTextureMap(RE_Texture *tex,
589  RE_TexMapType maptype,
590  int index = 0);
591  // Remove the explicit map from 'maptype'.
592  void removeTextureMap(RE_TexMapType maptype,
593  int index = 0);
594 
595  void setTextureMap(RE_TextureMap *map,
596  bool give_ownership,
597  RE_TexMapType maptype,
598  const UT_StringRef &uv_set,
599  int index = 0);
600  void clearTextureMap(RE_TexMapType maptype,
601  int index = 0);
602  RE_TextureMap *getTextureMap(RE_TexMapType maptype,
603  int index = 0);
604 
605 
607  { return myMaterialType==FILM_SURFACE ?myNumDiffuseLayers :1; }
608 
609  bool updateShaderForMaterial(
610  RE_Render *r,
611  int layer,
612  bool textured,
614  RE_Shader *shader = nullptr,
615  bool allow_partial = false);
616  void restoreShader(RE_Render *r,
618 
619  /// Returns the amount of main memory (NOT graphics memory!)
620  /// owned by this RE_Material.
621  int64 getMemoryUsage(bool inclusive) const;
622 
623 
624  void writeMaterialParmsToBlockGL4(RE_Render *r,
625  RE_UniformBlock *block,
626  int material_idx,
627  int layer,
628  bool lit,
629  bool textured);
630  // For bindless texturing.
631  void makeTexturesResident(RE_Render *r);
632  void removeTexturesFromResident(RE_Render *r);
633 
634  DEP_MicroNode &dependencies() { return myDepNode; }
635 
636  void updateMaterialBlock(int layer, bool textured);
637 
639  { return myMaterialBlock; }
641  { return myHairMaterialBlock; }
643  { return myGameMaterialBlock; }
644 private:
645 
646  void loadShaderAttribNames();
647 
648  class re_MaterialTextureMap
649  {
650  public:
651  re_MaterialTextureMap()
652  : myMap(nullptr), myMapIndex(-1),
653  myArrayMapIndex(-1), myTexCoords(0), myComponent(0),
654  myExplicitMap(false), myOwnMap(false) {}
655  ~re_MaterialTextureMap()
656  {
657  if(myOwnMap)
658  delete myMap;
659  }
660  RE_TextureMap *myMap;
661  RE_TextureHolder myTex;
662  RE_CacheVersion myTexVersion;
663  UT_StringHolder myUVSet;
664  UT_DimRect myUDIMArea;
665  int myMapIndex;
666  int myArrayMapIndex;
667  int myTexCoords;
668  int myComponent;
669  bool myExplicitMap;
670  bool myOwnMap;
671  };
672  re_MaterialTextureMap *fetchMapInfo(RE_TexMapType t,
673  int index);
674 
675  RE_TextureHolder fetchTexture(RE_Render *r, RE_TextureMap *map,
676  bool preload_only = false,
677  bool mipmap = true);
678  RE_TextureHolder fetchMap(RE_Render *r,
679  RE_TexMapType map_target,
680  re_MaterialTextureMap &map,
681  bool preload,
682  bool promote_1chan_to_rgb = false);
683 
684  bool bindTextureMap(RE_Render *r, re_MaterialTextureMap &map,
685  const char *udim_stride_name,
686  RE_TexMapType type,
687  const char *component_name = nullptr);
688  void bindUVTransform(RE_TexMapType type,
689  int layer = 0);
690  void bindComponentAndUDIM(re_MaterialTextureMap &map,
691  const char *udim_area_name,
692  const char *component_name = nullptr);
693  void bindTextureMaps(RE_Render *r, int layer);
694 private:
695  ~RE_Material(); // No subclassing
696 
697  void updateHairMaterialForShader(RE_Render *r,
698  bool textured,
699  RE_ShaderTarget sht,
700  RE_Shader *sh);
701  void updateGameMaterialForShader(RE_Render *r,
702  bool textured,
703  RE_ShaderTarget sht,
704  RE_Shader *sh);
705 
706  // -- Bindless texturing support
707  void makeResident(RE_Render *r, RE_TextureHolder texmap);
708  void removeResident(RE_Render *r, RE_TextureHolder texmap);
709  bool bindTextureHandle(RE_Render *r,
710  re_MaterialTextureMap &map,
711  RE_UniformBlock *material_block,
712  int material_index,
713  const char *texture_name);
714  // --
715 
716  UT_Vector4F getComponentVector(int comp,
717  const re_MaterialTextureMap &map) const;
718 
719  DEP_MicroNode myDepNode;
720  UT_Vector3F myAmb;
721  UT_Vector3F myDiff;
722  UT_Vector3F mySpec;
723  UT_Vector3F myEmit;
724  UT_Vector3F myMetallicEdge;
725  float myMetallic;
726  float myAlpha;
727  float myRoughness;
728  float myDiffRoughness;
729  float mySpecTint;
730  RE_MaterialType myMaterialType;
731  AlphaMode myAlphaMode;
732  float myAlphaCutoff;
733 
734  // I own map if if I created my RE_OGLTex
736 
737  RE_Texture *myReflectMap; // always temporary during a render
738  RE_TextureHolder myDiffuseOverrideRef; // not owned; just a ref.
739 
740  re_MaterialTextureMap mySpecMap;
741  re_MaterialTextureMap myOpacityMap;
742  re_MaterialTextureMap myBumpMap;
743  re_MaterialTextureMap myRoughMap;
744  re_MaterialTextureMap myEmissionMap;
745  re_MaterialTextureMap myNormalMap;
746  re_MaterialTextureMap myDisplaceMap;
747  re_MaterialTextureMap myOcclusionMap;
748  re_MaterialTextureMap myMetallicMap;
749  re_MaterialTextureMap myCoatRoughMap;
750  re_MaterialTextureMap myCoatIntMap;
751  re_MaterialTextureMap myReflectAmountMap;
752  re_MaterialTextureMap myGameBlendMap;
753  re_MaterialTextureMap myEnvMap;
754  re_MaterialTextureMap myHairDiffMap;
755  re_MaterialTextureMap myHairSpecMap;
756  re_MaterialTextureMap myHairDiffRamp;
757  re_MaterialTextureMap myHairSpecRamp;
758  re_MaterialTextureMap myHairAlphaRamp;
759 
760  UT_Array<RE_TextureMap *> myMatXTextures;
761 
762  UT_IntArray mySamplerBindings;
763 
764  // The above maps are only valid pointers if myRenderCount is equal to
765  // RE_OGLRender::getRenderCount.
766  int64 myRenderCount;
767 
768 
769  UT_StringHolder myMaterialName;
770  UT_StringHolder myNodePath;
771  UT_StringHolder myMatNetName;
772  int myNodeID;
773  UT_Options myOverrides;
774  UT_StringMap<UT_StringHolder> myVertexOverrides;
775  unsigned myDoLighting:1,
776  myMipMapTextures:1,
777  myLimitTextureSize:1,
778  myDefaultShader:1,
779  myAllowShaders:1,
780  myTrivialTextureAlpha:1,
781  myInvertRoughMap:1,
782  myPreloadMaps:1,
783  myTextureLoadPending:1,
784  myCustomShaderDirty:1,
785  myNeedsTexUpdate:1,
786  myNeedsTexCheck:1,
787  myTextureSetup:1,
788  myMatNetDirty:1,
789  myIsTransparent:1,
790  myNeedsTangentSpace:1;
791  int myTextureAnisotropy;
792  int myNumDiffuseLayers;
793 
794  RE_TextureCompress myTexFormat;
795  int myMaxTextureW, myMaxTextureH;
796  float myTextureScale;
797  int myTextureMemLimitMB;
798  float myAlphaPara;
799  bool myShaderAlphaFlag;
800  bool myUseGeoColor;
801  bool myUsePackedColor;
802  bool myDirtyFlag;
803 
804  // Specular parms
805  fpreal myIOR;
806  fpreal32 myReflection;
807  int mySpecModel;
808  bool myReflectAsIOR;
809  bool myExplicitReflection;
810 
811  // Coat parms
812  fpreal myCoatRough;
813  fpreal myCoatIntensity;
814  int myCoatModel;
815 
816  // normal map parms
817  bool myNormalBias;
818  bool myNormalFlipX;
819  bool myNormalFlipY;
820  bool myNormalFlipZ;
821  UT_Vector2F myNormalScale;
822  re_NormalMapType myNormalMapType;
823 
824  // environment map parms
825  UT_Vector3 myEnvRotation;
826  float myEnvScale;
827  UT_XformOrder myEnvRotOrder;
828 
829  // displacement map parms
830  float myDisplaceScale;
831  float myDisplaceOffset;
832  float myDisplaceQuality;
833  re_Displace myDisplaceSpace;
834  bool myDisplaceYUp;
835  float myDisplaceLOD;
836 
837  bool myOpacityMapInvert;
838  int myRoughComp;
839  int myOcclusionComp;
840  int myMetallicComp;
841  bool myEmissionMatCap;
842 
843  RE_Shader *myShader[RE_SHADER_NUM_TARGETS];
844  bool myOwnShader[RE_SHADER_NUM_TARGETS];
845  UT_String myVertexSource[RE_SHADER_NUM_TARGETS];
846  UT_String myGeometrySource[RE_SHADER_NUM_TARGETS];
847  UT_String myFragmentSource[RE_SHADER_NUM_TARGETS];
848  UT_String myShaderProgramFile;
849  int myShaderRef[RE_SHADER_NUM_TARGETS];
850 
851  RE_UniformBlockHandle myMaterialBlock;
852  int myMaterialOverride;
853  bool myMatBlockDirty;
854  bool myMatBlockHasEnvMapTexture;
855  bool myMatBlockHasReflectMapTexture;
856  bool myMatBlockHasDiffuseTexture;
857  bool myTexturedFlag;
858  bool myNeedsUVs;
859  bool myDrawTextures;
860  int myTextureCacheSerial;
861 
862  // Hair parameters
863  class re_HairCompParms
864  {
865  public:
866  re_HairCompParms() : intensity(0.5), shift(0.0), angle(1.0),
867  root_col(1,1,1), tip_col(1,1,1),
868  use_ramp(false), use_map(false) {}
869  float intensity;
870  float angle;
871  float shift;
872  UT_Vector3F root_col;
873  UT_Vector3F tip_col;
874  bool use_ramp;
875  bool use_map;
876  };
877  struct re_HairRandomParms
878  {
879  re_HairRandomParms() : randomize(false) {}
880  bool randomize;
882  };
883 
884  bool myHairMaterialEnabled;
885  re_HairCompParms myHairDiffuse;
886  re_HairCompParms myHairSpecular;
887  float myHairAlpha;
888  bool myHairUseAlphaRamp;
889  re_HairRandomParms myHairRandomDiffHue;
890  re_HairRandomParms myHairRandomDiffSat;
891  re_HairRandomParms myHairRandomDiffInt;
892  re_HairRandomParms myHairRandomSpecInt;
893  RE_UniformBlockHandle myHairMaterialBlock;
894  int myHairMatBlockIndex;
895  int myHairRandomTextureIndex;
896  int myHairDiffBaseMapIndex;
897  UT_DimRect myHairDiffBaseMapUDIMArea;
898  UT_DimRect myHairSpecBaseMapUDIMArea;
899 
900  RE_TextureHolder myRandomTexture;
901 
902  // cached texture units for 'myLastMatShader'.
903 
904  int myMatBlockDiffuseIndex;
905  int myMatBlockDiffuseArrayIndex;
906 
907  int myMatBlockEnvMapIndex;
908  int myMatBlockReflectMapIndex;
909  int myMatBlockIndex;
910  int myHairMaterialOverride;
911 
912  // hair material block.
913  void *myLastHairShader;
914  int myLastHairShaderSerial;
915  int myHairDiffIndex;
916  int myHairDiffArrayIndex;
917  int myHairSpecIndex;
918  int myHairSpecArrayIndex;
919  int myHairDiffRampIndex;
920  int myHairSpecRampIndex;
921  int myHairAlphaRampIndex;
922  int myMatBlockHairIndex;
923 
924  // game shader material block
925  RE_UniformBlockHandle myGameMaterialBlock;
926  int myGameMaterialOverride;
927 
928  struct re_GameLayer
929  {
930  re_GameLayer() : triplanar(false), scale(1,1), trans(0,0), rot(0),
931  sharp(1), tpscale(1), transform(1.0),
932  tpblend(1,1,1), tpoff(0,0,0), use_tint(false),
933  tint(1.0, 1.0, 1.0, 1.0), rough(1.0) {}
934  bool triplanar;
937  float rot;
938  float sharp;
939  float tpscale;
940  UT_Vector3F tpblend;
941  UT_Vector3F tpoff;
943  bool use_tint;
944  UT_Vector4F tint;
945  float rough;
946  };
947  UT_Array<re_GameLayer> myGameLayers;
948  const RE_Shader *myLastGameShader;
949  int myLastGameShaderSerial;
950  int myGameBlendIndex;
951  int myGameMatBlockIndex;
952 
953  int myPrevSeamlessCubeMap;
954 
955  bool myTimeDep;
956  fpreal myTime;
957 
958  SYS_AtomicInt32 myRefCount;
959  int64 myUniqueId;
960  int64 myVersion;
961  int64 myTexVersion;
962  int64 myMatXVersion;
963  UT_StringMap<int> myUVSets;
964 
965  class re_UVTransform
966  {
967  public:
968  re_UVTransform() : transform(1.0), identity(true) {}
969  re_UVTransform(const UT_Matrix3F &t, bool i)
970  : transform(t), identity(i) {}
972  bool identity;
973  };
974  UT_Array<re_UVTransform> myTexUVTransform;
975  UT_Array<re_UVTransform> myDiffuseUVTransform;
976 };
977 
978 static inline void intrusive_ptr_add_ref(RE_Material *m) { m->incref(); }
979 static inline void intrusive_ptr_release(RE_Material *m) { m->decref(); }
980 
981 inline void
983 {
984  setAmb(col.x(), col.y(), col.z());
985 }
986 inline void
988 {
989  setDiff(col.x(), col.y(), col.z());
990 }
991 inline void
993 {
994  setSpec(col.x(), col.y(), col.z());
995 }
996 inline void
998 {
999  setEmit(col.x(), col.y(), col.z());
1000 }
1001 
1002 inline bool
1004 {
1005  if(cache_serial != myTextureCacheSerial)
1006  {
1007  myTextureCacheSerial = cache_serial;
1008  myNeedsTexUpdate = true;
1009  return true;
1010  }
1011  if(myTimeDep && !SYSisEqual(t, myTime))
1012  {
1013  myNeedsTexUpdate = true;
1014  return true;
1015  }
1016  return false;
1017 }
1018 
1019 inline bool
1021 {
1023  if(sh)
1024  return sh->hasTessellation();
1025 
1026  return false;
1027 }
1028 
1029 inline RE_Shader*
1031 {
1032  if(myShader[sht])
1033  return myShader[sht];
1034  if(myShaderRef[sht] != 0)
1035  return RE_Shader::lookupProgram(myShaderRef[sht]);
1036  return nullptr;
1037 }
1038 
1039 
1040 inline int
1042 {
1043  return myShaderRef[sht];
1044 }
1045 
1046 // This contains a list of materials for drawing a given geometry, and is
1047 // normally used as a transient list of materials during a redraw.
1048 // This class does not own the materials as they are also held in
1049 // a higher-level cache as well.
1050 class RE_API RE_MaterialAtlas : public UT_Map<int,RE_MaterialPtr>
1051 {
1052 public:
1053  // Default material for unassigned prims.
1055  { return myDefault; }
1056 
1057  // Factory default material if materials are disabled.
1059  { return myFactory; }
1060 
1061  bool isDirty(fpreal time) const;
1062 
1063  RE_MaterialPtr get(int material_id) const
1064  {
1065  if(material_id == -1)
1066  return myDefault ? myDefault : myFactory;
1067  const_iterator entry = find(material_id);
1068  if(entry != end())
1069  return entry->second;
1070 
1071  return nullptr;
1072  }
1073 
1074 
1075  // Add a new material to the atlas
1076  void add(const RE_MaterialPtr &material)
1077  { (*this)[ material->getUniqueId() ] = material; }
1078 
1079  // Set the default material, which will be used if no other material
1080  // assignments are present.
1081  void setDefaultMaterial(const RE_MaterialPtr &material,bool add_list=true)
1082  { myDefault = material; if(add_list && material) add(material); }
1083 
1084  // Sets the factory default material, which is used when all materials
1085  // are turned off (as the default material may be the object material).
1086  void setFactoryMaterial(const RE_MaterialPtr &material,bool add_list=true)
1087  { myFactory = material; if(add_list && material) add(material); }
1088 
1089 private:
1090  RE_MaterialPtr myDefault;
1091  RE_MaterialPtr myFactory;
1092 };
1093 
1094 #endif
void setDiffuse(UT_Color col)
bool mipMapTextures() const
Definition: RE_Material.h:311
void setTextured(bool has_tex)
Definition: RE_Material.h:264
UT_Vector3F spec() const
Definition: RE_Material.h:364
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:369
void setVersion(int64 v)
Definition: RE_Material.h:51
float getDisplaceLOD() const
Definition: RE_Material.h:484
GLenum GLint * range
Definition: glcorearb.h:1925
bool hasOpacityMap() const
Definition: RE_Material.h:227
int64 getVersion() const
Definition: RE_Material.h:50
float reflection() const
Definition: RE_Material.h:371
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
void incref()
Definition: RE_Material.h:71
#define RE_API
Definition: RE_API.h:10
bool isTimeDependent() const
Definition: RE_Material.h:68
SIM_API const UT_StringHolder angle
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
const GLdouble * v
Definition: glcorearb.h:837
UT_Vector3F diff() const
Definition: RE_Material.h:362
Transformation order of scales, rotates, and translates.
Definition: UT_XformOrder.h:23
float roughness() const
Definition: RE_Material.h:370
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
const RE_UniformBlockHandle & hairBlock() const
Definition: RE_Material.h:640
GA_API const UT_StringHolder rot
bool isMatCapTextured() const
Definition: RE_Material.h:283
void setEmit(float r, float g, float b)
GLboolean GLboolean g
Definition: glcorearb.h:1222
float metallic() const
Definition: RE_Material.h:368
int getSpecularModel() const
Definition: RE_Material.h:436
constexpr SYS_FORCE_INLINE T & z() noexcept
Definition: UT_Vector3.h:667
bool areTexturesPending()
Definition: RE_Material.h:218
void setShaderAlpha(bool enabled)
Definition: RE_Material.h:402
bool hasShaderAlpha() const
Definition: RE_Material.h:404
const RE_MaterialPtr & getDefaultMaterial() const
Definition: RE_Material.h:1054
void decref()
Definition: RE_Material.h:72
GLdouble s
Definition: glad.h:3009
bool hasTessellation() const
Definition: RE_Shader.h:787
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
fpreal getCurrentTime() const
Definition: RE_Material.h:69
int getTextureMemLimitMB() const
Definition: RE_Material.h:308
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
int getAnisotropySamples() const
Definition: RE_Material.h:314
bool isShaderOwned(RE_ShaderTarget sht=RE_SHADER_TARGET_TRIANGLE) const
Definition: RE_Material.h:327
static RE_Shader * lookupProgram(int id)
GLenum GLuint GLint GLint layer
Definition: glcorearb.h:1299
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_UniquePtr.h:39
bool needsTangentSpace() const
Definition: RE_Material.h:459
bool isMatNetDirty() const
Definition: RE_Material.h:91
vint4 blend(const vint4 &a, const vint4 &b, const vbool4 &mask)
Definition: simd.h:4784
RE_MaterialType getMaterialType() const
Definition: RE_Material.h:114
GA_API const UT_StringHolder scale
bool hasHairSpecularRamp() const
Definition: RE_Material.h:251
float amb(unsigned idx) const
Definition: RE_Material.h:359
GLfloat f
Definition: glcorearb.h:1926
DEP_MicroNode & dependencies()
Definition: RE_Material.h:634
void setFactoryMaterial(const RE_MaterialPtr &material, bool add_list=true)
Definition: RE_Material.h:1086
GLintptr offset
Definition: glcorearb.h:665
const RE_UniformBlockHandle & materialBlock() const
Definition: RE_Material.h:638
void intrusive_ptr_release(T *x)
Definition: refcnt.h:217
bool hasDisplaceMap() const
Definition: RE_Material.h:228
int getCoatSpecuarModel() const
Definition: RE_Material.h:438
const RE_UniformBlockHandle & gameMatBlock() const
Definition: RE_Material.h:642
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
bool hasNormalMap() const
Definition: RE_Material.h:226
void setReflectionMap(RE_Texture *map)
Definition: RE_Material.h:569
bool usePackedColor() const
Definition: RE_Material.h:452
GLuint GLuint end
Definition: glcorearb.h:475
bool limitTextureSize() const
Definition: RE_Material.h:299
GLint GLint GLsizei GLint GLenum format
Definition: glcorearb.h:108
fpreal getIOR() const
Definition: RE_Material.h:445
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:1030
bool customShaderDirty() const
Definition: RE_Material.h:354
bool hasMetallicMap() const
Definition: RE_Material.h:236
bool hasDisplacement() const
Definition: RE_Material.h:1020
long long int64
Definition: SYS_Types.h:116
void needTextureUpdate()
Definition: RE_Material.h:270
GLfloat GLfloat GLfloat alpha
Definition: glcorearb.h:112
const UT_StringRef & getMatNetName() const
Definition: RE_Material.h:86
GLuint const GLchar * name
Definition: glcorearb.h:786
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1222
GA_API const UT_StringHolder transform
void setEmission(UT_Color col)
bool isLit() const
Definition: RE_Material.h:321
fpreal getCoatIntensity() const
Definition: RE_Material.h:440
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
GLdouble t
Definition: glad.h:2397
bool allowShaders() const
Definition: RE_Material.h:317
void enableHairParameters(bool e)
Definition: RE_Material.h:502
GLenum mode
Definition: glcorearb.h:99
float diff(unsigned idx) const
Definition: RE_Material.h:361
GT_API const UT_StringHolder version
void setDefaultMaterial(const RE_MaterialPtr &material, bool add_list=true)
Definition: RE_Material.h:1081
UT_Vector3T< fpreal32 > UT_Vector3F
float emit(unsigned idx) const
Definition: RE_Material.h:365
float coatRoughness() const
Definition: RE_Material.h:372
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:388
float diffuseRoughness() const
Definition: RE_Material.h:374
bool hasCoatRoughnessMap() const
Definition: RE_Material.h:238
float spec(unsigned idx) const
Definition: RE_Material.h:363
float coatIntensity() const
Definition: RE_Material.h:373
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:570
bool hasEnvMap() const
Definition: RE_Material.h:229
const RE_MaterialPtr & getFactoryMaterial() const
Definition: RE_Material.h:1058
bool useGeometryColor() const
Definition: RE_Material.h:453
bool checkForCacheUpdate(int cache_serial, fpreal t)
Definition: RE_Material.h:1003
void setVertexOverrides(const UT_StringMap< UT_StringHolder > &ovr)
Definition: RE_Material.h:100
UT_Vector3F metallicEdgeTint() const
Definition: RE_Material.h:367
fpreal64 fpreal
Definition: SYS_Types.h:277
bool hasHairAlphaRamp() const
Definition: RE_Material.h:253
void setDisplaceLOD(float lod)
Definition: RE_Material.h:483
bool hasEmissionMap() const
Definition: RE_Material.h:230
GLuint index
Definition: glcorearb.h:786
void preloadMapsOnly(bool preload)
Definition: RE_Material.h:583
RE_TextureCompress getTextureFormat() const
Definition: RE_Material.h:296
void setAmbient(UT_Color col)
UT_Vector3F amb() const
Definition: RE_Material.h:360
void dirtyMatNet(bool dirty=true)
Definition: RE_Material.h:90
void setNeedsTangentSpace(bool b)
Definition: RE_Material.h:458
const UT_StringHolder & getMaterialName() const
Definition: RE_Material.h:47
MX_RENDER_API ShaderPtr createShader(const string &shaderName, GenContext &context, ElementPtr elem)
Create a shader for a given element.
fpreal getAlphaCutoff() const
Definition: RE_Material.h:392
int getNodeId() const
Definition: RE_Material.h:81
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:857
Simple class for a mutli-integer cache tag.
UT_Vector3F emit() const
Definition: RE_Material.h:366
void add(const RE_MaterialPtr &material)
Definition: RE_Material.h:1076
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)
GLboolean r
Definition: glcorearb.h:1222
void getMaxTextureSize(int &w, int &h)
Definition: RE_Material.h:300
RE_ShaderTarget
Definition: RE_Types.h:269
bool hasExplicitReflection() const
Definition: RE_Material.h:456
RE_TextureCompress
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector3.h:665
bool SYSisEqual(const UT_Vector2T< T > &a, const UT_Vector2T< T > &b, S tol=SYS_FTOLERANCE)
Componentwise equality.
Definition: UT_Vector2.h:674
type
Definition: core.h:1059
bool isDirty(fpreal time) const
Definition: RE_Material.h:54
fpreal getCoatRoughness() const
Definition: RE_Material.h:442
Base::const_iterator const_iterator
Definition: UT_Map.h:118
bool isTextured() const
Definition: RE_Material.h:263
int getNumDiffuseLayers() const
Definition: RE_Material.h:606
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:305
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:432
void allowShaders(bool yes)
Definition: RE_Material.h:316
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:1041
bool hasCustomShader(RE_ShaderTarget ptype=RE_SHADER_TARGET_TRIANGLE) const
Definition: RE_Material.h:348
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector3.h:663