mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
Merge branch 'main' into animation
This commit is contained in:
commit
eca7eeadee
7 changed files with 39 additions and 19 deletions
|
|
@ -105,8 +105,6 @@ socket:peek_async(
|
|||
[optional] usetable: boolean=false
|
||||
) -> nil|table|Bytearray
|
||||
|
||||
Translated with DeepL.com (free version)
|
||||
|
||||
-- Closes the connection
|
||||
socket:close()
|
||||
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ This primitive describes a triangle.
|
|||
- `region` - UV region within the selected texture, defined by the positions of opposite corners of a square of normalized texture coordinates. Example: `region (0,0,1,1)`
|
||||
- `region-scale` - multiplier vector for the UV region. Example: `region-scale (0.5,1)`
|
||||
- `shading` - determines whether shading is enabled on the primitive. Example: `shading off`
|
||||
- `normal` - overrides normal vector. Example: `normal (0,1,0)`
|
||||
|
||||
By default, texture coordinates are not affected by shape or size, unlike other primitives.
|
||||
|
||||
|
|
@ -56,6 +57,7 @@ This primitive describes a parallelogram using the right and up vectors.
|
|||
- `region-scale` - the multiplier vector for the automatically selected UV region. Example: `region-scale (0.5,1)`
|
||||
- `shading` - determines whether shading is enabled on the primitive. Example: `shading off`
|
||||
- `flip` - flips the UV region horizontally or vertically. Example: `flip v`
|
||||
- `normal` - overrides normal vector. Example: `normal (0,1,0)`
|
||||
|
||||
### `box` Properties
|
||||
|
||||
|
|
@ -66,8 +68,8 @@ This primitive describes a rectangular parallelepiped.
|
|||
- `origin` - the point relative to which the rotation will be applied. Default: the center of the primitive. Example: `origin (0.5,0.5,0.5)`
|
||||
- `rotate` - rotation around the (x,y,z) axes in degrees, or a quaternion (x,y,z,w). Example: `rotate (45,0,0)` or `rotate (0.3826834, 0, 0, 0.9238795)`
|
||||
- `texture` - the default texture to display for all sides.
|
||||
- `shading` determines whether shading is enabled on the primitive. Example: `shading off`
|
||||
- `delete` deletes sides by name (top, bottom, east, west, north, south)
|
||||
- `shading` - determines whether shading is enabled on the primitive. Example: `shading off`
|
||||
- `delete` - deletes sides by name (top, bottom, east, west, north, south)
|
||||
|
||||
### `part` properties (nested in `box`)
|
||||
|
||||
|
|
@ -76,7 +78,7 @@ This primitive describes the properties of the sides of a rectangular parallelep
|
|||
- `tags` - determines which side the properties will be applied to. Example: `tags (top,bottom)`
|
||||
- `texture` - the texture to display. Default: `$side_index`.
|
||||
- `region` - the UV region within the selected texture, defined by the positions of opposite corners. Example: `region (0,0,1,1)`
|
||||
- `region-scale` is a multiplier vector for the automatically selected UV region. Example: `region-scale (0.5,1)`
|
||||
- `region-scale` - multiplier vector for the automatically selected UV region. Example: `region-scale (0.5,1)`
|
||||
|
||||
## Skeleton
|
||||
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@
|
|||
- `region` - UV регион в границах выбранной текстуры, определяется позициями противоположных углов квадрата нормализованных текстурных координат. Пример: `region (0,0,1,1)`
|
||||
- `region-scale` вектор-множитель для UV региона. Пример: `region-scale (0.5,1)`
|
||||
- `shading` определяет возможность затенения на примитиве. Пример: `shading off`
|
||||
- `normal` переопределяет вектор нормали. Пример: `normal (0,1,0)`
|
||||
|
||||
Текстурные координаты по-умолчанию не зависят от формы из размера, в отличие от других примитивов.
|
||||
|
||||
|
|
@ -53,9 +54,10 @@
|
|||
- `up` - вектор Y, также определяющий высоту примитива. Пример: `up (0,1,0)`
|
||||
- `texture` - отображаемая текстура. По-умолчанию: `$0`. Пример: `texture "blocks:sand"`
|
||||
- `region` - UV регион в границах выбранной текстуры, определяется позициями противоположных углов. Пример: `region (0,0,1,1)`
|
||||
- `region-scale` вектор-множитель для автоматически выбранного UV региона. Пример: `region-scale (0.5,1)`
|
||||
- `shading` определяет возможность затенения на примитиве. Пример: `shading off`
|
||||
- `flip` отражает UV регион по горизонтали или вертикали. Пример: `flip v`
|
||||
- `region-scale` - вектор-множитель для автоматически выбранного UV региона. Пример: `region-scale (0.5,1)`
|
||||
- `shading` - определяет возможность затенения на примитиве. Пример: `shading off`
|
||||
- `flip` - отражает UV регион по горизонтали или вертикали. Пример: `flip v`
|
||||
- `normal` - переопределяет вектор нормали. Пример: `normal (0,1,0)`
|
||||
|
||||
### Свойства `box`
|
||||
|
||||
|
|
@ -66,8 +68,8 @@
|
|||
- `origin` - точка, относительно которой будет применено вращение. По-умолчанию: центр примитива. Пример: `origin (0.5,0.5,0.5)`
|
||||
- `rotate` - вращение вокруг осей (x,y,z) в градусах, или кватернион (x,y,z,w). Пример: `rotate (45,0,0)` или `rotate (0.3826834, 0, 0, 0.9238795)`
|
||||
- `texture` - отображаемая текстура для всех сторон по-умолчанию.
|
||||
- `shading` определяет возможность затенения на примитиве. Пример: `shading off`
|
||||
- `delete` удаляет стороны по именам (top, bottom, east, west, north, south)
|
||||
- `shading` - определяет возможность затенения на примитиве. Пример: `shading off`
|
||||
- `delete` - удаляет стороны по именам (top, bottom, east, west, north, south)
|
||||
|
||||
### Свойства `part` (вложен в `box`)
|
||||
|
||||
|
|
@ -76,7 +78,7 @@
|
|||
- `tags` - определяет то, на какаие из сторон будут применены свойства. Пример: `tags (top,bottom)`
|
||||
- `texture` - отображаемая текстура. По-умолчанию: `$индекс_стороны`.
|
||||
- `region` - UV регион в границах выбранной текстуры, определяется позициями противоположных углов. Пример: `region (0,0,1,1)`
|
||||
- `region-scale` вектор-множитель для автоматически выбранного UV региона. Пример: `region-scale (0.5,1)`
|
||||
- `region-scale` - вектор-множитель для автоматически выбранного UV региона. Пример: `region-scale (0.5,1)`
|
||||
|
||||
## Скелет
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ uniform vec3 u_fogColor;
|
|||
uniform float u_fogFactor;
|
||||
uniform float u_fogCurve;
|
||||
uniform bool u_alphaClip;
|
||||
uniform bool u_dithering;
|
||||
uniform vec3 u_sunDir;
|
||||
|
||||
const float BAYER_MATRIX[64] = float[](
|
||||
|
|
@ -35,6 +36,7 @@ void main() {
|
|||
vec4 texColor = texture(u_texture0, a_texCoord);
|
||||
float alpha = a_color.a * texColor.a;
|
||||
// anyway it's any alpha-test alternative required
|
||||
if (u_dithering) {
|
||||
if (u_alphaClip) {
|
||||
float bayer = calc_bayer(gl_FragCoord.xy);
|
||||
if (alpha - bayer < 0.01f) {
|
||||
|
|
@ -44,6 +46,9 @@ void main() {
|
|||
} else if (alpha < 0.05f) {
|
||||
discard;
|
||||
}
|
||||
} else if (alpha < (u_alphaClip ? 0.5f : 0.15f)) {
|
||||
discard;
|
||||
}
|
||||
f_color = a_color * texColor;
|
||||
|
||||
#ifndef ADVANCED_RENDER
|
||||
|
|
|
|||
|
|
@ -192,7 +192,12 @@ static void perform_rect(const xmlelement& root, ModelBuilder& builder) {
|
|||
}
|
||||
std::string texture = root.attr("texture", "$0").getText();
|
||||
|
||||
auto normal = glm::cross(glm::normalize(right), glm::normalize(up));
|
||||
glm::vec3 normal;
|
||||
if (root.has("normal")) {
|
||||
normal = root.attr("normal").asVec3();
|
||||
} else {
|
||||
normal = glm::cross(glm::normalize(right), glm::normalize(up));
|
||||
}
|
||||
builder.addRect(
|
||||
texture,
|
||||
shading,
|
||||
|
|
@ -218,7 +223,12 @@ static void perform_triangle(const xmlelement& root, ModelBuilder& builder) {
|
|||
|
||||
glm::vec3 ba = pointB - pointA;
|
||||
glm::vec3 ca = pointC - pointA;
|
||||
glm::vec3 normal = glm::normalize(glm::cross(ba, ca));
|
||||
glm::vec3 normal;
|
||||
if (root.has("normal")) {
|
||||
normal = root.attr("normal").asVec3();
|
||||
} else {
|
||||
normal = glm::normalize(glm::cross(ba, ca));
|
||||
}
|
||||
|
||||
if (root.has("uv")) {
|
||||
root.attr("uv").asNumbers(glm::value_ptr(uvs[0]), 6);
|
||||
|
|
|
|||
|
|
@ -144,6 +144,7 @@ void BlockWrapsRenderer::draw(const DrawContext& pctx) {
|
|||
auto& shader = assets.require<Shader>("entity");
|
||||
shader.use();
|
||||
shader.uniform1i("u_alphaClip", false);
|
||||
shader.uniform1i("u_dithering", 0);
|
||||
|
||||
for (const auto& [_, wrapper] : wrappers) {
|
||||
if (wrapper->dirtySides) {
|
||||
|
|
|
|||
|
|
@ -244,6 +244,7 @@ void WorldRenderer::renderOpaque(
|
|||
}
|
||||
|
||||
entityShader.uniform1i("u_alphaClip", true);
|
||||
entityShader.uniform1i("u_dithering", 1);
|
||||
entityShader.uniform1f("u_opacity", 1.0f);
|
||||
level.entities->render(
|
||||
assets,
|
||||
|
|
@ -512,6 +513,7 @@ void WorldRenderer::renderWeatherEffects(Camera& camera) {
|
|||
float one = weather->fall.maxOpacity;
|
||||
float t = (weather->intensity * (one - zero)) * maxIntensity + zero;
|
||||
entityShader.uniform1i("u_alphaClip", weather->fall.opaque);
|
||||
entityShader.uniform1i("u_dithering", 0);
|
||||
entityShader.uniform1f(
|
||||
"u_opacity", weather->fall.opaque ? t * t : t
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue