2026-03-01 12:16:08 +08:00
|
|
|
#include "stdafx.h"
|
|
|
|
|
#include "GhastRenderer.h"
|
|
|
|
|
#include "GhastModel.h"
|
|
|
|
|
#include "..\Minecraft.World\net.minecraft.world.entity.monster.h"
|
|
|
|
|
|
2026-03-03 03:04:10 +08:00
|
|
|
ResourceLocation GhastRenderer::GHAST_LOCATION = ResourceLocation(TN_MOB_GHAST);
|
|
|
|
|
ResourceLocation GhastRenderer::GHAST_SHOOTING_LOCATION = ResourceLocation(TN_MOB_GHAST_FIRE);
|
|
|
|
|
|
2026-03-01 12:16:08 +08:00
|
|
|
GhastRenderer::GhastRenderer() : MobRenderer(new GhastModel(), 0.5f)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-03 03:04:10 +08:00
|
|
|
void GhastRenderer::scale(shared_ptr<LivingEntity> mob, float a)
|
2026-03-01 12:16:08 +08:00
|
|
|
{
|
2026-03-02 17:37:16 +07:00
|
|
|
shared_ptr<Ghast> ghast = dynamic_pointer_cast<Ghast>(mob);
|
|
|
|
|
|
2026-03-01 12:16:08 +08:00
|
|
|
float ss = (ghast->oCharge+(ghast->charge-ghast->oCharge)*a)/20.0f;
|
|
|
|
|
if (ss<0) ss = 0;
|
|
|
|
|
ss = 1/(ss*ss*ss*ss*ss*2+1);
|
|
|
|
|
float s = (8+ss)/2;
|
|
|
|
|
float hs = (8+1/ss)/2;
|
|
|
|
|
glScalef(hs, s, hs);
|
|
|
|
|
glColor4f(1, 1, 1, 1);
|
2026-03-03 03:04:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ResourceLocation *GhastRenderer::getTextureLocation(shared_ptr<Entity> mob)
|
|
|
|
|
{
|
|
|
|
|
shared_ptr<Ghast> ghast = dynamic_pointer_cast<Ghast>(mob);
|
|
|
|
|
|
|
|
|
|
if (ghast->isCharging())
|
|
|
|
|
{
|
|
|
|
|
return &GHAST_SHOOTING_LOCATION;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return &GHAST_LOCATION;
|
2026-03-01 12:16:08 +08:00
|
|
|
}
|