Clean up code for rendering and wrapping it to Lua
Now with an object oriented example. Signed-off-by: Hartmut Seichter <hartmut@technotecture.com>
This commit is contained in:
parent
52c077af6c
commit
2c4cc29f97
21 changed files with 332 additions and 236 deletions
|
@ -8,39 +8,46 @@
|
|||
|
||||
int main(int argc,char **argv) {
|
||||
|
||||
pw::geometry amesh;
|
||||
pw::geometry geo;
|
||||
|
||||
pw::geometry::vertex3array_t vs = { {-1,-1,0},{1,-1,0},{0,1,0} };
|
||||
amesh.set_vertices(vs);
|
||||
pw::vector3_array vs = { {-1,-1,0},{1,-1,0},{0,1,0} };
|
||||
|
||||
for (auto v : amesh.vertices()) {
|
||||
std::cout << pw::serialize::matrix(v.transposed()) << std::endl;
|
||||
}
|
||||
|
||||
auto scale = pw::matrix_transform<float>::scale_matrix({2,2,2});
|
||||
geo.set_vertices(vs);
|
||||
|
||||
amesh.transform(scale);
|
||||
|
||||
std::cout << "after scale" << std::endl;
|
||||
|
||||
for (auto v : amesh.vertices()) {
|
||||
std::cout << pw::serialize::matrix(v.transposed()) << std::endl;
|
||||
}
|
||||
|
||||
pw::axisangle aa;
|
||||
// amesh.set_vertices(vs);
|
||||
|
||||
aa.axis = pw::vector3({ 0, 0, 1 });
|
||||
aa.angle = pw::deg_to_rad(90.0f);
|
||||
// for (auto v : amesh.vertices()) {
|
||||
// std::cout << pw::serialize::matrix(v.transposed()) << std::endl;
|
||||
// }
|
||||
|
||||
auto rot_mat = aa.to_matrix();
|
||||
// auto scale = pw::matrix_transform<float>::scale_matrix({2,2,2});
|
||||
|
||||
amesh.transform(rot_mat);
|
||||
// amesh.transform(scale);
|
||||
|
||||
std::cout << "after rotate" << std::endl;
|
||||
// std::cout << "after scale" << std::endl;
|
||||
|
||||
for (auto v : amesh.vertices()) {
|
||||
std::cout << pw::serialize::matrix(v.transposed()) << std::endl;
|
||||
}
|
||||
// for (auto v : amesh.vertices()) {
|
||||
// std::cout << pw::serialize::matrix(v.transposed()) << std::endl;
|
||||
// }
|
||||
|
||||
// pw::axisangle aa;
|
||||
|
||||
// aa.axis = pw::vector3({ 0, 0, 1 });
|
||||
// aa.angle = pw::deg_to_rad(90.0f);
|
||||
|
||||
// auto rot_mat = aa.to_matrix();
|
||||
|
||||
// amesh.transform(rot_mat);
|
||||
|
||||
// std::cout << "after rotate" << std::endl;
|
||||
|
||||
// for (auto v : amesh.vertices()) {
|
||||
// std::cout << pw::serialize::matrix(v.transposed()) << std::endl;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue