Grass rendering behing water fix
This commit is contained in:
@@ -18,22 +18,27 @@ void ContentBuilder::add(Block* def) {
|
||||
|
||||
Content* ContentBuilder::build() {
|
||||
vector<Block*> blockDefsIndices;
|
||||
DrawGroups* groups = new DrawGroups;
|
||||
for (const string& name : blockIds) {
|
||||
Block* def = blockDefs[name];
|
||||
def->id = blockDefsIndices.size();
|
||||
blockDefsIndices.push_back(def);
|
||||
if (groups->find(def->drawGroup) == groups->end()) {
|
||||
groups->insert(def->drawGroup);
|
||||
}
|
||||
}
|
||||
ContentIndices* indices = new ContentIndices(blockDefsIndices);
|
||||
return new Content(indices, blockDefs);
|
||||
return new Content(indices, groups, blockDefs);
|
||||
}
|
||||
|
||||
ContentIndices::ContentIndices(vector<Block*> blockDefs)
|
||||
: blockDefs(blockDefs) {
|
||||
}
|
||||
|
||||
Content::Content(ContentIndices* indices,
|
||||
Content::Content(ContentIndices* indices, DrawGroups* drawGroups,
|
||||
unordered_map<string, Block*> blockDefs)
|
||||
: blockDefs(blockDefs),
|
||||
drawGroups(drawGroups),
|
||||
indices(indices) {
|
||||
}
|
||||
|
||||
|
||||
@@ -4,8 +4,11 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <unordered_map>
|
||||
#include <set>
|
||||
#include "../typedefs.h"
|
||||
|
||||
typedef std::set<unsigned char> DrawGroups;
|
||||
|
||||
class Block;
|
||||
class Content;
|
||||
|
||||
@@ -46,8 +49,9 @@ class Content {
|
||||
std::unordered_map<std::string, Block*> blockDefs;
|
||||
public:
|
||||
ContentIndices* const indices;
|
||||
|
||||
Content(ContentIndices* indices,
|
||||
DrawGroups* const drawGroups;
|
||||
|
||||
Content(ContentIndices* indices, DrawGroups* drawGroups,
|
||||
std::unordered_map<std::string, Block*> blockDefs);
|
||||
~Content();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user