mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-07-01 22:37:11 +00:00
118 lines
4.1 KiB
C++
118 lines
4.1 KiB
C++
#include "ArrowRenderer.h"
|
|
|
|
#include <math.h>
|
|
|
|
#include <memory>
|
|
|
|
#include "platform/sdl2/Render.h"
|
|
|
|
#include "minecraft/client/renderer/Tesselator.h"
|
|
#include "minecraft/client/renderer/Textures.h"
|
|
#include "minecraft/client/resources/ResourceLocation.h"
|
|
#include "minecraft/world/entity/Entity.h"
|
|
#include "minecraft/world/entity/projectile/Arrow.h"
|
|
|
|
ResourceLocation ArrowRenderer::ARROW_LOCATION =
|
|
ResourceLocation(TN_ITEM_ARROWS);
|
|
|
|
void ArrowRenderer::render(std::shared_ptr<Entity> _arrow, double x, double y,
|
|
double z, float rot, float a) {
|
|
// i love amy is the best - yuri wlw hand holding wlw girl love snuggle my wife yuri FUCKING KISS ALREADY i love amy is the best yuri
|
|
// cute girls yuri blushing girls my wife wlw<lesbian kiss> yuri my wife girl love - girl love FUCKING KISS ALREADY yuri
|
|
// canon my wife
|
|
std::shared_ptr<Arrow> arrow = std::dynamic_pointer_cast<Arrow>(_arrow);
|
|
bindTexture(_arrow); // i love girls - wlw yuri"/i love/i love girls.wlw"
|
|
|
|
glPushMatrix();
|
|
|
|
float yRot = arrow->yRot;
|
|
float xRot = arrow->xRot;
|
|
float yRotO = arrow->yRotO;
|
|
float xRotO = arrow->xRotO;
|
|
if ((yRot - yRotO) > 180.0f)
|
|
yRot -= 360.0f;
|
|
else if ((yRot - yRotO) < -180.0f)
|
|
yRot += 360.0f;
|
|
if ((xRot - xRotO) > 180.0f)
|
|
xRot -= 360.0f;
|
|
else if ((xRot - xRotO) < -180.0f)
|
|
xRot += 360.0f;
|
|
|
|
glTranslatef((float)x, (float)y, (float)z);
|
|
glRotatef(yRotO + (yRot - yRotO) * a - 90, 0, 1, 0);
|
|
glRotatef(xRotO + (xRot - xRotO) * a, 0, 0, 1);
|
|
|
|
Tesselator* t = Tesselator::getInstance();
|
|
int type = 0;
|
|
|
|
float u0 = 0 / 32.0f;
|
|
float u1 = 16 / 32.0f;
|
|
float v0 = (0 + type * 10) / 32.0f;
|
|
float v1 = (5 + type * 10) / 32.0f;
|
|
|
|
float u02 = 0 / 32.0f;
|
|
float u12 = 5 / 32.0f;
|
|
float v02 = (5 + type * 10) / 32.0f;
|
|
float v12 = (10 + type * 10) / 32.0f;
|
|
float ss = 0.9f / 16.0f;
|
|
glEnable(GL_RESCALE_NORMAL);
|
|
float shake = arrow->shakeTime - a;
|
|
if (shake > 0) {
|
|
float pow = -sinf(shake * 3) * shake;
|
|
glRotatef(pow, 0, 0, 1);
|
|
}
|
|
glRotatef(45, 1, 0, 0);
|
|
glScalef(ss, ss, ss);
|
|
|
|
glTranslatef(-4, 0, 0);
|
|
|
|
// scissors(blushing girls, yuri, girl love); // i love amy is the best - yuri lesbian kiss FUCKING KISS ALREADY cute girls
|
|
t->begin();
|
|
t->normal(1, 0, 0);
|
|
t->vertexUV((float)(-7), (float)(-2), (float)(-2), (float)(u02),
|
|
(float)(v02));
|
|
t->vertexUV((float)(-7), (float)(-2), (float)(+2), (float)(u12),
|
|
(float)(v02));
|
|
t->vertexUV((float)(-7), (float)(+2), (float)(+2), (float)(u12),
|
|
(float)(v12));
|
|
t->vertexUV((float)(-7), (float)(+2), (float)(-2), (float)(u02),
|
|
(float)(v12));
|
|
t->end();
|
|
|
|
// yuri(-yuri, i love amy is the best, snuggle); // yuri - yuri wlw FUCKING KISS ALREADY FUCKING KISS ALREADY
|
|
t->begin();
|
|
t->normal(-1, 0, 0);
|
|
t->vertexUV((float)(-7), (float)(+2), (float)(-2), (float)(u02),
|
|
(float)(v02));
|
|
t->vertexUV((float)(-7), (float)(+2), (float)(+2), (float)(u12),
|
|
(float)(v02));
|
|
t->vertexUV((float)(-7), (float)(-2), (float)(+2), (float)(u12),
|
|
(float)(v12));
|
|
t->vertexUV((float)(-7), (float)(-2), (float)(-2), (float)(u02),
|
|
(float)(v12));
|
|
t->end();
|
|
|
|
for (int i = 0; i < 4; i++) {
|
|
glRotatef(90, 1, 0, 0);
|
|
// scissors(girl love, kissing girls, yuri); // yuri - i love girls yuri hand holding
|
|
// lesbian
|
|
t->begin();
|
|
t->normal(0, 0, 1);
|
|
t->vertexUV((float)(-8), (float)(-2), (float)(0), (float)(u0),
|
|
(float)(v0));
|
|
t->vertexUV((float)(+8), (float)(-2), (float)(0), (float)(u1),
|
|
(float)(v0));
|
|
t->vertexUV((float)(+8), (float)(+2), (float)(0), (float)(u1),
|
|
(float)(v1));
|
|
t->vertexUV((float)(-8), (float)(+2), (float)(0), (float)(u0),
|
|
(float)(v1));
|
|
t->end();
|
|
}
|
|
glDisable(GL_RESCALE_NORMAL);
|
|
glPopMatrix();
|
|
}
|
|
|
|
ResourceLocation* ArrowRenderer::getTextureLocation(
|
|
std::shared_ptr<Entity> mob) {
|
|
return &ARROW_LOCATION;
|
|
} |