Skip to content

Commit

Permalink
WOOPER!
Browse files Browse the repository at this point in the history
  • Loading branch information
Waterpicker committed Nov 29, 2023
1 parent 87eb893 commit 5a1d4a5
Show file tree
Hide file tree
Showing 28 changed files with 499 additions and 510 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import generations.gg.generations.core.generationscore.client.render.rarecandy.M
import gg.generations.rarecandy.renderer.animation.Animation
import gg.generations.rarecandy.renderer.components.AnimatedMeshObject
import net.minecraft.resources.ResourceLocation
import net.minecraft.world.entity.Entity
import java.util.function.Supplier

class RareCandyAnimationFactory : AnimationReferenceFactory {
Expand Down Expand Up @@ -54,19 +53,16 @@ class RareCandyAnimationFactory : AnimationReferenceFactory {
})
}

class StatefulAnimationRareCandy(private val animationSuppler: Supplier<Animation<Any>>?) :
StatefulAnimation<PokemonEntity, ModelFrame> {
class StatefulAnimationRareCandy(private val animationSuppler: Supplier<Animation<Any>>?) : StatefulAnimation<PokemonEntity, ModelFrame> {
private var secondsPassed = 0f
override val isTransform: Boolean
get() = false
override val isTransform: Boolean = false

override val isPosePauser: Boolean
get() = false //TODO: Implment this.
override val isPosePauser: Boolean = false //TODO: Implment this.

override fun preventsIdle(
t: PokemonEntity?,
poseableEntityState: PoseableEntityState<PokemonEntity>,
statelessAnimation: StatelessAnimation<PokemonEntity, *>
entity: PokemonEntity?,
state: PoseableEntityState<PokemonEntity>,
idleAnimation: StatelessAnimation<PokemonEntity, *>
): Boolean {
return false
}
Expand Down Expand Up @@ -101,8 +97,7 @@ class RareCandyAnimationFactory : AnimationReferenceFactory {
jsonPokemonPoseableModel: JsonPokemonPoseableModel,
private val animationSupplier: Supplier<Animation<Any>?>
) : StatelessAnimation<PokemonEntity, ModelFrame>(jsonPokemonPoseableModel) {
override val targetFrame: Class<ModelFrame>
get() = frame!!.javaClass
override val targetFrame = ModelFrame::class.java

override fun setAngles(
pokemonEntity: PokemonEntity?,
Expand All @@ -120,7 +115,7 @@ class RareCandyAnimationFactory : AnimationReferenceFactory {
if (pokemonEntity != null) (pokemonEntity as PixelmonInstanceProvider).instance else ModelRegistry.getGuiInstance()
val animation = animationSupplier.get()
if (instance != null && animation != null) instance.matrixTransforms =
animationSupplier.get()!!.getFrameTransform(cur.toDouble())
animation.getFrameTransform(cur.toDouble())
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ public void render(RenderContext context, PoseStack stack, VertexConsumer buffer


var id = getTexture(context.request(RenderContext.Companion.getENTITY()));
System.out.println("Rendering: " + id);

if (id != null) {
if (id.getNamespace().equals("pk")) {
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ out vec2 texCoord0;
uniform mat4 viewMatrix;
uniform mat4 modelMatrix;
uniform mat4 projectionMatrix;
uniform vec2 uvOffset;


uniform mat4 boneTransforms[MAX_BONES];

Expand All @@ -29,6 +31,6 @@ void main() {
mat4 modelTransform = modelMatrix * getBoneTransform();
vec4 worldPosition = modelTransform * vec4(positions, 1.0);

texCoord0 = texcoords;
texCoord0 = texcoords + uvOffset;
gl_Position = worldSpace * worldPosition;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#version 330 core

in vec2 texCoord0;

out vec4 outColor;

uniform sampler2D diffuse;
uniform sampler2D layer;
uniform sampler2D mask;

uniform sampler2D lightmap;
uniform ivec2 light;

//base
uniform vec3 baseColor1;
uniform vec3 baseColor2;
uniform vec3 baseColor3;
uniform vec3 baseColor4;
uniform vec3 baseColor5;

//emi
uniform vec3 emiColor1;
uniform vec3 emiColor2;
uniform vec3 emiColor3;
uniform vec3 emiColor4;
uniform vec3 emiColor5;
uniform float emiIntensity1;
uniform float emiIntensity2;
uniform float emiIntensity3;
uniform float emiIntensity4;
uniform float emiIntensity5;

vec4 adjust(vec4 color) {
color.r = clamp(color.r * 2, 0.0, 1.0);
color.g = clamp(color.g * 2, 0.0, 1.0);
color.b = clamp(color.b * 2, 0.0, 1.0);
color.a = clamp(color.a * 2, 0.0, 1.0);

return color;
}

vec3 emission(vec3 base, vec3 emissionColor, float intensity) {
return base + (emissionColor - base) * intensity;
}

vec4 getColor() {
vec3 color = texture(diffuse, texCoord0).xyz;
vec4 layerMasks = adjust(texture(layer, texCoord0));
vec4 maskColor = adjust(texture(mask, texCoord0));

vec3 base = mix(color, color * baseColor1, layerMasks.r);
base = mix(base, color * baseColor2, layerMasks.g);
base = mix(base, color * baseColor3, layerMasks.b);
base = mix(base, color * baseColor4, layerMasks.a);
base = mix(base, color * baseColor5, maskColor.r);

base = mix(base, emission(base, emiColor1, emiIntensity1), layerMasks.r);
base = mix(base, emission(base, emiColor2, emiIntensity2), layerMasks.g);
base = mix(base, emission(base, emiColor3, emiIntensity3), layerMasks.b);
base = mix(base, emission(base, emiColor4, emiIntensity4), layerMasks.a);
base = mix(base, emission(base, emiColor5, emiIntensity5), maskColor.r);

return vec4(base, 1);
}

vec4 minecraft_sample_lightmap(sampler2D lightMap, ivec2 uv) {
return texture(lightMap, clamp(uv / 256.0, vec2(0.5 / 16.0), vec2(15.5 / 16.0)));
}

void main() {
vec4 color = getColor();
vec4 lightColor = minecraft_sample_lightmap(lightmap, light);

if(color.a < 0.1) {
discard;
}

outColor = color * lightColor;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#version 330 core

in vec2 texCoord0;

out vec4 outColor;

uniform sampler2D diffuse;


void main() {
vec4 color = texture(diffuse, texCoord0);

if(color.a < 0.1) {
discard;
}

outColor = color;
}
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@
]
}
],
"baseScale": 0.5,
"baseScale": 1,
"hitbox": {
"width": 0.8,
"height": 1,
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 5a1d4a5

Please sign in to comment.