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

📄 primitiveshapes.h

📁 file code.zip are used to implement ray tracing technology.
💻 H
字号:
#ifndef _PRIMITIVES_
#define _PRIMITIVES_
#include "BaseShapes.h"
#include "RGBpixmap.h"
#include <windows.h>
//@$@$@$@$@$@$@$@$@$@ Plane class @$@$@$@$@$@$@$@$@$
class Plane : public Shape
{
public:
    Plane();

    void makeExtentPoints(PointCluster& clust);
    bool hit(Ray &r, Intersection &inter);

	void drawOpenGL();

	void print();
};

class Checkerboard : public Shape
{
private:
	Plane *checkObj1, *checkObj2;
	double dx, dy;

public:
    Checkerboard();
    Checkerboard(double newDX, double newDY);

    void makeExtentPoints(PointCluster& clust);
    bool hit(Ray &r, Intersection &inter);

	void drawOpenGL();

	void print();
};

//@$@$@$@$@$@$@$@$@$@ Square class @$@$@$@$@$@$@$@$@$
class Square : public Shape
{
public:
    Square();

    void makeExtentPoints(PointCluster& clust);
    bool hit(Ray &r, Intersection &inter);

    void drawOpenGL();

    void print();
};


//@$@$@$@$@$@$@$@$@ Cube class $@$@$@$@$@$@$@$@$@$@
class Cube : public Shape
{
private:
	Point3 cubeNormal(int surface);
	
public:
    Cube();
	
    void makeExtentPoints(PointCluster& clust);
    bool hit(Ray &r, Intersection &inter);

    void drawOpenGL();

    void print(void);
};


//@$@$@$@$@$@$@$@$ Sphere class @$@$@$@$@$@$@$@$@$@$@$@
class Sphere : public Shape
{
public:
    Sphere();

    void makeExtentPoints(PointCluster& clust);
    bool hit(Ray& r, Intersection& inter);
	
    void drawOpenGL();
	
    void print();
};


//@$@$@$@$@$@$@$@$@$@ TaperedCylinder class @$@$@$@$@$@$@$@$@$
class TaperedCylinder : public Shape
{
public:
    float smallRadius;

    TaperedCylinder();
    TaperedCylinder(float radius);

    void makeExtentPoints(PointCluster& clust);
    bool hit(Ray &r, Intersection &inter);

    void drawOpenGL();

    void print();
};


//@$@$@$@$@$@$@$@$@$@ Cone class @$@$@$@$@$@$@$@$@$
class Cone : public TaperedCylinder
{
public:
    Cone();
    void print();

    void drawOpenGL();
};


//@$@$@$@$@$@$@$@$@$@ Cylinder class @$@$@$@$@$@$@$@$@$
class Cylinder : public TaperedCylinder
{
public:
    Cylinder();
    void print();

    void drawOpenGL();
};


//@$@$@$@$@$@$@$@$@$@ Torus class @$@$@$@$@$@$@$@$@$
class Torus : public Shape
{
public:
    Torus();

    void makeExtentPoints(PointCluster& clust);
    bool hit(Ray &r, Intersection &inter);

    void drawOpenGL();

    void print();
};
class Teapot : public Shape{
public:
	Teapot(){};
		void makeExtentPoints(PointCluster& clust) {};
		void drawOpenGL(){ tellMaterialsGL(); glPushMatrix();
		glMultMatrixf(transf.m);
		glutSolidTeapot(1.0); glPopMatrix();};
		bool hit(Ray &r, Intersection &inter){return false;}
};
#endif

⌨️ 快捷键说明

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