Panda3D
fltMaterial.h
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 fltMaterial.h
10  * @author drose
11  * @date 2000-08-25
12  */
13 
14 #ifndef FLTMATERIAL_H
15 #define FLTMATERIAL_H
16 
17 #include "pandatoolbase.h"
18 
19 #include "fltRecord.h"
20 
21 #include "luse.h"
22 
23 class DatagramIterator;
24 
25 /**
26  * Represents a single material in the material palette.
27  */
28 class FltMaterial : public FltRecord {
29 public:
30  FltMaterial(FltHeader *header);
31 
32  enum Flags {
33  F_materials_used = 0x80000000,
34  };
35 
36  int _material_index;
37  std::string _material_name;
38  unsigned int _flags;
39  LRGBColor _ambient;
40  LRGBColor _diffuse;
41  LRGBColor _specular;
42  LRGBColor _emissive;
43  PN_stdfloat _shininess;
44  PN_stdfloat _alpha;
45 
46 protected:
47  virtual bool extract_record(FltRecordReader &reader);
48  virtual bool build_record(FltRecordWriter &writer) const;
49 
50 public:
51  bool extract_14_record(int index, DatagramIterator &di);
52  bool build_14_record(Datagram &datagram);
53 
54 public:
55  virtual TypeHandle get_type() const {
56  return get_class_type();
57  }
58  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
59  static TypeHandle get_class_type() {
60  return _type_handle;
61  }
62  static void init_type() {
63  FltRecord::init_type();
64  register_type(_type_handle, "FltMaterial",
65  FltRecord::get_class_type());
66  }
67 
68 private:
69  static TypeHandle _type_handle;
70 
71  friend class FltHeader;
72 };
73 
74 #endif
This class writes a sequence of FltRecords to an ostream, handling opcode and size counts properly.
This class turns an istream into a sequence of FltRecords by reading a sequence of Datagrams and extr...
bool build_14_record(Datagram &datagram)
Fills up the current record on the FltRecordWriter with data for this record, formatted as a part of ...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition: register_type.I:22
Represents a single material in the material palette.
Definition: fltMaterial.h:28
This is the first bead in the file, the top of the bead hierarchy, and the primary interface to readi...
Definition: fltHeader.h:44
bool extract_14_record(int index, DatagramIterator &di)
Fills in the information in this record based on the information from the current position within the...
The base class for all kinds of records in a MultiGen OpenFlight file.
Definition: fltRecord.h:36
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A class to retrieve the individual data elements previously stored in a Datagram.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:38