Открыть боковую панель
6yntar05
BebraCraft
Коммиты
9e990467
Не подтверждена
Коммит
9e990467
создал
Фев 20, 2023
по автору
6yntar05
Просмотр файлов
Some unnecessary effect lol
владелец
bd1b86c2
Изменения
4
Скрыть пробелы
Построчно
Рядом
res/shaders/block.frag
Просмотр файла @
9e990467
...
@@ -30,6 +30,6 @@ void main(void){
...
@@ -30,6 +30,6 @@ void main(void){
else
if
(
TexIndex
<
5
.
1
)
else
if
(
TexIndex
<
5
.
1
)
color
=
texture2D
(
right
,
TexCoord
);
color
=
texture2D
(
right
,
TexCoord
);
else
color
=
vec4
(
1
.
0
,
0
.
0
,
1
.
0
,
1
.
0
);
// Error
else
color
=
vec4
(
1
.
0
,
0
.
0
,
1
.
0
,
1
.
0
);
// Error
//
color
+= glPos
;
color
.
xyz
-=
vec3
((
1
.
0
-
gl_FragCoord
.
z
)
/
3
.
0
)
;
}
}
res/shaders/block.vs
Просмотр файла @
9e990467
...
@@ -19,6 +19,7 @@ out vec4 glPos;
...
@@ -19,6 +19,7 @@ out vec4 glPos;
void
main
(
void
){
void
main
(
void
){
gl_Position
=
projection
*
view
*
model
*
vec4
(
position
,
1
.
0
);
gl_Position
=
projection
*
view
*
model
*
vec4
(
position
,
1
.
0
);
glPos
=
gl_Position
;
glPos
=
gl_Position
;
TexCoord
=
texCoord
;
TexCoord
=
texCoord
;
TexIndex
=
texIndex
;
TexIndex
=
texIndex
;
...
...
src/engine/core.cpp
Просмотр файла @
9e990467
...
@@ -47,7 +47,7 @@ namespace bebra {
...
@@ -47,7 +47,7 @@ namespace bebra {
SDL_SetHint
(
SDL_HINT_RENDER_VSYNC
,
"0"
);
SDL_SetHint
(
SDL_HINT_RENDER_VSYNC
,
"0"
);
SDL_GL_SetSwapInterval
(
0
);
SDL_GL_SetSwapInterval
(
0
);
SDL_Window
*
window
=
SDL_CreateWindow
(
windowName
.
c_str
()
,
SDL_WINDOWPOS_CENTERED
,
SDL_WINDOWPOS_CENTERED
,
SDL_Window
*
window
=
SDL_CreateWindow
(
windowName
.
c_str
()
,
SDL_WINDOWPOS_CENTERED
,
SDL_WINDOWPOS_CENTERED
,
windowWidth
,
windowHeight
,
properties_graphic_api
|
!
SDL_RENDERER_PRESENTVSYNC
|
SDL_RENDERER_ACCELERATED
);
windowWidth
,
windowHeight
,
properties_graphic_api
|
SDL_RENDERER_ACCELERATED
);
if
(
window
==
NULL
){
if
(
window
==
NULL
){
std
::
cout
<<
"ERROR::SDL::CREATE_WINDOW
\n
"
;
std
::
cout
<<
"ERROR::SDL::CREATE_WINDOW
\n
"
;
...
...
src/game/game.cpp
Просмотр файла @
9e990467
...
@@ -89,8 +89,10 @@ int main() {
...
@@ -89,8 +89,10 @@ int main() {
// Clear the buffers
// Clear the buffers
glClear
(
GL_COLOR_BUFFER_BIT
|
GL_DEPTH_BUFFER_BIT
);
glClear
(
GL_COLOR_BUFFER_BIT
|
GL_DEPTH_BUFFER_BIT
);
glClearColor
(
54.0
/
255.0
,
58.0
/
255.0
,
61.0
/
255.0
,
1.0
f
);
//glClearColor(54.0/255.0, 58.0/255.0, 61.0/255.0, 1.0f);
glClearColor
(
15.0
/
255.0
,
15.0
/
255.0
,
15.0
/
255.0
,
1.0
f
);
{
// SkyBox render
{
// SkyBox render
glDepthMask
(
GL_FALSE
);
glDepthMask
(
GL_FALSE
);
skyboxShader
.
Use
();
skyboxShader
.
Use
();
...
@@ -118,15 +120,15 @@ int main() {
...
@@ -118,15 +120,15 @@ int main() {
/// Render chunk
/// Render chunk
// Functor: Render single layer of chunk
// Functor: Render single layer of chunk
static
std
::
function
layerFunctor
=
[
&
](
bebra
::
objects
::
chunk
&
shittedChunk
,
int
iLayer
)
{
static
std
::
function
layerFunctor
=
[
&
blockShader
](
bebra
::
objects
::
chunk
&
shittedChunk
,
int
iLayer
)
{
bebra
::
objects
::
chunkLayer
&
layer
=
shittedChunk
[
iLayer
];
bebra
::
objects
::
chunkLayer
&
layer
=
shittedChunk
[
iLayer
];
// Functor: Render single row of chunk
// Functor: Render single row of chunk
static
std
::
function
rowFunctor
=
[
&
](
bebra
::
objects
::
chunkLayer
&
layer
,
int
iRow
)
{
static
std
::
function
rowFunctor
=
[
&
blockShader
,
&
iLayer
](
bebra
::
objects
::
chunkLayer
&
layer
,
int
iRow
)
{
bebra
::
objects
::
chunkRow
&
row
=
layer
[
iRow
];
bebra
::
objects
::
chunkRow
&
row
=
layer
[
iRow
];
// Functor: Render single block of chunk
// Functor: Render single block of chunk
static
std
::
function
blockFunctor
=
[
&
](
bebra
::
objects
::
chunkRow
&
row
,
int
iBlock
)
{
static
std
::
function
blockFunctor
=
[
&
blockShader
,
&
iLayer
,
&
iRow
](
bebra
::
objects
::
chunkRow
&
row
,
int
iBlock
)
{
bebra
::
objects
::
block
*
block
=
row
[
iBlock
];
bebra
::
objects
::
block
*
block
=
row
[
iBlock
];
if
(
block
->
air
)
return
;
if
(
block
->
air
)
return
;
...
...
Редактирование
Предварительный просмотр
Поддерживает Markdown
0%
Попробовать снова
или
прикрепить новый файл
.
Отмена
You are about to add
0
people
to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Отмена
Пожалуйста,
зарегистрируйтесь
или
войдите
чтобы прокомментировать