MGCL V10  V10
MGCL V10
 全て クラス 名前空間 関数 変数 型定義 列挙型 列挙値 フレンド グループ ページ
VBOLeaf.h
1  /********************************************************************/
2 /* Copyright (c) 2015 DG Technologies Inc. and Yuzi Mizuno */
3 /* All rights reserved. */
4 /********************************************************************/
5 
6 #if !defined(_MGVBOLEAF__INCLUDED_)
7 #define _MGVBOLEAF__INCLUDED_
8 
9 #if _MSC_VER > 1000
10 #pragma once
11 #endif // _MSC_VER > 1000
12 
13 #include "MGCLStdAfx.h"
14 #include "mgGL/Color.h"
15 #include "mgGL/VBOElement.h"
16 
17 class MGPosition;
18 class MGBPointSeq;
19 class MGCurve;
20 class mgVBO;
21 class mgVBOLeafBuilder;
22 class mgTexture;
23 
30 // mgVBOLeaf
32 
34 
38 class MG_DLL_DECLR mgVBOLeaf:public mgVBOElement{
39 
46 static const GLfloat m_PolygonModePointSizeBase;
47 
48 friend class mgVBO;
49 
50 public:
51 
52 mgVBOLeaf();
53 mgVBOLeaf(GLfloat size,MGColor& color);
54 mgVBOLeaf(const mgVBOLeaf& vbol);
55 mgVBOLeaf(const mgVBOLeafBuilder& builder);
56 ~mgVBOLeaf();
57 
60 //mgVBOLeaf* clone()const;
61 
65 bool is_made(MGCL::VIEWMODE viewMode=MGCL::DONTCARE){return true;};
66 
70 
74 void draw(MGCL::VIEWMODE viewMode=MGCL::DONTCARE);
75 
79 void redraw(MGCL::VIEWMODE viewMode=MGCL::DONTCARE){draw(viewMode);};
80 
84 virtual void selectionDraw(MGCL::VIEWMODE viewMode=MGCL::DONTCARE);
85 //
86 
88 //void setFunctionID(int functionID){m_functionID=functionID;};
89 //int getFunctionID()const{return m_functionID;};
90 
92 void setDrawType(mgGLSL::DrawType drawType){m_drawType=drawType;};
93 mgGLSL::DrawType getDrawType()const{return m_drawType;};
94 
97 void setTexture(mgTexture* texture);
98 
100 const mgTexture* getTexture()const;
101 mgTexture* getTexture();
102 
104 bool texture_is_bound()const;
105 
108 void updateVertex(unsigned ID, const MGPosition& P);
109 
113 void updateVertices(unsigned startID, const std::vector<MGPosition>& Ps);
114 
118 void updateVertices(unsigned startID, const MGBPointSeq& Ps);
119 
123 void updateVertices(unsigned startID, unsigned numVertices, const float* area);
124 
126 unsigned getVerticesNumber()const{return m_count;};
127 
131 unsigned getDName()const{return 0;};
132 
136 virtual GLuint getSelectionName()const{return 0;};
137 
141 void setPolygonMode(GLenum mode);
142 
143 void setStaticAttribColor(const MGColor& color){//colorにはundefinedのものも許される
144  m_color=color;
145 };
146 
147 void setPrimitiveMode(GLenum primitiveMode){m_primitiveMode=primitiveMode;};
148 
150 void setLightMode(int mode);
151 
157 void setLineStipple(short int factor, GLushort pattern);
158 
159 void setStaticAttribLineWidth(GLfloat size);
160 void setStaticAttribPointSize(GLfloat size);
161 
162 protected:
163 
164 private:
165 
166  //int m_functionID;///the function ID to set to the current mgGLSLProgram.
167  // ///mgVBO will invoke setUniform("functionID",m_functionID);
168  // ///Initially m_functionID=0.
169 
170  mgGLSL::DrawType m_drawType;
171 
172  GLuint m_bufferID;
173 
176  bool m_ColorSpecified:1,m_NormalSpecified:1,m_TextureSpecified:1;
177 
178  mutable GLuint m_vertexArrayID;
179 
182  GLenum m_primitiveMode;
183  unsigned m_count;
184 
185  mutable mgTexture* m_texture;
186 
188  MGColor m_color;
189 
191  GLfloat m_size;
192 
201  short int m_stippleFactor;
202  GLushort m_LineStipplePattern;
205 
207  int m_lightMode;
208 
209 void execStaticAttrib(MGCL::VIEWMODE viewMode, bool selection=false);
210 
211 };
212  // end of DisplayHandling group
214 #endif // !defined(_MGVBOLEAF__INCLUDED_)
Interface class to include an element in mgVBO class's.
Definition: VBOElement.h:44
MGCurve is an abstract class which represents a whole curve.
Definition: Curve.h:63
void setStaticAttribColor(const MGColor &color)
Definition: VBOLeaf.h:143
void setLineStipple(short int factor, GLushort pattern=0)
size<=0. はundefinedを示す
Definition: MGCL.h:272
unsigned getDName() const
Definition: VBOLeaf.h:131
void setStaticAttribPointSize(GLfloat size)
size<=0. はundefinedを示す
void make_display_list(MGCL::VIEWMODE vmode=MGCL::DONTCARE)
Definition: VBOLeaf.h:69
mgGLSL::DrawType getDrawType() const
Definition: VBOLeaf.h:93
MGColor defines the OpenGL color (R,G,B,A).
Definition: Color.h:26
void setLightMode(int mode)
Set light mode. mode=-1:undefined, =0:disabled, =1:enabled.
Definition: VBO.h:448
virtual void draw(MGCL::VIEWMODE viewMode=MGCL::DONTCARE)=0
DrawType
Definition: glslprogram.h:25
void setPrimitiveMode(GLenum primitiveMode)
Definition: VBOLeaf.h:147
Represent a positional data.
Definition: Position.h:28
Texture definition class.
Definition: Texture.h:29
short int m_stippleFactor
Definition: VBO.h:484
Defines BPoint seq of a space dimension and of a capacity.
Definition: BPointSeq.h:38
VIEWMODE
Definition: MGCL.h:271
void redraw(MGCL::VIEWMODE viewMode=MGCL::DONTCARE)
Definition: VBOLeaf.h:79
int m_lightMode
m_LineStipplePatternindicates the pattern.
Definition: VBO.h:490
GLushort m_LineStipplePattern
Definition: VBO.h:487
void setTexture(mgTexture *texture)
virtual GLuint getSelectionName() const
Definition: VBOLeaf.h:136
bool is_made(MGCL::VIEWMODE viewMode=MGCL::DONTCARE)
Definition: VBOLeaf.h:65
virtual void selectionDraw(MGCL::VIEWMODE viewMode=MGCL::DONTCARE)=0
void setStaticAttribLineWidth(GLfloat size)
mgVBOに対して描画データ作成後の情報を保持するためのクラス.
Definition: VBOLeaf.h:38
void setDrawType(mgGLSL::DrawType drawType)
DrawTypeをセットする
Definition: VBOLeaf.h:92
OpenGL 4 用描画のためのクラス, in other words, display list.
Definition: VBO.h:76
unsigned getVerticesNumber() const
Vertexの数を求める
Definition: VBOLeaf.h:126