91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 9.39MB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2023-10-19
  • 語言: 其他
  • 標簽: OpenGL??

資源簡介

OpenGL實現鼠標旋轉縮放平移操作:VS2015+OpenGL;加載OFF文件,實現鼠標旋轉縮放平移操作,添加2個光源。

資源截圖

代碼片段和文件信息

#include?
#include?
#include?
#include?“windows.h“
#include


using?namespace?std;


#include?
#include?
#include?
#include?

//窗口參數
static?int?GLWindow_height?=?600;
static?int?GLWindow_width?=?600;

//平移、縮放、旋轉
static?int?scaling?=?0;
static?int?translating?=?0;
static?int?rotating?=?0;
static?float?scale?=?1.0;
static?float?rotation[3]?=?{?0.0?0.0?0.0?};
static?float?translation[3]?=?{?0.0?0.0?-4.0?};

static?int?GLmouse[2]?=?{?00?};
static?int?GLbutton[3]?=?{?000?};

//點
struct?point
{
GLfloat?x;
GLfloat?y;
GLfloat?z;
GLfloat?dx;
GLfloat?dy;
GLfloat?dz;
int?num;
};
//三角面片
struct?triangle
{
int?p1;
int?p2;
int?p3;
GLfloat?dx;
GLfloat?dy;
GLfloat?dz;
};

point?Point[40000];
triangle?Triangle[70000];

int?m?n?t;
string?s;

void?GLRedraw(void)
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45.0?(GLfloat)GLWindow_width?/?(GLfloat)GLWindow_height?1?8000.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0?600?0?0?0?0?0?0?1);

//平移、縮放、旋轉
glTranslatef(translation[0]?translation[2]?translation[1]);
glScalef(scale?scale?scale);
glRotatef(rotation[0]?1.0?0.0?0.0);
glRotatef(rotation[1]?0.0?1.0?0.0);
glRotatef(rotation[2]?0.0?0.0?1.0);

//光位置變化
static?GLfloat?light0_position[]?=?{?3.0?4.0?0.0?0.0?};
static?GLfloat?light1_position[]?=?{?-3.0?-2.0?0.0?0.0?};
glLightfv(GL_LIGHT0?GL_POSITION?light0_position);
glLightfv(GL_LIGHT1?GL_POSITION?light1_position);

//窗口背景顏色
glClearColor(1.0?1.0?1.0?1.0);
glClear(GL_COLOR_BUFFER_BIT?|?GL_DEPTH_BUFFER_BIT);

//繪制面片
for?(int?i?=?1;i?<=?n;i++)
{
glBegin(GL_TRIANGLES);??
glNormal3f(Point[Triangle[i].p1].dx?Point[Triangle[i].p1].dy?Point[Triangle[i].p1].dz);
glVertex3f(Point[Triangle[i].p1].x?Point[Triangle[i].p1].y?Point[Triangle[i].p1].z);
glNormal3f(Point[Triangle[i].p2].dx?Point[Triangle[i].p2].dy?Point[Triangle[i].p2].dz);
glVertex3f(Point[Triangle[i].p2].x?Point[Triangle[i].p2].y?Point[Triangle[i].p2].z);
glNormal3f(Point[Triangle[i].p3].dx?Point[Triangle[i].p3].dy?Point[Triangle[i].p3].dz);
glVertex3f(Point[Triangle[i].p3].x?Point[Triangle[i].p3].y?Point[Triangle[i].p3].z);
glEnd();
}

glutSwapBuffers();
}



void?GLMotion(int?x?int?y)
{
y?=?GLWindow_height?-?y;

//?鼠標移動
if?(rotating)?{
rotation[0]?+=?0.5?*?(y?-?GLmouse[1]);
rotation[2]?+=?0.5?*?(x?-?GLmouse[0]);
}
else?if?(scaling)?{
scale?*=?exp(?(float)(y?-?GLmouse[1])?/?(float)GLWindow_width);
}
else?if?(translating)?{
translation[0]?-=?(float)(x?-?GLmouse[0])?/?3;
translation[1]?+=?(float)(y?-?GLmouse[1])?/?3;
}

//?當前鼠標坐標
GLmouse[0]?=?x;
GLmouse[1]?=?y;
}



void?GLMouse(int?button?int?state?int?x?int?y)
{
y?=?GLWindow_height?-?y;

rotating?=?(button?==?GLUT_LEFT_BUTTON);
scaling?=?(button?=

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件????????691??2017-04-10?13:12??模型加載與繪制\.git\config

?????文件?????????73??2017-04-10?13:12??模型加載與繪制\.git\description

?????文件?????????23??2017-04-10?13:12??模型加載與繪制\.git\HEAD

?????文件????????177??2017-04-10?13:12??模型加載與繪制\.git\hooks\README.sample

?????文件????????712??2017-04-10?13:12??模型加載與繪制\.git\index

?????文件????????113??2017-04-10?13:12??模型加載與繪制\.git\info\exclude

?????文件????????334??2017-04-10?13:12??模型加載與繪制\.git\logs\HEAD

?????文件????????334??2017-04-10?13:12??模型加載與繪制\.git\logs\refs\heads\master

?????文件????????150??2017-04-10?13:12??模型加載與繪制\.git\ms-persist.xml

?????文件?????????89??2017-04-10?13:12??模型加載與繪制\.git\objects\0d\76fe4328089e5b63a9c4190badacfc35ef2624

?????文件?????965748??2017-04-10?13:12??模型加載與繪制\.git\objects\0f\d7388f67cb1c2cf7633462f9e0f32445e4e3a4

?????文件???????1863??2017-04-10?13:12??模型加載與繪制\.git\objects\1c\9a181a44b4f9a105f0dc71a40ad0284ab6a7c4

?????文件????????751??2017-04-10?13:12??模型加載與繪制\.git\objects\1f\f0c423042b46cb1d617b81efb715defbe8054d

?????文件????????188??2017-04-10?13:12??模型加載與繪制\.git\objects\3f\92743f04c3bb52fe05d5b290a4aa24bf0df95b

?????文件????????153??2017-04-10?13:12??模型加載與繪制\.git\objects\4e\64e8dcd3eaa4a168ad73abcbc342d560f25e16

?????文件????????497??2017-04-10?13:12??模型加載與繪制\.git\objects\51\05997613c12dd58f3400df8ce5f9f18f53bebb

?????文件????????193??2017-04-10?13:12??模型加載與繪制\.git\objects\60\4c79afd3ae0895b06eca47b1a40ba0aa06ff7b

?????文件??????45297??2017-04-10?13:12??模型加載與繪制\.git\objects\78\2d13610342afd93462108f8489576cd4b05af3

?????文件????????439??2017-04-10?13:12??模型加載與繪制\.git\objects\8a\3679e83860c25d9e7ebcae8fe42ae5a20953be

?????文件???????4147??2017-04-10?13:12??模型加載與繪制\.git\objects\af\21f2034520ae27b9a99c8d45a9bb3d6eeba590

?????文件???????1274??2017-04-10?13:12??模型加載與繪制\.git\objects\ca\1c8c70724ef59efb966da6973819b882b34f23

?????文件????????162??2017-04-10?13:12??模型加載與繪制\.git\objects\d3\6fabac7d7090696ab21037e25dae00e09a65a5

?????文件?????????41??2017-04-10?13:12??模型加載與繪制\.git\refs\heads\master

?????文件???????2581??2017-04-10?13:12??模型加載與繪制\.gitattributes

?????文件???????3997??2017-04-10?13:12??模型加載與繪制\.gitignore

????..A..H.?????30720??2017-04-15?17:21??模型加載與繪制\.vs\OpenGL\v14\.suo

?????文件?????120832??2017-04-15?17:21??模型加載與繪制\Debug\OpenGL.exe

?????文件?????618312??2017-04-15?17:21??模型加載與繪制\Debug\OpenGL.ilk

?????文件????2805760??2017-04-15?17:21??模型加載與繪制\Debug\OpenGL.pdb

?????文件????2279648??2010-12-13?14:19??模型加載與繪制\OpenGL\Bunny.off

............此處省略53個文件信息

評論

共有 條評論