MGCL V10  V10
MGCL V10
 全て クラス 名前空間 関数 変数 型定義 列挙型 列挙値 フレンド グループ ページ
Lights.h
1 /********************************************************************/
2 /* Copyright (c) 2015 DG Technologies Inc. and Yuzi Mizuno */
3 /* All rights reserved. */
4 /********************************************************************/
5 #pragma once
6 
7 #ifndef _MGLIGHTS_HH_
8 #define _MGLIGHTS_HH_
9 
10 #include "mgGL/GLAttrib.h"
11 
12 class MGOfstream;
13 class MGIfstream;
14 class MGLight;
15 
20 
23 class MG_DLL_DECLR MGLights:public MGGLAttrib{
24 
25 public:
26 
31 
32 // Constructors
33 
34 MGLights();
35 
38  MGLight* light
39 ):MGGLAttrib(1),m_lights(light){;};
40 
42 
43 public:
44 
46 MGLights& operator=(const MGGel& gel2);
47 MGLights& operator=(const MGLights& gel2);
48 
50 bool operator<(const MGLights& gel2)const;
51 bool operator<(const MGGel& gel2)const;
52 
53 const MGLight* back()const{return m_lights.back();};
54 MGLight* back(){return m_lights.back();};
55 iterator begin(){return m_lights.begin();};
56 const_iterator begin()const{return m_lights.begin();};
57 void clear(){m_lights.clear();};
58 bool empty()const{return m_lights.empty();};
59 iterator end(){return m_lights.end();};
60 const_iterator end()const{return m_lights.end();};
61 const MGLight* front()const{return m_lights.front();};
62 MGLight* front(){return m_lights.front();};
63 const MGLight* operator[](int i)const{return m_lights[i];};
64 MGLight* operator[](int i){return m_lights[i];};
65 void pop_back(){m_lights.pop_back();};
66 
68 virtual MGLights* clone()const;
69 
71 virtual void exec()const;
72 
75  mgVBO& vbo,
76  bool no_color=false
77 )const{exec();};
78 
81 int push_back(MGLight* light);
82 
84 void render(mgVBO& vbo)const{exec();};
85 
87 void set_render_attrib_mask(unsigned int& mask)const{set_Amask(mask,LIGHTING_BIT);};
88 
90 void reset_render_attrib_mask(unsigned int& mask)const{reset_Amask(mask,LIGHTING_BIT);};
91 
93 void set_draw_attrib_mask(unsigned int& mask)const{set_Amask(mask,LIGHTING_BIT);};
94 
96 int size()const{return (int)m_lights.size();};
97 
99 void reset_draw_attrib_mask(unsigned int& mask)const{;};
100 
102 virtual long identify_type() const{return MGLIGHTS_TID;};
103 
104 std::string whoami()const{return "Lights";};
105 
107 virtual void ReadMembers(MGIfstream& buf);
109 virtual void WriteMembers(MGOfstream& buf)const;
110 
112 virtual std::ostream& out(std::ostream&) const;
113 
114 private:
115 
116  MGPvector<MGLight> m_lights;
117 
118 };
119  // end of GLAttrib group
121 #endif // _MGLIGHTS_HH_
const MGLight * operator[](int i) const
Definition: Lights.h:63
void reset_draw_attrib_mask(unsigned int &mask) const
Turn off the appropriate mask bit for this attribute. See glPushAttrib().
Definition: Lights.h:99
MGLights(MGLight *light)
Construct MGLights of one light.
Definition: Lights.h:37
void reset_Amask(unsigned int &mask, MGGLAttrib::ATTRIB_MASK bit)
MGGLAttrib is an abstract class which defines the enum of undefined or disabled.
Definition: GLAttrib.h:35
void set_Amask(unsigned int &mask, MGGLAttrib::ATTRIB_MASK bit)
Set or reset the bit of mask.
virtual bool operator<(const MGGel &gel2) const
virtual MGGLAttrib * clone() const =0
Generate a newed clone object.
virtual void WriteMembers(MGOfstream &buf) const
Write all member data.
MGPvector< MGLight >::reverse_iterator reverse_iterator
Definition: Lights.h:29
void render(mgVBO &vbo) const
render GLAttribute process.
Definition: Lights.h:84
virtual void ReadMembers(MGIfstream &buf)
Read all member data.
const_iterator end() const
Definition: Lights.h:60
MGIfstream is a class to read the serialized data generated by MGOfstream.
Definition: Ifstream.h:30
const_iterator begin() const
Definition: Lights.h:56
virtual MGGLAttrib & operator=(const MGGLAttrib &gel2)
Definition: GLAttrib.h:70
const MGLight * front() const
Definition: Lights.h:61
void clear()
Definition: Lights.h:57
MGLight is an abstract base class for light sources.
Definition: Light.h:27
virtual long identify_type() const
Return This object's typeID.
Definition: Lights.h:102
void reset_render_attrib_mask(unsigned int &mask) const
Turn off the appropriate mask bit for this attribute. See glPushAttrib().
Definition: Lights.h:90
MGGel is an abstract class which represents a group element.
Definition: Gel.h:53
MGLight * back()
Definition: Lights.h:54
void pop_back()
Definition: Lights.h:65
iterator begin()
Definition: Lights.h:55
bool empty() const
Definition: Lights.h:58
void set_draw_attrib_mask(unsigned int &mask) const
Turn on the appropriate mask bit for this attribute. See glPushAttrib().
Definition: Lights.h:93
virtual std::ostream & out(std::ostream &) const
Output virtual function.
MGOfstream is a class to serialize all of the subclasses of MGGel.
Definition: Ofstream.h:31
MGLight * operator[](int i)
Definition: Lights.h:64
MGPvector< MGLight >::const_iterator const_iterator
Definition: Lights.h:28
MGPvector< MGLight >::const_reverse_iterator const_reverse_iterator
Definition: Lights.h:30
MGLight * front()
Definition: Lights.h:62
const MGLight * back() const
Definition: Lights.h:53
MGPvector< MGLight >::iterator iterator
Definition: Lights.h:27
void drawAttrib(mgVBO &vbo, bool no_color=false) const
draw GLAttribute process.
Definition: Lights.h:74
void set_render_attrib_mask(unsigned int &mask) const
Turn on the appropriate mask bit for this attribute. See glPushAttrib().
Definition: Lights.h:87
std::string whoami() const
Definition: Lights.h:104
a container class for light sources(MGDirectionalLight, MGPointLight, or MGSpotLight).
Definition: Lights.h:23
OpenGL 4 用描画のためのクラス, in other words, display list.
Definition: VBO.h:76
Defines Vector of newed object pointers.
Definition: Pvector.h:27
int size() const
Obtain the light number defined.
Definition: Lights.h:96
iterator end()
Definition: Lights.h:59