فهرست منبع

Bug fixes. Commit before using PBOs on Tiler

Panagiotis Christopoulos Charitos 13 سال پیش
والد
کامیت
06a3094e1a
4فایلهای تغییر یافته به همراه26 افزوده شده و 19 حذف شده
  1. 1 1
      shaders/Dbg.glsl
  2. 8 8
      src/renderer/DebugDrawer.cpp
  3. 7 0
      src/scene/SceneNode.cpp
  4. 10 10
      testapp/Main.cpp

+ 1 - 1
shaders/Dbg.glsl

@@ -8,7 +8,7 @@ out vec3 vColor;
 
 void main()
 {
-	vColor = unpackSnorm4x8(color).rgb;
+	vColor = unpackUnorm4x8(color).rgb;
 	gl_Position = modelViewProjectionMat * vec4(position, 1.0);
 }
 

+ 8 - 8
src/renderer/DebugDrawer.cpp

@@ -33,23 +33,23 @@ DebugDrawer::DebugDrawer()
 
 	vao.attachArrayBufferVbo(
 		&vbo, prog->findAttributeVariable("color"), 1, GL_FLOAT,
-		false, sizeof(Vertex), sizeof(U32));
+		false, sizeof(Vertex), sizeof(Vec3));
 
 	GLint loc =
 		prog->findAttributeVariable("modelViewProjectionMat").getLocation();
 
 	vao.attachArrayBufferVbo(
 		&vbo, loc, 4, GL_FLOAT, false, sizeof(Vertex), 
-		2 * sizeof(Vec4));
+		1 * sizeof(Vec4));
 	vao.attachArrayBufferVbo(
 		&vbo, loc + 1, 4, GL_FLOAT, false, sizeof(Vertex), 
-		3 * sizeof(Vec4));
+		2 * sizeof(Vec4));
 	vao.attachArrayBufferVbo(
 		&vbo, loc + 2, 4, GL_FLOAT, false, sizeof(Vertex), 
-		4 * sizeof(Vec4));
+		3 * sizeof(Vec4));
 	vao.attachArrayBufferVbo(
 		&vbo, loc + 3, 4, GL_FLOAT, false, sizeof(Vertex), 
-		5 * sizeof(Vec4));
+		4 * sizeof(Vec4));
 
 	vertexPointer = 0;
 	mMat.setIdentity();
@@ -112,10 +112,10 @@ void DebugDrawer::flush()
 //==============================================================================
 void DebugDrawer::pushBackVertex(const Vec3& pos)
 {
-	U32 color = (U8)(crntCol.x() * 255.0);
-	color = (color << 8) | (U8)(crntCol.y() * 255.0);
+	U32 color = (U8)(1.0 * 255.0);
 	color = (color << 8) | (U8)(crntCol.z() * 255.0);
-	color = (color << 8) | (U8)(1.0 * 255.0);
+	color = (color << 8) | (U8)(crntCol.y() * 255.0);
+	color = (color << 8) | (U8)(crntCol.x() * 255.0);
 
 	union
 	{

+ 7 - 0
src/scene/SceneNode.cpp

@@ -35,6 +35,13 @@ SceneAllocator<U8> SceneNode::getSceneAllocator() const
 	return scene->getAllocator();
 }
 
+//==============================================================================
+SceneAllocator<U8> SceneNode::getSceneFrameAllocator() const
+{
+	ANKI_ASSERT(scene);
+	return scene->getFrameAllocator();
+}
+
 //==============================================================================
 U32 SceneNode::getLastUpdateFrame()
 {

+ 10 - 10
testapp/Main.cpp

@@ -139,14 +139,14 @@ void init()
 	cam->setAll(
 		MainRendererSingleton::get().getAspectRatio() * toRad(ang),
 		toRad(ang), 0.5, 500.0);
-	cam->setLocalTransform(Transform(Vec3(20.0, 5.0, 8.0),
+	cam->setLocalTransform(Transform(Vec3(20.0, 5.0, 0.0),
 		Mat3(Euler(toRad(-10.0), toRad(90.0), toRad(0.0))),
 		1.0));
 	scene.setActiveCamera(cam);
 
 	// lights
-#if 0
-	Vec3 lpos(-90.0, 1.2, -32.0);
+#if 1
+	Vec3 lpos(-24.0, 0.1, -10.0);
 	for(int i = 0; i < 50; i++)
 	{
 		for(int j = 0; j < 10; j++)
@@ -155,18 +155,18 @@ void init()
 
 			PointLight* point = new PointLight(name.c_str(), &scene,
 				Movable::MF_NONE, nullptr);
-			point->setRadius(2.0);
+			point->setRadius(0.5);
 			point->setDiffuseColor(Vec4(randFloat(6.0) - 2.0, 
 				randFloat(6.0) - 2.0, randFloat(6.0) - 2.0, 0.0));
 			point->setSpecularColor(Vec4(randFloat(6.0) - 3.0, 
 				randFloat(6.0) - 3.0, randFloat(6.0) - 3.0, 0.0));
 			point->setLocalTranslation(lpos);
 
-			lpos.z() += 7.0;
+			lpos.z() += 2.0;
 		}
 
-		lpos.x() += 3.5;
-		lpos.z() = -32;
+		lpos.x() += 0.93;
+		lpos.z() = -10;
 	}
 #endif
 
@@ -195,7 +195,7 @@ void init()
 	spot->setShadowEnabled(true);
 #endif
 
-#if 0
+#if 1
 	// Vase point lights
 	F32 x = 8.5;
 	F32 y = 2.25;
@@ -239,7 +239,7 @@ void init()
 	horse = new ModelNode("data/models/horse/horse.mdl", "horse", &scene,
 		Movable::MF_NONE, nullptr);
 	horse->setLocalTransform(Transform(Vec3(-2, 0, 0), Mat3::getIdentity(),
-		1.0));
+		0.7));
 
 #if 1
 	ModelNode* sponzaModel = new ModelNode(
@@ -453,7 +453,7 @@ void mainLoop()
 
 		// Sleep
 		//
-#if 1
+#if 0
 		timer.stop();
 		if(timer.getElapsedTime() < AppSingleton::get().getTimerTick())
 		{