亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? hairmain.cpp

?? hair solusion, c&#226 cs ádasda
?? CPP
字號:
/**********************************************************/
/*                                                        */
/*                     HairMain.cpp                       */
/*                    Steve Sloan II                      */
/*                      March 2003                        */
/*                                                        */
/**********************************************************/

#include <math.h>
#include <GL/glut.h>
#include <string.h>

#include "GL/glui.h"

#include "utils.h"

#include "decal.h"
#include "HairGuides.h"
#include "ToolMarker.h"

#define MAXPATH 1024
#define FILECHOICES 9
#define DEFAULTFILE 4

#define DEFAULTSPACING 20

#define ORTHOWIDTH 0.8

#define FILE_CHOICE_ID		111
#define PERSP_CHECK_ID		112
#define HAIRSPACING_ID		113

static char scFileList[FILECHOICES][MAXPATH] = {
	"c:\\temp\\tgatest.tga",
	"c:\\temp\\colortest.tga",
	"c:\\temp\\blurtest.tga",
	"c:\\temp\\bobble08.tga",
	"c:\\temp\\jgfronta.tga",
	"c:\\temp\\14by11.tga",
	"c:\\temp\\16by12.tga",
	"c:\\temp\\bobble08_full.tga",
	"c:\\temp\\threeby3.tga"
};

// GLUI Elements

/** These are the live variables passed into GLUI ***/
int bSpin = 0;
int bPersp = 0;
int nHairSpacing = DEFAULTSPACING;

int mainWindow;

int ScreenWidth = 0;
int ScreenHeight = 0;

GLUI_Rotation *glui_rotate;
float mTrackball[16];

GLUI_Listbox *glui_FileSectionLB;
int FileSelection = DEFAULTFILE;

GLUI_Spinner *spacing_spinner;

GLUI_Panel *glui_hairsettings;
GLUI_Panel *glui_view;

GLuint nCursorPos = 0;

// Texture Info

Decal *CurrentDecal;

HairGuides HairArray;

ToolMarker Cursor;

GLdouble projmatrix[16];

// PrintPicture
// Input: tgaInfo*
// Output: void
// An early test function, confirming that the TGA reader works

void PrintPicture(tgaInfo *info)
{
	int mode, i, j, cursor;
	unsigned char grayscale = 0;

	printf("    width  = %4d\n", info->width);
	printf("    height = %4d\n", info->height);

	// compute the number of actual components
	mode = info->pixelDepth / 8;

	for (j = (info->height - 1); j >= 0; j--)
	{
		printf("[");
		for (i = 0; i < info->width; i ++)
		{
			cursor = mode * (j * info->width + i);
			grayscale =	(unsigned char)(0.30 * info->imageData[cursor] + 
							0.59 * info->imageData[cursor+1] +
							0.11 * info->imageData[cursor+2]);
			if (grayscale > 128)
				printf("X");
			else
				printf(" ");
		}
		printf("]\n");
	}
}

// DoPicture
// Input: char*
// Output: void
// Opens the TGA file specified by sFileName, copies its
// data into a texture with power-of-two dimensions, then
// sets up the texture for use in OpenGL

void DoPicture(char* sFileName)
{
	if (CurrentDecal)
		CurrentDecal->SetDecal(sFileName);
	else
		CurrentDecal = new Decal(sFileName);

	CurrentDecal->InitGLTexture();

	HairArray.SetTextureInfo(CurrentDecal);
	HairArray.SetPixelSpacing(nHairSpacing);

	Cursor.SetTextureInfo(CurrentDecal);
	Cursor.CreateDisplayList();
}

// DoReshape
// Input: void
// Output: void
// Do the actual work behind myGlutReshape

void DoReshape()
{
	glViewport( 0, 0, ScreenWidth, ScreenHeight );

	glMatrixMode( GL_PROJECTION );
	glLoadIdentity();

	float xy_aspect = (float)ScreenWidth / (float)ScreenHeight;

	if (bPersp)
	{
		glFrustum( -xy_aspect*.08, xy_aspect*.08, -.08, .08, .1, 15.0 );
	}
	else
	{
		float scaled_aspect = xy_aspect * ORTHOWIDTH;
		glOrtho( -scaled_aspect, scaled_aspect, -ORTHOWIDTH, ORTHOWIDTH, -10.0, 10.0 );
	}

	// Store the new projection matrix
	glGetDoublev(GL_PROJECTION_MATRIX, projmatrix);

	// Refresh the screen
	glutPostRedisplay();
}

void MoveCursor()
{
/*
	if ( ( nCursorPos > CurrentDecal->nPixelTextureWidth ) || ( nCursorPos > CurrentDecal->nPixelTextureHeight ) )
		nCursorPos = 0;
	else
		nCursorPos++;

	Cursor.SetPixelPos( nCursorPos, nCursorPos );
*/
}

// myGlutIdle
// Input: void
// Output: void
// Called when the program isn't doing anything else

void myGlutIdle( void )
{
	// According to the GLUT specification, the current window is
	// undefined during an idle callback.  So we need to explicitly
	// change it if necessary
	if ( glutGetWindow() != mainWindow )
		glutSetWindow(mainWindow);

	MoveCursor();

	glutPostRedisplay();
}

// myGlutReshape
// Input: w, h = New width and height of the window
// Output: void
// Update the screen's proportions when the window resizes

void myGlutReshape(int w, int h)
{
	ScreenWidth  = w;
	ScreenHeight = h;

	DoReshape();
}

// myGlutDisplay
// Input: void
// Output: void
// Display the scene

void myGlutDisplay(void)
{
	static float rotationX = 0.0, rotationY = 0.0;
	GLuint i = 0;

	glClearColor( .9f, .9f, .9f, 1.0f );
	glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

	/*** Rotate the object ***/
	rotationX += 3.3f;
	rotationY += 4.7f;

	glMatrixMode( GL_MODELVIEW );
	glLoadIdentity();
	glTranslatef( 0.0, 0.0, -1.0 );
	if (bSpin)
	{
		glRotatef( rotationY, 0.0, 1.0, 0.0 );
		glRotatef( rotationX, 1.0, 0.0, 0.0 );
	}
	else
	{
		glMultMatrixf(mTrackball);
	}

	CurrentDecal->DoTransform();

	GLfloat fPlaneDif[]  = {1.0, 1.0, 1.0, 1.0};
	GLfloat fPlaneAmb[]  = {0.0, 0.0, 0.0, 1.0};
	GLfloat fPlaneSpec[] = {1.0, 1.0, 1.0, 1.0};

	glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE,  fPlaneDif);
	glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT,  fPlaneAmb);

	CurrentDecal->Draw();

	HairArray.Draw();

	Cursor.Draw();

	glutSwapBuffers(); 
}

GLdouble dClamp(GLdouble val, GLdouble min, GLdouble max)
{
	if (val > max) return max;

	if (val < min) return min;

	return val;
}

void PlaceCursor(int mousex, int mousey)
{
	GLint viewport[4];
	GLdouble mvmatrix[16];
	GLdouble x1, y1, z1;
	GLdouble x2, y2, z2;
	GLdouble t;
	GLdouble wx, wy;
	GLint realy;

	glGetIntegerv(GL_VIEWPORT, viewport);
	glGetDoublev(GL_MODELVIEW_MATRIX, mvmatrix);

	// Get the "mouse line", from the mouse directly into the screen, in world coordinates
	realy = viewport[3] - (GLint) mousey - 1;

	gluUnProject( (GLdouble) mousex, (GLdouble) realy, 0.0,
		mvmatrix, projmatrix, viewport, &x1, &y1, &z1 );

	gluUnProject( (GLdouble) mousex, (GLdouble) realy, 1.0,
		mvmatrix, projmatrix, viewport, &x2, &y2, &z2 );

	// Compute where the "mouse line" intersects z = 0
	t = z1 / (z1 - z2);
	wx = x1 + t * (x2 - x1);
	wy = y1 + t * (y2 - y1);

	wx = dClamp(wx, 0.0, CurrentDecal->fPhysicalTextureWidth);
	wy = dClamp(wy, 0.0, CurrentDecal->fPhysicalTextureHeight);

	Cursor.SetWorldPos(wx, wy);
}

// myGlutPassiveMotion
// Input: void
// Output: void
// Display the scene

void myGlutPassiveMotion(int x, int y)
{
//	printf("Passive     x, y = (%5d, %5d)\n", x, y);

	PlaceCursor(x, y);
}

// myGlutMouse
// Input: void
// Output: void
// Display the scene

void myGlutMouse(int button, int state, int x, int y)
{
	switch (button)
	{
		case GLUT_LEFT_BUTTON:
			printf("L ");
			break;

		case GLUT_MIDDLE_BUTTON:
			printf("M ");
			break;

		case GLUT_RIGHT_BUTTON:
			printf("R ");
			break;
	}

	switch (state)
	{
		case GLUT_UP:
			printf("U ");
			break;

		case GLUT_DOWN:
			printf("D ");
			break;
	}

//	printf("        x, y = (%5d, %5d)\n", x, y);

	PlaceCursor(x, y);
}

// myGlutMotion
// Input: void
// Output: void
// Display the scene

void myGlutMotion(int x, int y)
{
//	printf("button down x, y = (%5d, %5d)\n", x, y);

	PlaceCursor(x, y);
}

// glui_control
// Input: control = ID of the control that changed
// Output: void
// React to changes in the widget data

void glui_control( int control )
{
	switch(control) {
		case FILE_CHOICE_ID:
			FileSelection = glui_FileSectionLB->get_int_val();
			DoPicture(scFileList[FileSelection]);
			break;

		case PERSP_CHECK_ID:
			DoReshape();
			break;

		case HAIRSPACING_ID:

			// Update the value
			nHairSpacing = spacing_spinner->get_int_val();

			// Change the spacing to match
			HairArray.SetPixelSpacing(nHairSpacing);

			// Refresh the screen
			glutPostRedisplay();

			break;
	}
}

// Cleanup
// Input: void
// Output: void
// Delete any data structures

void Cleanup()
{
	if (CurrentDecal)
	{
		delete CurrentDecal;
		CurrentDecal = NULL;
	}
}

// quit
// Input: status = program exit status
// Output: void
// Stuff to do when the program exits

void quit(int status) {
	Cleanup();
	exit(status);
}

void PrintVectorAngle(double x, double y)
{
	double angle = GetVectorAngle(x, y);

	printf("angle(%7.2f, %7.2f) = %7.2f\n", x, y, angle);
}

// main
// Input: argc, argv = program command line arguments
// Output: void
// Main body of the program

int main(int argc, char **argv)
{
	int i;

	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
	glutInitWindowPosition(0,0);
	glutInitWindowSize(500,500);
	mainWindow = glutCreateWindow("TGA Test");

	GLUI_Master.set_glutReshapeFunc(myGlutReshape);
	GLUI_Master.set_glutDisplayFunc(myGlutDisplay);

	GLUI_Master.set_glutMouseFunc(myGlutMouse);

	glutMotionFunc(myGlutMotion);
	glutPassiveMotionFunc(myGlutPassiveMotion);

	CurrentDecal = NULL;

	PrintVectorAngle( 0.0,  0.0); // 0
	PrintVectorAngle( 0.0,  1.0); // 0
	PrintVectorAngle( 1.0,  1.0); // 45
	PrintVectorAngle( 1.0,  0.0); // 90
	PrintVectorAngle( 2.0, -1.0); // ~117
	PrintVectorAngle( 0.0, -1.0); // 180
	PrintVectorAngle(-2.0, -1.0); // ~243
	PrintVectorAngle(-1.0,  0.0); // 270
	PrintVectorAngle(-1.0,  2.0); // ~333

	/****************************************/
	/*       Set up OpenGL lights           */
	/****************************************/

//	GLfloat light0_ambient[] =  {0.1f, 0.1f, 0.3f, 1.0f};
//	GLfloat light0_diffuse[] =  {.6f, .6f, 1.0f, 1.0f};
	GLfloat light0_ambient[] =  {0.05f, 0.05f, 0.05f, 1.0f};
	GLfloat light0_diffuse[] =  {1.0f, 1.0f, 1.0f, 1.0f};
	GLfloat light0_position[] = {1.0f, 1.0f, 1.0f, 0.0f};

	glEnable(GL_LIGHTING);
	glEnable(GL_LIGHT0);
	glLightfv(GL_LIGHT0, GL_AMBIENT, light0_ambient);
	glLightfv(GL_LIGHT0, GL_DIFFUSE, light0_diffuse);
	glLightfv(GL_LIGHT0, GL_POSITION, light0_position);

	/****************************************/
	/*          Enable z-buferring          */
	/****************************************/

	glEnable(GL_DEPTH_TEST);

	/* Get texture */
	DoPicture(scFileList[DEFAULTFILE]);

	/****************************************/
	/*         Here's the GLUI code         */
	/****************************************/

	GLUI *glui = GLUI_Master.create_glui( "GLUI" );

	glui_FileSectionLB = glui->add_listbox("Image File:",
		NULL,FILE_CHOICE_ID,glui_control);

	// Fill the file list box
	for (i = 0; i < FILECHOICES; i++)
		glui_FileSectionLB->add_item( i, scFileList[i] );

	// Set the list box to the default
	glui_FileSectionLB->set_int_val(DEFAULTFILE);

	glui_hairsettings = glui->add_panel("Hair Settings");

	spacing_spinner = glui->add_spinner_to_panel( glui_hairsettings, "Guide Hair Spacing:",
		GLUI_SPINNER_INT, NULL, HAIRSPACING_ID, glui_control );
	spacing_spinner->set_int_val( DEFAULTSPACING );
	spacing_spinner->set_int_limits( 1, 1000 );

	// Set up the rotation "trackball"
	glui_view = glui->add_panel("View");

	glui_rotate = glui->add_rotation_to_panel( glui_view, "Rotation", mTrackball );
	glui_rotate->set_spin( 0.95 );
	glui_rotate->reset();

	glui->add_checkbox_to_panel( glui_view, "Perspective", &bPersp, PERSP_CHECK_ID, glui_control );

	glui->add_checkbox_to_panel( glui_view, "Spin?", &bSpin );

	// Quit button
	glui->add_button( "Quit", 0,quit);

	glui->set_main_gfx_window( mainWindow );

	/* We register the idle callback with GLUI, *not* with GLUT */
	GLUI_Master.set_glutIdleFunc( myGlutIdle ); 

	glutMainLoop();

	Cleanup();

	return(0);
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产一区二区三区美女| 久久亚洲一区二区三区四区| 日韩欧美高清在线| 国产精品久久久久久久久免费桃花 | 久久99久久精品| 91免费观看在线| 久久青草国产手机看片福利盒子| 一区二区三区四区在线免费观看 | 一区二区三区中文字幕精品精品 | 国产精品免费视频网站| 奇米精品一区二区三区在线观看| 99久久99久久久精品齐齐| 日韩欧美国产综合在线一区二区三区| 国产精品网站在线| 国产综合色精品一区二区三区| 欧美日韩一区二区在线观看| 亚洲桃色在线一区| 成人精品一区二区三区四区| 精品福利av导航| 亚洲成a天堂v人片| 欧美中文字幕亚洲一区二区va在线| 国产精品视频第一区| 国产一区二区三区高清播放| 日韩欧美一级特黄在线播放| 天天射综合影视| 欧美日韩一级片网站| 亚洲精品国产无天堂网2021| 色综合中文字幕| 亚洲美女少妇撒尿| 色综合天天天天做夜夜夜夜做| 欧美高清在线精品一区| 成人一区在线观看| 亚洲国产精品黑人久久久| 国产91精品入口| 国产精品色噜噜| 99精品欧美一区二区蜜桃免费| 国产精品女同一区二区三区| 岛国精品一区二区| 亚洲日本青草视频在线怡红院| 波多野结衣在线aⅴ中文字幕不卡| 欧美激情一区二区三区在线| 成人18视频日本| 一区二区三区四区激情| 91传媒视频在线播放| 亚洲一区免费观看| 678五月天丁香亚洲综合网| 日韩av一级片| 久久精品夜色噜噜亚洲aⅴ| 不卡的电影网站| 亚洲永久免费av| 精品久久久久香蕉网| 国产成人精品一区二区三区网站观看| 欧美国产精品专区| 欧美日韩国产综合草草| 蜜臀久久99精品久久久久久9| 久久久久88色偷偷免费| 色婷婷综合在线| 日韩av中文字幕一区二区| 国产喂奶挤奶一区二区三区| 一本色道a无线码一区v| 日韩精品一区第一页| 久久久久久97三级| 在线观看亚洲成人| 精品一区二区三区欧美| 亚洲色图第一区| 日韩一二三四区| av爱爱亚洲一区| 奇米影视在线99精品| 久久久久久免费| 一本大道久久a久久综合婷婷| 日本视频免费一区| 中文一区在线播放| 91精品国产综合久久久蜜臀粉嫩 | 懂色av一区二区三区蜜臀| 一区二区三区欧美日| 欧美成人a视频| 欧美这里有精品| 国产黄人亚洲片| 日韩av二区在线播放| 亚洲品质自拍视频| 久久蜜桃av一区精品变态类天堂 | 国产午夜精品福利| 欧美男人的天堂一二区| 成人性生交大片免费看中文| 日本亚洲免费观看| 一区二区三区在线免费| 中文幕一区二区三区久久蜜桃| 欧美顶级少妇做爰| 色综合久久久久| 成人免费av在线| 韩国精品免费视频| 日本不卡不码高清免费观看| 一区二区三区欧美亚洲| 国产精品色在线| 国产午夜精品久久久久久免费视 | 欧美日韩一区二区三区四区| www.av精品| 成人一道本在线| 国产一区二区三区久久悠悠色av| 天天综合网天天综合色| 亚洲一区日韩精品中文字幕| 1区2区3区欧美| 国产精品视频一二| 国产欧美va欧美不卡在线| 26uuu国产日韩综合| 日韩视频免费观看高清在线视频| 欧美视频精品在线| eeuss影院一区二区三区| 懂色一区二区三区免费观看| 国产精品亚洲人在线观看| 国内久久婷婷综合| 韩国精品久久久| 国产麻豆成人精品| 国产精品一二三在| 处破女av一区二区| www.综合网.com| 白白色亚洲国产精品| 成a人片亚洲日本久久| 99精品视频在线观看| 色中色一区二区| 欧美亚洲图片小说| 日韩精品中文字幕在线不卡尤物| 欧美高清www午色夜在线视频| 欧美视频日韩视频| 69久久99精品久久久久婷婷| 日韩一级高清毛片| 久久精品欧美一区二区三区不卡| www成人在线观看| 亚洲国产精品激情在线观看| 中文字幕中文乱码欧美一区二区| 中文字幕亚洲一区二区av在线| 亚洲精品成人a在线观看| 亚洲自拍偷拍av| 三级欧美在线一区| 韩日av一区二区| 丁香六月综合激情| 色丁香久综合在线久综合在线观看| 欧美色区777第一页| 在线播放中文一区| 久久夜色精品国产噜噜av | 99在线视频精品| 色老汉av一区二区三区| 欧美精品视频www在线观看| 精品国产精品网麻豆系列| 国产精品美女久久久久久久久| 一区二区三区在线免费观看| 蜜桃久久av一区| 99久久久免费精品国产一区二区| 色噜噜夜夜夜综合网| 欧美第一区第二区| 国产精品三级av| 日本不卡1234视频| 成人黄色电影在线| 91精品国产乱码| 中文字幕在线不卡视频| 国产美女精品在线| 麻豆国产精品777777在线| 国产综合久久久久影院| 99久久国产综合色|国产精品| 欧美日韩久久久| 欧美激情一区二区三区四区| 亚洲香肠在线观看| 国产91丝袜在线18| 欧美精品 国产精品| 亚洲国产高清在线| 青青草国产成人av片免费| 99精品热视频| 精品粉嫩超白一线天av| 亚洲国产精品一区二区尤物区| 国产69精品久久777的优势| 4438x亚洲最大成人网| 亚洲欧美在线aaa| 久久狠狠亚洲综合| 精品视频在线免费看| 国产精品你懂的| 国产自产2019最新不卡| 欧美日韩黄视频| 一区二区三区蜜桃| 成人精品免费网站| 国产亚洲欧美一级| 黄页视频在线91| 欧美刺激午夜性久久久久久久| 亚洲一区二区视频| 91在线视频免费91| 中文字幕第一区第二区| 国产一区二区三区最好精华液| 69p69国产精品| 午夜av一区二区三区| 在线看国产日韩| 亚洲精品免费在线观看| 99久久久国产精品免费蜜臀| 国产日韩成人精品| 国产精品一区二区不卡| 亚洲精品一区二区三区在线观看| 三级久久三级久久| 欧美日韩激情在线| 无码av中文一区二区三区桃花岛| 日本精品一区二区三区高清 | 欧美色综合影院| 亚洲伊人色欲综合网|