Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#5584: OpenGLShader now offers an interface to attach indexed vertice…
…s directly, returning a handle for later manipulation.
- Loading branch information
1 parent
98bde91
commit a8bc537
Showing
15 changed files
with
297 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#pragma once | ||
|
||
#include <vector> | ||
#include <limits> | ||
#include <cstdint> | ||
#include "render/ArbitraryMeshVertex.h" | ||
|
||
namespace render | ||
{ | ||
|
||
/** | ||
* A surface renderer accepts a variable number of indexed surfaces and arranges | ||
* them into one or more continuous blocks of vertices for efficient rendering. | ||
* | ||
* The internal arrangement has the goal of reducing the amount of draw calls for | ||
* suraces sharing a single material. Allocating a surface slot yields a handle which | ||
* allows for later update or deallocation of the slot. | ||
*/ | ||
class ISurfaceRenderer | ||
{ | ||
public: | ||
virtual ~ISurfaceRenderer() {} | ||
|
||
using Slot = std::uint64_t; | ||
static constexpr Slot InvalidSlot = std::numeric_limits<Slot>::max(); | ||
|
||
// Allocate a slot to hold the given surface data of the given size | ||
// Returns the handle which can be used to update or deallocate the data later | ||
virtual Slot addSurface(const std::vector<ArbitraryMeshVertex>& vertices, | ||
const std::vector<unsigned int>& indices) = 0; | ||
|
||
// Releases a previously allocated slot. This invalidates the handle. | ||
virtual void removeSurface(Slot slot) = 0; | ||
|
||
// Sets the surface data | ||
virtual void updateSurface(Slot slot, const std::vector<ArbitraryMeshVertex>& vertices, | ||
const std::vector<unsigned int>& indices) = 0; | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.