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

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

?? lightmaterial.c

?? Example source codes in C++ using 3d studio max models
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*    lightmaterial.c    Nate Robins, 1997    Tool for teaching about OpenGL lighting & material properties.    */#include <math.h>#include <stdio.h>#include <stdlib.h>#include <stdarg.h>#include <string.h>#include <GL/glut.h>#include "glm.h"#include "materials.h"
#pragma comment( linker, "/entry:\"mainCRTStartup\"" )  // set the entry point to be main()

typedef struct _cell {    int id;    int x, y;    float min, max;    float value;    float step;    char* info;    char* format;} cell;cell light_pos[4] = {    { 1, 210, 30, -5.0, 5.0, -2.0, 0.01,        "Specifies X coordinate of light vector.", "%.2f" },    { 2, 270, 30, -5.0, 5.0, 2.0, 0.01,    "Specifies Y coordinate of light vector.", "%.2f" },    { 3, 330, 30, -5.0, 5.0, 2.0, 0.01,    "Specifies Z coordinate of light vector.", "%.2f" },    { 4, 390, 30, 0.0, 1.0, 1.0, 1.0,    "Specifies directional (0) or positional (1) light.", "%.2f" },};cell light_Ka[4] = {    { 5, 200, 60, 0.0, 1.0, 0.0, 0.01,        "Specifies ambient red intensity of the light.", "%.2f" },    { 6, 260, 60, 0.0, 1.0, 0.0, 0.01,    "Specifies ambient green intensity of the light.", "%.2f" },    { 7, 320, 60, 0.0, 1.0, 0.0, 0.01,    "Specifies ambient blue intensity of the light.", "%.2f" },    { 8, 380, 60, 0.0, 1.0, 1.0, 0.01,    "Specifies ambient alpha intensity of the light.", "%.2f" },};cell light_Kd[4] = {    {  9, 200, 90, 0.0, 1.0, 1.0, 0.01,        "Specifies diffuse red intensity of the light.", "%.2f" },    { 10, 260, 90, 0.0, 1.0, 1.0, 0.01,    "Specifies diffuse green intensity of the light.", "%.2f" },    { 11, 320, 90, 0.0, 1.0, 1.0, 0.01,    "Specifies diffuse blue intensity of the light.", "%.2f" },    { 12, 380, 90, 0.0, 1.0, 1.0, 0.01,    "Specifies diffuse alpha intensity of the light.", "%.2f" },};cell light_Ks[4] = {    { 13, 200, 120, 0.0, 1.0, 1.0, 0.01,        "Specifies specular red intensity of the light.", "%.2f" },    { 14, 260, 120, 0.0, 1.0, 1.0, 0.01,    "Specifies specular green intensity of the light.", "%.2f" },    { 15, 320, 120, 0.0, 1.0, 1.0, 0.01,    "Specifies specular blue intensity of the light.", "%.2f" },    { 16, 380, 120, 0.0, 1.0, 1.0, 0.01,    "Specifies specular alpha intensity of the light.", "%.2f" },};cell spot_direction[3] = {    { 17, 250, 260, -1.0, 1.0, 1.0, 0.01,        "Specifies X coordinate of spotlight direction vector.", "%.2f" },    { 18, 310, 260, -1.0, 1.0, -1.0, 0.01,    "Specifies Y coordinate of spotlight direction vector.", "%.2f" },    { 19, 370, 260, -1.0, 1.0, -1.0, 0.01,    "Specifies Z coordinate of spotlight direction vector.", "%.2f" },};cell spot_exponent = { 20, 210, 290, 0.0, 128.0, 30.0, 1.0,"Specifies intensity distribution of spotlight.", "%.0f" };cell spot_cutoff = { 21, 410, 290, 0.0, 91.0, 91.0, 1.0,"Specifies maximum spread angle of spotlight (180 = off).", "%.0f" };cell Kc = { 22, 120, 410, 0.0, 5.0, 1.0, 0.01,"Specifies constant attenuation factor.", "%.2f" };cell Kl = { 23, 215, 410, 0.0, 5.0, 0.0, 0.01,"Specifies linear attenuation factor.", "%.2f" };cell Kq = { 24, 315, 410, 0.0, 5.0, 0.0, 0.01,"Specifies quadratic attenuation factor.", "%.2f" };cell material_Ka[4] = {    { 25, 220, 260, 0.0, 1.0, 0.2, 0.01,        "Specifies ambient red reflectance of the material.", "%.2f" },    { 26, 280, 260, 0.0, 1.0, 0.2, 0.01,    "Specifies ambient green reflectance of the material.", "%.2f" },    { 27, 340, 260, 0.0, 1.0, 0.2, 0.01,    "Specifies ambient blue reflectance of the material.", "%.2f" },    { 28, 400, 260, 0.0, 1.0, 1.0, 0.01,    "Specifies ambient alpha reflectance of the material.", "%.2f" },};cell material_Kd[4] = {    { 29, 220, 290, 0.0, 1.0, 0.8, 0.01,        "Specifies diffuse red reflectance of the material.", "%.2f" },    { 30, 280, 290, 0.0, 1.0, 0.8, 0.01,    "Specifies diffuse green reflectance of the material.", "%.2f" },    { 31, 340, 290, 0.0, 1.0, 0.8, 0.01,    "Specifies diffuse blue reflectance of the material.", "%.2f" },    { 32, 400, 290, 0.0, 1.0, 1.0, 0.01,    "Specifies diffuse alpha reflectance of the material.", "%.2f" },};cell material_Ks[4] = {    { 33, 220, 320, 0.0, 1.0, 1.0, 0.01,        "Specifies specular red reflectance of the material.", "%.2f" },    { 34, 280, 320, 0.0, 1.0, 1.0, 0.01,    "Specifies specular green reflectance of the material.", "%.2f" },    { 35, 340, 320, 0.0, 1.0, 1.0, 0.01,    "Specifies specular blue reflectance of the material.", "%.2f" },    { 36, 400, 320, 0.0, 1.0, 1.0, 0.01,    "Specifies specular alpha reflectance of the material.", "%.2f" },};cell material_Ke[4] = {    { 37, 220, 350, 0.0, 1.0, 0.0, 0.01,        "Specifies red emitted light intensity of the material.", "%.2f" },    { 38, 280, 350, 0.0, 1.0, 0.0, 0.01,    "Specifies green emitted light intensity of the material.", "%.2f" },    { 39, 340, 350, 0.0, 1.0, 0.0, 0.01,    "Specifies blue emitted light intensity of the material.", "%.2f" },    { 40, 400, 350, 0.0, 1.0, 1.0, 0.01,    "Specifies alpha emitted light intensity of the material.", "%.2f" },};cell material_Se = { 41, 200, 380, 0.0, 128.0, 50.0, 1.0,"Specifies the specular exponent of the material.", "%.0f" };cell lmodel_Ka[4] = {    { 42, 220, 260, 0.0, 1.0, 0.2, 0.01,        "Specifies ambient red intensity of the entire scene.", "%.2f" },    { 43, 280, 260, 0.0, 1.0, 0.2, 0.01,    "Specifies ambient green intensity of the entire scene.", "%.2f" },    { 44, 340, 260, 0.0, 1.0, 0.2, 0.01,    "Specifies ambient blue intensity of the entire scene.", "%.2f" },    { 45, 400, 260, 0.0, 1.0, 1.0, 0.01,    "Specifies ambient alpha intensity of the entire scene.", "%.2f" },};cell local_viewer = { 46, 460, 340, 0.0, 1.0, 0.0, 1.0,"Specifies infinite (0.0) or local (1.0) light model.", "%.1f" };cell two_side = { 47, 415, 390, 0.0, 1.0, 0.0, 1.0,"Specifies one (0.0) or two (1.0) sided lighting.", "%.1f" };GLfloat eye[3] = { 0.0, 0.0, 3.0 };GLfloat at[3]  = { 0.0, 0.0, 0.0 };GLfloat up[3]  = { 0.0, 1.0, 0.0 };GLboolean world_draw = GL_TRUE;GLMmodel* pmodel = NULL;GLint selection = 0;GLfloat spin_x = 0.0;GLfloat spin_y = 0.0;void redisplay_all(void);GLdouble projection[16], modelview[16], inverse[16];GLuint window, world, screen, command;GLuint sub_width = 256, sub_height = 256;GLvoid *font_style = GLUT_BITMAP_TIMES_ROMAN_10;voidsetfont(char* name, int size){    font_style = GLUT_BITMAP_HELVETICA_10;    if (strcmp(name, "helvetica") == 0) {        if (size == 12)             font_style = GLUT_BITMAP_HELVETICA_12;        else if (size == 18)            font_style = GLUT_BITMAP_HELVETICA_18;    } else if (strcmp(name, "times roman") == 0) {        font_style = GLUT_BITMAP_TIMES_ROMAN_10;        if (size == 24)            font_style = GLUT_BITMAP_TIMES_ROMAN_24;    } else if (strcmp(name, "8x13") == 0) {        font_style = GLUT_BITMAP_8_BY_13;    } else if (strcmp(name, "9x15") == 0) {        font_style = GLUT_BITMAP_9_BY_15;    }}void drawstr(GLuint x, GLuint y, char* format, ...){    va_list args;    char buffer[255], *s;        va_start(args, format);    vsprintf(buffer, format, args);    va_end(args);        glRasterPos2i(x, y);    for (s = buffer; *s; s++)        glutBitmapCharacter(font_style, *s);}voidcell_draw(cell* cell){    glColor3ub(0, 255, 128);    if (selection == cell->id) {        glColor3ub(255, 255, 0);        drawstr(10, 525, cell->info);        glColor3ub(255, 0, 0);    }        if (cell->id == 21 && cell->value > 90.0) /* treat cutoff specially */        drawstr(cell->x, cell->y, cell->format, 180.0);    else         drawstr(cell->x, cell->y, cell->format, cell->value);}intcell_hit(cell* cell, int x, int y){    if (x > cell->x && x < cell->x+60 &&        y > cell->y-20 && y < cell->y+10)        return cell->id;    return 0;}voidcell_update(cell* cell, int update){    if (selection != cell->id)        return;        cell->value += update * cell->step;        if (cell->value < cell->min)        cell->value = cell->min;    else if (cell->value > cell->max)         cell->value = cell->max;    }voidcell_vector(float* dst, cell* cell, int num){    while (--num >= 0)        dst[num] = cell[num].value;}voiddrawmodel(void){    if (!pmodel) {        pmodel = glmReadOBJ("data/soccerball.obj");        if (!pmodel) exit(0);        glmUnitize(pmodel);        glmFacetNormals(pmodel);        glmVertexNormals(pmodel, 90.0);    }        glmDraw(pmodel, GLM_SMOOTH);}voiddrawaxes(void){    glColor3ub(255, 0, 0);    glBegin(GL_LINE_STRIP);    glVertex3f(0.0, 0.0, 0.0);    glVertex3f(1.0, 0.0, 0.0);    glVertex3f(0.75, 0.25, 0.0);    glVertex3f(0.75, -0.25, 0.0);    glVertex3f(1.0, 0.0, 0.0);    glVertex3f(0.75, 0.0, 0.25);    glVertex3f(0.75, 0.0, -0.25);    glVertex3f(1.0, 0.0, 0.0);    glEnd();    glBegin(GL_LINE_STRIP);    glVertex3f(0.0, 0.0, 0.0);    glVertex3f(0.0, 1.0, 0.0);    glVertex3f(0.0, 0.75, 0.25);    glVertex3f(0.0, 0.75, -0.25);    glVertex3f(0.0, 1.0, 0.0);    glVertex3f(0.25, 0.75, 0.0);    glVertex3f(-0.25, 0.75, 0.0);    glVertex3f(0.0, 1.0, 0.0);    glEnd();    glBegin(GL_LINE_STRIP);    glVertex3f(0.0, 0.0, 0.0);    glVertex3f(0.0, 0.0, 1.0);    glVertex3f(0.25, 0.0, 0.75);    glVertex3f(-0.25, 0.0, 0.75);    glVertex3f(0.0, 0.0, 1.0);    glVertex3f(0.0, 0.25, 0.75);    glVertex3f(0.0, -0.25, 0.75);    glVertex3f(0.0, 0.0, 1.0);    glEnd();        glColor3ub(255, 255, 0);    glRasterPos3f(1.1, 0.0, 0.0);    glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, 'x');    glRasterPos3f(0.0, 1.1, 0.0);    glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, 'y');    glRasterPos3f(0.0, 0.0, 1.1);    glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, 'z');}voididentity(GLdouble m[16]){    m[0+4*0] = 1; m[0+4*1] = 0; m[0+4*2] = 0; m[0+4*3] = 0;    m[1+4*0] = 0; m[1+4*1] = 1; m[1+4*2] = 0; m[1+4*3] = 0;    m[2+4*0] = 0; m[2+4*1] = 0; m[2+4*2] = 1; m[2+4*3] = 0;    m[3+4*0] = 0; m[3+4*1] = 0; m[3+4*2] = 0; m[3+4*3] = 1;}GLbooleaninvert(GLdouble src[16], GLdouble inverse[16]){    double t;    int i, j, k, swap;    GLdouble tmp[4][4];        identity(inverse);        for (i = 0; i < 4; i++) {        for (j = 0; j < 4; j++) {            tmp[i][j] = src[i*4+j];        }    }        for (i = 0; i < 4; i++) {        /* look for largest element in column. */        swap = i;        for (j = i + 1; j < 4; j++) {            if (fabs(tmp[j][i]) > fabs(tmp[i][i])) {                swap = j;            }        }                if (swap != i) {            /* swap rows. */            for (k = 0; k < 4; k++) {                t = tmp[i][k];                tmp[i][k] = tmp[swap][k];                tmp[swap][k] = t;                                t = inverse[i*4+k];                inverse[i*4+k] = inverse[swap*4+k];                inverse[swap*4+k] = t;            }        }                if (tmp[i][i] == 0) {        /* no non-zero pivot.  the matrix is singular, which           shouldn't happen.  This means the user gave us a bad            matrix. */            return GL_FALSE;        }                t = tmp[i][i];        for (k = 0; k < 4; k++) {            tmp[i][k] /= t;            inverse[i*4+k] /= t;        }        for (j = 0; j < 4; j++) {            if (j != i) {                t = tmp[j][i];                for (k = 0; k < 4; k++) {                    tmp[j][k] -= tmp[i][k]*t;                    inverse[j*4+k] -= inverse[i*4+k]*t;                }            }        }    }    return GL_TRUE;}floatnormalize(float* v){    float length;        length = sqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);    v[0] /= length;    v[1] /= length;    v[2] /= length;        return length;}voidmain_reshape(int width,  int height) {    glViewport(0, 0, width, height);    glMatrixMode(GL_PROJECTION);    glLoadIdentity();    gluOrtho2D(0, width, height, 0);    glMatrixMode(GL_MODELVIEW);    glLoadIdentity();    #define GAP  25             /* gap between subwindows */    sub_width = (width-GAP*3)/3;    sub_height = (height-GAP*3)/2;        glutSetWindow(screen);    glutPositionWindow(GAP, GAP);    glutReshapeWindow(sub_width, sub_height);    glutSetWindow(world);    glutPositionWindow(GAP, GAP+sub_height+GAP);    glutReshapeWindow(sub_width, sub_height);    glutSetWindow(command);    glutPositionWindow(GAP+sub_width+GAP, GAP);    glutReshapeWindow(sub_width*2, sub_height*2+GAP);}voidmain_display(void){    glClearColor(0.8, 0.8, 0.8, 0.0);    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);    glColor3ub(0, 0, 0);    setfont("helvetica", 12);    drawstr(GAP, GAP-5, "Screen-space view");    drawstr(GAP+sub_width+GAP, GAP-5, "Command manipulation window");    drawstr(GAP, GAP+sub_height+GAP-5, "World-space view");    glutSwapBuffers();}voidworld_reshape(int width, int height){    glViewport(0, 0, width, height);    glMatrixMode(GL_PROJECTION);    glLoadIdentity();    gluPerspective(60.0, (GLfloat)width/height, 0.01, 256.0);    glMatrixMode(GL_MODELVIEW);    glLoadIdentity();    glTranslatef(0.0, 0.0, -6.0);    glRotatef(-45.0, 0.0, 1.0, 0.0);    glClearColor(0.0, 0.0, 0.0, 0.0);    glEnable(GL_DEPTH_TEST);    glDisable(GL_LIGHTING);    glEnable(GL_LIGHT0);}voidworld_display(void){    double length;    float l[3];    GLfloat pos[4], lKa[4], lKd[4], lKs[4];    GLfloat dir[3], mKa[4], mKd[4], mKs[4], mKe[4];    GLfloat lmKa[4];        cell_vector(pos, light_pos, 4);    cell_vector(lKa, light_Ka, 4);    cell_vector(lKd, light_Kd, 4);    cell_vector(lKs, light_Ks, 4);    cell_vector(dir, spot_direction, 3);    cell_vector(mKa, material_Ka, 4);    cell_vector(mKd, material_Kd, 4);    cell_vector(mKs, material_Ks, 4);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
五月天精品一区二区三区| 亚洲成人福利片| 亚洲色图视频免费播放| 天天综合色天天| 91精品国产综合久久蜜臀| 久久美女高清视频| 无码av中文一区二区三区桃花岛| 国产成人99久久亚洲综合精品| 欧美视频中文字幕| 国产精品不卡在线观看| 狠狠色丁香久久婷婷综合_中| 色国产综合视频| 国产精品天干天干在线综合| 久久国产免费看| 欧美日韩国产高清一区二区| 亚洲天堂久久久久久久| 国产精品一区二区免费不卡| 日韩一区二区三区四区| 亚洲一区二区黄色| 色综合久久综合网欧美综合网| 久久毛片高清国产| 国产一区美女在线| 日韩欧美卡一卡二| 日韩av中文字幕一区二区| 91黄视频在线| 亚洲色图自拍偷拍美腿丝袜制服诱惑麻豆| 久久国产日韩欧美精品| 欧美精品tushy高清| 亚洲高清免费在线| 欧日韩精品视频| 一区二区三区在线视频播放| 99久久99久久久精品齐齐| 国产精品三级视频| 丁香网亚洲国际| 亚洲国产精品av| 粗大黑人巨茎大战欧美成人| 久久久91精品国产一区二区三区| 久久99久久久久| 精品国产乱码久久久久久蜜臀| 免费成人av在线播放| 91精品国产黑色紧身裤美女| 蜜桃视频在线一区| 久久―日本道色综合久久| 国产一区二区精品久久91| 久久午夜电影网| 福利91精品一区二区三区| 亚洲国产精品av| 91亚洲男人天堂| 成人免费观看视频| 国产精品久久久久三级| 91丨国产丨九色丨pron| 一区二区三区.www| 在线成人午夜影院| 国产综合色产在线精品| 国产调教视频一区| 色视频一区二区| 日韩国产成人精品| 国产午夜精品一区二区| 99久久99久久免费精品蜜臀| 午夜精品福利视频网站| 日韩欧美一区二区三区在线| 国产成人高清在线| 亚洲午夜激情网站| 欧美xfplay| heyzo一本久久综合| 亚洲高清在线视频| 久久嫩草精品久久久久| 色狠狠一区二区| 韩国精品主播一区二区在线观看| 国产精品私人自拍| 在线不卡一区二区| 成人91在线观看| 日韩制服丝袜av| 国产精品色眯眯| 日韩欧美黄色影院| 91性感美女视频| 麻豆成人久久精品二区三区小说| 国产精品国产自产拍高清av| 欧美日韩三级视频| 成人黄色软件下载| 美腿丝袜在线亚洲一区| 亚洲欧美日韩国产中文在线| 欧美一级黄色录像| 色偷偷久久人人79超碰人人澡| 青青草成人在线观看| 亚洲三级电影网站| 久久香蕉国产线看观看99| 欧美在线观看一二区| 成人涩涩免费视频| 久草精品在线观看| 午夜电影一区二区三区| 亚洲欧美综合另类在线卡通| 日韩免费观看高清完整版 | 亚洲午夜国产一区99re久久| 日韩欧美国产1| 欧美图区在线视频| 色婷婷一区二区三区四区| 国产乱对白刺激视频不卡| 五月天亚洲精品| 亚洲美女在线国产| 国产精品高潮呻吟| 久久久99精品免费观看不卡| 91精品国产乱码| 欧美日韩国产首页在线观看| 色综合欧美在线视频区| 成人av集中营| 风流少妇一区二区| 丁香另类激情小说| 国产成人精品免费网站| 国产精品一卡二卡| 久久精品国产成人一区二区三区| 日韩制服丝袜先锋影音| 日韩va欧美va亚洲va久久| 午夜精品久久久久久久久| 午夜精品视频在线观看| 亚洲大型综合色站| 手机精品视频在线观看| 婷婷开心激情综合| 日韩成人dvd| 久久99久久久欧美国产| 欧美嫩在线观看| 欧美亚洲国产一区二区三区va| 欧美亚洲国产一区二区三区va| 欧洲一区在线电影| 欧美日韩高清一区二区| 9191成人精品久久| 日韩欧美二区三区| 久久精品无码一区二区三区| 久久久国产午夜精品| 国产精品久久久久精k8| 成人欧美一区二区三区1314| 亚洲欧美日韩国产综合| 亚洲成人久久影院| 奇米影视一区二区三区小说| 麻豆精品新av中文字幕| 国产综合久久久久久久久久久久| 国产黑丝在线一区二区三区| 成人精品免费视频| 欧美亚洲高清一区二区三区不卡| 欧美久久一二三四区| 精品国产乱码久久久久久牛牛| 国产亚洲综合av| 亚洲人成网站在线| 日韩不卡一区二区| 国产精品中文欧美| 日本精品一区二区三区高清 | 久久色.com| 国产亚洲视频系列| 亚洲亚洲精品在线观看| 国产专区综合网| 91在线一区二区| 91精品久久久久久久91蜜桃| 久久久99精品免费观看不卡| 亚洲免费视频中文字幕| 日韩国产欧美在线播放| 成人一区二区三区中文字幕| 国产亚洲一区二区三区在线观看| 亚洲女同一区二区| 久久av中文字幕片| 91啦中文在线观看| 精品国产一区二区亚洲人成毛片| 亚洲视频一区在线| 久久国产精品无码网站| 欧美在线制服丝袜| 国产午夜精品一区二区三区嫩草 | 欧美大度的电影原声| 亚洲视频你懂的| 裸体歌舞表演一区二区| 色婷婷精品久久二区二区蜜臀av| 91精品国产丝袜白色高跟鞋| 中文字幕高清一区| 久久精品99国产精品| 在线亚洲免费视频| 国产精品乱码人人做人人爱| 奇米影视7777精品一区二区| 色噜噜偷拍精品综合在线| 久久久精品黄色| 免费观看久久久4p| 欧美色网站导航| 中文字幕色av一区二区三区| 紧缚奴在线一区二区三区| 欧美日韩日本视频| 中文字幕亚洲欧美在线不卡| 国产一区二区三区不卡在线观看| 欧美老肥妇做.爰bbww| 亚洲美女在线一区| 波多野结衣精品在线| 久久精品免费在线观看| 精品一区二区三区免费毛片爱| 欧美日本一道本| 国产91露脸合集magnet| 日韩精品一区二区三区在线播放| 亚洲 欧美综合在线网络| 在线观看免费亚洲| 亚洲精品视频在线观看网站| aaa亚洲精品| 国产精品女主播av| 成人黄色在线看| 中文字幕亚洲区| 一本一本大道香蕉久在线精品|