mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-11-21 09:59:44 +00:00
Merge branch 'dev' into lights-fixes
This commit is contained in:
commit
3fc5a4322d
65 changed files with 1549 additions and 715 deletions
|
|
@ -113,8 +113,6 @@ static inline auto shader_deleter = [](GLuint* shader) {
|
|||
delete shader;
|
||||
};
|
||||
|
||||
inline const uint GL_LOG_LEN = 512;
|
||||
|
||||
// shader should be deleted after shader program linking
|
||||
using glshader = std::unique_ptr<GLuint, decltype(shader_deleter)>;
|
||||
|
||||
|
|
@ -125,12 +123,14 @@ glshader compile_shader(GLenum type, const GLchar* source, const std::string& fi
|
|||
glCompileShader(shader);
|
||||
glGetShaderiv(shader, GL_COMPILE_STATUS, &success);
|
||||
if (!success) {
|
||||
GLchar infoLog[GL_LOG_LEN];
|
||||
glGetShaderInfoLog(shader, GL_LOG_LEN, nullptr, infoLog);
|
||||
GLint infoLogLength;
|
||||
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLogLength);
|
||||
auto infoLog = std::make_unique<GLchar[]>(infoLogLength);
|
||||
glGetShaderInfoLog(shader, infoLogLength, nullptr, infoLog.get());
|
||||
glDeleteShader(shader);
|
||||
throw std::runtime_error(
|
||||
"vertex shader compilation failed (" + file + "):\n" +
|
||||
std::string(infoLog)
|
||||
std::string(infoLog.get(), infoLogLength)
|
||||
);
|
||||
}
|
||||
return glshader(new GLuint(shader), shader_deleter); //-V508
|
||||
|
|
@ -172,10 +172,14 @@ static GLuint compile_program(
|
|||
glGetProgramiv(program, GL_LINK_STATUS, &success);
|
||||
|
||||
if (!success) {
|
||||
GLchar infoLog[GL_LOG_LEN];
|
||||
glGetProgramInfoLog(program, GL_LOG_LEN, nullptr, infoLog);
|
||||
GLint infoLogLength;
|
||||
glGetProgramiv(program, GL_INFO_LOG_LENGTH, &infoLogLength);
|
||||
auto infoLog = std::make_unique<GLchar[]>(infoLogLength);
|
||||
glGetProgramInfoLog(program, infoLogLength, nullptr, infoLog.get());
|
||||
glDeleteProgram(program);
|
||||
throw std::runtime_error(
|
||||
"shader program linking failed:\n" + std::string(infoLog)
|
||||
"shader program linking failed:\n" +
|
||||
std::string(infoLog.get(), infoLogLength)
|
||||
);
|
||||
}
|
||||
return program;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ static debug::Logger logger("chunks-render");
|
|||
|
||||
size_t ChunksRenderer::visibleChunks = 0;
|
||||
|
||||
static constexpr inline size_t MAX_CHUNKS_ENQUEUED_IN_FRAME = 4;
|
||||
static constexpr inline size_t MAX_CHUNKS_ENQUEUED_IN_FRAME = 64;
|
||||
|
||||
class RendererWorker : public util::Worker<RendererJob, RendererResult> {
|
||||
BlocksRenderer renderer;
|
||||
|
|
@ -197,8 +197,7 @@ void ChunksRenderer::update() {
|
|||
|
||||
int loadDistance = settings.chunks.loadDistance.get();
|
||||
|
||||
const int topN = 10;
|
||||
int top = std::min<int>(meshBuildQueue.size(), topN);
|
||||
int top = std::min<int>(meshBuildQueue.size(), MAX_CHUNKS_ENQUEUED_IN_FRAME);
|
||||
for (int i = 0; i < top; i++) {
|
||||
glm::ivec2 offset = meshBuildQueue[i];
|
||||
size_t index =
|
||||
|
|
|
|||
|
|
@ -35,8 +35,15 @@ void InlineFrame::setDocument(const std::shared_ptr<UiDocument>& document) {
|
|||
|
||||
root->setSize(size);
|
||||
|
||||
gui.postRunnable([this]() {
|
||||
scripting::on_ui_open(*this->document, {});
|
||||
gui.postRunnable([weak = weak_from_this(), document]() {
|
||||
auto node = weak.lock();
|
||||
if (node == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (static_cast<InlineFrame&>(*node).document != document) {
|
||||
return;
|
||||
}
|
||||
scripting::on_ui_open(*document, {});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue