Commit 998e9819 authored by Tim Übelhör's avatar Tim Übelhör

Conanfile packages shader files.

Default constructor for OnScreenRender.
parent 22ea6d63
......@@ -30,6 +30,12 @@ class SciglRenderConan(ConanFile):
cmake.build()
def package(self):
self.copy("*.cs", dst="include", src="include", keep_path=True)
self.copy("*.fs", dst="include", src="include", keep_path=True)
self.copy("*.gs", dst="include", src="include", keep_path=True)
self.copy("*.tcs", dst="include", src="include", keep_path=True)
self.copy("*.tes", dst="include", src="include", keep_path=True)
self.copy("*.vs", dst="include", src="include", keep_path=True)
self.copy("*.h", dst="include", src="include", keep_path=True)
self.copy("*.hpp", dst="include", src="include", keep_path=True)
self.copy("*.lib", dst="lib", keep_path=False)
......
......@@ -14,12 +14,18 @@ Simple rendering of a scene right on the screen (GLContext window).
class OnscreenRender
{
public:
/*! Need to set the shader with the setter */
OnscreenRender();
/*!
Configures the rendering environment and loads the models.
\param shader how to render the scene
*/
OnscreenRender(Shader shader);
/*! Shader program for rendering the scene*/
void set_shader_program(Shader shader);
/*!
Renders the next frame onto the screen.
*/
......
......@@ -67,11 +67,15 @@ int main(int argc, char *argv[])
camera_intrinsics.c_y = 310;
camera_intrinsics.f_x = 511;
camera_intrinsics.f_y = 513;
camera_intrinsics.dist_coeffs[0] = 4.1925421198910247e-02;
camera_intrinsics.dist_coeffs[1] = -9.6463442423611379e-02;
camera_intrinsics.dist_coeffs[2] = -2.3391717576772839e-03;
camera_intrinsics.dist_coeffs[3] = 5.8792609967242386e-04;
camera_intrinsics.dist_coeffs[4] = 4.9171950039135250e-02;
float dist_coeffs[] = {
4.1925421198910247e-02,
-9.6463442423611379e-02,
-2.3391717576772839e-03,
5.8792609967242386e-04,
4.9171950039135250e-02,
0, 0, 0};
std::copy(std::begin(dist_coeffs), std::end(dist_coeffs),
std::begin(camera_intrinsics.dist_coeffs));
CvCamera camera(camera_intrinsics);
// Test if Cartesian -> Quaternion works
CartesianPose camera_pose = {glm::vec3(0, 0, 0), glm::vec3(0, 0, 0)};
......@@ -81,7 +85,7 @@ int main(int argc, char *argv[])
model.pose.position = glm::vec3(0, 0, 0.5);
model.pose.orientation.x = 0.707;
model.pose.orientation.w = 0.707;
light.position = glm::vec3(0, -0.1, 0);
light.position = glm::vec3(0, -0.5, 0);
light.color = glm::vec3(1, 1, 1);
// main loop
......
......@@ -3,12 +3,13 @@
namespace scigl_render
{
OnscreenRender::OnscreenRender() : OnscreenRender(Shader(0)) {}
OnscreenRender::OnscreenRender(Shader shader)
: shader(std::move(shader))
{
// Configure the global rendering settings
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
check_gl_error("onscreen render created");
set_shader_program(std::move(shader));
}
void OnscreenRender::next_frame(
......@@ -24,7 +25,12 @@ void OnscreenRender::next_frame(
model.draw(shader);
glfwSwapBuffers(gl_context.get_window());
check_gl_error("next frame");
check_gl_error("rendered next frame");
}
void OnscreenRender::set_shader_program(Shader shader)
{
this->shader = std::move(shader);
}
} // namespace scigl_render
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment