Browse Source

Updated docs to match the new resource creation methods

BearishSun 9 years ago
parent
commit
7c72303823

+ 8 - 1
Documentation/Manuals/Native/gpuPrograms.md

@@ -24,7 +24,14 @@ For example if we wanted to create a HLSL fragment program (HLSL source not show
 ~~~~~~~~~~~~~{.cpp}
 String hlslSource = "...";
 
-SPtr<GpuProgram> myProgram = GpuProgram::create(hlslSource, "main", "hlsl", GPT_FRAGMENT_PROGRAM, GPP_FS_5_0);
+GPU_PROGRAM_DESC desc;
+desc.type = GPT_FRAGMENT_PROGRAM;
+desc.source = hlslSource;
+desc.entryPoint = "main";
+desc.language = "hlsl";
+desc.profile = GPP_FS_5_0;
+
+SPtr<GpuProgram> myProgram = GpuProgram::create(desc);
 ~~~~~~~~~~~~~ 
  
 Once the GPU program has been created it is not guaranteed to be usable. The compilation of the provided source code could have failed, which you can check by calling @ref BansheeEngine::GpuProgram::isCompiled() "GpuProgram::isCompiled", and retrieve the error message by calling @ref BansheeEngine::GpuProgram::getCompileErrorMessage() "GpuProgram::getCompileErrorMessage". Be aware that both of these methods are only valid after the core thread has initialized the object. You can ensure this by calling @ref BansheeEngine::CoreObject::blockUntilCoreInitialized "GpuProgram::blockUntilCoreInitialized" but be aware this will block the calling thread which can result in a significant performance impact.

+ 8 - 3
Documentation/Manuals/Native/meshes.md

@@ -7,7 +7,7 @@ Mesh is an object represented by a set of points, their properties and a set of
 We're going to focus on the simulation thread implementation in this manual, and then note the differences in the core thread version at the end.
 
 # Creating a mesh {#meshes_a}
-To create a mesh call @ref BansheeEngine::Mesh::create "Mesh::create" or one if its overloads. At minimum you need to provide a @ref BansheeEngine::VertexDataDesc "vertex description" that describes in what format are the vertices stored in the vertex buffer and the number of vertices and indices. 
+To create a mesh call @ref BansheeEngine::Mesh::create "Mesh::create" or one if its overloads. You'll need to populate the @ref BansheeEngine::MESH_DESC "MESH_DESC" structure and pass it as a parameter. At minimum you need to provide a @ref BansheeEngine::VertexDataDesc "vertex description" that describes in what format are the vertices stored in the vertex buffer and the number of vertices and indices. 
 
 Optionally you can also provide the type of indices, type of primitives, and a set of sub-meshes:
  - Indices can be 32- or 16-bit. This is controlled by the `indexType` parameter. Smaller indices can be used to save bandwidth if your mesh has a small enough number of primitives.
@@ -16,10 +16,15 @@ Optionally you can also provide the type of indices, type of primitives, and a s
  
 For example to create a simple mesh:
 ~~~~~~~~~~~~~{.cpp}
+// Creates an empty mesh with 36 indices and 8 vertices
+MESH_DESC meshDesc;
+meshDesc.numVertices = 8;
+meshDesc.numIndices = 36;
+
 SPtr<VertexDataDesc> vertexDesc = ...; // Vertex description creation is explained later
+meshDesc.vertexDesc = vertexDesc;
 
-// Creates an empty mesh with 36 indices and 8 vertices
-HMesh mesh = Mesh::create(8, 32, vertexDesc);
+HMesh mesh = Mesh::create(meshDesc);
 ~~~~~~~~~~~~~ 
  
 You can also create a non-empty mesh by creating it with a populated @ref BansheeEngine::MeshData "MeshData" object. More about @ref BansheeEngine::MeshData "MeshData" later. 

+ 24 - 4
Documentation/Manuals/Native/renderTargets.md

@@ -69,10 +69,24 @@ To create a render texture call @ref BansheeEngine::RenderTexture::create(const
 For example:
 ~~~~~~~~~~~~~{.cpp}
 // Create a 1280x720 texture with 32-bit RGBA format
-HTexture color = Texture::create(TEX_TYPE_2D, 1280, 720, 1, 0, PF_R8G8B8A8);
+TEXTURE_DESC colorDesc;
+colorDesc.type = TEX_TYPE_2D;
+colorDesc.width = 1280;
+colorDesc.heigth = 720;
+colorDesc.format = PF_R8G8B8A8;
+colorDesc.usage = TU_RENDERTARGET;
+
+HTexture color = Texture::create(colorDesc);
 
 // Create a 1280x720 texture with a 32-bit depth-stencil format
-HTexture depthStencil = Texture::create(TEX_TYPE_2D, 1280, 720, 1, 0, PF_D24S8);
+TEXTURE_DESC depthDesc;
+depthDesc.type = TEX_TYPE_2D;
+depthDesc.width = 1280;
+depthDesc.heigth = 720;
+depthDesc.format = PF_R8G8B8A8;
+depthDesc.usage = TU_DEPTHSTENCIL;
+
+HTexture depthStencil = Texture::create(depthDesc);
 
 RENDER_TEXTURE_DESC desc;
 desc.colorSurfaces[0].texture = color;
@@ -86,10 +100,16 @@ desc.depthStencilSurface.mipLevel = 0;
 SPtr<RenderTexture> renderTexture = RenderTexture::create(desc);
 ~~~~~~~~~~~~~
 
-Optionally you can also use the overloaded @ref BansheeEngine::RenderTexture::create(TextureType, UINT32, UINT32, PixelFormat, bool, UINT32, bool, PixelFormat) "RenderTexture::create" to create the texture surfaces and the render texture in one go:
+Optionally you can also use the overloaded @ref BansheeEngine::RenderTexture::create(const TEXTURE_DESC&, bool, PixelFormat) "RenderTexture::create" to create the texture surfaces and the render texture in one go:
 ~~~~~~~~~~~~~{.cpp}
 // Has the same result as above:
-SPtr<RenderTexture> renderTexture = RenderTexture::create(TEX_TYPE_2D, 1280, 720, PF_R8G8B8A8, false, 0, true, PF_D24S8);
+TEXTURE_DESC colorDesc;
+colorDesc.type = TEX_TYPE_2D;
+colorDesc.width = 1280;
+colorDesc.heigth = 720;
+colorDesc.format = PF_R8G8B8A8;
+
+SPtr<RenderTexture> renderTexture = RenderTexture::create(colorDesc, true, PF_D24S8);
 ~~~~~~~~~~~~~
 
 ## Multiple surfaces {#renderTargets_b_a}

+ 7 - 1
Documentation/Manuals/Native/resources.md

@@ -66,7 +66,13 @@ If a resource already exists on the disk (i.e. it was created by @ref BansheeEng
 
 An example:
 ~~~~~~~~~~~~~{.cpp}
-HTexture texture = Texture::create(TEX_TYPE_2D, 1280, 720, 0, PF_R8G8B8A8);
+TEXTURE_DESC desc;
+desc.type = TEX_TYPE_2D;
+desc.width = 1280;
+desc.heigth = 720;
+desc.format = PF_R8G8B8A8;
+
+HTexture texture = Texture::create(desc);
 ... fill texture with some data ...
 
 gResources().save(texture, "myTexture.asset");

+ 8 - 2
Documentation/Manuals/Native/textures.md

@@ -7,7 +7,7 @@ Textures in Banshee are represented with the @ref BansheeEngine::Texture "Textur
 We're going to focus on the simulation thread implementation in this manual, and then note the differences in the core thread version at the end.
 
 # Creating a texture {#textures_a}
-To create a texture call @ref BansheeEngine::Texture::create "Texture::create" or one if its overloads. At minimum you need to provide a @ref BansheeEngine::TextureType "texture type", dimensions and @ref BansheeEngine::PixelFormat "pixel format". The dimensions range from one to three dimensional depending on the texture type.
+To create a texture call @ref BansheeEngine::Texture::create "Texture::create" or one if its overloads. You'll need to populate the @ref BansheeEngine::TEXTURE_DESC "TEXTURE_DESC" structure and pass it as a parameter. At minimum you need to provide a @ref BansheeEngine::TextureType "texture type", dimensions and @ref BansheeEngine::PixelFormat "pixel format". The dimensions range from one to three dimensional depending on the texture type.
 
 Optionally you can also provide the number of mipmaps, number of samples, usage flags and a gamma correction flag:
  - A texture with mip-maps will contain a set of scaled down versions of itself that are used by the GPU for special filtering. 
@@ -18,7 +18,13 @@ Optionally you can also provide the number of mipmaps, number of samples, usage
 For example:
 ~~~~~~~~~~~~~{.cpp}
 // Creates a 2D texture, 128x128 with an 8-bit RGBA format
-HTexture texture = Texture::create(TEX_TYPE_2D, 128, 128, 0, PF_R8G8B8A8);
+TEXTURE_DESC desc;
+desc.type = TEX_TYPE_2D;
+desc.width = 128;
+desc.heigth = 128;
+desc.format = PF_R8G8B8A8;
+
+HTexture texture = Texture::create(desc);
 ~~~~~~~~~~~~~ 
 
 You can also create a non-empty texture by creating it with a populated @ref BansheeEngine::PixelData "PixelData" object. More about @ref BansheeEngine::PixelData "PixelData" later.

+ 15 - 5
Source/BansheeCore/Include/BsHardwareBufferManager.h

@@ -62,10 +62,18 @@ namespace BansheeEngine
 		 */
 		SPtr<GpuBuffer> createGpuBuffer(const GPU_BUFFER_DESC& desc);
 
-		/** Creates a new vertex declaration from a list of vertex elements. */
+		/** 
+		 * Creates a new vertex declaration from a list of vertex elements. 
+		 * 
+		 * @param[in]	desc	Description of the object to create.
+		 */
 		SPtr<VertexDeclaration> createVertexDeclaration(const SPtr<VertexDataDesc>& desc);
 
-		/** Creates a new GpuParams object from the provided set of GPU parameter descriptors. */
+		/** 
+		 * Creates a new GpuParams object from the provided set of GPU parameter descriptors.
+		 *  
+		 * @param[in]	desc	Description of the object to create.
+		 */
 		SPtr<GpuParams> createGpuParams(const GPU_PARAMS_DESC& desc);
 	};
 
@@ -98,8 +106,10 @@ namespace BansheeEngine
 		SPtr<VertexDeclarationCore> createVertexDeclaration(const SPtr<VertexDataDesc>& desc,
 			GpuDeviceFlags deviceMask = GDF_DEFAULT);
 
-		/** 
-		 * @copydoc HardwareBufferManager::createVertexDeclaration 
+		/**
+		 * Creates a new vertex declaration from a list of vertex elements.
+		 *
+		 * @param[in]	elements		List of elements to initialize the declaration with.
 		 * @param[in]	deviceMask		Mask that determines on which GPU devices should the object be created on.
 		 */
 		SPtr<VertexDeclarationCore> createVertexDeclaration(const List<VertexElement>& elements, 
@@ -150,7 +160,7 @@ namespace BansheeEngine
 		virtual SPtr<GpuBufferCore> createGpuBufferInternal(const GPU_BUFFER_DESC& desc, 
 			GpuDeviceFlags deviceMask = GDF_DEFAULT) = 0;
 
-		/** @copydoc createVertexDeclaration */
+		/** @copydoc createVertexDeclaration(const List<VertexElement>&, GpuDeviceFlags) */
 		virtual SPtr<VertexDeclarationCore> createVertexDeclarationInternal(const List<VertexElement>& elements,
 			GpuDeviceFlags deviceMask = GDF_DEFAULT);
 

+ 2 - 2
Source/BansheeCore/Include/BsRenderTexture.h

@@ -48,7 +48,7 @@ namespace BansheeEngine
 		virtual ~RenderTexture() { }
 
 		/** @copydoc TextureManager::createRenderTexture(const TEXTURE_DESC&, bool, PixelFormat) */
-		static SPtr<RenderTexture> create(const TEXTURE_DESC& desc, 
+		static SPtr<RenderTexture> create(const TEXTURE_DESC& colorDesc, 
 			bool createDepth = true, PixelFormat depthStencilFormat = PF_D24S8);
 
 		/** @copydoc TextureManager::createRenderTexture(const RENDER_TEXTURE_DESC&) */
@@ -127,7 +127,7 @@ namespace BansheeEngine
 		/** @copydoc CoreObjectCore::initialize */
 		void initialize() override;
 
-		/** @copydoc TextureCoreManager::createRenderTexture(const RENDER_TEXTURE_DESC_CORE&) */
+		/** @copydoc TextureCoreManager::createRenderTexture(const RENDER_TEXTURE_DESC_CORE&, GpuDeviceFlags) */
 		static SPtr<RenderTextureCore> create(const RENDER_TEXTURE_DESC_CORE& desc, GpuDeviceFlags deviceMask = GDF_DEFAULT);
 
 		/**

+ 5 - 1
Source/BansheeCore/Include/BsTextureManager.h

@@ -55,7 +55,11 @@ namespace BansheeEngine
 		virtual SPtr<RenderTexture> createRenderTexture(const TEXTURE_DESC& colorDesc,
 			bool createDepth = true, PixelFormat depthStencilFormat = PF_D24S8);
 
-		/** Creates a RenderTexture using the description struct. */
+		/** 
+		 * Creates a RenderTexture using the description struct. 
+		 * 
+		 * @param[in]	desc	Description of the render texture to create.
+		 */
 		virtual SPtr<RenderTexture> createRenderTexture(const RENDER_TEXTURE_DESC& desc);
 
 		/**