Panda3D
fltLightSourceDefinition.h
1 // Filename: fltLightSourceDefinition.h
2 // Created by: drose (26Aug00)
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 FLTLIGHTSOURCEDEFINITION_H
16 #define FLTLIGHTSOURCEDEFINITION_H
17 
18 #include "pandatoolbase.h"
19 
20 #include "fltRecord.h"
21 
22 #include "luse.h"
23 
24 ////////////////////////////////////////////////////////////////////
25 // Class : FltLightSourceDefinition
26 // Description : Represents a single entry in the light source
27 // palette. This completely defines the color, etc. of
28 // a single light source, which may be referenced later
29 // by a FltLightSource bead in the hierarchy.
30 ////////////////////////////////////////////////////////////////////
32 public:
34 
35  enum LightType {
36  LT_infinite = 0,
37  LT_local = 1,
38  LT_spot = 2
39  };
40 
41  int _light_index;
42  string _light_name;
43  LColor _ambient;
44  LColor _diffuse;
45  LColor _specular;
46  LightType _light_type;
47  PN_stdfloat _exponential_dropoff;
48  PN_stdfloat _cutoff_angle; // in degrees
49 
50  // yaw and pitch only for modeling lights, which are positioned at
51  // the eyepoint.
52  PN_stdfloat _yaw;
53  PN_stdfloat _pitch;
54 
55  PN_stdfloat _constant_coefficient;
56  PN_stdfloat _linear_coefficient;
57  PN_stdfloat _quadratic_coefficient;
58  bool _modeling_light;
59 
60 protected:
61  virtual bool extract_record(FltRecordReader &reader);
62  virtual bool build_record(FltRecordWriter &writer) const;
63 
64 public:
65  virtual TypeHandle get_type() const {
66  return get_class_type();
67  }
68  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
69  static TypeHandle get_class_type() {
70  return _type_handle;
71  }
72  static void init_type() {
73  FltRecord::init_type();
74  register_type(_type_handle, "FltLightSourceDefinition",
75  FltRecord::get_class_type());
76  }
77 
78 private:
79  static TypeHandle _type_handle;
80 
81  friend class FltHeader;
82 };
83 
84 #endif
85 
86 
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...
This is the first bead in the file, the top of the bead hierarchy, and the primary interface to readi...
Definition: fltHeader.h:48
Represents a single entry in the light source palette.
The base class for all kinds of records in a MultiGen OpenFlight file.
Definition: fltRecord.h:40
This is the base class for all three-component vectors and points.
Definition: lvecBase4.h:111
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85