Makman2 / CE3D2

A simple 3D engine for the console
GNU General Public License v3.0
10 stars 3 forks source link

Transformation: Actually make use of ITransformable #89

Closed Makman2 closed 8 years ago

Makman2 commented 8 years ago

The Transformation class does not implement a function/specialization for ITransformable so this gets possible:

Model model;
Scale scale(create_vector(2.0f, 2.0f));
scale.transform(model);
# This one is already possible:
model.transform(scale)
Makman2 commented 8 years ago

This sucks so hard with circular dependencies, overload lookup problems together with the templated version of transform (even SFINAE approach doesn't work, it retriggers the old circular-dependency forward declaration problem because the code of the new transform resides now in a header and needs the internal methods used declared) and forward declaration, that it makes it quite complicated. There's still another possibility using private function overload lookup using dummy types passed to the function, but I dislike it because I'm not really sure how the compiler optimizes that away (a type is at least instantiated). It also looks not very clean, so please just do:

itransformable_instance.transform(transformation_instance);