Panda3D
 All Classes Functions Variables Enumerations
fltMaterial.h
1 // Filename: fltMaterial.h
2 // Created by: drose (25Aug00)
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 #ifndef FLTMATERIAL_H
16 #define FLTMATERIAL_H
17 
18 #include "pandatoolbase.h"
19 
20 #include "fltRecord.h"
21 
22 #include "luse.h"
23 
24 class DatagramIterator;
25 
26 ////////////////////////////////////////////////////////////////////
27 // Class : FltMaterial
28 // Description : Represents a single material in the material palette.
29 ////////////////////////////////////////////////////////////////////
30 class FltMaterial : public FltRecord {
31 public:
32  FltMaterial(FltHeader *header);
33 
34  enum Flags {
35  F_materials_used = 0x80000000,
36  };
37 
38  int _material_index;
39  string _material_name;
40  unsigned int _flags;
41  LRGBColor _ambient;
42  LRGBColor _diffuse;
43  LRGBColor _specular;
44  LRGBColor _emissive;
45  PN_stdfloat _shininess;
46  PN_stdfloat _alpha;
47 
48 protected:
49  virtual bool extract_record(FltRecordReader &reader);
50  virtual bool build_record(FltRecordWriter &writer) const;
51 
52 public:
53  bool extract_14_record(int index, DatagramIterator &di);
54  bool build_14_record(Datagram &datagram);
55 
56 public:
57  virtual TypeHandle get_type() const {
58  return get_class_type();
59  }
60  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
61  static TypeHandle get_class_type() {
62  return _type_handle;
63  }
64  static void init_type() {
65  FltRecord::init_type();
66  register_type(_type_handle, "FltMaterial",
67  FltRecord::get_class_type());
68  }
69 
70 private:
71  static TypeHandle _type_handle;
72 
73  friend class FltHeader;
74 };
75 
76 #endif
77 
78 
This is the base class for all three-component vectors and points.
Definition: lvecBase3.h:105
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 ...
Represents a single material in the material palette.
Definition: fltMaterial.h:30
This is the first bead in the file, the top of the bead hierarchy, and the primary interface to readi...
Definition: fltHeader.h:48
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:40
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:85
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:43