|
| 1 | +// Filename: cfCommand.cxx |
| 2 | +// Created by: drose (19Feb09) |
| 3 | +// |
| 4 | +//////////////////////////////////////////////////////////////////// |
| 5 | +// |
| 6 | +// PANDA 3D SOFTWARE |
| 7 | +// Copyright (c) Carnegie Mellon University. All rights reserved. |
| 8 | +// |
| 9 | +// All use of this software is subject to the terms of the revised BSD |
| 10 | +// license. You should have received a copy of this license along |
| 11 | +// with this source code in a file named "LICENSE." |
| 12 | +// |
| 13 | +//////////////////////////////////////////////////////////////////// |
| 14 | + |
| 15 | +#include "cfCommand.h" |
| 16 | + |
| 17 | +TypeHandle CFCommand::_type_handle; |
| 18 | +TypeHandle CFDoCullCommand::_type_handle; |
| 19 | + |
| 20 | +//////////////////////////////////////////////////////////////////// |
| 21 | +// Function: CFCommand::Destructor |
| 22 | +// Access: Published, Virtual |
| 23 | +// Description: |
| 24 | +//////////////////////////////////////////////////////////////////// |
| 25 | +CFCommand:: |
| 26 | +~CFCommand() { |
| 27 | +} |
| 28 | + |
| 29 | +//////////////////////////////////////////////////////////////////// |
| 30 | +// Function: CFDoCullCommand::register_with_read_factory |
| 31 | +// Access: Public, Static |
| 32 | +// Description: Tells the BamReader how to create objects of type |
| 33 | +// CFDoCullCommand. |
| 34 | +//////////////////////////////////////////////////////////////////// |
| 35 | +void CFDoCullCommand:: |
| 36 | +register_with_read_factory() { |
| 37 | + BamReader::get_factory()->register_factory(get_class_type(), make_from_bam); |
| 38 | +} |
| 39 | + |
| 40 | +//////////////////////////////////////////////////////////////////// |
| 41 | +// Function: CFDoCullCommand::write_datagram |
| 42 | +// Access: Public, Virtual |
| 43 | +// Description: Writes the contents of this object to the datagram |
| 44 | +// for shipping out to a Bam file. |
| 45 | +//////////////////////////////////////////////////////////////////// |
| 46 | +void CFDoCullCommand:: |
| 47 | +write_datagram(BamWriter *manager, Datagram &dg) { |
| 48 | + TypedWritable::write_datagram(manager, dg); |
| 49 | + manager->write_pointer(dg, _scene); |
| 50 | +} |
| 51 | + |
| 52 | +//////////////////////////////////////////////////////////////////// |
| 53 | +// Function: CFDoCullCommand::update_bam_nested |
| 54 | +// Access: Public, Virtual |
| 55 | +// Description: Called by the BamWriter when this object has not |
| 56 | +// itself been modified recently, but it should check |
| 57 | +// its nested objects for updates. |
| 58 | +//////////////////////////////////////////////////////////////////// |
| 59 | +void CFDoCullCommand:: |
| 60 | +update_bam_nested(BamWriter *manager) { |
| 61 | + manager->consider_update(_scene); |
| 62 | +} |
| 63 | + |
| 64 | +//////////////////////////////////////////////////////////////////// |
| 65 | +// Function: CFDoCullCommand::complete_pointers |
| 66 | +// Access: Public, Virtual |
| 67 | +// Description: Receives an array of pointers, one for each time |
| 68 | +// manager->read_pointer() was called in fillin(). |
| 69 | +// Returns the number of pointers processed. |
| 70 | +//////////////////////////////////////////////////////////////////// |
| 71 | +int CFDoCullCommand:: |
| 72 | +complete_pointers(TypedWritable **p_list, BamReader *manager) { |
| 73 | + int pi = TypedWritable::complete_pointers(p_list, manager); |
| 74 | + |
| 75 | + PandaNode *scene; |
| 76 | + DCAST_INTO_R(scene, p_list[pi++], pi); |
| 77 | + _scene = scene; |
| 78 | + |
| 79 | + return pi; |
| 80 | +} |
| 81 | + |
| 82 | +//////////////////////////////////////////////////////////////////// |
| 83 | +// Function: CFDoCullCommand::make_from_bam |
| 84 | +// Access: Protected, Static |
| 85 | +// Description: This function is called by the BamReader's factory |
| 86 | +// when a new object of type CFDoCullCommand is encountered |
| 87 | +// in the Bam file. It should create the CFDoCullCommand |
| 88 | +// and extract its information from the file. |
| 89 | +//////////////////////////////////////////////////////////////////// |
| 90 | +TypedWritable *CFDoCullCommand:: |
| 91 | +make_from_bam(const FactoryParams ¶ms) { |
| 92 | + CFDoCullCommand *node = new CFDoCullCommand; |
| 93 | + DatagramIterator scan; |
| 94 | + BamReader *manager; |
| 95 | + |
| 96 | + parse_params(params, scan, manager); |
| 97 | + node->fillin(scan, manager); |
| 98 | + |
| 99 | + return node; |
| 100 | +} |
| 101 | + |
| 102 | +//////////////////////////////////////////////////////////////////// |
| 103 | +// Function: CFDoCullCommand::fillin |
| 104 | +// Access: Protected |
| 105 | +// Description: This internal function is called by make_from_bam to |
| 106 | +// read in all of the relevant data from the BamFile for |
| 107 | +// the new CFDoCullCommand. |
| 108 | +//////////////////////////////////////////////////////////////////// |
| 109 | +void CFDoCullCommand:: |
| 110 | +fillin(DatagramIterator &scan, BamReader *manager) { |
| 111 | + TypedWritable::fillin(scan, manager); |
| 112 | + manager->read_pointer(scan); |
| 113 | +} |
0 commit comments