Skip to content

Commit cf01ef9

Browse files
committed
add NodePath::find_material(), find_all_texcoords(), etc. Make Material be directly modifiable.
1 parent 2832172 commit cf01ef9

37 files changed

+1198
-103
lines changed

panda/src/distort/projectionScreen.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ class EXPCL_PANDAFX ProjectionScreen : public PandaNode {
124124

125125
NodePath _projector;
126126
PT(LensNode) _projector_node;
127-
CPT(InternalName) _texcoord_name;
127+
PT(InternalName) _texcoord_name;
128128
bool _invert_uvs;
129129
bool _vignette_on;
130130
Colorf _vignette_color;

panda/src/dxgsg8/dxGeomMunger8.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ munge_format_impl(const GeomVertexFormat *orig,
118118
for (int i = 0; i < num_stages; ++i) {
119119
TextureStage *stage = _texture->get_on_stage(i);
120120

121-
const InternalName *name = stage->get_texcoord_name();
121+
InternalName *name = stage->get_texcoord_name();
122122
if (used_stages.insert(name).second) {
123123
// This is the first time we've encountered this texcoord name.
124124
const GeomVertexColumn *texcoord_type = orig->get_column(name);

panda/src/dxgsg9/dxGeomMunger9.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ munge_format_impl(const GeomVertexFormat *orig,
118118
for (int i = 0; i < num_stages; ++i) {
119119
TextureStage *stage = _texture->get_on_stage(i);
120120

121-
const InternalName *name = stage->get_texcoord_name();
121+
InternalName *name = stage->get_texcoord_name();
122122
if (used_stages.insert(name).second) {
123123
// This is the first time we've encountered this texcoord name.
124124
const GeomVertexColumn *texcoord_type = orig->get_column(name);

panda/src/egg2pg/eggLoader.cxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2156,8 +2156,7 @@ record_morph(GeomVertexArrayFormat *array_format,
21562156
CharacterMaker *character_maker,
21572157
const string &morph_name, InternalName *column_name,
21582158
int num_components) {
2159-
CPT(InternalName) slider_name = InternalName::make(morph_name);
2160-
CPT(InternalName) delta_name =
2159+
PT(InternalName) delta_name =
21612160
InternalName::get_morph(column_name, morph_name);
21622161
if (!array_format->has_column(delta_name)) {
21632162
array_format->add_column

panda/src/egg2pg/eggRenderState.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ get_material_attrib(const EggMaterial *egg_mat, bool bface) {
450450

451451
// Ok, this is the first time we've seen this particular
452452
// EggMaterial. Create a new Material that matches it.
453-
PT(Material) mat = new Material;
453+
PT(Material) mat = new Material(egg_mat->get_name());
454454
if (egg_mat->has_diff()) {
455455
mat->set_diffuse(egg_mat->get_diff());
456456
// By default, ambient is the same as diffuse, if diffuse is
@@ -476,7 +476,7 @@ get_material_attrib(const EggMaterial *egg_mat, bool bface) {
476476
mat->set_twoside(bface);
477477

478478
// Now get a global Material pointer, shared with other models.
479-
const Material *shared_mat = MaterialPool::get_material(mat);
479+
Material *shared_mat = MaterialPool::get_material(mat);
480480

481481
// And create a MaterialAttrib for this Material.
482482
CPT(RenderAttrib) mt = MaterialAttrib::make(shared_mat);

panda/src/gobj/geomVertexArrayFormat.cxx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ GeomVertexArrayFormat() :
4949
// Description:
5050
////////////////////////////////////////////////////////////////////
5151
GeomVertexArrayFormat::
52-
GeomVertexArrayFormat(const InternalName *name0, int num_components0,
52+
GeomVertexArrayFormat(InternalName *name0, int num_components0,
5353
GeomVertexArrayFormat::NumericType numeric_type0,
5454
GeomVertexArrayFormat::Contents contents0) :
5555
_is_registered(false),
@@ -67,10 +67,10 @@ GeomVertexArrayFormat(const InternalName *name0, int num_components0,
6767
// Description:
6868
////////////////////////////////////////////////////////////////////
6969
GeomVertexArrayFormat::
70-
GeomVertexArrayFormat(const InternalName *name0, int num_components0,
70+
GeomVertexArrayFormat(InternalName *name0, int num_components0,
7171
GeomVertexArrayFormat::NumericType numeric_type0,
7272
GeomVertexArrayFormat::Contents contents0,
73-
const InternalName *name1, int num_components1,
73+
InternalName *name1, int num_components1,
7474
GeomVertexArrayFormat::NumericType numeric_type1,
7575
GeomVertexArrayFormat::Contents contents1) :
7676
_is_registered(false),
@@ -89,13 +89,13 @@ GeomVertexArrayFormat(const InternalName *name0, int num_components0,
8989
// Description:
9090
////////////////////////////////////////////////////////////////////
9191
GeomVertexArrayFormat::
92-
GeomVertexArrayFormat(const InternalName *name0, int num_components0,
92+
GeomVertexArrayFormat(InternalName *name0, int num_components0,
9393
GeomVertexArrayFormat::NumericType numeric_type0,
9494
GeomVertexArrayFormat::Contents contents0,
95-
const InternalName *name1, int num_components1,
95+
InternalName *name1, int num_components1,
9696
GeomVertexArrayFormat::NumericType numeric_type1,
9797
GeomVertexArrayFormat::Contents contents1,
98-
const InternalName *name2, int num_components2,
98+
InternalName *name2, int num_components2,
9999
GeomVertexArrayFormat::NumericType numeric_type2,
100100
GeomVertexArrayFormat::Contents contents2) :
101101
_is_registered(false),
@@ -115,16 +115,16 @@ GeomVertexArrayFormat(const InternalName *name0, int num_components0,
115115
// Description:
116116
////////////////////////////////////////////////////////////////////
117117
GeomVertexArrayFormat::
118-
GeomVertexArrayFormat(const InternalName *name0, int num_components0,
118+
GeomVertexArrayFormat(InternalName *name0, int num_components0,
119119
GeomVertexArrayFormat::NumericType numeric_type0,
120120
GeomVertexArrayFormat::Contents contents0,
121-
const InternalName *name1, int num_components1,
121+
InternalName *name1, int num_components1,
122122
GeomVertexArrayFormat::NumericType numeric_type1,
123123
GeomVertexArrayFormat::Contents contents1,
124-
const InternalName *name2, int num_components2,
124+
InternalName *name2, int num_components2,
125125
GeomVertexArrayFormat::NumericType numeric_type2,
126126
GeomVertexArrayFormat::Contents contents2,
127-
const InternalName *name3, int num_components3,
127+
InternalName *name3, int num_components3,
128128
GeomVertexArrayFormat::NumericType numeric_type3,
129129
GeomVertexArrayFormat::Contents contents3) :
130130
_is_registered(false),
@@ -208,7 +208,7 @@ GeomVertexArrayFormat::
208208
// type.
209209
////////////////////////////////////////////////////////////////////
210210
int GeomVertexArrayFormat::
211-
add_column(const InternalName *name, int num_components,
211+
add_column(InternalName *name, int num_components,
212212
GeomVertexArrayFormat::NumericType numeric_type,
213213
GeomVertexArrayFormat::Contents contents, int start) {
214214
if (start < 0) {

panda/src/gobj/geomVertexArrayFormat.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,25 +57,25 @@ class EXPCL_PANDA GeomVertexArrayFormat : public TypedWritableReferenceCount, pu
5757
PUBLISHED:
5858
GeomVertexArrayFormat();
5959
GeomVertexArrayFormat(const GeomVertexArrayFormat &copy);
60-
GeomVertexArrayFormat(const InternalName *name0, int num_components0,
60+
GeomVertexArrayFormat(InternalName *name0, int num_components0,
6161
NumericType numeric_type0, Contents contents0);
62-
GeomVertexArrayFormat(const InternalName *name0, int num_components0,
62+
GeomVertexArrayFormat(InternalName *name0, int num_components0,
6363
NumericType numeric_type0, Contents contents0,
64-
const InternalName *name1, int num_components1,
64+
InternalName *name1, int num_components1,
6565
NumericType numeric_type1, Contents contents1);
66-
GeomVertexArrayFormat(const InternalName *name0, int num_components0,
66+
GeomVertexArrayFormat(InternalName *name0, int num_components0,
6767
NumericType numeric_type0, Contents contents0,
68-
const InternalName *name1, int num_components1,
68+
InternalName *name1, int num_components1,
6969
NumericType numeric_type1, Contents contents1,
70-
const InternalName *name2, int num_components2,
70+
InternalName *name2, int num_components2,
7171
NumericType numeric_type2, Contents contents2);
72-
GeomVertexArrayFormat(const InternalName *name0, int num_components0,
72+
GeomVertexArrayFormat(InternalName *name0, int num_components0,
7373
NumericType numeric_type0, Contents contents0,
74-
const InternalName *name1, int num_components1,
74+
InternalName *name1, int num_components1,
7575
NumericType numeric_type1, Contents contents1,
76-
const InternalName *name2, int num_components2,
76+
InternalName *name2, int num_components2,
7777
NumericType numeric_type2, Contents contents2,
78-
const InternalName *name3, int num_components3,
78+
InternalName *name3, int num_components3,
7979
NumericType numeric_type3, Contents contents3);
8080
void operator = (const GeomVertexArrayFormat &copy);
8181
~GeomVertexArrayFormat();
@@ -89,7 +89,7 @@ class EXPCL_PANDA GeomVertexArrayFormat : public TypedWritableReferenceCount, pu
8989
INLINE int get_total_bytes() const;
9090
INLINE int get_pad_to() const;
9191

92-
int add_column(const InternalName *name, int num_components,
92+
int add_column(InternalName *name, int num_components,
9393
NumericType numeric_type, Contents contents,
9494
int start = -1);
9595
int add_column(const GeomVertexColumn &column);

panda/src/gobj/geomVertexColumn.I

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ GeomVertexColumn() :
3535
// Description:
3636
////////////////////////////////////////////////////////////////////
3737
INLINE GeomVertexColumn::
38-
GeomVertexColumn(const InternalName *name, int num_components,
39-
NumericType numeric_type, Contents contents,
40-
int start) :
38+
GeomVertexColumn(InternalName *name, int num_components,
39+
NumericType numeric_type, Contents contents,
40+
int start) :
4141
_name(name),
4242
_num_components(num_components),
4343
_numeric_type(numeric_type),
@@ -84,7 +84,7 @@ INLINE GeomVertexColumn::
8484
// system-defined field types. Only the system-defined
8585
// field types are used for the actual rendering.
8686
////////////////////////////////////////////////////////////////////
87-
INLINE const InternalName *GeomVertexColumn::
87+
INLINE InternalName *GeomVertexColumn::
8888
get_name() const {
8989
return _name;
9090
}

panda/src/gobj/geomVertexColumn.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ class EXPCL_PANDA GeomVertexColumn : public GeomEnums {
4646
private:
4747
INLINE GeomVertexColumn();
4848
PUBLISHED:
49-
INLINE GeomVertexColumn(const InternalName *name, int num_components,
50-
NumericType numeric_type, Contents contents,
51-
int start);
49+
INLINE GeomVertexColumn(InternalName *name, int num_components,
50+
NumericType numeric_type, Contents contents,
51+
int start);
5252
INLINE GeomVertexColumn(const GeomVertexColumn &copy);
5353
void operator = (const GeomVertexColumn &copy);
5454
INLINE ~GeomVertexColumn();
5555

56-
INLINE const InternalName *get_name() const;
56+
INLINE InternalName *get_name() const;
5757
INLINE int get_num_components() const;
5858
INLINE int get_num_values() const;
5959
INLINE NumericType get_numeric_type() const;
@@ -89,7 +89,7 @@ class EXPCL_PANDA GeomVertexColumn : public GeomEnums {
8989
void fillin(DatagramIterator &scan, BamReader *manager);
9090

9191
private:
92-
CPT(InternalName) _name;
92+
PT(InternalName) _name;
9393
int _num_components;
9494
int _num_values;
9595
NumericType _numeric_type;

panda/src/gobj/geomVertexData.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -963,7 +963,7 @@ bytewise_copy(unsigned char *to, int to_stride,
963963
// anything else.
964964
////////////////////////////////////////////////////////////////////
965965
PT(GeomVertexData) GeomVertexData::
966-
replace_column(const InternalName *name, int num_components,
966+
replace_column(InternalName *name, int num_components,
967967
GeomVertexData::NumericType numeric_type,
968968
GeomVertexData::Contents contents) const {
969969
PT(GeomVertexFormat) new_format = new GeomVertexFormat(*_format);

0 commit comments

Comments
 (0)