summaryrefslogblamecommitdiffstats
path: root/src/RendererSectionData.hpp
blob: 7b30e441b5942d19170d6d4ea8b5f73e5c458370 (plain) (tree)
1
2
3
4
5
6
7
8
9


                 


                         
                     
                      
                           

            
 
                       
                                                                  

  







                        

                                                    
        
                                                         
 
                                                            

  
                            




                                                      
                                  
                    
                      
                            
  
 
                                                              
#pragma once

#include <vector>

#include <glm/mat4x4.hpp>

#include "Vector.hpp"
#include "Section.hpp"
#include "AssetManager.hpp"

class World;

struct BlockLightness {
	unsigned char face[FaceDirection::none] = { 0,0,0,0,0,0 };
};

struct SectionsData {
	Section section;
	Section west;
	Section east;
	Section top;
	Section bottom;
	Section north;
	Section south;

	BlockId GetBlockId(const Vector &pos) const;
	
	BlockLightness GetLight(const Vector &pos) const;

	BlockLightness GetSkyLight(const Vector &pos) const;
};

struct RendererSectionData {
    std::vector<glm::vec4> positions; //4 per instance
    std::vector<glm::vec2> uvs; //4 per instance
	std::vector<float> uvLayers;
	std::vector<glm::vec2> animations;
	std::vector<glm::vec3> colors;
    std::vector<glm::vec2> lights;
    size_t hash = 0;
    Vector sectionPos;
	bool forced = false;
};

RendererSectionData ParseSection(const SectionsData &sections);