Panda3D
Loading...
Searching...
No Matches
fltFace.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 fltFace.cxx
10 * @author drose
11 * @date 2000-08-25
12 */
13
14#include "fltFace.h"
15#include "fltRecordReader.h"
16#include "fltRecordWriter.h"
17#include "fltHeader.h"
18#include "fltMaterial.h"
19
20TypeHandle FltFace::_type_handle;
21
22/**
23 *
24 */
25FltFace::
26FltFace(FltHeader *header) : FltGeometry(header) {
27}
28
29/**
30 * Fills in the information in this bead based on the information given in the
31 * indicated datagram, whose opcode has already been read. Returns true on
32 * success, false if the datagram is invalid.
33 */
34bool FltFace::
35extract_record(FltRecordReader &reader) {
36 if (!FltBeadID::extract_record(reader)) {
37 return false;
38 }
39 if (!FltGeometry::extract_record(reader)) {
40 return false;
41 }
42
43 nassertr(reader.get_opcode() == FO_face, false);
44
45 DatagramIterator &iterator = reader.get_iterator();
46 check_remaining_size(iterator);
47 return true;
48}
49
50/**
51 * Fills up the current record on the FltRecordWriter with data for this
52 * record, but does not advance the writer. Returns true on success, false if
53 * there is some error.
54 */
55bool FltFace::
56build_record(FltRecordWriter &writer) const {
57 if (!FltBeadID::build_record(writer)) {
58 return false;
59 }
60 if (!FltGeometry::build_record(writer)) {
61 return false;
62 }
63
64 writer.set_opcode(FO_face);
65
66 return true;
67}
A class to retrieve the individual data elements previously stored in a Datagram.
This is a base class for both FltFace and FltMesh, which are two different kinds of geometric primiti...
Definition fltGeometry.h:33
This is the first bead in the file, the top of the bead hierarchy, and the primary interface to readi...
Definition fltHeader.h:44
This class turns an istream into a sequence of FltRecords by reading a sequence of Datagrams and extr...
FltOpcode get_opcode() const
Returns the opcode associated with the current record.
DatagramIterator & get_iterator()
Returns an iterator suitable for extracting data from the current record.
This class writes a sequence of FltRecords to an ostream, handling opcode and size counts properly.
void set_opcode(FltOpcode opcode)
Sets the opcode associated with the current record.
void check_remaining_size(const DatagramIterator &di, const std::string &name=std::string()) const
Checks that the iterator has no bytes left, as it should at the end of a successfully read record.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.