Skip to content

Instantly share code, notes, and snippets.

@iondune
Created May 12, 2017 05:19
Show Gist options
  • Save iondune/4626a6e8990e8ab729b4695a431eaebc to your computer and use it in GitHub Desktop.
Save iondune/4626a6e8990e8ab729b4695a431eaebc to your computer and use it in GitHub Desktop.
Sample struct to make raytracer diagnostics possible.
struct SPixelContext
{
enum class EIterationType
{
Primary = 0,
Reflection = 1,
Refraction = 2
};
struct SShadowInfo
{
ray3f Ray;
bool Hit = false;
};
struct SIteration
{
EIterationType Type = EIterationType::Primary;
ray3f Ray;
CObject const * HitObject = nullptr;
vec3f HitPoint;
vec3f HitNormal;
float HitTime = 0;
vector<SShadowInfo> ShadowRays;
color3f Ambient;
color3f Diffuse;
color3f Specular;
string ExtraInfo;
SIteration * Parent = nullptr;
};
vector<SIteration *> Iterations;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment