技术标签: PBRT_V2
Primitive 类
class Primitive : public ReferenceCounted {
public:
// Primitive Interface
Primitive() : primitiveId(nextprimitiveId++) { }
virtual ~Primitive();
virtual BBox WorldBound() const = 0;
virtual bool CanIntersect() const;
virtual bool Intersect(const Ray &r, Intersection *in) const = 0;
virtual bool IntersectP(const Ray &r) const = 0;
virtual void Refine(vector<Reference<Primitive> > &refined) const;
void FullyRefine(vector<Reference<Primitive> > &refined) const;
virtual const AreaLight *GetAreaLight() const = 0;
virtual BSDF *GetBSDF(const DifferentialGeometry &dg,
const Transform &ObjectToWorld, MemoryArena &arena) const = 0;
virtual BSSRDF *GetBSSRDF(const DifferentialGeometry &dg,
const Transform &ObjectToWorld, MemoryArena &arena) const = 0;
// Primitive Public Data
const uint32_t primitiveId;
protected:
// Primitive Protected Data
static uint32_t nextprimitiveId;
};
类的作用:
(Shape不能表示Scene上的一个物体,因为Shape只有几何的信息,一个物体往往需要的还有是外观的信息(材质,所以 出现了Primitive ,既 包含了几何信息,又包含了材质信息))
Although the Shape class provides a convenient abstraction for
geometric operations such as intersection and bounding, it doesn’t contain enough information
to fully describe an object in a scene. For example, it is necessary to bind material
properties to each shape in order to specify its appearance. To accomplish these goals,
this chapter introduces the Primitive class and provides a number of implementations.
1. 几何接口
virtual bool CanIntersect() const;
virtual bool Intersect(const Ray &r, Intersection *in) const = 0;
virtual bool IntersectP(const Ray &r) const = 0;
virtual void Refine(vector<Reference<Primitive> > &refined) const;
这些接口 直接 关联 shape的对应的接口
2. 相交
virtual bool Intersect(const Ray &r, Intersection *in) const = 0;
注意:(Primitive 和Shape很相似,但是对应 Intersect方法 有点不同,最主要的区别是,Primitive->Intersect 返回的是Intersection 结构,而不是 DifferentialGeometry ,Intersection 保存了更加多的信息,而不只是几何信息,例如还有一些材质的信息)
One difference from the Shape interface is that the Primitive intersection methods return
Intersection structures rather than DifferentialGeometry. These Intersection
structures hold more information about the intersection than just the local geometric
information, such as information about the material properties at the hit point.
Another difference is that Shape::Intersect() returns the parametric distance along the
ray to the intersection in a float * output variable, while Primitive::Intersect() is
responsible for updating Ray::maxt with this value if an intersection is found.
3. Intersection 结构
// Intersection Declarations
struct Intersection {
// Intersection Public Methods
Intersection() {
primitive = NULL;
shapeId = primitiveId = 0;
rayEpsilon = 0.f;
}
BSDF *GetBSDF(const RayDifferential &ray, MemoryArena &arena) const;
BSSRDF *GetBSSRDF(const RayDifferential &ray, MemoryArena &arena) const;
Spectrum Le(const Vector &wo) const;
// Intersection Public Data
DifferentialGeometry dg;
const Primitive *primitive;
Transform WorldToObject, ObjectToWorld;
uint32_t shapeId, primitiveId;
float rayEpsilon;
};
类的作用:
(Intersection 结构 保存了 一个 相交点的 DifferentialGeometry,相交物体Primitive指针,和一些变换矩阵)
The Intersection structure holds information about a ray–primitive intersection, including
information about the differential geometry of the point on the surface, a pointer
to the Primitive that the ray hit, and its world-to-object-space transformation.
4. 细分
void Primitive::FullyRefine(vector<Reference<Primitive> > &refined) const
void Primitive::FullyRefine(vector<Reference<Primitive> > &refined) const {
vector<Reference<Primitive> > todo;
todo.push_back(const_cast<Primitive *>(this));
while (todo.size()) {
// Refine last primitive in todo list
Reference<Primitive> prim = todo.back();
todo.pop_back();
if (prim->CanIntersect())
refined.push_back(prim);
else
prim->Refine(todo);
}
}
作用:
(细分一个Primitive,直到所有的 Primitive 都是 intersectable,并返回 vector<Reference<Primitive> > &refined 保存所有的intersectable Primitive, )
It may be necessary to repeatedly refine a primitive until all of the primitives it has returned
are themselves intersectable. The Primitive::FullyRefine() utility method handles
this task. Its implementation is straightforward. It maintains(维护) a queue of primitives
to be refined (called todo in the following code) and invokes the Primitive::Refine()
method repeatedly on entries in that queue. Intersectable Primitives returned by
Primitive::Refine() are placed in the refined array, while nonintersectable ones are
placed back on the todo list by the Refine() routine.
5. virtual const AreaLight *GetAreaLight() const = 0;
作用:(如果 Primitive 可以作为 一个Area Light,就直接返回 Area Light, 不是的话,就直接返回NULL)
Primitive::GetAreaLight(), returns a pointer to the
AreaLight that describes the primitive’s emission distribution, if the primitive is itself a
light source. If the primitive is not emissive, this method should return NULL.
6.
(下面的两个方法,主要就是返回 某一个相交点的材质的 光散射 属性)
The other two methods return representations of the light-scattering properties of the
material at the given point on the surface.
6. 1
virtual BSDF *GetBSDF(const DifferentialGeometry &dg, const Transform &ObjectToWorld, MemoryArena &arena) const = 0;
作用:
returns a BSDF object (introduced in Section 9.1) that describes local light-scattering properties at the
intersection point.
6.2
virtual BSSRDF *GetBSSRDF(const DifferentialGeometry &dg,
const Transform &ObjectToWorld, MemoryArena &arena) const = 0;
作用:
Primitive::GetBSSRDF(), returns a BSSRDF, which describes subsurface
scattering inside the primitive—light that enters the surface at points far from where
it exits.While subsurface light transport has little effect on the appearance of objects like
metal, cloth, or plastic, it is the dominant(显著) light-scattering mechanism for biological(生物) materials
like skin, thick liquids like milk, etc.
Android开发开关基本上用不上原生的样式,都要自己改,空余时间自定义修改了switchButton,用法和原生switchButton一致,可以更换背景图以及开关圆点支持按住开关随手势左右滑动进行开关控制,动画流畅,使用也比较简单,用法:<com.yangfan.widget.SwitchButton android:id="@+id/pushset_switch2" a...
Hibernate中的sql查出的数据不能写别名,否则报错
AM是调幅,现在主要指中波,其实中波应该用MW表示中波的步进各国家和地区都不同,我国是步进9KHz,范围是531KHz-1602KHz,美国和我国的中波基本相同,国际上还有步进10KHz的制式。美国的调频(FM)范围和我国一致是87.0MHz-108.0MHz,日本的调频为76MHz-90MHz,与我国的校园广播频段大致相同。按省份划分的中国中波广播频率表中央台 频率(千赫) 功率(千瓦) 台呼 地属(发射地) 1017 中央人民广播电台第一套 1035 50 中央人民广播电台第一套_am频率
算法递归反转链表中的每一个结点:1.递归反转当前节点的下一个结点返回值设为pre2.如果当前结点的下一个结点为空则此时已经找到链表的最后一个结点,这是递归的出口:head->next = curr ,return curr3.从最后一个结点开始递归返回,将返回值作为当前结点的前驱结点4.反转当前结点:pre->next = currvoid Reverse(){ if(head->next == nullptr){ return; _c++单向链表反转
首先要使用一个TCP/UDP Socket调试工具。本次使用虚拟机NAT模式,主机IP地址为192.168.164.1,此时主机的/UDP Socket调试工具配置如下:虚拟机采用Win7 IP地址为192.168.164.101,其TCP/UDP Soceked调试工具配置如下:在Wireshark过滤器里面输入过滤命令,就能对获取的数据包进行过滤命令如下:ip.addr==192.168.16...
在工作中我们会遇到将通过数据手动录入到系统中的需求,如果数据量比较小,那么手动输入是可行的,倘若数据量很大,那么这些数据手动录入将会是一个很大的工作量,为了简化这个手动录入的操作流程,我们可以使用Excel表格先将数据按照相关格式保存,然后再通过Excel表格数据导入Oracle 表的表中,这样可以大大节约手动输入的时间。但这样做也不是没有风险的,虽然我们手动输入很慢和繁杂,但是如果系统对..._oracle如何导入数据
>>版权声明:本文为原创文章,请不要拷贝转载。1.JNA资料 https://github.com/java-native-access/jna 这份说明中讲的还是蛮细的,参数映射,指针,回调函数等等都有涉及,源码中还有一些例子。2.使用例子引入依赖<dependency> <grou..._ net.java.dev.jna jna
点击按钮,导出Excel,接口返回的是数据流,axios 利用blob导出后端返回二进制流excel文件打开axios官网,在请求配置这里可以看到‘responseType’这个属性//api.js//设置responseType为‘blob’export function download (data) { return request({ url: '/***/***/download', method: 'post', data:._vue 二进制转excel
什么是数据库?什么是数据库管理系统DBMS? 数据库——大规模 集成的数据集合;面向企业的相关数据的集合 数据库作用:真实世界的建模(描述) 数据库重要数据:实体(有形和无形都行)+ 客观实体之间的联系 数据库管理系统是一个软件被设计用于存储和管理数据库 文件和数据库之间的关系 文件也可以存储数据 但文件是操作系统提供的最简单的存储系统的机制; 文件只是一个平滑的字符流 没有结构 只有create open read write lseek等简单._数据库技术与应用笔记
Tune概述/home/kangkang/桌面/2019-04-04 10-02-17屏幕截图.png_ray.tune
public class BufferedWriterTest { public static void main(String[] args) { // TODO Auto-generated method stub BufferedWriterTest bwt = new BufferedWriterTest(); bwt.bufferedWriter("呵可呵榀", "d:\
文章目录实验2 linux文件系统实验一open()系统调用参数flags说明参数mode说明close()系统调用read()/write()系统调用lseek()系统调用实验二dup()系统调用dup2()系统调用fcntl()系统调用实验三struct stat结构定义stat()/fstat()/lstat()系统调用access()系统调用chmod()/fchmod()系统调用测试文件类型的宏实验四umask()系统调用link()/unlink()系统调用实验五mkdir()/rmdir()系_linux华清远见实验问题总结