eos 1.4.0
Loading...
Searching...
No Matches
render.hpp
1/*
2 * eos - A 3D Morphable Model fitting library written in modern C++11/14.
3 *
4 * File: include/eos/render/render.hpp
5 *
6 * Copyright 2014-2020, 2023 Patrik Huber
7 *
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20#pragma once
21
22#ifndef EOS_RENDER_HPP
23#define EOS_RENDER_HPP
24
25#include "eos/core/Image.hpp"
26#include "eos/core/Mesh.hpp"
28#include "eos/render/VertexShader.hpp"
29#include "eos/render/FragmentShader.hpp"
30
31#include "Eigen/Core"
32
33namespace eos {
34namespace render {
35
52core::Image4u render(const core::Mesh& mesh, const Eigen::Matrix4f& model_view_matrix,
53 const Eigen::Matrix4f& projection_matrix, int viewport_width, int viewport_height,
54 bool enable_backface_culling = false, bool enable_near_clipping = true,
55 bool enable_far_clipping = true)
56{
58 viewport_height);
59 software_renderer.enable_backface_culling = enable_backface_culling;
60 software_renderer.enable_near_clipping = enable_near_clipping;
61 software_renderer.rasterizer.enable_far_clipping = enable_far_clipping;
62
63 return software_renderer.render(mesh, model_view_matrix, projection_matrix);
64};
65
84core::Image4u render(const core::Mesh& mesh, const Eigen::Matrix4f& model_view_matrix,
85 const Eigen::Matrix4f& projection_matrix, int viewport_width, int viewport_height,
86 Texture texture, bool enable_backface_culling = false, bool enable_near_clipping = true,
87 bool enable_far_clipping = true)
88{
89 SoftwareRenderer<VertexShader, TexturingFragmentShader> software_renderer(viewport_width,
90 viewport_height);
91 software_renderer.enable_backface_culling = enable_backface_culling;
92 software_renderer.enable_near_clipping = enable_near_clipping;
93 software_renderer.rasterizer.enable_far_clipping = enable_far_clipping;
94
95 return software_renderer.render(mesh, model_view_matrix, projection_matrix, texture);
96};
97
98} /* namespace render */
99} /* namespace eos */
100
101#endif /* EOS_RENDER_HPP */
This file implements a software renderer, in the spirit of OpenGL conventions and vertex and fragment...
Class to represent images.
Definition: Image.hpp:44
X.
Definition: SoftwareRenderer.hpp:71
core::Image4u render(const core::Mesh &mesh, const Eigen::Matrix4< T > &model_view_matrix, const Eigen::Matrix4< T > &projection_matrix, const cpp17::optional< Texture > &texture=cpp17::nullopt)
Todo.
Definition: SoftwareRenderer.hpp:98
Represents a texture for rendering.
Definition: Texture.hpp:64
core::Image4u render(const core::Mesh &mesh, const Eigen::Matrix4f &model_view_matrix, const Eigen::Matrix4f &projection_matrix, int viewport_width, int viewport_height, bool enable_backface_culling=false, bool enable_near_clipping=true, bool enable_far_clipping=true)
Definition: render.hpp:52
Namespace containing all of eos's 3D model fitting functionality.
This class represents a 3D mesh consisting of vertices, vertex colour information and texture coordin...
Definition: Mesh.hpp:45