107 lines
4.1 KiB
Plaintext
107 lines
4.1 KiB
Plaintext
// Filename: modelNode.I
|
|
// Created by: drose (16Mar02)
|
|
//
|
|
////////////////////////////////////////////////////////////////////
|
|
//
|
|
// 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: ModelNode::Constructor
|
|
// Access: Public
|
|
// Description:
|
|
////////////////////////////////////////////////////////////////////
|
|
INLINE ModelNode::
|
|
ModelNode(const string &name) :
|
|
PandaNode(name)
|
|
{
|
|
_preserve_transform = PT_none;
|
|
_preserve_attributes = 0;
|
|
_transform_limit = 0;
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
// Function: ModelNode::set_preserve_transform
|
|
// Access: Public
|
|
// Description: Sets the preserve_transform flag. This restricts the
|
|
// ability of a flatten operation to affect the
|
|
// transform stored on this node. If the flag is:
|
|
//
|
|
// PT_none - the transform may be adjusted at will.
|
|
//
|
|
// PT_local - the local (and net) transform should not
|
|
// be changed in any way. If necessary, an extra
|
|
// transform will be left on the node above to guarantee
|
|
// this. This is the strongest restriction.
|
|
//
|
|
// PT_net - preserve the net transform from the
|
|
// root, but it's acceptable to modify the local
|
|
// transform stored on this particular node if
|
|
// necessary, so long as the net transform is not
|
|
// changed. This eliminates the need to drop an extra
|
|
// transform on the node above.
|
|
////////////////////////////////////////////////////////////////////
|
|
INLINE void ModelNode::
|
|
set_preserve_transform(ModelNode::PreserveTransform preserve_transform) {
|
|
_preserve_transform = preserve_transform;
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
// Function: ModelNode::get_preserve_transform
|
|
// Access: Public
|
|
// Description: Returns the current setting of the preserve_transform
|
|
// flag. See set_preserve_transform().
|
|
////////////////////////////////////////////////////////////////////
|
|
INLINE ModelNode::PreserveTransform ModelNode::
|
|
get_preserve_transform() const {
|
|
return _preserve_transform;
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
// Function: ModelNode::set_preserve_attributes
|
|
// Access: Public
|
|
// Description: Sets the preserve_attributes flag. This restricts the
|
|
// ability of a flatten operation to affect the
|
|
// render attributes stored on this node.
|
|
//
|
|
// The value should be the union of bits from
|
|
// SceneGraphReducer::AttribTypes that represent the
|
|
// attributes that should *not* be changed.
|
|
////////////////////////////////////////////////////////////////////
|
|
INLINE void ModelNode::
|
|
set_preserve_attributes(int preserve_attributes) {
|
|
_preserve_attributes = preserve_attributes;
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
// Function: ModelNode::get_preserve_attributes
|
|
// Access: Public
|
|
// Description: Returns the current setting of the preserve_attributes
|
|
// flag. See set_preserve_attributes().
|
|
////////////////////////////////////////////////////////////////////
|
|
INLINE int ModelNode::
|
|
get_preserve_attributes() const {
|
|
return _preserve_attributes;
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
// Function: ModelNode::Copy Constructor
|
|
// Access: Protected
|
|
// Description:
|
|
////////////////////////////////////////////////////////////////////
|
|
INLINE ModelNode::
|
|
ModelNode(const ModelNode ©) :
|
|
PandaNode(copy),
|
|
_preserve_transform(copy._preserve_transform),
|
|
_preserve_attributes(copy._preserve_attributes),
|
|
_transform_limit(copy._transform_limit)
|
|
{
|
|
}
|