add missing files

This commit is contained in:
Hartmut Seichter 2019-01-25 18:01:16 +01:00
parent 5245ceb112
commit 46036f15bf
4 changed files with 209 additions and 0 deletions

View file

@ -0,0 +1,47 @@
#include <pw/core/vector.hpp>
#include <pw/core/serialize.hpp>
#include <pw/core/transform_tools.hpp>
#include <pw/core/mesh.hpp>
#include <pw/core/axisangle.hpp>
#include <iostream>
int main(int argc,char **argv) {
pw::mesh amesh;
pw::mesh::vertex3array_t vs = { {-1,-1,0},{1,-1,0},{0,1,0} };
amesh.set_vertices(vs);
for (auto v : amesh.vertices()) {
std::cout << pw::serialize::matrix(v.transposed()) << std::endl;
}
auto scale = pw::transform_tools<float>::scale_matrix({2,2,2});
amesh.apply(scale);
std::cout << "after scale" << 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.apply(rot_mat);
std::cout << "after rotate" << std::endl;
for (auto v : amesh.vertices()) {
std::cout << pw::serialize::matrix(v.transposed()) << std::endl;
}
}

View file

@ -0,0 +1,18 @@
#include <pw/core/vector.hpp>
#include <pw/core/serialize.hpp>
#include <pw/core/transform_tools.hpp>
#include <iostream>
int main(int argc,char **argv) {
auto perspective_mat = pw::transform_tools<float>::perspective_projection(45.f,1.3f,10,100);
auto ortho_mat = pw::transform_tools<float>::orthogonal_projection(-1,1,1,-1,10,100);
auto lookat_mat = pw::transform_tools<float>::look_at(pw::vector3(0,0,5),pw::vector3(0,0,0),pw::vector3(0,1,0));
std::cout << pw::serialize::matrix(perspective_mat) << std::endl;
std::cout << pw::serialize::matrix(ortho_mat) << std::endl;
std::cout << pw::serialize::matrix(lookat_mat) << std::endl;
}