📄 enviroment.cpp
字号:
#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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -