資源簡介
使用18個控制點繪制6組三次Bezier曲線魚輪廓,可以通過調節控制點,控制魚輪廓生成形狀。

代碼片段和文件信息
/*
?* This?Code?Was?Created?By?Jeff?Molofee?2000
?* A?HUGE?Thanks?To?Fredric?Echols?For?Cleaning?Up
?* And?Optimizing?The?base?Code?Making?It?More?Flexible!
?* If?You‘ve?Found?This?Code?Useful?Please?Let?Me?Know.
?* Visit?My?Site?At?nehe.gamedev.net
?*/
#include? //?Header?File?For?Windows
#include? //?Header?File?For?The?OpenGL32?Library
#include? //?Header?File?For?The?GLu32?Library
#include? //?Header?File?For?The?Glaux?Library
#include?
#include?
//Math?types?derived?from?the?KempoApi?tMath?library
bool????????isClicked??=?false; //?NEW:?Clicking?The?Mouse?
bool????????isRClicked?=?false; //?NEW:?Clicking?The?Right?Mouse?Button?
typedef?union?Tuple2f_t
{
struct
{
GLfloat?X?Y;
}?s;
GLfloat?T[2];
}?Tuple2fT;??????//A?generic?2-element?tuple?that?is?represented?by?single-precision?floating?point?xy?coordinates.?
#define?Point2fT????Tuple2fT???//A?2?element?point?that?is?represented?by?single?precision?floating?point?xy?coordinates.?
HDC hDC=NULL; //?Private?GDI?Device?Context
HGLRC hRC=NULL; //?Permanent?Rendering?Context
HWND hWnd=NULL; //?Holds?Our?Window?Handle
HINSTANCE hInstance; //?Holds?The?Instance?Of?The?Application
bool keys[256]; //?Array?Used?For?The?Keyboard?Routine
bool active=TRUE; //?Window?Active?Flag?Set?To?TRUE?By?Default
bool fullscreen=TRUE; //?Fullscreen?Flag?Set?To?Fullscreen?Mode?By?Default
bool?????keyleftdown=TRUE;
Point2fT????MousePt; //?NEW:?Current?Mouse?Point
float?p0_h=0;
float?p0_w=0;
float?p1_h=0;
float?p1_w=0;
float?p2_h=0;
float?p2_w=0;
float?p3_h=0;
float?p3_w=0;
float?p11_h=0;
float?p11_w=0;
float?p22_h=0;
float?p22_w=0;
float?p33_h=0;
float?p33_w=0;
float?p111_h=0;
float?p111_w=0;
float?p222_h=0;
float?p222_w=0;
float?p333_h=0;
float?p333_w=0;
LRESULT CALLBACK?WndProc(HWND?UINT?WPARAM?LPARAM); //?Declaration?For?WndProc
//文件
std::ofstream?putfiletxt(“a.txt“);
//定義頂點類
class?Point
{
private:
float?p_x;
float?p_y;
float?p_z;
public:
Point(float?xfloat?yfloat?z):p_x(x)p_y(y)p_z(z)
{
?????
}
Point?operator+(Point?&point)
{
???Point?p=*this;
p.p_x=p.p_x+point.p_x;
p.p_y=p.p_y+point.p_y;
p.p_z=p.p_z+point.p_z;
return?p;
}
Point?operator*(float?m)
{
????Point?p=*this;
p.p_x=p.p_x*m;
p.p_y=p.p_y*m;
p.p_z=p.p_z*m;
return?p;
}
float?point_x()
{
return?p_x;
}
float?point_y()
{
return?p_y;
}
float?point_z()
{
return?p_z;
}
};
void?drawallpoint(Point&?point0Point&?point1Point&?point2Point&?point3)
{
//glEnable(GL_LINE_STIPPLE);?//聲明線型為虛線;
//glLineStipple?(10?0x1111);?//設定線型
//glLineWidth(2);?//設定線寬
//glBegin(GL_LINE_STRIP);
//glColor3f(0.01.00.0);
//glVertex3f(point0.point_x()point0.point_y()point0.point_z());
//glVertex3f(point1.point_x()point1.point_y()point1.point_z());
//glVertex3f(point2.point_x()point2.point_
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????7884198??2011-10-26?02:54??鯽魚厚輪廓\a.txt
?????文件?????102090??2011-07-12?17:25??鯽魚厚輪廓\Debug\a.txt
?????文件??????16294??2011-10-26?02:35??鯽魚厚輪廓\Debug\BuildLog.htm
?????文件?????667648??2011-10-26?02:35??鯽魚厚輪廓\Debug\lesson2.exe
?????文件????????146??2011-04-11?22:40??鯽魚厚輪廓\Debug\lesson2.exe.em
?????文件????????212??2011-04-11?22:40??鯽魚厚輪廓\Debug\lesson2.exe.em
?????文件????????145??2011-10-26?02:35??鯽魚厚輪廓\Debug\lesson2.exe.intermediate.manifest
?????文件????1501284??2011-10-26?02:35??鯽魚厚輪廓\Debug\lesson2.ilk
?????文件?????532378??2011-10-26?02:35??鯽魚厚輪廓\Debug\Lesson2.obj
?????文件????3042304??2011-10-26?02:35??鯽魚厚輪廓\Debug\lesson2.pdb
?????文件?????????67??2011-10-26?02:35??鯽魚厚輪廓\Debug\mt.dep
?????文件????1453056??2011-10-26?02:35??鯽魚厚輪廓\Debug\vc80.idb
?????文件?????217088??2011-10-26?02:35??鯽魚厚輪廓\Debug\vc80.pdb
?????文件??????26419??2011-10-26?03:28??鯽魚厚輪廓\Lesson2.cpp
?????文件???????4056??2011-04-11?22:40??鯽魚厚輪廓\Lesson2.dsp
?????文件????????539??2011-04-11?22:40??鯽魚厚輪廓\Lesson2.dsw
?????文件????7474176??2011-10-26?03:59??鯽魚厚輪廓\Lesson2.ncb
?????文件????????878??2011-04-11?22:40??鯽魚厚輪廓\Lesson2.sln
????..A..H.?????57344??2011-10-26?03:59??鯽魚厚輪廓\Lesson2.suo
?????文件???????5552??2011-04-11?22:40??鯽魚厚輪廓\lesson2.vcproj
?????文件???????1405??2011-10-26?03:59??鯽魚厚輪廓\lesson2.vcproj.DIAO.Administrator.user
?????文件???????1409??2011-04-11?22:40??鯽魚厚輪廓\lesson2.vcproj.MONICA.Administrator.user
?????文件???????1427??2011-06-12?00:30??鯽魚厚輪廓\lesson2.vcproj.PC-201103051308.Administrator.user
?????文件???????1427??2011-07-03?18:54??鯽魚厚輪廓\lesson2.vcproj.PC2009083115XTS.Administrator.user
?????文件???????1427??2011-04-11?22:40??鯽魚厚輪廓\lesson2.vcproj.WWW-B0143540B21.Administrator.user
?????文件????????771??2011-04-11?22:40??鯽魚厚輪廓\NeHe‘s?Readme.txt
?????目錄??????????0??2011-10-26?02:35??鯽魚厚輪廓\Debug
?????目錄??????????0??2011-10-26?03:28??鯽魚厚輪廓
-----------?---------??----------?-----??----
?????????????22993740????????????????????28
............此處省略1個文件信息
- 上一篇:iptapev3.zip
- 下一篇:電子設計大賽控制類題目——水溫控制系統講義
評論
共有 條評論