这个类主要是记录了所有跟视图窗口有关的数据,用于显示。
类声明:
#pragma once #ifndef __VIEWPLANE_HEADER__ #define __VIEWPLANE_HEADER__ #include "../../Types.h" class Sampler; class ViewPlane { public: ViewPlane(); ViewPlane(const ViewPlane& vp); void set_hres(const integer hr); void set_vres(const integer vr); void set_pixelsize(const ldouble ps); void set_gamma(const ldouble ga); void set_samples(const integer n); void set_sampler(Sampler* const sp); integer hres; integer vres; ldouble s; ldouble g; }; #endif
类定义:
#include "pch.h" #include "viewplane.h" ViewPlane::ViewPlane() :hres(200), vres(100), s(0.02), g(1) {} ViewPlane::ViewPlane(const ViewPlane& vp) : hres(vp.hres), vres(vp.vres), s(vp.s), g(vp.g) {} void ViewPlane::set_hres(const integer hr) { hres = hr; } void ViewPlane::set_vres(const integer vr) { vres = vr; } void ViewPlane::set_pixelsize(const ldouble ps) { s = ps; } void ViewPlane::set_gamma(const ldouble ga) { g = ga; }
暂时不添加采样,后续后扩展。目前我们只想实现基础的碰撞,至少要显示一个球体出来吧。