From 134e9a9e925fb41845698f5f6c3a42ec0707aafc Mon Sep 17 00:00:00 2001 From: David Rose Date: Tue, 11 Oct 2011 00:45:51 +0000 Subject: [PATCH] dual names for interrogate --- direct/src/directscripts/gendocs.py | 33 +- direct/src/showbase/Loader.py | 3 +- dtool/LocalSetup.pp | 2 +- dtool/src/cppparser/cppParser.cxx | 2 +- dtool/src/cppparser/cppType.cxx | 74 ++- dtool/src/cppparser/cppType.h | 8 +- dtool/src/cppparser/cppTypedef.cxx | 2 +- .../interfaceMakerPythonNative.cxx | 513 +++++++++--------- dtool/src/interrogate/interrogate.cxx | 5 +- dtool/src/interrogate/interrogateBuilder.cxx | 10 + .../src/interrogatedb/interrogateComponent.I | 23 + .../interrogatedb/interrogateComponent.cxx | 18 + .../src/interrogatedb/interrogateComponent.h | 9 + dtool/src/interrogatedb/interrogateType.cxx | 4 - dtool/src/interrogatedb/interrogateType.h | 2 - makepanda/makepanda.py | 1 + panda/src/bullet/bulletDebugNode.cxx | 4 +- panda/src/bullet/bulletDebugNode.h | 4 +- panda/src/egg/eggAttributes.I | 4 +- panda/src/egg/eggAttributes.h | 6 +- panda/src/egg/eggGroupNode.cxx | 18 +- panda/src/egg/eggGroupNode.h | 10 +- panda/src/egg/eggMesherStrip.cxx | 2 +- panda/src/egg/eggMesherStrip.h | 2 +- panda/src/egg/eggPolygon.I | 2 +- panda/src/egg/eggPolygon.cxx | 14 +- panda/src/egg/eggPolygon.h | 2 +- panda/src/egg/eggPrimitive.cxx | 4 +- panda/src/egg/eggVertex.I | 10 +- panda/src/egg/eggVertex.cxx | 12 +- panda/src/egg/eggVertex.h | 14 +- panda/src/egg/eggVertexUV.I | 20 +- panda/src/egg/eggVertexUV.cxx | 4 +- panda/src/egg/eggVertexUV.h | 26 +- panda/src/egg/parser.yxx | 12 +- panda/src/egg2pg/eggLoader.cxx | 26 +- panda/src/express/config_express.N | 25 +- .../src/glstuff/glGraphicsStateGuardian_src.I | 4 +- .../glstuff/glGraphicsStateGuardian_src.cxx | 4 +- panda/src/linmath/Sources.pp | 12 +- panda/src/linmath/aa_luse.h | 109 +++- panda/src/linmath/linmath_composite1.cxx | 4 - panda/src/linmath/luse.N | 34 -- panda/src/linmath/test_math.cxx | 6 +- panda/src/linmath/vector_Colorf.cxx | 27 - panda/src/linmath/vector_Colorf.h | 43 -- panda/src/linmath/vector_Normalf.cxx | 27 - panda/src/linmath/vector_Normalf.h | 43 -- panda/src/linmath/vector_TexCoordf.h | 28 - panda/src/linmath/vector_Vertexf.cxx | 27 - panda/src/linmath/vector_Vertexf.h | 43 -- panda/src/mathutil/boundingHexahedron.cxx | 2 +- panda/src/mathutil/boundingHexahedron.h | 2 +- panda/src/mathutil/config_mathutil.N | 71 +-- panda/src/mathutil/frustum.h | 15 +- panda/src/mathutil/frustum_src.I | 26 +- panda/src/mathutil/frustum_src.h | 6 +- panda/src/mathutil/parabola.h | 4 +- panda/src/mathutil/parabola_src.I | 46 +- panda/src/mathutil/parabola_src.cxx | 20 +- panda/src/mathutil/parabola_src.h | 16 +- panda/src/mathutil/plane.h | 15 +- panda/src/mathutil/plane_src.I | 82 +-- panda/src/mathutil/plane_src.cxx | 30 +- panda/src/mathutil/plane_src.h | 26 +- panda/src/mathutil/pta_LMatrix3.h | 8 + panda/src/mathutil/pta_LMatrix4.h | 8 + panda/src/mathutil/pta_LVecBase2.h | 8 + panda/src/mathutil/pta_LVecBase3.h | 8 + panda/src/mathutil/pta_LVecBase4.h | 8 + panda/src/pgraph/nodePath.cxx | 8 +- panda/src/pnmimage/pnmBrush.cxx | 34 +- panda/src/pnmimage/pnmBrush.h | 4 +- panda/src/pnmimage/pnmImage.I | 24 +- panda/src/pnmimage/pnmImage.cxx | 34 +- panda/src/pnmimage/pnmImage.h | 30 +- panda/src/pnmimage/pnmPainter.cxx | 4 +- panda/src/pnmtext/pnmTextGlyph.cxx | 10 +- panda/src/putil/config_util.N | 15 +- panda/src/putil/typedWritable.cxx | 24 +- pandatool/src/daeegg/daeToEggConverter.cxx | 4 +- pandatool/src/egg-mkfont/eggMakeFont.cxx | 8 +- pandatool/src/egg-qtess/qtessSurface.cxx | 4 +- pandatool/src/eggprogs/eggTextureCards.cxx | 8 +- pandatool/src/eggprogs/eggToC.cxx | 6 +- .../src/imageprogs/imageFixHiddenColor.cxx | 2 +- pandatool/src/imageprogs/imageTrans.cxx | 2 +- .../src/imageprogs/imageTransformColors.cxx | 18 +- pandatool/src/maxegg/maxEggLoader.cxx | 12 +- pandatool/src/maxegg/maxToEggConverter.cxx | 6 +- pandatool/src/maya/mayaShader.h | 2 +- pandatool/src/maya/mayaShaderColorDef.cxx | 4 +- pandatool/src/maya/mayaShaderColorDef.h | 4 +- pandatool/src/mayaegg/mayaEggLoader.cxx | 14 +- pandatool/src/mayaegg/mayaToEggConverter.cxx | 12 +- pandatool/src/objegg/objToEggConverter.cxx | 4 +- pandatool/src/palettizer/paletteImage.cxx | 2 +- pandatool/src/palettizer/palettizer.h | 2 +- pandatool/src/palettizer/texturePlacement.cxx | 28 +- pandatool/src/palettizer/texturePlacement.h | 2 +- pandatool/src/palettizer/texturePosition.h | 4 +- pandatool/src/palettizer/textureReference.cxx | 40 +- pandatool/src/palettizer/textureReference.h | 20 +- pandatool/src/softegg/softToEggConverter.cxx | 4 +- pandatool/src/vrmlegg/indexedFaceSet.cxx | 30 +- pandatool/src/vrmlegg/indexedFaceSet.h | 12 +- pandatool/src/xfileegg/xFileMesh.cxx | 2 +- pandatool/src/xfileegg/xFileNormal.cxx | 2 +- pandatool/src/xfileegg/xFileNormal.h | 2 +- pandatool/src/xfileegg/xFileVertex.cxx | 4 +- pandatool/src/xfileegg/xFileVertex.h | 4 +- 111 files changed, 1043 insertions(+), 1154 deletions(-) delete mode 100644 panda/src/linmath/vector_Colorf.cxx delete mode 100644 panda/src/linmath/vector_Colorf.h delete mode 100644 panda/src/linmath/vector_Normalf.cxx delete mode 100644 panda/src/linmath/vector_Normalf.h delete mode 100644 panda/src/linmath/vector_TexCoordf.h delete mode 100644 panda/src/linmath/vector_Vertexf.cxx delete mode 100644 panda/src/linmath/vector_Vertexf.h diff --git a/direct/src/directscripts/gendocs.py b/direct/src/directscripts/gendocs.py index 9928501cab..edf402382c 100644 --- a/direct/src/directscripts/gendocs.py +++ b/direct/src/directscripts/gendocs.py @@ -756,38 +756,7 @@ class CodeDatabase: ######################################################################## CLASS_RENAME_DICT = { - "Loader": "PandaLoader", - "String": "CString", - "LMatrix4f": "Mat4", - "LMatrix3f": "Mat3", - "LVecBase4f": "VBase4", - "LVector4f": "Vec4", - "LPoint4f": "Point4", - "LVecBase3f": "VBase3", - "LVector3f": "Vec3", - "LPoint3f": "Point3", - "LVecBase2f": "VBase2", - "LVector2f": "Vec2", - "LPoint2f": "Point2", - "LQuaternionf": "Quat", - "LMatrix4d": "Mat4D", - "LMatrix3d": "Mat3D", - "LVecBase4d": "VBase4D", - "LVector4d": "Vec4D", - "LPoint4d": "Point4D", - "LVecBase3d": "VBase3D", - "LVector3d": "Vec3D", - "LPoint3d": "Point3D", - "LVecBase2d": "VBase2D", - "LVector2d": "Vec2D", - "LPoint2d": "Point2D", - "LQuaterniond": "QuatD", - "Plane": "PlaneBase", - "Planef": "Plane", - "Planed": "PlaneD", - "Frustum": "FrustumBase", - "Frustumf": "Frustum", - "Frustumd": "FrustumD" + # No longer used, now empty. } diff --git a/direct/src/showbase/Loader.py b/direct/src/showbase/Loader.py index 05b6292fa1..51a5c8b9cd 100644 --- a/direct/src/showbase/Loader.py +++ b/direct/src/showbase/Loader.py @@ -2,7 +2,8 @@ __all__ = ['Loader'] -from pandac.PandaModules import * +from panda3d.core import * +from panda3d.core import Loader as PandaLoader from direct.directnotify.DirectNotifyGlobal import * from direct.showbase.DirectObject import DirectObject import types diff --git a/dtool/LocalSetup.pp b/dtool/LocalSetup.pp index 5d2895d511..58dec8cc3b 100644 --- a/dtool/LocalSetup.pp +++ b/dtool/LocalSetup.pp @@ -286,7 +286,7 @@ $[cdefine HAVE_SPEEDTREE] /* Define if we want to compile in a default font. */ $[cdefine COMPILE_IN_DEFAULT_FONT] -/* Define to use doubles for graphic values, intead of single-precision floats. */ +/* Define to use doubles for most numbers, intead of single-precision floats. */ $[cdefine STDFLOAT_DOUBLE] /* Define if we have Maya available. */ diff --git a/dtool/src/cppparser/cppParser.cxx b/dtool/src/cppparser/cppParser.cxx index e5a37a2836..443bbf9e0e 100644 --- a/dtool/src/cppparser/cppParser.cxx +++ b/dtool/src/cppparser/cppParser.cxx @@ -21,7 +21,7 @@ #include #include -bool cppparser_output_class_keyword = true; +bool cppparser_output_class_keyword = false; //////////////////////////////////////////////////////////////////// // Function: CPPParser::Constructor diff --git a/dtool/src/cppparser/cppType.cxx b/dtool/src/cppparser/cppType.cxx index 09c19f94f6..cae31242ed 100644 --- a/dtool/src/cppparser/cppType.cxx +++ b/dtool/src/cppparser/cppType.cxx @@ -18,6 +18,7 @@ CPPType::Types CPPType::_types; CPPType::PreferredNames CPPType::_preferred_names; +CPPType::AltNames CPPType::_alt_names; bool CPPTypeCompare:: operator () (CPPType *a, CPPType *b) const { @@ -167,6 +168,58 @@ get_preferred_name() const { return get_local_name(); } +//////////////////////////////////////////////////////////////////// +// Function: CPPType::get_num_alt_names +// Access: Public +// Description: Returns the number of "alternate" names for this +// type. The alternate names are alternate typedef +// names. This list might be empty, or it might be +// long. One of these names may or may not be the same +// as the "preferred" name. +//////////////////////////////////////////////////////////////////// +int CPPType:: +get_num_alt_names() const { + // We do a lookup based on the type's name, instead of its pointer, + // so we can resolve different expansions of the same type. + string tname = this->get_fully_scoped_name(); + + if (!tname.empty()) { + AltNames::const_iterator ai; + ai = _alt_names.find(tname); + if (ai != _alt_names.end()) { + const Names &names = (*ai).second; + return names.size(); + } + } + + return 0; +} + +//////////////////////////////////////////////////////////////////// +// Function: CPPType::get_alt_name +// Access: Public +// Description: Returns the nth "alternate" name for this +// type. See get_num_alt_names(). +//////////////////////////////////////////////////////////////////// +string CPPType:: +get_alt_name(int n) const { + // We do a lookup based on the type's name, instead of its pointer, + // so we can resolve different expansions of the same type. + string tname = this->get_fully_scoped_name(); + + if (!tname.empty()) { + AltNames::const_iterator ai; + ai = _alt_names.find(tname); + if (ai != _alt_names.end()) { + const Names &names = (*ai).second; + if (n >= 0 && n < (int)names.size()) { + return names[n]; + } + } + } + + return string(); +} //////////////////////////////////////////////////////////////////// // Function: CPPType::is_incomplete @@ -271,18 +324,29 @@ new_type(CPPType *type) { } //////////////////////////////////////////////////////////////////// -// Function: CPPType::record_preferred_name_for +// Function: CPPType::record_alt_name_for // Access: Public, Static // Description: Records a global typedef name associated with the -// indicated Type. This will be taken as the -// "preferred" name for this class, should anyone ask. +// indicated Type. This will be an "alt" name, and it +// may also become the "preferred" name. //////////////////////////////////////////////////////////////////// void CPPType:: -record_preferred_name_for(const CPPType *type, const string &name) { +record_alt_name_for(const CPPType *type, const string &name) { if (!name.empty()) { string tname = type->get_fully_scoped_name(); if (!tname.empty()) { - _preferred_names.insert(PreferredNames::value_type(tname, name)); + if (tname.find('<') != string::npos) { + // If the name contains a funny character like a template + // name, then we implicitly take the first typedef as the + // preferred name. + _preferred_names.insert(PreferredNames::value_type(tname, name)); + } + + Names &names = _alt_names[tname]; + if (find(names.begin(), names.end(), name) == names.end()) { + // It's not already recorded as an alt name, so record it now. + names.push_back(name); + } } } } diff --git a/dtool/src/cppparser/cppType.h b/dtool/src/cppparser/cppType.h index 1258fec2c7..dfc2364e76 100644 --- a/dtool/src/cppparser/cppType.h +++ b/dtool/src/cppparser/cppType.h @@ -57,6 +57,8 @@ public: virtual string get_local_name(CPPScope *scope = NULL) const; virtual string get_fully_scoped_name() const; virtual string get_preferred_name() const; + int get_num_alt_names() const; + string get_alt_name(int n) const; virtual bool is_incomplete() const; virtual bool is_equivalent(const CPPType &other) const; @@ -73,7 +75,7 @@ public: static CPPType *new_type(CPPType *type); - static void record_preferred_name_for(const CPPType *type, const string &name); + static void record_alt_name_for(const CPPType *type, const string &name); static string get_preferred_name_for(const CPPType *type); CPPTypeDeclaration *_declaration; @@ -85,6 +87,10 @@ protected: typedef map PreferredNames; static PreferredNames _preferred_names; + + typedef vector Names; + typedef map AltNames; + static AltNames _alt_names; }; #endif diff --git a/dtool/src/cppparser/cppTypedef.cxx b/dtool/src/cppparser/cppTypedef.cxx index a1ad7fb068..7bb8002f61 100644 --- a/dtool/src/cppparser/cppTypedef.cxx +++ b/dtool/src/cppparser/cppTypedef.cxx @@ -37,7 +37,7 @@ CPPTypedef(CPPInstance *inst, bool global) : CPPInstance(*inst) assert(_type != NULL); if (global) { _type->_typedefs.push_back(this); - CPPType::record_preferred_name_for(_type, inst->get_local_name()); + CPPType::record_alt_name_for(_type, inst->get_local_name()); } } diff --git a/dtool/src/interrogate/interfaceMakerPythonNative.cxx b/dtool/src/interrogate/interfaceMakerPythonNative.cxx index 65114603e4..dca94f992d 100755 --- a/dtool/src/interrogate/interfaceMakerPythonNative.cxx +++ b/dtool/src/interrogate/interfaceMakerPythonNative.cxx @@ -124,38 +124,7 @@ const char * InPlaceSet[] = { /////////////////////////////////////////////////////////////////////////////////////// RenameSet classRenameDictionary[] = { - { "Loader" , "PandaLoader",0 }, - { "string" , "CString",0 }, - { "LMatrix4f" , "Mat4",0 }, - { "LMatrix3f" , "Mat3",0 }, - { "LVecBase4f" , "VBase4",0 }, - { "LVector4f" , "Vec4",0 }, - { "LPoint4f" , "Point4",0 }, - { "LVecBase3f" , "VBase3",0 }, - { "LVector3f" , "Vec3",0 }, - { "LPoint3f" , "Point3",0 }, - { "LVecBase2f" , "VBase2",0 }, - { "LVector2f" , "Vec2",0 }, - { "LPoint2f" , "Point2",0 }, - { "LQuaternionf" , "Quat",0 }, - { "LMatrix4d" , "Mat4D",0 }, - { "LMatrix3d" , "Mat3D",0 }, - { "LVecBase4d" , "VBase4D",0 }, - { "LVector4d" , "Vec4D",0 }, - { "LPoint4d" , "Point4D",0 }, - { "LVecBase3d" , "VBase3D",0 }, - { "LVector3d" , "Vec3D",0 }, - { "LPoint3d" , "Point3D",0 }, - { "LVecBase2d" , "VBase2D",0 }, - { "LVector2d" , "Vec2D",0 }, - { "LPoint2d" , "Point2D",0 }, - { "LQuaterniond" , "QuatD",0 }, - { "Plane" , "PlaneBase",0 }, - { "Planef" , "Plane",0 }, - { "Planed" , "PlaneD",0 }, - { "Frustum" , "FrustumBase",0 }, - { "Frustumf" , "Frustum",0 }, - { "Frustumd" , "FrustumD",0 }, + // No longer used, now empty. { NULL,NULL,-1 } }; @@ -205,78 +174,61 @@ std::string checkKeyword(std::string & cppName) } return cppName; } -/////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////// -std::string classNameFromCppName(const std::string &cppName) -{ - //# initialize to empty string - std::string className = ""; - //# These are the characters we want to strip out of the name - const std::string badChars("!@#$%^&*()<>,.-=+~{}?"); - int nextCap = 0; - int firstChar = 1; - for(std::string::const_iterator chr = cppName.begin(); chr != cppName.end(); chr++) - { - if (badChars.find(*chr) != std::string::npos) - { - } - else if (*chr == '_' || *chr == ' ') - { - nextCap = 1; - } - else if (nextCap || firstChar) - { - className += toupper(*chr); - nextCap = 0; - firstChar = 0; - } - else - { - className += * chr; - } - } - for(int x = 0; classRenameDictionary[x]._from != NULL; x++) - { - if(cppName == classRenameDictionary[x]._from) - className = classRenameDictionary[x]._to; - } - if (className.empty()) - { - std::string text = "** ERROR ** Renaming class: " + cppName + " to empty string"; - printf("%s",text.c_str()); - } - - - //# FFIConstants.notify.debug('Renaming class: ' + cppName + ' to: ' + className) - //# Note we do not have to check for keywords because class name are capitalized - return className; -} - -/////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////// -std::string nonClassNameFromCppName(const std::string &cppName_in) -{ - std::string className = classNameFromCppName(cppName_in); - //# Make the first character lowercase - std::string newName; - int pass = 0; - for(std::string::const_iterator chr = className.begin(); chr != className.end(); chr++) - { - if(pass == 0) - newName += toupper(*chr); - else - newName += tolower(*chr); - pass++; - } - //# Mangle names that happen to be python keywords so they are not anymore - //newName = checkKeyword(newName) - return newName; -} /////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////// std::string -methodNameFromCppName(const std::string &cppName, const std::string &className) { +classNameFromCppName(const std::string &cppName, bool mangle) { + //# initialize to empty string + std::string className = ""; + + //# These are the characters we want to strip out of the name + const std::string badChars("!@#$%^&*()<>,.-=+~{}? "); + + bool nextCap = false; + bool firstChar = true && mangle; + + for (std::string::const_iterator chr = cppName.begin(); + chr != cppName.end(); + chr++) { + if ((*chr == '_' || *chr == ' ') && mangle) { + nextCap = true; + + } else if (badChars.find(*chr) != std::string::npos) { + if (!mangle) { + className += '_'; + } + + } else if (nextCap || firstChar) { + className += toupper(*chr); + nextCap = false; + firstChar = false; + + } else { + className += * chr; + } + } + + for (int x = 0; classRenameDictionary[x]._from != NULL; x++) { + if (cppName == classRenameDictionary[x]._from) { + className = classRenameDictionary[x]._to; + } + } + + if (className.empty()) { + std::string text = "** ERROR ** Renaming class: " + cppName + " to empty string"; + printf("%s",text.c_str()); + } + + className = checkKeyword(className); + //# FFIConstants.notify.debug('Renaming class: ' + cppName + ' to: ' + className) + return className; +} + +/////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////// +std::string +methodNameFromCppName(const std::string &cppName, const std::string &className, bool mangle) { std::string origName = cppName; if (origName.substr(0, 6) == "__py__") { @@ -286,59 +238,54 @@ methodNameFromCppName(const std::string &cppName, const std::string &className) } std::string methodName; - const std::string badChars("!@#$%^&*()<>,.-=+~{}?"); - int nextCap = 0; - for(std::string::const_iterator chr = origName.begin(); chr != origName.end(); chr++) - { - if (badChars.find(*chr) != std::string::npos) - { - } - else if (*chr == '_' || *chr == ' ') - { - nextCap = 1; - } - else if (nextCap) - { - methodName += toupper(*chr); - nextCap = 0; - } - else - { - methodName += *chr; - } - } + const std::string badChars("!@#$%^&*()<>,.-=+~{}? "); + bool nextCap = false; + for (std::string::const_iterator chr = origName.begin(); + chr != origName.end(); + chr++) { + if ((*chr == '_' || *chr == ' ') && mangle) { + nextCap = true; - for(int x = 0; methodRenameDictionary[x]._from != NULL; x++) - { - if(origName == methodRenameDictionary[x]._from) - { - methodName = methodRenameDictionary[x]._to; - } - } + } else if (badChars.find(*chr) != std::string::npos) { + if (!mangle) { + methodName += '_'; + } - if(className.size() > 0) - { - string LookUpName = className + '.' + cppName; - for(int x = 0; classRenameDictionary[x]._from != NULL; x++) - { - if(LookUpName == methodRenameDictionary[x]._from) - methodName = methodRenameDictionary[x]._to; - } + } else if (nextCap) { + methodName += toupper(*chr); + nextCap = false; + + } else { + methodName += *chr; } + } + + for (int x = 0; methodRenameDictionary[x]._from != NULL; x++) { + if (origName == methodRenameDictionary[x]._from) { + methodName = methodRenameDictionary[x]._to; + } + } + + if (className.size() > 0) { + string LookUpName = className + '.' + cppName; + for (int x = 0; classRenameDictionary[x]._from != NULL; x++) { + if (LookUpName == methodRenameDictionary[x]._from) + methodName = methodRenameDictionary[x]._to; + } + } - // # Mangle names that happen to be python keywords so they are not anymore methodName = checkKeyword(methodName); return methodName; } -std::string methodNameFromCppName(InterfaceMaker::Function *func, const std::string &className) +std::string methodNameFromCppName(InterfaceMaker::Function *func, const std::string &className, bool mangle) { std::string cppName = func->_ifunc.get_name(); if (func->_ifunc.is_unary_op()) { cppName += "unary"; } - return methodNameFromCppName(cppName, className); + return methodNameFromCppName(cppName, className, mangle); } /////////////////////////////////////////////////////////////////////////////////////// @@ -346,13 +293,13 @@ std::string methodNameFromCppName(InterfaceMaker::Function *func, const std::st bool isInplaceFunction(InterfaceMaker::Function *func) { - std::string wname = methodNameFromCppName(func,""); - - for(int x = 0; InPlaceSet[x] != NULL; x++) - if(InPlaceSet[x] == wname) - return true; - - return false; + std::string wname = methodNameFromCppName(func, "", false); + + for(int x = 0; InPlaceSet[x] != NULL; x++) + if(InPlaceSet[x] == wname) + return true; + + return false; } //////////////////////////////////////////////////////////////////// @@ -752,6 +699,7 @@ void InterfaceMakerPythonNative::write_prototypes_class_external(ostream &out, O { std::string class_name = make_safe_name(obj->_itype.get_scoped_name()); std::string c_class_name = obj->_itype.get_true_name(); + std::string preferred_name = obj->_itype.get_name(); out << "//********************************************************************\n"; @@ -759,7 +707,7 @@ void InterfaceMakerPythonNative::write_prototypes_class_external(ostream &out, O out << "//********************************************************************\n"; out << "typedef "<< c_class_name <<" "<< class_name <<"_localtype;\n"; - out << "Define_Module_Class_Forward("<< _def->module_name << ", "<< class_name << "," << class_name <<"_localtype,"<< classNameFromCppName(c_class_name) << ");\n"; + out << "Define_Module_Class_Forward("<< _def->module_name << ", "<< class_name << "," << class_name <<"_localtype,"<< classNameFromCppName(preferred_name, false) << ");\n"; } ///////////////////////////////////////// //////////////////////////////////////////////////// @@ -855,7 +803,6 @@ void InterfaceMakerPythonNative::write_ClasseDetails(ostream &out, Object * obj) //std::string cClassName = obj->_itype.get_scoped_name(); std::string ClassName = make_safe_name(obj->_itype.get_scoped_name()); std::string cClassName = obj->_itype.get_true_name(); - std::string export_class_name = classNameFromCppName(obj->_itype.get_name()); out << "//********************************************************************\n"; out << "//*** Functions for .. "<< cClassName <<" \n" ; @@ -995,7 +942,8 @@ void InterfaceMakerPythonNative::write_ClasseDeclarations(ostream &out, ostream const InterrogateType &itype = obj->_itype; std::string class_name = make_safe_name(obj->_itype.get_scoped_name()); - std::string c_class_name = itype.get_true_name(); + std::string c_class_name = obj->_itype.get_true_name(); + std::string preferred_name = itype.get_name(); std::string class_struct_name = std::string(CLASS_PREFEX) +class_name; out << "typedef "<< c_class_name <<" "<< class_name <<"_localtype;\n"; @@ -1004,22 +952,22 @@ void InterfaceMakerPythonNative::write_ClasseDeclarations(ostream &out, ostream { if(TypeManager::is_reference_count(obj->_itype._cpptype)) { - out << "Define_Module_ClassRef("<< _def->module_name<<"," << class_name << "," << class_name <<"_localtype,"<< classNameFromCppName(c_class_name) <<");\n"; + out << "Define_Module_ClassRef("<< _def->module_name<<"," << class_name << "," << class_name <<"_localtype,"<< classNameFromCppName(preferred_name, false) <<");\n"; } else { - out << "Define_Module_Class("<<_def->module_name << "," << class_name << "," <module_name << "," << class_name << "," <_itype._cpptype)) { - out << "Define_Module_ClassRef_Private("<<_def->module_name << "," << class_name << "," << class_name <<"_localtype,"<< classNameFromCppName(c_class_name) <<");\n"; + out << "Define_Module_ClassRef_Private("<<_def->module_name << "," << class_name << "," << class_name <<"_localtype,"<< classNameFromCppName(preferred_name, false) <<");\n"; } else { - out << "Define_Module_Class_Private("<<_def->module_name<< "," << class_name << "," << class_name <<"_localtype,"<< classNameFromCppName(c_class_name) << ");\n"; + out << "Define_Module_Class_Private("<<_def->module_name<< "," << class_name << "," << class_name <<"_localtype,"<< classNameFromCppName(preferred_name, false) << ");\n"; } } @@ -1028,19 +976,19 @@ void InterfaceMakerPythonNative::write_ClasseDeclarations(ostream &out, ostream *out_h << "extern \"C\" " << EXPORT_IMPORT_PREFEX << " struct Dtool_PyTypedObject Dtool_" << class_name <<";\n"; } //////////////////////////////////////////////////////////////////// -// Function: InterfaceMakerPythonNative::write_module +// Function: InterfaceMakerPythonNative::write_sub_module // Access: Public, Virtual // Description: Generates whatever additional code is required to // support a module file. //////////////////////////////////////////////////////////////////// void InterfaceMakerPythonNative::write_sub_module(ostream &out, Object *obj) { - //Object * obj = _objects[_embeded_index] ; - std::string ClassName = make_safe_name(obj->_itype.get_scoped_name()); - out << "//********************************************************************\n"; - out << "//*** Module Init Updcall .." << obj->_itype.get_scoped_name() << "\n"; - out << "//********************************************************************\n"; - out << " Dtool_PyModuleClassInit_"<< ClassName <<"(module);\n"; + //Object * obj = _objects[_embeded_index] ; + std::string ClassName = make_safe_name(obj->_itype.get_scoped_name()); + out << "//********************************************************************\n"; + out << "//*** Module Init Updcall .." << obj->_itype.get_scoped_name() << "\n"; + out << "//********************************************************************\n"; + out << " Dtool_PyModuleClassInit_"<< ClassName <<"(module);\n"; } ///////////////////////////////////////////////////////////////////////////// // Function : write_module_support @@ -1068,8 +1016,16 @@ void InterfaceMakerPythonNative::write_module_support(ostream &out,ostream *out_ out << "//*** Module Enums .." << object->_itype.get_scoped_name() << "\n"; out << "//********************************************************************\n"; } - for(int xx = 0; xx< enum_count; xx++) - out << " PyModule_AddIntConstant(module,\"" << classNameFromCppName(object->_itype.get_enum_value_name(xx)) <<"\","<< object->_itype.get_enum_value(xx) << ");\n"; + for(int xx = 0; xx< enum_count; xx++) { + string name1 = classNameFromCppName(object->_itype.get_enum_value_name(xx), false); + string name2 = classNameFromCppName(object->_itype.get_enum_value_name(xx), true); + int enum_value = object->_itype.get_enum_value(xx); + out << " PyModule_AddIntConstant(module,\"" << name1 <<"\","<< enum_value << ");\n"; + if (name1 != name2) { + // Also write the mangled name, for historical purposes. + out << " PyModule_AddIntConstant(module,\"" << name2 <<"\","<< enum_value << ");\n"; + } + } } } } @@ -1085,15 +1041,25 @@ void InterfaceMakerPythonNative::write_module_support(ostream &out,ostream *out_ FunctionIndex func_index = iman.get_getter(); record_function(dummy_type, func_index); } - if(iman.has_int_value()) - out << " PyModule_AddIntConstant(module,\"" << classNameFromCppName(iman.get_name()) <<"\","<< iman.get_int_value() << ");\n"; - else - out << " PyModule_AddStringConstant(module,\"" << classNameFromCppName(iman.get_name()) <<"\",\""<< iman.get_definition().c_str() << "\");\n"; + string name1 = classNameFromCppName(iman.get_name(), false); + string name2 = classNameFromCppName(iman.get_name(), true); + if(iman.has_int_value()) { + int value = iman.get_int_value(); + out << " PyModule_AddIntConstant(module,\"" << name1 <<"\","<< value << ");\n"; + if (name1 != name2) { + // Also write the mangled name, for historical purposes. + out << " PyModule_AddIntConstant(module,\"" << name2 <<"\","<< value << ");\n"; + } + } else { + string value = iman.get_definition(); + out << " PyModule_AddStringConstant(module,\"" << name1 <<"\",\""<< value << "\");\n"; + if (name1 != name2) { + out << " PyModule_AddStringConstant(module,\"" << name2 <<"\",\""<< value << "\");\n"; + } + } } - - for (oi = _objects.begin(); oi != _objects.end(); ++oi) { Object *object = (*oi).second; @@ -1125,18 +1091,22 @@ void InterfaceMakerPythonNative::write_module_support(ostream &out,ostream *out_ Function *func = (*fi); if(!func->_itype.is_global() && isFunctionLegal(func)) { - { - out << " { \"" << methodNameFromCppName(func,"") << "\", (PyCFunction) &" - << func->_name << ", METH_VARARGS| METH_KEYWORDS, (char *)" << func->_name << "_comment},\n"; - } + string name1 = methodNameFromCppName(func, "", false); + string name2 = methodNameFromCppName(func, "", true); + out << " { \"" << name1 << "\", (PyCFunction) &" + << func->_name << ", METH_VARARGS| METH_KEYWORDS, (char *)" << func->_name << "_comment},\n"; + if (name1 != name2) { + out << " { \"" << name2 << "\", (PyCFunction) &" + << func->_name << ", METH_VARARGS| METH_KEYWORDS, (char *)" << func->_name << "_comment},\n"; + } } } if(force_base_functions) { out << " //Support Function For Dtool_types ... for now in each module ??\n"; - out << " {\"Dtool_BorrowThisReference\", &Dtool_BorrowThisReference,METH_VARARGS,\"Used to borrow 'this' poiner ( to, from)\\n Assumes no ownership\"}, \n"; - out << " {\"Dtool_AddToDictionary\", &Dtool_AddToDictionary,METH_VARARGS,\"Used to Items Into a types (tp_dict)\"}, \n"; + out << " {\"Dtool_BorrowThisReference\", &Dtool_BorrowThisReference,METH_VARARGS,\"Used to borrow 'this' pointer ( to, from)\\n Assumes no ownership\"}, \n"; + out << " {\"Dtool_AddToDictionary\", &Dtool_AddToDictionary,METH_VARARGS,\"Used to add items into a tp_dict\"}, \n"; } out << " { NULL, NULL ,0,NULL}\n" << "};\n\n"; @@ -1194,16 +1164,15 @@ write_module_class(ostream &out, Object *obj) { std::string ClassName = make_safe_name(obj->_itype.get_scoped_name()); std::string cClassName = obj->_itype.get_true_name(); - std::string export_calss_name = classNameFromCppName(obj->_itype.get_name()); + std::string export_class_name = classNameFromCppName(obj->_itype.get_name(), false); + std::string export_class_name2 = classNameFromCppName(obj->_itype.get_name(), true); Functions::iterator fi; out << "//********************************************************************\n"; - out << "//*** Py Init Code For .. "<< ClassName <<" | " << export_calss_name <<"\n" ; + out << "//*** Py Init Code For .. "<< ClassName <<" | " << export_class_name <<"\n" ; out << "//********************************************************************\n"; out << "PyMethodDef Dtool_Methods_"<< ClassName << "[]= {\n"; - - std::map static_functions; std::map normal_Operator_functions; std::map wraped_Operator_functions; @@ -1211,8 +1180,8 @@ write_module_class(ostream &out, Object *obj) { bool got_copy = false; bool got_deepcopy = false; - int x; - for (x = 0, fi = obj->_methods.begin(); fi != obj->_methods.end(); ++fi,x++) { + int x = 0; + for (fi = obj->_methods.begin(); fi != obj->_methods.end(); ++fi) { Function *func = (*fi); if (func->_name == "__copy__") { got_copy = true; @@ -1220,33 +1189,31 @@ write_module_class(ostream &out, Object *obj) { got_deepcopy = true; } + if (!isFunctionWithThis(func)) { + // Save a reference to this static method, so we can add it + // directly to the class. + static_functions[x] = func; + } + + string name1 = methodNameFromCppName(func, export_class_name, false); + string name2 = methodNameFromCppName(func, export_class_name, true); + out << " { \"" << name1 << "\",(PyCFunction ) &" + << func->_name << ", METH_VARARGS| METH_KEYWORDS, (char *)" << func->_name << "_comment},\n"; + ++x; + if (name1 != name2) { + out << " { \"" << name2 << "\",(PyCFunction ) &" + << func->_name << ", METH_VARARGS| METH_KEYWORDS, (char *)" << func->_name << "_comment},\n"; + ++x; + } + SlottedFunctionDef slotted_def; if (!get_slotted_function_def(obj, func, slotted_def)) { - out << " { \"" << methodNameFromCppName(func,export_calss_name) << "\",(PyCFunction ) &" - << func->_name << ", METH_VARARGS| METH_KEYWORDS, (char *)" << func->_name << "_comment},\n"; - if(!isFunctionWithThis(func)) { - static_functions[x] = func; - } + } else if (slotted_def._wrapper_type != WT_none) { + wraped_Operator_functions[func] = slotted_def; + } else { - if (slotted_def._wrapper_type != WT_none) { - wraped_Operator_functions[func] = slotted_def; - - out << " { \"" << methodNameFromCppName(func,export_calss_name) << "\",(PyCFunction ) &" - << func->_name << ", METH_VARARGS| METH_KEYWORDS, (char *)" << func->_name << "_comment},\n"; - if (!isFunctionWithThis(func)) { - static_functions[x] = func; - } - - } else { - normal_Operator_functions[func] = slotted_def._answer_location; - - out << " { \"" << methodNameFromCppName(func,export_calss_name) << "\",(PyCFunction ) &" - << func->_name << ", METH_VARARGS| METH_KEYWORDS, (char *)" << func->_name << "_comment},\n"; - if (!isFunctionWithThis(func)) { - static_functions[x] = func; - } - } + normal_Operator_functions[func] = slotted_def._answer_location; } } @@ -1272,9 +1239,14 @@ write_module_class(ostream &out, Object *obj) { if (obj->is_static_method((*msi)->_element_name)) { flags += "|METH_CLASS"; } - out << " { \"" - << methodNameFromCppName((*msi)->_seq_name, export_calss_name) + string name1 = methodNameFromCppName((*msi)->_seq_name, export_class_name, false); + string name2 = methodNameFromCppName((*msi)->_seq_name, export_class_name, true); + out << " { \"" << name1 << "\",(PyCFunction) &" << (*msi)->_name << ", " << flags << ", NULL},\n"; + if (name1 != name2) { + out << " { \"" << name2 + << "\",(PyCFunction) &" << (*msi)->_name << ", " << flags << ", NULL},\n"; + } } out << " { NULL, NULL }\n" @@ -1329,9 +1301,9 @@ write_module_class(ostream &out, Object *obj) { Function *func = rfi->first; out << "//////////////////\n"; out << "// A wrapper function to satisfy Python's internal calling conventions. \n"; - out << "// " <second._answer_location <<" = "<< methodNameFromCppName(func,export_calss_name) <<"\n"; + out << "// " <second._answer_location <<" = "<< methodNameFromCppName(func,export_class_name, false) <<"\n"; out << "//////////////////\n"; - out << "static PyObject * " << func->_name << methodNameFromCppName(func,export_calss_name) << "( PyObject * self)\n"; + out << "static PyObject * " << func->_name << methodNameFromCppName(func,export_class_name, false) << "( PyObject * self)\n"; out << "{\n"; out << " PyObject *args = Py_BuildValue(\"()\");\n"; out << " PyObject *result = " << func->_name <<"(self, args, NULL);\n"; @@ -1348,9 +1320,9 @@ write_module_class(ostream &out, Object *obj) { Function *func = rfi->first; out << "//////////////////\n"; out << "// A wrapper function to satisfy Python's internal calling conventions. \n"; - out << "// " <second._answer_location <<" = "<< methodNameFromCppName(func,export_calss_name) <<"\n"; + out << "// " <second._answer_location <<" = "<< methodNameFromCppName(func,export_class_name, false) <<"\n"; out << "//////////////////\n"; - out << "static PyObject *" << func->_name << methodNameFromCppName(func,export_calss_name) << "(PyObject *self, PyObject *one)\n"; + out << "static PyObject *" << func->_name << methodNameFromCppName(func,export_class_name, false) << "(PyObject *self, PyObject *one)\n"; out << "{\n"; out << " PyObject *args = Py_BuildValue(\"(O)\", one);\n"; out << " PyObject *result = " << func->_name <<"(self, args, NULL);\n"; @@ -1366,9 +1338,9 @@ write_module_class(ostream &out, Object *obj) { Function *func = rfi->first; out << "//////////////////\n"; out << "// A wrapper function to satisfy Python's internal calling conventions. \n"; - out << "// " <second._answer_location <<" = "<< methodNameFromCppName(func,export_calss_name) <<"\n"; + out << "// " <second._answer_location <<" = "<< methodNameFromCppName(func,export_class_name, false) <<"\n"; out << "//////////////////\n"; - out << "static int " << func->_name << methodNameFromCppName(func,export_calss_name) << "( PyObject * self, PyObject * one, PyObject * two)\n"; + out << "static int " << func->_name << methodNameFromCppName(func,export_class_name, false) << "( PyObject * self, PyObject * one, PyObject * two)\n"; out << "{\n"; out << " PyObject *args;\n"; out << " if (two == NULL) {\n"; @@ -1395,9 +1367,9 @@ write_module_class(ostream &out, Object *obj) { Function *func = rfi->first; out << "//////////////////\n"; out << "// A wrapper function to satisfy Python's internal calling conventions. \n"; - out << "// " <second._answer_location <<" = "<< methodNameFromCppName(func,export_calss_name) <<"\n"; + out << "// " <second._answer_location <<" = "<< methodNameFromCppName(func,export_class_name, false) <<"\n"; out << "//////////////////\n"; - out << "static PyObject * " << func->_name << methodNameFromCppName(func,export_calss_name) << "( PyObject * self, PyObject * one)\n"; + out << "static PyObject * " << func->_name << methodNameFromCppName(func,export_class_name, false) << "( PyObject * self, PyObject * one)\n"; out << "{\n"; out << " PyObject *args = Py_BuildValue(\"(O)\", one);\n"; out << " PyObject *result = " << func->_name <<"(self, args, NULL);\n"; @@ -1417,9 +1389,9 @@ write_module_class(ostream &out, Object *obj) { Function *func = rfi->first; out << "//////////////////\n"; out << "// A wrapper function to satisfy Python's internal calling conventions. \n"; - out << "// " <second._answer_location <<" = "<< methodNameFromCppName(func,export_calss_name) <<"\n"; + out << "// " <second._answer_location <<" = "<< methodNameFromCppName(func,export_class_name, false) <<"\n"; out << "//////////////////\n"; - out << "static PyObject * " << func->_name << methodNameFromCppName(func,export_calss_name) << "( PyObject * self, Py_ssize_t index)\n"; + out << "static PyObject * " << func->_name << methodNameFromCppName(func,export_class_name, false) << "( PyObject * self, Py_ssize_t index)\n"; out << "{\n"; out << " PyObject *args = Py_BuildValue(\"(i)\", index);\n"; out << " PyObject *result = " << func->_name <<"(self, args, NULL);\n"; @@ -1435,9 +1407,9 @@ write_module_class(ostream &out, Object *obj) { Function *func = rfi->first; out << "//////////////////\n"; out << "// A wrapper function to satisfy Python's internal calling conventions. \n"; - out << "// " <second._answer_location <<" = "<< methodNameFromCppName(func,export_calss_name) <<"\n"; + out << "// " <second._answer_location <<" = "<< methodNameFromCppName(func,export_class_name, false) <<"\n"; out << "//////////////////\n"; - out << "static int " << func->_name << methodNameFromCppName(func,export_calss_name) << "( PyObject * self, Py_ssize_t index, PyObject *value)\n"; + out << "static int " << func->_name << methodNameFromCppName(func,export_class_name, false) << "( PyObject * self, Py_ssize_t index, PyObject *value)\n"; out << "{\n"; out << " PyObject *args = Py_BuildValue(\"(iO)\", index, value);\n"; out << " PyObject *result = " << func->_name <<"(self, args, NULL);\n"; @@ -1457,9 +1429,9 @@ write_module_class(ostream &out, Object *obj) { Function *func = rfi->first; out << "//////////////////\n"; out << "// A wrapper function to satisfy Python's internal calling conventions. \n"; - out << "// " <second._answer_location <<" = "<< methodNameFromCppName(func,export_calss_name) <<"\n"; + out << "// " <second._answer_location <<" = "<< methodNameFromCppName(func,export_class_name, false) <<"\n"; out << "//////////////////\n"; - out << "static Py_ssize_t " << func->_name << methodNameFromCppName(func,export_calss_name) << "(PyObject *self)\n"; + out << "static Py_ssize_t " << func->_name << methodNameFromCppName(func,export_class_name, false) << "(PyObject *self)\n"; out << "{\n"; out << " PyObject *args = Py_BuildValue(\"()\");\n"; out << " PyObject *result = "<< func->_name <<"(self, args, NULL);\n"; @@ -1480,9 +1452,9 @@ write_module_class(ostream &out, Object *obj) { Function *func = rfi->first; out << "//////////////////\n"; out << "// A wrapper function to satisfy Python's internal calling conventions. \n"; - out << "// " <second._answer_location <<" = "<< methodNameFromCppName(func,export_calss_name) <<"\n"; + out << "// " <second._answer_location <<" = "<< methodNameFromCppName(func,export_class_name, false) <<"\n"; out << "//////////////////\n"; - out << "static int " << func->_name << methodNameFromCppName(func,export_calss_name) << "( PyObject * self, PyObject * one, PyObject * two)\n"; + out << "static int " << func->_name << methodNameFromCppName(func,export_class_name, false) << "( PyObject * self, PyObject * one, PyObject * two)\n"; out << "{\n"; out << " PyObject *args = Py_BuildValue(\"(OO)\", one, two);\n"; out << " PyObject *result = " << func->_name <<"(self, args, NULL);\n"; @@ -1502,9 +1474,9 @@ write_module_class(ostream &out, Object *obj) { Function *func = rfi->first; out << "//////////////////\n"; out << "// A wrapper function to satisfy Python's internal calling conventions. \n"; - out << "// " <second._answer_location <<" = "<< methodNameFromCppName(func,export_calss_name) <<"\n"; + out << "// " <second._answer_location <<" = "<< methodNameFromCppName(func,export_class_name, false) <<"\n"; out << "//////////////////\n"; - out << "static int " << func->_name << methodNameFromCppName(func,export_calss_name) << "(PyObject *self)\n"; + out << "static int " << func->_name << methodNameFromCppName(func,export_class_name, false) << "(PyObject *self)\n"; out << "{\n"; out << " PyObject *args = Py_BuildValue(\"()\");\n"; out << " PyObject *result = " << func->_name <<"(self, args, NULL);\n"; @@ -1582,12 +1554,12 @@ write_module_class(ostream &out, Object *obj) { out << " ostringstream os;\n"; if (need_repr == 3) { out << " _ext_" << ClassName << "_python_repr(local_this, os, \"" - << classNameFromCppName(ClassName) << "\");\n"; + << classNameFromCppName(ClassName, false) << "\");\n"; } else if (need_repr == 2) { out << " local_this->output(os);\n"; } else { out << " local_this->python_repr(os, \"" - << classNameFromCppName(ClassName) << "\");\n"; + << classNameFromCppName(ClassName, false) << "\");\n"; } out << " std::string ss = os.str();\n"; out << " return PyString_FromStringAndSize(ss.data(),ss.length());\n"; @@ -1668,15 +1640,13 @@ write_module_class(ostream &out, Object *obj) { // get dictionary out << " Dtool_" << ClassName << ".As_PyTypeObject().tp_dict = PyDict_New();\n"; out << " PyDict_SetItemString(Dtool_"<::iterator ofi; for(ofi = normal_Operator_functions.begin(); ofi != normal_Operator_functions.end(); ofi++) { Function *func = ofi->first; - out << " // " << ofi->second <<" = "<< methodNameFromCppName(func,export_calss_name) <<"\n"; + out << " // " << ofi->second <<" = "<< methodNameFromCppName(func,export_class_name, false) <<"\n"; out << " Dtool_" << ClassName <<".As_PyTypeObject()." << ofi->second <<" = &" << func->_name <<";\n"; } @@ -1687,8 +1657,8 @@ write_module_class(ostream &out, Object *obj) { for(rfi = wraped_Operator_functions.begin(); rfi != wraped_Operator_functions.end(); rfi++) { Function *func = rfi->first; - out << " // " << rfi->second._answer_location <<" = "<< methodNameFromCppName(func,export_calss_name) <<"\n"; - out << " Dtool_" << ClassName <<".As_PyTypeObject()." << rfi->second._answer_location <<" = &" << func->_name << methodNameFromCppName(func,export_calss_name)<<";\n"; + out << " // " << rfi->second._answer_location <<" = "<< methodNameFromCppName(func,export_class_name, false) <<"\n"; + out << " Dtool_" << ClassName <<".As_PyTypeObject()." << rfi->second._answer_location <<" = &" << func->_name << methodNameFromCppName(func,export_class_name, false)<<";\n"; } } @@ -1734,7 +1704,12 @@ write_module_class(ostream &out, Object *obj) { std::string ClassName2 = make_safe_name(nested_obj->_itype.get_name()); out << " // Nested Object "<< ClassName1 << ";\n"; out << " Dtool_" << ClassName1 << "._Dtool_ClassInit(NULL);\n"; - out << " PyDict_SetItemString(Dtool_" << ClassName << ".As_PyTypeObject().tp_dict,\"" << classNameFromCppName(ClassName2) <<"\",(PyObject *)&Dtool_" << ClassName1 << ".As_PyTypeObject());\n"; + string name1 = classNameFromCppName(ClassName2, false); + string name2 = classNameFromCppName(ClassName2, true); + out << " PyDict_SetItemString(Dtool_" << ClassName << ".As_PyTypeObject().tp_dict,\"" << name1 <<"\",(PyObject *)&Dtool_" << ClassName1 << ".As_PyTypeObject());\n"; + if (name1 != name2) { + out << " PyDict_SetItemString(Dtool_" << ClassName << ".As_PyTypeObject().tp_dict,\"" << name2 <<"\",(PyObject *)&Dtool_" << ClassName1 << ".As_PyTypeObject());\n"; + } } else { @@ -1742,9 +1717,15 @@ write_module_class(ostream &out, Object *obj) { { out << " // Enum "<< nested_obj->_itype.get_scoped_name() << ";\n"; int enum_count = nested_obj->_itype.number_of_enum_values(); - for(int xx = 0; xx< enum_count; xx++) - out << " PyDict_SetItemString(Dtool_" << ClassName << ".As_PyTypeObject().tp_dict,\"" << classNameFromCppName(nested_obj->_itype.get_enum_value_name(xx)) <<"\",PyInt_FromLong("<< nested_obj->_itype.get_enum_value(xx) << "));\n"; - + for(int xx = 0; xx< enum_count; xx++) { + string name1 = classNameFromCppName(nested_obj->_itype.get_enum_value_name(xx), false); + string name2 = classNameFromCppName(nested_obj->_itype.get_enum_value_name(xx), true); + int enum_value = nested_obj->_itype.get_enum_value(xx); + out << " PyDict_SetItemString(Dtool_" << ClassName << ".As_PyTypeObject().tp_dict,\"" << name1 <<"\",PyInt_FromLong("<< enum_value << "));\n"; + if (name1 != name2) { + out << " PyDict_SetItemString(Dtool_" << ClassName << ".As_PyTypeObject().tp_dict,\"" << name2 <<"\",PyInt_FromLong("<< enum_value << "));\n"; + } + } } } } @@ -1757,20 +1738,30 @@ write_module_class(ostream &out, Object *obj) { out << " }\n"; out << " Py_INCREF(&Dtool_"<< ClassName << ".As_PyTypeObject());\n"; - out << " PyDict_SetItemString(Dtool_"<::iterator sfi; for(sfi= static_functions.begin(); sfi != static_functions.end(); sfi++) { - out << " // Static Method " << methodNameFromCppName(sfi->second,export_calss_name) << "\n"; - out << " PyDict_SetItemString(Dtool_" << ClassName << ".As_PyTypeObject().tp_dict,\"" ; - out << methodNameFromCppName(sfi->second,export_calss_name) ; - out << "\",PyCFunction_New(&Dtool_Methods_"<< ClassName <<"[" << sfi->first << "],&Dtool_"<< ClassName<< ".As_PyObject()));\n"; + out << " // Static Method " << methodNameFromCppName(sfi->second,export_class_name, false) << "\n"; + string name1 = methodNameFromCppName(sfi->second,export_class_name, false); + string name2 = methodNameFromCppName(sfi->second,export_class_name, true); + out << " PyDict_SetItemString(Dtool_" << ClassName + << ".As_PyTypeObject().tp_dict,\"" << name1 + << "\",PyCFunction_New(&Dtool_Methods_"<< ClassName <<"[" << sfi->first + << "],&Dtool_"<< ClassName<< ".As_PyObject()));\n"; + if (name1 != name2) { + out << " PyDict_SetItemString(Dtool_" << ClassName + << ".As_PyTypeObject().tp_dict,\"" << name2 + << "\",PyCFunction_New(&Dtool_Methods_"<< ClassName <<"[" << sfi->first + << "],&Dtool_"<< ClassName<< ".As_PyObject()));\n"; + } } - bool is_runtime_typed = IsPandaTypedObject(obj->_itype._cpptype->as_struct_type()); if (HasAGetClassTypeFunction(obj->_itype)) { is_runtime_typed = true; @@ -1786,11 +1777,24 @@ write_module_class(ostream &out, Object *obj) { out << " if(module != NULL)\n"; out << " {\n"; out << " Py_INCREF(&Dtool_"<< ClassName << ".As_PyTypeObject());\n"; - out << " PyModule_AddObject(module, \""<_itype.get_num_alt_names(); + for (int i = 0; i < num_alt_names; ++i) { + string alt_name = make_safe_name(obj->_itype.get_alt_name(i)); + if (export_class_name != alt_name) { + out << " PyModule_AddObject(module, \"" << alt_name << "\",(PyObject *)&Dtool_"<< ClassName << ".As_PyTypeObject());\n"; + } + } + out << " }\n"; out << "}\n"; - } + //////////////////////////////////////////////////////////////////// // Function: InterfaceMakerPythonNative::synthesize_this_parameter // Access: Public, Virtual @@ -1973,7 +1977,7 @@ write_function_for_name(ostream &out1, InterfaceMaker::Object *obj, InterfaceMak indent(out,8)<< "{\n"; indent(out,12) << "PyErr_Format(PyExc_TypeError, \"" - << methodNameFromCppName(func, "") + << methodNameFromCppName(func, "", false) << "() takes "; // We add one to the parameter count for "self", following the @@ -2181,7 +2185,7 @@ write_function_forset(ostream &out, InterfaceMaker::Object *obj, if (isRemapLegal(*remap)) { int pn = 0; if (remap->_has_this) { - // Skip the "this" parameter. It's never coerceable. + // Skip the "this" parameter. It's never coercible. ++pn; } while (pn < (int)remap->_parameters.size()) { @@ -2277,8 +2281,8 @@ write_function_forset(ostream &out, InterfaceMaker::Object *obj, string class_name = remap->_cpptype->get_simple_name(); indent(out, indent_level + 2) << " \"Cannot call " - << classNameFromCppName(class_name) - << "." << methodNameFromCppName(func, class_name) + << classNameFromCppName(class_name, false) + << "." << methodNameFromCppName(func, class_name, false) << "() on a const object.\");\n"; indent(out, indent_level + 2) << "return (PyObject *) NULL;\n"; @@ -2386,7 +2390,7 @@ write_function_instance(ostream &out, InterfaceMaker::Object *obj, // simultaneously building the ParseTuple() function call and also // the parameter expression list for call_function(). - expected_params += methodNameFromCppName(func1, ""); + expected_params += methodNameFromCppName(func1, "", false); expected_params += "("; int pn; @@ -2538,7 +2542,7 @@ write_function_instance(ostream &out, InterfaceMaker::Object *obj, } else { expected_params += "non-const "; } - expected_params += classNameFromCppName(obj_type->get_simple_name()); + expected_params += classNameFromCppName(obj_type->get_simple_name(), false); if (!remap->_has_this || pn != 0) { indent(out, indent_level) @@ -2572,14 +2576,14 @@ write_function_instance(ostream &out, InterfaceMaker::Object *obj, string method_prefix; if (remap->_cpptype) { class_name = remap->_cpptype->get_simple_name(); - method_prefix = classNameFromCppName(class_name) + string("."); + method_prefix = classNameFromCppName(class_name, false) + string("."); } ostringstream str; str << "DTOOL_Call_GetPointerThisClass(" << param_name << ", &Dtool_" << make_safe_name(p_itype.get_scoped_name()) << ", " << pn << ", \"" - << method_prefix << methodNameFromCppName(func1, class_name) + << method_prefix << methodNameFromCppName(func1, class_name, false) << "\", " << const_ok; if (coercion_possible && !is_copy_constructor) { // We never attempt to coerce a copy constructor parameter. @@ -2626,7 +2630,7 @@ write_function_instance(ostream &out, InterfaceMaker::Object *obj, // parameters, since we won't be getting any anyway. if (!func1->_ifunc.is_unary_op()) { std::string format_specifiers1 = format_specifiers + ":" + - methodNameFromCppName(func1, ""); + methodNameFromCppName(func1, "", false); indent(out,indent_level) << "static char * key_word_list[] = {" << keyword_list << "NULL};\n"; @@ -3048,8 +3052,8 @@ write_make_seq(ostream &out, Object *obj, const std::string &ClassName, out << " *******************************************************************/\n"; out << "static PyObject *" << make_seq->_name + "(PyObject *self, PyObject *) {\n"; - string num_name = methodNameFromCppName(make_seq->_num_name, ClassName); - string element_name = methodNameFromCppName(make_seq->_element_name, ClassName); + string num_name = methodNameFromCppName(make_seq->_num_name, ClassName, false); + string element_name = methodNameFromCppName(make_seq->_element_name, ClassName, false); out << " return make_list_for_item(self, \"" << num_name << "\", \"" << element_name << "\");\n"; @@ -3203,7 +3207,6 @@ void InterfaceMakerPythonNative::generate_wrappers() int num_global_elements = idb->get_num_global_elements(); for (int gi = 0; gi < num_global_elements; ++gi) { - printf(" Global Type = %d",gi); TypeIndex type_index = idb->get_global_element(gi); record_object(type_index); @@ -3233,8 +3236,6 @@ void InterfaceMakerPythonNative::generate_wrappers() int num_elements = idb->get_num_global_elements(); for (int ei = 0; ei < num_elements; ei++) { - printf(" Element %d\n",ei); - ElementIndex element_index = idb->get_global_element(ei); const InterrogateElement &ielement = idb->get_element(element_index); if (ielement.has_getter()) diff --git a/dtool/src/interrogate/interrogate.cxx b/dtool/src/interrogate/interrogate.cxx index d4ddf81829..705d89c208 100644 --- a/dtool/src/interrogate/interrogate.cxx +++ b/dtool/src/interrogate/interrogate.cxx @@ -494,8 +494,11 @@ main(int argc, char *argv[]) { // Now that we've parsed all the source code, change the way things // are output from now on so we can compile our generated code using // VC++. Sheesh. - cppparser_output_class_keyword = false; + // Actually, don't do this any more, since it bitches some of the + // logic (particularly with locating alt names), and it shouldn't be + // necessary with modern VC++. + // cppparser_output_class_keyword = false; // Now look for the .N files. for (i = 1; i < argc; ++i) { diff --git a/dtool/src/interrogate/interrogateBuilder.cxx b/dtool/src/interrogate/interrogateBuilder.cxx index f1813cd775..a526f67828 100644 --- a/dtool/src/interrogate/interrogateBuilder.cxx +++ b/dtool/src/interrogate/interrogateBuilder.cxx @@ -1905,6 +1905,16 @@ get_type(CPPType *type, bool global) { InterrogateDatabase::get_ptr()->update_type(index); itype._name = get_preferred_name(type); + + int num_alt_names = type->get_num_alt_names(); + if (num_alt_names != 0) { + itype._alt_names.clear(); + for (int i = 0; i < num_alt_names; ++i) { + string alt_name = type->get_alt_name(i); + itype._alt_names.push_back(alt_name); + } + } + itype._scoped_name = true_name; itype._true_name = true_name; itype._cpptype = type; diff --git a/dtool/src/interrogatedb/interrogateComponent.I b/dtool/src/interrogatedb/interrogateComponent.I index 4b0d466d39..7f85969055 100644 --- a/dtool/src/interrogatedb/interrogateComponent.I +++ b/dtool/src/interrogatedb/interrogateComponent.I @@ -125,3 +125,26 @@ INLINE const string &InterrogateComponent:: get_name() const { return _name; } + +//////////////////////////////////////////////////////////////////// +// Function: InterrogateComponent::get_num_alt_names +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +INLINE int InterrogateComponent:: +get_num_alt_names() const { + return _alt_names.size(); +} + +//////////////////////////////////////////////////////////////////// +// Function: InterrogateComponent::get_num_alt_names +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +INLINE const string &InterrogateComponent:: +get_alt_name(int n) const { + if (n >= 0 && n < (int)_alt_names.size()) { + return _alt_names[n]; + } + return _empty_string; +} diff --git a/dtool/src/interrogatedb/interrogateComponent.cxx b/dtool/src/interrogatedb/interrogateComponent.cxx index 4b2b3f5a63..dcd6af9a20 100644 --- a/dtool/src/interrogatedb/interrogateComponent.cxx +++ b/dtool/src/interrogatedb/interrogateComponent.cxx @@ -15,6 +15,9 @@ #include "interrogateComponent.h" #include "interrogate_datafile.h" +// This static string is just kept around as a handy bogus return +// value for functions that must return a const string reference. +string InterrogateComponent::_empty_string; //////////////////////////////////////////////////////////////////// // Function: InterrogateComponent::output @@ -24,6 +27,12 @@ void InterrogateComponent:: output(ostream &out) const { idf_output_string(out, _name); + out << _alt_names.size() << " "; + + Strings::const_iterator vi; + for (vi = _alt_names.begin(); vi != _alt_names.end(); ++vi) { + idf_output_string(out, *vi); + } } //////////////////////////////////////////////////////////////////// @@ -35,4 +44,13 @@ output(ostream &out) const { void InterrogateComponent:: input(istream &in) { idf_input_string(in, _name); + + int num_alt_names; + in >> num_alt_names; + _alt_names.reserve(num_alt_names); + for (int i = 0; i < num_alt_names; ++i) { + string alt_name; + idf_input_string(in, alt_name); + _alt_names.push_back(alt_name); + } } diff --git a/dtool/src/interrogatedb/interrogateComponent.h b/dtool/src/interrogatedb/interrogateComponent.h index 3670bf12bb..6ad6bcd806 100644 --- a/dtool/src/interrogatedb/interrogateComponent.h +++ b/dtool/src/interrogatedb/interrogateComponent.h @@ -45,13 +45,22 @@ public: INLINE bool has_name() const; INLINE const string &get_name() const; + INLINE int get_num_alt_names() const; + INLINE const string &get_alt_name(int n) const; + void output(ostream &out) const; void input(istream &in); +protected: + static string _empty_string; + private: InterrogateModuleDef *_def; string _name; + typedef vector Strings; + Strings _alt_names; + friend class InterrogateBuilder; friend class FunctionRemap; }; diff --git a/dtool/src/interrogatedb/interrogateType.cxx b/dtool/src/interrogatedb/interrogateType.cxx index 53b056e4a7..2e31feb884 100644 --- a/dtool/src/interrogatedb/interrogateType.cxx +++ b/dtool/src/interrogatedb/interrogateType.cxx @@ -18,10 +18,6 @@ #include -// This static string is just kept around as a handy bogus return -// value for functions that must return a const string reference. -string InterrogateType::_empty_string; - //////////////////////////////////////////////////////////////////// // Function: InterrogateType::Constructor // Access: Public diff --git a/dtool/src/interrogatedb/interrogateType.h b/dtool/src/interrogatedb/interrogateType.h index 1d1c5df797..a96f6e7d37 100644 --- a/dtool/src/interrogatedb/interrogateType.h +++ b/dtool/src/interrogatedb/interrogateType.h @@ -199,8 +199,6 @@ private: typedef vector Types; Types _nested_types; - static string _empty_string; - public: // The rest of the members in this class aren't part of the public // interface to interrogate, but are used internally as the diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index e6fa8ebb48..e8239bb7a8 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -1370,6 +1370,7 @@ DTOOL_CONFIG=[ ("USE_DEBUG_PYTHON", 'UNDEF', 'UNDEF'), ("PYTHON_FRAMEWORK", 'UNDEF', 'UNDEF'), ("COMPILE_IN_DEFAULT_FONT", '1', '1'), + ("STDFLOAT_DOUBLE", 'UNDEF', 'UNDEF'), ("HAVE_MAYA", '1', '1'), ("MAYA_PRE_5_0", 'UNDEF', 'UNDEF'), ("HAVE_SOFTIMAGE", 'UNDEF', 'UNDEF'), diff --git a/panda/src/bullet/bulletDebugNode.cxx b/panda/src/bullet/bulletDebugNode.cxx index 91bc463475..f8c88fc414 100644 --- a/panda/src/bullet/bulletDebugNode.cxx +++ b/panda/src/bullet/bulletDebugNode.cxx @@ -313,7 +313,7 @@ drawLine(const btVector3 &from, const btVector3 &to, const btVector3 &color) { line._p0 = LVecBase3f(from.getX(), from.getY(), from.getZ()); line._p1 = LVecBase3f(to.getX(), to.getY(), to.getZ()); - line._color = Colorf(r, g, b, 1.0f); + line._color = LColorf(r, g, b, 1.0f); _lines.push_back(line); } @@ -335,7 +335,7 @@ drawTriangle(const btVector3 &v0, const btVector3 &v1, const btVector3 &v2, cons tri._p0 = LVecBase3f(v0.getX(), v0.getY(), v0.getZ()); tri._p1 = LVecBase3f(v1.getX(), v1.getY(), v1.getZ()); tri._p2 = LVecBase3f(v2.getX(), v2.getY(), v2.getZ()); - tri._color = Colorf(r, g, b, 1.0f); + tri._color = LColorf(r, g, b, 1.0f); _triangles.push_back(tri); diff --git a/panda/src/bullet/bulletDebugNode.h b/panda/src/bullet/bulletDebugNode.h index 47944d85ba..7d46f6e41f 100644 --- a/panda/src/bullet/bulletDebugNode.h +++ b/panda/src/bullet/bulletDebugNode.h @@ -56,14 +56,14 @@ private: struct Line { LVecBase3f _p0; LVecBase3f _p1; - Colorf _color; + LColorf _color; }; struct Triangle { LVecBase3f _p0; LVecBase3f _p1; LVecBase3f _p2; - Colorf _color; + LColorf _color; }; class DebugDraw : public btIDebugDraw { diff --git a/panda/src/egg/eggAttributes.I b/panda/src/egg/eggAttributes.I index 29f0bea697..fdb7e1e9c9 100644 --- a/panda/src/egg/eggAttributes.I +++ b/panda/src/egg/eggAttributes.I @@ -28,7 +28,7 @@ has_normal() const { // Access: Published // Description: //////////////////////////////////////////////////////////////////// -INLINE const Normald &EggAttributes:: +INLINE const LNormald &EggAttributes:: get_normal() const { nassertr(has_normal(), _normal); return _normal; @@ -40,7 +40,7 @@ get_normal() const { // Description: //////////////////////////////////////////////////////////////////// INLINE void EggAttributes:: -set_normal(const Normald &normal) { +set_normal(const LNormald &normal) { _normal = normal; _flags |= F_has_normal; } diff --git a/panda/src/egg/eggAttributes.h b/panda/src/egg/eggAttributes.h index 9aaa994242..d126392613 100644 --- a/panda/src/egg/eggAttributes.h +++ b/panda/src/egg/eggAttributes.h @@ -42,8 +42,8 @@ PUBLISHED: virtual ~EggAttributes(); INLINE bool has_normal() const; - INLINE const Normald &get_normal() const; - INLINE void set_normal(const Normald &normal); + INLINE const LNormald &get_normal() const; + INLINE void set_normal(const LNormald &normal); INLINE void clear_normal(); INLINE bool matches_normal(const EggAttributes &other) const; INLINE void copy_normal(const EggAttributes &other); @@ -71,7 +71,7 @@ private: }; int _flags; - Normald _normal; + LNormald _normal; LColor _color; diff --git a/panda/src/egg/eggGroupNode.cxx b/panda/src/egg/eggGroupNode.cxx index 82d6ced475..6d86e2cd85 100644 --- a/panda/src/egg/eggGroupNode.cxx +++ b/panda/src/egg/eggGroupNode.cxx @@ -1877,7 +1877,7 @@ do_compute_vertex_normals(const NVertexGroup &group) { // Determine the common normal. This is simply the average of all // the polygon normals that share this vertex. - Normald normal(0.0, 0.0, 0.0); + LNormald normal(0.0, 0.0, 0.0); NVertexGroup::const_iterator gi; for (gi = group.begin(); gi != group.end(); ++gi) { const NVertexReference &ref = (*gi); @@ -1959,9 +1959,9 @@ r_collect_tangent_binormal(const GlobPattern &uv_name, LPoint3d p2 = v2->get_pos3(); LPoint3d p3 = v3->get_pos3(); - TexCoordd w1 = v1->get_uv(name); - TexCoordd w2 = v2->get_uv(name); - TexCoordd w3 = v3->get_uv(name); + LTexCoordd w1 = v1->get_uv(name); + LTexCoordd w2 = v2->get_uv(name); + LTexCoordd w3 = v3->get_uv(name); // Check the facing of the texture; we will have to // split vertices whose UV's are mirrored along a seam. @@ -2033,8 +2033,8 @@ do_compute_tangent_binormal(const TBNVertexValue &value, // Accumulate together all of the s vectors and t vectors computed // for the different vertices that are together here. - Normald sdir(0.0, 0.0, 0.0); - Normald tdir(0.0, 0.0, 0.0); + LNormald sdir(0.0, 0.0, 0.0); + LNormald tdir(0.0, 0.0, 0.0); TBNVertexGroup::const_iterator gi; for (gi = group.begin(); gi != group.end(); ++gi) { @@ -2051,13 +2051,13 @@ do_compute_tangent_binormal(const TBNVertexValue &value, sdir.set(1.0, 0.0, 0.0); } if (!tdir.normalize()) { - tdir = sdir.cross(Normald(0.0, 0.0, -1.0)); + tdir = sdir.cross(LNormald(0.0, 0.0, -1.0)); } - Normald tangent = (sdir - value._normal * value._normal.dot(sdir)); + LNormald tangent = (sdir - value._normal * value._normal.dot(sdir)); tangent.normalize(); - Normald binormal = cross(value._normal, tangent); + LNormald binormal = cross(value._normal, tangent); if (dot(binormal, tdir) < 0.0f) { binormal = -binormal; } diff --git a/panda/src/egg/eggGroupNode.h b/panda/src/egg/eggGroupNode.h index b8b2ea30cd..7e6bc358f9 100644 --- a/panda/src/egg/eggGroupNode.h +++ b/panda/src/egg/eggGroupNode.h @@ -199,11 +199,11 @@ private: class NVertexReference { public: EggPolygon *_polygon; - Normald _normal; + LNormald _normal; size_t _vertex; }; typedef pvector NVertexGroup; - typedef pmap NVertexCollection; + typedef pmap NVertexCollection; void r_collect_vertex_normals(NVertexCollection &collection, double threshold, CoordinateSystem cs); @@ -220,10 +220,10 @@ private: class TBNVertexValue { public: INLINE bool operator < (const TBNVertexValue &other) const; - Vertexd _pos; - Normald _normal; + LVertexd _pos; + LNormald _normal; string _uv_name; - TexCoordd _uv; + LTexCoordd _uv; bool _facing; }; typedef pvector TBNVertexGroup; diff --git a/panda/src/egg/eggMesherStrip.cxx b/panda/src/egg/eggMesherStrip.cxx index 85b42f49a8..5d82ec0b14 100644 --- a/panda/src/egg/eggMesherStrip.cxx +++ b/panda/src/egg/eggMesherStrip.cxx @@ -822,7 +822,7 @@ convex_quad(EggMesherEdge *common_edge, EggMesherStrip &front, nassertr(front._planar, false); - const Normald &n = front._plane_normal; + const LNormald &n = front._plane_normal; int xi, yi; // Find the largest dimension of the normal. diff --git a/panda/src/egg/eggMesherStrip.h b/panda/src/egg/eggMesherStrip.h index 9c20b0d514..366be0d23a 100644 --- a/panda/src/egg/eggMesherStrip.h +++ b/panda/src/egg/eggMesherStrip.h @@ -140,7 +140,7 @@ public: MesherStatus _status; bool _planar; - Normald _plane_normal; + LNormald _plane_normal; PN_stdfloat _plane_offset; int _row_id, _row_distance; MesherOrigin _origin; diff --git a/panda/src/egg/eggPolygon.I b/panda/src/egg/eggPolygon.I index b1b20feae9..9311ebb694 100644 --- a/panda/src/egg/eggPolygon.I +++ b/panda/src/egg/eggPolygon.I @@ -52,7 +52,7 @@ operator = (const EggPolygon ©) { //////////////////////////////////////////////////////////////////// INLINE bool EggPolygon:: recompute_polygon_normal(CoordinateSystem cs) { - Normald normal; + LNormald normal; if (calculate_normal(normal, cs)) { set_normal(normal); return true; diff --git a/panda/src/egg/eggPolygon.cxx b/panda/src/egg/eggPolygon.cxx index 9f308fcbad..0cd24a9151 100644 --- a/panda/src/egg/eggPolygon.cxx +++ b/panda/src/egg/eggPolygon.cxx @@ -37,7 +37,7 @@ cleanup() { remove_doubled_verts(true); // Use calculate_normal() to determine if the polygon is degenerate. - Normald normal; + LNormald normal; return calculate_normal(normal); } @@ -54,8 +54,8 @@ cleanup() { // does not have at least three noncollinear vertices. //////////////////////////////////////////////////////////////////// bool EggPolygon:: -calculate_normal(Normald &result, CoordinateSystem cs) const { - result = Normald::zero(); +calculate_normal(LNormald &result, CoordinateSystem cs) const { + result = LNormald::zero(); // Project the polygon into each of the three major planes and // calculate the area of each 2-d projection. This becomes the @@ -64,8 +64,8 @@ calculate_normal(Normald &result, CoordinateSystem cs) const { // tilted toward each plane. size_t num_verts = size(); for (size_t i = 0; i < num_verts; i++) { - Vertexd p0 = get_vertex(i)->get_pos3(); - Vertexd p1 = get_vertex((i + 1) % num_verts)->get_pos3(); + LVertexd p0 = get_vertex(i)->get_pos3(); + LVertexd p1 = get_vertex((i + 1) % num_verts)->get_pos3(); result[0] += p0[1] * p1[2] - p0[2] * p1[1]; result[1] += p0[2] * p1[0] - p0[0] * p1[2]; result[2] += p0[0] * p1[1] - p0[1] * p1[0]; @@ -100,7 +100,7 @@ is_planar() const { return true; } - Normald normal; + LNormald normal; if (!calculate_normal(normal)) { // A degenerate polygon--all of the vertices are within one line, // or all in the same point--is technically planar. Not sure if @@ -116,7 +116,7 @@ is_planar() const { // the first vertex. const_iterator vi = begin(); LVecBase3d first_point = (*vi)->get_pos3(); - Planed plane(normal, first_point); + LPlaned plane(normal, first_point); // And check that all of the remaining vertices are sufficiently // close to the plane. diff --git a/panda/src/egg/eggPolygon.h b/panda/src/egg/eggPolygon.h index e94e80c704..0078abfea6 100644 --- a/panda/src/egg/eggPolygon.h +++ b/panda/src/egg/eggPolygon.h @@ -31,7 +31,7 @@ PUBLISHED: virtual bool cleanup(); - bool calculate_normal(Normald &result, CoordinateSystem cs = CS_default) const; + bool calculate_normal(LNormald &result, CoordinateSystem cs = CS_default) const; bool is_planar() const; INLINE bool recompute_polygon_normal(CoordinateSystem cs = CS_default); diff --git a/panda/src/egg/eggPrimitive.cxx b/panda/src/egg/eggPrimitive.cxx index 045f11ff54..c2ce28e378 100644 --- a/panda/src/egg/eggPrimitive.cxx +++ b/panda/src/egg/eggPrimitive.cxx @@ -1104,11 +1104,11 @@ r_apply_texmats(EggTextureCollection &textures) { if (uv_obj != (EggVertexUV *)NULL) { EggVertex new_vertex(*vertex); PT(EggVertexUV) new_uv_obj = new EggVertexUV(*uv_obj); - TexCoord3d uvw = uv_obj->get_uvw() * mat; + LTexCoord3d uvw = uv_obj->get_uvw() * mat; if (uv_obj->has_w() || texture->has_transform3d()) { new_uv_obj->set_uvw(uvw); } else { - new_uv_obj->set_uv(TexCoordd(uvw[0], uvw[1])); + new_uv_obj->set_uv(LTexCoordd(uvw[0], uvw[1])); } new_vertex.set_uv_obj(new_uv_obj); diff --git a/panda/src/egg/eggVertex.I b/panda/src/egg/eggVertex.I index 4dd6753d8d..24327e6197 100644 --- a/panda/src/egg/eggVertex.I +++ b/panda/src/egg/eggVertex.I @@ -156,11 +156,11 @@ get_pos2() const { // Description: Valid if get_num_dimensions() returns 3 or 4. // Returns the position as a three-dimensional value. //////////////////////////////////////////////////////////////////// -INLINE Vertexd EggVertex:: +INLINE LVertexd EggVertex:: get_pos3() const { nassertr(_num_dimensions == 3 || _num_dimensions == 4, LPoint3d(0.0, 0.0, 0.0)); - return Vertexd(_pos[0] / _pos[3], _pos[1] / _pos[3], _pos[2] / _pos[3]); + return LVertexd(_pos[0] / _pos[3], _pos[1] / _pos[3], _pos[2] / _pos[3]); } @@ -207,9 +207,9 @@ has_uv() const { // multitexturing; see get_uv(name) for the interface // that supports multitexturing. //////////////////////////////////////////////////////////////////// -INLINE TexCoordd EggVertex:: +INLINE LTexCoordd EggVertex:: get_uv() const { - nassertr(has_uv(), TexCoordd::zero()); + nassertr(has_uv(), LTexCoordd::zero()); return get_uv(""); } @@ -225,7 +225,7 @@ get_uv() const { // interface that supports multitexturing. //////////////////////////////////////////////////////////////////// INLINE void EggVertex:: -set_uv(const TexCoordd &uv) { +set_uv(const LTexCoordd &uv) { set_uv("", uv); } diff --git a/panda/src/egg/eggVertex.cxx b/panda/src/egg/eggVertex.cxx index 9a95dddb8a..fe0937c1e9 100644 --- a/panda/src/egg/eggVertex.cxx +++ b/panda/src/egg/eggVertex.cxx @@ -150,10 +150,10 @@ has_uvw(const string &name) const { // vertex. It is an error to call this if has_uv(name) // returned false. //////////////////////////////////////////////////////////////////// -TexCoordd EggVertex:: +LTexCoordd EggVertex:: get_uv(const string &name) const { UVMap::const_iterator ui = _uv_map.find(EggVertexUV::filter_name(name)); - nassertr(ui != _uv_map.end(), TexCoordd::zero()); + nassertr(ui != _uv_map.end(), LTexCoordd::zero()); return (*ui).second->get_uv(); } @@ -164,10 +164,10 @@ get_uv(const string &name) const { // vertex. It is an error to call this if has_uvw(name) // returned false. //////////////////////////////////////////////////////////////////// -const TexCoord3d &EggVertex:: +const LTexCoord3d &EggVertex:: get_uvw(const string &name) const { UVMap::const_iterator ui = _uv_map.find(EggVertexUV::filter_name(name)); - nassertr(ui != _uv_map.end(), TexCoord3d::zero()); + nassertr(ui != _uv_map.end(), LTexCoord3d::zero()); return (*ui).second->get_uvw(); } @@ -179,7 +179,7 @@ get_uvw(const string &name) const { // name already on the vertex, but preserves UV morphs. //////////////////////////////////////////////////////////////////// void EggVertex:: -set_uv(const string &name, const TexCoordd &uv) { +set_uv(const string &name, const LTexCoordd &uv) { string fname = EggVertexUV::filter_name(name); PT(EggVertexUV) &uv_obj = _uv_map[fname]; @@ -202,7 +202,7 @@ set_uv(const string &name, const TexCoordd &uv) { // morphs. //////////////////////////////////////////////////////////////////// void EggVertex:: -set_uvw(const string &name, const TexCoord3d &uvw) { +set_uvw(const string &name, const LTexCoord3d &uvw) { string fname = EggVertexUV::filter_name(name); PT(EggVertexUV) &uv_obj = _uv_map[fname]; diff --git a/panda/src/egg/eggVertex.h b/panda/src/egg/eggVertex.h index 0cefb0a1b3..ba1386a530 100644 --- a/panda/src/egg/eggVertex.h +++ b/panda/src/egg/eggVertex.h @@ -74,19 +74,19 @@ PUBLISHED: INLINE int get_num_dimensions() const; INLINE double get_pos1() const; INLINE LPoint2d get_pos2() const; - INLINE Vertexd get_pos3() const; + INLINE LVertexd get_pos3() const; INLINE LPoint4d get_pos4() const; INLINE bool has_uv() const; - INLINE TexCoordd get_uv() const; - INLINE void set_uv(const TexCoordd &texCoord); + INLINE LTexCoordd get_uv() const; + INLINE void set_uv(const LTexCoordd &texCoord); INLINE void clear_uv(); bool has_uv(const string &name) const; bool has_uvw(const string &name) const; - TexCoordd get_uv(const string &name) const; - const TexCoord3d &get_uvw(const string &name) const; - void set_uv(const string &name, const TexCoordd &texCoord); - void set_uvw(const string &name, const TexCoord3d &texCoord); + LTexCoordd get_uv(const string &name) const; + const LTexCoord3d &get_uvw(const string &name) const; + void set_uv(const string &name, const LTexCoordd &texCoord); + void set_uvw(const string &name, const LTexCoord3d &texCoord); const EggVertexUV *get_uv_obj(const string &name) const; EggVertexUV *modify_uv_obj(const string &name); void set_uv_obj(EggVertexUV *vertex_uv); diff --git a/panda/src/egg/eggVertexUV.I b/panda/src/egg/eggVertexUV.I index 4f60610f4e..a49de4a36c 100755 --- a/panda/src/egg/eggVertexUV.I +++ b/panda/src/egg/eggVertexUV.I @@ -70,10 +70,10 @@ has_w() const { // Description: Returns the texture coordinate pair, if // get_num_dimensions() is 2. //////////////////////////////////////////////////////////////////// -INLINE TexCoordd EggVertexUV:: +INLINE LTexCoordd EggVertexUV:: get_uv() const { - nassertr(!has_w(), TexCoordd::zero()); - return TexCoordd(_uvw[0], _uvw[1]); + nassertr(!has_w(), LTexCoordd::zero()); + return LTexCoordd(_uvw[0], _uvw[1]); } //////////////////////////////////////////////////////////////////// @@ -84,7 +84,7 @@ get_uv() const { // call if get_num_dimensions() is 2 (but the last // dimension will be zero). //////////////////////////////////////////////////////////////////// -INLINE const TexCoord3d &EggVertexUV:: +INLINE const LTexCoord3d &EggVertexUV:: get_uvw() const { return _uvw; } @@ -97,7 +97,7 @@ get_uvw() const { // the usual case. //////////////////////////////////////////////////////////////////// INLINE void EggVertexUV:: -set_uv(const TexCoordd &uv) { +set_uv(const LTexCoordd &uv) { _uvw.set(uv[0], uv[1], 0.0); _flags &= ~F_has_w; } @@ -109,7 +109,7 @@ set_uv(const TexCoordd &uv) { // texture coordinate a 3-d texture coordinate. //////////////////////////////////////////////////////////////////// INLINE void EggVertexUV:: -set_uvw(const TexCoord3d &uvw) { +set_uvw(const LTexCoord3d &uvw) { _uvw = uvw; _flags |= F_has_w; } @@ -129,7 +129,7 @@ has_tangent() const { // Access: Published // Description: //////////////////////////////////////////////////////////////////// -INLINE const Normald &EggVertexUV:: +INLINE const LNormald &EggVertexUV:: get_tangent() const { nassertr(has_tangent(), _tangent); return _tangent; @@ -141,7 +141,7 @@ get_tangent() const { // Description: //////////////////////////////////////////////////////////////////// INLINE void EggVertexUV:: -set_tangent(const Normald &tangent) { +set_tangent(const LNormald &tangent) { _tangent = tangent; _flags |= F_has_tangent; } @@ -171,7 +171,7 @@ has_binormal() const { // Access: Published // Description: //////////////////////////////////////////////////////////////////// -INLINE const Normald &EggVertexUV:: +INLINE const LNormald &EggVertexUV:: get_binormal() const { nassertr(has_binormal(), _binormal); return _binormal; @@ -183,7 +183,7 @@ get_binormal() const { // Description: //////////////////////////////////////////////////////////////////// INLINE void EggVertexUV:: -set_binormal(const Normald &binormal) { +set_binormal(const LNormald &binormal) { _binormal = binormal; _flags |= F_has_binormal; } diff --git a/panda/src/egg/eggVertexUV.cxx b/panda/src/egg/eggVertexUV.cxx index 3c1d10be3e..387ba33f13 100755 --- a/panda/src/egg/eggVertexUV.cxx +++ b/panda/src/egg/eggVertexUV.cxx @@ -25,7 +25,7 @@ TypeHandle EggVertexUV::_type_handle; // Description: //////////////////////////////////////////////////////////////////// EggVertexUV:: -EggVertexUV(const string &name, const TexCoordd &uv) : +EggVertexUV(const string &name, const LTexCoordd &uv) : EggNamedObject(name), _flags(0), _uvw(uv[0], uv[1], 0.0) @@ -41,7 +41,7 @@ EggVertexUV(const string &name, const TexCoordd &uv) : // Description: //////////////////////////////////////////////////////////////////// EggVertexUV:: -EggVertexUV(const string &name, const TexCoord3d &uvw) : +EggVertexUV(const string &name, const LTexCoord3d &uvw) : EggNamedObject(name), _flags(F_has_w), _uvw(uvw) diff --git a/panda/src/egg/eggVertexUV.h b/panda/src/egg/eggVertexUV.h index eceff95555..ddb6cc3576 100755 --- a/panda/src/egg/eggVertexUV.h +++ b/panda/src/egg/eggVertexUV.h @@ -31,8 +31,8 @@ //////////////////////////////////////////////////////////////////// class EXPCL_PANDAEGG EggVertexUV : public EggNamedObject { PUBLISHED: - EggVertexUV(const string &name, const TexCoordd &uv); - EggVertexUV(const string &name, const TexCoord3d &uvw); + EggVertexUV(const string &name, const LTexCoordd &uv); + EggVertexUV(const string &name, const LTexCoord3d &uvw); EggVertexUV(const EggVertexUV ©); EggVertexUV &operator = (const EggVertexUV ©); virtual ~EggVertexUV(); @@ -42,19 +42,19 @@ PUBLISHED: INLINE int get_num_dimensions() const; INLINE bool has_w() const; - INLINE TexCoordd get_uv() const; - INLINE const TexCoord3d &get_uvw() const; - INLINE void set_uv(const TexCoordd &texCoord); - INLINE void set_uvw(const TexCoord3d &texCoord); + INLINE LTexCoordd get_uv() const; + INLINE const LTexCoord3d &get_uvw() const; + INLINE void set_uv(const LTexCoordd &texCoord); + INLINE void set_uvw(const LTexCoord3d &texCoord); INLINE bool has_tangent() const; - INLINE const Normald &get_tangent() const; - INLINE void set_tangent(const Normald &tangent); + INLINE const LNormald &get_tangent() const; + INLINE void set_tangent(const LNormald &tangent); INLINE void clear_tangent(); INLINE bool has_binormal() const; - INLINE const Normald &get_binormal() const; - INLINE void set_binormal(const Normald &binormal); + INLINE const LNormald &get_binormal() const; + INLINE void set_binormal(const LNormald &binormal); INLINE void clear_binormal(); void transform(const LMatrix4d &mat); @@ -72,9 +72,9 @@ private: }; int _flags; - Normald _tangent; - Normald _binormal; - TexCoord3d _uvw; + LNormald _tangent; + LNormald _binormal; + LTexCoord3d _uvw; public: static TypeHandle get_class_type() { diff --git a/panda/src/egg/parser.yxx b/panda/src/egg/parser.yxx index 9808543101..a8eb016589 100644 --- a/panda/src/egg/parser.yxx +++ b/panda/src/egg/parser.yxx @@ -988,7 +988,7 @@ vertex_body: | vertex_body UV optional_name '{' { EggVertex *vertex = DCAST(EggVertex, egg_stack.back()); - EggVertexUV *uv = new EggVertexUV($3, TexCoordd::zero()); + EggVertexUV *uv = new EggVertexUV($3, LTexCoordd::zero()); egg_stack.push_back(uv); if (vertex->has_uv($3)) { eggyywarning("Ignoring repeated UV name " + $3); @@ -1031,7 +1031,7 @@ vertex_body: vertex_uv_body: real real { - DCAST(EggVertexUV, egg_stack.back())->set_uv(TexCoordd($1, $2)); + DCAST(EggVertexUV, egg_stack.back())->set_uv(LTexCoordd($1, $2)); } | real real real { @@ -1042,7 +1042,7 @@ vertex_uv_body: if (DCAST(EggVertexUV, egg_stack.back())->has_tangent()) { eggyywarning("Ignoring repeated tangent"); } else { - DCAST(EggVertexUV, egg_stack.back())->set_tangent(Normald($4, $5, $6)); + DCAST(EggVertexUV, egg_stack.back())->set_tangent(LNormald($4, $5, $6)); } } | vertex_uv_body BINORMAL '{' real real real '}' @@ -1050,7 +1050,7 @@ vertex_uv_body: if (DCAST(EggVertexUV, egg_stack.back())->has_binormal()) { eggyywarning("Ignoring repeated binormal"); } else { - DCAST(EggVertexUV, egg_stack.back())->set_binormal(Normald($4, $5, $6)); + DCAST(EggVertexUV, egg_stack.back())->set_binormal(LNormald($4, $5, $6)); } } | vertex_uv_body DUV string '{' real real '}' @@ -1097,7 +1097,7 @@ vertex_uv_body: vertex_normal_body: real real real { - DCAST(EggVertex, egg_stack.back())->set_normal(Normald($1, $2, $3)); + DCAST(EggVertex, egg_stack.back())->set_normal(LNormald($1, $2, $3)); } | vertex_normal_body DNORMAL string '{' real real real '}' { @@ -2299,7 +2299,7 @@ primitive_material_body: primitive_normal_body: real real real { - DCAST(EggPrimitive, egg_stack.back())->set_normal(Normald($1, $2, $3)); + DCAST(EggPrimitive, egg_stack.back())->set_normal(LNormald($1, $2, $3)); } | primitive_normal_body DNORMAL string '{' real real real '}' { diff --git a/panda/src/egg2pg/eggLoader.cxx b/panda/src/egg2pg/eggLoader.cxx index 838ccdacdd..eedb974cd9 100644 --- a/panda/src/egg2pg/eggLoader.cxx +++ b/panda/src/egg2pg/eggLoader.cxx @@ -2370,8 +2370,8 @@ make_vertex_data(const EggRenderState *render_state, if (vertex->has_normal()) { gvw.set_column(InternalName::get_normal()); - Normald orig_normal = vertex->get_normal(); - Normald transformed_normal = normalize(orig_normal * transform); + LNormald orig_normal = vertex->get_normal(); + LNormald transformed_normal = normalize(orig_normal * transform); gvw.add_data3d(transformed_normal); if (is_dynamic) { @@ -2381,8 +2381,8 @@ make_vertex_data(const EggRenderState *render_state, CPT(InternalName) delta_name = InternalName::get_morph(InternalName::get_normal(), morph.get_name()); gvw.set_column(delta_name); - Normald morphed_normal = orig_normal + morph.get_offset(); - Normald transformed_morphed_normal = normalize(morphed_normal * transform); + LNormald morphed_normal = orig_normal + morph.get_offset(); + LNormald transformed_morphed_normal = normalize(morphed_normal * transform); LVector3d delta = transformed_morphed_normal - transformed_normal; gvw.add_data3d(delta); } @@ -2408,8 +2408,8 @@ make_vertex_data(const EggRenderState *render_state, EggVertex::const_uv_iterator uvi; for (uvi = vertex->uv_begin(); uvi != vertex->uv_end(); ++uvi) { EggVertexUV *egg_uv = (*uvi); - TexCoord3d orig_uvw = egg_uv->get_uvw(); - TexCoord3d uvw = egg_uv->get_uvw(); + LTexCoord3d orig_uvw = egg_uv->get_uvw(); + LTexCoord3d uvw = egg_uv->get_uvw(); string name = egg_uv->get_name(); PT(InternalName) iname = InternalName::get_texcoord_name(name); @@ -2430,9 +2430,9 @@ make_vertex_data(const EggRenderState *render_state, CPT(InternalName) delta_name = InternalName::get_morph(iname, morph.get_name()); gvw.set_column(delta_name); - TexCoord3d duvw = morph.get_offset(); + LTexCoord3d duvw = morph.get_offset(); if (buv != render_state->_bake_in_uvs.end()) { - TexCoord3d new_uvw = orig_uvw + duvw; + LTexCoord3d new_uvw = orig_uvw + duvw; duvw = (new_uvw * (*buv).second->get_transform3d()) - uvw; } @@ -2623,7 +2623,7 @@ set_portal_polygon(EggGroup *egg_group, PortalNode *pnode) { EggPolygon::const_iterator vi; for (vi = poly->begin(); vi != poly->end(); ++vi) { - Vertexd vert = (*vi)->get_pos3() * mat; + LVertexd vert = (*vi)->get_pos3() * mat; pnode->add_vertex(LCAST(PN_stdfloat, vert)); } } @@ -3258,10 +3258,10 @@ create_collision_plane(EggPolygon *egg_poly, EggGroup *parent_group) { EggPolygon::const_iterator vi; vi = egg_poly->begin(); - Vertexd vert = (*vi)->get_pos3() * mat; + LVertexd vert = (*vi)->get_pos3() * mat; vertices.push_back(LCAST(PN_stdfloat, vert)); - Vertexd last_vert = vert; + LVertexd last_vert = vert; ++vi; while (vi != egg_poly->end()) { vert = (*vi)->get_pos3() * mat; @@ -3320,10 +3320,10 @@ create_collision_polygons(CollisionNode *cnode, EggPolygon *egg_poly, EggPolygon::const_iterator vi; vi = poly->begin(); - Vertexd vert = (*vi)->get_pos3() * mat; + LVertexd vert = (*vi)->get_pos3() * mat; vertices.push_back(LCAST(PN_stdfloat, vert)); - Vertexd last_vert = vert; + LVertexd last_vert = vert; ++vi; while (vi != poly->end()) { vert = (*vi)->get_pos3() * mat; diff --git a/panda/src/express/config_express.N b/panda/src/express/config_express.N index 4808137563..e4440cdffd 100644 --- a/panda/src/express/config_express.N +++ b/panda/src/express/config_express.N @@ -17,9 +17,6 @@ forcetype NeverFreeMemory forcetype IFileStream forcetype OFileStream forcetype FileStream -renametype IFileStream IFileStream -renametype OFileStream OFileStream -renametype FileStream FileStream forcetype IDecryptStream forcetype OEncryptStream @@ -56,17 +53,11 @@ forcetype IStreamWrapper forcetype OStreamWrapper forcetype StreamWrapper -forcetype PointerToArray -forcetype ConstPointerToArray -renametype PointerToArray PTAUchar -renametype ConstPointerToArray CPTAUchar - -forcetype PointerToArray -forcetype ConstPointerToArray -renametype PointerToArray PTAFloat -renametype ConstPointerToArray CPTAFloat - -forcetype PointerToArray -forcetype ConstPointerToArray -renametype PointerToArray PTAInt -renametype ConstPointerToArray CPTAInt +forcetype PTA_uchar +forcetype CPTA_uchar +forcetype PTA_float +forcetype CPTA_float +forcetype PTA_double +forcetype CPTA_double +forcetype PTA_int +forcetype CPTA_int diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.I b/panda/src/glstuff/glGraphicsStateGuardian_src.I index 59ae7bb6f6..6226a10a3a 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.I +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.I @@ -604,7 +604,7 @@ call_glFogfv(GLenum pname, const LColor &color) { #ifndef STDFLOAT_DOUBLE GLP(Fogfv)(pname, color.get_data()); #else // STDFLOAT_DOUBLE - Colorf fcolor = LCAST(float, color); + LColorf fcolor = LCAST(float, color); GLP(Fogfv)(pname, fcolor.get_data()); #endif // STDFLOAT_DOUBLE } @@ -620,7 +620,7 @@ call_glMaterialfv(GLenum face, GLenum pname, const LColor &color) { #ifndef STDFLOAT_DOUBLE GLP(Materialfv)(face, pname, color.get_data()); #else // STDFLOAT_DOUBLE - Colorf fcolor = LCAST(float, color); + LColorf fcolor = LCAST(float, color); GLP(Materialfv)(face, pname, fcolor.get_data()); #endif // STDFLOAT_DOUBLE } diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index cf4029f78b..7d4c368e51 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -7051,11 +7051,11 @@ bind_clip_plane(const NodePath &plane, int plane_id) { #ifndef OPENGLES_2 // OpenGL ES 2.0 doesn't support clip planes at all. #ifdef OPENGLES // OpenGL ES uses a single-precision call. - Planef single_plane(LCAST(single, xformed_plane)); + LPlanef single_plane(LCAST(single, xformed_plane)); GLP(ClipPlanef)(id, single_plane.get_data()); #else // Mainline OpenGL uses a double-precision call. - Planed double_plane(LCAST(double, xformed_plane)); + LPlaned double_plane(LCAST(double, xformed_plane)); GLP(ClipPlane)(id, double_plane.get_data()); #endif // OPENGLES #endif // OPENGLES_2 diff --git a/panda/src/linmath/Sources.pp b/panda/src/linmath/Sources.pp index 1ad60931b6..dd363c86b9 100644 --- a/panda/src/linmath/Sources.pp +++ b/panda/src/linmath/Sources.pp @@ -37,9 +37,7 @@ lvecBase2_ext.I lvecBase3_ext.I lvecBase4_ext.I \ lpoint2_ext.I lpoint3_ext.I lpoint4_ext.I \ lvector2_ext.I lvector3_ext.I lvector4_ext.I \ - mathNumbers.h mathNumbers.I vector_Colorf.h \ - vector_LPoint2f.h vector_Normalf.h \ - vector_TexCoordf.h vector_Vertexf.h + mathNumbers.h mathNumbers.I #define INCLUDED_SOURCES \ compose_matrix.cxx config_linmath.cxx coordinateSystem.cxx \ @@ -47,9 +45,7 @@ lorientation.cxx lpoint2.cxx \ lpoint3.cxx lpoint4.cxx lquaternion.cxx lrotation.cxx \ luse.cxx lvecBase2.cxx lvecBase3.cxx lvecBase4.cxx \ - lvector2.cxx lvector3.cxx lvector4.cxx mathNumbers.cxx \ - vector_Colorf.cxx vector_LPoint2f.cxx \ - vector_Normalf.cxx vector_Vertexf.cxx \ + lvector2.cxx lvector3.cxx lvector4.cxx mathNumbers.cxx #define INSTALL_HEADERS \ aa_luse.h \ @@ -70,9 +66,7 @@ lvecBase3_src.I lvecBase3_src.h lvecBase4.h lvecBase4_src.I \ lvecBase4_src.h lvector2.h lvector2_src.I lvector2_src.h \ lvector3.h lvector3_src.I lvector3_src.h lvector4.h lvector4_src.I \ - lvector4_src.h mathNumbers.h mathNumbers.I vector_Colorf.h \ - vector_LPoint2f.h vector_Normalf.h \ - vector_TexCoordf.h vector_Vertexf.h + lvector4_src.h mathNumbers.h mathNumbers.I #define IGATESCAN all diff --git a/panda/src/linmath/aa_luse.h b/panda/src/linmath/aa_luse.h index 771c19714c..d6450b3ebc 100644 --- a/panda/src/linmath/aa_luse.h +++ b/panda/src/linmath/aa_luse.h @@ -46,19 +46,48 @@ // Now we define some handy typedefs for these classes. -typedef LPoint3f Vertexf; -typedef LVector3f Normalf; -typedef LPoint2f TexCoordf; -typedef LPoint3f TexCoord3f; -typedef LVecBase4f Colorf; -typedef LVecBase3f RGBColorf; +typedef LPoint3f LVertexf; +typedef LVector3f LNormalf; +typedef LPoint2f LTexCoordf; +typedef LPoint3f LTexCoord3f; +typedef LVecBase4f LColorf; +typedef LVecBase3f LRGBColorf; -typedef LPoint3d Vertexd; -typedef LVector3d Normald; -typedef LPoint2d TexCoordd; -typedef LPoint3d TexCoord3d; -typedef LVecBase4d Colord; -typedef LVecBase3d RGBColord; +typedef LPoint3d LVertexd; +typedef LVector3d LNormald; +typedef LPoint2d LTexCoordd; +typedef LPoint3d LTexCoord3d; +typedef LVecBase4d LColord; +typedef LVecBase3d LRGBColord; + +// The following names are only for legacy Python code. These aren't +// real typedefs; they're just commands to interrogate. +#ifdef CPPPARSER +typedef LMatrix4f Mat4F; +typedef LMatrix3f Mat3F; +typedef LVecBase4f VBase4F; +typedef LVector4f Vec4F; +typedef LPoint4f Point4F; +typedef LVecBase3f VBase3F; +typedef LVector3f Vec3F; +typedef LPoint3f Point3F; +typedef LVecBase2f VBase2F; +typedef LVector2f Vec2F; +typedef LPoint2f Point2F; +typedef LQuaternionf QuatF; +typedef LMatrix4d Mat4D; +typedef LMatrix3d Mat3D; +typedef LVecBase4d VBase4D; +typedef LVector4d Vec4D; +typedef LPoint4d Point4D; +typedef LVecBase3d VBase3D; +typedef LVector3d Vec3D; +typedef LPoint3d Point3D; +typedef LVecBase2d VBase2D; +typedef LVector2d Vec2D; +typedef LPoint2d Point2D; +typedef LQuaterniond QuatD; +#endif // CPPPARSER // And finally, we define the unqualified "standard" float type, which // is based on the setting of STDFLOAT_DOUBLE. This is the type that @@ -83,12 +112,28 @@ typedef LOrientationf LOrientation; typedef LMatrix3f LMatrix3; typedef LMatrix4f LMatrix4; -typedef Vertexf LVertex; -typedef Normalf LNormal; -typedef TexCoordf LTexCoord; -typedef TexCoord3f LTexCoord3; -typedef Colorf LColor; -typedef RGBColorf LRGBColor; +typedef LVertexf LVertex; +typedef LNormalf LNormal; +typedef LTexCoordf LTexCoord; +typedef LTexCoord3f LTexCoord3; +typedef LColorf LColor; +typedef LRGBColorf LRGBColor; + +// Bogus typedefs for interrogate and legacy Python code. +#ifdef CPPPARSER +typedef LMatrix4f Mat4; +typedef LMatrix3f Mat3; +typedef LVecBase4f VBase4; +typedef LVector4f Vec4; +typedef LPoint4f Point4; +typedef LVecBase3f VBase3; +typedef LVector3f Vec3; +typedef LPoint3f Point3; +typedef LVecBase2f VBase2; +typedef LVector2f Vec2; +typedef LPoint2f Point2; +typedef LQuaternionf Quat; +#endif // CPPPARSER #else // STDFLOAT_DOUBLE // The specialty setting--double-precision floats. @@ -108,12 +153,28 @@ typedef LOrientationd LOrientation; typedef LMatrix3d LMatrix3; typedef LMatrix4d LMatrix4; -typedef Vertexd LVertex; -typedef Normald LNormal; -typedef TexCoordd LTexCoord; -typedef TexCoord3d LTexCoord3; -typedef Colord LColor; -typedef RGBColord LRGBColor; +typedef LVertexd LVertex; +typedef LNormald LNormal; +typedef LTexCoordd LTexCoord; +typedef LTexCoord3d LTexCoord3; +typedef LColord LColor; +typedef LRGBColord LRGBColor; + +// Bogus typedefs for interrogate and legacy Python code. +#ifdef CPPPARSER +typedef LMatrix4d Mat4; +typedef LMatrix3d Mat3; +typedef LVecBase4d VBase4; +typedef LVector4d Vec4; +typedef LPoint4d Point4; +typedef LVecBase3d VBase3; +typedef LVector3d Vec3; +typedef LPoint3d Point3; +typedef LVecBase2d VBase2; +typedef LVector2d Vec2; +typedef LPoint2d Point2; +typedef LQuaterniond Quat; +#endif // CPPPARSER #endif // STDFLOAT_DOUBLE diff --git a/panda/src/linmath/linmath_composite1.cxx b/panda/src/linmath/linmath_composite1.cxx index 041c2800fa..131e985afe 100644 --- a/panda/src/linmath/linmath_composite1.cxx +++ b/panda/src/linmath/linmath_composite1.cxx @@ -9,7 +9,3 @@ #include "lvector4.cxx" #include "luse.cxx" #include "mathNumbers.cxx" -#include "vector_Colorf.cxx" -#include "vector_LPoint2f.cxx" -#include "vector_Normalf.cxx" -#include "vector_Vertexf.cxx" diff --git a/panda/src/linmath/luse.N b/panda/src/linmath/luse.N index 55f572d7cf..7b82e0ac27 100644 --- a/panda/src/linmath/luse.N +++ b/panda/src/linmath/luse.N @@ -1,38 +1,4 @@ -renametype LPoint2f LPoint2f -renametype LPoint3f LPoint3f -renametype LPoint4f LPoint4f -renametype LPoint2d LPoint2d -renametype LPoint3d LPoint3d -renametype LPoint4d LPoint4d - -renametype LVecBase2f LVecBase2f -renametype LVecBase3f LVecBase3f -renametype LVecBase4f LVecBase4f -renametype LVecBase2d LVecBase2d -renametype LVecBase3d LVecBase3d -renametype LVecBase4d LVecBase4d - -renametype LVector2f LVector2f -renametype LVector3f LVector3f -renametype LVector4f LVector4f -renametype LVector2d LVector2d -renametype LVector3d LVector3d -renametype LVector4d LVector4d - -renametype LMatrix3f LMatrix3f -renametype LMatrix4f LMatrix4f -renametype LMatrix3d LMatrix3d -renametype LMatrix4d LMatrix4d - -renametype LQuaternionf LQuaternionf -renametype LRotationf LRotationf -renametype LOrientationf LOrientationf - -renametype LQuaterniond LQuaterniond -renametype LRotationd LRotationd -renametype LOrientationd LOrientationd - defconstruct LPoint2f new LPoint2f(0.0f) defconstruct LPoint3f new LPoint3f(0.0f) defconstruct LPoint4f new LPoint4f(0.0f) diff --git a/panda/src/linmath/test_math.cxx b/panda/src/linmath/test_math.cxx index 891bdc2bdb..d7d1e1cf50 100644 --- a/panda/src/linmath/test_math.cxx +++ b/panda/src/linmath/test_math.cxx @@ -97,9 +97,9 @@ int main(int argc, char *argv[]) { << "q * invert(y) is " << q * invert(y) << "\n" << "q * a is " << q * a << "\n"; - Normald v1(0,0,1), v2(1,1,1); - Vertexd p1(1,0,1), p2(1,2,3); - Colorf c1(1,1,1,1), c2(0,0,0,0); + LNormald v1(0,0,1), v2(1,1,1); + LVertexd p1(1,0,1), p2(1,2,3); + LColorf c1(1,1,1,1), c2(0,0,0,0); p2 = p2 - v1; diff --git a/panda/src/linmath/vector_Colorf.cxx b/panda/src/linmath/vector_Colorf.cxx deleted file mode 100644 index be97be5a75..0000000000 --- a/panda/src/linmath/vector_Colorf.cxx +++ /dev/null @@ -1,27 +0,0 @@ -// Filename: vector_Colorf.cxx -// Created by: drose (10May00) -// -//////////////////////////////////////////////////////////////////// -// -// PANDA 3D SOFTWARE -// Copyright (c) Carnegie Mellon University. All rights reserved. -// -// All use of this software is subject to the terms of the revised BSD -// license. You should have received a copy of this license along -// with this source code in a file named "LICENSE." -// -//////////////////////////////////////////////////////////////////// - -#include "vector_Colorf.h" - -#define EXPCL EXPCL_PANDA_LINMATH -#define EXPTP EXPTP_PANDA_LINMATH -#define TYPE Colorf -#define NAME vector_Colorf - -#include "vector_src.cxx" - -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma implementation -#endif diff --git a/panda/src/linmath/vector_Colorf.h b/panda/src/linmath/vector_Colorf.h deleted file mode 100644 index 6f6d11e5ff..0000000000 --- a/panda/src/linmath/vector_Colorf.h +++ /dev/null @@ -1,43 +0,0 @@ -// Filename: vector_Colorf.h -// Created by: drose (10May00) -// -//////////////////////////////////////////////////////////////////// -// -// PANDA 3D SOFTWARE -// Copyright (c) Carnegie Mellon University. All rights reserved. -// -// All use of this software is subject to the terms of the revised BSD -// license. You should have received a copy of this license along -// with this source code in a file named "LICENSE." -// -//////////////////////////////////////////////////////////////////// - -#ifndef VECTOR_COLORF_H -#define VECTOR_COLORF_H - -#include "pandabase.h" -#include "luse.h" -#include "pvector.h" - -//////////////////////////////////////////////////////////////////// -// Class : vector_Colorf -// Description : A vector of Colorfs. 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. -//////////////////////////////////////////////////////////////////// - -#define EXPCL EXPCL_PANDA_LINMATH -#define EXPTP EXPTP_PANDA_LINMATH -#define TYPE Colorf -#define NAME vector_Colorf - -#include "vector_src.h" - -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma interface -#endif - -#endif diff --git a/panda/src/linmath/vector_Normalf.cxx b/panda/src/linmath/vector_Normalf.cxx deleted file mode 100644 index f8926933a0..0000000000 --- a/panda/src/linmath/vector_Normalf.cxx +++ /dev/null @@ -1,27 +0,0 @@ -// Filename: vector_Normalf.cxx -// Created by: drose (10May00) -// -//////////////////////////////////////////////////////////////////// -// -// PANDA 3D SOFTWARE -// Copyright (c) Carnegie Mellon University. All rights reserved. -// -// All use of this software is subject to the terms of the revised BSD -// license. You should have received a copy of this license along -// with this source code in a file named "LICENSE." -// -//////////////////////////////////////////////////////////////////// - -#include "vector_Normalf.h" - -#define EXPCL EXPCL_PANDA_LINMATH -#define EXPTP EXPTP_PANDA_LINMATH -#define TYPE Normalf -#define NAME vector_Normalf - -#include "vector_src.cxx" - -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma implementation -#endif diff --git a/panda/src/linmath/vector_Normalf.h b/panda/src/linmath/vector_Normalf.h deleted file mode 100644 index 2933abfbb9..0000000000 --- a/panda/src/linmath/vector_Normalf.h +++ /dev/null @@ -1,43 +0,0 @@ -// Filename: vector_Normalf.h -// Created by: drose (10May00) -// -//////////////////////////////////////////////////////////////////// -// -// PANDA 3D SOFTWARE -// Copyright (c) Carnegie Mellon University. All rights reserved. -// -// All use of this software is subject to the terms of the revised BSD -// license. You should have received a copy of this license along -// with this source code in a file named "LICENSE." -// -//////////////////////////////////////////////////////////////////// - -#ifndef VECTOR_NORMALF_H -#define VECTOR_NORMALF_H - -#include "pandabase.h" -#include "luse.h" -#include "pvector.h" - -//////////////////////////////////////////////////////////////////// -// Class : vector_Normalf -// Description : A vector of Normalfs. 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. -//////////////////////////////////////////////////////////////////// - -#define EXPCL EXPCL_PANDA_LINMATH -#define EXPTP EXPTP_PANDA_LINMATH -#define TYPE Normalf -#define NAME vector_Normalf - -#include "vector_src.h" - -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma interface -#endif - -#endif diff --git a/panda/src/linmath/vector_TexCoordf.h b/panda/src/linmath/vector_TexCoordf.h deleted file mode 100644 index b7a83dd7e0..0000000000 --- a/panda/src/linmath/vector_TexCoordf.h +++ /dev/null @@ -1,28 +0,0 @@ -// Filename: vector_TexCoordf.h -// Created by: drose (11May00) -// -//////////////////////////////////////////////////////////////////// -// -// PANDA 3D SOFTWARE -// Copyright (c) Carnegie Mellon University. All rights reserved. -// -// All use of this software is subject to the terms of the revised BSD -// license. You should have received a copy of this license along -// with this source code in a file named "LICENSE." -// -//////////////////////////////////////////////////////////////////// - -#ifndef VECTOR_TEXCOORDF_H -#define VECTOR_TEXCOORDF_H - -#include "pandabase.h" -#include "vector_LPoint2f.h" - -//////////////////////////////////////////////////////////////////// -// Class : vector_TexCoordf -// Description : This is just another name for vector_LPoint2f. -//////////////////////////////////////////////////////////////////// - -typedef vector_LPoint2f vector_TexCoordf; - -#endif diff --git a/panda/src/linmath/vector_Vertexf.cxx b/panda/src/linmath/vector_Vertexf.cxx deleted file mode 100644 index 82541d5ec9..0000000000 --- a/panda/src/linmath/vector_Vertexf.cxx +++ /dev/null @@ -1,27 +0,0 @@ -// Filename: vector_Vertexf.cxx -// Created by: drose (10May00) -// -//////////////////////////////////////////////////////////////////// -// -// PANDA 3D SOFTWARE -// Copyright (c) Carnegie Mellon University. All rights reserved. -// -// All use of this software is subject to the terms of the revised BSD -// license. You should have received a copy of this license along -// with this source code in a file named "LICENSE." -// -//////////////////////////////////////////////////////////////////// - -#include "vector_Vertexf.h" - -#define EXPCL EXPCL_PANDA_LINMATH -#define EXPTP EXPTP_PANDA_LINMATH -#define TYPE Vertexf -#define NAME vector_Vertexf - -#include "vector_src.cxx" - -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma implementation -#endif diff --git a/panda/src/linmath/vector_Vertexf.h b/panda/src/linmath/vector_Vertexf.h deleted file mode 100644 index e0a6e86dbb..0000000000 --- a/panda/src/linmath/vector_Vertexf.h +++ /dev/null @@ -1,43 +0,0 @@ -// Filename: vector_Vertexf.h -// Created by: drose (10May00) -// -//////////////////////////////////////////////////////////////////// -// -// PANDA 3D SOFTWARE -// Copyright (c) Carnegie Mellon University. All rights reserved. -// -// All use of this software is subject to the terms of the revised BSD -// license. You should have received a copy of this license along -// with this source code in a file named "LICENSE." -// -//////////////////////////////////////////////////////////////////// - -#ifndef VECTOR_VERTEXF_H -#define VECTOR_VERTEXF_H - -#include "pandabase.h" -#include "luse.h" -#include "pvector.h" - -//////////////////////////////////////////////////////////////////// -// Class : vector_Vertexf -// Description : A vector of Vertexfs. 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. -//////////////////////////////////////////////////////////////////// - -#define EXPCL EXPCL_PANDA_LINMATH -#define EXPTP EXPTP_PANDA_LINMATH -#define TYPE Vertexf -#define NAME vector_Vertexf - -#include "vector_src.h" - -// Tell GCC that we'll take care of the instantiation explicitly here. -#ifdef __GNUC__ -#pragma interface -#endif - -#endif diff --git a/panda/src/mathutil/boundingHexahedron.cxx b/panda/src/mathutil/boundingHexahedron.cxx index cc2ef03e70..3a8ab4e086 100644 --- a/panda/src/mathutil/boundingHexahedron.cxx +++ b/panda/src/mathutil/boundingHexahedron.cxx @@ -28,7 +28,7 @@ TypeHandle BoundingHexahedron::_type_handle; // Description: //////////////////////////////////////////////////////////////////// BoundingHexahedron:: -BoundingHexahedron(const Frustumf &frustum, bool is_ortho, +BoundingHexahedron(const LFrustum &frustum, bool is_ortho, CoordinateSystem cs) { if (cs == CS_default) { cs = get_default_coordinate_system(); diff --git a/panda/src/mathutil/boundingHexahedron.h b/panda/src/mathutil/boundingHexahedron.h index 034922e9ed..ebb5cceeca 100644 --- a/panda/src/mathutil/boundingHexahedron.h +++ b/panda/src/mathutil/boundingHexahedron.h @@ -38,7 +38,7 @@ public: INLINE_MATHUTIL BoundingHexahedron(); PUBLISHED: - BoundingHexahedron(const Frustumf &frustum, bool is_ortho, + BoundingHexahedron(const LFrustum &frustum, bool is_ortho, CoordinateSystem cs = CS_default); BoundingHexahedron(const LPoint3 &fll, const LPoint3 &flr, const LPoint3 &fur, const LPoint3 &ful, diff --git a/panda/src/mathutil/config_mathutil.N b/panda/src/mathutil/config_mathutil.N index 948b48af9e..cf652f3cf6 100644 --- a/panda/src/mathutil/config_mathutil.N +++ b/panda/src/mathutil/config_mathutil.N @@ -1,84 +1,53 @@ -forcetype Frustumf -renametype Frustumf Frustumf -forcetype Frustumd -renametype Frustumd Frustumd - noinclude frustum_src.h noinclude look_at_src.h -forcetype Planef -renametype Planef Planef -forcetype Planed -renametype Planed Planed - noinclude plane_src.h forcetype PointerToBase > forcetype PointerToArrayBase -forcetype PointerToArray -forcetype ConstPointerToArray -renametype PointerToArray PTAMat4f -renametype ConstPointerToArray CPTAMat4f +forcetype PTA_LMatrix4f +forcetype CPTA_LMatrix4f forcetype PointerToBase > forcetype PointerToArrayBase -forcetype PointerToArray -forcetype ConstPointerToArray -renametype PointerToArray PTAMat3f -renametype ConstPointerToArray CPTAMat3f +forcetype PTA_LMatrix3f +forcetype CPTA_LMatrix3f forcetype PointerToBase > forcetype PointerToArrayBase -forcetype PointerToArray -forcetype ConstPointerToArray -renametype PointerToArray PTAVecBase4f -renametype ConstPointerToArray PTAVecBase4f +forcetype PTA_LVecBase4f +forcetype CPTA_LVecBase4f forcetype PointerToBase > forcetype PointerToArrayBase -forcetype PointerToArray -forcetype ConstPointerToArray -renametype PointerToArray PTAVecBase3f -renametype ConstPointerToArray PTAVecBase3f +forcetype PTA_LVecBase3f +forcetype CPTA_LVecBase3f forcetype PointerToBase > forcetype PointerToArrayBase -forcetype PointerToArray -forcetype ConstPointerToArray -renametype PointerToArray PTAVecBase2f -renametype ConstPointerToArray PTAVecBase2f +forcetype PTA_LVecBase2f +forcetype CPTA_LVecBase2f forcetype PointerToBase > forcetype PointerToArrayBase -forcetype PointerToArray -forcetype ConstPointerToArray -renametype PointerToArray PTAMat4d -renametype ConstPointerToArray CPTAMat4d +forcetype PTA_LMatrix4d +forcetype CPTA_LMatrix4d forcetype PointerToBase > forcetype PointerToArrayBase -forcetype PointerToArray -forcetype ConstPointerToArray -renametype PointerToArray PTAMat3d -renametype ConstPointerToArray CPTAMat3d +forcetype PTA_LMatrix3d +forcetype CPTA_LMatrix3d forcetype PointerToBase > forcetype PointerToArrayBase -forcetype PointerToArray -forcetype ConstPointerToArray -renametype PointerToArray PTAVecBase4d -renametype ConstPointerToArray PTAVecBase4d +forcetype PTA_LVecBase4d +forcetype CPTA_LVecBase4d forcetype PointerToBase > forcetype PointerToArrayBase -forcetype PointerToArray -forcetype ConstPointerToArray -renametype PointerToArray PTAVecBase3d -renametype ConstPointerToArray PTAVecBase3d +forcetype PTA_LVecBase3d +forcetype CPTA_LVecBase3d forcetype PointerToBase > forcetype PointerToArrayBase -forcetype PointerToArray -forcetype ConstPointerToArray -renametype PointerToArray PTAVecBase2d -renametype ConstPointerToArray PTAVecBase2d - +forcetype PTA_LVecBase2d +forcetype CPTA_LVecBase2d diff --git a/panda/src/mathutil/frustum.h b/panda/src/mathutil/frustum.h index 3cab4f539d..7e0051ced2 100644 --- a/panda/src/mathutil/frustum.h +++ b/panda/src/mathutil/frustum.h @@ -29,9 +29,20 @@ #include "frustum_src.h" #ifndef STDFLOAT_DOUBLE -typedef Frustumf LFrustum; +typedef LFrustumf LFrustum; #else -typedef Frustumd LFrustum; +typedef LFrustumd LFrustum; #endif +// Bogus typedefs for interrogate and legacy Python code. +#ifdef CPPPARSER +typedef LFrustumf FrustumF; +typedef LFrustumd FrustumD; +#ifndef STDFLOAT_DOUBLE +typedef LFrustumf Frustum; +#else +typedef LFrustumd Frustum; +#endif +#endif // CPPPARSER + #endif diff --git a/panda/src/mathutil/frustum_src.I b/panda/src/mathutil/frustum_src.I index 50625235a6..be0bf11aee 100644 --- a/panda/src/mathutil/frustum_src.I +++ b/panda/src/mathutil/frustum_src.I @@ -17,8 +17,8 @@ // Access: // Description: //////////////////////////////////////////////////////////////////// -INLINE_MATHUTIL FLOATNAME(Frustum):: -FLOATNAME(Frustum)() { +INLINE_MATHUTIL FLOATNAME(LFrustum):: +FLOATNAME(LFrustum)() { _fnear = FLOATCONST(1.4142); _ffar = FLOATCONST(10.0); _l = -1.0f; @@ -32,7 +32,7 @@ FLOATNAME(Frustum)() { // Access: // Description: Sets up a two-dimensional orthographic frustum //////////////////////////////////////////////////////////////////// -INLINE_MATHUTIL void FLOATNAME(Frustum)::make_ortho_2D() { +INLINE_MATHUTIL void FLOATNAME(LFrustum)::make_ortho_2D() { make_ortho(-1.0f, 1.0f); } @@ -41,7 +41,7 @@ INLINE_MATHUTIL void FLOATNAME(Frustum)::make_ortho_2D() { // Access: // Description: Sets up a two-dimensional orthographic frustum //////////////////////////////////////////////////////////////////// -INLINE_MATHUTIL void FLOATNAME(Frustum):: +INLINE_MATHUTIL void FLOATNAME(LFrustum):: make_ortho_2D(FLOATTYPE l, FLOATTYPE r, FLOATTYPE t, FLOATTYPE b) { make_ortho(-1.0f, 1.0f, l, r, t, b); } @@ -51,7 +51,7 @@ make_ortho_2D(FLOATTYPE l, FLOATTYPE r, FLOATTYPE t, FLOATTYPE b) { // Access: // Description: Behaves like gluOrtho //////////////////////////////////////////////////////////////////// -INLINE_MATHUTIL void FLOATNAME(Frustum)::make_ortho(FLOATTYPE fnear, FLOATTYPE ffar) { +INLINE_MATHUTIL void FLOATNAME(LFrustum)::make_ortho(FLOATTYPE fnear, FLOATTYPE ffar) { _fnear = fnear; _ffar = ffar; _l = -1.0f; @@ -65,7 +65,7 @@ INLINE_MATHUTIL void FLOATNAME(Frustum)::make_ortho(FLOATTYPE fnear, FLOATTYPE f // Access: // Description: Behaves like gluOrtho //////////////////////////////////////////////////////////////////// -INLINE_MATHUTIL void FLOATNAME(Frustum):: +INLINE_MATHUTIL void FLOATNAME(LFrustum):: make_ortho(FLOATTYPE fnear, FLOATTYPE ffar, FLOATTYPE l, FLOATTYPE r, FLOATTYPE t, FLOATTYPE b) { _fnear = fnear; @@ -98,7 +98,7 @@ make_ortho(FLOATTYPE fnear, FLOATTYPE ffar, FLOATTYPE l, FLOATTYPE r, // W yfov // //////////////////////////////////////////////////////////////////// -INLINE_MATHUTIL void FLOATNAME(Frustum):: +INLINE_MATHUTIL void FLOATNAME(LFrustum):: make_perspective_hfov(FLOATTYPE hfov, FLOATTYPE aspect, FLOATTYPE fnear, FLOATTYPE ffar) { _fnear = fnear; @@ -110,7 +110,7 @@ make_perspective_hfov(FLOATTYPE hfov, FLOATTYPE aspect, FLOATTYPE fnear, } -INLINE_MATHUTIL void FLOATNAME(Frustum):: +INLINE_MATHUTIL void FLOATNAME(LFrustum):: make_perspective_vfov(FLOATTYPE yfov, FLOATTYPE aspect, FLOATTYPE fnear, FLOATTYPE ffar) { _fnear = fnear; @@ -122,7 +122,7 @@ make_perspective_vfov(FLOATTYPE yfov, FLOATTYPE aspect, FLOATTYPE fnear, } -INLINE_MATHUTIL void FLOATNAME(Frustum):: +INLINE_MATHUTIL void FLOATNAME(LFrustum):: make_perspective(FLOATTYPE xfov, FLOATTYPE yfov, FLOATTYPE fnear, FLOATTYPE ffar) { _fnear = fnear; @@ -138,7 +138,7 @@ make_perspective(FLOATTYPE xfov, FLOATTYPE yfov, FLOATTYPE fnear, // Access: // Description: //////////////////////////////////////////////////////////////////// -INLINE_MATHUTIL void FLOATNAME(Frustum):: +INLINE_MATHUTIL void FLOATNAME(LFrustum):: get_perspective_params(FLOATTYPE& yfov, FLOATTYPE& aspect, FLOATTYPE& fnear, FLOATTYPE& ffar) const { yfov = rad_2_deg(atan(_t / _fnear)) * 2.0f; @@ -152,7 +152,7 @@ get_perspective_params(FLOATTYPE& yfov, FLOATTYPE& aspect, // Access: // Description: //////////////////////////////////////////////////////////////////// -INLINE_MATHUTIL void FLOATNAME(Frustum):: +INLINE_MATHUTIL void FLOATNAME(LFrustum):: get_perspective_params(FLOATTYPE& xfov, FLOATTYPE& yfov, FLOATTYPE& aspect, FLOATTYPE& fnear, FLOATTYPE& ffar) const { xfov = rad_2_deg(atan(_r / _fnear)) * 2.0f; @@ -166,7 +166,7 @@ get_perspective_params(FLOATTYPE& xfov, FLOATTYPE& yfov, FLOATTYPE& aspect, // perspective transform defined by the frustum, // accordinate to the indicated coordinate system. //////////////////////////////////////////////////////////////////// -INLINE_MATHUTIL FLOATNAME(LMatrix4) FLOATNAME(Frustum):: +INLINE_MATHUTIL FLOATNAME(LMatrix4) FLOATNAME(LFrustum):: get_perspective_projection_mat(CoordinateSystem cs) const { if (cs == CS_default) { cs = get_default_coordinate_system(); @@ -228,7 +228,7 @@ get_perspective_projection_mat(CoordinateSystem cs) const { // orthographic transform defined by the frustum, // accordinate to the indicated coordinate system. //////////////////////////////////////////////////////////////////// -INLINE_MATHUTIL FLOATNAME(LMatrix4) FLOATNAME(Frustum):: +INLINE_MATHUTIL FLOATNAME(LMatrix4) FLOATNAME(LFrustum):: get_ortho_projection_mat(CoordinateSystem cs) const { if (cs == CS_default) { cs = get_default_coordinate_system(); diff --git a/panda/src/mathutil/frustum_src.h b/panda/src/mathutil/frustum_src.h index 543daed430..a8b12eceb8 100644 --- a/panda/src/mathutil/frustum_src.h +++ b/panda/src/mathutil/frustum_src.h @@ -13,12 +13,12 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Class : Frustum +// Class : LFrustum // Description : //////////////////////////////////////////////////////////////////// -class EXPCL_PANDA_MATHUTIL FLOATNAME(Frustum) { +class EXPCL_PANDA_MATHUTIL FLOATNAME(LFrustum) { PUBLISHED: - INLINE_MATHUTIL FLOATNAME(Frustum)(); + INLINE_MATHUTIL FLOATNAME(LFrustum)(); INLINE_MATHUTIL void make_ortho_2D(); INLINE_MATHUTIL void make_ortho_2D(FLOATTYPE l, FLOATTYPE r, FLOATTYPE t, FLOATTYPE b); diff --git a/panda/src/mathutil/parabola.h b/panda/src/mathutil/parabola.h index 09473fc810..60b8d379a7 100644 --- a/panda/src/mathutil/parabola.h +++ b/panda/src/mathutil/parabola.h @@ -27,9 +27,9 @@ #include "parabola_src.h" #ifndef STDFLOAT_DOUBLE -typedef Parabolaf LParabola; +typedef LParabolaf LParabola; #else -typedef Parabolad LParabola; +typedef LParabolad LParabola; #endif #endif diff --git a/panda/src/mathutil/parabola_src.I b/panda/src/mathutil/parabola_src.I index 89429419a4..7d2902f579 100644 --- a/panda/src/mathutil/parabola_src.I +++ b/panda/src/mathutil/parabola_src.I @@ -14,12 +14,12 @@ //////////////////////////////////////////////////////////////////// -// Function: Parabola::Default Constructor +// Function: LParabola::Default Constructor // Access: Published // Description: Constructs a meaningless degenerate parabola. //////////////////////////////////////////////////////////////////// -INLINE_MATHUTIL FLOATNAME(Parabola):: -FLOATNAME(Parabola)() : +INLINE_MATHUTIL FLOATNAME(LParabola):: +FLOATNAME(LParabola)() : _a(FLOATNAME(LVecBase3)::zero()), _b(FLOATNAME(LVecBase3)::zero()), _c(FLOATNAME(LVecBase3)::zero()) @@ -27,14 +27,14 @@ FLOATNAME(Parabola)() : } //////////////////////////////////////////////////////////////////// -// Function: Parabola::Constructor +// Function: LParabola::Constructor // Access: Published // Description: Constructs a parabola given the three points of the // parametric equation: the acceleration, initial // velocity, and start point. //////////////////////////////////////////////////////////////////// -INLINE_MATHUTIL FLOATNAME(Parabola):: -FLOATNAME(Parabola)(const FLOATNAME(LVecBase3) &a, +INLINE_MATHUTIL FLOATNAME(LParabola):: +FLOATNAME(LParabola)(const FLOATNAME(LVecBase3) &a, const FLOATNAME(LVecBase3) &b, const FLOATNAME(LVecBase3) &c) : _a(a), _b(b), _c(c) @@ -42,12 +42,12 @@ FLOATNAME(Parabola)(const FLOATNAME(LVecBase3) &a, } //////////////////////////////////////////////////////////////////// -// Function: Parabola::Copy Constructor +// Function: LParabola::Copy Constructor // Access: Published // Description: //////////////////////////////////////////////////////////////////// -INLINE_MATHUTIL FLOATNAME(Parabola):: -FLOATNAME(Parabola)(const FLOATNAME(Parabola) ©) : +INLINE_MATHUTIL FLOATNAME(LParabola):: +FLOATNAME(LParabola)(const FLOATNAME(LParabola) ©) : _a(copy._a), _b(copy._b), _c(copy._c) @@ -55,65 +55,65 @@ FLOATNAME(Parabola)(const FLOATNAME(Parabola) ©) : } //////////////////////////////////////////////////////////////////// -// Function: Parabola::Copy Assignment Operator +// Function: LParabola::Copy Assignment Operator // Access: Published // Description: //////////////////////////////////////////////////////////////////// -INLINE_MATHUTIL void FLOATNAME(Parabola):: -operator = (const FLOATNAME(Parabola) ©) { +INLINE_MATHUTIL void FLOATNAME(LParabola):: +operator = (const FLOATNAME(LParabola) ©) { _a = copy._a; _b = copy._b; _c = copy._c; } //////////////////////////////////////////////////////////////////// -// Function: Parabola::Destructor +// Function: LParabola::Destructor // Access: Published // Description: //////////////////////////////////////////////////////////////////// -INLINE_MATHUTIL FLOATNAME(Parabola):: -~FLOATNAME(Parabola)() { +INLINE_MATHUTIL FLOATNAME(LParabola):: +~FLOATNAME(LParabola)() { } //////////////////////////////////////////////////////////////////// -// Function: Parabola::get_a +// Function: LParabola::get_a // Access: Published // Description: Returns the first point of the parabola's parametric // equation: the acceleration. //////////////////////////////////////////////////////////////////// -INLINE_MATHUTIL const FLOATNAME(LVecBase3) &FLOATNAME(Parabola):: +INLINE_MATHUTIL const FLOATNAME(LVecBase3) &FLOATNAME(LParabola):: get_a() const { return _a; } //////////////////////////////////////////////////////////////////// -// Function: Parabola::get_b +// Function: LParabola::get_b // Access: Published // Description: Returns the second point of the parabola's parametric // equation: the initial velocity. //////////////////////////////////////////////////////////////////// -INLINE_MATHUTIL const FLOATNAME(LVecBase3) &FLOATNAME(Parabola):: +INLINE_MATHUTIL const FLOATNAME(LVecBase3) &FLOATNAME(LParabola):: get_b() const { return _b; } //////////////////////////////////////////////////////////////////// -// Function: Parabola::get_c +// Function: LParabola::get_c // Access: Published // Description: Returns the third point of the parabola's parametric // equation: the start point. //////////////////////////////////////////////////////////////////// -INLINE_MATHUTIL const FLOATNAME(LVecBase3) &FLOATNAME(Parabola):: +INLINE_MATHUTIL const FLOATNAME(LVecBase3) &FLOATNAME(LParabola):: get_c() const { return _c; } //////////////////////////////////////////////////////////////////// -// Function: Parabola::calc_point +// Function: LParabola::calc_point // Access: Published // Description: Computes the point on the parabola at time t. //////////////////////////////////////////////////////////////////// -INLINE_MATHUTIL FLOATNAME(LPoint3) FLOATNAME(Parabola):: +INLINE_MATHUTIL FLOATNAME(LPoint3) FLOATNAME(LParabola):: calc_point(FLOATTYPE t) const { return _a * t * t + _b * t + _c; } diff --git a/panda/src/mathutil/parabola_src.cxx b/panda/src/mathutil/parabola_src.cxx index dd1799c9ae..71ef15c266 100644 --- a/panda/src/mathutil/parabola_src.cxx +++ b/panda/src/mathutil/parabola_src.cxx @@ -14,11 +14,11 @@ //////////////////////////////////////////////////////////////////// -// Function: Parabola::xform +// Function: LParabola::xform // Access: Published // Description: Transforms the parabola by the indicated matrix. //////////////////////////////////////////////////////////////////// -void FLOATNAME(Parabola):: +void FLOATNAME(LParabola):: xform(const FLOATNAME(LMatrix4) &mat) { // Note that xform_vec() is the correct operation here, while // xform_vec_general() is not. @@ -28,31 +28,31 @@ xform(const FLOATNAME(LMatrix4) &mat) { } //////////////////////////////////////////////////////////////////// -// Function: Parabola::output +// Function: LParabola::output // Access: Published // Description: //////////////////////////////////////////////////////////////////// -void FLOATNAME(Parabola):: +void FLOATNAME(LParabola):: output(ostream &out) const { - out << "Parabola(" << _a << ", " << _b << ", " << _c << ")"; + out << "LParabola(" << _a << ", " << _b << ", " << _c << ")"; } //////////////////////////////////////////////////////////////////// -// Function: Parabola::write +// Function: LParabola::write // Access: Published // Description: //////////////////////////////////////////////////////////////////// -void FLOATNAME(Parabola):: +void FLOATNAME(LParabola):: write(ostream &out, int indent_level) const { indent(out, indent_level) << *this << "\n"; } //////////////////////////////////////////////////////////////////// -// Function: Parabola::write_datagram +// Function: LParabola::write_datagram // Access: Public // Description: Function to write itself into a datagram //////////////////////////////////////////////////////////////////// -void FLOATNAME(Parabola):: +void FLOATNAME(LParabola):: write_datagram(Datagram &destination) const { _a.write_datagram(destination); _b.write_datagram(destination); @@ -64,7 +64,7 @@ write_datagram(Datagram &destination) const { // Access: Public // Description: Function to read itself from a datagramIterator //////////////////////////////////////////////////////////////////// -void FLOATNAME(Parabola):: +void FLOATNAME(LParabola):: read_datagram(DatagramIterator &source) { _a.read_datagram(source); _b.read_datagram(source); diff --git a/panda/src/mathutil/parabola_src.h b/panda/src/mathutil/parabola_src.h index 2ff4ea9fb8..0cb9b63bf9 100644 --- a/panda/src/mathutil/parabola_src.h +++ b/panda/src/mathutil/parabola_src.h @@ -13,7 +13,7 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Class : Parabola +// Class : LParabola // Description : An abstract mathematical description of a parabola, // particularly useful for describing arcs of // projectiles. @@ -21,15 +21,15 @@ // The parabolic equation, given parametrically here, is // P = At^2 + Bt + C. //////////////////////////////////////////////////////////////////// -class EXPCL_PANDA_MATHUTIL FLOATNAME(Parabola) { +class EXPCL_PANDA_MATHUTIL FLOATNAME(LParabola) { PUBLISHED: - INLINE_MATHUTIL FLOATNAME(Parabola)(); - INLINE_MATHUTIL FLOATNAME(Parabola)(const FLOATNAME(LVecBase3) &a, + INLINE_MATHUTIL FLOATNAME(LParabola)(); + INLINE_MATHUTIL FLOATNAME(LParabola)(const FLOATNAME(LVecBase3) &a, const FLOATNAME(LVecBase3) &b, const FLOATNAME(LVecBase3) &c); - INLINE_MATHUTIL FLOATNAME(Parabola)(const FLOATNAME(Parabola) ©); - INLINE_MATHUTIL void operator = (const FLOATNAME(Parabola) ©); - INLINE_MATHUTIL ~FLOATNAME(Parabola)(); + INLINE_MATHUTIL FLOATNAME(LParabola)(const FLOATNAME(LParabola) ©); + INLINE_MATHUTIL void operator = (const FLOATNAME(LParabola) ©); + INLINE_MATHUTIL ~FLOATNAME(LParabola)(); void xform(const FLOATNAME(LMatrix4) &mat); @@ -51,7 +51,7 @@ private: }; inline ostream & -operator << (ostream &out, const FLOATNAME(Parabola) &p) { +operator << (ostream &out, const FLOATNAME(LParabola) &p) { p.output(out); return out; } diff --git a/panda/src/mathutil/plane.h b/panda/src/mathutil/plane.h index 0ed759789a..1bac38e238 100644 --- a/panda/src/mathutil/plane.h +++ b/panda/src/mathutil/plane.h @@ -33,9 +33,20 @@ class DatagramIterator; #include "plane_src.h" #ifndef STDFLOAT_DOUBLE -typedef Planef LPlane; +typedef LPlanef LPlane; #else -typedef Planed LPlane; +typedef LPlaned LPlane; #endif +// Bogus typedefs for interrogate and legacy Python code. +#ifdef CPPPARSER +typedef LPlanef PlaneF; +typedef LPlaned PlaneD; +#ifndef STDFLOAT_DOUBLE +typedef LPlanef Plane; +#else +typedef LPlaned Plane; +#endif +#endif // CPPPARSER + #endif diff --git a/panda/src/mathutil/plane_src.I b/panda/src/mathutil/plane_src.I index ad96464568..aec212cccd 100644 --- a/panda/src/mathutil/plane_src.I +++ b/panda/src/mathutil/plane_src.I @@ -13,14 +13,14 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Function: Plane::Constructor +// Function: LPlane::Constructor // Access: Published // Description: Creates a default plane. This plane happens to // intersect the origin, perpendicular to the Z axis. // It's not clear how useful a default plane is. //////////////////////////////////////////////////////////////////// -INLINE_MATHUTIL FLOATNAME(Plane):: -FLOATNAME(Plane)() { +INLINE_MATHUTIL FLOATNAME(LPlane):: +FLOATNAME(LPlane)() { _v.v._0 = 0.0f; _v.v._1 = 0.0f; _v.v._2 = 1.0f; @@ -28,26 +28,26 @@ FLOATNAME(Plane)() { } //////////////////////////////////////////////////////////////////// -// Function: Plane::Copy Constructor +// Function: LPlane::Copy Constructor // Access: Published // Description: //////////////////////////////////////////////////////////////////// -INLINE_MATHUTIL FLOATNAME(Plane):: -FLOATNAME(Plane)(const FLOATNAME(LVecBase4) ©) : +INLINE_MATHUTIL FLOATNAME(LPlane):: +FLOATNAME(LPlane)(const FLOATNAME(LVecBase4) ©) : FLOATNAME(LVecBase4)(copy) { } //////////////////////////////////////////////////////////////////// -// Function: Plane::Constructor +// Function: LPlane::Constructor // Access: Published // Description: Constructs a plane given three counter-clockwise // points, as seen from the front of the plane (that is, // viewed from the end of the normal vector, looking // down). //////////////////////////////////////////////////////////////////// -INLINE_MATHUTIL FLOATNAME(Plane):: -FLOATNAME(Plane)(const FLOATNAME(LPoint3) &a, const FLOATNAME(LPoint3) &b, +INLINE_MATHUTIL FLOATNAME(LPlane):: +FLOATNAME(LPlane)(const FLOATNAME(LPoint3) &a, const FLOATNAME(LPoint3) &b, const FLOATNAME(LPoint3) &c) { FLOATNAME(LVector3) u = b - a; FLOATNAME(LVector3) v = c - a; @@ -60,13 +60,13 @@ FLOATNAME(Plane)(const FLOATNAME(LPoint3) &a, const FLOATNAME(LPoint3) &b, } //////////////////////////////////////////////////////////////////// -// Function: Plane::Constructor +// Function: LPlane::Constructor // Access: Published // Description: Constructs a plane given a surface normal vector and // a point within the plane. //////////////////////////////////////////////////////////////////// -INLINE_MATHUTIL FLOATNAME(Plane):: -FLOATNAME(Plane)(const FLOATNAME(LVector3) &normal, +INLINE_MATHUTIL FLOATNAME(LPlane):: +FLOATNAME(LPlane)(const FLOATNAME(LVector3) &normal, const FLOATNAME(LPoint3) &point) { FLOATNAME(LVector3) p = ::normalize(normal); @@ -77,82 +77,82 @@ FLOATNAME(Plane)(const FLOATNAME(LVector3) &normal, } //////////////////////////////////////////////////////////////////// -// Function: Plane::Constructor +// Function: LPlane::Constructor // Access: Published // Description: Constructs a plane given the four terms of the plane // equation. //////////////////////////////////////////////////////////////////// -INLINE_MATHUTIL FLOATNAME(Plane):: -FLOATNAME(Plane)(FLOATTYPE a, FLOATTYPE b, FLOATTYPE c, FLOATTYPE d) : +INLINE_MATHUTIL FLOATNAME(LPlane):: +FLOATNAME(LPlane)(FLOATTYPE a, FLOATTYPE b, FLOATTYPE c, FLOATTYPE d) : FLOATNAME(LVecBase4)(a, b, c, d) { } //////////////////////////////////////////////////////////////////// -// Function: Plane::Operator * LMatrix3 +// Function: LPlane::Operator * LMatrix3 // Access: Published // Description: Transforms the plane by the indicated matrix. //////////////////////////////////////////////////////////////////// -INLINE_MATHUTIL FLOATNAME(Plane) FLOATNAME(Plane):: +INLINE_MATHUTIL FLOATNAME(LPlane) FLOATNAME(LPlane):: operator * (const FLOATNAME(LMatrix3) &mat) const { FLOATNAME(LVector3) new_normal = mat.xform(get_normal()); - return FLOATNAME(Plane)(new_normal, get_point()); + return FLOATNAME(LPlane)(new_normal, get_point()); } //////////////////////////////////////////////////////////////////// -// Function: Plane::Operator * LMatrix4 +// Function: LPlane::Operator * LMatrix4 // Access: Published // Description: Transforms the plane by the indicated matrix. //////////////////////////////////////////////////////////////////// -INLINE_MATHUTIL FLOATNAME(Plane) FLOATNAME(Plane):: +INLINE_MATHUTIL FLOATNAME(LPlane) FLOATNAME(LPlane):: operator * (const FLOATNAME(LMatrix4) &mat) const { FLOATNAME(LVector3) new_normal = mat.xform_vec_general(get_normal()); FLOATNAME(LPoint3) new_point = get_point() * mat; - return FLOATNAME(Plane)(new_normal, new_point); + return FLOATNAME(LPlane)(new_normal, new_point); } //////////////////////////////////////////////////////////////////// -// Function: Plane::Operator *= LMatrix4 +// Function: LPlane::Operator *= LMatrix4 // Access: Published // Description: Transforms the plane by the indicated matrix. //////////////////////////////////////////////////////////////////// -INLINE_MATHUTIL void FLOATNAME(Plane):: +INLINE_MATHUTIL void FLOATNAME(LPlane):: operator *= (const FLOATNAME(LMatrix4) &mat) { (*this) = (*this) * mat; } //////////////////////////////////////////////////////////////////// -// Function: Plane::xform +// Function: LPlane::xform // Access: Published // Description: Transforms the plane by the indicated matrix. //////////////////////////////////////////////////////////////////// -INLINE_MATHUTIL void FLOATNAME(Plane):: +INLINE_MATHUTIL void FLOATNAME(LPlane):: xform(const FLOATNAME(LMatrix4) &mat) { (*this) = (*this) * mat; } //////////////////////////////////////////////////////////////////// -// Function: Plane::Unary - +// Function: LPlane::Unary - // Access: Published // Description: Returns the same plane facing the opposite direction. //////////////////////////////////////////////////////////////////// -INLINE_MATHUTIL FLOATNAME(Plane) FLOATNAME(Plane):: +INLINE_MATHUTIL FLOATNAME(LPlane) FLOATNAME(LPlane):: operator - () const { - return FLOATNAME(Plane)(-_v.v._0, -_v.v._1, -_v.v._2, -_v.v._3); + return FLOATNAME(LPlane)(-_v.v._0, -_v.v._1, -_v.v._2, -_v.v._3); } //////////////////////////////////////////////////////////////////// -// Function: Plane::get_normal +// Function: LPlane::get_normal // Access: Published // Description: Returns the surface normal of the plane. //////////////////////////////////////////////////////////////////// -INLINE_MATHUTIL FLOATNAME(LVector3) FLOATNAME(Plane):: +INLINE_MATHUTIL FLOATNAME(LVector3) FLOATNAME(LPlane):: get_normal() const { return FLOATNAME(LVector3)(_v.v._0, _v.v._1, _v.v._2); } //////////////////////////////////////////////////////////////////// -// Function: Plane::dist_to_plane +// Function: LPlane::dist_to_plane // Access: Published // Description: Returns the straight-line shortest distance from the // point to the plane. The returned value is positive @@ -161,29 +161,29 @@ get_normal() const { // the plane (on the opposite side from the normal). // It's zero if the point is exactly in the plane. //////////////////////////////////////////////////////////////////// -INLINE_MATHUTIL FLOATTYPE FLOATNAME(Plane):: +INLINE_MATHUTIL FLOATTYPE FLOATNAME(LPlane):: dist_to_plane(const FLOATNAME(LPoint3) &point) const { return (_v.v._0 * point[0] + _v.v._1 * point[1] + _v.v._2 * point[2] + _v.v._3); } //////////////////////////////////////////////////////////////////// -// Function: Plane::project +// Function: LPlane::project // Access: Published // Description: Returns the point within the plane nearest to the // indicated point in space. //////////////////////////////////////////////////////////////////// -INLINE_MATHUTIL FLOATNAME(LPoint3) FLOATNAME(Plane):: +INLINE_MATHUTIL FLOATNAME(LPoint3) FLOATNAME(LPlane):: project(const FLOATNAME(LPoint3) &point) const { return point - get_normal() * dist_to_plane(point); } //////////////////////////////////////////////////////////////////// -// Function: Plane::flip +// Function: LPlane::flip // Access: Published // Description: Convenience method that flips the plane in-place. // This is done by simply flipping the normal vector. //////////////////////////////////////////////////////////////////// -INLINE_MATHUTIL void FLOATNAME(Plane):: +INLINE_MATHUTIL void FLOATNAME(LPlane):: flip() { _v.v._0 = -_v.v._0; _v.v._1 = -_v.v._1; @@ -192,7 +192,7 @@ flip() { } //////////////////////////////////////////////////////////////////// -// Function: Plane::intersects_line +// Function: LPlane::intersects_line // Access: Published // Description: Returns true if the plane intersects the infinite // line passing through points p1 and p2, false if the @@ -201,7 +201,7 @@ flip() { // bearing on the intersection test. If true, sets // intersection_point to the point of intersection. //////////////////////////////////////////////////////////////////// -INLINE_MATHUTIL bool FLOATNAME(Plane):: +INLINE_MATHUTIL bool FLOATNAME(LPlane):: intersects_line(FLOATNAME(LPoint3) &intersection_point, const FLOATNAME(LPoint3) &p1, const FLOATNAME(LPoint3) &p2) const { @@ -214,7 +214,7 @@ intersects_line(FLOATNAME(LPoint3) &intersection_point, } //////////////////////////////////////////////////////////////////// -// Function: Plane::intersects_line +// Function: LPlane::intersects_line // Access: Published // Description: This flavor of intersects_line() returns a bit more // information about the nature of the intersecting @@ -230,7 +230,7 @@ intersects_line(FLOATNAME(LPoint3) &intersection_point, // point from, and t == 1.0f implies at point from + // delta, with other values of t accordingly. //////////////////////////////////////////////////////////////////// -INLINE_MATHUTIL bool FLOATNAME(Plane):: +INLINE_MATHUTIL bool FLOATNAME(LPlane):: intersects_line(FLOATTYPE &t, const FLOATNAME(LPoint3) &from, const FLOATNAME(LVector3) &delta) const { @@ -245,7 +245,7 @@ intersects_line(FLOATTYPE &t, } INLINE_MATHUTIL ostream & -operator << (ostream &out, const FLOATNAME(Plane) &p) { +operator << (ostream &out, const FLOATNAME(LPlane) &p) { p.output(out); return out; } diff --git a/panda/src/mathutil/plane_src.cxx b/panda/src/mathutil/plane_src.cxx index 4a94c3c795..e0464c4424 100644 --- a/panda/src/mathutil/plane_src.cxx +++ b/panda/src/mathutil/plane_src.cxx @@ -14,13 +14,13 @@ //////////////////////////////////////////////////////////////////// -// Function: Plane::get_reflection_mat +// Function: LPlane::get_reflection_mat // Access: Published // Description: This computes a transform matrix that reflects the // universe to the other side of the plane, as in a // mirror. //////////////////////////////////////////////////////////////////// -FLOATNAME(LMatrix4) FLOATNAME(Plane):: +FLOATNAME(LMatrix4) FLOATNAME(LPlane):: get_reflection_mat() const { FLOATTYPE aa = _v.v._0 * _v.v._0; FLOATTYPE ab = _v.v._0 * _v.v._1; @@ -39,13 +39,13 @@ get_reflection_mat() const { } //////////////////////////////////////////////////////////////////// -// Function: Plane::get_point +// Function: LPlane::get_point // Access: Published // Description: Returns an arbitrary point in the plane. This can be // used along with the normal returned by get_normal() // to reconstruct the plane. //////////////////////////////////////////////////////////////////// -FLOATNAME(LPoint3) FLOATNAME(Plane):: +FLOATNAME(LPoint3) FLOATNAME(LPlane):: get_point() const { // Choose the denominator based on the largest axis in the normal. if (cabs(_v.v._0) >= cabs(_v.v._1) && cabs(_v.v._0) >= cabs(_v.v._2)) { @@ -62,7 +62,7 @@ get_point() const { //////////////////////////////////////////////////////////////////// -// Function: Plane::intersects_plane +// Function: LPlane::intersects_plane // Access: Published // Description: Returns true if the two planes intersect, false if // they do not. If they do intersect, then from and @@ -71,10 +71,10 @@ get_point() const { // from is a point on that line, and delta is a vector // showing the direction of the line. //////////////////////////////////////////////////////////////////// -bool FLOATNAME(Plane):: +bool FLOATNAME(LPlane):: intersects_plane(FLOATNAME(LPoint3) &from, FLOATNAME(LVector3) &delta, - const FLOATNAME(Plane) &other) const { + const FLOATNAME(LPlane) &other) const { FLOATNAME(LVector3) n1 = get_normal(); FLOATNAME(LVector3) n2 = other.get_normal(); @@ -100,7 +100,7 @@ intersects_plane(FLOATNAME(LPoint3) &from, } //////////////////////////////////////////////////////////////////// -// Function: Plane::intersects_parabola +// Function: LPlane::intersects_parabola // Access: Published // Description: Determines whether and where the indicated parabola // intersects with the plane. @@ -113,9 +113,9 @@ intersects_plane(FLOATNAME(LPoint3) &from, // of intersection. If the parabola is exactly tangent // to the plane, then t1 == t2. //////////////////////////////////////////////////////////////////// -bool FLOATNAME(Plane):: +bool FLOATNAME(LPlane):: intersects_parabola(FLOATTYPE &t1, FLOATTYPE &t2, - const FLOATNAME(Parabola) ¶bola) const { + const FLOATNAME(LParabola) ¶bola) const { // // The parabola intersects the plane wherever: // @@ -164,23 +164,23 @@ intersects_parabola(FLOATTYPE &t1, FLOATTYPE &t2, } //////////////////////////////////////////////////////////////////// -// Function: Plane::output +// Function: LPlane::output // Access: Published // Description: //////////////////////////////////////////////////////////////////// -void FLOATNAME(Plane):: +void FLOATNAME(LPlane):: output(ostream &out) const { - out << "Plane("; + out << "LPlane("; FLOATNAME(LVecBase4)::output(out); out << ")"; } //////////////////////////////////////////////////////////////////// -// Function: Plane::write +// Function: LPlane::write // Access: Published // Description: //////////////////////////////////////////////////////////////////// -void FLOATNAME(Plane):: +void FLOATNAME(LPlane):: write(ostream &out, int indent_level) const { indent(out, indent_level) << *this << "\n"; } diff --git a/panda/src/mathutil/plane_src.h b/panda/src/mathutil/plane_src.h index 25aeec6341..290b3745a2 100644 --- a/panda/src/mathutil/plane_src.h +++ b/panda/src/mathutil/plane_src.h @@ -13,27 +13,27 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Class : Plane +// Class : LPlane // Description : An abstract mathematical description of a plane. A // plane is defined by the equation Ax + By + Cz + D = 0. //////////////////////////////////////////////////////////////////// -class EXPCL_PANDA_MATHUTIL FLOATNAME(Plane) : public FLOATNAME(LVecBase4) { +class EXPCL_PANDA_MATHUTIL FLOATNAME(LPlane) : public FLOATNAME(LVecBase4) { PUBLISHED: - INLINE_MATHUTIL FLOATNAME(Plane)(); - INLINE_MATHUTIL FLOATNAME(Plane)(const FLOATNAME(LVecBase4) ©); - INLINE_MATHUTIL FLOATNAME(Plane)(const FLOATNAME(LPoint3) &a, + INLINE_MATHUTIL FLOATNAME(LPlane)(); + INLINE_MATHUTIL FLOATNAME(LPlane)(const FLOATNAME(LVecBase4) ©); + INLINE_MATHUTIL FLOATNAME(LPlane)(const FLOATNAME(LPoint3) &a, const FLOATNAME(LPoint3) &b, const FLOATNAME(LPoint3) &c); - INLINE_MATHUTIL FLOATNAME(Plane)(const FLOATNAME(LVector3) &normal, + INLINE_MATHUTIL FLOATNAME(LPlane)(const FLOATNAME(LVector3) &normal, const FLOATNAME(LPoint3) &point); - INLINE_MATHUTIL FLOATNAME(Plane)(FLOATTYPE a, FLOATTYPE b, + INLINE_MATHUTIL FLOATNAME(LPlane)(FLOATTYPE a, FLOATTYPE b, FLOATTYPE c, FLOATTYPE d); - INLINE_MATHUTIL FLOATNAME(Plane) operator * (const FLOATNAME(LMatrix3) &mat) const; - INLINE_MATHUTIL FLOATNAME(Plane) operator * (const FLOATNAME(LMatrix4) &mat) const; + INLINE_MATHUTIL FLOATNAME(LPlane) operator * (const FLOATNAME(LMatrix3) &mat) const; + INLINE_MATHUTIL FLOATNAME(LPlane) operator * (const FLOATNAME(LMatrix4) &mat) const; INLINE_MATHUTIL void operator *= (const FLOATNAME(LMatrix4) &mat); INLINE_MATHUTIL void xform(const FLOATNAME(LMatrix4) &mat); - INLINE_MATHUTIL FLOATNAME(Plane) operator - () const; + INLINE_MATHUTIL FLOATNAME(LPlane) operator - () const; FLOATNAME(LMatrix4) get_reflection_mat() const; @@ -53,16 +53,16 @@ PUBLISHED: bool intersects_plane(FLOATNAME(LPoint3) &from, FLOATNAME(LVector3) &delta, - const FLOATNAME(Plane) &other) const; + const FLOATNAME(LPlane) &other) const; bool intersects_parabola(FLOATTYPE &t1, FLOATTYPE &t2, - const FLOATNAME(Parabola) ¶bola) const; + const FLOATNAME(LParabola) ¶bola) const; void output(ostream &out) const; void write(ostream &out, int indent_level = 0) const; }; INLINE_MATHUTIL ostream & -operator << (ostream &out, const FLOATNAME(Plane) &p); +operator << (ostream &out, const FLOATNAME(LPlane) &p); #include "plane_src.I" diff --git a/panda/src/mathutil/pta_LMatrix3.h b/panda/src/mathutil/pta_LMatrix3.h index 816afef033..004e058fd7 100644 --- a/panda/src/mathutil/pta_LMatrix3.h +++ b/panda/src/mathutil/pta_LMatrix3.h @@ -61,6 +61,14 @@ typedef PTA_LMatrix3d PTA_LMatrix3; typedef CPTA_LMatrix3d CPTA_LMatrix3; #endif // STDFLOAT_DOUBLE +// Bogus typedefs for interrogate and legacy Python code. +#ifdef CPPPARSER +typedef PTA_LMatrix3 PTAMat3; +typedef CPTA_LMatrix3 CPTAMat3; +typedef PTA_LMatrix3d PTAMat3d; +typedef CPTA_LMatrix3d CPTAMat3d; +#endif // CPPPARSER + // Tell GCC that we'll take care of the instantiation explicitly here. #ifdef __GNUC__ #pragma interface diff --git a/panda/src/mathutil/pta_LMatrix4.h b/panda/src/mathutil/pta_LMatrix4.h index 5e0032ef2d..0f1138e387 100644 --- a/panda/src/mathutil/pta_LMatrix4.h +++ b/panda/src/mathutil/pta_LMatrix4.h @@ -61,6 +61,14 @@ typedef PTA_LMatrix4d PTA_LMatrix4; typedef CPTA_LMatrix4d CPTA_LMatrix4; #endif // STDFLOAT_DOUBLE +// Bogus typedefs for interrogate and legacy Python code. +#ifdef CPPPARSER +typedef PTA_LMatrix4 PTAMat4; +typedef CPTA_LMatrix4 CPTAMat4; +typedef PTA_LMatrix4d PTAMat4d; +typedef CPTA_LMatrix4d CPTAMat4d; +#endif // CPPPARSER + // Tell GCC that we'll take care of the instantiation explicitly here. #ifdef __GNUC__ #pragma interface diff --git a/panda/src/mathutil/pta_LVecBase2.h b/panda/src/mathutil/pta_LVecBase2.h index 82468ba01c..c1dba12a10 100644 --- a/panda/src/mathutil/pta_LVecBase2.h +++ b/panda/src/mathutil/pta_LVecBase2.h @@ -61,6 +61,14 @@ typedef PTA_LVecBase2d PTA_LVecBase2; typedef CPTA_LVecBase2d CPTA_LVecBase2; #endif // STDFLOAT_DOUBLE +// Bogus typedefs for interrogate and legacy Python code. +#ifdef CPPPARSER +typedef PTA_LVecBase2f PTAVecBase2f; +typedef CPTA_LVecBase2f CPTAVecBase2f; +typedef PTA_LVecBase2d PTAVecBase2d; +typedef CPTA_LVecBase2d CPTAVecBase2d; +#endif // CPPPARSER + // Tell GCC that we'll take care of the instantiation explicitly here. #ifdef __GNUC__ #pragma interface diff --git a/panda/src/mathutil/pta_LVecBase3.h b/panda/src/mathutil/pta_LVecBase3.h index 0fc46a92cb..5a9531aca6 100644 --- a/panda/src/mathutil/pta_LVecBase3.h +++ b/panda/src/mathutil/pta_LVecBase3.h @@ -61,6 +61,14 @@ typedef PTA_LVecBase3d PTA_LVecBase3; typedef CPTA_LVecBase3d CPTA_LVecBase3; #endif // STDFLOAT_DOUBLE +// Bogus typedefs for interrogate and legacy Python code. +#ifdef CPPPARSER +typedef PTA_LVecBase3f PTAVecBase3f; +typedef CPTA_LVecBase3f CPTAVecBase3f; +typedef PTA_LVecBase3d PTAVecBase3d; +typedef CPTA_LVecBase3d CPTAVecBase3d; +#endif // CPPPARSER + // Tell GCC that we'll take care of the instantiation explicitly here. #ifdef __GNUC__ #pragma interface diff --git a/panda/src/mathutil/pta_LVecBase4.h b/panda/src/mathutil/pta_LVecBase4.h index 4a86afcc28..55ff24ebdc 100644 --- a/panda/src/mathutil/pta_LVecBase4.h +++ b/panda/src/mathutil/pta_LVecBase4.h @@ -61,6 +61,14 @@ typedef PTA_LVecBase4d PTA_LVecBase4; typedef CPTA_LVecBase4d CPTA_LVecBase4; #endif // STDFLOAT_DOUBLE +// Bogus typedefs for interrogate and legacy Python code. +#ifdef CPPPARSER +typedef PTA_LVecBase4f PTAVecBase4f; +typedef CPTA_LVecBase4f CPTAVecBase4f; +typedef PTA_LVecBase4d PTAVecBase4d; +typedef CPTA_LVecBase4d CPTAVecBase4d; +#endif // CPPPARSER + // Tell GCC that we'll take care of the instantiation explicitly here. #ifdef __GNUC__ #pragma interface diff --git a/panda/src/pgraph/nodePath.cxx b/panda/src/pgraph/nodePath.cxx index b9a40dd123..93a5731dd5 100644 --- a/panda/src/pgraph/nodePath.cxx +++ b/panda/src/pgraph/nodePath.cxx @@ -309,9 +309,9 @@ __reduce_persist__(PyObject *self, PyObject *pickler) const { // The modified pickle support: call the "persistent" version of // this function, which receives the unpickler itself as an // additional parameter. - func = TypedWritable::find_global_decode(this_class, "pyDecodeNodePathFromBamStreamPersist"); + func = TypedWritable::find_global_decode(this_class, "py_decode_NodePath_from_bam_stream_persist"); if (func == NULL) { - PyErr_SetString(PyExc_TypeError, "Couldn't find pyDecodeNodePathFromBamStreamPersist()"); + PyErr_SetString(PyExc_TypeError, "Couldn't find py_decode_NodePath_from_bam_stream_persist()"); Py_DECREF(this_class); return NULL; } @@ -320,9 +320,9 @@ __reduce_persist__(PyObject *self, PyObject *pickler) const { // The traditional pickle support: call the non-persistent version // of this function. - func = TypedWritable::find_global_decode(this_class, "pyDecodeNodePathFromBamStream"); + func = TypedWritable::find_global_decode(this_class, "py_decode_NodePath_from_bam_stream"); if (func == NULL) { - PyErr_SetString(PyExc_TypeError, "Couldn't find pyDecodeNodePathFromBamStream()"); + PyErr_SetString(PyExc_TypeError, "Couldn't find py_decode_NodePath_from_bam_stream()"); Py_DECREF(this_class); return NULL; } diff --git a/panda/src/pnmimage/pnmBrush.cxx b/panda/src/pnmimage/pnmBrush.cxx index f60c7dcb10..8e93eabdab 100644 --- a/panda/src/pnmimage/pnmBrush.cxx +++ b/panda/src/pnmimage/pnmBrush.cxx @@ -32,17 +32,17 @@ public: // A PNMPixelBrush is a family of brushes that draw one pixel at a time. class EXPCL_PANDA_PNMIMAGE PNMPixelBrush : public PNMBrush { protected: - PNMPixelBrush(const Colord &color) : + PNMPixelBrush(const LColord &color) : PNMBrush(0.5, 0.5), _rgb(color[0], color[1], color[2]), _a(color[3]) { } - RGBColord _rgb; + LRGBColord _rgb; double _a; }; // Arbitrarily sets the pixel to a particular color, with no antialiasing. class EXPCL_PANDA_PNMIMAGE PNMSetPixelBrush : public PNMPixelBrush { public: - PNMSetPixelBrush(const Colord &color) : PNMPixelBrush(color) { } + PNMSetPixelBrush(const LColord &color) : PNMPixelBrush(color) { } virtual void draw(PNMImage &image, int x, int y, double pixel_scale) { if (x >= 0 && x < image.get_x_size() && @@ -75,7 +75,7 @@ public: // Blends the pixel in to the existing background. class EXPCL_PANDA_PNMIMAGE PNMBlendPixelBrush : public PNMPixelBrush { public: - PNMBlendPixelBrush(const Colord &color) : PNMPixelBrush(color) { } + PNMBlendPixelBrush(const LColord &color) : PNMPixelBrush(color) { } virtual void draw(PNMImage &image, int x, int y, double pixel_scale) { if (x >= 0 && x < image.get_x_size() && @@ -99,13 +99,13 @@ public: // Darkens the pixel in the existing background. class EXPCL_PANDA_PNMIMAGE PNMDarkenPixelBrush : public PNMPixelBrush { public: - PNMDarkenPixelBrush(const Colord &color) : PNMPixelBrush(color) { } + PNMDarkenPixelBrush(const LColord &color) : PNMPixelBrush(color) { } virtual void draw(PNMImage &image, int x, int y, double pixel_scale) { if (x >= 0 && x < image.get_x_size() && y >= 0 && y < image.get_y_size()) { - RGBColord rgb = image.get_xel(x, y); - RGBColord p; + LRGBColord rgb = image.get_xel(x, y); + LRGBColord p; p.set(min(1.0 - (1.0 - _rgb[0]) * pixel_scale, rgb[0]), min(1.0 - (1.0 - _rgb[1]) * pixel_scale, rgb[1]), min(1.0 - (1.0 - _rgb[2]) * pixel_scale, rgb[2])); @@ -124,8 +124,8 @@ public: xfrom = max(xfrom, 0); xto = min(xto, image.get_x_size() - 1); for (int x = xfrom; x <= xto; ++x) { - RGBColord rgb = image.get_xel(x, y); - RGBColord p; + LRGBColord rgb = image.get_xel(x, y); + LRGBColord p; p.set(min(_rgb[0], rgb[0]), min(_rgb[1], rgb[1]), min(_rgb[2], rgb[2])); @@ -144,13 +144,13 @@ public: // Lightens the pixel in the existing background. class EXPCL_PANDA_PNMIMAGE PNMLightenPixelBrush : public PNMPixelBrush { public: - PNMLightenPixelBrush(const Colord &color) : PNMPixelBrush(color) { } + PNMLightenPixelBrush(const LColord &color) : PNMPixelBrush(color) { } virtual void draw(PNMImage &image, int x, int y, double pixel_scale) { if (x >= 0 && x < image.get_x_size() && y >= 0 && y < image.get_y_size()) { - RGBColord rgb = image.get_xel(x, y); - RGBColord p; + LRGBColord rgb = image.get_xel(x, y); + LRGBColord p; p.set(max(_rgb[0] * pixel_scale, rgb[0]), max(_rgb[1] * pixel_scale, rgb[1]), max(_rgb[2] * pixel_scale, rgb[2])); @@ -169,8 +169,8 @@ public: xfrom = max(xfrom, 0); xto = max(xto, image.get_x_size() - 1); for (int x = xfrom; x <= xto; ++x) { - RGBColord rgb = image.get_xel(x, y); - RGBColord p; + LRGBColord rgb = image.get_xel(x, y); + LRGBColord p; p.set(max(_rgb[0], rgb[0]), max(_rgb[1], rgb[1]), max(_rgb[2], rgb[2])); @@ -317,7 +317,7 @@ make_transparent() { // in an interior. //////////////////////////////////////////////////////////////////// PT(PNMBrush) PNMBrush:: -make_pixel(const Colord &color, PNMBrush::BrushEffect effect) { +make_pixel(const LColord &color, PNMBrush::BrushEffect effect) { switch (effect) { case BE_set: return new PNMSetPixelBrush(color); @@ -345,9 +345,9 @@ make_pixel(const Colord &color, PNMBrush::BrushEffect effect) { // spot is fuzzy; otherwise, it is hard-edged. //////////////////////////////////////////////////////////////////// PT(PNMBrush) PNMBrush:: -make_spot(const Colord &color, double radius, bool fuzzy, +make_spot(const LColord &color, double radius, bool fuzzy, BrushEffect effect) { - Colord bg; + LColord bg; switch (effect) { case BE_set: diff --git a/panda/src/pnmimage/pnmBrush.h b/panda/src/pnmimage/pnmBrush.h index 68640ead80..376ec544ae 100644 --- a/panda/src/pnmimage/pnmBrush.h +++ b/panda/src/pnmimage/pnmBrush.h @@ -53,8 +53,8 @@ PUBLISHED: }; static PT(PNMBrush) make_transparent(); - static PT(PNMBrush) make_pixel(const Colord &color, BrushEffect effect = BE_blend); - static PT(PNMBrush) make_spot(const Colord &color, double radius, bool fuzzy, + static PT(PNMBrush) make_pixel(const LColord &color, BrushEffect effect = BE_blend); + static PT(PNMBrush) make_spot(const LColord &color, double radius, bool fuzzy, BrushEffect effect = BE_blend); static PT(PNMBrush) make_image(const PNMImage &image, double xc, double yc, BrushEffect effect = BE_blend); diff --git a/panda/src/pnmimage/pnmImage.I b/panda/src/pnmimage/pnmImage.I index 9904eca7cb..78462b5f21 100644 --- a/panda/src/pnmimage/pnmImage.I +++ b/panda/src/pnmimage/pnmImage.I @@ -478,9 +478,9 @@ set_alpha_val(int x, int y, xelval a) { // Description: Returns the RGB color at the indicated pixel. Each // component is a double in the range 0..1. //////////////////////////////////////////////////////////////////// -INLINE RGBColord PNMImage:: +INLINE LRGBColord PNMImage:: get_xel(int x, int y) const { - return RGBColord(from_val(get_red_val(x, y)), + return LRGBColord(from_val(get_red_val(x, y)), from_val(get_green_val(x, y)), from_val(get_blue_val(x, y))); } @@ -492,7 +492,7 @@ get_xel(int x, int y) const { // component is a double in the range 0..1. //////////////////////////////////////////////////////////////////// INLINE void PNMImage:: -set_xel(int x, int y, const RGBColord &value) { +set_xel(int x, int y, const LRGBColord &value) { set_xel_val(x, y, to_val(value[0]), to_val(value[1]), to_val(value[2])); } @@ -525,15 +525,15 @@ set_xel(int x, int y, double gray) { // Description: Returns the RGBA color at the indicated pixel. Each // component is a double in the range 0..1. //////////////////////////////////////////////////////////////////// -INLINE Colord PNMImage:: +INLINE LColord PNMImage:: get_xel_a(int x, int y) const { if (has_alpha()) { - return Colord(from_val(get_red_val(x, y)), + return LColord(from_val(get_red_val(x, y)), from_val(get_green_val(x, y)), from_val(get_blue_val(x, y)), from_val(get_alpha_val(x, y))); } else { - return Colord(from_val(get_red_val(x, y)), + return LColord(from_val(get_red_val(x, y)), from_val(get_green_val(x, y)), from_val(get_blue_val(x, y)), 0.0); @@ -547,7 +547,7 @@ get_xel_a(int x, int y) const { // component is a double in the range 0..1. //////////////////////////////////////////////////////////////////// INLINE void PNMImage:: -set_xel_a(int x, int y, const Colord &value) { +set_xel_a(int x, int y, const LColord &value) { set_xel_val(x, y, to_val(value[0]), to_val(value[1]), to_val(value[2])); if (has_alpha()) { set_alpha_val(x, y, to_val(value[3])); @@ -784,7 +784,7 @@ get_bright(int x, int y, double rc, double gc, double bc, double ac) const { // alpha of 0.0 is fully transparent and does nothing. //////////////////////////////////////////////////////////////////// INLINE void PNMImage:: -blend(int x, int y, const RGBColord &val, double alpha) { +blend(int x, int y, const LRGBColord &val, double alpha) { blend(x, y, val[0], val[1], val[2], alpha); } @@ -939,9 +939,9 @@ setup_sub_image(const PNMImage ©, int &xto, int &yto, // from the center. //////////////////////////////////////////////////////////////////// INLINE void PNMImage:: -compute_spot_pixel(Colord &c, double d2, +compute_spot_pixel(LColord &c, double d2, double min_radius, double max_radius, - const Colord &fg, const Colord &bg) { + const LColord &fg, const LColord &bg) { double d = sqrt(d2); if (d > max_radius) { c = bg; @@ -977,7 +977,7 @@ operator + (const PNMImage &other) const { // is added to each pixel in the provided image. //////////////////////////////////////////////////////////////////// INLINE PNMImage PNMImage:: -operator + (const Colord &other) const { +operator + (const LColord &other) const { PNMImage target (*this); target += other; return target; @@ -1005,7 +1005,7 @@ operator - (const PNMImage &other) const { // is subtracted from each pixel in the provided image. //////////////////////////////////////////////////////////////////// INLINE PNMImage PNMImage:: -operator - (const Colord &other) const { +operator - (const LColord &other) const { PNMImage target (*this); target -= other; return target; diff --git a/panda/src/pnmimage/pnmImage.cxx b/panda/src/pnmimage/pnmImage.cxx index 6ddda1ba2f..5cac34e131 100644 --- a/panda/src/pnmimage/pnmImage.cxx +++ b/panda/src/pnmimage/pnmImage.cxx @@ -685,7 +685,7 @@ blend(int x, int y, double r, double g, double b, double alpha) { } else { // Blend the color with the previous color. - RGBColord prev_rgb = get_xel(x, y); + LRGBColord prev_rgb = get_xel(x, y); r = r + (1.0 - alpha) * (get_red(x, y) - r); g = g + (1.0 - alpha) * (get_green(x, y) - g); b = b + (1.0 - alpha) * (get_blue(x, y) - b); @@ -849,9 +849,9 @@ darken_sub_image(const PNMImage ©, int xto, int yto, int x, y; for (y = ymin; y < ymax; y++) { for (x = xmin; x < xmax; x++) { - RGBColord c = copy.get_xel(x - xmin + xfrom, y - ymin + yfrom); - RGBColord o = get_xel(x, y); - RGBColord p; + LRGBColord c = copy.get_xel(x - xmin + xfrom, y - ymin + yfrom); + LRGBColord o = get_xel(x, y); + LRGBColord p; p.set(min(1.0 - ((1.0 - c[0]) * pixel_scale), o[0]), min(1.0 - ((1.0 - c[1]) * pixel_scale), o[1]), min(1.0 - ((1.0 - c[2]) * pixel_scale), o[2])); @@ -919,9 +919,9 @@ lighten_sub_image(const PNMImage ©, int xto, int yto, int x, y; for (y = ymin; y < ymax; y++) { for (x = xmin; x < xmax; x++) { - RGBColord c = copy.get_xel(x - xmin + xfrom, y - ymin + yfrom); - RGBColord o = get_xel(x, y); - RGBColord p; + LRGBColord c = copy.get_xel(x - xmin + xfrom, y - ymin + yfrom); + LRGBColord o = get_xel(x, y); + LRGBColord p; p.set(max(c[0] * pixel_scale, o[0]), max(c[1] * pixel_scale, o[1]), max(c[2] * pixel_scale, o[2])); @@ -1132,7 +1132,7 @@ copy_channel(const PNMImage ©, int xto, int yto, int cto, // between fg and bg colors. //////////////////////////////////////////////////////////////////// void PNMImage:: -render_spot(const Colord &fg, const Colord &bg, +render_spot(const LColord &fg, const LColord &bg, double min_radius, double max_radius) { if (_x_size == 0 || _y_size == 0) { return; @@ -1184,14 +1184,14 @@ render_spot(const Colord &fg, const Colord &bg, } else { // This pixel is in a feathered area or along the antialiased edge. - Colord c_outer, c_inner, c_a, c_b; + LColord c_outer, c_inner, c_a, c_b; compute_spot_pixel(c_outer, d2_outer, min_radius, max_radius, fg, bg); compute_spot_pixel(c_inner, d2_inner, min_radius, max_radius, fg, bg); compute_spot_pixel(c_a, d2_a, min_radius, max_radius, fg, bg); compute_spot_pixel(c_b, d2_b, min_radius, max_radius, fg, bg); // Now average all four pixels for the antialiased result. - Colord c; + LColord c; c = (c_outer + c_inner + c_a + c_b) * 0.25; set_xel_a(x_center1 - 1 - xi, y_center1 - 1 - yi, c); @@ -1215,7 +1215,7 @@ render_spot(const Colord &fg, const Colord &bg, //////////////////////////////////////////////////////////////////// void PNMImage:: expand_border(int left, int right, int bottom, int top, - const Colord &color) { + const LColord &color) { PNMImage new_image(get_x_size() + left + right, get_y_size() + bottom + top, get_num_channels(), get_maxval(), get_type()); @@ -1323,9 +1323,9 @@ setup_rc() { // Description: Returns the average color of all of the pixels // in the image. //////////////////////////////////////////////////////////////////// -RGBColord PNMImage:: +LRGBColord PNMImage:: get_average_xel() const { - RGBColord color (RGBColord::zero()); + LRGBColord color (LRGBColord::zero()); if (_x_size == 0 || _y_size == 0) { return color; } @@ -1347,9 +1347,9 @@ get_average_xel() const { // Description: Returns the average color of all of the pixels // in the image, including the alpha channel. //////////////////////////////////////////////////////////////////// -Colord PNMImage:: +LColord PNMImage:: get_average_xel_a() const { - Colord color (Colord::zero()); + LColord color (LColord::zero()); if (_x_size == 0 || _y_size == 0) { return color; } @@ -1462,7 +1462,7 @@ operator += (const PNMImage &other) { // is added to each pixel in the provided image. //////////////////////////////////////////////////////////////////// void PNMImage:: -operator += (const Colord &other) { +operator += (const LColord &other) { size_t array_size = _x_size * _y_size; // Note: don't use to_val here because it clamps values below 0 int add_r = (int)(other.get_x() * get_maxval() + 0.5); @@ -1531,7 +1531,7 @@ operator -= (const PNMImage &other) { // is subtracted from each pixel in the provided image. //////////////////////////////////////////////////////////////////// void PNMImage:: -operator -= (const Colord &other) { +operator -= (const LColord &other) { (*this) += (-other); } diff --git a/panda/src/pnmimage/pnmImage.h b/panda/src/pnmimage/pnmImage.h index 2e59b44593..9529a5dcb1 100644 --- a/panda/src/pnmimage/pnmImage.h +++ b/panda/src/pnmimage/pnmImage.h @@ -152,13 +152,13 @@ PUBLISHED: // automatically scale their values by get_maxval() into the range // [0..1]. - INLINE RGBColord get_xel(int x, int y) const; - INLINE void set_xel(int x, int y, const RGBColord &value); + INLINE LRGBColord get_xel(int x, int y) const; + INLINE void set_xel(int x, int y, const LRGBColord &value); INLINE void set_xel(int x, int y, double r, double g, double b); INLINE void set_xel(int x, int y, double gray); - INLINE Colord get_xel_a(int x, int y) const; - INLINE void set_xel_a(int x, int y, const Colord &value); + INLINE LColord get_xel_a(int x, int y) const; + INLINE void set_xel_a(int x, int y, const LColord &value); INLINE void set_xel_a(int x, int y, double r, double g, double b, double a); INLINE double get_red(int x, int y) const; @@ -182,7 +182,7 @@ PUBLISHED: INLINE double get_bright(int x, int y, double rc, double gc, double bc, double ac) const; - INLINE void blend(int x, int y, const RGBColord &val, double alpha); + INLINE void blend(int x, int y, const LRGBColord &val, double alpha); void blend(int x, int y, double r, double g, double b, double alpha); // If you're used to the NetPBM library and like working with a 2-d @@ -214,11 +214,11 @@ PUBLISHED: int xfrom = 0, int yfrom = 0, int cfrom = 0, int x_size = -1, int y_size = -1); - void render_spot(const Colord &fg, const Colord &bg, + void render_spot(const LColord &fg, const LColord &bg, double min_radius, double max_radius); void expand_border(int left, int right, int bottom, int top, - const Colord &color); + const LColord &color); // The bodies for the non-inline *_filter() functions can be found // in the file pnm-image-filter.cxx. @@ -236,8 +236,8 @@ PUBLISHED: unsigned long seed = 0); void perlin_noise_fill(StackedPerlinNoise2 &perlin); - RGBColord get_average_xel() const; - Colord get_average_xel_a() const; + LRGBColord get_average_xel() const; + LColord get_average_xel_a() const; double get_average_gray() const; private: @@ -251,9 +251,9 @@ private: int &xfrom, int &yfrom, int &x_size, int &y_size, int &xmin, int &ymin, int &xmax, int &ymax); - INLINE static void compute_spot_pixel(Colord &c, double d2, + INLINE static void compute_spot_pixel(LColord &c, double d2, double min_radius, double max_radius, - const Colord &fg, const Colord &bg); + const LColord &fg, const LColord &bg); void setup_rc(); @@ -261,15 +261,15 @@ PUBLISHED: PNMImage operator ~() const; INLINE PNMImage operator + (const PNMImage &other) const; - INLINE PNMImage operator + (const Colord &other) const; + INLINE PNMImage operator + (const LColord &other) const; INLINE PNMImage operator - (const PNMImage &other) const; - INLINE PNMImage operator - (const Colord &other) const; + INLINE PNMImage operator - (const LColord &other) const; INLINE PNMImage operator * (const PNMImage &other) const; INLINE PNMImage operator * (double multiplier) const; void operator += (const PNMImage &other); - void operator += (const Colord &other); + void operator += (const LColord &other); void operator -= (const PNMImage &other); - void operator -= (const Colord &other); + void operator -= (const LColord &other); void operator *= (const PNMImage &other); void operator *= (double multiplier); diff --git a/panda/src/pnmimage/pnmPainter.cxx b/panda/src/pnmimage/pnmPainter.cxx index 0fb9cecd2d..7b4ec50ea9 100644 --- a/panda/src/pnmimage/pnmPainter.cxx +++ b/panda/src/pnmimage/pnmPainter.cxx @@ -36,8 +36,8 @@ PNMPainter(PNMImage &image, int xo, int yo) : _image(image), _xo(xo), _yo(yo) { - _pen = PNMBrush::make_pixel(Colord(0, 0, 0, 1)); - _fill = PNMBrush::make_pixel(Colord(1, 1, 1, 1)); + _pen = PNMBrush::make_pixel(LColord(0, 0, 0, 1)); + _fill = PNMBrush::make_pixel(LColord(1, 1, 1, 1)); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/pnmtext/pnmTextGlyph.cxx b/panda/src/pnmtext/pnmTextGlyph.cxx index 309d773c97..58ae6848a6 100644 --- a/panda/src/pnmtext/pnmTextGlyph.cxx +++ b/panda/src/pnmtext/pnmTextGlyph.cxx @@ -54,7 +54,7 @@ place(PNMImage &dest_image, int xp, int yp, const LColor &fg) { // If we have no image, do nothing. return; } - RGBColord fg_rgb(fg[0], fg[1], fg[2]); + LRGBColord fg_rgb(fg[0], fg[1], fg[2]); double fg_alpha = fg[3]; int left = xp + _left; @@ -78,7 +78,7 @@ place(PNMImage &dest_image, int xp, int yp, const LColor &fg) { } } else if (gval > 0.0) { - RGBColord bg_rgb = dest_image.get_xel(x, y); + LRGBColord bg_rgb = dest_image.get_xel(x, y); dest_image.set_xel(x, y, fg_rgb * gval + bg_rgb * (1.0 - gval)); if (dest_image.has_alpha()) { double bg_alpha = dest_image.get_alpha(x, y); @@ -103,9 +103,9 @@ place(PNMImage &dest_image, int xp, int yp, const LColor &fg, // If we have no image, do nothing. return; } - RGBColord fg_rgb(fg[0], fg[1], fg[2]); + LRGBColord fg_rgb(fg[0], fg[1], fg[2]); double fg_alpha = fg[3]; - RGBColord interior_rgb(interior[0], interior[1], interior[2]); + LRGBColord interior_rgb(interior[0], interior[1], interior[2]); double interior_alpha = interior[3]; int left = xp + _left; @@ -130,7 +130,7 @@ place(PNMImage &dest_image, int xp, int yp, const LColor &fg, } else if (gval > 0.0) { bool is_interior = get_interior_flag(x - left, y - top); - RGBColord bg_rgb; + LRGBColord bg_rgb; if (is_interior) { bg_rgb = interior_rgb; } else { diff --git a/panda/src/putil/config_util.N b/panda/src/putil/config_util.N index 4d1474fba6..e5fa86c80b 100644 --- a/panda/src/putil/config_util.N +++ b/panda/src/putil/config_util.N @@ -11,20 +11,9 @@ ignoremember rend ignoreinvolved __reserve_t forcetype DoubleBitMaskNative -renametype DoubleBitMaskNative DoubleBitMaskNative forcetype QuadBitMaskNative -renametype QuadBitMaskNative QuadBitMaskNative - -forcetype PointerToBase > -forcetype PointerToArrayBase -forcetype PointerToArray -forcetype ConstPointerToArray -renametype PointerToArray PTADouble -renametype ConstPointerToArray CPTADouble forcetype PointerToBase > forcetype PointerToArrayBase -forcetype PointerToArray -forcetype ConstPointerToArray -renametype PointerToArray PTAUshort -renametype ConstPointerToArray CPTAUshort +forcetype PTA_ushort +forcetype CPTA_ushort diff --git a/panda/src/putil/typedWritable.cxx b/panda/src/putil/typedWritable.cxx index e34f590377..44c3ffa67b 100644 --- a/panda/src/putil/typedWritable.cxx +++ b/panda/src/putil/typedWritable.cxx @@ -194,9 +194,9 @@ __reduce_persist__(PyObject *self, PyObject *pickler) const { // (e.g. this), and the arguments necessary to reconstruct this // object. - // Check that we have a decodeFromBamStream python method. If not, + // Check that we have a decode_from_bam_stream python method. If not, // we can't use this interface. - PyObject *method = PyObject_GetAttrString(self, "decodeFromBamStream"); + PyObject *method = PyObject_GetAttrString(self, "decode_from_bam_stream"); if (method == NULL) { ostringstream stream; stream << "Cannot pickle objects of type " << get_type() << "\n"; @@ -239,9 +239,9 @@ __reduce_persist__(PyObject *self, PyObject *pickler) const { // The modified pickle support: call the "persistent" version of // this function, which receives the unpickler itself as an // additional parameter. - func = find_global_decode(this_class, "pyDecodeTypedWritableFromBamStreamPersist"); + func = find_global_decode(this_class, "py_decode_TypedWritable_from_bam_stream_persist"); if (func == NULL) { - PyErr_SetString(PyExc_TypeError, "Couldn't find pyDecodeTypedWritableFromBamStreamPersist()"); + PyErr_SetString(PyExc_TypeError, "Couldn't find py_decode_TypedWritable_from_bam_stream_persist()"); Py_DECREF(this_class); return NULL; } @@ -250,9 +250,9 @@ __reduce_persist__(PyObject *self, PyObject *pickler) const { // The traditional pickle support: call the non-persistent version // of this function. - func = find_global_decode(this_class, "pyDecodeTypedWritableFromBamStream"); + func = find_global_decode(this_class, "py_decode_TypedWritable_from_bam_stream"); if (func == NULL) { - PyErr_SetString(PyExc_TypeError, "Couldn't find pyDecodeTypedWritableFromBamStream()"); + PyErr_SetString(PyExc_TypeError, "Couldn't find py_decode_TypedWritable_from_bam_stream()"); Py_DECREF(this_class); return NULL; } @@ -432,11 +432,11 @@ decode_raw_from_bam_stream(TypedWritable *&ptr, ReferenceCount *&ref_ptr, // Access: Public, Static // Description: This is a support function for __reduce__(). It // searches for the global function -// pyDecodeTypedWritableFromBamStream() in this class's -// module, or in the module for any base class. (It's -// really looking for the libpanda module, but we can't -// be sure what name that module was loaded under, so we -// search upwards this way.) +// py_decode_TypedWritable_from_bam_stream() in this +// class's module, or in the module for any base class. +// (It's really looking for the libpanda module, but we +// can't be sure what name that module was loaded under, +// so we search upwards this way.) // // Returns: new reference on success, or NULL on failure. //////////////////////////////////////////////////////////////////// @@ -534,7 +534,7 @@ py_decode_TypedWritable_from_bam_stream_persist(PyObject *pickler, PyObject *thi // the specific object's class as the pointer, we get the particular // instance of decode_from_bam_stream appropriate to this class. - PyObject *func = PyObject_GetAttrString(this_class, "decodeFromBamStream"); + PyObject *func = PyObject_GetAttrString(this_class, "decode_from_bam_stream"); if (func == NULL) { return NULL; } diff --git a/pandatool/src/daeegg/daeToEggConverter.cxx b/pandatool/src/daeegg/daeToEggConverter.cxx index f0e6de067b..e5ff4dfed0 100755 --- a/pandatool/src/daeegg/daeToEggConverter.cxx +++ b/pandatool/src/daeegg/daeToEggConverter.cxx @@ -442,7 +442,7 @@ void DAEToEggConverter::process_mesh(PT(EggGroup) parent, const FCDGeometryMesh* data = &bsource->GetData()[bindices[ix]*3]; PT(EggVertexUV) uv_obj = vertex->modify_uv_obj(tbsetname); if (uv_obj == NULL) { - uv_obj = new EggVertexUV(tbsetname, TexCoordd()); + uv_obj = new EggVertexUV(tbsetname, LTexCoordd()); } uv_obj->set_binormal(LVecBase3d(data[0], data[1], data[2])); } @@ -451,7 +451,7 @@ void DAEToEggConverter::process_mesh(PT(EggGroup) parent, const FCDGeometryMesh* data = &tsource->GetData()[tindices[ix]*3]; PT(EggVertexUV) uv_obj = vertex->modify_uv_obj(ttsetname); if (uv_obj == NULL) { - uv_obj = new EggVertexUV(ttsetname, TexCoordd()); + uv_obj = new EggVertexUV(ttsetname, LTexCoordd()); } uv_obj->set_tangent(LVecBase3d(data[0], data[1], data[2])); } diff --git a/pandatool/src/egg-mkfont/eggMakeFont.cxx b/pandatool/src/egg-mkfont/eggMakeFont.cxx index 2806d39785..36a5e04acc 100644 --- a/pandatool/src/egg-mkfont/eggMakeFont.cxx +++ b/pandatool/src/egg-mkfont/eggMakeFont.cxx @@ -551,10 +551,10 @@ make_geom(PNMTextGlyph *glyph, int character) { EggVertex *v3 = make_vertex(LPoint2d(right, top)); EggVertex *v4 = make_vertex(LPoint2d(left, top)); - v1->set_uv(TexCoordd(uv_left, uv_bottom)); - v2->set_uv(TexCoordd(uv_right, uv_bottom)); - v3->set_uv(TexCoordd(uv_right, uv_top)); - v4->set_uv(TexCoordd(uv_left, uv_top)); + v1->set_uv(LTexCoordd(uv_left, uv_bottom)); + v2->set_uv(LTexCoordd(uv_right, uv_bottom)); + v3->set_uv(LTexCoordd(uv_right, uv_top)); + v4->set_uv(LTexCoordd(uv_left, uv_top)); EggPolygon *poly = new EggPolygon(); group->add_child(poly); diff --git a/pandatool/src/egg-qtess/qtessSurface.cxx b/pandatool/src/egg-qtess/qtessSurface.cxx index 97bcbc16cf..c3d77fe85d 100644 --- a/pandatool/src/egg-qtess/qtessSurface.cxx +++ b/pandatool/src/egg-qtess/qtessSurface.cxx @@ -433,7 +433,7 @@ do_uniform_tesselate(int &tris) const { // Also collect the vertices into this set to group them by spatial // position only. This is relevant for calculating normals. typedef pset NVertexGroup; - typedef pmap NVertexCollection; + typedef pmap NVertexCollection; NVertexCollection n_collection; for (vi = 0; vi < num_v; vi++) { @@ -489,7 +489,7 @@ do_uniform_tesselate(int &tris) const { // Calculate the normal these vertices should have based on the // polygons that share it. - Normald normal = Normald::zero(); + LNormald normal = LNormald::zero(); int num_polys = 0; NVertexGroup::const_iterator ngi; for (ngi = group.begin(); ngi != group.end(); ++ngi) { diff --git a/pandatool/src/eggprogs/eggTextureCards.cxx b/pandatool/src/eggprogs/eggTextureCards.cxx index bdc4dfbec1..90fe0adb3a 100644 --- a/pandatool/src/eggprogs/eggTextureCards.cxx +++ b/pandatool/src/eggprogs/eggTextureCards.cxx @@ -375,10 +375,10 @@ make_vertices(const LPoint4d &geometry, EggVertexPool *vpool, v4 = vpool->make_new_vertex (LPoint3d(geometry[1], geometry[3], 0.0)); - v1->set_uv(TexCoordd(0.0, 1.0)); - v2->set_uv(TexCoordd(0.0, 0.0)); - v3->set_uv(TexCoordd(1.0, 0.0)); - v4->set_uv(TexCoordd(1.0, 1.0)); + v1->set_uv(LTexCoordd(0.0, 1.0)); + v2->set_uv(LTexCoordd(0.0, 0.0)); + v3->set_uv(LTexCoordd(1.0, 0.0)); + v4->set_uv(LTexCoordd(1.0, 1.0)); } //////////////////////////////////////////////////////////////////// diff --git a/pandatool/src/eggprogs/eggToC.cxx b/pandatool/src/eggprogs/eggToC.cxx index b28d44546f..66131adee8 100644 --- a/pandatool/src/eggprogs/eggToC.cxx +++ b/pandatool/src/eggprogs/eggToC.cxx @@ -208,7 +208,7 @@ write_vertex_pool(EggVertexPool *vpool) { if (vert == (EggVertex *)NULL || !vert->has_uv()) { out << " uv(), /* " << i << " */\n"; } else { - TexCoordd uv = vert->get_uv(); + LTexCoordd uv = vert->get_uv(); out << " uv(" << uv[0] << ", " << uv[1] << "), /* " << i << " */\n"; } @@ -225,7 +225,7 @@ write_vertex_pool(EggVertexPool *vpool) { if (vert == (EggVertex *)NULL || !vert->has_normal()) { out << " normal(), /* " << i << " */\n"; } else { - Normald n = vert->get_normal(); + LNormald n = vert->get_normal(); out << " normal(" << n[0] << ", " << n[1] << ", " << n[2] << "), /* " << i << " */\n"; } @@ -334,7 +334,7 @@ write_bin(EggBin *bin) { if (!prim->has_normal()) { out << " normal(), /* " << prim_index << " */\n"; } else { - Normald n = prim->get_normal(); + LNormald n = prim->get_normal(); out << " normal(" << n[0] << ", " << n[1] << ", " << n[2] << "), /* " << prim_index << " */\n"; } diff --git a/pandatool/src/imageprogs/imageFixHiddenColor.cxx b/pandatool/src/imageprogs/imageFixHiddenColor.cxx index b867b440dc..f8622843ae 100644 --- a/pandatool/src/imageprogs/imageFixHiddenColor.cxx +++ b/pandatool/src/imageprogs/imageFixHiddenColor.cxx @@ -110,7 +110,7 @@ run() { // First, get the average color of all the opaque pixels. int count = 0; - RGBColord color(0.0, 0.0, 0.0); + LRGBColord color(0.0, 0.0, 0.0); int xi, yi; for (yi = 0; yi < _image.get_y_size(); ++yi) { for (xi = 0; xi < _image.get_x_size(); ++xi) { diff --git a/pandatool/src/imageprogs/imageTrans.cxx b/pandatool/src/imageprogs/imageTrans.cxx index 321f139124..47cd0c6851 100644 --- a/pandatool/src/imageprogs/imageTrans.cxx +++ b/pandatool/src/imageprogs/imageTrans.cxx @@ -91,7 +91,7 @@ run() { _color_scale[2] != 1.0f) { for (int yi = 0; yi < _image.get_y_size(); ++yi) { for (int xi = 0; xi < _image.get_x_size(); ++xi) { - RGBColord rgb = _image.get_xel(xi, yi); + LRGBColord rgb = _image.get_xel(xi, yi); _image.set_xel(xi, yi, rgb[0] * _color_scale[0], rgb[1] * _color_scale[1], diff --git a/pandatool/src/imageprogs/imageTransformColors.cxx b/pandatool/src/imageprogs/imageTransformColors.cxx index f0f5d7af88..5e1b73b060 100644 --- a/pandatool/src/imageprogs/imageTransformColors.cxx +++ b/pandatool/src/imageprogs/imageTransformColors.cxx @@ -402,8 +402,8 @@ hue2rgb(double m1, double m2, double h) { return m1; } -static RGBColord -hls2rgb(const RGBColord &hls) { +static LRGBColord +hls2rgb(const LRGBColord &hls) { double h = hls[0]; double l = max(min(hls[1], 1.0), 0.0); double s = max(min(hls[2], 1.0), 0.0); @@ -416,14 +416,14 @@ hls2rgb(const RGBColord &hls) { } double m1 = l * 2 - m2; - RGBColord rgb(hue2rgb(m1, m2, h + 1.0/3.0), + LRGBColord rgb(hue2rgb(m1, m2, h + 1.0/3.0), hue2rgb(m1, m2, h), hue2rgb(m1, m2, h - 1.0/3.0)); return rgb; } -static RGBColord -rgb2hls(const RGBColord &rgb) { +static LRGBColord +rgb2hls(const LRGBColord &rgb) { double r = rgb[0]; double g = rgb[1]; double b = rgb[2]; @@ -438,7 +438,7 @@ rgb2hls(const RGBColord &rgb) { l = 0.5 * msum; if (maxval == minval) { // Grayscale. - return RGBColord(0.0, l, 0.0); + return LRGBColord(0.0, l, 0.0); } rnorm = (maxval - r) / mdiff; @@ -463,7 +463,7 @@ rgb2hls(const RGBColord &rgb) { h -= 1.0; } - return RGBColord(h, l, s); + return LRGBColord(h, l, s); } //////////////////////////////////////////////////////////////////// @@ -476,7 +476,7 @@ process_image(PNMImage &image) { if (_hls) { for (int yi = 0; yi < image.get_y_size(); ++yi) { for (int xi = 0; xi < image.get_x_size(); ++xi) { - RGBColord rgb = image.get_xel(xi, yi); + LRGBColord rgb = image.get_xel(xi, yi); rgb = hls2rgb(_mat.xform_point(rgb2hls(rgb))); image.set_xel(xi, yi, rgb); } @@ -484,7 +484,7 @@ process_image(PNMImage &image) { } else { for (int yi = 0; yi < image.get_y_size(); ++yi) { for (int xi = 0; xi < image.get_x_size(); ++xi) { - RGBColord rgb = image.get_xel(xi, yi); + LRGBColord rgb = image.get_xel(xi, yi); rgb = _mat.xform_point(rgb); image.set_xel(xi, yi, rgb); } diff --git a/pandatool/src/maxegg/maxEggLoader.cxx b/pandatool/src/maxegg/maxEggLoader.cxx index 2486daebfc..4932afb4b5 100755 --- a/pandatool/src/maxegg/maxEggLoader.cxx +++ b/pandatool/src/maxegg/maxEggLoader.cxx @@ -302,8 +302,8 @@ typedef pair MaxEggWeight; struct MaxEggVertex { - Vertexd _pos; - Normald _normal; + LVertexd _pos; + LNormald _normal; vector _weights; int _index; }; @@ -339,7 +339,7 @@ struct MEV_Compare: public stl_hash_compare }; typedef phash_set VertTable; -typedef phash_map TVertTable; +typedef phash_map TVertTable; typedef phash_map CVertTable; class MaxEggMesh @@ -364,7 +364,7 @@ public: CVertTable _cvert_tab; int GetVert(EggVertex *vert, EggGroup *context); - int GetTVert(TexCoordd uv); + int GetTVert(LTexCoordd uv); int GetCVert(LColor col); int AddFace(int v0, int v1, int v2, int tv0, int tv1, int tv2, int cv0, int cv1, int cv2, int tex); EggGroup *GetControlJoint(void); @@ -404,7 +404,7 @@ int MaxEggMesh::GetVert(EggVertex *vert, EggGroup *context) return vtx._index; } -int MaxEggMesh::GetTVert(TexCoordd uv) +int MaxEggMesh::GetTVert(LTexCoordd uv) { if (_tvert_tab.count(uv)) return _tvert_tab[uv]; @@ -589,7 +589,7 @@ void MaxEggLoader::TraverseEggNode(EggNode *node, EggGroup *context) for (ci = poly->begin(); ci != poly->end(); ++ci) { EggVertex *vtx = (*ci); EggVertexPool *pool = poly->get_pool(); - TexCoordd uv = vtx->get_uv(); + LTexCoordd uv = vtx->get_uv(); vertIndices.push_back(mesh->GetVert(vtx, context)); tvertIndices.push_back(mesh->GetTVert(uv * uvtrans)); cvertIndices.push_back(mesh->GetCVert(vtx->get_color())); diff --git a/pandatool/src/maxegg/maxToEggConverter.cxx b/pandatool/src/maxegg/maxToEggConverter.cxx index 3a31952583..f50292db09 100755 --- a/pandatool/src/maxegg/maxToEggConverter.cxx +++ b/pandatool/src/maxegg/maxToEggConverter.cxx @@ -698,7 +698,7 @@ make_polyset(INode *max_node, Mesh *mesh, //since the channel will always be one because there's //no other textures then don't bother with the name UVVert uvw = get_max_vertex_texcoord(mesh, iFace, iVertex, 1); - vert.set_uv( TexCoordd(uvw.x, uvw.y)); + vert.set_uv( LTexCoordd(uvw.x, uvw.y)); } //otherwise go through and generate the maps per channel //this will also generate default UV's as long @@ -710,9 +710,9 @@ make_polyset(INode *max_node, Mesh *mesh, UVVert uvw = get_max_vertex_texcoord(mesh, iFace, iVertex, channel); // changes allow the first channel to be swapped if(channel == 1) - vert.set_uv( TexCoordd(uvw.x, uvw.y)); + vert.set_uv( LTexCoordd(uvw.x, uvw.y)); else - vert.set_uv( uvname.str(), TexCoordd(uvw.x, uvw.y)); + vert.set_uv( uvname.str(), LTexCoordd(uvw.x, uvw.y)); } diff --git a/pandatool/src/maya/mayaShader.h b/pandatool/src/maya/mayaShader.h index 193c368a24..7b3d3d75ab 100644 --- a/pandatool/src/maya/mayaShader.h +++ b/pandatool/src/maya/mayaShader.h @@ -52,7 +52,7 @@ public: public: // relevant only to modern mode. - Colord _flat_color; + LColord _flat_color; MayaShaderColorList _color_maps; MayaShaderColorList _trans_maps; diff --git a/pandatool/src/maya/mayaShaderColorDef.cxx b/pandatool/src/maya/mayaShaderColorDef.cxx index c38a3cc767..2d75f6bd6a 100644 --- a/pandatool/src/maya/mayaShaderColorDef.cxx +++ b/pandatool/src/maya/mayaShaderColorDef.cxx @@ -181,9 +181,9 @@ has_projection() const { // are closed up by ensuring the point is in the same // quadrant as the indicated reference point. //////////////////////////////////////////////////////////////////// -TexCoordd MayaShaderColorDef:: +LTexCoordd MayaShaderColorDef:: project_uv(const LPoint3d &pos, const LPoint3d ¢roid) const { - nassertr(_map_uvs != NULL, TexCoordd::zero()); + nassertr(_map_uvs != NULL, LTexCoordd::zero()); return (this->*_map_uvs)(pos * _projection_matrix, centroid * _projection_matrix); } diff --git a/pandatool/src/maya/mayaShaderColorDef.h b/pandatool/src/maya/mayaShaderColorDef.h index b56c0899b4..127b079445 100755 --- a/pandatool/src/maya/mayaShaderColorDef.h +++ b/pandatool/src/maya/mayaShaderColorDef.h @@ -45,7 +45,7 @@ public: LMatrix3d compute_texture_matrix() const; bool has_projection() const; - TexCoordd project_uv(const LPoint3d &pos, const LPoint3d &ref_point) const; + LTexCoordd project_uv(const LPoint3d &pos, const LPoint3d &ref_point) const; bool reset_maya_texture(const Filename &texture); void write(ostream &out) const; @@ -150,7 +150,7 @@ private: public: bool _has_texture; // deprecated, see above. bool _has_flat_color; // deprecated, see above. - Colord _flat_color; // deprecated, see above. + LColord _flat_color; // deprecated, see above. bool _has_alpha_channel; // deprecated, see above. bool _keep_color; // deprecated, see above. bool _keep_alpha; // deprecated, see above. diff --git a/pandatool/src/mayaegg/mayaEggLoader.cxx b/pandatool/src/mayaegg/mayaEggLoader.cxx index d6003c8a91..ebc3102e5d 100755 --- a/pandatool/src/mayaegg/mayaEggLoader.cxx +++ b/pandatool/src/mayaegg/mayaEggLoader.cxx @@ -642,9 +642,9 @@ typedef pair MayaEggWeight; struct MayaEggVertex { - Vertexd _pos; - Normald _normal; - TexCoordd _uv; + LVertexd _pos; + LNormald _normal; + LTexCoordd _uv; vector _weights; double _sumWeights; // [gjeon] to be used in normalizing weights int _index; @@ -929,7 +929,7 @@ void MayaEggGeom::AddEggFlag(MString fieldName) { // MayaEggMesh // //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef phash_map TVertTable; +typedef phash_map TVertTable; typedef phash_map CVertTable; class MayaEggMesh : public MayaEggGeom @@ -952,14 +952,14 @@ public: TVertTable _tvert_tab; CVertTable _cvert_tab; - int GetTVert(TexCoordd uv); + int GetTVert(LTexCoordd uv); int GetCVert(LColor col); int AddFace(unsigned numVertices, MIntArray mvertIndices, MIntArray mtvertIndices, MayaEggTex *tex); void ConnectTextures(void); }; -int MayaEggMesh::GetTVert(TexCoordd uv) +int MayaEggMesh::GetTVert(LTexCoordd uv) { if (_tvert_tab.count(uv)) { if (mayaloader_cat.is_spam()) { @@ -1412,7 +1412,7 @@ void MayaEggLoader::TraverseEggNode(EggNode *node, EggGroup *context, string del for (ci = poly->begin(); ci != poly->end(); ++ci) { EggVertex *vtx = (*ci); EggVertexPool *pool = poly->get_pool(); - TexCoordd uv(0,0); + LTexCoordd uv(0,0); if (vtx->has_uv()) { uv = vtx->get_uv(); } diff --git a/pandatool/src/mayaegg/mayaToEggConverter.cxx b/pandatool/src/mayaegg/mayaToEggConverter.cxx index f4813f70d6..c70c40c518 100644 --- a/pandatool/src/mayaegg/mayaToEggConverter.cxx +++ b/pandatool/src/mayaegg/mayaToEggConverter.cxx @@ -1939,7 +1939,7 @@ make_polyset(MayaNodeDesc *node_desc, const MDagPath &dag_path, if (!status) { status.perror("MItMeshPolygon::getNormal"); } else { - Normald n3d(n[0], n[1], n[2]); + LNormald n3d(n[0], n[1], n[2]); n3d = n3d * vertex_frame_inv; vert.set_normal(n3d); } @@ -1968,7 +1968,7 @@ make_polyset(MayaNodeDesc *node_desc, const MDagPath &dag_path, bool keep_uv = keep_all_uvsets; bool project_uv = false; - TexCoordd uv_projection; + LTexCoordd uv_projection; if (shader != (MayaShader *)NULL) { for (size_t tj = 0; tj < shader->_all_maps.size(); ++tj) { @@ -2023,7 +2023,7 @@ make_polyset(MayaNodeDesc *node_desc, const MDagPath &dag_path, mayaegg_cat.debug() << "after rounding uvs[1]: " << uvs[1] << endl; } } - vert.set_uv(panda_uvset_name, TexCoordd(uvs[0], uvs[1])); + vert.set_uv(panda_uvset_name, LTexCoordd(uvs[0], uvs[1])); } } } @@ -2042,7 +2042,7 @@ make_polyset(MayaNodeDesc *node_desc, const MDagPath &dag_path, } // Also get the face normal for the polygon. - Normald face_normal; + LNormald face_normal; bool got_face_normal = false; MVector n; @@ -2060,7 +2060,7 @@ make_polyset(MayaNodeDesc *node_desc, const MDagPath &dag_path, // direction of the normals. If not, reverse the vertex ordering // (since we have seen cases where Maya sets this in contradiction // to its normals). - Normald order_normal; + LNormald order_normal; if (got_face_normal && egg_poly->calculate_normal(order_normal)) { if (order_normal.dot(face_normal) < 0.0) { egg_poly->reverse_vertex_ordering(); @@ -3168,7 +3168,7 @@ set_vertex_color_modern(EggVertex &vert, MItMeshPolygon &pi, int vert_index, con // If there's no explicit color, use flat color, or white on a textured model. if (shader->_color_maps.empty()) { - const Colord &c = shader->_flat_color; + const LColord &c = shader->_flat_color; vert.set_color(LColor((PN_stdfloat)c[0], (PN_stdfloat)c[1], (PN_stdfloat)c[2], (PN_stdfloat)c[3])); } else { //there's no explicit color anywhere, must be textured (or blank) diff --git a/pandatool/src/objegg/objToEggConverter.cxx b/pandatool/src/objegg/objToEggConverter.cxx index 4e54ce10b2..d64100f6e9 100755 --- a/pandatool/src/objegg/objToEggConverter.cxx +++ b/pandatool/src/objegg/objToEggConverter.cxx @@ -262,7 +262,7 @@ process_vt(vector_string &words) { } bool okflag = true; - TexCoord3d uvw; + LTexCoord3d uvw; okflag &= string_to_double(words[1], uvw[0]); okflag &= string_to_double(words[2], uvw[1]); if (words.size() == 4) { @@ -279,7 +279,7 @@ process_vt(vector_string &words) { if (words.size() == 4) { vertex->set_uvw("", uvw); } else { - vertex->set_uv("", TexCoordd(uvw[0], uvw[1])); + vertex->set_uv("", LTexCoordd(uvw[0], uvw[1])); } ++_vti; diff --git a/pandatool/src/palettizer/paletteImage.cxx b/pandatool/src/palettizer/paletteImage.cxx index 36a42c9e7d..8676ec1409 100644 --- a/pandatool/src/palettizer/paletteImage.cxx +++ b/pandatool/src/palettizer/paletteImage.cxx @@ -93,7 +93,7 @@ operator = (const PaletteImage::ClearedRegion ©) { //////////////////////////////////////////////////////////////////// void PaletteImage::ClearedRegion:: clear(PNMImage &image) { - RGBColord rgb(pal->_background[0], pal->_background[1], pal->_background[2]); + LRGBColord rgb(pal->_background[0], pal->_background[1], pal->_background[2]); double alpha = pal->_background[3]; for (int y = _y; y < _y + _y_size; y++) { diff --git a/pandatool/src/palettizer/palettizer.h b/pandatool/src/palettizer/palettizer.h index 9fecacd99b..308093dff5 100644 --- a/pandatool/src/palettizer/palettizer.h +++ b/pandatool/src/palettizer/palettizer.h @@ -105,7 +105,7 @@ public: Filename _shadow_dirname; Filename _rel_dirname; int _pal_x_size, _pal_y_size; - Colord _background; + LColord _background; int _margin; bool _omit_solitary; bool _omit_everything; diff --git a/pandatool/src/palettizer/texturePlacement.cxx b/pandatool/src/palettizer/texturePlacement.cxx index 816139f6e6..9ca5c286d4 100644 --- a/pandatool/src/palettizer/texturePlacement.cxx +++ b/pandatool/src/palettizer/texturePlacement.cxx @@ -249,14 +249,14 @@ determine_size() { _position._wrap_u = EggTexture::WM_clamp; _position._wrap_v = EggTexture::WM_clamp; - TexCoordd max_uv, min_uv; + LTexCoordd max_uv, min_uv; References::iterator ri; for (ri = _references.begin(); ri != _references.end(); ++ri) { TextureReference *reference = (*ri); if (reference->has_uvs()) { - const TexCoordd &n = reference->get_min_uv(); - const TexCoordd &x = reference->get_max_uv(); + const LTexCoordd &n = reference->get_min_uv(); + const LTexCoordd &x = reference->get_max_uv(); if (_has_uvs) { min_uv.set(min(min_uv[0], n[0]), min(min_uv[1], n[1])); @@ -293,8 +293,8 @@ determine_size() { return false; } - TexCoordd rounded_min_uv = min_uv; - TexCoordd rounded_max_uv = max_uv; + LTexCoordd rounded_min_uv = min_uv; + LTexCoordd rounded_max_uv = max_uv; //cout << get_name() << endl; @@ -485,7 +485,7 @@ get_uv_area() const { return 0.0; } - TexCoordd range = _position._max_uv - _position._min_uv; + LTexCoordd range = _position._max_uv - _position._min_uv; return range[0] * range[1]; } @@ -588,7 +588,7 @@ get_placed_y_size() const { double TexturePlacement:: get_placed_uv_area() const { nassertr(is_placed(), 0); - TexCoordd range = _placed._max_uv - _placed._min_uv; + LTexCoordd range = _placed._max_uv - _placed._min_uv; return range[0] * range[1]; } @@ -702,7 +702,7 @@ compute_tex_matrix(LMatrix3d &transform) { LMatrix3d source_uvs = LMatrix3d::ident_mat(); - TexCoordd range = _placed._max_uv - _placed._min_uv; + LTexCoordd range = _placed._max_uv - _placed._min_uv; if (range[0] != 0.0 && range[1] != 0.0) { source_uvs = LMatrix3d::translate_mat(-_placed._min_uv) * @@ -807,8 +807,8 @@ fill_image(PNMImage &image) { LMatrix3d transform; compute_tex_matrix(transform); - TexCoordd ul = TexCoordd(0.0, 1.0) * transform; - TexCoordd lr = TexCoordd(1.0, 0.0) * transform; + LTexCoordd ul = LTexCoordd(0.0, 1.0) * transform; + LTexCoordd lr = LTexCoordd(1.0, 0.0) * transform; // Now we convert those texture coordinates back to pixel units. int pal_x_size = _image->get_x_size(); @@ -907,8 +907,8 @@ fill_swapped_image(PNMImage &image, int index) { LMatrix3d transform; compute_tex_matrix(transform); - TexCoordd ul = TexCoordd(0.0, 1.0) * transform; - TexCoordd lr = TexCoordd(1.0, 0.0) * transform; + LTexCoordd ul = LTexCoordd(0.0, 1.0) * transform; + LTexCoordd lr = LTexCoordd(1.0, 0.0) * transform; // Now we convert those texture coordinates back to pixel units. int pal_x_size = _image->get_x_size(); @@ -1021,11 +1021,11 @@ flag_error_image(PNMImage &image) { // size of the source texture). //////////////////////////////////////////////////////////////////// void TexturePlacement:: -compute_size_from_uvs(const TexCoordd &min_uv, const TexCoordd &max_uv) { +compute_size_from_uvs(const LTexCoordd &min_uv, const LTexCoordd &max_uv) { _position._min_uv = min_uv; _position._max_uv = max_uv; - TexCoordd range = _position._max_uv - _position._min_uv; + LTexCoordd range = _position._max_uv - _position._min_uv; //cout << "range: " << range << endl; //cout << "_x_size texture: " << _texture->get_x_size() << endl; diff --git a/pandatool/src/palettizer/texturePlacement.h b/pandatool/src/palettizer/texturePlacement.h index b0a51adae4..2a172e5855 100644 --- a/pandatool/src/palettizer/texturePlacement.h +++ b/pandatool/src/palettizer/texturePlacement.h @@ -98,7 +98,7 @@ public: TextureSwaps _textureSwaps; private: - void compute_size_from_uvs(const TexCoordd &min_uv, const TexCoordd &max_uv); + void compute_size_from_uvs(const LTexCoordd &min_uv, const LTexCoordd &max_uv); TextureImage *_texture; PaletteGroup *_group; diff --git a/pandatool/src/palettizer/texturePosition.h b/pandatool/src/palettizer/texturePosition.h index d64f5bac4c..351cdc6964 100644 --- a/pandatool/src/palettizer/texturePosition.h +++ b/pandatool/src/palettizer/texturePosition.h @@ -41,8 +41,8 @@ public: int _x, _y; int _x_size, _y_size; - TexCoordd _min_uv; - TexCoordd _max_uv; + LTexCoordd _min_uv; + LTexCoordd _max_uv; EggTexture::WrapMode _wrap_u; EggTexture::WrapMode _wrap_v; diff --git a/pandatool/src/palettizer/textureReference.cxx b/pandatool/src/palettizer/textureReference.cxx index 3cce47fef1..1ee7a62d27 100644 --- a/pandatool/src/palettizer/textureReference.cxx +++ b/pandatool/src/palettizer/textureReference.cxx @@ -262,7 +262,7 @@ has_uvs() const { // Description: Returns the minimum UV coordinate in use for the // texture by this reference. //////////////////////////////////////////////////////////////////// -const TexCoordd &TextureReference:: +const LTexCoordd &TextureReference:: get_min_uv() const { nassertr(_any_uvs, _min_uv); return _min_uv; @@ -274,7 +274,7 @@ get_min_uv() const { // Description: Returns the maximum UV coordinate in use for the // texture by this reference. //////////////////////////////////////////////////////////////////// -const TexCoordd &TextureReference:: +const LTexCoordd &TextureReference:: get_max_uv() const { nassertr(_any_uvs, _max_uv); return _max_uv; @@ -547,7 +547,7 @@ write(ostream &out, int indent_level) const { if (_any_uvs) { // Compute the fraction of the image that is covered by the UV's // minmax rectangle. - TexCoordd box = _max_uv - _min_uv; + LTexCoordd box = _max_uv - _min_uv; double area = box[0] * box[1]; out << " coverage " << area; @@ -621,7 +621,7 @@ get_uv_range(EggGroupNode *group, Palettizer::RemapUV remap) { } bool group_any_uvs = false; - TexCoordd group_min_uv, group_max_uv; + LTexCoordd group_min_uv, group_max_uv; EggGroupNode::iterator ci; for (ci = group->begin(); ci != group->end(); ci++) { @@ -665,7 +665,7 @@ get_uv_range(EggGroupNode *group, Palettizer::RemapUV remap) { return false; } else { - TexCoordd geom_min_uv, geom_max_uv; + LTexCoordd geom_min_uv, geom_max_uv; if (get_geom_uvs(geom, geom_min_uv, geom_max_uv)) { if (remap == Palettizer::RU_poly) { @@ -719,7 +719,7 @@ update_uv_range(EggGroupNode *group, Palettizer::RemapUV remap) { } bool group_any_uvs = false; - TexCoordd group_min_uv, group_max_uv; + LTexCoordd group_min_uv, group_max_uv; EggGroupNode::iterator ci; for (ci = group->begin(); ci != group->end(); ci++) { @@ -732,7 +732,7 @@ update_uv_range(EggGroupNode *group, Palettizer::RemapUV remap) { if (remap != Palettizer::RU_never) { EggPrimitive *geom = DCAST(EggPrimitive, child); if (geom->has_texture(_egg_tex)) { - TexCoordd geom_min_uv, geom_max_uv; + LTexCoordd geom_min_uv, geom_max_uv; if (get_geom_uvs(geom, geom_min_uv, geom_max_uv)) { if (remap == Palettizer::RU_poly) { @@ -781,7 +781,7 @@ update_uv_range(EggGroupNode *group, Palettizer::RemapUV remap) { //////////////////////////////////////////////////////////////////// bool TextureReference:: get_geom_uvs(EggPrimitive *geom, - TexCoordd &geom_min_uv, TexCoordd &geom_max_uv) { + LTexCoordd &geom_min_uv, LTexCoordd &geom_max_uv) { string uv_name = _egg_tex->get_uv_name(); bool geom_any_uvs = false; @@ -789,7 +789,7 @@ get_geom_uvs(EggPrimitive *geom, for (pi = geom->begin(); pi != geom->end(); ++pi) { EggVertex *vtx = (*pi); if (vtx->has_uv(uv_name)) { - TexCoordd uv = vtx->get_uv(uv_name) * _tex_mat; + LTexCoordd uv = vtx->get_uv(uv_name) * _tex_mat; collect_uv(geom_any_uvs, geom_min_uv, geom_max_uv, uv, uv); } } @@ -804,7 +804,7 @@ get_geom_uvs(EggPrimitive *geom, // primitive. //////////////////////////////////////////////////////////////////// void TextureReference:: -translate_geom_uvs(EggPrimitive *geom, const TexCoordd &trans) const { +translate_geom_uvs(EggPrimitive *geom, const LTexCoordd &trans) const { string uv_name = _egg_tex->get_uv_name(); EggPrimitive::iterator pi; @@ -833,15 +833,15 @@ translate_geom_uvs(EggPrimitive *geom, const TexCoordd &trans) const { void TextureReference:: collect_nominal_uv_range() { static const int num_nurbs_uvs = 4; - static TexCoordd nurbs_uvs[num_nurbs_uvs] = { - TexCoordd(0.0, 0.0), - TexCoordd(0.0, 1.0), - TexCoordd(1.0, 1.0), - TexCoordd(1.0, 0.0) + static LTexCoordd nurbs_uvs[num_nurbs_uvs] = { + LTexCoordd(0.0, 0.0), + LTexCoordd(0.0, 1.0), + LTexCoordd(1.0, 1.0), + LTexCoordd(1.0, 0.0) }; for (int i = 0; i < num_nurbs_uvs; i++) { - TexCoordd uv = nurbs_uvs[i] * _tex_mat; + LTexCoordd uv = nurbs_uvs[i] * _tex_mat; collect_uv(_any_uvs, _min_uv, _max_uv, uv, uv); } } @@ -853,8 +853,8 @@ collect_nominal_uv_range() { // indicated min and max UV's already determined. //////////////////////////////////////////////////////////////////// void TextureReference:: -collect_uv(bool &any_uvs, TexCoordd &min_uv, TexCoordd &max_uv, - const TexCoordd &got_min_uv, const TexCoordd &got_max_uv) { +collect_uv(bool &any_uvs, LTexCoordd &min_uv, LTexCoordd &max_uv, + const LTexCoordd &got_min_uv, const LTexCoordd &got_max_uv) { if (any_uvs) { min_uv.set(min(min_uv[0], got_min_uv[0]), min(min_uv[1], got_min_uv[1])); @@ -876,8 +876,8 @@ collect_uv(bool &any_uvs, TexCoordd &min_uv, TexCoordd &max_uv, // square (0,0) - (1,1). //////////////////////////////////////////////////////////////////// LVector2d TextureReference:: -translate_uv(const TexCoordd &min_uv, const TexCoordd &max_uv) { - TexCoordd center = (min_uv + max_uv) / 2; +translate_uv(const LTexCoordd &min_uv, const LTexCoordd &max_uv) { + LTexCoordd center = (min_uv + max_uv) / 2; return LVector2d(-floor(center[0]), -floor(center[1])); } diff --git a/pandatool/src/palettizer/textureReference.h b/pandatool/src/palettizer/textureReference.h index 4bcb6b07e6..3e6d3905c9 100644 --- a/pandatool/src/palettizer/textureReference.h +++ b/pandatool/src/palettizer/textureReference.h @@ -58,8 +58,8 @@ public: bool operator < (const TextureReference &other) const; bool has_uvs() const; - const TexCoordd &get_min_uv() const; - const TexCoordd &get_max_uv() const; + const LTexCoordd &get_min_uv() const; + const LTexCoordd &get_max_uv() const; EggTexture::WrapMode get_wrap_u() const; EggTexture::WrapMode get_wrap_v() const; @@ -83,14 +83,14 @@ private: void update_uv_range(EggGroupNode *group, Palettizer::RemapUV remap); bool get_geom_uvs(EggPrimitive *geom, - TexCoordd &geom_min_uv, TexCoordd &geom_max_uv); - void translate_geom_uvs(EggPrimitive *geom, const TexCoordd &trans) const; + LTexCoordd &geom_min_uv, LTexCoordd &geom_max_uv); + void translate_geom_uvs(EggPrimitive *geom, const LTexCoordd &trans) const; void collect_nominal_uv_range(); - static void collect_uv(bool &any_uvs, TexCoordd &min_uv, TexCoordd &max_uv, - const TexCoordd &got_min_uv, - const TexCoordd &got_max_uv); - static LVector2d translate_uv(const TexCoordd &min_uv, - const TexCoordd &max_uv); + static void collect_uv(bool &any_uvs, LTexCoordd &min_uv, LTexCoordd &max_uv, + const LTexCoordd &got_min_uv, + const LTexCoordd &got_max_uv); + static LVector2d translate_uv(const LTexCoordd &min_uv, + const LTexCoordd &max_uv); EggFile *_egg_file; EggTexture *_egg_tex; @@ -104,7 +104,7 @@ private: bool _uses_alpha; bool _any_uvs; - TexCoordd _min_uv, _max_uv; + LTexCoordd _min_uv, _max_uv; EggTexture::WrapMode _wrap_u, _wrap_v; TextureProperties _properties; diff --git a/pandatool/src/softegg/softToEggConverter.cxx b/pandatool/src/softegg/softToEggConverter.cxx index d2e056b608..dffd1c1375 100755 --- a/pandatool/src/softegg/softToEggConverter.cxx +++ b/pandatool/src/softegg/softToEggConverter.cxx @@ -1175,8 +1175,8 @@ make_polyset(SoftNodeDesc *node_desc, EggGroup *egg_group, SAA_ModelType type) { softegg_cat.spam() << "texcoords[" << i << "] = " << u << " " << v << endl; - vert.set_uv(TexCoordd(u, v)); - //vert.set_uv(TexCoordd(uCoords[i], vCoords[i])); + vert.set_uv(LTexCoordd(u, v)); + //vert.set_uv(LTexCoordd(uCoords[i], vCoords[i])); } } vert.set_external_index(indices[i]); diff --git a/pandatool/src/vrmlegg/indexedFaceSet.cxx b/pandatool/src/vrmlegg/indexedFaceSet.cxx index c99d15cdd4..932847c9b4 100644 --- a/pandatool/src/vrmlegg/indexedFaceSet.cxx +++ b/pandatool/src/vrmlegg/indexedFaceSet.cxx @@ -75,7 +75,7 @@ get_coord_values() { MFArray::const_iterator ci; for (ci = point->begin(); ci != point->end(); ++ci) { const double *p = (*ci)._sfvec; - _coord_values.push_back(Vertexd(p[0], p[1], p[2])); + _coord_values.push_back(LVertexd(p[0], p[1], p[2])); } } } @@ -97,7 +97,7 @@ get_polys() { _polys.push_back(poly); poly._verts.clear(); } else { - const Vertexd &p = _coord_values[(*ci)._sfint32]; + const LVertexd &p = _coord_values[(*ci)._sfint32]; VrmlVertex vert; vert._index = (*ci)._sfint32; vert._pos = p; @@ -132,12 +132,12 @@ get_vrml_colors(const VrmlNode *color_node, double transparency, //////////////////////////////////////////////////////////////////// void IndexedFaceSet:: get_vrml_normals(const VrmlNode *normal_node, - pvector &normal_list) { + pvector &normal_list) { const MFArray *point = normal_node->get_value("vector")._mf; MFArray::const_iterator ci; for (ci = point->begin(); ci != point->end(); ++ci) { const double *p = (*ci)._sfvec; - Normald normal(p[0], p[1], p[2]); + LNormald normal(p[0], p[1], p[2]); normal_list.push_back(normal); } } @@ -150,12 +150,12 @@ get_vrml_normals(const VrmlNode *normal_node, //////////////////////////////////////////////////////////////////// void IndexedFaceSet:: get_vrml_uvs(const VrmlNode *texCoord_node, - pvector &uv_list) { + pvector &uv_list) { const MFArray *point = texCoord_node->get_value("point")._mf; MFArray::const_iterator ci; for (ci = point->begin(); ci != point->end(); ++ci) { const double *p = (*ci)._sfvec; - TexCoordd uv(p[0], p[1]); + LTexCoordd uv(p[0], p[1]); uv_list.push_back(uv); } } @@ -243,7 +243,7 @@ get_normals() { const VrmlNode *normal = _geometry->get_value("normal")._sfnode._p; if (normal != NULL) { // Vertex or face normals. - pvector normal_list; + pvector normal_list; get_vrml_normals(normal, normal_list); bool normalPerVertex = _geometry->get_value("normalPerVertex")._sfbool; @@ -326,7 +326,7 @@ get_normals() { cerr << "Normal indices don't match up!\n"; return false; } - const Normald &d = normal_list[(*ci)._sfint32]; + const LNormald &d = normal_list[(*ci)._sfint32]; _polys[pi]._verts[pv]._attrib.set_normal(d); pv++; } @@ -348,7 +348,7 @@ get_normals() { cerr << "Invalid normal index!\n"; return false; } - const Normald &d = normal_list[(*ci)._sfint32]; + const LNormald &d = normal_list[(*ci)._sfint32]; _polys[pi]._attrib.set_normal(d); pi++; } @@ -358,7 +358,7 @@ get_normals() { return false; } for (size_t pi = 0; pi < normal_list.size(); pi++) { - const Normald &d = normal_list[pi]; + const LNormald &d = normal_list[pi]; _polys[pi]._attrib.set_normal(d); } } @@ -383,7 +383,7 @@ assign_per_vertex_normals() { for (size_t pv = 0; pv < _polys[pi]._verts.size(); pv++) { VrmlVertex &vv = _polys[pi]._verts[pv]; if (vv._index >= 0 && vv._index < (int)_per_vertex_normals.size()) { - const Normald &d = _per_vertex_normals[vv._index]; + const LNormald &d = _per_vertex_normals[vv._index]; vv._attrib.set_normal(d); } } @@ -401,7 +401,7 @@ get_uvs() { const VrmlNode *texCoord = _geometry->get_value("texCoord")._sfnode._p; if (texCoord != NULL) { // Vertex or face texCoords. - pvector uv_list; + pvector uv_list; get_vrml_uvs(texCoord, uv_list); MFArray *texCoordIndex = _geometry->get_value("texCoordIndex")._mf; @@ -499,7 +499,7 @@ assign_per_vertex_uvs() { for (size_t pv = 0; pv < _polys[pi]._verts.size(); pv++) { VrmlVertex &vv = _polys[pi]._verts[pv]; if (vv._index >= 0 && vv._index < (int)_per_vertex_uvs.size()) { - const TexCoordd &d = _per_vertex_uvs[vv._index]; + const LTexCoordd &d = _per_vertex_uvs[vv._index]; vv._attrib.set_uv(d); } } @@ -539,7 +539,7 @@ make_polys(EggVertexPool *vpool, EggGroup *group, // The vertices are counterclockwise, same as Egg. for (int pv = 0; pv < (int)_polys[pi]._verts.size(); pv++) { EggVertex vert(_polys[pi]._verts[pv]._attrib); - Vertexd pos = + LVertexd pos = _polys[pi]._verts[pv]._pos * net_transform; vert.set_pos(pos); @@ -549,7 +549,7 @@ make_polys(EggVertexPool *vpool, EggGroup *group, // The vertices are clockwise, so add 'em in reverse order. for (int pv = (int)_polys[pi]._verts.size() - 1; pv >= 0; pv--) { EggVertex vert(_polys[pi]._verts[pv]._attrib); - Vertexd pos = + LVertexd pos = _polys[pi]._verts[pv]._pos * net_transform; vert.set_pos(pos); diff --git a/pandatool/src/vrmlegg/indexedFaceSet.h b/pandatool/src/vrmlegg/indexedFaceSet.h index c2ec5e52d2..fba341f696 100644 --- a/pandatool/src/vrmlegg/indexedFaceSet.h +++ b/pandatool/src/vrmlegg/indexedFaceSet.h @@ -44,9 +44,9 @@ private: void get_vrml_colors(const VrmlNode *color_node, double transparency, pvector &color_list); void get_vrml_normals(const VrmlNode *normal_node, - pvector &normal_list); + pvector &normal_list); void get_vrml_uvs(const VrmlNode *texCoord_node, - pvector &uv_list); + pvector &uv_list); bool get_colors(); bool get_normals(); @@ -60,7 +60,7 @@ private: class VrmlVertex { public: int _index; - Vertexd _pos; + LVertexd _pos; EggVertex _attrib; }; class VrmlPolygon { @@ -68,10 +68,10 @@ private: EggPolygon _attrib; pvector _verts; }; - pvector _coord_values; + pvector _coord_values; pvector _polys; - pvector _per_vertex_uvs; - pvector _per_vertex_normals; + pvector _per_vertex_uvs; + pvector _per_vertex_normals; bool _has_normals; diff --git a/pandatool/src/xfileegg/xFileMesh.cxx b/pandatool/src/xfileegg/xFileMesh.cxx index 484e4b8f32..73e473b087 100644 --- a/pandatool/src/xfileegg/xFileMesh.cxx +++ b/pandatool/src/xfileegg/xFileMesh.cxx @@ -311,7 +311,7 @@ create_polygons(XFileToEggConverter *converter) { temp_vtx.set_color(vertex->_color); } if (vertex->_has_uv) { - TexCoordd uv = vertex->_uv; + LTexCoordd uv = vertex->_uv; // Windows draws the UV's upside-down. uv[1] = 1.0 - uv[1]; temp_vtx.set_uv(uv); diff --git a/pandatool/src/xfileegg/xFileNormal.cxx b/pandatool/src/xfileegg/xFileNormal.cxx index c613fd1c97..316f5ce224 100644 --- a/pandatool/src/xfileegg/xFileNormal.cxx +++ b/pandatool/src/xfileegg/xFileNormal.cxx @@ -36,7 +36,7 @@ XFileNormal() { void XFileNormal:: set_from_egg(EggVertex *egg_vertex, EggPrimitive *egg_prim) { if (egg_vertex->has_normal() || egg_prim->has_normal()) { - Normald norm; + LNormald norm; if (egg_vertex->has_normal()) { norm = egg_vertex->get_normal(); } else { diff --git a/pandatool/src/xfileegg/xFileNormal.h b/pandatool/src/xfileegg/xFileNormal.h index 75c61f69dc..66e5b827f2 100644 --- a/pandatool/src/xfileegg/xFileNormal.h +++ b/pandatool/src/xfileegg/xFileNormal.h @@ -34,7 +34,7 @@ public: void set_from_egg(EggVertex *egg_vertex, EggPrimitive *egg_prim); int compare_to(const XFileNormal &other) const; - Normald _normal; + LNormald _normal; bool _has_normal; }; diff --git a/pandatool/src/xfileegg/xFileVertex.cxx b/pandatool/src/xfileegg/xFileVertex.cxx index 7846de0dfe..af7db14b3b 100644 --- a/pandatool/src/xfileegg/xFileVertex.cxx +++ b/pandatool/src/xfileegg/xFileVertex.cxx @@ -38,7 +38,7 @@ XFileVertex() { //////////////////////////////////////////////////////////////////// void XFileVertex:: set_from_egg(EggVertex *egg_vertex, EggPrimitive *egg_prim) { - Vertexd pos = egg_vertex->get_pos3(); + LVertexd pos = egg_vertex->get_pos3(); if (xfile_one_mesh) { // If this is going into one big mesh, we must ensure every @@ -52,7 +52,7 @@ set_from_egg(EggVertex *egg_vertex, EggPrimitive *egg_prim) { _point = pos; if (egg_vertex->has_uv()) { - TexCoordd uv = egg_vertex->get_uv(); + LTexCoordd uv = egg_vertex->get_uv(); if (egg_prim->has_texture()) { // Check if there's a texture matrix on the texture. EggTexture *egg_tex = egg_prim->get_texture(); diff --git a/pandatool/src/xfileegg/xFileVertex.h b/pandatool/src/xfileegg/xFileVertex.h index 24d5a6f7c3..5a86bf66d2 100644 --- a/pandatool/src/xfileegg/xFileVertex.h +++ b/pandatool/src/xfileegg/xFileVertex.h @@ -32,8 +32,8 @@ public: void set_from_egg(EggVertex *egg_vertex, EggPrimitive *egg_poly); int compare_to(const XFileVertex &other) const; - Vertexd _point; - TexCoordd _uv; + LVertexd _point; + LTexCoordd _uv; LColor _color; bool _has_color; bool _has_uv;