Skip to content

Commit

Permalink
Insert dlights into a worldspace axis-aligned grid to reduce shading …
Browse files Browse the repository at this point in the history
…cost.
  • Loading branch information
jpcy committed Feb 20, 2016
1 parent 8920bb6 commit 38b714d
Show file tree
Hide file tree
Showing 12 changed files with 573 additions and 129 deletions.
42 changes: 42 additions & 0 deletions code/math/Math.h
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,48 @@ class vec3
vec3 projectOnPlane(const vec3 &normal) const;
};

class vec3i
{
public:
vec3i() : x(0), y(0), z(0) {}
vec3i(int x, int y, int z) : x(x), y(y), z(z) {}

int &operator[](size_t index)
{
assert(index >= 0 && index <= 2);
return (&x)[index];
}

const int &operator[](size_t index) const
{
assert(index >= 0 && index <= 2);
return (&x)[index];
}

int x, y, z;
};

class vec3b
{
public:
vec3b() : x(0), y(0), z(0) {}
vec3b(uint8_t x, uint8_t y, uint8_t z) : x(x), y(y), z(z) {}

uint8_t &operator[](size_t index)
{
assert(index >= 0 && index <= 2);
return (&x)[index];
}

const uint8_t &operator[](size_t index) const
{
assert(index >= 0 && index <= 2);
return (&x)[index];
}

uint8_t x, y, z;
};

class vec4
{
public:
Expand Down
Loading

0 comments on commit 38b714d

Please sign in to comment.