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 
20 class RE_MaterialAtlas;
21 
22 
23 /// A class that manages material assignments to different groups of primitives.
25 {
26 public:
29 
30  int getNumGroups() const { return myMatGroups.entries(); }
31  bool isGroupVisible(int i) const
32  { return myMatGroups(i).visible; }
34  getGroupMaterial(int group_index,
35  const RE_MaterialAtlas &atlas,
36  int default_material = -1) const;
37  int getGroupMaterialID(int group_index) const;
38  int getGroupUnmappedID(int group_index) const
39  { return myMatGroups(group_index).mat_id; }
40 
41  void resetGroups() { myMatGroups.clear(); }
42  void appendGroup(int mat_id)
43  { myMatGroups.append();
44  myMatGroups.last().mat_id = mat_id; }
45  void setNumGroups(int num)
46  { myMatGroups.entries(num); }
47  void setGroupVisibility(int group_index, bool visible)
48  { myMatGroups(group_index).visible = visible; }
49  void setAllGroupsVisible(bool visible = true);
50 
51  void setGroupMaterial(int group_index, int mat_id)
52  { myMatGroups(group_index).mat_id = mat_id; }
53 
54  void updateMaterialRemap(const GT_PrimitiveHandle &for_prim);
55 
56 private:
57  class gr_MatGroup
58  {
59  public:
60  gr_MatGroup() : visible(true), mat_id(-1) {}
61 
62  bool visible;
63  int mat_id;
64  };
65 
66  UT_Array<gr_MatGroup> myMatGroups;
67  UT_Map<int,int> myMatRemap;
68  int64 myMatRemapDataID;
69 };
70 
71 #endif
void setNumGroups(int num)
int getNumGroups() const
void appendGroup(int mat_id)
A class that manages material assignments to different groups of primitives.
png_uint_32 i
Definition: png.h:2877
long long int64
Definition: SYS_Types.h:107
#define GR_API
Definition: GR_API.h:10
void setGroupMaterial(int group_index, int mat_id)
int getGroupUnmappedID(int group_index) const
png_infop png_uint_32 int num
Definition: png.h:2158
bool isGroupVisible(int i) const
void setGroupVisibility(int group_index, bool visible)