From 078ddc7c27474130b4f7ab4b20efdeeacab5f157 Mon Sep 17 00:00:00 2001 From: David Rose Date: Thu, 17 Nov 2011 22:10:09 +0000 Subject: [PATCH] oops, missing files from teedee's checkin --- panda/src/egg/eggVertexAux.I | 44 +++++++++++++++ panda/src/egg/eggVertexAux.cxx | 99 ++++++++++++++++++++++++++++++++++ panda/src/egg/eggVertexAux.h | 72 +++++++++++++++++++++++++ 3 files changed, 215 insertions(+) create mode 100644 panda/src/egg/eggVertexAux.I create mode 100644 panda/src/egg/eggVertexAux.cxx create mode 100644 panda/src/egg/eggVertexAux.h diff --git a/panda/src/egg/eggVertexAux.I b/panda/src/egg/eggVertexAux.I new file mode 100644 index 0000000000..315358da8b --- /dev/null +++ b/panda/src/egg/eggVertexAux.I @@ -0,0 +1,44 @@ +// Filename: eggVertexAux.I +// Created by: jenes (15Nov11) +// +//////////////////////////////////////////////////////////////////// +// +// 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." +// +//////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////// +// Function: EggVertexAux::set_name +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +INLINE void EggVertexAux:: +set_name(const string &name) { + Namable::set_name(name); +} + +//////////////////////////////////////////////////////////////////// +// Function: EggVertexAux::get_aux +// Access: Published +// Description: Returns the auxiliary data quadruple. +//////////////////////////////////////////////////////////////////// +INLINE const LVecBase4d &EggVertexAux:: +get_aux() const { + return _aux; +} + +//////////////////////////////////////////////////////////////////// +// Function: EggVertexAux::set_aux +// Access: Published +// Description: Sets the auxiliary data quadruple. +//////////////////////////////////////////////////////////////////// +INLINE void EggVertexAux:: +set_aux(const LVecBase4d &aux) { + _aux = aux; +} diff --git a/panda/src/egg/eggVertexAux.cxx b/panda/src/egg/eggVertexAux.cxx new file mode 100644 index 0000000000..15d5e748d7 --- /dev/null +++ b/panda/src/egg/eggVertexAux.cxx @@ -0,0 +1,99 @@ +// Filename: eggVertexAux.cxx +// Created by: jenes (15Nov11) +// +//////////////////////////////////////////////////////////////////// +// +// 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 "eggVertexAux.h" +#include "eggParameters.h" + +#include "indent.h" + +TypeHandle EggVertexAux::_type_handle; + +//////////////////////////////////////////////////////////////////// +// Function: EggVertexAux::Constructor +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +EggVertexAux:: +EggVertexAux(const string &name, const LVecBase4d &aux) : + EggNamedObject(name), + _aux(aux) +{ +} + +//////////////////////////////////////////////////////////////////// +// Function: EggVertexAux::Copy Constructor +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +EggVertexAux:: +EggVertexAux(const EggVertexAux ©) : + EggNamedObject(copy), + _aux(copy._aux) +{ +} + +//////////////////////////////////////////////////////////////////// +// Function: EggVertexAux::Copy Assignment Operator +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +EggVertexAux &EggVertexAux:: +operator = (const EggVertexAux ©) { + EggNamedObject::operator = (copy); + _aux = copy._aux; + + return (*this); +} + +//////////////////////////////////////////////////////////////////// +// Function: EggVertexAux::Destructor +// Access: Published, Virtual +// Description: +//////////////////////////////////////////////////////////////////// +EggVertexAux:: +~EggVertexAux() { +} + +//////////////////////////////////////////////////////////////////// +// Function: EggVertexAux::write +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +void EggVertexAux:: +write(ostream &out, int indent_level) const { + string inline_name = get_name(); + if (!inline_name.empty()) { + inline_name += ' '; + } + indent(out, indent_level) + << " " << inline_name << "{ " << get_aux() << " }\n"; +} + +//////////////////////////////////////////////////////////////////// +// Function: EggVertexAux::compare_to +// Access: Public +// Description: An ordering operator to compare two vertices for +// sorting order. This imposes an arbitrary ordering +// useful to identify unique vertices. +//////////////////////////////////////////////////////////////////// +int EggVertexAux:: +compare_to(const EggVertexAux &other) const { + int compare; + compare = _aux.compare_to(other._aux, egg_parameters->_pos_threshold); + if (compare != 0) { + return compare; + } + + return 0; +} diff --git a/panda/src/egg/eggVertexAux.h b/panda/src/egg/eggVertexAux.h new file mode 100644 index 0000000000..082795c86b --- /dev/null +++ b/panda/src/egg/eggVertexAux.h @@ -0,0 +1,72 @@ +// Filename: eggVertexAux.h +// Created by: jenes (15Nov11) +// +//////////////////////////////////////////////////////////////////// +// +// 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 EGGVERTEXAUX_H +#define EGGVERTEXAUX_H + +#include "pandabase.h" + +#include "eggMorphList.h" +#include "eggNamedObject.h" + +#include "luse.h" + +//////////////////////////////////////////////////////////////////// +// Class : EggVertexAux +// Description : The set of named auxiliary data that may or may not +// be assigned to a vertex. Panda will import this data +// and create a custom column for it in the vertex data, +// but will not otherwise interpret it. Presumably, a +// shader will process the data later. +//////////////////////////////////////////////////////////////////// +class EXPCL_PANDAEGG EggVertexAux : public EggNamedObject { +PUBLISHED: + EggVertexAux(const string &name, const LVecBase4d &aux); + EggVertexAux(const EggVertexAux ©); + EggVertexAux &operator = (const EggVertexAux ©); + virtual ~EggVertexAux(); + + INLINE void set_name(const string &name); + + INLINE const LVecBase4d &get_aux() const; + INLINE void set_aux(const LVecBase4d &aux); + + void write(ostream &out, int indent_level) const; + int compare_to(const EggVertexAux &other) const; + +private: + LVecBase4d _aux; + +public: + static TypeHandle get_class_type() { + return _type_handle; + } + static void init_type() { + EggNamedObject::init_type(); + register_type(_type_handle, "EggVertexAux", + EggNamedObject::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 "eggVertexAux.I" + +#endif +