-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
404386e
commit a578437
Showing
22 changed files
with
192 additions
and
41 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
carcockpit - Car cockpit example GUI project | ||
Copyright (C) 2024 Gagistech Oy <[email protected]> | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
/* ================ LICENSE END ================ */ | ||
|
||
#include "shader_skybox.hpp" | ||
|
||
#include <ruis/render/opengles/index_buffer.hpp> | ||
#include <ruis/render/opengles/texture_cube.hpp> | ||
#include <ruis/render/opengles/util.hpp> | ||
#include <ruis/render/opengles/vertex_array.hpp> | ||
#include <ruis/render/opengles/vertex_buffer.hpp> | ||
|
||
using namespace carcockpit; | ||
|
||
shader_skybox::shader_skybox() : | ||
shader_base( | ||
R"qwertyuiop( | ||
attribute highp vec4 a0; // position | ||
uniform highp mat4 matrix; // mvp matrix | ||
uniform highp mat4 mat4_mv; // modelview matrix | ||
varying highp vec3 pos; | ||
void main(void) | ||
{ | ||
pos = vec3( mat4_mv * a0 ); | ||
gl_Position = matrix * a0; | ||
} | ||
)qwertyuiop", | ||
R"qwertyuiop( | ||
precision highp float; | ||
varying highp vec3 pos; | ||
uniform samplerCube texture0; | ||
void main() | ||
{ | ||
gl_FragColor = vec4( textureCube(texture0, pos) ); | ||
} | ||
)qwertyuiop" | ||
), | ||
mat4_modelview(this->get_uniform("mat4_mv")) | ||
{} | ||
|
||
void shader_skybox::render( | ||
const ruis::render::vertex_array& va, | ||
const r4::matrix4<float>& mvp, | ||
const r4::matrix4<float>& modelview, | ||
const ruis::render::texture_cube& tex_env_cube | ||
) const | ||
{ | ||
ASSERT(dynamic_cast<const ruis::render::opengles::texture_cube*>(&tex_env_cube)) | ||
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast) | ||
static_cast<const ruis::render::opengles::texture_cube&>(tex_env_cube).bind(0); | ||
|
||
this->bind(); // bind the program | ||
|
||
this->set_uniform_matrix4f(this->mat4_modelview, modelview); | ||
|
||
this->shader_base::render(mvp, va); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
carcockpit - Car cockpit example GUI project | ||
Copyright (C) 2024 Gagistech Oy <[email protected]> | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
/* ================ LICENSE END ================ */ | ||
|
||
#pragma once | ||
|
||
// #include <ruis/render/texturing_shader.hpp> | ||
#include <ruis/render/opengles/shader_base.hpp> | ||
#include <ruis/render/texture_cube.hpp> | ||
|
||
namespace carcockpit { | ||
|
||
class shader_skybox : public ruis::render::opengles::shader_base | ||
{ | ||
public: | ||
GLint mat4_modelview, mat3_normal, vec4_light_position, vec3_light_intensity; | ||
|
||
shader_skybox(); | ||
void render( | ||
const ruis::render::vertex_array& va, | ||
const r4::matrix4<float>& mvp, | ||
const r4::matrix4<float>& modelview, | ||
const ruis::render::texture_cube& tex_env_cube | ||
) const; | ||
}; | ||
|
||
} // namespace carcockpit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.