mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-06-22 15:55:33 +00:00
restructure codebase according to vcproj filters
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
#include "../../../../../../Minecraft.World/Header Files/stdafx.h"
|
||||
#include "SlimeRenderer.h"
|
||||
#include "../../../../../../Minecraft.World/net/minecraft/world/entity/monster/net.minecraft.world.entity.monster.h"
|
||||
|
||||
ResourceLocation SlimeRenderer::SLIME_LOCATION = ResourceLocation(TN_MOB_SLIME);
|
||||
|
||||
SlimeRenderer::SlimeRenderer(Model* model, Model* armor, float shadow)
|
||||
: MobRenderer(model, shadow) {
|
||||
this->armor = armor;
|
||||
}
|
||||
|
||||
int SlimeRenderer::prepareArmor(std::shared_ptr<LivingEntity> _slime, int layer,
|
||||
float a) {
|
||||
// 4J - dynamic cast required because we aren't using templates/generics in
|
||||
// our version
|
||||
std::shared_ptr<Slime> slime = std::dynamic_pointer_cast<Slime>(_slime);
|
||||
|
||||
if (slime->isInvisible()) {
|
||||
return 0;
|
||||
}
|
||||
if (layer == 0) {
|
||||
setArmor(armor);
|
||||
|
||||
glEnable(GL_NORMALIZE);
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
return 1;
|
||||
}
|
||||
if (layer == 1) {
|
||||
glDisable(GL_BLEND);
|
||||
glColor4f(1, 1, 1, 1);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void SlimeRenderer::scale(std::shared_ptr<LivingEntity> _slime, float a) {
|
||||
// 4J - dynamic cast required because we aren't using templates/generics in
|
||||
// our version
|
||||
std::shared_ptr<Slime> slime = std::dynamic_pointer_cast<Slime>(_slime);
|
||||
|
||||
float size = (float)slime->getSize();
|
||||
float ss = (slime->oSquish + (slime->squish - slime->oSquish) * a) /
|
||||
(size * 0.5f + 1);
|
||||
float w = 1 / (ss + 1);
|
||||
glScalef(w * size, 1 / w * size, w * size);
|
||||
}
|
||||
|
||||
ResourceLocation* SlimeRenderer::getTextureLocation(
|
||||
std::shared_ptr<Entity> mob) {
|
||||
return &SLIME_LOCATION;
|
||||
}
|
||||
Reference in New Issue
Block a user