*** empty log message ***

This commit is contained in:
David Rose 2000-10-27 22:45:19 +00:00
parent 744d2fa810
commit 164d5a9fbe
39 changed files with 113 additions and 608 deletions

View File

@ -8,19 +8,19 @@
#define SOURCES \
builder.I builder.cxx builder.h builderAttrib.I builderAttrib.cxx \
builderAttrib.h builderBucket.I builderBucket.cxx builderBucket.h \
builderAttrib.h builderAttribTempl.I builderAttribTempl.h \
builderBucket.I builderBucket.cxx builderBucket.h \
builderBucketNode.I builderBucketNode.cxx builderBucketNode.h \
builderMisc.cxx builderMisc.h builderNormalVisualizer.I \
builderNormalVisualizer.cxx builderNormalVisualizer.h \
builderPrim.cxx builderPrim.h builderProperties.cxx \
builderProperties.h builderTypes.cxx builderTypes.h builderVertex.I \
builderVertex.cxx builderVertex.h config_builder.cxx \
config_builder.h mesher.cxx mesher.h pta_BuilderC.cxx \
pta_BuilderC.h pta_BuilderN.cxx pta_BuilderN.h pta_BuilderTC.cxx \
pta_BuilderTC.h pta_BuilderV.cxx pta_BuilderV.h vector_BuilderC.cxx \
vector_BuilderC.h vector_BuilderN.cxx vector_BuilderN.h \
vector_BuilderTC.cxx vector_BuilderTC.h vector_BuilderV.cxx \
vector_BuilderV.h
builderFuncs.I builderFuncs.h builderMisc.cxx builderMisc.h \
builderNormalVisualizer.I builderNormalVisualizer.cxx \
builderNormalVisualizer.h builderPrim.cxx builderPrim.h \
builderPrimTempl.I builderPrimTempl.h builderProperties.cxx \
builderProperties.h builderTypes.cxx builderTypes.h \
builderVertex.I builderVertex.cxx builderVertex.h \
builderVertexTempl.I builderVertexTempl.h config_builder.cxx \
config_builder.h mesher.cxx mesher.h mesherConfig.h mesherEdge.I \
mesherEdge.h mesherFanMaker.I mesherFanMaker.h mesherStrip.I \
mesherStrip.h mesherTempl.I mesherTempl.h
#define INSTALL_HEADERS \
builder.I builder.h builderAttrib.I builderAttrib.h \
@ -29,9 +29,7 @@
builderNormalVisualizer.I builderNormalVisualizer.h builderPrim.h \
builderPrimTempl.I builderPrimTempl.h builderProperties.h \
builderTypes.h builderVertex.I builderVertex.h builderVertexTempl.I \
builderVertexTempl.h config_builder.h pta_BuilderC.h pta_BuilderN.h \
pta_BuilderTC.h pta_BuilderV.h vector_BuilderC.h vector_BuilderN.h \
vector_BuilderTC.h vector_BuilderV.h
builderVertexTempl.h config_builder.h
#end lib_target

View File

@ -117,7 +117,7 @@ build(const string &default_name) {
++i) {
BuilderBucket *bucket = (*i).get_bucket();
NamedNode *node = bucket->_node;
const string &name = bucket->get_name();
// const string &name = bucket->get_name();
GeomNode *geom_node = NULL;
if (node!=NULL && node->is_of_type(GeomNode::get_class_type())) {

View File

@ -228,7 +228,7 @@ BuilderBucket(int) {
_show_qsheets = false;
_show_quads = false;
_show_normals = false;
_normal_color._v.set(1.0, 0.0, 0.0, 1.0);
_normal_color.set(1.0, 0.0, 0.0, 1.0);
_normal_scale = 1.0;
_subdivide_polys = true;
_coplanar_threshold = 0.01;

View File

@ -54,10 +54,7 @@
#include "builderPrimTempl.h"
#include "builderBucket.h"
#include "pta_BuilderV.h"
#include "pta_BuilderN.h"
#include "pta_BuilderTC.h"
#include "pta_BuilderC.h"
#include "builderTypes.h"
#include <pta_ushort.h>
#include <geom.h>

View File

@ -559,7 +559,7 @@ get_num_verts() const {
template <class VTX>
INLINE BuilderPrimTempl<VTX>::Vertex &BuilderPrimTempl<VTX>::
get_vertex(int n) {
nassertr(n >= 0 && n < _verts.size(), *(new Vertex));
nassertr(n >= 0 && n < (int)_verts.size(), *(new Vertex));
return _verts[n];
}
@ -572,7 +572,7 @@ get_vertex(int n) {
template <class VTX>
INLINE const BuilderPrimTempl<VTX>::Vertex &BuilderPrimTempl<VTX>::
get_vertex(int n) const {
nassertr(n >= 0 && n < _verts.size(), *(new Vertex));
nassertr(n >= 0 && n < (int)_verts.size(), *(new Vertex));
return _verts[n];
}
@ -634,7 +634,7 @@ get_num_components() const {
template <class VTX>
INLINE BuilderPrimTempl<VTX>::DAttrib &BuilderPrimTempl<VTX>::
get_component(int n) {
nassertr(n >= 0 && n < _components.size(), *(new DAttrib));
nassertr(n >= 0 && n < (int)_components.size(), *(new DAttrib));
return _components[n];
}
@ -649,7 +649,7 @@ get_component(int n) {
template <class VTX>
INLINE const BuilderPrimTempl<VTX>::DAttrib &BuilderPrimTempl<VTX>::
get_component(int n) const {
nassertr(n >= 0 && n < _components.size(), *(new DAttrib));
nassertr(n >= 0 && n < (int)_components.size(), *(new DAttrib));
return _components[n];
}
@ -698,12 +698,12 @@ sort_value() const {
// Furthermore, if one polygon has vertex normals and another is
// flat shaded, they shouldn't be stripped together.
return
((has_vertex_normal()!=0) << 5) |
((has_vertex_color()!=0) << 4) |
((has_any_texcoord()!=0) << 3) |
((has_any_normal()!=0) << 2) |
((has_any_color()!=0) << 1) |
((has_pixel_size()!=0) << 0);
((has_vertex_normal() ? 1:0) << 5) |
((has_vertex_color() ? 1:0) << 4) |
((has_any_texcoord() ? 1:0) << 3) |
((has_any_normal() ? 1:0) << 2) |
((has_any_color() ? 1:0) << 1) |
((has_pixel_size() ? 1:0) << 0);
}

View File

@ -8,184 +8,20 @@
#include <pandabase.h>
#include <luse.h>
#include <typedef.h>
#include <pta_TexCoordf.h>
#include <pta_Vertexf.h>
#include <pta_Normalf.h>
#include <pta_Colorf.h>
#ifndef WIN32_VC
#include <stl_config.h>
#endif
typedef TexCoordf BuilderTC;
typedef Vertexf BuilderV;
typedef Normalf BuilderN;
typedef Colorf BuilderC;
static const float nearly_zero = 0.0001;
// The BuilderVec classes are a series of proxies around Vertexf,
// Normalf, TexCoordf, and Colorf. They're useful for building
// collections of these vertex values, and provide handy things like
// (almost) equivalence operators and sorting operators.
// The BuilderVec's each have a special constructor with a single int.
// These constructors create an instance of the vector with all values
// initialized to zero. This is a cheat to create a uniform way to create
// a zero-valued VType, CType, or TType without knowing whether the type
// is indexed (a ushort) or nonindexed (a BuilderVec).
class EXPCL_PANDAEGG BuilderTC {
public:
BuilderTC() {}
BuilderTC(int) : _v(0.0, 0.0) {}
BuilderTC(const TexCoordf &v) : _v(v) {}
BuilderTC(const TexCoordd &v) : _v(v[0], v[1]) {}
BuilderTC(const BuilderTC &copy) : _v(copy._v) {}
operator TexCoordf & () {
return _v;
}
operator const TexCoordf & () const {
return _v;
}
float operator [] (int n) const { return _v[n]; }
float &operator [] (int n) { return _v[n]; }
BuilderTC &operator = (const BuilderTC &copy) {
_v = copy._v;
return *this;
}
bool operator == (const BuilderTC &other) const {
return _v.almost_equal(other._v, nearly_zero);
}
bool operator != (const BuilderTC &other) const {
return !operator == (other);
}
// The < operator is simply for ordering vectors in a sorted
// container; it has no useful mathematical meaning.
bool operator < (const BuilderTC &other) const {
return (_v.compare_to(other._v) < 0);
}
TexCoordf _v;
};
class EXPCL_PANDAEGG BuilderV {
public:
BuilderV() {}
BuilderV(int) : _v(0.0, 0.0, 0.0) {}
BuilderV(const Vertexf &v) : _v(v) {}
BuilderV(const Vertexd &v) : _v(v[0], v[1], v[2]) {}
BuilderV(const BuilderV &copy) : _v(copy._v) {}
operator Vertexf & () {
return _v;
}
operator const Vertexf & () const {
return _v;
}
float operator [] (int n) const { return _v[n]; }
float &operator [] (int n) { return _v[n]; }
BuilderV &operator = (const BuilderV &copy) {
_v = copy._v;
return *this;
}
bool operator == (const BuilderV &other) const {
return _v.almost_equal(other._v, nearly_zero);
}
bool operator != (const BuilderV &other) const {
return !operator == (other);
}
bool operator < (const BuilderV &other) const {
return (_v.compare_to(other._v) < 0);
}
Vertexf _v;
};
class EXPCL_PANDAEGG BuilderN {
public:
BuilderN() {}
BuilderN(int) : _v(0.0, 0.0, 0.0) {}
BuilderN(const Normalf &v) : _v(v) {}
BuilderN(const Normald &v) : _v(v[0], v[1], v[2]) {}
BuilderN(const BuilderN &copy) : _v(copy._v) {}
operator Normalf & () {
return _v;
}
operator const Normalf & () const {
return _v;
}
float operator [] (int n) const { return _v[n]; }
float &operator [] (int n) { return _v[n]; }
BuilderN &operator = (const BuilderN &copy) {
_v = copy._v;
return *this;
}
bool operator == (const BuilderN &other) const {
return _v.almost_equal(other._v, nearly_zero);
}
bool operator != (const BuilderN &other) const {
return !operator == (other);
}
bool operator < (const BuilderN &other) const {
return (_v.compare_to(other._v) < 0);
}
Normalf _v;
};
class EXPCL_PANDAEGG BuilderC {
public:
BuilderC() {}
BuilderC(int) : _v(0.0, 0.0, 0.0, 0.0) {}
BuilderC(const Colorf &v) : _v(v) {}
BuilderC(const Colord &v) : _v(v[0], v[1], v[2], v[3]) {}
BuilderC(const BuilderC &copy) : _v(copy._v) {}
operator Colorf & () {
return _v;
}
operator const Colorf & () const {
return _v;
}
float operator [] (int n) const { return _v[n]; }
float &operator [] (int n) { return _v[n]; }
BuilderC &operator = (const BuilderC &copy) {
_v = copy._v;
return *this;
}
bool operator == (const BuilderC &other) const {
return _v.almost_equal(other._v, nearly_zero);
}
bool operator != (const BuilderC &other) const {
return !operator == (other);
}
bool operator < (const BuilderC &other) const {
return (_v.compare_to(other._v) < 0);
}
Colorf _v;
};
INLINE ostream &operator << (ostream &out, const BuilderTC &v) {
return out << "(" << v[0] << " " << v[1] << ")";
}
INLINE ostream &operator << (ostream &out, const BuilderV &v) {
return out << "(" << v[0] << " " << v[1] << " " << v[2] << ")";
}
INLINE ostream &operator << (ostream &out, const BuilderN &v) {
return out << "(" << v[0] << " " << v[1] << " " << v[2] << ")";
}
INLINE ostream &operator << (ostream &out, const BuilderC &v) {
return out << "(" << v[0] << " " << v[1] << " " << v[2] << " "
<< v[3] << ")";
}
typedef PTA_TexCoordf PTA_BuilderTC;
typedef PTA_Vertexf PTA_BuilderV;
typedef PTA_Normalf PTA_BuilderN;
typedef PTA_Colorf PTA_BuilderC;
enum BuilderAttribFlags {
BAF_coord = 0x00001,

View File

@ -7,12 +7,14 @@
#include <pandabase.h>
#include "mesherConfig.h"
#include "mesherFanMaker.h"
#include "mesherEdge.h"
#include "mesherStrip.h"
#include "mesherTempl.h"
#include "builderPrim.h"
#ifdef SUPPORT_FANS
EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, MesherFanMaker<BuilderPrim>);
EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, MesherFanMaker<BuilderPrimI>);

View File

@ -0,0 +1,19 @@
// Filename: mesherConfig.h
// Created by: drose (27Oct00)
//
////////////////////////////////////////////////////////////////////
#ifndef MESHERCONFIG_H
#define MESHERCONFIG_H
#include <pandabase.h>
// This is just a file to declare a definition or two global to the
// mesher compilation.
// Define this to support making triangle fans in addition to triangle
// strips. Fans may improve the grouping in certain models, although
// in most real cases the don't seem to help very much (and can
// actually hurt, by bitching the heuristic).
#define SUPPORT_FANS
#endif

View File

@ -8,6 +8,7 @@
#include <pandabase.h>
#include "mesherConfig.h"
#include "builderBucket.h"
#include <list>

View File

@ -3,6 +3,7 @@
//
////////////////////////////////////////////////////////////////////
/* okcircular */
#include "builderFuncs.h"
#include <notify.h>

View File

@ -10,6 +10,7 @@
#include <pandabase.h>
#include "mesherConfig.h"
#include "builderAttrib.h"
#include "builderVertex.h"
#include "builderBucket.h"

View File

@ -8,8 +8,8 @@
template <class PrimType>
INLINE MesherStrip<PrimType>::
MesherStrip(const MesherStrip &copy) :
_edges(copy._edges),
_prims(copy._prims),
_edges(copy._edges),
_verts(copy._verts),
_type(copy._type),
_index(copy._index),
@ -923,11 +923,11 @@ convex_quad(Edge *common_edge, MesherStrip &front, MesherStrip &back,
nassertr(a!=NULL && b!=NULL, false);
Vertexf a3, b3, c3, d3;
a3 = a->get_coord_value(bucket)._v;
b3 = b->get_coord_value(bucket)._v;
a3 = a->get_coord_value(bucket);
b3 = b->get_coord_value(bucket);
c3 = common_edge->_a->get_coord_value(bucket)._v;
d3 = common_edge->_b->get_coord_value(bucket)._v;
c3 = common_edge->_a->get_coord_value(bucket);
d3 = common_edge->_b->get_coord_value(bucket);
// Project both edges into the 2-d axis plane most nearly
// perpendicular to the normal. We're assuming both tris have the

View File

@ -8,6 +8,7 @@
#include <pandabase.h>
#include "mesherConfig.h"
#include "builderTypes.h"
#include "builderBucket.h"

View File

@ -3,7 +3,6 @@
//
////////////////////////////////////////////////////////////////////
#include "mesher.h"
#include "builderMisc.h"
#include "mesherStrip.h"
#include "mesherFanMaker.h"
@ -314,8 +313,8 @@ finalize() {
if (!_colors.empty()) {
// Create an array in the bucket we might use to add to geoms.
PTA_Colorf colors(_colors.size());
for (int i = 0; i < _colors.size(); i++) {
colors[i] = _colors[i]._v;
for (int i = 0; i < (int)_colors.size(); i++) {
colors[i] = _colors[i];
}
_bucket->set_colors(colors);

View File

@ -7,6 +7,7 @@
#include <pandabase.h>
#include "mesherConfig.h"
#include "builderBucket.h"
#include "mesherEdge.h"
#include "mesherStrip.h"

View File

@ -1,11 +0,0 @@
// Filename: pta_BuilderC.cxx
// Created by: drose (10May00)
//
////////////////////////////////////////////////////////////////////
#include "pta_BuilderC.h"
// Tell GCC that we'll take care of the instantiation explicitly here.
#ifdef __GNUC__
#pragma implementation
#endif

View File

@ -1,37 +0,0 @@
// Filename: pta_BuilderC.h
// Created by: drose (10May00)
//
////////////////////////////////////////////////////////////////////
#ifndef PTA_BUILDERC_H
#define PTA_BUILDERC_H
#include <pandabase.h>
#include "vector_BuilderC.h"
#include <pointerToArray.h>
////////////////////////////////////////////////////////////////////
// Class : PTA_BuilderC
// Description : A pta of BuilderCs. This class is defined once here,
// and exported to PANDA.DLL; other packages that want
// to use a pta of this type (whether they need to
// export it or not) should include this header file,
// rather than defining the pta again.
////////////////////////////////////////////////////////////////////
EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, RefCountObj<vector_BuilderC>);
EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, PointerToBase<RefCountObj<vector_BuilderC> >);
EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, PointerToArray<BuilderC>)
EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, ConstPointerToArray<BuilderC>)
typedef PointerToArray<BuilderC> PTA_BuilderC;
typedef ConstPointerToArray<BuilderC> CPTA_BuilderC;
// Tell GCC that we'll take care of the instantiation explicitly here.
#ifdef __GNUC__
#pragma interface
#endif
#endif

View File

@ -1,11 +0,0 @@
// Filename: pta_BuilderN.cxx
// Created by: drose (10May00)
//
////////////////////////////////////////////////////////////////////
#include "pta_BuilderN.h"
// Tell GCC that we'll take care of the instantiation explicitly here.
#ifdef __GNUC__
#pragma implementation
#endif

View File

@ -1,37 +0,0 @@
// Filename: pta_BuilderN.h
// Created by: drose (10May00)
//
////////////////////////////////////////////////////////////////////
#ifndef PTA_BUILDERN_H
#define PTA_BUILDERN_H
#include <pandabase.h>
#include "vector_BuilderN.h"
#include <pointerToArray.h>
////////////////////////////////////////////////////////////////////
// Class : PTA_BuilderN
// Description : A pta of BuilderNs. This class is defined once here,
// and exported to PANDA.DLL; other packages that want
// to use a pta of this type (whether they need to
// export it or not) should include this header file,
// rather than defining the pta again.
////////////////////////////////////////////////////////////////////
EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, RefCountObj<vector_BuilderN>);
EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, PointerToBase<RefCountObj<vector_BuilderN> >);
EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, PointerToArray<BuilderN>)
EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, ConstPointerToArray<BuilderN>)
typedef PointerToArray<BuilderN> PTA_BuilderN;
typedef ConstPointerToArray<BuilderN> CPTA_BuilderN;
// Tell GCC that we'll take care of the instantiation explicitly here.
#ifdef __GNUC__
#pragma interface
#endif
#endif

View File

@ -1,11 +0,0 @@
// Filename: pta_BuilderTC.cxx
// Created by: drose (10May00)
//
////////////////////////////////////////////////////////////////////
#include "pta_BuilderTC.h"
// Tell GCC that we'll take care of the instantiation explicitly here.
#ifdef __GNUC__
#pragma implementation
#endif

View File

@ -1,37 +0,0 @@
// Filename: pta_BuilderTC.h
// Created by: drose (10May00)
//
////////////////////////////////////////////////////////////////////
#ifndef PTA_BUILDERTC_H
#define PTA_BUILDERTC_H
#include <pandabase.h>
#include "vector_BuilderTC.h"
#include <pointerToArray.h>
////////////////////////////////////////////////////////////////////
// Class : PTA_BuilderTC
// Description : A pta of BuilderTCs. This class is defined once here,
// and exported to PANDA.DLL; other packages that want
// to use a pta of this type (whether they need to
// export it or not) should include this header file,
// rather than defining the pta again.
////////////////////////////////////////////////////////////////////
EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, RefCountObj<vector_BuilderTC>);
EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, PointerToBase<RefCountObj<vector_BuilderTC> >);
EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, PointerToArray<BuilderTC>)
EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, ConstPointerToArray<BuilderTC>)
typedef PointerToArray<BuilderTC> PTA_BuilderTC;
typedef ConstPointerToArray<BuilderTC> CPTA_BuilderTC;
// Tell GCC that we'll take care of the instantiation explicitly here.
#ifdef __GNUC__
#pragma interface
#endif
#endif

View File

@ -1,11 +0,0 @@
// Filename: pta_BuilderV.cxx
// Created by: drose (10May00)
//
////////////////////////////////////////////////////////////////////
#include "pta_BuilderV.h"
// Tell GCC that we'll take care of the instantiation explicitly here.
#ifdef __GNUC__
#pragma implementation
#endif

View File

@ -1,37 +0,0 @@
// Filename: pta_BuilderV.h
// Created by: drose (10May00)
//
////////////////////////////////////////////////////////////////////
#ifndef PTA_BUILDERV_H
#define PTA_BUILDERV_H
#include <pandabase.h>
#include "vector_BuilderV.h"
#include <pointerToArray.h>
////////////////////////////////////////////////////////////////////
// Class : PTA_BuilderV
// Description : A pta of BuilderVs. This class is defined once here,
// and exported to PANDA.DLL; other packages that want
// to use a pta of this type (whether they need to
// export it or not) should include this header file,
// rather than defining the pta again.
////////////////////////////////////////////////////////////////////
EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, RefCountObj<vector_BuilderV>);
EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, PointerToBase<RefCountObj<vector_BuilderV> >);
EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, PointerToArray<BuilderV>)
EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, ConstPointerToArray<BuilderV>)
typedef PointerToArray<BuilderV> PTA_BuilderV;
typedef ConstPointerToArray<BuilderV> CPTA_BuilderV;
// Tell GCC that we'll take care of the instantiation explicitly here.
#ifdef __GNUC__
#pragma interface
#endif
#endif

View File

@ -1,11 +0,0 @@
// Filename: vector_BuilderC.cxx
// Created by: drose (10May00)
//
////////////////////////////////////////////////////////////////////
#include "vector_BuilderC.h"
// Tell GCC that we'll take care of the instantiation explicitly here.
#ifdef __GNUC__
#pragma implementation
#endif

View File

@ -1,32 +0,0 @@
// Filename: vector_BuilderC.h
// Created by: drose (10May00)
//
////////////////////////////////////////////////////////////////////
#ifndef VECTOR_BUILDERC_H
#define VECTOR_BUILDERC_H
#include <pandabase.h>
#include "builderTypes.h"
#include <vector>
////////////////////////////////////////////////////////////////////
// Class : vector_BuilderC
// Description : A vector of BuilderCs. This class is defined once here,
// and exported to PANDA.DLL; other packages that want
// to use a vector of this type (whether they need to
// export it or not) should include this header file,
// rather than defining the vector again.
////////////////////////////////////////////////////////////////////
EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, std::vector<BuilderC>)
typedef vector<BuilderC> vector_BuilderC;
// Tell GCC that we'll take care of the instantiation explicitly here.
#ifdef __GNUC__
#pragma interface
#endif
#endif

View File

@ -1,11 +0,0 @@
// Filename: vector_BuilderN.cxx
// Created by: drose (10May00)
//
////////////////////////////////////////////////////////////////////
#include "vector_BuilderN.h"
// Tell GCC that we'll take care of the instantiation explicitly here.
#ifdef __GNUC__
#pragma implementation
#endif

View File

@ -1,32 +0,0 @@
// Filename: vector_BuilderN.h
// Created by: drose (10May00)
//
////////////////////////////////////////////////////////////////////
#ifndef VECTOR_BUILDERN_H
#define VECTOR_BUILDERN_H
#include <pandabase.h>
#include "builderTypes.h"
#include <vector>
////////////////////////////////////////////////////////////////////
// Class : vector_BuilderN
// Description : A vector of BuilderNs. This class is defined once here,
// and exported to PANDA.DLL; other packages that want
// to use a vector of this type (whether they need to
// export it or not) should include this header file,
// rather than defining the vector again.
////////////////////////////////////////////////////////////////////
EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, std::vector<BuilderN>)
typedef vector<BuilderN> vector_BuilderN;
// Tell GCC that we'll take care of the instantiation explicitly here.
#ifdef __GNUC__
#pragma interface
#endif
#endif

View File

@ -1,11 +0,0 @@
// Filename: vector_BuilderTC.cxx
// Created by: drose (10May00)
//
////////////////////////////////////////////////////////////////////
#include "vector_BuilderTC.h"
// Tell GCC that we'll take care of the instantiation explicitly here.
#ifdef __GNUC__
#pragma implementation
#endif

View File

@ -1,32 +0,0 @@
// Filename: vector_BuilderTC.h
// Created by: drose (10May00)
//
////////////////////////////////////////////////////////////////////
#ifndef VECTOR_BUILDERTC_H
#define VECTOR_BUILDERTC_H
#include <pandabase.h>
#include "builderTypes.h"
#include <vector>
////////////////////////////////////////////////////////////////////
// Class : vector_BuilderTC
// Description : A vector of BuilderTCs. This class is defined once here,
// and exported to PANDA.DLL; other packages that want
// to use a vector of this type (whether they need to
// export it or not) should include this header file,
// rather than defining the vector again.
////////////////////////////////////////////////////////////////////
EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, std::vector<BuilderTC>)
typedef vector<BuilderTC> vector_BuilderTC;
// Tell GCC that we'll take care of the instantiation explicitly here.
#ifdef __GNUC__
#pragma interface
#endif
#endif

View File

@ -1,11 +0,0 @@
// Filename: vector_BuilderV.cxx
// Created by: drose (10May00)
//
////////////////////////////////////////////////////////////////////
#include "vector_BuilderV.h"
// Tell GCC that we'll take care of the instantiation explicitly here.
#ifdef __GNUC__
#pragma implementation
#endif

View File

@ -1,32 +0,0 @@
// Filename: vector_BuilderV.h
// Created by: drose (10May00)
//
////////////////////////////////////////////////////////////////////
#ifndef VECTOR_BUILDERV_H
#define VECTOR_BUILDERV_H
#include <pandabase.h>
#include "builderTypes.h"
#include <vector>
////////////////////////////////////////////////////////////////////
// Class : vector_BuilderV
// Description : A vector of BuilderVs. This class is defined once here,
// and exported to PANDA.DLL; other packages that want
// to use a vector of this type (whether they need to
// export it or not) should include this header file,
// rather than defining the vector again.
////////////////////////////////////////////////////////////////////
EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, std::vector<BuilderV>)
typedef vector<BuilderV> vector_BuilderV;
// Tell GCC that we'll take care of the instantiation explicitly here.
#ifdef __GNUC__
#pragma interface
#endif
#endif

View File

@ -38,6 +38,9 @@ write(ostream &out, int indent_level) const {
case CS_yup_left:
out << "Y-Up-Left";
break;
default:
out << "/* Invalid coordinate system " << (int)get_value() << " */";
}
out << " }\n\n";
}

View File

@ -44,9 +44,9 @@ EggVertex() {
EggVertex::
EggVertex(const EggVertex &copy)
: EggObject(copy), EggAttributes(copy),
_dxyzs(copy._dxyzs),
_pos(copy._pos),
_num_dimensions(copy._num_dimensions),
_dxyzs(copy._dxyzs)
_num_dimensions(copy._num_dimensions)
{
_pool = NULL;
_index = -1;

View File

@ -57,7 +57,7 @@ EggXfmAnimData(const EggXfmSAnim &convert_from)
// Now, go through and extract out all the data.
int num_rows = convert_from.get_num_rows();
for (int row = 0; row < num_rows; row++) {
for (int col = 0; col < subtables.size(); col++) {
for (int col = 0; col < (int)subtables.size(); col++) {
EggSAnimData *sanim = subtables[col];
if (sanim->get_num_rows() == 1) {
add_data(sanim->get_value(0));

View File

@ -1119,7 +1119,7 @@ group_vertex_ref:
PTA_double nums = $3;
double membership = $4;
for (int i = 0; i < nums.size(); i++) {
for (int i = 0; i < (int)nums.size(); i++) {
int index = (int)nums[i];
EggVertex *vertex = pool->get_vertex(index);
if (vertex == NULL) {
@ -1581,7 +1581,7 @@ primitive_vertex_ref:
EggPrimitive *prim = DCAST(EggPrimitive, egg_stack.back());
PTA_double nums = $3;
for (int i = 0; i < nums.size(); i++) {
for (int i = 0; i < (int)nums.size(); i++) {
int index = (int)nums[i];
EggVertex *vertex = pool->get_vertex(index);
if (vertex == NULL) {
@ -1629,7 +1629,7 @@ nurbs_surface_uknots_body:
PTA_double nums = $1;
nurbs->set_num_u_knots(nums.size());
for (int i = 0; i < nums.size(); i++) {
for (int i = 0; i < (int)nums.size(); i++) {
nurbs->set_u_knot(i, nums[i]);
}
}
@ -1649,7 +1649,7 @@ nurbs_surface_vknots_body:
PTA_double nums = $1;
nurbs->set_num_v_knots(nums.size());
for (int i = 0; i < nums.size(); i++) {
for (int i = 0; i < (int)nums.size(); i++) {
nurbs->set_v_knot(i, nums[i]);
}
}
@ -1726,7 +1726,7 @@ nurbs_curve_knots_body:
PTA_double nums = $1;
nurbs->set_num_knots(nums.size());
for (int i = 0; i < nums.size(); i++) {
for (int i = 0; i < (int)nums.size(); i++) {
nurbs->set_knot(i, nums[i]);
}
}

View File

@ -25,7 +25,7 @@
////////////////////////////////////////////////////////////////////
CharacterMaker::
CharacterMaker(EggGroup *root, EggLoader &loader)
: _egg_root(root), _loader(loader) {
: _loader(loader), _egg_root(root) {
_character_node = new Character(_egg_root->get_name());
_bundle = _character_node->get_bundle();
@ -63,7 +63,7 @@ egg_to_part(EggNode *egg_node) const {
// character, just return the root of the character.
return _bundle;
}
nassertr(index < _parts.size(), NULL);
nassertr(index < (int)_parts.size(), NULL);
return _parts[index];
}
@ -173,8 +173,6 @@ build_joint_hierarchy(EggNode *egg_node, PartGroup *part) {
index = _parts.size();
_parts.push_back(joint);
PartGroup *pgroup = (PartGroup *)joint;
if (egg_group->get_dcs_flag()) {
// If the joint requested an explicit DCS, create a node for
// it.

View File

@ -272,23 +272,23 @@ make_nonindexed_primitive(EggPrimitive *egg_prim, NamedNode *parent,
}
if (egg_prim->has_normal()) {
bprim.set_normal(egg_prim->get_normal() * mat);
bprim.set_normal(LCAST(float, egg_prim->get_normal() * mat));
}
if (egg_prim->has_color() && !egg_false_color) {
bprim.set_color(egg_prim->get_color());
bprim.set_color(LCAST(float, egg_prim->get_color()));
}
bool has_vert_color = true;
EggPrimitive::const_iterator vi;
for (vi = egg_prim->begin(); vi != egg_prim->end(); ++vi) {
EggVertex *egg_vert = *vi;
BuilderVertex bvert(egg_vert->get_pos3() * mat);
BuilderVertex bvert(LCAST(float, egg_vert->get_pos3() * mat));
if (egg_vert->has_normal()) {
bvert.set_normal(egg_vert->get_normal() * mat);
bvert.set_normal(LCAST(float, egg_vert->get_normal() * mat));
}
if (egg_vert->has_color() && !egg_false_color) {
bvert.set_color(egg_vert->get_color());
bvert.set_color(LCAST(float, egg_vert->get_color()));
} else {
// If any vertex doesn't have a color, we can't use any of the
// vertex colors.
@ -301,7 +301,7 @@ make_nonindexed_primitive(EggPrimitive *egg_prim, NamedNode *parent,
// If we have a texture matrix, apply it.
uv = uv * egg_prim->get_texture()->get_transform();
}
bvert.set_texcoord(uv);
bvert.set_texcoord(LCAST(float, uv));
}
bprim.add_vertex(bvert);
@ -543,6 +543,10 @@ apply_texture_attributes(Texture *tex, const EggTexture *egg_tex) {
tex->set_wrapu(Texture::WM_clamp);
}
break;
default:
cerr << "Unexpected texture wrap flag: "
<< (int)egg_tex->determine_wrap_u() << "\n";
}
switch (egg_tex->determine_wrap_v()) {
@ -559,6 +563,10 @@ apply_texture_attributes(Texture *tex, const EggTexture *egg_tex) {
tex->set_wrapv(Texture::WM_clamp);
}
break;
default:
cerr << "Unexpected texture wrap flag: "
<< (int)egg_tex->determine_wrap_v() << "\n";
}
switch (egg_tex->get_minfilter()) {
@ -786,6 +794,10 @@ apply_texture_apply_attributes(TextureApplyTransition *apply,
case EggTexture::ET_decal:
apply->set_mode(TextureApplyProperty::M_decal);
break;
default:
cerr << "Invalid texture environment "
<< (int)egg_tex->get_env_type() << "\n";
}
}
}

View File

@ -221,7 +221,7 @@ get_float32() {
nassertr(_current_index < _datagram.get_length(), 0.0);
float tempvar;
BigEndian s =
LittleEndian s =
_datagram.get_message().substr(_current_index, sizeof(tempvar));
nassertr(s.length() == sizeof(tempvar), 0.0);

View File

@ -1163,8 +1163,8 @@ draw_polygon(const GeomPolygon *geom) {
// If we have per-vertex colors or normals, we need smooth shading.
// Otherwise we want flat shading for performance reasons.
if (geom->get_binding(G_COLOR) == G_PER_VERTEX ||
geom->get_binding(G_NORMAL) == G_PER_VERTEX) {
if ((geom->get_binding(G_COLOR) == G_PER_VERTEX && wants_colors()) ||
(geom->get_binding(G_NORMAL) == G_PER_VERTEX && wants_normals())) {
call_glShadeModel(GL_SMOOTH);
} else {
call_glShadeModel(GL_FLAT);
@ -1233,8 +1233,8 @@ draw_tri(const GeomTri *geom) {
// If we have per-vertex colors or normals, we need smooth shading.
// Otherwise we want flat shading for performance reasons.
if (geom->get_binding(G_COLOR) == G_PER_VERTEX ||
geom->get_binding(G_NORMAL) == G_PER_VERTEX) {
if ((geom->get_binding(G_COLOR) == G_PER_VERTEX && wants_colors()) ||
(geom->get_binding(G_NORMAL) == G_PER_VERTEX && wants_normals())) {
call_glShadeModel(GL_SMOOTH);
} else {
call_glShadeModel(GL_FLAT);
@ -1299,8 +1299,8 @@ draw_quad(const GeomQuad *geom) {
// If we have per-vertex colors or normals, we need smooth shading.
// Otherwise we want flat shading for performance reasons.
if (geom->get_binding(G_COLOR) == G_PER_VERTEX ||
geom->get_binding(G_NORMAL) == G_PER_VERTEX) {
if ((geom->get_binding(G_COLOR) == G_PER_VERTEX && wants_colors()) ||
(geom->get_binding(G_NORMAL) == G_PER_VERTEX && wants_normals())) {
call_glShadeModel(GL_SMOOTH);
} else {
call_glShadeModel(GL_FLAT);
@ -1366,8 +1366,8 @@ draw_tristrip(const GeomTristrip *geom) {
// If we have per-vertex colors or normals, we need smooth shading.
// Otherwise we want flat shading for performance reasons.
if (geom->get_binding(G_COLOR) == G_PER_VERTEX ||
geom->get_binding(G_NORMAL) == G_PER_VERTEX) {
if ((geom->get_binding(G_COLOR) == G_PER_VERTEX && wants_colors()) ||
(geom->get_binding(G_NORMAL) == G_PER_VERTEX && wants_normals())) {
call_glShadeModel(GL_SMOOTH);
} else {
call_glShadeModel(GL_FLAT);
@ -1454,8 +1454,8 @@ draw_trifan(const GeomTrifan *geom) {
// If we have per-vertex colors or normals, we need smooth shading.
// Otherwise we want flat shading for performance reasons.
if (geom->get_binding(G_COLOR) == G_PER_VERTEX ||
geom->get_binding(G_NORMAL) == G_PER_VERTEX) {
if ((geom->get_binding(G_COLOR) == G_PER_VERTEX && wants_colors()) ||
(geom->get_binding(G_NORMAL) == G_PER_VERTEX && wants_normals())) {
call_glShadeModel(GL_SMOOTH);
} else {
call_glShadeModel(GL_FLAT);