Panda3D
fltLightSourceDefinition.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 fltLightSourceDefinition.h
10  * @author drose
11  * @date 2000-08-26
12  */
13 
14 #ifndef FLTLIGHTSOURCEDEFINITION_H
15 #define FLTLIGHTSOURCEDEFINITION_H
16 
17 #include "pandatoolbase.h"
18 
19 #include "fltRecord.h"
20 
21 #include "luse.h"
22 
23 /**
24  * Represents a single entry in the light source palette. This completely
25  * defines the color, etc. of a single light source, which may be referenced
26  * later by a FltLightSource bead in the hierarchy.
27  */
29 public:
31 
32  enum LightType {
33  LT_infinite = 0,
34  LT_local = 1,
35  LT_spot = 2
36  };
37 
38  int _light_index;
39  std::string _light_name;
40  LColor _ambient;
41  LColor _diffuse;
42  LColor _specular;
43  LightType _light_type;
44  PN_stdfloat _exponential_dropoff;
45  PN_stdfloat _cutoff_angle; // in degrees
46 
47  // yaw and pitch only for modeling lights, which are positioned at the
48  // eyepoint.
49  PN_stdfloat _yaw;
50  PN_stdfloat _pitch;
51 
52  PN_stdfloat _constant_coefficient;
53  PN_stdfloat _linear_coefficient;
54  PN_stdfloat _quadratic_coefficient;
55  bool _modeling_light;
56 
57 protected:
58  virtual bool extract_record(FltRecordReader &reader);
59  virtual bool build_record(FltRecordWriter &writer) const;
60 
61 public:
62  virtual TypeHandle get_type() const {
63  return get_class_type();
64  }
65  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
66  static TypeHandle get_class_type() {
67  return _type_handle;
68  }
69  static void init_type() {
70  FltRecord::init_type();
71  register_type(_type_handle, "FltLightSourceDefinition",
72  FltRecord::get_class_type());
73  }
74 
75 private:
76  static TypeHandle _type_handle;
77 
78  friend class FltHeader;
79 };
80 
81 #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...
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
This is the first bead in the file, the top of the bead hierarchy, and the primary interface to readi...
Definition: fltHeader.h:44
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:36
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81