Panda3D
Loading...
Searching...
No Matches
transform2sg.cxx
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file transform2sg.cxx
10 * @author drose
11 * @date 2002-03-12
12 */
13
14#include "transform2sg.h"
15#include "transformState.h"
16#include "dataNodeTransmit.h"
17#include "dataGraphTraverser.h"
18
19
20TypeHandle Transform2SG::_type_handle;
21
22/**
23 *
24 */
25Transform2SG::
26Transform2SG(const std::string &name) :
27 DataNode(name)
28{
29 _transform_input = define_input("transform", TransformState::get_class_type());
30
31 _node = nullptr;
32}
33
34/**
35 * Sets the node that this object will adjust.
36 */
38set_node(PandaNode *node) {
39 _node = node;
40}
41
42/**
43 * Returns the node that this object will adjust, or NULL if the node has not
44 * yet been set.
45 */
47get_node() const {
48 return _node;
49}
50
51
52/**
53 * The virtual implementation of transmit_data(). This function receives an
54 * array of input parameters and should generate an array of output
55 * parameters. The input parameters may be accessed with the index numbers
56 * returned by the define_input() calls that were made earlier (presumably in
57 * the constructor); likewise, the output parameters should be set with the
58 * index numbers returned by the define_output() calls.
59 */
60void Transform2SG::
61do_transmit_data(DataGraphTraverser *trav, const DataNodeTransmit &input,
63 Thread *current_thread = trav->get_current_thread();
64
65 if (input.has_data(_transform_input)) {
66 const TransformState *transform;
67 DCAST_INTO_V(transform, input.get_data(_transform_input).get_ptr());
68 if (_node != nullptr) {
69 _node->set_transform(transform, current_thread);
70 }
71 }
72}
This object supervises the traversal of the data graph and the moving of data from one DataNode to it...
Thread * get_current_thread() const
Returns the currently-executing thread object, as passed to the DataGraphTraverser constructor.
Encapsulates the data generated from (or sent into) any particular DataNode.
const EventParameter & get_data(int index) const
Extracts the data for the indicated index, if it has been stored, or the empty parameter if it has no...
bool has_data(int index) const
Returns true if the indicated parameter has been stored, false otherwise.
The fundamental type of node for the data graph.
Definition dataNode.h:52
TypedWritableReferenceCount * get_ptr() const
Retrieves a pointer to the actual value stored in the parameter.
A basic node of the scene graph or data graph.
Definition pandaNode.h:65
A thread; that is, a lightweight process.
Definition thread.h:46
PandaNode * get_node() const
Returns the node that this object will adjust, or NULL if the node has not yet been set.
void set_node(PandaNode *node)
Sets the node that this object will adjust.
Indicates a coordinate-system transform on vertices.
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.