Revert "Revert "WIP objects appear as dots""

This reverts commit bde2409b59.
This commit is contained in:
dompia5 2024-02-07 18:32:04 +01:00
parent bde2409b59
commit de646292bd
41 changed files with 198 additions and 33 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -2,7 +2,7 @@
<Project>
<ProjectOutputs>
<ProjectOutput>
<FullPath>D:\DANE\CppProjects\grk_cw1 (1)\grk_cw1\grk\Release\grk-cw6.exe</FullPath>
<FullPath>D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\Release\grk-cw6.exe</FullPath>
</ProjectOutput>
</ProjectOutputs>
<ContentFiles />

View File

@ -1 +1,125 @@
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(439,5): error MSB8020: Не удается найти средства сборки для v143 (набор инструментов платформы = "v143"). Чтобы выполнить сборку с использованием средств сборки v143 установите средства сборки v143. Кроме того, можно выполнить обновление до текущей версии средств Visual Studio, перейдя в меню "Проект" или щелкнув решение правой кнопкой мыши и выбрав "Обновить решение...".
 Render_Utils.cpp
main.cpp
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\minwindef.h(130,1): warning C4005: "APIENTRY": ponowna definicja makra
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\dependencies\glfw-3.3.8.bin.WIN32\include\GLFW\glfw3.h(123,1): message : zobacz poprzednią definicję „APIENTRY”
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(126,15): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(166,30): warning C4244: "=": konwersja z "float" do "int", możliwa utrata danych
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(172,20): warning C4244: "=": konwersja z "int" do "float", możliwa utrata danych
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(321,10): warning C4305: "inicjowanie": obcięcie z "double" do "float"
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(404,57): warning C4305: "argument": obcięcie z "double" do "GLfloat"
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(405,58): warning C4305: "argument": obcięcie z "double" do "GLfloat"
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(426,57): warning C4305: "argument": obcięcie z "double" do "GLfloat"
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(427,58): warning C4305: "argument": obcięcie z "double" do "GLfloat"
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(437,17): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(514,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(553,87): warning C4305: "argument": obcięcie z "double" do "float"
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(641,44): warning C4305: "argument": obcięcie z "double" do "float"
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(642,44): warning C4305: "argument": obcięcie z "double" do "float"
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(643,44): warning C4305: "argument": obcięcie z "double" do "float"
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\tuple(144,47): warning C4244: "inicjowanie": konwersja z "_Ty" do "_Ty", możliwa utrata danych
with
[
_Ty=float
]
and
[
_Ty=int
]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\tuple(236,102): message : zobacz odwołanie do kompilowanego tworzenia wystąpienia „std::_Tuple_val<_This>::_Tuple_val<_Ty>(_Other &&)” funkcji szablon
with
[
_This=int,
_Ty=float,
_Other=float
]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\tuple(236,18): message : zobacz odwołanie do kompilowanego tworzenia wystąpienia „std::tuple<int>::tuple<std::_Exact_args_t,_Ty,,0>(_Tag,_This2 &&)” funkcji szablon
with
[
_Ty=float,
_Tag=std::_Exact_args_t,
_This2=float
]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\tuple(799,12): message : zobacz odwołanie do kompilowanego tworzenia wystąpienia „std::tuple<int,int>::tuple<std::_Exact_args_t,int,float,0>(_Tag,_This2 &&,float &&)” funkcji szablon
with
[
_Tag=std::_Exact_args_t,
_This2=int
]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\tuple(243,16): message : zobacz odwołanie do kompilowanego tworzenia wystąpienia „std::tuple<int,int>::tuple<std::_Unpack_tuple_t,_Ty,0,1,0>(_Tag,_Tpl &&,std::integer_sequence<size_t,0,1>)” funkcji szablon
with
[
_Ty=std::tuple<int,float>,
_Tag=std::_Unpack_tuple_t,
_Tpl=std::tuple<int,float>
]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\tuple(309,16): message : zobacz odwołanie do kompilowanego tworzenia wystąpienia „std::tuple<int,int>::tuple<std::_Unpack_tuple_t,std::tuple<int,float>,0>(_Tag,_Tpl &&)” funkcji szablon
with
[
_Tag=std::_Unpack_tuple_t,
_Tpl=std::tuple<int,float>
]
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(173,50): message : zobacz odwołanie do kompilowanego tworzenia wystąpienia „std::tuple<int,int>::tuple<int,float,0>(std::tuple<int,float> &&) noexcept” funkcji szablon
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(173,33): message : zobacz pierwsze odwołanie do elementu „std::tuple<int,int>::tuple” w „populatePlanet”
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\tuple(144,47): warning C4244: "inicjowanie": konwersja z "const int" do "_Ty", możliwa utrata danych
with
[
_Ty=float
]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\tuple(236,102): message : zobacz odwołanie do kompilowanego tworzenia wystąpienia „std::_Tuple_val<_This>::_Tuple_val<const int&>(_Other)” funkcji szablon
with
[
_This=float,
_Other=const int &
]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\tuple(236,18): message : zobacz odwołanie do kompilowanego tworzenia wystąpienia „std::tuple<float>::tuple<std::_Exact_args_t,const int&,,0>(_Tag,_This2)” funkcji szablon
with
[
_Tag=std::_Exact_args_t,
_This2=const int &
]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\tuple(799,12): message : zobacz odwołanie do kompilowanego tworzenia wystąpienia „std::tuple<int,float>::tuple<std::_Exact_args_t,const int&,const int&,0>(_Tag,_This2,const int &)” funkcji szablon
with
[
_Tag=std::_Exact_args_t,
_This2=const int &
]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\tuple(243,16): message : zobacz odwołanie do kompilowanego tworzenia wystąpienia „std::tuple<int,float>::tuple<std::_Unpack_tuple_t,const _Ty&,0,1,0>(_Tag,_Tpl,std::integer_sequence<size_t,0,1>)” funkcji szablon
with
[
_Ty=std::tuple<int,int>,
_Tag=std::_Unpack_tuple_t,
_Tpl=const std::tuple<int,int> &
]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\tuple(302,16): message : zobacz odwołanie do kompilowanego tworzenia wystąpienia „std::tuple<int,float>::tuple<std::_Unpack_tuple_t,const std::tuple<int,int>&,0>(_Tag,_Tpl)” funkcji szablon
with
[
_Tag=std::_Unpack_tuple_t,
_Tpl=const std::tuple<int,int> &
]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\algorithm(7929,17): message : zobacz odwołanie do kompilowanego tworzenia wystąpienia „std::tuple<int,float>::tuple<int,int,0>(const std::tuple<int,int> &) noexcept” funkcji szablon
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\algorithm(8053,13): message : zobacz odwołanie do kompilowanego tworzenia wystąpienia „_BidIt *std::_Insertion_sort_unchecked<_RanIt,bool(__cdecl *)(std::tuple<int,float>,std::tuple<int,float>)>(const _BidIt,const _BidIt,_Pr)” funkcji szablon
with
[
_BidIt=std::tuple<int,int> *,
_RanIt=std::tuple<int,int> *,
_Pr=bool (__cdecl *)(std::tuple<int,float>,std::tuple<int,float>)
]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\algorithm(8083,5): message : zobacz odwołanie do kompilowanego tworzenia wystąpienia „void std::_Sort_unchecked<std::tuple<int,int>*,bool(__cdecl *)(std::tuple<int,float>,std::tuple<int,float>)>(_RanIt,_RanIt,int,_Pr)” funkcji szablon
with
[
_RanIt=std::tuple<int,int> *,
_Pr=bool (__cdecl *)(std::tuple<int,float>,std::tuple<int,float>)
]
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(181,7): message : zobacz odwołanie do kompilowanego tworzenia wystąpienia „void std::sort<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<_Ty>>>,bool(__cdecl *)(std::tuple<int,float>,std::tuple<int,float>)>(const _RanIt,const _RanIt,_Pr)” funkcji szablon
with
[
_Ty=std::tuple<int,int>,
_RanIt=std::_Vector_iterator<std::_Vector_val<std::_Simple_types<std::tuple<int,int>>>>,
_Pr=bool (__cdecl *)(std::tuple<int,float>,std::tuple<int,float>)
]
Trwa generowanie kodu
9 of 2414 functions ( 0.4%) were compiled, the rest were copied from previous compilation.
4 functions were new in current compilation
23 functions had inline decision re-evaluated but remain unchanged
Zakończono generowanie kodu
grk-cw6.vcxproj -> D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\Release\grk-cw6.exe

View File

@ -1,10 +1,17 @@
D:\DANE\CppProjects\grk_cw1 (1)\grk_cw1\cw 6\src\Box.cpp;D:\DANE\CppProjects\grk_cw1 (1)\grk_cw1\cw 6\Release\Box.obj
D:\DANE\CppProjects\grk_cw1 (1)\grk_cw1\cw 6\src\Camera.cpp;D:\DANE\CppProjects\grk_cw1 (1)\grk_cw1\cw 6\Release\Camera.obj
D:\DANE\CppProjects\grk_cw1 (1)\grk_cw1\cw 6\src\main.cpp;D:\DANE\CppProjects\grk_cw1 (1)\grk_cw1\cw 6\Release\main.obj
D:\DANE\CppProjects\grk_cw1 (1)\grk_cw1\cw 6\src\Render_Utils.cpp;D:\DANE\CppProjects\grk_cw1 (1)\grk_cw1\cw 6\Release\Render_Utils.obj
D:\DANE\CppProjects\grk_cw1 (1)\grk_cw1\cw 6\src\Shader_Loader.cpp;D:\DANE\CppProjects\grk_cw1 (1)\grk_cw1\cw 6\Release\Shader_Loader.obj
D:\DANE\CppProjects\grk_cw1 (1)\grk_cw1\cw 6\src\SOIL\image_DXT.c;D:\DANE\CppProjects\grk_cw1 (1)\grk_cw1\cw 6\Release\image_DXT.obj
D:\DANE\CppProjects\grk_cw1 (1)\grk_cw1\cw 6\src\SOIL\image_helper.c;D:\DANE\CppProjects\grk_cw1 (1)\grk_cw1\cw 6\Release\image_helper.obj
D:\DANE\CppProjects\grk_cw1 (1)\grk_cw1\cw 6\src\SOIL\SOIL.c;D:\DANE\CppProjects\grk_cw1 (1)\grk_cw1\cw 6\Release\SOIL.obj
D:\DANE\CppProjects\grk_cw1 (1)\grk_cw1\cw 6\src\SOIL\stb_image_aug.c;D:\DANE\CppProjects\grk_cw1 (1)\grk_cw1\cw 6\Release\stb_image_aug.obj
D:\DANE\CppProjects\grk_cw1 (1)\grk_cw1\cw 6\src\Texture.cpp;D:\DANE\CppProjects\grk_cw1 (1)\grk_cw1\cw 6\Release\Texture.obj
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\Box.cpp;D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\Release\Box.obj
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\Camera.cpp;D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\Release\Camera.obj
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\imgui.cpp;D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\Release\imgui.obj
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\imgui_demo.cpp;D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\Release\imgui_demo.obj
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\imgui_draw.cpp;D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\Release\imgui_draw.obj
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\imgui_impl_glfw.cpp;D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\Release\imgui_impl_glfw.obj
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\imgui_impl_opengl3.cpp;D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\Release\imgui_impl_opengl3.obj
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\imgui_tables.cpp;D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\Release\imgui_tables.obj
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\imgui_widgets.cpp;D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\Release\imgui_widgets.obj
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\main.cpp;D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\Release\main.obj
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\Render_Utils.cpp;D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\Release\Render_Utils.obj
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\Shader_Loader.cpp;D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\Release\Shader_Loader.obj
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\SOIL\image_DXT.c;D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\Release\image_DXT.obj
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\SOIL\image_helper.c;D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\Release\image_helper.obj
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\SOIL\SOIL.c;D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\Release\SOIL.obj
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\SOIL\stb_image_aug.c;D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\Release\stb_image_aug.obj
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\Texture.cpp;D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\Release\Texture.obj

View File

@ -1,2 +1,2 @@
PlatformToolSet=v143:VCToolArchitecture=Native32Bit:VCToolsVersion=14.36.32532:TargetPlatformVersion=10.0.22621.0:
Release|Win32|D:\DANE\CppProjects\grk_cw1 (1)\grk_cw1\grk\|
Release|Win32|D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\|

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -68,6 +68,8 @@
<None Include="shaders\shader_biomes.vert" />
<None Include="shaders\shader_pbr.frag" />
<None Include="shaders\shader_pbr.vert" />
<None Include="shaders\shader_pbr_instanced.frag" />
<None Include="shaders\shader_pbr_instanced.vert" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{3952C396-B1C6-44CD-96DD-C1AC15D32978}</ProjectGuid>

View File

@ -170,5 +170,11 @@
<None Include="shaders\shader_pbr.vert">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_pbr_instanced.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_pbr_instanced.vert">
<Filter>Shader Files</Filter>
</None>
</ItemGroup>
</Project>

View File

@ -11,6 +11,6 @@ Pos=4,3
Size=218,129
[Window][Dodawanie nowej planety]
Pos=77,31
Pos=0,-22
Size=282,158

View File

@ -3,7 +3,7 @@
layout(location = 0) in vec3 inPosition;
layout(location = 1) in vec3 inNormal;
layout(location = 2) in vec2 inTexCoord;
uniform mat4 modelMatrix[500];
layout(location = 6) in mat4 transformations;
out vec2 texCoords;
@ -12,9 +12,9 @@ out vec3 fragPosition;
uniform sampler2D colorTexture;
void main()
{
mat4 modelMat = modelMatrix[gl_InstanceID];
gl_Position = modelMat * vec4(inPosition, 1.0);
fragPosition = (modelMat* vec4(inPosition,1)).xyz;
mat4 modelMat = transformations;
gl_Position = modelMat* vec4(inPosition, 1.0);
fragPosition = (transformations* vec4(inPosition,1)).xyz;
texCoords = inTexCoord;
fragNormal = (modelMat* vec4(inNormal,0)).xyz;
}

View File

@ -214,26 +214,52 @@ void Core::DrawContext(Core::RenderContext& context)
void Core::DrawContextInstanced(Core::RenderContext& context,std::vector<glm::mat4> matrices,int numberOfInstances, GLuint program)
void Core::DrawContextInstanced(Core::RenderContext& context, std::vector<glm::mat4> transformations,std::vector<glm::mat4> Modelmatrices,int numberOfInstances, GLuint program)
{
GLuint vbo;
glGenBuffers(1, &vbo);
glBindBuffer(GL_ARRAY_BUFFER, vbo);
glBufferData(GL_ARRAY_BUFFER, matrices.size() * sizeof(glm::mat4), matrices.data(), GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);
GLint modelMatrixLocation = glGetAttribLocation(program, "modelMatrix");
glEnableVertexAttribArray(modelMatrixLocation);
glBindBuffer(GL_ARRAY_BUFFER, vbo);
glVertexAttribPointer(modelMatrixLocation, 3, GL_FLOAT, GL_FALSE,sizeof(glm::mat4), (void*)0);
glVertexAttribDivisor(modelMatrixLocation, 1);
glBindVertexArray(context.vertexArray);
glBufferData(GL_ARRAY_BUFFER, transformations.size() * sizeof(glm::mat4), transformations.data(), GL_STATIC_DRAW);
GLuint VAO = context.vertexArray;
glBindVertexArray(VAO);
std::size_t mat4Size = sizeof(glm::mat4);
glEnableVertexAttribArray(6);
glVertexAttribPointer(6, 4, GL_FLOAT, GL_FALSE, mat4Size, (void*)0);
glVertexAttribDivisor(6, 1);
/* std::size_t vec4Size = sizeof(glm::vec4);
glEnableVertexAttribArray(3);
glVertexAttribPointer(3, 4, GL_FLOAT, GL_FALSE, 4 * vec4Size, (void*)0);*
glEnableVertexAttribArray(4);
glVertexAttribPointer(4, 4, GL_FLOAT, GL_FALSE, 4 * vec4Size, (void*)(1 * vec4Size));
glEnableVertexAttribArray(5);
glVertexAttribPointer(5, 4, GL_FLOAT, GL_FALSE, 4 * vec4Size, (void*)(2 * vec4Size));
glEnableVertexAttribArray(6);
glVertexAttribPointer(6, 4, GL_FLOAT, GL_FALSE, 4 * vec4Size, (void*)(3 * vec4Size));
glVertexAttribDivisor(3, 1);
glVertexAttribDivisor(4, 1);
glVertexAttribDivisor(5, 1);
glVertexAttribDivisor(6, 1);*/
//GLint modelMatrixLocation = glGetAttribLocation(program, "modelMatrix");
//glEnableVertexAttribArray(modelMatrixLocation);
//glBindBuffer(GL_ARRAY_BUFFER, vbo);
//glVertexAttribPointer(modelMatrixLocation, 3, GL_FLOAT, GL_FALSE,sizeof(glm::mat4), (void*)0);
//glVertexAttribDivisor(modelMatrixLocation, 1);
//glBindVertexArray(context.vertexArray);
glDrawElementsInstanced(
GL_TRIANGLES, // mode
context.size, // count
GL_UNSIGNED_INT, // type
0, numberOfInstances // element array buffer offset
(void*)0, numberOfInstances // element array buffer offset
);
glBindVertexArray(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
}

View File

@ -70,6 +70,6 @@ namespace Core
void DrawVertexArray(const VertexData & data);
void DrawContext(RenderContext& context);
void DrawContextInstanced(RenderContext& context, std::vector<glm::mat4> matrices ,int count,GLuint program);
void DrawContextInstanced(RenderContext& context, std::vector<glm::mat4> transformations, std::vector<glm::mat4> matrices ,int count,GLuint program);
}

View File

@ -155,7 +155,7 @@ bool sortFunction(std::tuple<int, float> objA, std::tuple<int, float> objB)
PlanetParams populatePlanet(PlanetParams planet, std::vector<Plant::Plant> plants)
{
float probability=0.5f;
int HOW_MANY_PLANTS = 1000;
int HOW_MANY_PLANTS = 100;
int PRECISION = 10000;
float NOTHING_SPAWNS_CUTOFF = 0.0;
int sum = 0;
@ -419,7 +419,6 @@ void drawObjectTexture_plantInstanced(Core::RenderContext& context, std::vector<
}
glUniform3f(glGetUniformLocation(program, "lightPos"), 0, 0, 0);
//Material
glUniform1f(glGetUniformLocation(program, "shininess"), material.Ns);
glUniform3f(glGetUniformLocation(program, "ambientColor"), material.Ka.r, material.Ka.g, material.Ka.b);
@ -430,7 +429,8 @@ void drawObjectTexture_plantInstanced(Core::RenderContext& context, std::vector<
glUniform1i(glGetUniformLocation(program, "illuminationModel"), material.illum);
glUniform1f(glGetUniformLocation(program, "metallic"), 0.05);
glUniform1f(glGetUniformLocation(program, "roughness"), 0.2);
Core::DrawContextInstanced(context, transformations,count,program);
Core::DrawContextInstanced(context, transformations,modelMatrices,count,program);
glUseProgram(0);
}
void placeObjectOnPlanet(Core::RenderContext& objectContext, glm::mat4 objectMatrix,float scale,std::vector<glm::vec3>placePoints, PlanetParams planetParams,int count) {
@ -590,7 +590,7 @@ void renderScene(GLFWwindow* window)
//drawObjectColor(plant2Context, plantModelMatrix, glm::vec3(1,1,1), program);
// drawObjectColor(plant3Context,glm::translate(glm::vec3(1.0f, 0.5f, 3.0f)) *glm::scale(glm::vec3(0.03f)) *glm::rotate(glm::mat4(1.0f), glm::radians(-90.0f), glm::vec3(1.0f, 0.0f, 0.0f)),glm::vec3(1, 1, 1), program);
//drawObjectTexture_plant(plant_1_1_small_Context, plantModelMatrix, plant3Material, program_pbr);
drawObjectTexture_plant(plant_2_1_small_Context, plantModelMatrix, plant2_1Material, program_pbr);
drawObjectTexture_plant(plant_2_1Context, plantModelMatrix, plant2_1Material, program_pbr);
//drawObjectColor(plant2Context, plantModelMatrix, glm::vec3(1, 1, 1), program);