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 RE_MaterialAtlas;
22 class GR_MaterialAtlas;
23 
24 
25 /// A class that manages material assignments to different groups of primitives.
27 {
28 public:
31 
32  int getNumGroups() const { return myMatGroups.entries(); }
33  bool isGroupVisible(int i) const
34  { return myMatGroups(i).visible; }
36  getGroupMaterial(int group_index,
37  const RE_MaterialAtlas &atlas,
38  int default_material = -1) const;
40  getGroupMaterial(int group_index,
41  const GR_MaterialAtlas &atlas,
42  int default_material = -1) const;
43  int getGroupMaterialID(int group_index) const;
44  int getGroupUnmappedID(int group_index) const
45  { return myMatGroups(group_index).mat_id; }
46 
47  void resetGroups() { myMatGroups.clear(); }
48  void appendGroup(int mat_id)
49  { myMatGroups.append();
50  myMatGroups.last().mat_id = mat_id; }
51  void setNumGroups(int num)
52  { myMatGroups.entries(num); }
53  void setGroupVisibility(int group_index, bool visible)
54  { myMatGroups(group_index).visible = visible; }
55  void setAllGroupsVisible(bool visible = true);
56 
57  void setGroupMaterial(int group_index, int mat_id)
58  { myMatGroups(group_index).mat_id = mat_id; }
59 
60  void updateMaterialRemap(const GT_PrimitiveHandle &for_prim);
61 
62 private:
63  class gr_MatGroup
64  {
65  public:
66  gr_MatGroup() : visible(true), mat_id(-1) {}
67 
68  bool visible;
69  int mat_id;
70  };
71 
72  UT_Array<gr_MatGroup> myMatGroups;
73  UT_Map<int,int> myMatRemap;
74  int64 myMatRemapDataID;
75 };
76 
77 #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)