vlod 5 месяцев назад
Родитель
Сommit
824caf2b4b

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

@@ -413,7 +413,6 @@ void pika::gl3d::lightEditorSettingsWindow(int imguiId, ::gl3d::Renderer3D &rend
 	}
 
 
-
 	ImGui::PopID();
 }
 
@@ -458,10 +457,10 @@ void pika::gl3d::fpsInput(::gl3d::Renderer3D &renderer, pika::Input &input, floa
 
 			glm::dvec2 currentMousePos = {input.mouseX, input.mouseY};
 
-			float speed = 0.2f;
+			float speed = 0.2f * (1.f/60.f);
 
 			glm::vec2 delta = lastMousePos - currentMousePos;
-			delta *= speed * input.deltaTime;
+			delta *= speed; //* input.deltaTime;
 
 			renderer.camera.rotateCamera(delta);
 			lastMousePos = currentMousePos;

+ 2 - 2
Pika/gameplay/containers.h

@@ -46,7 +46,7 @@ Container *getContainer(const char* name, pika::memory::MemoryArena *memoryArena
 //#include "containers/physicsTest/logo.h"
 
 //#include "containers/angryBirds/angryBirds.h"
-//#include "containers/milk/milk.h"
+#include "containers/milk/milk.h"
 
 #include "containers/silksong/silkSong.h"
 
@@ -67,6 +67,7 @@ Container *getContainer(const char* name, pika::memory::MemoryArena *memoryArena
 	PIKA_DECLARE_CONTAINER(ThreeDTest) \
 	PIKA_DECLARE_CONTAINER(ThreeDEditor) \
 	PIKA_DECLARE_CONTAINER(Holloknight)\
+	PIKA_DECLARE_CONTAINER(Milk) \
 	PIKA_DECLARE_CONTAINER(PikaTextEditor)
 	//PIKA_DECLARE_CONTAINER(ThreeDGameExample) \
 	//PIKA_DECLARE_CONTAINER(ThreeDGameMenu) \
@@ -82,7 +83,6 @@ Container *getContainer(const char* name, pika::memory::MemoryArena *memoryArena
 	//PIKA_DECLARE_CONTAINER(MarioNeuralTrainer) \
 	//PIKA_DECLARE_CONTAINER(McDungeonsGameplay) \
 	//PIKA_DECLARE_CONTAINER(AngryBirds) \
-	//PIKA_DECLARE_CONTAINER(Milk) \
 	//PIKA_DECLARE_CONTAINER(MarioNeuralVizualizer) 
 	//PIKA_DECLARE_CONTAINER(McDungeonsEditor)
 	//PIKA_DECLARE_CONTAINER(McDungeonsMenu)

+ 51 - 1
Pika/gameplay/containers/milk/milk.h

@@ -36,6 +36,8 @@ struct Milk: public Container
 	gl3d::Model milkModel;
 	gl3d::Entity milkEntity;
 
+	gl3d::Model gunModel;
+	gl3d::Entity gunEntity;
 
 	Simulator simulator;
 
@@ -244,6 +246,10 @@ struct Milk: public Container
 		milkModel = renderer.loadModel(PIKA_RESOURCES_PATH "milk/milk.glb", gl3d::TextureLoadQuality::maxQuality, 1);
 		milkEntity = renderer.createEntity(milkModel, {{66.9,4.9,-9.5}}, false);
 
+		gunModel = renderer.loadModel(PIKA_RESOURCES_PATH "milk/bananagun.glb", gl3d::TextureLoadQuality::maxQuality, 0.08);
+		gunEntity = renderer.createEntity(gunModel, {{0,0,0}}, false);
+		
+
 		//optional make milk bottle shiny
 		//gl3d::MaterialValues mat;
 		//mat.roughness = 0.1;
@@ -370,9 +376,53 @@ struct Milk: public Container
 
 		}
 
+		static float shootCulldown = 0;
+
+		if (shootCulldown <= 0)
+		{
+			if (input.lMouse.pressed())
+			{
+				shootCulldown = 1;
+			}
+
+
+		}
+		else
+		{
+			shootCulldown -= input.deltaTime * 1.5f;
+			shootCulldown = std::max(shootCulldown, 0.f);
+		}
+
+		//banana gun
+		{
+			renderer.camera.position = playerObject.position + glm::vec3(0, 0.7, 0);
+
+			glm::vec3 forward = glm::normalize(renderer.camera.viewDirection);
+
+			// Calculate yaw and pitch from the direction vector
+			float yaw = atan2(forward.x, forward.z);
+			float pitch = -asin(forward.y); // assuming Y is up in your coordinate system
 
-		renderer.camera.position = playerObject.position + glm::vec3(0, 0.7, 0);
 
+			// Use global up vector (adjust if your game uses a different "up")
+			glm::vec3 worldUp = glm::vec3(0, 1, 0);
+
+			// Compute right and corrected up vectors
+			glm::vec3 right = glm::normalize(glm::cross(forward, worldUp));
+			glm::vec3 up = glm::normalize(glm::cross(right, forward));
+
+			// Create the gun transform relative to camera
+			gl3d::Transform gunTransform;
+			gunTransform.position =
+				renderer.camera.position
+				+ forward * 0.5f     // in front
+				- up * 0.3f          // slightly down
+				+ right * 0.02f;      // slightly to the right
+
+			gunTransform.rotation = glm::vec3(pitch + shootCulldown * shootCulldown * glm::radians(360.f), yaw, 0.0f); // roll = 0
+
+			renderer.setEntityTransform(gunEntity, gunTransform);
+		}
 
 		if (input.buttons[pika::Button::Escape].released())
 		{

+ 17 - 6
Pika/gameplay/containers/silksong/silkSong.h

@@ -24,6 +24,8 @@ struct SilkSong: public Container
 
 	b2World world{{0, 10}};
 
+	bool blur = true;
+
 	constexpr static int ASSETS_COUNT = 27;
 
 	std::vector<const char*> assetsNames=
@@ -288,6 +290,9 @@ struct SilkSong: public Container
 		hornetSprite = pika::gl2d::loadTextureWithPixelPadding(PIKA_RESOURCES_PATH "hollowknight/hornet.png", requestedInfo, 249);
 		hornetAtlas = gl2d::TextureAtlasPadding(8, 1, hornetSprite.GetSize().x, hornetSprite.GetSize().y);
 
+		//hornetSprite = pika::gl2d::loadTextureWithPixelPadding(PIKA_RESOURCES_PATH "hollowknight/sprites.png", requestedInfo, 80);
+		//hornetAtlas = gl2d::TextureAtlasPadding(12, 12, hornetSprite.GetSize().x, hornetSprite.GetSize().y);
+
 		world.SetAllowSleeping(true);
 		world.SetContinuousPhysics(true);
 
@@ -338,18 +343,20 @@ struct SilkSong: public Container
 
 		floor.create(world, {-5.1, -5, 4.2, 40}, 0, b2BodyType::b2_staticBody);
 		floor.create(world, {-1.0, 5.5, 3.85, 10}, 0, b2BodyType::b2_staticBody);
-
-
+		
 		floor.create(world, {15.4, 8.3, 2.1, 0.53}, 0, b2BodyType::b2_staticBody);
+		
+		floor.create(world, {12.7, 5.5, 3.4, 0.73}, 0, b2BodyType::b2_staticBody);
 
 		floor.create(world, {17.5, 6.8, 6.2, 0.6}, 0, b2BodyType::b2_staticBody);
-
+		
 		floor.create(world, {25.0, 6.8, 10.2, 0.6}, 0, b2BodyType::b2_staticBody);
-
+		
 		floor.create(world, {32.3, 2.7, 6.2, 20.6}, 0, b2BodyType::b2_staticBody);
 
 
 
+
 		return true;
 	}
 
@@ -439,7 +446,7 @@ struct SilkSong: public Container
 				if (vel.x < 5) force = inputMetrics.speed;
 			}
 
-			float MAX = 4;
+			float MAX = 3;
 			if (vel.x > MAX) { vel.x = MAX; }
 			if (vel.x < -MAX) { vel.x = -MAX; }
 		
@@ -550,7 +557,8 @@ struct SilkSong: public Container
 				index++;
 			}
 		}
-		renderer.flushPostProcess({blurShader});
+
+		if(blur) renderer.flushPostProcess({blurShader});
 
 
 		for (int i = 1; i < 4; i++)
@@ -753,6 +761,9 @@ struct SilkSong: public Container
 			ImGui::InputFloat("Jump timer", &inputMetrics.jumpTimer);
 			ImGui::InputFloat("Initial jump", &inputMetrics.initialJumpImpulse);
 
+			ImGui::Checkbox("Blur", &blur);
+
+
 			ImGui::Separator();
 
 			if (hitsGround)

+ 5 - 3
Pika/gameplay/containers/threedtest.h

@@ -77,12 +77,11 @@ struct ThreeDTest: public Container
 
 
 		gl3d::Transform t;
-		t.position = {400'000, 0, -4};
+		//t.position = {400'000, 0, -4};
 		t.rotation = {1.5, 0 , 0};
 
 		helmetEntity = renderer.createEntity(helmetModel, t);
 	
-		renderer.camera.position.x = 400'000;
 
 
 		return true;
@@ -106,8 +105,11 @@ struct ThreeDTest: public Container
 		renderer.updateWindowMetrics(windowState.windowW, windowState.windowH);
 		renderer.camera.aspectRatio = (float)windowState.windowW / windowState.windowH; //todo do this in update
 		
+		static glm::dvec2 lastMousePos = {};
+		pika::gl3d::fpsInput(renderer, input, 5, lastMousePos, requestedInfo, {windowState.windowW, windowState.windowH});
+
+		if(0)
 		{
-			static glm::dvec2 lastMousePos = {};
 			if (input.rMouse.held())
 			{
 				glm::dvec2 currentMousePos = {input.mouseX, input.mouseY};

BIN
Pika/resources/hollowknight/inputMetrics.bin


BIN
Pika/resources/hollowknight/map21 - Copy.bin


BIN
Pika/resources/hollowknight/map21.bin


BIN
Pika/resources/hollowknight/map22.bin


+ 2 - 15
Pika/resources/logs.txt

@@ -1,15 +1,2 @@
-#2025-06-07 00:25:03[warning]: Couldn't reloaded dll
-#2025-06-07 00:25:04: Reloaded dll
-#2025-06-07 00:25:24[error]: Error reading map file
-#2025-06-07 00:25:24: Created container: SilkSong
-#2025-06-07 00:25:41: Destroyed continer: SilkSong #1
-#2025-06-07 00:25:47[warning]: Couldn't reloaded dll
-#2025-06-07 00:25:49: Reloaded dll
-#2025-06-07 00:26:00[error]: Error reading map file
-#2025-06-07 00:26:00: Created container: SilkSong
-#2025-06-07 00:26:15: Destroyed continer: SilkSong #2
-#2025-06-07 00:26:27[warning]: Couldn't reloaded dll
-#2025-06-07 00:26:29: Reloaded dll
-#2025-06-07 00:28:13[error]: Error reading map file
-#2025-06-07 00:28:13: Created container: SilkSong
-#2025-06-07 00:28:54: Destroyed continer: SilkSong #3
+#2025-06-30 16:14:59: Created container: Milk
+#2025-06-30 16:15:15: Destroyed continer: Milk #1

Разница между файлами не показана из-за своего большого размера
+ 0 - 0
Pika/resources/milk/bananagun.bbmodel


BIN
Pika/resources/milk/bananagun.glb


Некоторые файлы не были показаны из-за большого количества измененных файлов