add EggUserData
This commit is contained in:
parent
ff66e80fc0
commit
1367be51df
|
|
@ -31,6 +31,7 @@
|
|||
eggSwitchCondition.h eggTable.I eggTable.h eggTexture.I \
|
||||
eggTexture.h eggTextureCollection.I eggTextureCollection.h \
|
||||
eggTransform3d.I eggTransform3d.h \
|
||||
eggUserData.I eggUserData.h \
|
||||
eggUtilities.I eggUtilities.h eggVertex.I eggVertex.h \
|
||||
eggVertexPool.I eggVertexPool.h eggXfmAnimData.I \
|
||||
eggXfmAnimData.h eggXfmSAnim.I eggXfmSAnim.h parserDefs.h \
|
||||
|
|
@ -52,6 +53,7 @@
|
|||
eggSAnimData.cxx eggSurface.cxx eggSwitchCondition.cxx \
|
||||
eggTable.cxx eggTexture.cxx eggTextureCollection.cxx \
|
||||
eggTransform3d.cxx \
|
||||
eggUserData.cxx \
|
||||
eggUtilities.cxx eggVertex.cxx eggVertexPool.cxx \
|
||||
eggXfmAnimData.cxx eggXfmSAnim.cxx xx xx pt_EggMaterial.cxx \
|
||||
vector_PT_EggMaterial.cxx pt_EggTexture.cxx \
|
||||
|
|
@ -77,6 +79,7 @@
|
|||
eggSwitchCondition.h eggTable.I eggTable.h eggTexture.I \
|
||||
eggTexture.h eggTextureCollection.I eggTextureCollection.h \
|
||||
eggTransform3d.I eggTransform3d.h \
|
||||
eggUserData.I eggUserData.h \
|
||||
eggUtilities.I eggUtilities.h eggVertex.I eggVertex.h \
|
||||
eggVertexPool.I eggVertexPool.h eggXfmAnimData.I eggXfmAnimData.h \
|
||||
eggXfmSAnim.I eggXfmSAnim.h \
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@
|
|||
#include "eggSwitchCondition.h"
|
||||
#include "eggTable.h"
|
||||
#include "eggTexture.h"
|
||||
#include "eggUserData.h"
|
||||
#include "eggVertex.h"
|
||||
#include "eggVertexPool.h"
|
||||
#include "eggXfmAnimData.h"
|
||||
|
|
@ -116,6 +117,7 @@ init_libegg() {
|
|||
EggSwitchConditionDistance::init_type();
|
||||
EggTable::init_type();
|
||||
EggTexture::init_type();
|
||||
EggUserData::init_type();
|
||||
EggVertex::init_type();
|
||||
EggVertexPool::init_type();
|
||||
EggXfmAnimData::init_type();
|
||||
|
|
|
|||
|
|
@ -39,7 +39,8 @@ EggData(const EggData ©) :
|
|||
EggGroupNode(copy),
|
||||
_auto_resolve_externals(copy._auto_resolve_externals),
|
||||
_coordsys(copy._coordsys),
|
||||
_egg_filename(copy._egg_filename) {
|
||||
_egg_filename(copy._egg_filename)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -33,7 +33,10 @@ EggObject() {
|
|||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE EggObject::
|
||||
EggObject(const EggObject ©) : TypedReferenceCount(copy) {
|
||||
EggObject(const EggObject ©) :
|
||||
TypedReferenceCount(copy),
|
||||
_user_data(copy._user_data)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -45,5 +48,56 @@ EggObject(const EggObject ©) : TypedReferenceCount(copy) {
|
|||
INLINE EggObject &EggObject::
|
||||
operator = (const EggObject ©) {
|
||||
TypedReferenceCount::operator = (copy);
|
||||
_user_data = copy._user_data;
|
||||
return *this;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: EggObject::set_user_data
|
||||
// Access: Public
|
||||
// Description: Sets the user data associated with this object. This
|
||||
// may be any EggUserData-derived object. The egg
|
||||
// library will do nothing with this pointer, except to
|
||||
// hold its reference count and return the pointer on
|
||||
// request.
|
||||
//
|
||||
// This pointer is also copied by the copy assignment
|
||||
// operator and copy constructor.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void EggObject::
|
||||
set_user_data(EggUserData *user_data) {
|
||||
_user_data = user_data;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: EggObject::get_user_data
|
||||
// Access: Public
|
||||
// Description: Returns the user data pointer previously stored on
|
||||
// this object, or NULL if nothing was previously
|
||||
// stored.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE EggUserData *EggObject::
|
||||
get_user_data() const {
|
||||
return _user_data;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: EggObject::has_user_data
|
||||
// Access: Public
|
||||
// Description: Returns true if the user data pointer has been set,
|
||||
// false otherwise.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool EggObject::
|
||||
has_user_data() const {
|
||||
return !_user_data.is_null();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: EggObject::clear_user_data
|
||||
// Access: Public
|
||||
// Description: Resets the user data pointer to NULL.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void EggObject::
|
||||
clear_user_data() {
|
||||
_user_data.clear();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,8 +20,9 @@
|
|||
#define EGGOBJECT_H
|
||||
|
||||
#include "pandabase.h"
|
||||
|
||||
#include "eggUserData.h"
|
||||
#include "typedReferenceCount.h"
|
||||
#include "pointerTo.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : EggObject
|
||||
|
|
@ -36,6 +37,14 @@ public:
|
|||
|
||||
virtual ~EggObject();
|
||||
|
||||
INLINE void set_user_data(EggUserData *user_data);
|
||||
INLINE EggUserData *get_user_data() const;
|
||||
INLINE bool has_user_data() const;
|
||||
INLINE void clear_user_data();
|
||||
|
||||
private:
|
||||
PT(EggUserData) _user_data;
|
||||
|
||||
public:
|
||||
static TypeHandle get_class_type() {
|
||||
return _type_handle;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,49 @@
|
|||
// Filename: eggUserData.I
|
||||
// Created by: drose (03Jun03)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: EggUserData::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE EggUserData::
|
||||
EggUserData() {
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: EggUserData::Copy constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE EggUserData::
|
||||
EggUserData(const EggUserData ©) : TypedReferenceCount(copy) {
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: EggUserData::Copy assignment operator
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE EggUserData &EggUserData::
|
||||
operator = (const EggUserData ©) {
|
||||
TypedReferenceCount::operator = (copy);
|
||||
return *this;
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
// Filename: eggUserData.cxx
|
||||
// Created by: drose (03Jun03)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "eggUserData.h"
|
||||
|
||||
TypeHandle EggUserData::_type_handle;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: EggUserData::Destructor
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
EggUserData::
|
||||
~EggUserData() {
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
// Filename: eggUserData.h
|
||||
// Created by: drose (03Jun03)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 EGGUSERDATA_H
|
||||
#define EGGUSERDATA_H
|
||||
|
||||
#include "pandabase.h"
|
||||
|
||||
#include "typedReferenceCount.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : EggUserData
|
||||
// Description : This is a base class for a user-defined data type to
|
||||
// extend egg structures in processing code. The user
|
||||
// of the egg library may derive from EggUserData to
|
||||
// associate any arbitrary data with various egg
|
||||
// objects.
|
||||
//
|
||||
// However, this data will not be written out to the
|
||||
// disk when the egg file is written; it is an in-memory
|
||||
// object only.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDAEGG EggUserData : public TypedReferenceCount {
|
||||
public:
|
||||
INLINE EggUserData();
|
||||
INLINE EggUserData(const EggUserData ©);
|
||||
INLINE EggUserData &operator = (const EggUserData ©);
|
||||
|
||||
virtual ~EggUserData();
|
||||
|
||||
public:
|
||||
static TypeHandle get_class_type() {
|
||||
return _type_handle;
|
||||
}
|
||||
static void init_type() {
|
||||
TypedReferenceCount::init_type();
|
||||
register_type(_type_handle, "EggUserData",
|
||||
TypedReferenceCount::get_class_type());
|
||||
}
|
||||
virtual TypeHandle get_type() const {
|
||||
return get_class_type();
|
||||
}
|
||||
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
|
||||
|
||||
private:
|
||||
static TypeHandle _type_handle;
|
||||
};
|
||||
|
||||
#include "eggUserData.I"
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
#include "config_egg.cxx"
|
||||
#include "eggAnimData.cxx"
|
||||
#include "eggAttributes.cxx"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
#include "eggObject.cxx"
|
||||
#include "eggParameters.cxx"
|
||||
#include "eggPoint.cxx"
|
||||
|
|
@ -14,6 +13,7 @@
|
|||
#include "eggTexture.cxx"
|
||||
#include "eggTextureCollection.cxx"
|
||||
#include "eggTransform3d.cxx"
|
||||
#include "eggUserData.cxx"
|
||||
#include "eggUtilities.cxx"
|
||||
#include "eggVertex.cxx"
|
||||
#include "eggVertexPool.cxx"
|
||||
|
|
|
|||
Loading…
Reference in New Issue