Botcraft 1.21.5
Loading...
Searching...
No Matches
Botcraft::Renderer::WorldRenderer Class Reference

#include <WorldRenderer.hpp>

Public Member Functions

 WorldRenderer (const unsigned int section_height_)
 
 ~WorldRenderer ()
 
std::shared_ptr< CameraGetCamera ()
 
void InitGL ()
 
void UpdateViewMatrix ()
 
void SetCameraProjection (const glm::mat4 &proj)
 
void UpdateFaces ()
 
void UpdateChunk (const int x_, const int z_, const std::optional< Botcraft::Chunk > &chunk)
 
void UpdateEntity (const int id, const std::vector< Face > &faces)
 
void UseAtlasTextureGL ()
 
void ClearFaces ()
 
void SetPosOrientation (const double x_, const double y_, const double z_, const float yaw_, const float pitch_)
 
void RenderFaces (int *num_chunks_=nullptr, int *num_rendered_chunks_=nullptr, int *num_entities_=nullptr, int *num_rendered_entities_=nullptr, int *num_faces_=nullptr, int *num_rendered_faces_=nullptr)
 

Private Member Functions

void AddFace (const Position &block_pos, const Vector3< double > &offset, const Face &face_, const std::vector< std::string > &texture_identifiers_, const std::vector< unsigned int > &texture_multipliers_)
 
const std::vector< unsigned int > GetColorModifier (const int y, const Biome *biome, const Blockstate *blockstate, const std::vector< bool > &use_tintindex) const
 
const float DistanceToCamera (const Position &chunk) const
 

Private Attributes

unsigned int view_uniform_buffer
 
unsigned int section_height
 
std::unordered_map< Position, std::shared_ptr< Chunk > > chunks
 
std::mutex chunks_mutex
 
std::unordered_map< Position, std::shared_ptr< TransparentChunk > > transparent_chunks
 
std::mutex transparent_chunks_mutex
 
bool blocks_faces_should_be_updated
 
std::unordered_map< int, std::shared_ptr< Entity > > entities
 
std::mutex entities_mutex
 
bool entities_faces_should_be_updated
 
std::shared_ptr< Cameracamera
 
std::mutex m_mutex_camera
 
unsigned int atlas_texture
 

Detailed Description

Definition at line 38 of file WorldRenderer.hpp.

Constructor & Destructor Documentation

◆ WorldRenderer()

Botcraft::Renderer::WorldRenderer::WorldRenderer ( const unsigned int  section_height_)

◆ ~WorldRenderer()

Botcraft::Renderer::WorldRenderer::~WorldRenderer ( )

Definition at line 36 of file WorldRenderer.cpp.

References atlas_texture, and camera.

Member Function Documentation

◆ AddFace()

void Botcraft::Renderer::WorldRenderer::AddFace ( const Position block_pos,
const Vector3< double > &  offset,
const Face face_,
const std::vector< std::string > &  texture_identifiers_,
const std::vector< unsigned int > &  texture_multipliers_ 
)
private

◆ ClearFaces()

void Botcraft::Renderer::WorldRenderer::ClearFaces ( )

◆ DistanceToCamera()

const float Botcraft::Renderer::WorldRenderer::DistanceToCamera ( const Position chunk) const
private

◆ GetCamera()

std::shared_ptr< Camera > Botcraft::Renderer::WorldRenderer::GetCamera ( )

Definition at line 42 of file WorldRenderer.cpp.

References camera.

◆ GetColorModifier()

const std::vector< unsigned int > Botcraft::Renderer::WorldRenderer::GetColorModifier ( const int  y,
const Biome biome,
const Blockstate blockstate,
const std::vector< bool > &  use_tintindex 
) const
private

◆ InitGL()

◆ RenderFaces()

void Botcraft::Renderer::WorldRenderer::RenderFaces ( int *  num_chunks_ = nullptr,
int *  num_rendered_chunks_ = nullptr,
int *  num_entities_ = nullptr,
int *  num_rendered_entities_ = nullptr,
int *  num_faces_ = nullptr,
int *  num_rendered_faces_ = nullptr 
)

◆ SetCameraProjection()

void Botcraft::Renderer::WorldRenderer::SetCameraProjection ( const glm::mat4 &  proj)

Definition at line 100 of file WorldRenderer.cpp.

References camera, and m_mutex_camera.

◆ SetPosOrientation()

void Botcraft::Renderer::WorldRenderer::SetPosOrientation ( const double  x_,
const double  y_,
const double  z_,
const float  yaw_,
const float  pitch_ 
)

Definition at line 340 of file WorldRenderer.cpp.

References camera, and m_mutex_camera.

◆ UpdateChunk()

◆ UpdateEntity()

void Botcraft::Renderer::WorldRenderer::UpdateEntity ( const int  id,
const std::vector< Face > &  faces 
)

Definition at line 283 of file WorldRenderer.cpp.

References entities, entities_faces_should_be_updated, and entities_mutex.

◆ UpdateFaces()

void Botcraft::Renderer::WorldRenderer::UpdateFaces ( )

◆ UpdateViewMatrix()

void Botcraft::Renderer::WorldRenderer::UpdateViewMatrix ( )

◆ UseAtlasTextureGL()

void Botcraft::Renderer::WorldRenderer::UseAtlasTextureGL ( )

Definition at line 306 of file WorldRenderer.cpp.

References atlas_texture.

Member Data Documentation

◆ atlas_texture

unsigned int Botcraft::Renderer::WorldRenderer::atlas_texture
private

Definition at line 101 of file WorldRenderer.hpp.

Referenced by InitGL(), UseAtlasTextureGL(), and ~WorldRenderer().

◆ blocks_faces_should_be_updated

bool Botcraft::Renderer::WorldRenderer::blocks_faces_should_be_updated
private

Definition at line 92 of file WorldRenderer.hpp.

Referenced by ClearFaces(), UpdateChunk(), UpdateFaces(), and WorldRenderer().

◆ camera

std::shared_ptr<Camera> Botcraft::Renderer::WorldRenderer::camera
private

◆ chunks

std::unordered_map<Position, std::shared_ptr<Chunk> > Botcraft::Renderer::WorldRenderer::chunks
private

◆ chunks_mutex

std::mutex Botcraft::Renderer::WorldRenderer::chunks_mutex
private

Definition at line 89 of file WorldRenderer.hpp.

Referenced by AddFace(), ClearFaces(), RenderFaces(), UpdateChunk(), and UpdateFaces().

◆ entities

std::unordered_map<int, std::shared_ptr<Entity> > Botcraft::Renderer::WorldRenderer::entities
private

Definition at line 94 of file WorldRenderer.hpp.

Referenced by ClearFaces(), RenderFaces(), UpdateEntity(), UpdateFaces(), and WorldRenderer().

◆ entities_faces_should_be_updated

bool Botcraft::Renderer::WorldRenderer::entities_faces_should_be_updated
private

Definition at line 96 of file WorldRenderer.hpp.

Referenced by ClearFaces(), UpdateEntity(), UpdateFaces(), and WorldRenderer().

◆ entities_mutex

std::mutex Botcraft::Renderer::WorldRenderer::entities_mutex
private

Definition at line 95 of file WorldRenderer.hpp.

Referenced by ClearFaces(), RenderFaces(), UpdateEntity(), and UpdateFaces().

◆ m_mutex_camera

std::mutex Botcraft::Renderer::WorldRenderer::m_mutex_camera
private

◆ section_height

unsigned int Botcraft::Renderer::WorldRenderer::section_height
private

Definition at line 86 of file WorldRenderer.hpp.

Referenced by AddFace(), DistanceToCamera(), RenderFaces(), and WorldRenderer().

◆ transparent_chunks

std::unordered_map<Position, std::shared_ptr<TransparentChunk> > Botcraft::Renderer::WorldRenderer::transparent_chunks
private

◆ transparent_chunks_mutex

std::mutex Botcraft::Renderer::WorldRenderer::transparent_chunks_mutex
private

◆ view_uniform_buffer

unsigned int Botcraft::Renderer::WorldRenderer::view_uniform_buffer
private

Definition at line 81 of file WorldRenderer.hpp.

Referenced by InitGL(), and UpdateViewMatrix().


The documentation for this class was generated from the following files: