Browse Source

Temporary hack to allow non-compiled geometry to display in the DirectX 9 sample, this is inefficient but better than nothing

David Wimsey 11 years ago
parent
commit
a914ffeb35
1 changed files with 15 additions and 11 deletions
  1. 15 11
      Samples/basic/directx/src/RenderInterfaceDirectX.cpp

+ 15 - 11
Samples/basic/directx/src/RenderInterfaceDirectX.cpp

@@ -65,18 +65,22 @@ RenderInterfaceDirectX::~RenderInterfaceDirectX()
 }
 }
 
 
 // Called by Rocket when it wants to render geometry that it does not wish to optimise.
 // Called by Rocket when it wants to render geometry that it does not wish to optimise.
-void RenderInterfaceDirectX::RenderGeometry(Rocket::Core::Vertex* ROCKET_UNUSED_PARAMETER(vertices), int ROCKET_UNUSED_PARAMETER(num_vertices), int* ROCKET_UNUSED_PARAMETER(indices), int ROCKET_UNUSED_PARAMETER(num_indices), const Rocket::Core::TextureHandle ROCKET_UNUSED_PARAMETER(texture), const Rocket::Core::Vector2f& ROCKET_UNUSED_PARAMETER(translation))
+void RenderInterfaceDirectX::RenderGeometry(Rocket::Core::Vertex* vertices, int num_vertices, int* indices, int num_indices, const Rocket::Core::TextureHandle texture, const Rocket::Core::Vector2f& translation)
 {
 {
-	ROCKET_UNUSED(vertices);
-	ROCKET_UNUSED(num_vertices);
-	ROCKET_UNUSED(indices);
-	ROCKET_UNUSED(num_indices);
-	ROCKET_UNUSED(texture);
-	ROCKET_UNUSED(translation);
-
-	// We've chosen to not support non-compiled geometry in the DirectX renderer. If you wanted to render non-compiled
-	// geometry, for example for very small sections of geometry, you could use DrawIndexedPrimitiveUP or write to a
-	// dynamic vertex buffer which is flushed when either the texture changes or compiled geometry is drawn.
+	/// @TODO We've chosen to not support non-compiled geometry in the DirectX renderer. If you wanted to render non-compiled
+	/// geometry, for example for very small sections of geometry, you could use DrawIndexedPrimitiveUP or write to a
+	/// dynamic vertex buffer which is flushed when either the texture changes or compiled geometry is drawn.
+
+	if(g_pd3dDevice == NULL)
+	{
+		return;
+	}
+
+	/// @TODO, HACK, just use the compiled geometry framework for now, this is inefficient but better than absolutely nothing
+	/// for the time being
+	Rocket::Core::CompiledGeometryHandle gemo = this->CompileGeometry(vertices, num_vertices, indices, num_indices, texture);
+	this->RenderCompiledGeometry(gemo, translation);
+	this->ReleaseCompiledGeometry(gemo);
 }
 }
 
 
 // Called by Rocket when it wants to compile geometry it believes will be static for the forseeable future.
 // Called by Rocket when it wants to compile geometry it believes will be static for the forseeable future.