HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GR_MaterialGroups.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: GR_MaterialGroups.h (GR Library, C++)
7  *
8  * COMMENTS:
9  */
10 #ifndef GR_MaterialGroups_h
11 #define GR_MaterialGroups_h
12 
13 #include <GT/GT_Primitive.h>
14 #include <RE/RE_Types.h>
15 #include <UT/UT_Array.h>
16 #include <UT/UT_Map.h>
17 
18 #include "GR_API.h"
19 #include "GR_Defines.h"
20 
21 class GR_MaterialAtlas;
22 
23 
24 /// A class that manages material assignments to different groups of primitives.
26 {
27 public:
30 
31  int getNumGroups() const { return myMatGroups.entries(); }
32  bool isGroupVisible(int i) const
33  { return myMatGroups(i).visible; }
35  getGroupMaterial(int group_index,
36  const GR_MaterialAtlas &atlas,
37  int default_material = -1) const;
38  int getGroupMaterialID(int group_index, int default_material) const;
39  int getGroupUnmappedID(int group_index) const
40  { return myMatGroups(group_index).mat_id; }
41 
42  void resetGroups() { myMatGroups.clear(); }
43  void appendGroup(int mat_id)
44  { myMatGroups.append();
45  myMatGroups.last().mat_id = mat_id; }
46  void setNumGroups(int num)
47  { myMatGroups.entries(num); }
48  void setGroupVisibility(int group_index, bool visible)
49  { myMatGroups(group_index).visible = visible; }
50  void setAllGroupsVisible(bool visible = true);
51 
52  void setGroupMaterial(int group_index, int mat_id)
53  { myMatGroups(group_index).mat_id = mat_id; }
54 
55  void updateMaterialRemap(const GT_PrimitiveHandle &for_prim);
56 
57 private:
58  class gr_MatGroup
59  {
60  public:
61  gr_MatGroup() : visible(true), mat_id(-1) {}
62 
63  bool visible;
64  int mat_id;
65  };
66 
67  UT_Array<gr_MatGroup> myMatGroups;
68  UT_Map<int,int> myMatRemap;
69  int64 myMatRemapDataID;
70 };
71 
72 #endif
void setNumGroups(int num)
int getNumGroups() const
void appendGroup(int mat_id)
A class that manages material assignments to different groups of primitives.
#define GR_API
Definition: GR_API.h:10
void setGroupMaterial(int group_index, int mat_id)
long long int64
Definition: SYS_Types.h:116
int getGroupUnmappedID(int group_index) const
bool isGroupVisible(int i) const
void setGroupVisibility(int group_index, bool visible)