mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-01-27 05:18:08 +01:00
Throwing shade
- Actually register instance types. - Update instance shaders to compile with new flywheel. - Add cull shaders. - Update flywheel dep in mods.toml. - Bump flywheel build.
This commit is contained in:
parent
45c9e2c87a
commit
e892003eb5
11 changed files with 118 additions and 73 deletions
|
@ -23,7 +23,7 @@ use_parchment = true
|
||||||
# dependency versions
|
# dependency versions
|
||||||
registrate_version = MC1.20-1.3.3
|
registrate_version = MC1.20-1.3.3
|
||||||
flywheel_minecraft_version = 1.20.1
|
flywheel_minecraft_version = 1.20.1
|
||||||
flywheel_version = 1.0.0-alpha-11
|
flywheel_version = 1.0.0-alpha-14
|
||||||
jei_minecraft_version = 1.20.1
|
jei_minecraft_version = 1.20.1
|
||||||
jei_version = 15.2.0.22
|
jei_version = 15.2.0.22
|
||||||
curios_minecraft_version = 1.20.1
|
curios_minecraft_version = 1.20.1
|
||||||
|
|
|
@ -18,6 +18,7 @@ import com.simibubi.create.foundation.blockEntity.behaviour.ValueSettingsClient;
|
||||||
import com.simibubi.create.foundation.gui.UIRenderHelper;
|
import com.simibubi.create.foundation.gui.UIRenderHelper;
|
||||||
import com.simibubi.create.foundation.outliner.Outliner;
|
import com.simibubi.create.foundation.outliner.Outliner;
|
||||||
import com.simibubi.create.foundation.ponder.element.WorldSectionElement;
|
import com.simibubi.create.foundation.ponder.element.WorldSectionElement;
|
||||||
|
import com.simibubi.create.foundation.render.AllInstanceTypes;
|
||||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||||
import com.simibubi.create.foundation.render.CreateContexts;
|
import com.simibubi.create.foundation.render.CreateContexts;
|
||||||
import com.simibubi.create.foundation.render.SuperByteBufferCache;
|
import com.simibubi.create.foundation.render.SuperByteBufferCache;
|
||||||
|
@ -63,6 +64,8 @@ public class CreateClient {
|
||||||
modEventBus.addListener(CreateClient::clientInit);
|
modEventBus.addListener(CreateClient::clientInit);
|
||||||
modEventBus.addListener(AllParticleTypes::registerFactories);
|
modEventBus.addListener(AllParticleTypes::registerFactories);
|
||||||
|
|
||||||
|
AllInstanceTypes.init();
|
||||||
|
|
||||||
MODEL_SWAPPER.registerListeners(modEventBus);
|
MODEL_SWAPPER.registerListeners(modEventBus);
|
||||||
|
|
||||||
ZAPPER_RENDER_HANDLER.registerListeners(forgeEventBus);
|
ZAPPER_RENDER_HANDLER.registerListeners(forgeEventBus);
|
||||||
|
|
|
@ -5,7 +5,7 @@ license="MIT"
|
||||||
|
|
||||||
[[mods]]
|
[[mods]]
|
||||||
modId="create"
|
modId="create"
|
||||||
# The Implementation-Version property in the jar's MANIFEST.MF file will be used as the mod version at runtime
|
# The Implementation-Version property in the jar's MANIFEST.MF file will be used as the mod version at runtime
|
||||||
version="${file.jarVersion}"
|
version="${file.jarVersion}"
|
||||||
displayName="Create"
|
displayName="Create"
|
||||||
#updateJSONURL=""
|
#updateJSONURL=""
|
||||||
|
@ -33,6 +33,6 @@ Technology that empowers the player.'''
|
||||||
[[dependencies.create]]
|
[[dependencies.create]]
|
||||||
modId="flywheel"
|
modId="flywheel"
|
||||||
mandatory=true
|
mandatory=true
|
||||||
versionRange="[0.6.10,0.6.11)"
|
versionRange="[1.0.0-alpha,2.0)"
|
||||||
ordering="AFTER"
|
ordering="AFTER"
|
||||||
side="CLIENT"
|
side="CLIENT"
|
||||||
|
|
|
@ -1,33 +1,23 @@
|
||||||
#define PI 3.1415926538
|
#define PI 3.1415926538
|
||||||
|
|
||||||
#include "flywheel:core/quaternion.glsl"
|
#include "flywheel:util/quaternion.glsl"
|
||||||
#include "flywheel:core/matutils.glsl"
|
#include "flywheel:util/matrix.glsl"
|
||||||
|
|
||||||
struct Belt {
|
const float uTime = 0.;
|
||||||
vec2 light;
|
|
||||||
vec4 color;
|
|
||||||
vec3 pos;
|
|
||||||
float speed;
|
|
||||||
float offset;
|
|
||||||
vec4 rotation;
|
|
||||||
vec2 sourceTexture;
|
|
||||||
vec4 scrollTexture;
|
|
||||||
float scrollMult;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
void vertex(inout Vertex v, Belt instance) {
|
void flw_instanceVertex(in FlwInstance instance) {
|
||||||
v.pos = rotateVertexByQuat(v.pos - .5, instance.rotation) + instance.pos + .5;
|
flw_vertexPos = vec4(rotateVertexByQuat(flw_vertexPos.xyz - .5, instance.rotation) + instance.pos + .5, 1.);
|
||||||
|
|
||||||
v.normal = rotateVertexByQuat(v.normal, instance.rotation);
|
flw_vertexNormal = rotateVertexByQuat(flw_vertexNormal, instance.rotation);
|
||||||
|
|
||||||
float scrollSize = instance.scrollTexture.w - instance.scrollTexture.y;
|
float scrollSize = instance.scrollTexture.w - instance.scrollTexture.y;
|
||||||
float scroll = fract(instance.speed * uTime / (31.5 * 16.) + instance.offset) * scrollSize * instance.scrollMult;
|
float scroll = fract(instance.speed * uTime / (31.5 * 16.) + instance.offset) * scrollSize * instance.scrollMult;
|
||||||
|
|
||||||
v.texCoords = v.texCoords - instance.sourceTexture + instance.scrollTexture.xy + vec2(0, scroll);
|
flw_vertexTexCoord = flw_vertexTexCoord - instance.sourceTexture + instance.scrollTexture.xy + vec2(0, scroll);
|
||||||
v.light = instance.light;
|
flw_vertexLight = instance.light;
|
||||||
|
|
||||||
#if defined(DEBUG_RAINBOW)
|
#if defined(DEBUG_RAINBOW)
|
||||||
v.color = instance.color;
|
flw_vertexColor = instance.color;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,26 +1,15 @@
|
||||||
#define PI 3.1415926538
|
#include "flywheel:util/matrix.glsl"
|
||||||
|
#include "flywheel:util/quaternion.glsl"
|
||||||
|
|
||||||
#include "flywheel:core/matutils.glsl"
|
const float uTime = 0.;
|
||||||
#include "flywheel:core/quaternion.glsl"
|
|
||||||
|
|
||||||
struct Actor {
|
void flw_instanceVertex(in FlwInstance instance) {
|
||||||
vec3 pos;
|
|
||||||
vec2 light;
|
|
||||||
float offset;
|
|
||||||
vec3 axis;
|
|
||||||
vec4 rotation;
|
|
||||||
vec3 rotationCenter;
|
|
||||||
float speed;
|
|
||||||
};
|
|
||||||
|
|
||||||
void vertex(inout Vertex v, Actor instance) {
|
|
||||||
float degrees = instance.offset + uTime * instance.speed / 20.;
|
float degrees = instance.offset + uTime * instance.speed / 20.;
|
||||||
//float angle = fract(degrees / 360.) * PI * 2.;
|
|
||||||
|
|
||||||
vec4 kineticRot = quat(instance.axis, degrees);
|
vec4 kineticRot = quat(instance.axis, degrees);
|
||||||
vec3 rotated = rotateVertexByQuat(v.pos - instance.rotationCenter, kineticRot) + instance.rotationCenter;
|
vec3 rotated = rotateVertexByQuat(flw_vertexPos.xyz - instance.rotationCenter, kineticRot) + instance.rotationCenter;
|
||||||
|
|
||||||
v.pos = rotateVertexByQuat(rotated - .5, instance.rotation) + instance.pos + .5;
|
flw_vertexPos = vec4(rotateVertexByQuat(rotated - .5, instance.rotation) + instance.pos + .5, 1.);
|
||||||
v.normal = rotateVertexByQuat(rotateVertexByQuat(v.normal, kineticRot), instance.rotation);
|
flw_vertexNormal = rotateVertexByQuat(rotateVertexByQuat(flw_vertexNormal, kineticRot), instance.rotation);
|
||||||
v.light = instance.light;
|
flw_vertexLight = instance.light;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
#define PI 3.1415926538
|
||||||
|
|
||||||
|
#include "flywheel:util/quaternion.glsl"
|
||||||
|
#include "flywheel:util/matrix.glsl"
|
||||||
|
|
||||||
|
const float uTime = 0.;
|
||||||
|
|
||||||
|
void flw_transformBoundingSphere(in FlwInstance instance, inout vec3 center, inout float radius) {
|
||||||
|
// FIXME: this is incorrect, but it compiles
|
||||||
|
center = rotateVertexByQuat(center - .5, instance.rotation) + instance.pos + .5;
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
#include "flywheel:util/matrix.glsl"
|
||||||
|
#include "flywheel:util/quaternion.glsl"
|
||||||
|
|
||||||
|
const float uTime = 0.;
|
||||||
|
|
||||||
|
void flw_transformBoundingSphere(in FlwInstance instance, inout vec3 center, inout float radius) {
|
||||||
|
// FIXME: this is incorrect, but it compiles
|
||||||
|
float degrees = instance.offset + uTime * instance.speed / 20.;
|
||||||
|
|
||||||
|
vec4 kineticRot = quat(instance.axis, degrees);
|
||||||
|
vec3 rotated = rotateVertexByQuat(center - instance.rotationCenter, kineticRot) + instance.rotationCenter;
|
||||||
|
|
||||||
|
center = rotateVertexByQuat(rotated - .5, instance.rotation) + instance.pos + .5;
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
#define PI 3.1415926538
|
||||||
|
|
||||||
|
const float uTime = 0.;
|
||||||
|
|
||||||
|
#include "flywheel:util/matrix.glsl"
|
||||||
|
#include "flywheel:util/quaternion.glsl"
|
||||||
|
|
||||||
|
float toRad(float degrees) {
|
||||||
|
return fract(degrees / 360.) * PI * 2.;
|
||||||
|
}
|
||||||
|
|
||||||
|
float getFlapAngle(float flapness, float intensity, float scale) {
|
||||||
|
float absFlap = abs(flapness);
|
||||||
|
|
||||||
|
float angle = sin((1. - absFlap) * PI * intensity) * 30. * flapness * scale;
|
||||||
|
|
||||||
|
float halfAngle = angle * 0.5;
|
||||||
|
|
||||||
|
float which = step(0., flapness); // 0 if negative, 1 if positive
|
||||||
|
float degrees = which * halfAngle + (1. - which) * angle; // branchless conditional multiply
|
||||||
|
|
||||||
|
return degrees;
|
||||||
|
}
|
||||||
|
|
||||||
|
void flw_transformBoundingSphere(in FlwInstance flap, inout vec3 center, inout float radius) {
|
||||||
|
// FIXME: this is incorrect, but it compiles
|
||||||
|
float flapAngle = getFlapAngle(flap.flapness, flap.intensity, flap.flapScale);
|
||||||
|
|
||||||
|
vec4 orientation = quat(vec3(0., 1., 0.), -flap.horizontalAngle);
|
||||||
|
vec4 flapRotation = quat(vec3(1., 0., 0.), flapAngle);
|
||||||
|
|
||||||
|
vec3 rotated = rotateVertexByQuat(center - flap.pivot, flapRotation) + flap.pivot + flap.segmentOffset;
|
||||||
|
center = rotateVertexByQuat(rotated - .5, orientation) + flap.instancePos + .5;
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
#define PI 3.1415926538
|
||||||
|
|
||||||
|
#include "flywheel:util/matrix.glsl"
|
||||||
|
|
||||||
|
const float uTime = 0.;
|
||||||
|
|
||||||
|
mat4 kineticRotation(float offset, float speed, vec3 axis) {
|
||||||
|
float degrees = offset + uTime * speed * 3./10.;
|
||||||
|
float angle = fract(degrees / 360.) * PI * 2.;
|
||||||
|
|
||||||
|
return rotate(axis, angle);
|
||||||
|
}
|
||||||
|
|
||||||
|
void flw_transformBoundingSphere(in FlwInstance instance, inout vec3 center, inout float radius) {
|
||||||
|
// FIXME: this is incorrect, but it compiles
|
||||||
|
mat4 spin = kineticRotation(instance.offset, instance.speed, instance.axis);
|
||||||
|
|
||||||
|
vec4 worldPos = spin * vec4(center - .5, 1.);
|
||||||
|
center = worldPos.xyz + instance.pos + .5;
|
||||||
|
}
|
|
@ -1,18 +1,9 @@
|
||||||
#define PI 3.1415926538
|
#define PI 3.1415926538
|
||||||
|
|
||||||
#include "flywheel:core/matutils.glsl"
|
const float uTime = 0.;
|
||||||
#include "flywheel:core/quaternion.glsl"
|
|
||||||
|
|
||||||
struct Flap {
|
#include "flywheel:util/matrix.glsl"
|
||||||
vec3 instancePos;
|
#include "flywheel:util/quaternion.glsl"
|
||||||
vec2 light;
|
|
||||||
vec3 segmentOffset;
|
|
||||||
vec3 pivot;
|
|
||||||
float horizontalAngle;
|
|
||||||
float intensity;
|
|
||||||
float flapScale;
|
|
||||||
float flapness;
|
|
||||||
};
|
|
||||||
|
|
||||||
float toRad(float degrees) {
|
float toRad(float degrees) {
|
||||||
return fract(degrees / 360.) * PI * 2.;
|
return fract(degrees / 360.) * PI * 2.;
|
||||||
|
@ -31,16 +22,16 @@ float getFlapAngle(float flapness, float intensity, float scale) {
|
||||||
return degrees;
|
return degrees;
|
||||||
}
|
}
|
||||||
|
|
||||||
void vertex(inout Vertex v, Flap flap) {
|
void flw_instanceVertex(in FlwInstance flap) {
|
||||||
float flapAngle = getFlapAngle(flap.flapness, flap.intensity, flap.flapScale);
|
float flapAngle = getFlapAngle(flap.flapness, flap.intensity, flap.flapScale);
|
||||||
|
|
||||||
vec4 orientation = quat(vec3(0., 1., 0.), -flap.horizontalAngle);
|
vec4 orientation = quat(vec3(0., 1., 0.), -flap.horizontalAngle);
|
||||||
vec4 flapRotation = quat(vec3(1., 0., 0.), flapAngle);
|
vec4 flapRotation = quat(vec3(1., 0., 0.), flapAngle);
|
||||||
|
|
||||||
vec3 rotated = rotateVertexByQuat(v.pos - flap.pivot, flapRotation) + flap.pivot + flap.segmentOffset;
|
vec3 rotated = rotateVertexByQuat(flw_vertexPos.xyz - flap.pivot, flapRotation) + flap.pivot + flap.segmentOffset;
|
||||||
rotated = rotateVertexByQuat(rotated - .5, orientation) + flap.instancePos + .5;
|
rotated = rotateVertexByQuat(rotated - .5, orientation) + flap.instancePos + .5;
|
||||||
|
|
||||||
v.pos = rotated;
|
flw_vertexPos = vec4(rotated, 1.);
|
||||||
v.normal = rotateVertexByQuat(rotateVertexByQuat(v.normal, flapRotation), orientation);
|
flw_vertexNormal = rotateVertexByQuat(rotateVertexByQuat(flw_vertexNormal, flapRotation), orientation);
|
||||||
v.light = flap.light;
|
flw_vertexLight = flap.light;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,8 @@
|
||||||
#define PI 3.1415926538
|
#define PI 3.1415926538
|
||||||
|
|
||||||
#include "flywheel:core/matutils.glsl"
|
#include "flywheel:util/matrix.glsl"
|
||||||
|
|
||||||
struct Rotating {
|
const float uTime = 0.;
|
||||||
vec2 light;
|
|
||||||
vec4 color;
|
|
||||||
vec3 pos;
|
|
||||||
float speed;
|
|
||||||
float offset;
|
|
||||||
vec3 axis;
|
|
||||||
};
|
|
||||||
|
|
||||||
mat4 kineticRotation(float offset, float speed, vec3 axis) {
|
mat4 kineticRotation(float offset, float speed, vec3 axis) {
|
||||||
float degrees = offset + uTime * speed * 3./10.;
|
float degrees = offset + uTime * speed * 3./10.;
|
||||||
|
@ -18,16 +11,16 @@ mat4 kineticRotation(float offset, float speed, vec3 axis) {
|
||||||
return rotate(axis, angle);
|
return rotate(axis, angle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void vertex(inout Vertex v, Rotating instance) {
|
void flw_instanceVertex(in FlwInstance instance) {
|
||||||
mat4 spin = kineticRotation(instance.offset, instance.speed, instance.axis);
|
mat4 spin = kineticRotation(instance.offset, instance.speed, instance.axis);
|
||||||
|
|
||||||
vec4 worldPos = spin * vec4(v.pos - .5, 1.);
|
vec4 worldPos = spin * vec4(flw_vertexPos.xyz - .5, 1.);
|
||||||
v.pos = worldPos.xyz + instance.pos + .5;
|
flw_vertexPos = vec4(worldPos.xyz + instance.pos + .5, 1.);
|
||||||
|
|
||||||
v.normal = modelToNormal(spin) * v.normal;
|
flw_vertexNormal = modelToNormal(spin) * flw_vertexNormal;
|
||||||
v.light = instance.light;
|
flw_vertexLight = instance.light;
|
||||||
|
|
||||||
#if defined(DEBUG_RAINBOW)
|
#if defined(DEBUG_RAINBOW)
|
||||||
v.color = instance.color;
|
flw_vertexColor = instance.color;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue