reworking the transform tools
This commit is contained in:
parent
114f17a499
commit
6b4eb83e64
7 changed files with 126 additions and 49 deletions
|
@ -8,6 +8,6 @@ make_test(pwcore_test_matrix)
|
|||
make_test(pwcore_test_axisangle)
|
||||
make_test(pwcore_test_quaternion)
|
||||
make_test(pwcore_test_color)
|
||||
make_test(pwcore_test_transform_tools)
|
||||
|
||||
# make_test(pwcore_test_transform_tools)
|
||||
# make_test(pwcore_test_mesh)
|
||||
|
|
|
@ -1,18 +1,38 @@
|
|||
|
||||
#include <pw/core/vector.hpp>
|
||||
#include <pw/core/serialize.hpp>
|
||||
#include <pw/core/debug.hpp>
|
||||
#include <pw/core/matrix_transform.hpp>
|
||||
#include <pw/core/serialize.hpp>
|
||||
#include <pw/core/vector.hpp>
|
||||
|
||||
#include <iostream>
|
||||
auto main() -> int {
|
||||
|
||||
int main(int argc,char **argv) {
|
||||
pw::debug::d() << "pixwerx.matrix_transform.test\n";
|
||||
|
||||
auto perspective_mat = pw::matrix_transform<float>::perspective_projection(45.f,1.3f,10,100);
|
||||
auto ortho_mat = pw::matrix_transform<float>::orthographic_frustum(-1,1,1,-1,10,100);
|
||||
auto lookat_mat = pw::matrix_transform<float>::look_at(pw::vector3(0,0,5),pw::vector3(0,0,0),pw::vector3(0,1,0));
|
||||
auto scale_123 =
|
||||
pw::matrix_transform::scale_matrix<float>({1.f, 2.f, 3.f, 1.f});
|
||||
pw::debug::d() << "matrix_transform::scale(1,2,3) -> \n"
|
||||
<< pw::serialize::to_string(scale_123);
|
||||
|
||||
auto fm_default =
|
||||
pw::matrix_transform::frustum_matrix(pw::frustum<float>{});
|
||||
pw::debug::d() << "matrix_transform::frustum::default -> \n"
|
||||
<< pw::serialize::to_string(fm_default);
|
||||
|
||||
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;
|
||||
auto fm_45deg_1dot3 = pw::matrix_transform::frustum_matrix(
|
||||
pw::frustum<float>::make_perspective_symmetric(45.f, 1.3f, 0.1f,
|
||||
1000.f));
|
||||
pw::debug::d() << "matrix_transform::frustum::45deg -> \n"
|
||||
<< pw::serialize::to_string(fm_45deg_1dot3);
|
||||
|
||||
auto fm_ortho = pw::matrix_transform::frustum_matrix(
|
||||
pw::frustum<float>::make_orthographic_symmetric(0.5f, 1.3f, 0.1f,
|
||||
1000.f));
|
||||
pw::debug::d() << "matrix_transform::frustum::ortho -> \n"
|
||||
<< pw::serialize::to_string(fm_ortho);
|
||||
|
||||
auto lookat_mat = pw::matrix_transform::look_at_matrix(
|
||||
pw::vector{0.f, 0, 5}, pw::vector{0.f, 0, 0}, pw::vector{0.f, 1, 0});
|
||||
|
||||
pw::debug::d() << "matrix_transform::look_at -> \n"
|
||||
<< pw::serialize::to_string(lookat_mat);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue