A voxel rendering engine in C++ and Vulkan
The main challenge is to have nice performances in rendering fluidity.
A procedural voxel terrain rendering engine in C++ and Vulkan
License: Apache License 2.0
CPP code
inline int32_t toChunkPos(float x, float y, float z) noexcept {
// TODO: Add render distance in ubo
int32_t chunk_address =
(int32_t)x / CHUNK_SIZE |
((int32_t)z / CHUNK_SIZE) << 8 |
((int32_t)y / CHUNK_SIZE) << 16;
x = (int32_t)x % CHUNK_SIZE;
y = (int32_t)y % CHUNK_SIZE;
z = (int32_t)z % CHUNK_SIZE;
return
static_cast<int32_t>(x) |
static_cast<int32_t>(y) << 4 |
static_cast<int32_t>(z) << 8 |
chunk_address << 12;
}
HLSL code
// Extract actual vertex position from input
float4 extractPos(int input) {
// Local position in chunk
float3 pos = float3(
input & 0xF,
(input >> 4) & 0xF,
(input >> 8) & 0xF);
// Chunk position in world
int chunk_x = (input >> 12) & 0xFF;
int chunk_z = (input >> 20) & 0xFF;
int chunk_y = (input >> 28) & 0xF;
return float4(
(chunk_x * 16) + pos.x,
(chunk_y * 16) + pos.y,
(chunk_z * 16) + pos.z,
1.0
);
}
Actually, it's a Windows feature:
Every line feed (\LF) on Linux are actually interpreted as carriage-return/line-feed (\CRLF).
The "fix" is in the readExcept
lambda function:
ParseNumberFn readExcept = [this]() -> uint8_t {
if (cursor >= base::data.size()) {
throw PpmParseError("unexpected end of file");
}
// replace `cursor++` to `++cursor`:
return base::data[++cursor];
};
need to add constructor for App(uint32_t seed) or sth
Upgrade command buffer thing,
Textures setup,
...
In matrix.cpp, comment is "Produces orthographic projection matrix" l.422.
Replace with "Produces perspective projection matrix".
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.