Browse Source

Fixing the probe distance. Enabling the player controller

Panagiotis Christopoulos Charitos 9 years ago
parent
commit
a3a442faed

+ 2 - 0
README.md

@@ -5,6 +5,8 @@
 AnKi 3D engine is a Linux and Windows opensource game engine that runs on
 AnKi 3D engine is a Linux and Windows opensource game engine that runs on
 OpenGL 4.4.
 OpenGL 4.4.
 
 
+[![Video](http://img.youtube.com/vi/va7nZ2EFR4c/0.jpg)](http://www.youtube.com/watch?v=va7nZ2EFR4c)
+
 License
 License
 =======
 =======
 
 

+ 1 - 0
include/anki/scene/ReflectionProbe.h

@@ -23,6 +23,7 @@ class ReflectionProbe : public SceneNode
 
 
 public:
 public:
 	const F32 FRUSTUM_NEAR_PLANE = 0.1 / 4.0;
 	const F32 FRUSTUM_NEAR_PLANE = 0.1 / 4.0;
+	const F32 EFFECTIVE_DISTANCE = 256.0;
 
 
 	ReflectionProbe(SceneGraph* scene)
 	ReflectionProbe(SceneGraph* scene)
 		: SceneNode(scene)
 		: SceneNode(scene)

+ 17 - 2
sandbox/Main.cpp

@@ -6,11 +6,11 @@
 #include <cstdio>
 #include <cstdio>
 #include <iostream>
 #include <iostream>
 #include <fstream>
 #include <fstream>
-#include "anki/AnKi.h"
+#include <anki/AnKi.h>
 
 
 using namespace anki;
 using namespace anki;
 
 
-#define PLAYER 0
+#define PLAYER 1
 #define MOUSE 1
 #define MOUSE 1
 
 
 class MyApp : public App
 class MyApp : public App
@@ -70,6 +70,21 @@ Error MyApp::init(int argc, char* argv[])
 	ANKI_CHECK(renderer.getOffscreenRenderer().getPps().loadColorGradingTexture(
 	ANKI_CHECK(renderer.getOffscreenRenderer().getPps().loadColorGradingTexture(
 		"textures/adis/dungeon.ankitex"));
 		"textures/adis/dungeon.ankitex"));
 
 
+#if PLAYER
+	SceneNode& cam = scene.getActiveCamera();
+
+	PlayerNode* pnode;
+	ANKI_CHECK(scene.newSceneNode<PlayerNode>("player",
+		pnode,
+		cam.getComponent<MoveComponent>().getLocalOrigin()
+			- Vec4(0.0, 1.0, 0.0, 0.0)));
+
+	cam.getComponent<MoveComponent>().setLocalTransform(Transform(
+		Vec4(0.0), Mat3x4(Euler(toRad(0.0), toRad(180.0), toRad(0.0))), 1.0));
+
+	pnode->addChild(&cam);
+#endif
+
 	return ErrorCode::NONE;
 	return ErrorCode::NONE;
 }
 }
 
 

+ 1 - 1
sandbox/config.xml

@@ -35,7 +35,7 @@
 	<tm.enabled>1</tm.enabled>
 	<tm.enabled>1</tm.enabled>
 	<width>1920</width>
 	<width>1920</width>
 	<height>1088</height>
 	<height>1088</height>
-	<renderingQuality>1</renderingQuality>
+	<renderingQuality>0.6</renderingQuality>
 	<lodDistance>20</lodDistance>
 	<lodDistance>20</lodDistance>
 	<samples>1</samples>
 	<samples>1</samples>
 	<tessellation>1</tessellation>
 	<tessellation>1</tessellation>

+ 2 - 2
shaders/MsCommonFrag.glsl

@@ -242,8 +242,8 @@ vec2 computeTextureCoordParalax(in sampler2D heightMap,
 
 
 	vec3 E = normalize(eyeTangentSpace);
 	vec3 E = normalize(eyeTangentSpace);
 
 
-	float sampleCountf =
-		mix(MAX_SAMPLES, MIN_SAMPLES, 
+	float sampleCountf = mix(MAX_SAMPLES,
+		MIN_SAMPLES,
 		min(dot(E, normTangentSpace), posView.z / -MAX_EFFECTIVE_DISTANCE));
 		min(dot(E, normTangentSpace), posView.z / -MAX_EFFECTIVE_DISTANCE));
 
 
 	float stepSize = 1.0 / sampleCountf;
 	float stepSize = 1.0 / sampleCountf;

+ 1 - 1
src/scene/ReflectionProbe.cpp

@@ -98,7 +98,7 @@ Error ReflectionProbe::init(const CString& name, F32 radius)
 		m_cubeSides[i].m_localTrf.setOrigin(Vec4(0.0));
 		m_cubeSides[i].m_localTrf.setOrigin(Vec4(0.0));
 		m_cubeSides[i].m_localTrf.setScale(1.0);
 		m_cubeSides[i].m_localTrf.setScale(1.0);
 
 
-		m_cubeSides[i].m_frustum.setAll(ang, ang, zNear, radius);
+		m_cubeSides[i].m_frustum.setAll(ang, ang, zNear, EFFECTIVE_DISTANCE);
 		m_cubeSides[i].m_frustum.resetTransform(m_cubeSides[i].m_localTrf);
 		m_cubeSides[i].m_frustum.resetTransform(m_cubeSides[i].m_localTrf);
 
 
 		FrustumComponent* frc =
 		FrustumComponent* frc =