Commit graph

24 commits

Author SHA1 Message Date
0ab3e17467 Objects need to be translated by their negation
Translating by the negation of the given vector puts them in the right place from the ray's perspective. Without the negation, things are mirrored.
2014-08-20 10:06:22 -07:00
301f5ff9aa Use ToObjectSpace and FromObjectSpace for ray components 2014-08-20 10:05:17 -07:00
07e75c663d Convert normal from object to world space
Properly doing this is a bit more complicated because it has to be normalized and pointing in the right direction. Just applying the inverse of the transform matrix doesn't quite do it.
2014-08-20 10:04:38 -07:00
791fdaa14a Use the Vector4 version of Matrix4::Translation for object origins 2014-08-16 20:35:49 -07:00
c45d698424 Get a column vector of a matrix 2014-08-16 00:43:43 -07:00
bbbac6ff92 Fix up Object object space conversions
- Ray directions shouldn't be translated
- Implement vector translation to global space
2014-08-15 22:33:22 -07:00
8af03c3f3d Implement Object::Place
Places the object by manipulating its translation matrix.
2014-08-15 22:32:44 -07:00
56fff1178e ToObjectSpace copies the Ray anyway, so pass by value 2014-08-10 16:58:05 -07:00
49d097a803 Get rid of Matrix<N,M>, just use Matrix4 2014-08-10 10:51:12 -07:00
bf91fff5a2 More compiler fixups 2014-08-09 21:23:11 -07:00
70576c382a Do all the clean up needed for Object 2014-08-09 10:42:49 -07:00
d0d667d6d2 Object::Intersect
A new intersect method that converts to object space before doing the intersection. Now all objects are at their own origin!
2014-08-09 09:59:00 -07:00
584d0326a9 Get rid of object's origin 2014-08-09 08:59:11 -07:00
ab9ac5e963 Clean up constructors for Object and Sphere
Use default arguments instead of multiple constructors. I forgot about those! Use Vector4s all around.
2014-08-09 08:57:41 -07:00
4828cb313f Add Write methods to scene objects
Write methods are polymorphic, overridden by subclasses. There is a single operator<< for Objects that calls the right Write() method for the object. Neat.
2014-08-03 17:25:00 -07:00
2036521f42 Update code style for Object
- Remove Shape, because it seems to be mostly extra. All renderable objects now
derive from Object, rather than Shape
- Light (which inherited from Object before) now defines its own origin, but
this is coming in a later commit...
- Use charles namespace

- Use a std::vector<double> instead of float** to pass back intersection points.
This is kind of a biggie because it made the render process 50% slower :( I'll
have to work out why and maybe fix it...
2014-07-20 16:48:09 -07:00
0a14661da8 Set material to NULL in Shape 2014-07-19 15:41:17 -07:00
68d0083ba8 Object::get_material returns a pointer instead of a reference 2014-07-19 14:09:47 -07:00
c405302613 Add operator<< overload for Object 2013-09-22 10:16:15 -07:00
e55828890b Add virtual destructor for Shape class 2013-09-13 14:14:45 -07:00
2c23fb819e Add Materials to the shapes in the scene 2013-09-11 09:05:27 -07:00
e5601e7f43 Define constructors for Object and Shape; move a bunch of Sphere code to object_sphere 2013-09-10 15:45:13 -07:00
2d66ba0945 Move Sphere::does_intersect to object_sphere; fill out object_sphere in C++ 2013-09-10 09:33:59 -07:00
a02e31952e Update object.cc for C++ 2013-09-10 09:18:05 -07:00
Renamed from src/object.c (Browse further)