diff options
author | Sebastian Park <SebPark03@gmail.com> | 2024-04-17 03:10:27 -0400 |
---|---|---|
committer | Sebastian Park <SebPark03@gmail.com> | 2024-04-17 03:10:27 -0400 |
commit | 9b436e67cdc5ee896c3c2fec90499e400a9e524e (patch) | |
tree | 45366352db1024722bbe7db07792c4148683afa9 /src/arap.cpp | |
parent | 0b0629450e2553b2f890094290528b565d607e38 (diff) |
Do realtime refraction kinda.
Diffstat (limited to 'src/arap.cpp')
-rw-r--r-- | src/arap.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/arap.cpp b/src/arap.cpp index 79fe475..94f2e3d 100644 --- a/src/arap.cpp +++ b/src/arap.cpp @@ -9,6 +9,7 @@ #include <Eigen/Core> #include <Eigen/Sparse> #include <Eigen/SVD> +#include <QImage> #include "ocean/ocean.h" @@ -47,6 +48,45 @@ void ARAP::init } coeffMin = all_vertices.colwise().minCoeff(); coeffMax = all_vertices.colwise().maxCoeff(); + + minCorner = coeffMin; + maxCorner = coeffMax; + + +// m_shape.initGroundPlane("cornell_box_full_lighting.png") +// QImage ocean_floor_image; +// GLuint ocean_floor_texture; +// // Prepare filepath +// QString ocean_floor_filepath = QString(":/resources/images/kitten.png"); + +// // TASK 1: Obtain image from filepath +// ocean_floor_image = QImage(ocean_floor_filepath); + +// // TASK 2: Format image to fit OpenGL +// ocean_floor_image = ocean_floor_image.convertToFormat(QImage::Format_RGBA8888).mirrored(); + +// // TASK 3: Generate kitten texture +// glGenTextures(1, &ocean_floor_texture); + +// // TASK 9: Set the active texture slot to texture slot 0 +// glActiveTexture(GL_TEXTURE0); + +// // TASK 4: Bind kitten texture +// glBindTexture(GL_TEXTURE_2D, ocean_floor_texture); + +// // TASK 5: Load image into kitten texture +// glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, ocean_floor_image.width(), ocean_floor_image.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, ocean_floor_image.bits()); + +// // TASK 6: Set min and mag filters' interpolation mode to linear +// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); +// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + +// // TASK 7: Unbind kitten texture +// glBindTexture(GL_TEXTURE_2D, 0); + +// // TASK 10: set the texture.frag uniform for our texture +// glUseProgram(m_texture_shader); +// glUniform1i(glGetUniformLocation(m_texture_shader, "sampler"), 0); } void ARAP::update(double seconds) |