?? baseshapes.cpp
字號:
#include "BaseShapes.h"#include <float.h>void Cuboid::set(float l, float t, float r, float b, float f, float bk) { left = l; top = t; right = r; bott = b; front = f; back = bk;}void Cuboid::set(Cuboid& c){ left = c.left;top = c.top; right = c.right; bott = c.bott; front = c.front; back = c.back;}void Cuboid::print(){ cout << "\n(l,t,r,b,f,bk) = (" << left << "," << top << "," << right << "," << bott << "," << front << "," << back << ")";}void SphereInfo::set(float x, float y, float z, float rsq){ center.set(x,y,z); radSq = rsq;}GeomObj::GeomObj() : next(NULL) { name = "N/A"; }GeomObj::GeomObj(string NAME) : next(NULL) { name = NAME; }Shape::Shape() {}void Shape::setMaterial(Material mt) { mtrl = mt; }void Shape::tellMaterialsGL(){ float amb[4], diff[4], spec[4], emiss[4]; //Fill each array for use with openGL 'fv' functions mtrl.ambient.build4tuple(amb); mtrl.diffuse.build4tuple(diff); mtrl.specular.build4tuple(spec); mtrl.emissive.build4tuple(emiss); glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, amb); glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, diff); glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, spec); glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, emiss); glMaterialf (GL_FRONT_AND_BACK, GL_SHININESS, mtrl.specularExponent);}void Shape::xfrmRay(Ray &genRay, Ray r){ float v[4]; r.getStart().build4tuple(v); invTransf.applyTransform(v); genRay.setStart(v[0], v[1], v[2]); r.getDir().build4tuple(v); invTransf.applyTransform(v); genRay.setDir(v[0], v[1], v[2]); return;}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -