📄 raytracer.h
字号:
/* Copyright (c) 2007 Massachusetts Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of * the Software, and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *//** * raytracer.h - blue-steel RayTracer class * @author Brian Sweatt * * Contains routines for tracing a packet of rays through a scene represented by a set of objects * This includes the tracing of secondary rays for shadows, reflection, and refraction * * This class is only instantiable on the SPU */#ifndef _RAYTRACER_H_#define _RAYTRACER_H_#include <stdio.h>#include "objectset.h"#include "raypacket.h"#include "hitpacket.h"#include "rgbpacket.h"class RayTracer { public: RayTracer(ObjectSet *objects, int bounces, bool shadows, int numLights, vector float amb); ~RayTracer() {} RGBPacket tracePacket(const RayPacket r, HitPacket &hit, float tmin, int bounces, vector float refIndex) const; int getBounces() const; void setAmbient(vector float amb) {ambient_light = amb;} private: vector unsigned int transmit_vec3_v(vector float &dx, vector float &dy, vector float &dz, const vector float nx, const vector float ny, const vector float nz, const vector float ix, const vector float iy, const vector float iz, vector float index_i, vector float index_t) const; ObjectSet *objects; vector float ambient_light; int bounces; int num_lights; bool shadows; };#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -