various interface improvements
This commit is contained in:
parent
a5b42a959e
commit
16b5c0f9ee
|
|
@ -25,7 +25,7 @@
|
|||
eggNode.I eggNode.h eggNurbsCurve.I eggNurbsCurve.h \
|
||||
eggNurbsSurface.I eggNurbsSurface.h eggObject.I eggObject.h \
|
||||
eggParameters.h eggPoint.I eggPoint.h eggPolygon.I \
|
||||
eggPolygon.h eggPoolUniquifier.h eggPrimitive.I \
|
||||
eggPolygon.h eggPolysetMaker.h eggPoolUniquifier.h eggPrimitive.I \
|
||||
eggPrimitive.h eggRenderMode.I eggRenderMode.h \
|
||||
eggSAnimData.I eggSAnimData.h eggSurface.I eggSurface.h \
|
||||
eggSwitchCondition.h eggTable.I eggTable.h eggTexture.I \
|
||||
|
|
@ -46,7 +46,7 @@
|
|||
eggMaterialCollection.cxx eggMiscFuncs.cxx eggMorphList.cxx \
|
||||
eggNamedObject.cxx eggNameUniquifier.cxx eggNode.cxx \
|
||||
eggNurbsCurve.cxx eggNurbsSurface.cxx eggObject.cxx \
|
||||
eggParameters.cxx eggPoint.cxx eggPolygon.cxx \
|
||||
eggParameters.cxx eggPoint.cxx eggPolygon.cxx eggPolysetMaker.cxx \
|
||||
eggPoolUniquifier.cxx eggPrimitive.cxx eggRenderMode.cxx \
|
||||
eggSAnimData.cxx eggSurface.cxx eggSwitchCondition.cxx \
|
||||
eggTable.cxx eggTexture.cxx eggTextureCollection.cxx \
|
||||
|
|
@ -69,7 +69,7 @@
|
|||
eggNamedObject.I eggNamedObject.h eggNameUniquifier.h eggNode.I eggNode.h \
|
||||
eggNurbsCurve.I eggNurbsCurve.h eggNurbsSurface.I eggNurbsSurface.h \
|
||||
eggObject.I eggObject.h eggParameters.h eggPoint.I eggPoint.h \
|
||||
eggPolygon.I eggPolygon.h eggPoolUniquifier.h \
|
||||
eggPolygon.I eggPolygon.h eggPolysetMaker.h eggPoolUniquifier.h \
|
||||
eggPrimitive.I eggPrimitive.h eggRenderMode.I eggRenderMode.h \
|
||||
eggSAnimData.I eggSAnimData.h eggSurface.I eggSurface.h \
|
||||
eggSwitchCondition.h eggTable.I eggTable.h eggTexture.I \
|
||||
|
|
|
|||
|
|
@ -116,12 +116,16 @@ has_color() const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
// Function: EggAttributes::get_color
|
||||
// Access: Public
|
||||
// Description:
|
||||
// Description: Returns the color set on this particular attribute.
|
||||
// If there is no color set, returns white.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const Colorf &EggAttributes::
|
||||
INLINE Colorf EggAttributes::
|
||||
get_color() const {
|
||||
nassertr(has_color(), _color);
|
||||
return _color;
|
||||
if (has_color()) {
|
||||
return _color;
|
||||
} else {
|
||||
return Colorf(1.0, 1.0, 1.0, 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ public:
|
|||
INLINE void clear_uv();
|
||||
|
||||
INLINE bool has_color() const;
|
||||
INLINE const Colorf &get_color() const;
|
||||
INLINE Colorf get_color() const;
|
||||
INLINE void set_color(const Colorf &Color);
|
||||
INLINE void clear_color();
|
||||
|
||||
|
|
|
|||
|
|
@ -49,6 +49,24 @@ operator ()(const EggNode *a, const EggNode *b) const {
|
|||
return _ebm->sorts_less(bin_number_a, a, b);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: EggBinMaker::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
EggBinMaker::
|
||||
EggBinMaker() {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: EggBinMaker::Destructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
EggBinMaker::
|
||||
~EggBinMaker() {
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: EggBinMaker::make_bins
|
||||
|
|
@ -122,7 +140,7 @@ get_bin_name(int) {
|
|||
void EggBinMaker::
|
||||
collect_nodes(EggGroupNode *group) {
|
||||
// We have to play games with this next iterator, because we might
|
||||
// be destructively operation on the child list as we traverse it.
|
||||
// be destructively operating on the child list as we traverse it.
|
||||
EggGroupNode::iterator i, next;
|
||||
|
||||
bool first_in_group = true;
|
||||
|
|
|
|||
|
|
@ -249,7 +249,8 @@ public:
|
|||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDAEGG EggBinMaker : public EggObject {
|
||||
public:
|
||||
EggBinMaker() { }
|
||||
EggBinMaker();
|
||||
~EggBinMaker();
|
||||
|
||||
int make_bins(EggGroupNode *root_group);
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
#include "eggGroup.h"
|
||||
#include "eggMiscFuncs.h"
|
||||
#include "eggVertexPool.h"
|
||||
#include "eggBin.h"
|
||||
#include "lexerDefs.h"
|
||||
|
||||
#include <indent.h>
|
||||
|
|
@ -179,6 +180,11 @@ write(ostream &out, int indent_level) const {
|
|||
nassertv(false);
|
||||
}
|
||||
|
||||
if (is_of_type(EggBin::get_class_type())) {
|
||||
indent(out, indent_level + 2)
|
||||
<< "// Bin " << DCAST(EggBin, this)->get_bin_number() << "\n";
|
||||
}
|
||||
|
||||
if (has_lod()) {
|
||||
get_lod().write(out, indent_level + 2);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -191,6 +191,17 @@ insert(const MorphType &value) {
|
|||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: EggMorphList::clear
|
||||
// Access: Public
|
||||
// Description: Empties the list of morphs.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class MorphType>
|
||||
INLINE void EggMorphList<MorphType>::
|
||||
clear() {
|
||||
_morphs.clear();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: EggMorphList::write
|
||||
// Access: Public
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ public:
|
|||
INLINE bool empty() const;
|
||||
|
||||
pair<iterator, bool> insert(const MorphType &value);
|
||||
INLINE void clear();
|
||||
|
||||
void write(ostream &out, int indent_level) const;
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,66 @@
|
|||
// Filename: eggPolysetMaker.cxx
|
||||
// Created by: drose (20Jun01)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://www.panda3d.org/license.txt .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d@yahoogroups.com .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "eggPolysetMaker.h"
|
||||
#include "eggPolygon.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: EggPolysetMaker::get_bin_number
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int EggPolysetMaker::
|
||||
get_bin_number(const EggNode *node) {
|
||||
if (node->is_of_type(EggPolygon::get_class_type())) {
|
||||
return (int)BN_polyset;
|
||||
}
|
||||
|
||||
return (int)BN_none;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: EggPolysetMaker::sorts_less
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool EggPolysetMaker::
|
||||
sorts_less(int bin_number, const EggNode *a, const EggNode *b) {
|
||||
nassertr((BinNumber)bin_number == BN_polyset, false);
|
||||
|
||||
const EggPolygon *pa = DCAST(EggPolygon, a);
|
||||
const EggPolygon *pb = DCAST(EggPolygon, b);
|
||||
|
||||
if (pa->has_texture() != pb->has_texture()) {
|
||||
return ((int)pa->has_texture() < (int)pb->has_texture());
|
||||
}
|
||||
if (pa->has_texture()) {
|
||||
return (pa->get_texture()->sorts_less_than(*pb->get_texture(), ~EggTexture::E_tref_name));
|
||||
}
|
||||
if (pa->has_material() != pb->has_material()) {
|
||||
return ((int)pa->has_material() < (int)pb->has_material());
|
||||
}
|
||||
if (pa->has_material()) {
|
||||
return (pa->get_material()->sorts_less_than(*pb->get_material(), ~EggMaterial::E_mref_name));
|
||||
}
|
||||
if (pa->get_bface_flag() != pb->get_bface_flag()) {
|
||||
return ((int)pa->get_bface_flag() < (int)pb->get_bface_flag());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
// Filename: eggPolysetMaker.h
|
||||
// Created by: drose (19Jun01)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://www.panda3d.org/license.txt .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d@yahoogroups.com .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef EGGPOLYSETMAKER_H
|
||||
#define EGGPOLYSETMAKER_H
|
||||
|
||||
#include <pandabase.h>
|
||||
|
||||
#include "eggBinMaker.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : EggPolysetMaker
|
||||
// Description : A specialization on EggBinMaker for making polysets
|
||||
// that share the same basic rendering characteristic.
|
||||
// This really just defines the example functions
|
||||
// described in the leading comment to EggBinMaker.
|
||||
//
|
||||
// It makes some common assumptions about how polysets
|
||||
// should be grouped; if these are not sufficient, you
|
||||
// can always rederive your own further specialization
|
||||
// of this class.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDAEGG EggPolysetMaker : public EggBinMaker {
|
||||
public:
|
||||
|
||||
// The BinNumber serves to identify why a particular EggBin was
|
||||
// created.
|
||||
enum BinNumber {
|
||||
BN_none = 0,
|
||||
BN_polyset,
|
||||
};
|
||||
|
||||
virtual int
|
||||
get_bin_number(const EggNode *node);
|
||||
|
||||
virtual bool
|
||||
sorts_less(int bin_number, const EggNode *a, const EggNode *b);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
#include "eggParameters.cxx"
|
||||
#include "eggPoint.cxx"
|
||||
#include "eggPolygon.cxx"
|
||||
#include "eggPolysetMaker.cxx"
|
||||
#include "eggPoolUniquifier.cxx"
|
||||
#include "eggPrimitive.cxx"
|
||||
#include "eggRenderMode.cxx"
|
||||
|
|
|
|||
Loading…
Reference in New Issue