enviroment.cpp
来自「此文档是用vistual studio 2005 开发的用来描述3D-tree 」· C++ 代码 · 共 56 行
CPP
56 行
#include "stdafx.h"
#include "Enviroment.h"
#include "GL/glut.h"
Enviroment::Enviroment() {
setAmbient( 0.2f, 0.2f, 0.2f, 1.0f );
setDiffuse( 0.8f, 0.8f, 0.8f, 1.0f );
setSpecular( 1.0f, 1.0f, 1.0f, 1.0f );
setEmission( 0.0f, 0.0f, 0.0f, 1.0f );
setShiness( 0.0f );
}
void Enviroment::setAmbient( float r, float g, float b,float a ) {
ambient[ 0 ] = r;
ambient[ 1 ] = g;
ambient[ 2 ] = b;
ambient[ 3 ] = a;
}
void Enviroment::setDiffuse( float r, float g, float b,float a ) {
diffuse[ 0 ] = r;
diffuse[ 1 ] = g;
diffuse[ 2 ] = b;
diffuse[ 3 ] = a;
}
void Enviroment::setSpecular( float r, float g, float b,float a ) {
specular[ 0 ] = r;
specular[ 1 ] = g;
specular[ 2 ] = b;
specular[ 3 ] = a;
}
void Enviroment::setEmission( float r, float g, float b,float a ) {
emission[ 0 ] = r;
emission[ 1 ] = g;
emission[ 2 ] = b;
emission[ 3 ] = a;
}
void Enviroment::setShiness( float shin ) {
shiness = shin;
}
void Enviroment::resetMaterial() {
glMaterialfv( GL_FRONT, GL_AMBIENT, ambient );
glMaterialfv( GL_FRONT, GL_DIFFUSE, diffuse );
glMaterialfv( GL_FRONT, GL_SPECULAR, specular );
glMaterialfv( GL_FRONT, GL_EMISSION, emission );
glMaterialf( GL_FRONT, GL_SHININESS, shiness );
}
Enviroment::~Enviroment() {
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?