Browse Source

working at mc dungeons editor

meemknight 2 years ago
parent
commit
f9d0f88ab8

+ 3 - 4
Pika/core/pikaSTD/engineLibraresSupport/engineGL3DSupport.cpp

@@ -486,10 +486,9 @@ void pika::gl3d::General3DEditor::loadFromFile(::gl3d::Renderer3D &renderer, std
 void pika::gl3d::General3DEditor::update(int imguiId, ::gl3d::Renderer3D &renderer,
 void pika::gl3d::General3DEditor::update(int imguiId, ::gl3d::Renderer3D &renderer,
 	pika::Input &input, float moveSpeed, RequestedContainerInfo &info)
 	pika::Input &input, float moveSpeed, RequestedContainerInfo &info)
 {
 {
-
-	if (ImGui::Begin("Settings"))
+	ImGui::PushID(imguiId);
+	if (ImGui::Begin("General3DEditor"))
 	{
 	{
-
 		if (ImGui::CollapsingHeader("Basic settings", ImGuiTreeNodeFlags_Framed | ImGuiTreeNodeFlags_FramePadding))
 		if (ImGui::CollapsingHeader("Basic settings", ImGuiTreeNodeFlags_Framed | ImGuiTreeNodeFlags_FramePadding))
 		{
 		{
 			pika::gl3d::generalSettingsWindow(imguiId, renderer);
 			pika::gl3d::generalSettingsWindow(imguiId, renderer);
@@ -603,7 +602,7 @@ void pika::gl3d::General3DEditor::update(int imguiId, ::gl3d::Renderer3D &render
 
 
 	}
 	}
 	ImGui::End();
 	ImGui::End();
-
+	ImGui::PopID();
 
 
 	pika::gl3d::fpsInput(renderer, input, 4, lastMousePos);
 	pika::gl3d::fpsInput(renderer, input, 4, lastMousePos);
 
 

+ 2 - 1
Pika/core/sharedRuntime/windowSystemm/window.cpp

@@ -59,9 +59,10 @@ void pika::PikaWindow::create()
 	glfwSetKeyCallback(context.wind, keyCallback);
 	glfwSetKeyCallback(context.wind, keyCallback);
 
 
 
 
+#if PIKA_SHOULD_REMOVE_IMGUI == 0
 	//todo macro
 	//todo macro
 	context.imguiAllocator.init(malloc(pika::MB(20)), pika::MB(20));
 	context.imguiAllocator.init(malloc(pika::MB(20)), pika::MB(20));
-
+#endif
 	//HWND hwnd = glfwGetWin32Window(context.wind);
 	//HWND hwnd = glfwGetWin32Window(context.wind);
 
 
 	//LONG exStyle = GetWindowLongPtr(hwnd, GWL_EXSTYLE);
 	//LONG exStyle = GetWindowLongPtr(hwnd, GWL_EXSTYLE);

+ 197 - 0
Pika/gameplay/containers/minecraftDungeons/blocks.cpp

@@ -0,0 +1,197 @@
+#include "blocks.h"
+
+
+
+int atlasData[] = 
+{
+	//front
+	0, 0,
+	3, 15, //grass
+	2, 15, // dirt
+	1, 15, //stone
+	3, 11, //ice
+	4, 14,//log
+	4, 15,//wooden_plank
+	0, 14,//cobblestone
+	7, 14,//gold_block
+	7, 15,//bricks
+	2, 14,//sand
+	0, 3,//sand_stone
+	4, 11,//snow_dirt
+	5, 12,//leaves
+	0, 13, // gold ore
+	2, 13, // coal ore
+	6, 12, //stone brick
+	1, 13, // iron ore
+	2, 12, // diamond ore
+	3, 13, //block shelf
+	5, 8, //birch wood
+	3, 14, //gravel
+	7, 13,//herbs
+	12, 15,//rose
+
+	//back
+	0, 0,
+	3, 15, //grass
+	2, 15, // dirt
+	1, 15, //stone
+	3, 11, //ice
+	4, 14,//log
+	4, 15,//wooden_plank
+	0, 14,//cobblestone
+	7, 14,//gold_block
+	7, 15,//bricks
+	2, 14,//sand
+	0, 3,//sand_stone
+	4, 11,//snow_dirt
+	5, 12,//leaves
+	0, 13, // gold ore
+	2, 13, // coal ore
+	6, 12, //stone brick
+	1, 13, // iron ore
+	2, 12, // diamond ore
+	3, 13, //block shelf
+	5, 8, //birch wood
+	3, 14, //gravel
+	7, 13,//herbs
+	12, 15,//rose
+
+	//top
+	0, 0,
+	0, 15, //grass
+	2, 15, // dirt
+	1, 15, //stone
+	3, 11, //ice
+	4, 14,//log
+	4, 15,//wooden_plank
+	0, 14,//cobblestone
+	7, 14,//gold_block
+	7, 15,//bricks
+	2, 14,//sand
+	0, 4,//sand_stone
+	2, 11,// snow_grass
+	5, 12,//leaves
+	0, 13, // gold ore
+	2, 13, // coal ore
+	6, 12, //stone brick
+	1, 13, // iron ore
+	2, 12, // diamond ore
+	4, 15, //block shelf
+	5, 14, //birch wood
+	3, 14, //gravel
+	7, 13,//herbs
+	12, 15,//rose
+
+	//bottom
+	0, 0,
+	2, 15, //grass
+	2, 15, // dirt
+	1, 15, //stone
+	3, 11, //ice
+	5, 14,//log
+	4, 15,//wooden_plank
+	0, 14,//cobblestone
+	7, 14,//gold_block
+	7, 15,//bricks
+	2, 14,//sand
+	0, 2,//sand_stone
+	2, 15, // snow_grass
+	5, 12,//leaves
+	0, 13, // gold ore
+	2, 13, // coal ore
+	6, 12, //stone brick
+	1, 13, // iron ore
+	2, 12, // diamond ore
+	4, 15, //block shelf
+	5, 14, //birch wood
+	3, 14, //gravel
+	7, 13,//herbs
+	12, 15,//rose
+
+	//left
+	0, 0,
+	3, 15, //grass
+	2, 15, // dirt
+	1, 15, //stone
+	3, 11, //ice
+	4, 14,//log
+	4, 15,//wooden_plank
+	0, 14,//cobblestone
+	7, 14,//gold_block
+	7, 15,//bricks
+	2, 14,//sand
+	0, 3,//sand_stone
+	4, 11,//snow_dirt
+	5, 12,//leaves
+	0, 13, // gold ore
+	2, 13, // coal ore
+	6, 12, //stone brick
+	1, 13, // iron ore
+	2, 12, // diamond ore
+	3, 13, //block shelf
+	5, 8, //birch wood
+	3, 14, //gravel
+	7, 13,//herbs
+	12, 15,//rose
+
+	//right
+	0, 0,
+	3, 15, //grass
+	2, 15, // dirt
+	1, 15, //stone
+	3, 11, //ice
+	4, 14,//log
+	4, 15,//wooden_plank
+	0, 14,//cobblestone
+	7, 14,//gold_block
+	7, 15,//bricks
+	2, 14,//sand
+	0, 3,//sand_stone
+	4, 11,//snow_dirt
+	5, 12,//leaves
+	0, 13, // gold ore
+	2, 13, // coal ore
+	6, 12, //stone brick
+	1, 13, // iron ore
+	2, 12, // diamond ore
+	3, 13, //block shelf
+	5, 8, //birch wood
+	3, 14, //gravel
+	7, 13,//herbs
+	12, 15,//rose
+
+
+
+};
+
+const int padd = BlockTypes::BlocksCount * 2;
+
+glm::vec2 getAtlasTop(int type)
+{
+	return glm::vec2( atlasData[padd * 2 + type * 2] , atlasData[padd * 2 + type * 2 + 1] );
+}
+
+glm::vec2 getAtlasBottom(int type)
+{
+	return glm::vec2(atlasData[padd * 3 + type * 2], atlasData[padd * 3 + type * 2 + 1]);
+}
+
+glm::vec2 getAtlasLeft(int type)
+{
+	return glm::vec2(atlasData[padd * 4 + type * 2], atlasData[padd * 4 + type * 2 + 1]);
+}
+
+glm::vec2 getAtlasRight(int type)
+{
+	return glm::vec2(atlasData[padd * 5 + type * 2], atlasData[padd * 5 + type * 2 + 1]);
+}
+
+glm::vec2 getAtlasFront(int type)
+{
+	return glm::vec2(atlasData[type * 2], atlasData[type * 2 + 1]);
+}
+
+glm::vec2 getAtlasBack(int type)
+{
+	return glm::vec2(atlasData[padd + type * 2], atlasData[padd + type * 2 + 1]);
+}

+ 39 - 0
Pika/gameplay/containers/minecraftDungeons/blocks.h

@@ -0,0 +1,39 @@
+#pragma once
+#include <glm/vec2.hpp>
+
+enum BlockTypes
+{
+	air = 0,
+	grassBlock,
+	dirt,
+	stone,
+	ice,
+	woodLog,
+	wooden_plank,
+	cobblestone,
+	gold_block,
+	bricks,
+	sand,
+	sand_stone,
+	snow_dirt,
+	leaves,
+	gold_ore,
+	coar_ore,
+	stoneBrick,
+	iron_ore,
+	diamond_ore,
+	bookShelf,
+	birch_wood,
+	gravel,
+	grass,
+	rose,
+	BlocksCount
+};
+
+
+glm::vec2 getAtlasTop(int type);
+glm::vec2 getAtlasBottom(int type);
+glm::vec2 getAtlasLeft(int type);
+glm::vec2 getAtlasRight(int type);
+glm::vec2 getAtlasFront(int type);
+glm::vec2 getAtlasBack(int type);

+ 149 - 40
Pika/gameplay/containers/minecraftDungeons/mcDungeonsEditor.h

@@ -9,7 +9,7 @@
 #include <imgui_spinner.h>
 #include <imgui_spinner.h>
 #include <imfilebrowser.h>
 #include <imfilebrowser.h>
 #include <engineLibraresSupport/engineGL3DSupport.h>
 #include <engineLibraresSupport/engineGL3DSupport.h>
-
+#include "blocks.h"
 
 
 
 
 struct McDungeonsEditor: public Container
 struct McDungeonsEditor: public Container
@@ -36,14 +36,24 @@ struct McDungeonsEditor: public Container
 	gl3d::Entity entity;
 	gl3d::Entity entity;
 	bool first = 1;
 	bool first = 1;
 
 
+
 	pika::gl3d::General3DEditor editor;
 	pika::gl3d::General3DEditor editor;
 
 
+	unsigned char worldData[100][10][100] = {};
+
+	unsigned char &getBlockUnsafe(int x, int y, int z)
+	{
+		return worldData[x][y][z];
+	}
+
+		 
 	gl3d::Model createWorld(gl3d::Renderer3D &renderer, gl3d::Material material)
 	gl3d::Model createWorld(gl3d::Renderer3D &renderer, gl3d::Material material)
 	{
 	{
+
 	#pragma region data
 	#pragma region data
 
 
 		float uv = 1;
 		float uv = 1;
-		
+
 		std::vector<float> vertexes;
 		std::vector<float> vertexes;
 		std::vector<unsigned int> indices;
 		std::vector<unsigned int> indices;
 
 
@@ -88,29 +98,29 @@ struct McDungeonsEditor: public Container
 		std::vector<float> rightVer = {
 		std::vector<float> rightVer = {
 			+1.0f, +1.0f, -1.0f, // 8
 			+1.0f, +1.0f, -1.0f, // 8
 				+1.0f, +0.0f, +0.0f, // Normal
 				+1.0f, +0.0f, +0.0f, // Normal
-				1 * uv, 0,				 //uv
+				1, 1,				 //uv
 
 
 				+1.0f, +1.0f, +1.0f, // 9
 				+1.0f, +1.0f, +1.0f, // 9
 				+1.0f, +0.0f, +0.0f, // Normal
 				+1.0f, +0.0f, +0.0f, // Normal
-				1 * uv, 1 * uv,				 //uv
+				0, 1,				 //uv
 
 
 				+1.0f, -1.0f, +1.0f, // 10
 				+1.0f, -1.0f, +1.0f, // 10
 				+1.0f, +0.0f, +0.0f, // Normal
 				+1.0f, +0.0f, +0.0f, // Normal
-				0, 1 * uv,				 //uv
+				0, 0,				 //uv
 
 
 				+1.0f, -1.0f, -1.0f, // 11
 				+1.0f, -1.0f, -1.0f, // 11
 				+1.0f, +0.0f, +0.0f, // Normal
 				+1.0f, +0.0f, +0.0f, // Normal
-				0, 0,				 //uv
+				1, 0,				 //uv
 		};
 		};
 
 
-		std::vector<float> leftVer = { 
+		std::vector<float> leftVer = {
 		-1.0f, +1.0f, +1.0f, // 12
 		-1.0f, +1.0f, +1.0f, // 12
 				-1.0f, +0.0f, +0.0f, // Normal
 				-1.0f, +0.0f, +0.0f, // Normal
 				1 * uv, 1 * uv,				 //uv
 				1 * uv, 1 * uv,				 //uv
 
 
 				-1.0f, +1.0f, -1.0f, // 13
 				-1.0f, +1.0f, -1.0f, // 13
 				-1.0f, +0.0f, +0.0f, // Normal
 				-1.0f, +0.0f, +0.0f, // Normal
-				1 * uv, 0,				 //uv
+				0 * uv, 1,				 //uv
 
 
 				-1.0f, -1.0f, -1.0f, // 14
 				-1.0f, -1.0f, -1.0f, // 14
 				-1.0f, +0.0f, +0.0f, // Normal
 				-1.0f, +0.0f, +0.0f, // Normal
@@ -118,7 +128,7 @@ struct McDungeonsEditor: public Container
 
 
 				-1.0f, -1.0f, +1.0f, // 15
 				-1.0f, -1.0f, +1.0f, // 15
 				-1.0f, +0.0f, +0.0f, // Normal
 				-1.0f, +0.0f, +0.0f, // Normal
-				0, 1 * uv,				 //uv
+				1, 0 * uv,				 //uv
 		};
 		};
 
 
 		std::vector<float> frontVer = {
 		std::vector<float> frontVer = {
@@ -155,19 +165,19 @@ struct McDungeonsEditor: public Container
 		-1.0f, -1.0f, +1.0f, // 0
 		-1.0f, -1.0f, +1.0f, // 0
 		+0.0f, -1.0f, +0.0f, // Normal
 		+0.0f, -1.0f, +0.0f, // Normal
 		0, 0,				 //uv
 		0, 0,				 //uv
-		
+
 		};
 		};
 
 
-		auto addFace = [&](glm::vec3 pos, std::vector<float> &ver)
+		auto addFace = [&](glm::vec3 pos, std::vector<float> &ver, glm::vec2 atlas)
 		{
 		{
-			unsigned int currentIndexPadding = vertexes.size()/8;
+			unsigned int currentIndexPadding = vertexes.size() / 8;
 			for (auto i : ind) { indices.push_back(i + currentIndexPadding); }
 			for (auto i : ind) { indices.push_back(i + currentIndexPadding); }
 
 
 			for (auto v = 0; v < ver.size(); v++)
 			for (auto v = 0; v < ver.size(); v++)
 			{
 			{
 				if (v % 8 == 0)
 				if (v % 8 == 0)
 				{
 				{
-					vertexes.push_back(ver[v]*0.5 + pos.x);
+					vertexes.push_back(ver[v] * 0.5 + pos.x);
 				}
 				}
 				else if (v % 8 == 1)
 				else if (v % 8 == 1)
 				{
 				{
@@ -177,6 +187,14 @@ struct McDungeonsEditor: public Container
 				{
 				{
 					vertexes.push_back(ver[v] * 0.5 + pos.z);
 					vertexes.push_back(ver[v] * 0.5 + pos.z);
 				}
 				}
+				else if (v % 8 == 6)
+				{
+					vertexes.push_back(ver[v] / 16.f + atlas.x / 16.f);
+				}
+				else if (v % 8 == 7)
+				{
+					vertexes.push_back(ver[v] / 16.f + atlas.y / 16.f);
+				}
 				else
 				else
 				{
 				{
 					vertexes.push_back(ver[v]);
 					vertexes.push_back(ver[v]);
@@ -184,54 +202,118 @@ struct McDungeonsEditor: public Container
 			}
 			}
 		};
 		};
 
 
-		auto addTop = [&](glm::vec3 pos)
+		auto addTop = [&](glm::vec3 pos, int blockType)
 		{
 		{
-			return addFace(pos, topVer);
+			return addFace(pos, topVer, getAtlasTop(blockType));
 		};
 		};
 
 
-		auto addBottom = [&](glm::vec3 pos)
+		auto addBottom = [&](glm::vec3 pos, int blockType)
 		{
 		{
-			return addFace(pos, bottomVer);
+			return addFace(pos, bottomVer, getAtlasBottom(blockType));
 		};
 		};
 
 
-		auto addLeft = [&](glm::vec3 pos)
+		auto addLeft = [&](glm::vec3 pos, int blockType)
 		{
 		{
-			return addFace(pos, leftVer);
+			return addFace(pos, leftVer, getAtlasLeft(blockType));
 		};
 		};
 
 
-		auto addRight = [&](glm::vec3 pos)
+		auto addRight = [&](glm::vec3 pos, int blockType)
 		{
 		{
-			return addFace(pos, rightVer);
+			return addFace(pos, rightVer, getAtlasRight(blockType));
 		};
 		};
 
 
-		auto addFront = [&](glm::vec3 pos)
+		auto addFront = [&](glm::vec3 pos, int blockType)
 		{
 		{
-			return addFace(pos, frontVer);
+			return addFace(pos, frontVer, getAtlasFront(blockType));
 		};
 		};
 
 
-		auto addBack = [&](glm::vec3 pos)
+		auto addBack = [&](glm::vec3 pos, int blockType)
 		{
 		{
-			return addFace(pos, backVer);
+			return addFace(pos, backVer, getAtlasBack(blockType));
 		};
 		};
 	#pragma endregion
 	#pragma endregion
 
 
-		addTop({0,0,0});
-		addTop({1,0,0});
-		addTop({2,0,0});
+		auto addCube = [&](glm::vec3 pos, int blockType)
+		{
+			addTop(pos, blockType);
+			addBottom(pos, blockType);
+			addLeft(pos, blockType);
+			addRight(pos, blockType);
+			addFront(pos, blockType);
+			addBack(pos, blockType);
+		};
+
+
+		for (int x = 0; x < 10; x++)
+			for (int z = 0; z < 10; z++)
+			{
+				getBlockUnsafe(x, 0, z) = BlockTypes::grassBlock;
+			}
+
+		for (int x = 2; x < 8; x++)
+			for (int z = 2; z < 8; z++)
+			{
+				getBlockUnsafe(x, 4, z) = BlockTypes::stone;
+			}
+
+		getBlockUnsafe(4, 5, 4) = BlockTypes::gold_block;
+		getBlockUnsafe(5, 5, 4) = BlockTypes::gold_block;
 
 
-		addTop({4,0,3});
-		addBottom({4,0,3});
-		addLeft({4,0,3});
-		addRight({4,0,3});
-		addFront({4,0,3});
-		addBack({4,0,3});
 
 
+		glm::vec3 size = {100,10,100};
 
 
-		return renderer.createModelFromData(material, "cube",
+		auto isSolid = [](unsigned char b) { return b != 0; };
+
+		for (int x = 0; x < size.x; x++)
+			for (int y = 0; y < size.y; y++)
+				for (int z = 0; z < size.z; z++)
+				{
+					auto b = getBlockUnsafe(x, y, z);
+
+					if (b)
+					{
+						if (y == size.y - 1 || !isSolid(getBlockUnsafe(x, y + 1, z)))
+						{
+							addTop({x,y,z}, b);
+						}
+
+						if (y == 0 || !isSolid(getBlockUnsafe(x, y - 1, z)))
+						{
+							addBottom({x,y,z}, b);
+						}
+	
+						if (x == size.x - 1 || !isSolid(getBlockUnsafe(x + 1, y, z)))
+						{
+							addRight({x,y,z}, b);
+						}
+
+						if (x == 0 || !isSolid(getBlockUnsafe(x - 1, y, z)))
+						{
+							addLeft({x,y,z}, b);
+						}
+
+						if (z == size.z - 1 || !isSolid(getBlockUnsafe(x, y, z + 1)))
+						{
+							addFront({x,y,z}, b);
+
+						}
+
+						if (z == 0 || !isSolid(getBlockUnsafe(x, y, z - 1)))
+						{
+							addBack({x,y,z}, b);
+						}
+
+					}
+				}
+
+
+		return renderer.createModelFromData(material, "world",
 			vertexes.size(), vertexes.data(), indices.size(),
 			vertexes.size(), vertexes.data(), indices.size(),
 			indices.data());
 			indices.data());
 	}
 	}
 
 
+	gl3d::Material mat;
+
 	bool create(RequestedContainerInfo &requestedInfo, pika::StaticString<256> commandLineArgument)
 	bool create(RequestedContainerInfo &requestedInfo, pika::StaticString<256> commandLineArgument)
 	{
 	{
 		//todo close function for containers
 		//todo close function for containers
@@ -252,9 +334,17 @@ struct McDungeonsEditor: public Container
 
 
 		//helmetModel = renderer.loadModel(PIKA_RESOURCES_PATH "helmet/helmet.obj");
 		//helmetModel = renderer.loadModel(PIKA_RESOURCES_PATH "helmet/helmet.obj");
 		//model = renderer.loadModel(PIKA_RESOURCES_PATH "rave.glb", 0.5);
 		//model = renderer.loadModel(PIKA_RESOURCES_PATH "rave.glb", 0.5);
-		auto defaultMat = renderer.loadMaterial(PIKA_RESOURCES_PATH "materials/rustedIron.mtl");
-
+		auto defaultMat = renderer.loadMaterial(PIKA_RESOURCES_PATH "materials/mcSprites/mc.mtl", gl3d::TextureLoadQuality::leastPossible); //todo quality settings
 		if (defaultMat.empty()) { return 0; }
 		if (defaultMat.empty()) { return 0; }
+		mat = defaultMat[0];
+
+
+		auto textures = renderer.getMaterialTextures(defaultMat[0]);
+
+
+
+		textures.pbrTexture.RMA_loadedTextures &= 0b110;
+		renderer.setMaterialTextures(defaultMat[0], textures);
 
 
 		model = createWorld(renderer, defaultMat[0]);
 		model = createWorld(renderer, defaultMat[0]);
 
 
@@ -283,19 +373,38 @@ struct McDungeonsEditor: public Container
 		renderer.fileOpener.readEntireFileBinaryCallback = readEntireFileBinaryCustom;
 		renderer.fileOpener.readEntireFileBinaryCallback = readEntireFileBinaryCustom;
 		renderer.fileOpener.readEntireFileCallback = readEntireFileCustom;
 		renderer.fileOpener.readEntireFileCallback = readEntireFileCustom;
 		renderer.fileOpener.fileExistsCallback = defaultFileExistsCustom;
 		renderer.fileOpener.fileExistsCallback = defaultFileExistsCustom;
-	
+
 
 
 		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 		glEnable(GL_DEPTH_TEST);
 		glEnable(GL_DEPTH_TEST);
+		glDisable(GL_LINE_SMOOTH);
+		glDisable(GL_MULTISAMPLE);
 
 
-		
 
 
 		renderer.updateWindowMetrics(windowState.w, windowState.h);
 		renderer.updateWindowMetrics(windowState.w, windowState.h);
 		renderer.camera.aspectRatio = (float)windowState.w / windowState.h; //todo do this in update
 		renderer.camera.aspectRatio = (float)windowState.w / windowState.h; //todo do this in update
 
 
-			
+
 		editor.update(requestedInfo.requestedImguiIds, renderer, input, 4, requestedInfo);
 		editor.update(requestedInfo.requestedImguiIds, renderer, input, 4, requestedInfo);
 
 
+		ImGui::PushID(requestedInfo.requestedImguiIds);
+
+		if (ImGui::Begin("General3DEditor"))
+		{
+			if (ImGui::Button("recreate world"))
+			{
+				renderer.deleteModel(model);
+				model = createWorld(renderer, mat);
+				renderer.setEntityModel(entity, model);
+			}
+
+		}
+
+
+		ImGui::End();
+
+		ImGui::PopID();
+
 
 
 		renderer.render(input.deltaTime);
 		renderer.render(input.deltaTime);
 		glDisable(GL_DEPTH_TEST);
 		glDisable(GL_DEPTH_TEST);

+ 1 - 1
Pika/gameplay/containers/threedtest.h

@@ -63,7 +63,7 @@ struct ThreeDTest: public Container
 		renderer.skyBox = renderer.loadSkyBox(names);
 		renderer.skyBox = renderer.loadSkyBox(names);
 		//renderer.skyBox.color = {0.2,0.3,0.8};
 		//renderer.skyBox.color = {0.2,0.3,0.8};
 
 
-		helmetModel = renderer.loadModel(PIKA_RESOURCES_PATH "helmet/helmet.obj");
+		helmetModel = renderer.loadModel(PIKA_RESOURCES_PATH "helmet/helmet.obj", gl3d::TextureLoadQuality::maxQuality, 1.f);
 		//helmetModel = renderer.loadModel(PIKA_RESOURCES_PATH "/knight/uploads_files_1950170_Solus_the_knight.gltf", 1.f);
 		//helmetModel = renderer.loadModel(PIKA_RESOURCES_PATH "/knight/uploads_files_1950170_Solus_the_knight.gltf", 1.f);
 
 
 		gl3d::Transform t;
 		gl3d::Transform t;

+ 1 - 1
Pika/pluggins/pluggins/threeDEditor.h

@@ -61,7 +61,7 @@ struct ThreeDEditor: public Container
 			false, 10);
 			false, 10);
 
 
 		//helmetModel = renderer.loadModel(PIKA_RESOURCES_PATH "helmet/helmet.obj");
 		//helmetModel = renderer.loadModel(PIKA_RESOURCES_PATH "helmet/helmet.obj");
-		model = renderer.loadModel(PIKA_RESOURCES_PATH "rave.glb", 0.5);
+		model = renderer.loadModel(PIKA_RESOURCES_PATH "rave.glb", 0.5, gl3d::TextureLoadQuality::maxQuality);
 		
 		
 		gl3d::Transform t;
 		gl3d::Transform t;
 		t.position = {0, -1, -4};
 		t.position = {0, -1, -4};

+ 1 - 1
Pika/resources/3d/default.gl3d

@@ -1 +1 @@
-{"SSR":false,"SSRdata":{"maxRayDelta":0.6000000238418579,"maxRayStep":1.75,"maxSteps":20,"minRayStep":0.4000000059604645,"numBinarySearchSteps":7},"adaptiveResolution":true,"chromaticAberation":false,"chromaticAberationData":{"strength":20.0,"unfocusDistance":5.0},"exposure":1.7000000476837158,"frustumCulling":true,"fxaa":true,"fxaaData":{"edgeDarkTreshold":0.125,"edgeMinTreshold":0.02800000086426735,"iterations":12,"qualityMultiplyer":0.800000011920929,"subPixelQuality":0.949999988079071},"light subscatter":true,"normal mapping":true,"ssao":true,"ssaoData":{"bias":0.02500000037252903,"exponent":5.0,"radius":0.20000000298023224,"sampleCount":16}}
+{"SSR":false,"SSRdata":{"maxRayDelta":0.6000000238418579,"maxRayStep":1.75,"maxSteps":20,"minRayStep":0.4000000059604645,"numBinarySearchSteps":7},"adaptiveResolution":false,"chromaticAberation":false,"chromaticAberationData":{"strength":20.0,"unfocusDistance":5.0},"exposure":1.7000000476837158,"frustumCulling":true,"fxaa":false,"fxaaData":{"edgeDarkTreshold":0.125,"edgeMinTreshold":0.02800000086426735,"iterations":12,"qualityMultiplyer":0.800000011920929,"subPixelQuality":0.949999988079071},"light subscatter":true,"normal mapping":true,"ssao":false,"ssaoData":{"bias":0.02500000037252903,"exponent":5.0,"radius":0.20000000298023224,"sampleCount":16}}

+ 10 - 4
Pika/resources/logs.txt

@@ -1,4 +1,10 @@
-#2023-02-14 23:38:08: Created container: Gameplay
-#2023-02-14 23:38:12: Created container: McDungeonsEditor
-#2023-02-14 23:38:28: Destroyed continer: Gameplay #1
-#2023-02-14 23:38:28: Destroyed continer: McDungeonsEditor #2
+#2023-02-18 16:47:10: Created container: Gameplay
+#2023-02-18 16:47:15: Destroyed continer: Gameplay #1
+#2023-02-18 16:47:18: Created container: McDungeonsEditor
+#2023-02-18 16:47:18: Created container: McDungeonsEditor
+#2023-02-18 16:47:19: Created container: McDungeonsEditor
+#2023-02-18 16:47:21: Destroyed continer: McDungeonsEditor #4
+#2023-02-18 16:47:22: Destroyed continer: McDungeonsEditor #3
+#2023-02-18 16:48:20: Reloaded dll
+#2023-02-18 16:50:24: Reloaded dll
+#2023-02-18 16:53:11: Destroyed continer: McDungeonsEditor #2

+ 18 - 0
Pika/resources/materials/copper/copper.mtl

@@ -0,0 +1,18 @@
+# Blender MTL File: 'None'
+# Material Count: 1
+
+newmtl None
+Ns 198.039216
+Ka 0.000000 0.800000 0.000000
+Kd 1.000000 1.000000 1.000000
+Ks 1.000000 1.000000 1.000000
+Ke 0.000000 0.000000 0.000000
+Ni 1.000000
+d 1.000000
+Pm 0.9
+illum 2
+map_Kd deepslate_copper_ore.png 
+map_Kn deepslate_copper_ore_n.png
+map_RMA deepslate_copper_ore_s.png
+
+

BIN
Pika/resources/materials/copper/deepslate_copper_ore.png


BIN
Pika/resources/materials/copper/deepslate_copper_ore_n.png


BIN
Pika/resources/materials/copper/deepslate_copper_ore_s.png


BIN
Pika/resources/materials/mcSprites/albedo.png


BIN
Pika/resources/materials/mcSprites/albedo.psd


+ 17 - 0
Pika/resources/materials/mcSprites/mc.mtl

@@ -0,0 +1,17 @@
+# Blender MTL File: 'None'
+# Material Count: 1
+
+newmtl None
+Ns 198.039216
+Ka 0.000000 0.800000 0.000000
+Kd 1.000000 1.000000 1.000000
+Ks 1.000000 1.000000 1.000000
+Ke 0.000000 0.000000 0.000000
+Ni 1.000000
+d 1.000000
+Pm 0.9
+illum 2
+map_Kd albedo.png 
+map_Kn normal.png
+map_RMA rma.png
+

BIN
Pika/resources/materials/mcSprites/normal.png


BIN
Pika/resources/materials/mcSprites/normal.psd


BIN
Pika/resources/materials/mcSprites/rma.png


BIN
Pika/resources/materials/mcSprites/rma.psd


+ 39 - 37
Pika/thirdparty/gl3d/gl3d.cpp

@@ -1,6 +1,6 @@
 ////////////////////////////////////////////////
 ////////////////////////////////////////////////
 //gl32 --Vlad Luta -- 
 //gl32 --Vlad Luta -- 
-//built on 2023-02-14
+//built on 2023-02-18
 ////////////////////////////////////////////////
 ////////////////////////////////////////////////
 
 
 #include "gl3d.h"
 #include "gl3d.h"
@@ -36343,7 +36343,7 @@ namespace gl3d
 	}
 	}
 
 
 	
 	
-	Material Renderer3D::createMaterial(glm::vec4 kd,
+	Material Renderer3D::createMaterial(int quality, glm::vec4 kd,
 		float roughness, float metallic, float ao, std::string name,
 		float roughness, float metallic, float ao, std::string name,
 		gl3d::Texture albedoTexture, gl3d::Texture normalTexture, gl3d::Texture roughnessTexture, gl3d::Texture metallicTexture,
 		gl3d::Texture albedoTexture, gl3d::Texture normalTexture, gl3d::Texture roughnessTexture, gl3d::Texture metallicTexture,
 		gl3d::Texture occlusionTexture, gl3d::Texture emmisiveTexture)
 		gl3d::Texture occlusionTexture, gl3d::Texture emmisiveTexture)
@@ -36364,7 +36364,7 @@ namespace gl3d
 		textureData.emissiveTexture = emmisiveTexture;
 		textureData.emissiveTexture = emmisiveTexture;
 
 
 
 
-		textureData.pbrTexture = createPBRTexture(roughnessTexture, metallicTexture, occlusionTexture);
+		textureData.pbrTexture = createPBRTexture(roughnessTexture, metallicTexture, occlusionTexture, quality);
 
 
 
 
 		internal.materialIndexes.push_back(id);
 		internal.materialIndexes.push_back(id);
@@ -36393,9 +36393,9 @@ namespace gl3d
 
 
 	//this is the function that loads a material from parsed data
 	//this is the function that loads a material from parsed data
 	gl3d::Material createMaterialFromLoadedData(gl3d::Renderer3D &renderer, 
 	gl3d::Material createMaterialFromLoadedData(gl3d::Renderer3D &renderer, 
-		objl::Material &mat, const std::string &path, GLuint frameBuffer)
+		objl::Material &mat, const std::string &path, GLuint frameBuffer, int quality)
 	{
 	{
-		auto m = renderer.createMaterial(mat.Kd, mat.roughness,
+		auto m = renderer.createMaterial(quality, mat.Kd, mat.roughness,
 			mat.metallic, mat.ao, mat.name);
 			mat.metallic, mat.ao, mat.name);
 
 
 		stbi_set_flip_vertically_on_load(true);
 		stbi_set_flip_vertically_on_load(true);
@@ -36408,56 +36408,56 @@ namespace gl3d
 
 
 			if (!mat.loadedDiffuse.data.empty())
 			if (!mat.loadedDiffuse.data.empty())
 			{
 			{
-				textureData.albedoTexture = renderer.loadTextureFromMemory(mat.loadedDiffuse); 
+				textureData.albedoTexture = renderer.loadTextureFromMemory(mat.loadedDiffuse, quality); 
 
 
 			}
 			}
 			else
 			else
 			if (!mat.map_Kd.empty())
 			if (!mat.map_Kd.empty())
 			{
 			{
-				textureData.albedoTexture = renderer.loadTexture(std::string(path + mat.map_Kd));
+				textureData.albedoTexture = renderer.loadTexture(std::string(path + mat.map_Kd), quality);
 			}
 			}
 
 
 			if (!mat.loadedNormal.data.empty())
 			if (!mat.loadedNormal.data.empty())
 			{
 			{
-				textureData.normalMapTexture = renderer.loadTextureFromMemory(mat.loadedNormal);
+				textureData.normalMapTexture = renderer.loadTextureFromMemory(mat.loadedNormal, quality);
 
 
 			}
 			}
 			else
 			else
 			if (!mat.map_Kn.empty())
 			if (!mat.map_Kn.empty())
 			{
 			{
-				textureData.normalMapTexture = renderer.loadTexture(std::string(path + mat.map_Kn));
+				textureData.normalMapTexture = renderer.loadTexture(std::string(path + mat.map_Kn), quality);
 			}
 			}
 
 
 			if (!mat.loadedEmissive.data.empty())
 			if (!mat.loadedEmissive.data.empty())
 			{
 			{
-				textureData.emissiveTexture = renderer.loadTextureFromMemory(mat.loadedEmissive);
+				textureData.emissiveTexture = renderer.loadTextureFromMemory(mat.loadedEmissive, quality);
 				auto ind = renderer.internal.getMaterialIndex(m);
 				auto ind = renderer.internal.getMaterialIndex(m);
 				renderer.internal.materials[ind].emmisive = 1.f;
 				renderer.internal.materials[ind].emmisive = 1.f;
 			}
 			}
 			else
 			else
 			if (!mat.map_emissive.empty())
 			if (!mat.map_emissive.empty())
 			{
 			{
-				textureData.emissiveTexture = renderer.loadTexture(std::string(path + mat.map_emissive));
+				textureData.emissiveTexture = renderer.loadTexture(std::string(path + mat.map_emissive), quality);
 				auto ind = renderer.internal.getMaterialIndex(m);
 				auto ind = renderer.internal.getMaterialIndex(m);
 				renderer.internal.materials[ind].emmisive = 1.f;
 				renderer.internal.materials[ind].emmisive = 1.f;
 			}
 			}
 
 
 			textureData.pbrTexture.RMA_loadedTextures = 0;
 			textureData.pbrTexture.RMA_loadedTextures = 0;
 
 
-			auto rmaQuality = TextureLoadQuality::linearMipmap;
+			//auto rmaQuality = TextureLoadQuality::linearMipmap;
 
 
 			//todo not working in all gltf formats
 			//todo not working in all gltf formats
 			if (!mat.map_RMA.empty())
 			if (!mat.map_RMA.empty())
 			{
 			{
 			
 			
-				textureData.pbrTexture.texture = renderer.loadTexture(mat.map_RMA.c_str());
+				textureData.pbrTexture.texture = renderer.loadTexture((path + mat.map_RMA).c_str(), quality);
 				if (textureData.pbrTexture.texture.id_ != 0)
 				if (textureData.pbrTexture.texture.id_ != 0)
 				{
 				{
 					textureData.pbrTexture.RMA_loadedTextures = 0b111; //all textures loaded
 					textureData.pbrTexture.RMA_loadedTextures = 0b111; //all textures loaded
 				}
 				}
 
 
-			}//else //todo just add else
-
+			}
+			else
 			if (!mat.loadedORM.data.empty())
 			if (!mat.loadedORM.data.empty())
 			{
 			{
 				auto &t = mat.loadedORM;
 				auto &t = mat.loadedORM;
@@ -36476,7 +36476,7 @@ namespace gl3d
 					}
 					}
 
 
 				GpuTexture tex;
 				GpuTexture tex;
-				tex.loadTextureFromMemory(t.data.data(), t.w, t.h, 3, rmaQuality);
+				tex.loadTextureFromMemory(t.data.data(), t.w, t.h, 3, quality);
 				textureData.pbrTexture.texture = renderer.createIntenralTexture(tex, 0, 0);
 				textureData.pbrTexture.texture = renderer.createIntenralTexture(tex, 0, 0);
 				textureData.pbrTexture.RMA_loadedTextures = 0b111; //all textures loaded
 				textureData.pbrTexture.RMA_loadedTextures = 0b111; //all textures loaded
 
 
@@ -36512,7 +36512,7 @@ namespace gl3d
 								}
 								}
 
 
 							GpuTexture t;
 							GpuTexture t;
-							t.loadTextureFromMemory(data, w, h, 3, rmaQuality);
+							t.loadTextureFromMemory(data, w, h, 3, quality);
 							textureData.pbrTexture.texture = renderer.createIntenralTexture(t, 0, 0);
 							textureData.pbrTexture.texture = renderer.createIntenralTexture(t, 0, 0);
 
 
 							textureData.pbrTexture.RMA_loadedTextures = 0b111; //all textures loaded
 							textureData.pbrTexture.RMA_loadedTextures = 0b111; //all textures loaded
@@ -36526,7 +36526,7 @@ namespace gl3d
 			//RMA trexture
 			//RMA trexture
 			if (textureData.pbrTexture.RMA_loadedTextures == 0)
 			if (textureData.pbrTexture.RMA_loadedTextures == 0)
 			{
 			{
-				constexpr int MERGE_TEXTURES_ON_GPU = 1;
+				constexpr int MERGE_TEXTURES_ON_GPU = 1; //deprecated probably the old version
 
 
 				if constexpr (MERGE_TEXTURES_ON_GPU)
 				if constexpr (MERGE_TEXTURES_ON_GPU)
 				{
 				{
@@ -36564,7 +36564,7 @@ namespace gl3d
 
 
 					auto t = renderer.internal.pBRtextureMaker.createRMAtexture(
 					auto t = renderer.internal.pBRtextureMaker.createRMAtexture(
 						roughness, metallic, ambientOcclusion, renderer.internal.lightShader.quadDrawer.quadVAO,
 						roughness, metallic, ambientOcclusion, renderer.internal.lightShader.quadDrawer.quadVAO,
-						textureData.pbrTexture.RMA_loadedTextures, frameBuffer);
+						textureData.pbrTexture.RMA_loadedTextures, frameBuffer, quality);
 
 
 					if (textureData.pbrTexture.RMA_loadedTextures != 0)
 					if (textureData.pbrTexture.RMA_loadedTextures != 0)
 					{
 					{
@@ -36696,7 +36696,7 @@ namespace gl3d
 						//	rmaQuality);
 						//	rmaQuality);
 
 
 						GpuTexture t;
 						GpuTexture t;
-						t.loadTextureFromMemory(finalData, w, h, 4, rmaQuality);
+						t.loadTextureFromMemory(finalData, w, h, 4, quality);
 						textureData.pbrTexture.texture = renderer.createIntenralTexture(t, 0, 0);
 						textureData.pbrTexture.texture = renderer.createIntenralTexture(t, 0, 0);
 
 
 						stbi_image_free(data1);
 						stbi_image_free(data1);
@@ -36720,7 +36720,7 @@ namespace gl3d
 		return m;
 		return m;
 	}
 	}
 
 
-	std::vector<Material> Renderer3D::loadMaterial(std::string file)
+	std::vector<Material> Renderer3D::loadMaterial(std::string file, int quality)
 	{
 	{
 
 
 		objl::Loader loader;
 		objl::Loader loader;
@@ -36745,7 +36745,7 @@ namespace gl3d
 		for (auto &m : loader.LoadedMaterials)
 		for (auto &m : loader.LoadedMaterials)
 		{
 		{
 
 
-			auto material = createMaterialFromLoadedData(*this, m, path, frameBuffer);
+			auto material = createMaterialFromLoadedData(*this, m, path, frameBuffer, quality);
 			ret.push_back(material);
 			ret.push_back(material);
 
 
 		}
 		}
@@ -36893,7 +36893,7 @@ namespace gl3d
 	//}
 	//}
 
 
 
 
-	Texture Renderer3D::loadTexture(std::string path)
+	Texture Renderer3D::loadTexture(std::string path, int quality)
 	{
 	{
 
 
 		if (path == "")
 		if (path == "")
@@ -36916,13 +36916,13 @@ namespace gl3d
 		GpuTexture t;
 		GpuTexture t;
 		int alphaExists;
 		int alphaExists;
 		int alphaData;
 		int alphaData;
-		errorReporter.callErrorCallback(t.loadTextureFromFileAndCheckAlpha(path.c_str(), alphaExists, alphaData));
+		errorReporter.callErrorCallback(t.loadTextureFromFileAndCheckAlpha(path.c_str(), alphaExists, alphaData, quality));
 
 
 		return createIntenralTexture(t.id, alphaExists, alphaData, path);
 		return createIntenralTexture(t.id, alphaExists, alphaData, path);
 
 
 	}
 	}
 
 
-	Texture Renderer3D::loadTextureFromMemory(objl::LoadedTexture &t)
+	Texture Renderer3D::loadTextureFromMemory(objl::LoadedTexture &t, int quality)
 	{
 	{
 		if (t.data.empty())
 		if (t.data.empty())
 		{
 		{
@@ -36932,7 +36932,7 @@ namespace gl3d
 		GpuTexture tex;
 		GpuTexture tex;
 		int alphaExists = 0; 
 		int alphaExists = 0; 
 		int alphaWithData = 0;
 		int alphaWithData = 0;
-		tex.loadTextureFromMemoryAndCheckAlpha((void *)t.data.data(), t.w, t.h, alphaExists, t.components);
+		tex.loadTextureFromMemoryAndCheckAlpha((void *)t.data.data(), t.w, t.h, alphaExists, t.components, 4, quality);
 
 
 		return createIntenralTexture(tex, alphaExists, alphaWithData);
 		return createIntenralTexture(tex, alphaExists, alphaWithData);
 
 
@@ -37035,7 +37035,7 @@ namespace gl3d
 	}
 	}
 
 
 	PBRTexture Renderer3D::createPBRTexture(Texture& roughness, Texture& metallic,
 	PBRTexture Renderer3D::createPBRTexture(Texture& roughness, Texture& metallic,
-		Texture& ambientOcclusion)
+		Texture& ambientOcclusion, int quality)
 	{
 	{
 
 
 		PBRTexture ret = {};
 		PBRTexture ret = {};
@@ -37044,7 +37044,7 @@ namespace gl3d
 			{getTextureOpenglId(roughness)},
 			{getTextureOpenglId(roughness)},
 			{ getTextureOpenglId(metallic) },
 			{ getTextureOpenglId(metallic) },
 			{ getTextureOpenglId(ambientOcclusion) }, internal.lightShader.quadDrawer.quadVAO, ret.RMA_loadedTextures, 
 			{ getTextureOpenglId(ambientOcclusion) }, internal.lightShader.quadDrawer.quadVAO, ret.RMA_loadedTextures, 
-			frameBuffer);
+			frameBuffer, quality);
 
 
 		ret.texture = this->createIntenralTexture(t, 0, 0);
 		ret.texture = this->createIntenralTexture(t, 0, 0);
 
 
@@ -37105,7 +37105,7 @@ namespace gl3d
 	}
 	}
 
 
 
 
-	Model Renderer3D::loadModel(std::string path, float scale)
+	Model Renderer3D::loadModel(std::string path, int quality, float scale)
 	{
 	{
 
 
 		gl3d::LoadedModelData model(path.c_str(), errorReporter, fileOpener, scale);
 		gl3d::LoadedModelData model(path.c_str(), errorReporter, fileOpener, scale);
@@ -37129,7 +37129,7 @@ namespace gl3d
 			{
 			{
 				auto &mat = model.loader.LoadedMaterials[i];
 				auto &mat = model.loader.LoadedMaterials[i];
 				
 				
-				auto m = createMaterialFromLoadedData(*this, mat, model.path, frameBuffer);
+				auto m = createMaterialFromLoadedData(*this, mat, model.path, frameBuffer, quality);
 
 
 				returnModel.createdMaterials.push_back(m);
 				returnModel.createdMaterials.push_back(m);
 			}
 			}
@@ -37201,7 +37201,7 @@ namespace gl3d
 				}else
 				}else
 				{
 				{
 					//if no material loaded for this object create a new default one
 					//if no material loaded for this object create a new default one
-					gm.material = createMaterial(glm::vec4{ 0.8f,0.8f,0.8f, 1.0f }, 0.5f, 0.f, 1.f, "default material");
+					gm.material = createMaterial(quality, glm::vec4{ 0.8f,0.8f,0.8f, 1.0f }, 0.5f, 0.f, 1.f, "default material");
 				}
 				}
 				
 				
 				gm.ownMaterial = true;
 				gm.ownMaterial = true;
@@ -38217,7 +38217,7 @@ namespace gl3d
 				}else
 				}else
 				if (mat != data)
 				if (mat != data)
 				{
 				{
-					Material newMat = this->createMaterial(mat.kd, mat.roughness,
+					Material newMat = this->createMaterial(TextureLoadQuality::dontSet, mat.kd, mat.roughness,
 						mat.metallic, mat.ao, name);
 						mat.metallic, mat.ao, name);
 					int newMatIndex = internal.getMaterialIndex(newMat); //this should not fail
 					int newMatIndex = internal.getMaterialIndex(newMat); //this should not fail
 
 
@@ -38287,7 +38287,7 @@ namespace gl3d
 				else
 				else
 				if (name != oldName) //copy to new material
 				if (name != oldName) //copy to new material
 				{
 				{
-					Material newMat = this->createMaterial(data.kd, data.roughness,
+					Material newMat = this->createMaterial(TextureLoadQuality::dontSet, data.kd, data.roughness,
 						data.metallic, data.ao, name);
 						data.metallic, data.ao, name);
 					int newMatIndex = internal.getMaterialIndex(newMat); //this should not fail
 					int newMatIndex = internal.getMaterialIndex(newMat); //this should not fail
 					internal.materialTexturesData[newMatIndex] = textures;
 					internal.materialTexturesData[newMatIndex] = textures;
@@ -38382,7 +38382,7 @@ namespace gl3d
 				else
 				else
 				if (texture != oldTextures) //copy to new material
 				if (texture != oldTextures) //copy to new material
 				{
 				{
-					Material newMat = this->createMaterial(data.kd, data.roughness,
+					Material newMat = this->createMaterial(TextureLoadQuality::dontSet, data.kd, data.roughness,
 						data.metallic, data.ao, oldName);
 						data.metallic, data.ao, oldName);
 					int newMatIndex = internal.getMaterialIndex(newMat); //this should not fail
 					int newMatIndex = internal.getMaterialIndex(newMat); //this should not fail
 					internal.materialTexturesData[newMatIndex] = texture; //new textures
 					internal.materialTexturesData[newMatIndex] = texture; //new textures
@@ -42292,7 +42292,7 @@ namespace gl3d
 
 
 	//todo use the max w h to create it
 	//todo use the max w h to create it
 	GLuint Renderer3D::InternalStruct::PBRtextureMaker::createRMAtexture(GpuTexture roughness, 
 	GLuint Renderer3D::InternalStruct::PBRtextureMaker::createRMAtexture(GpuTexture roughness, 
-		GpuTexture metallic, GpuTexture ambientOcclusion, GLuint quadVAO, int &RMA_loadedTextures, GLuint frameBuffer)
+		GpuTexture metallic, GpuTexture ambientOcclusion, GLuint quadVAO, int &RMA_loadedTextures, GLuint frameBuffer, int quality)
 	{
 	{
 		bool roughnessLoaded = (roughness.id != 0);
 		bool roughnessLoaded = (roughness.id != 0);
 		bool metallicLoaded = (metallic.id != 0);
 		bool metallicLoaded = (metallic.id != 0);
@@ -42338,10 +42338,12 @@ namespace gl3d
 		GLuint texture = 0;
 		GLuint texture = 0;
 		glGenTextures(1, &texture);
 		glGenTextures(1, &texture);
 		glBindTexture(GL_TEXTURE_2D, texture);
 		glBindTexture(GL_TEXTURE_2D, texture);
+		
+		GpuTexture{texture}.setTextureQuality(quality);
 		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
 		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
 		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
 		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
-		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
-		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+		//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
+		//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
 		glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
 		glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
 		glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
 		glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
 		
 		

+ 13 - 13
Pika/thirdparty/gl3d/gl3d.h

@@ -1,6 +1,6 @@
 ////////////////////////////////////////////////
 ////////////////////////////////////////////////
 //gl32 --Vlad Luta -- 
 //gl32 --Vlad Luta -- 
-//built on 2023-02-14
+//built on 2023-02-18
 ////////////////////////////////////////////////
 ////////////////////////////////////////////////
 
 
 
 
@@ -33496,14 +33496,14 @@ namespace objl
 					tempMaterial.map_Pm = algorithm::tail(curline);
 					tempMaterial.map_Pm = algorithm::tail(curline);
 				}
 				}
 				else
 				else
-				if (firstToken == "map_ORM")
+				if (firstToken == "map_ORM" || firstToken == "map_orm" || firstToken == "map_Orm")
 				{
 				{
 					tempMaterial.map_ORM = algorithm::tail(curline);
 					tempMaterial.map_ORM = algorithm::tail(curline);
 				}
 				}
 				else
 				else
-				if (firstToken == "map_RMA")
+				if (firstToken == "map_RMA" || firstToken == "map_rma" || firstToken == "map_Rma")
 				{
 				{
-					tempMaterial.map_ORM = algorithm::tail(curline);
+					tempMaterial.map_RMA = algorithm::tail(curline);
 				}
 				}
 				else
 				else
 				if (firstToken == "map_emissive" || firstToken == "map_Ke" || firstToken == "map_Emissive")
 				if (firstToken == "map_emissive" || firstToken == "map_Ke" || firstToken == "map_Emissive")
@@ -33851,14 +33851,14 @@ namespace gl3d
 		//GpuTexture(const char *file) { loadTextureFromFile(file); };
 		//GpuTexture(const char *file) { loadTextureFromFile(file); };
 
 
 		//returns error
 		//returns error
-		std::string loadTextureFromFile(const char *file, FileOpener &fileOpener, int quality = maxQuality, int channels = 4);
+		std::string loadTextureFromFile(const char *file, FileOpener &fileOpener, int quality, int channels = 4);
 		void loadTextureFromMemory(void* data, int w, int h, int chanels = 4, int quality = maxQuality);
 		void loadTextureFromMemory(void* data, int w, int h, int chanels = 4, int quality = maxQuality);
 		void loadTextureFromMemoryAndCheckAlpha
 		void loadTextureFromMemoryAndCheckAlpha
 			(void *data, int w, int h, int &alpha, int &alphaWithData, int chanels = 4, int quality = maxQuality);
 			(void *data, int w, int h, int &alpha, int &alphaWithData, int chanels = 4, int quality = maxQuality);
 
 
 		//returns error
 		//returns error
 		std::string loadTextureFromFileAndCheckAlpha(const char* file, int& alpha, int& alphaData,
 		std::string loadTextureFromFileAndCheckAlpha(const char* file, int& alpha, int& alphaData,
-			int quality = maxQuality, int channels = 4);
+			int quality, int channels = 4);
 
 
 		void clear();
 		void clear();
 
 
@@ -34581,14 +34581,14 @@ namespace gl3d
 
 
 	#pragma region material
 	#pragma region material
 		
 		
-		Material createMaterial(glm::vec4 kd = glm::vec4(1), 
+		Material createMaterial(int quality, glm::vec4 kd = glm::vec4(1),
 			float roughness = 0.5f, float metallic = 0.1, float ao = 1.f, std::string name = "",
 			float roughness = 0.5f, float metallic = 0.1, float ao = 1.f, std::string name = "",
 			gl3d::Texture albedoTexture = {}, gl3d::Texture normalTexture = {}, gl3d::Texture roughnessTexture = {}, gl3d::Texture metallicTexture = {},
 			gl3d::Texture albedoTexture = {}, gl3d::Texture normalTexture = {}, gl3d::Texture roughnessTexture = {}, gl3d::Texture metallicTexture = {},
 			gl3d::Texture occlusionTexture = {}, gl3d::Texture emmisiveTexture = {});
 			gl3d::Texture occlusionTexture = {}, gl3d::Texture emmisiveTexture = {});
 
 
 		Material createMaterial(Material m);
 		Material createMaterial(Material m);
 
 
-		std::vector<Material> loadMaterial(std::string file);
+		std::vector<Material> loadMaterial(std::string file, int quality);
 
 
 		bool deleteMaterial(Material m);  
 		bool deleteMaterial(Material m);  
 		bool copyMaterialData(Material dest, Material source);
 		bool copyMaterialData(Material dest, Material source);
@@ -34611,8 +34611,8 @@ namespace gl3d
 
 
 	#pragma region Texture
 	#pragma region Texture
 
 
-		Texture loadTexture(std::string path);
-		Texture loadTextureFromMemory(objl::LoadedTexture &t);
+		Texture loadTexture(std::string path, int quality);
+		Texture loadTextureFromMemory(objl::LoadedTexture &t, int quality);
 		GLuint getTextureOpenglId(Texture& t);
 		GLuint getTextureOpenglId(Texture& t);
 		bool isTexture(Texture& t);
 		bool isTexture(Texture& t);
 
 
@@ -34625,7 +34625,7 @@ namespace gl3d
 		Texture createIntenralTexture(GLuint id_, int alphaData, int alphaValues, const std::string &name = "");
 		Texture createIntenralTexture(GLuint id_, int alphaData, int alphaValues, const std::string &name = "");
 
 
 		PBRTexture createPBRTexture(Texture& roughness, Texture& metallic,
 		PBRTexture createPBRTexture(Texture& roughness, Texture& metallic,
-			Texture& ambientOcclusion);
+			Texture& ambientOcclusion, int quality);
 		void deletePBRTexture(PBRTexture &t);
 		void deletePBRTexture(PBRTexture &t);
 
 
 	#pragma endregion
 	#pragma endregion
@@ -34652,7 +34652,7 @@ namespace gl3d
 			size_t vertexCount, const float *vertices, size_t indexesCount = 0,
 			size_t vertexCount, const float *vertices, size_t indexesCount = 0,
 			const unsigned int *indexes = nullptr, bool noTexture = false);
 			const unsigned int *indexes = nullptr, bool noTexture = false);
 
 
-		Model loadModel(std::string path, float scale = 1);
+		Model loadModel(std::string path, int quality, float scale);
 		bool isModel(Model& m);
 		bool isModel(Model& m);
 		void deleteModel(Model &m);
 		void deleteModel(Model &m);
 
 
@@ -34917,7 +34917,7 @@ namespace gl3d
 
 
 				GLuint createRMAtexture(
 				GLuint createRMAtexture(
 					GpuTexture roughness, GpuTexture metallic, GpuTexture ambientOcclusion, 
 					GpuTexture roughness, GpuTexture metallic, GpuTexture ambientOcclusion, 
-					GLuint quadVAO, int &RMA_loadedTextures, GLuint frameBuffer);
+					GLuint quadVAO, int &RMA_loadedTextures, GLuint frameBuffer, int quality);
 				
 				
 				void clear();
 				void clear();