⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 baseshapes.h

📁 file code.zip are used to implement ray tracing technology.
💻 H
字号:
#ifndef _BASE_SHAPES_#define _BASE_SHAPES_#include <string>#include <iostream>using namespace std;#include "common.h"#include "affine.h"#include "Material.h"#include "Ray.h"#define PI 3.14159265#define TWOPI (3.14159265 * 2)#define degPerRad (180/3.14159265)#define Near(a,v) fabs((a)-(v))<0.0001 //@@@@@@@@@@@@@@@@@@@@@@@@ Cuboid @@@@@@@@@@@@@@@@@@@@@@@@class Cuboid{ // holds six border values of a cuboidpublic:    float left, top, right, bott, front, back;    void set(float l, float t, float r, float b, float f, float bk);    void set(Cuboid& c);    void print();};//@@@@@@@@@@@@@@@@@@@@@@@@@@ SphereInfo @@@@@@@@@@@@@@@@@@@@@class SphereInfo{// holds the center and radius of a spherepublic:    Point3 center;    float radSq;    void set(float x, float y, float z, float rsq);};//@@@@@@@@@@@@@@@@@@@@@ GeomObj class @@@@@@@@@@@@@@@@class GeomObj{public:    IntRect scrnExtnt;    Cuboid genBoxExtent, worldBoxExtent;    SphereInfo genSphereExtent, worldSphereExtent;    string name;    GeomObj * next;    GeomObj();    GeomObj(string name);    virtual ~GeomObj() {};	virtual void initializeData() {};	virtual bool hit(Ray &r, Intersection &inter) =0;	virtual void makeExtentPoints(PointCluster& clust) {};	virtual void drawCanvas() {};	virtual void drawOpenGL() {};    virtual void loadStuff() {}	virtual void tellMaterialsGL() {};    virtual void print() { cout << "Object: GeomObj\n"; }};//@@@@@@@@@@@@@@@@@ Shape @@@@@@@@@@@@@@@@@@@@@class Shape: public GeomObj {public:    Material mtrl;    Affine4 transf, invTransf;    Shape();    virtual ~Shape() {}    void initializeData() {};    virtual bool hit(Ray &r, Intersection &inter) = 0;    virtual void makeExtentPoints(PointCluster& clust) = 0;    void setMaterial(Material mt);    void tellMaterialsGL();    void xfrmRay(Ray &genRay, Ray r);	virtual void drawCanvas() {}    virtual void drawOpenGL() = 0;    virtual void print() { cout << "Object: Shape\n"; }};#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -