MGCL V10  V10
MGCL V10
 全て クラス 名前空間 関数 変数 型定義 列挙型 列挙値 フレンド グループ ページ
PlaneImage.h
1 /********************************************************************/
2 /* Copyright (c) 2015 DG Technologies Inc. and Yuzi Mizuno */
3 /* All rights reserved. */
4 /********************************************************************/
5 #ifndef _MGPlaneImage_HH_
6 #define _MGPlaneImage_HH_
7 
8 #include <memory>
9 #include "mg/Plane.h"
10 #include "mgGL/Image.h"
11 #include "mgGL/texture.h"
12 
13 //
14 //Define MGPlaneImage Class.
15 
16 class MGOfstream;
17 class MGIfstream;
18 
23 
30 
31 class MG_DLL_DECLR MGPlaneImage:public MGPlane{
32 
33 public:
34 
36 
40 MGPlaneImage():m_pixelSizeWidth(0.),m_pixelSizeHeight(0.),
41 m_rightTexCoord(0.),m_topTexCoord(0.){;};
42 
44  const MGVector& uderiv,
45  const MGVector& vderiv,
46  const MGPosition &origin,
51  MGImage& image,//Image data will be transfered to this.
52  double pixelSizeWidth,
53  double pixelSizeHeight=-1.
54 );
57 
59 MGPlaneImage& operator=(const MGPlaneImage& gel2);
60 
62 
64 MGPosition center() const;
65 
67 MGPlaneImage* clone()const;
68 
70 void drawWire(
71  mgVBO& vbo,
72  double span_length,
73  int line_density=1
74 )const{MGSurface::drawWire(vbo,span_length,line_density);};
75 
77 //void make_display_list(
78 // MGCL::VIEWMODE vmode=MGCL::DONTCARE
79 //)const;We use MGPlane's make_display_list.
80 
82 void shade(
83  mgVBO& vbo,
84  const MGDrawParam& para,
86 )const;
87 
88 const MGImage& get_image()const{return m_image;};
89 MGImage& get_image(){return m_image;};
90 
92 long identify_type() const{return MGPLANEIMAGE_TID;};
93 
94 //Return (width, height) of the image.
95 int image_width()const{return m_image.width();};
96 int image_height()const{return m_image.height();};
97 
99 MGPosition left_bottom()const;
100 
102 MGPosition right_bottom()const;
103 
105 MGPosition right_top()const;
106 
108 MGPosition left_top()const;
109 
111 double param_e_u() const{return totalWidth();};
112 double param_e_v() const{return totalHeight();};
113 
114 
117 MGBox param_range() const;
118 
120 double param_s_u() const{return 0.;};
121 double param_s_v() const{return 0.;};
122 
126  int is_u
127  , double x
128 )const;
130 
132 MGCurve* perimeter_curve(int i)const;
133 
135 int perimeter_num() const{return 4;};
136 
141 MGPosition perimeter_uv(int i,double t) const;
142 
147 MGPvector<MGCurve> skeleton(int density=1)const;
148 
149 std::string whoami()const{return "PlaneImage";};
150 
152 void ReadMembers(MGIfstream& buf);
154 void WriteMembers(MGOfstream& buf)const;
155 
157 std::ostream& out(std::ostream&) const;
158 
159 //Get the one pixel size in world coordinate for width.
160 double pixelSizeWidth()const{return m_pixelSizeWidth;};
161 
162 //Get the one pixel size in world coordinate for height.
163 double pixelSeizeHeight()const{return m_pixelSizeHeight;};
164 
165 //Get total image size in world coordnate for width.
166 double totalWidth()const;
167 
168 //Get total image size in world coordnate for height.
169 double totalHeight()const;
170 
171 private:
172 
173  mutable mgTexture m_texture;//Texture to draw this image.
174  double m_pixelSizeWidth, m_pixelSizeHeight;
176 
177  double m_rightTexCoord, m_topTexCoord;
178 
181 MGBox* compute_box() const;
182 
183 };
184  // end of GLAttrib group
186 #endif
void WriteMembers(MGOfstream &buf) const
メンバデータを書き込む関数
MGCurve is an abstract class which represents a whole curve.
Definition: Curve.h:63
MGPlane is infinite plane in 3D space.
Definition: Plane.h:38
double param_s_u() const
Return starting parameter value.
Definition: PlaneImage.h:120
long identify_type() const
Return This object's typeID.
Definition: PlaneImage.h:92
double param_s_v() const
Definition: PlaneImage.h:121
void ReadMembers(MGIfstream &buf)
メンバデータを読み込む関数
MGImage defines bit map image data.
Definition: Image.h:26
MGImage & get_image()
Definition: PlaneImage.h:89
double pixelSizeWidth() const
Definition: PlaneImage.h:160
int height() const
Definition: Image.h:88
virtual void drawWire(mgVBO &vbo, double span_length, int line_density=1) const
Draw 3D curve in world coordinates.
Definition: Surface.h:251
MGIfstream is a class to read the serialized data generated by MGOfstream.
Definition: Ifstream.h:30
virtual MGPosition center() const
Obtain ceter coordinate of the geometry.
Definition: Plane.h:178
virtual MGPosition perimeter_uv(int i, double t) const
Definition: VBO.h:86
int image_height() const
Definition: PlaneImage.h:96
Vector of a general n space dimension.
Definition: Vector.h:26
virtual void shade(mgVBO &vbo, const MGDrawParam &para, mgVBO::ELEMENT_TARGET target=mgVBO::SHADING) const
Shade the object in world coordinates.
Definition: Plane.h:247
virtual MGBox param_range() const
Defines a Box of any space dimendion.
Definition: Box.h:34
Defines parameters to draw MGObject, maily to approximate by lines and facets.
Definition: drawParam.h:53
virtual MGCurve * parameter_curve(int is_u, double x) const
Represent a positional data.
Definition: Position.h:28
std::string whoami() const
Definition: PlaneImage.h:149
double param_e_u() const
Return ending parameter value.
Definition: PlaneImage.h:111
Texture definition class.
Definition: Texture.h:29
ELEMENT_TARGET
Definition: VBO.h:84
virtual MGPvector< MGCurve > skeleton(int density=1) const
MGImage m_image
Definition: PlaneImage.h:35
MGOfstream is a class to serialize all of the subclasses of MGGel.
Definition: Ofstream.h:31
double pixelSeizeHeight() const
Definition: PlaneImage.h:163
int perimeter_num() const
Return how many perimeters this surface has.
Definition: PlaneImage.h:135
virtual MGCurve * perimeter_curve(int i) const
Definition: Plane.h:462
MGPlaneImage defines square image plane.
Definition: PlaneImage.h:31
MGPlane * clone() const
double param_e_v() const
Definition: PlaneImage.h:112
MGPlaneImage()
Definition: PlaneImage.h:40
std::ostream & out(std::ostream &) const
int width() const
Definition: Image.h:87
int image_width() const
Definition: PlaneImage.h:95
OpenGL 4 用描画のためのクラス, in other words, display list.
Definition: VBO.h:76
MGPlane & operator=(const MGPlane &gel2)
void drawWire(mgVBO &vbo, double span_length, int line_density=1) const
Draw the image in world coordinates using texture.
Definition: PlaneImage.h:70
const MGImage & get_image() const
Definition: PlaneImage.h:88