MGCL V10  V10
MGCL V10
 全て クラス 名前空間 関数 変数 型定義 列挙型 列挙値 フレンド グループ ページ
SpotLight.h
1 /********************************************************************/
2 /* Copyright (c) 2015 DG Technologies Inc. and Yuzi Mizuno */
3 /* All rights reserved. */
4 /********************************************************************/
5 #pragma once
6 
7 #ifndef _MGSPOTLIGHT_HH_
8 #define _MGSPOTLIGHT_HH_
9 
10 #include "mgGL/PointLight.h"
11 
16 
22 class MG_DLL_DECLR MGSpotLight : public MGPointLight{
23 
24 public:
25 
27 enum {
28  DIRECTION=1,
30  CUT_OFF_ANGLE
31 };
32 
34 
35 MGSpotLight();
37  float intensity,
38  float ambientIntensity,
39  const float color[3],
40  const MGPosition& location,
41  float radius,
42  const float attenuation[3],
43  const MGVector& direction,
46  float exponent,
47  float cutOffAngle
48 );
49 
51 
53 MGSpotLight& operator=(const MGGel& gel2);
54 MGSpotLight& operator=(const MGSpotLight& gel2);
55 
57 bool operator<(const MGSpotLight& gel2)const;
58 bool operator<(const MGGel& gel2)const;
59 
61 
63 MGSpotLight* clone()const;
64 
65 void setDirection(const MGVector& direction);
66 void setDirection(const float direction[3]){
67  for(int i=0; i<3; i++) m_direction[i]=direction[i];
68 }
69 void setDirection(float v0, float v1, float v2){
70  m_direction[0]=v0;
71  m_direction[1]=v1;
72  m_direction[2]=v2;
73 }
74 void getDirection(MGVector& direction);
75 void getDirection(float direction[3]){
76  for(int i=0; i<3; i++) direction[i]=m_direction[i];
77 }
78 void getDirection(float& v0, float& v1, float& v2){
79  v0=m_direction[0];
80  v1=m_direction[1];
81  v2=m_direction[2];
82 }
83 
84 void setExponent(float exponent){m_exponent=exponent;};
85 float getExponent(){return m_exponent;};
86 
87 void setCutOffAngle(float cutOffAngle){m_cutOffAngle=cutOffAngle;};
88 float getCutOffAngle(){return m_cutOffAngle;};
89 
90 
93 int exec()const;
94 
96 long identify_type() const{return MGSPOT_LIGHT_TID;};
97 
98 std::string whoami()const{return "SpotLight";};
99 
101 void ReadMembers(MGIfstream& buf);
103 void WriteMembers(MGOfstream& buf)const;
104 
106 std::ostream& out(std::ostream&) const;
107 
110 virtual void transform(const MGVector& v);
111 
113 virtual void transform(double scale);
114 
116 virtual void transform(const MGMatrix& mat);
117 
119 virtual void transform(const MGTransf& tr);
120 
121 private:
122 
123  float m_direction[3];
124 
125  float m_exponent;
126  float m_cutOffAngle;
127 
128 };
129  // end of GLAttrib group
131 #endif // _MGSPOTLIGHT_HH_
float getCutOffAngle()
Definition: SpotLight.h:88
MGTransf represents a transformation of a space dimension.
Definition: Transf.h:35
float getExponent()
Definition: SpotLight.h:85
virtual void ReadMembers(MGIfstream &buf)
Read all member data.
MGPointLight is a point light source that radiates equally in all directions.
Definition: PointLight.h:24
void setDirection(float v0, float v1, float v2)
Definition: SpotLight.h:69
MGPointLight & operator=(const MGGel &gel2)
virtual ~MGPointLight();
void getDirection(float direction[3])
Definition: SpotLight.h:75
MGIfstream is a class to read the serialized data generated by MGOfstream.
Definition: Ifstream.h:30
bool operator<(const MGPointLight &gel2) const
comparison
virtual void WriteMembers(MGOfstream &buf) const
Write all member data.
void setExponent(float exponent)
Definition: SpotLight.h:84
A directional light source.
Definition: SpotLight.h:22
Vector of a general n space dimension.
Definition: Vector.h:26
std::string whoami() const
Definition: SpotLight.h:98
Definition: SpotLight.h:29
virtual std::ostream & out(std::ostream &) const
Output virtual function.
MGGel is an abstract class which represents a group element.
Definition: Gel.h:53
Represent a positional data.
Definition: Position.h:28
void setCutOffAngle(float cutOffAngle)
Definition: SpotLight.h:87
virtual MGPointLight * clone() const
Generate a newed clone object.
void getDirection(float &v0, float &v1, float &v2)
Definition: SpotLight.h:78
MGOfstream is a class to serialize all of the subclasses of MGGel.
Definition: Ofstream.h:31
void setDirection(const float direction[3])
Definition: SpotLight.h:66
virtual void transform(const MGVector &v)
Transform the gel by the argument.
long identify_type() const
Return This object's typeID.
Definition: SpotLight.h:96
virtual int exec() const
MGMatrix is a matix of m by m, where m is the space dimension.
Definition: Matrix.h:30