use of net.minecraft.util.math.Vec3f in project Skyblocker by LifeIsAParadox.
the class Vertexer method vertexLine.
public static void vertexLine(MatrixStack matrices, VertexConsumer vertexConsumer, float x1, float y1, float z1, float x2, float y2, float z2, LineColor lineColor) {
Matrix4f model = matrices.peek().getPositionMatrix();
Matrix3f normal = matrices.peek().getNormalMatrix();
Vec3f normalVec = getNormal(normal, x1, y1, z1, x2, y2, z2);
int[] color1 = lineColor.getColor(x1, y1, z1, 0);
int[] color2 = lineColor.getColor(x2, y2, z2, 1);
vertexConsumer.vertex(model, x1, y1, z1).color(color1[0], color1[1], color1[2], color1[3]).normal(normal, normalVec.getX(), normalVec.getY(), normalVec.getZ()).next();
vertexConsumer.vertex(model, x2, y2, z2).color(color2[0], color2[1], color2[2], color2[3]).normal(normal, normalVec.getX(), normalVec.getY(), normalVec.getZ()).next();
}
use of net.minecraft.util.math.Vec3f in project BleachHack by BleachDrinker420.
the class Vertexer method vertexLine.
public static void vertexLine(MatrixStack matrices, VertexConsumer vertexConsumer, float x1, float y1, float z1, float x2, float y2, float z2, LineColor lineColor) {
Matrix4f model = matrices.peek().getModel();
Matrix3f normal = matrices.peek().getNormal();
Vec3f normalVec = getNormal(normal, x1, y1, z1, x2, y2, z2);
int[] color1 = lineColor.getColor(x1, y1, z1, 0);
int[] color2 = lineColor.getColor(x2, y2, z2, 1);
vertexConsumer.vertex(model, x1, y1, z1).color(color1[0], color1[1], color1[2], color1[3]).normal(normal, normalVec.getX(), normalVec.getY(), normalVec.getZ()).next();
vertexConsumer.vertex(model, x2, y2, z2).color(color2[0], color2[1], color2[2], color2[3]).normal(normal, normalVec.getX(), normalVec.getY(), normalVec.getZ()).next();
}
use of net.minecraft.util.math.Vec3f in project BleachHack by BleachDrinker420.
the class WorldRenderer method drawGuiItem.
/**
* Draws a 2D gui items somewhere in the world. *
*/
public static void drawGuiItem(double x, double y, double z, double offX, double offY, double scale, ItemStack item) {
if (item.isEmpty()) {
return;
}
MatrixStack matrices = matrixFrom(x, y, z);
Camera camera = mc.gameRenderer.getCamera();
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(-camera.getYaw()));
matrices.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(camera.getPitch()));
matrices.translate(offX, offY, 0);
matrices.scale((float) scale, (float) scale, 0.001f);
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(180f));
mc.getBufferBuilders().getEntityVertexConsumers().draw();
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
Vec3f[] currentLight = shaderLight.clone();
DiffuseLighting.disableGuiDepthLighting();
mc.getItemRenderer().renderItem(item, ModelTransformation.Mode.GUI, 0xF000F0, OverlayTexture.DEFAULT_UV, matrices, mc.getBufferBuilders().getEntityVertexConsumers(), 0);
mc.getBufferBuilders().getEntityVertexConsumers().draw();
RenderSystem.setShaderLights(currentLight[0], currentLight[1]);
RenderSystem.disableBlend();
}
use of net.minecraft.util.math.Vec3f in project fabricskyboxes by AMereBagatelle.
the class SkyboxGenerationTest method init.
@Test
public void init() throws IOException {
DefaultProperties props = new DefaultProperties.Builder().changesFog().rotates().rotation(new Rotation(new Vec3f(0.1F, 0.0F, 0.1F), new Vec3f(0.0F, 0.0F, 0.0F), 1)).maxAlpha(0.99F).transitionSpeed(0.7F).fade(new Fade(1000, 2000, 11000, 12000, false)).build();
Conditions conditions = new Conditions.Builder().biomes(new Identifier("minecraft:plains")).worlds(new Identifier("minecraft:overworld")).weather(Weather.CLEAR).yRanges(new MinMaxEntry(40, 120)).build();
Decorations decorations = new Decorations(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, SpriteAtlasTexture.PARTICLE_ATLAS_TEXTURE, true, true, false, Rotation.DEFAULT);
Gson gson = new GsonBuilder().setPrettyPrinting().serializeNulls().setLenient().create();
this.test(gson, MonoColorSkybox.CODEC, new MonoColorSkybox(props, conditions, decorations, new RGBA(0.5F, 0.8F, 0.6F, 0.99F)));
this.test(gson, SquareTexturedSkybox.CODEC, new SquareTexturedSkybox(props, conditions, decorations, Blend.DEFAULT, new Textures(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, PlayerScreenHandler.EMPTY_BOOTS_SLOT_TEXTURE, PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, PlayerScreenHandler.EMPTY_OFFHAND_ARMOR_SLOT, PlayerScreenHandler.EMPTY_BOOTS_SLOT_TEXTURE, new Identifier("missingno"))));
this.test(gson, AnimatedSquareTexturedSkybox.CODEC, new AnimatedSquareTexturedSkybox(props, conditions, decorations, Blend.DEFAULT, Arrays.asList(new Textures(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, PlayerScreenHandler.EMPTY_BOOTS_SLOT_TEXTURE, PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, PlayerScreenHandler.EMPTY_OFFHAND_ARMOR_SLOT, PlayerScreenHandler.EMPTY_BOOTS_SLOT_TEXTURE, new Identifier("missingno")), new Textures(SpriteAtlasTexture.PARTICLE_ATLAS_TEXTURE, SpriteAtlasTexture.PARTICLE_ATLAS_TEXTURE, SpriteAtlasTexture.PARTICLE_ATLAS_TEXTURE, SpriteAtlasTexture.PARTICLE_ATLAS_TEXTURE, new Identifier("missingno"), SpriteAtlasTexture.PARTICLE_ATLAS_TEXTURE), new Textures(SpriteAtlasTexture.PARTICLE_ATLAS_TEXTURE, PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, SpriteAtlasTexture.PARTICLE_ATLAS_TEXTURE, SpriteAtlasTexture.PARTICLE_ATLAS_TEXTURE, SpriteAtlasTexture.PARTICLE_ATLAS_TEXTURE)), 0.2F));
}
use of net.minecraft.util.math.Vec3f in project wildmod by Osmiooo.
the class ShriekParticleNX2 method buildGeometry.
@Override
public void buildGeometry(VertexConsumer vertexConsumer, Camera camera, float f) {
Vec3d vec3d = camera.getPos();
float g = (float) (MathHelper.lerp((double) f, this.prevPosX, this.x) - vec3d.getX());
float h = (float) (MathHelper.lerp((double) f, this.prevPosY, this.y) - vec3d.getY());
float i = (float) (MathHelper.lerp((double) f, this.prevPosZ, this.z) - vec3d.getZ());
Quaternion quaternion;
quaternion = new Quaternion(-0.2F, -0.8F, -0.8F, -0.2F);
Vec3f j = new Vec3f(-1.0F, -1.0F, 0.0F);
j.rotate(quaternion);
Vec3f[] vec3fs = new Vec3f[] { new Vec3f(-1.0F, -1.0F, 0.0F), new Vec3f(-1.0F, 1.0F, 0.0F), new Vec3f(1.0F, 1.0F, 0.0F), new Vec3f(1.0F, -1.0F, 0.0F) };
float k = this.getSize(f);
for (int l = 0; l < 4; ++l) {
Vec3f vec3f = vec3fs[l];
vec3f.rotate(quaternion);
vec3f.scale((float) (((this.age) / (9.8)) / 7));
vec3f.add(g, h, i);
this.setAlpha((float) (this.age - this.maxAge) * 6);
}
float l = this.getMinU();
float vec3f = this.getMaxU();
float m = this.getMinV();
float n = this.getMaxV();
int o = this.getBrightness(f);
vertexConsumer.vertex((double) vec3fs[0].getX(), (double) vec3fs[0].getY(), (double) vec3fs[0].getZ()).texture(vec3f, n).color(this.red, this.green, this.blue, this.alpha).light(o).next();
vertexConsumer.vertex((double) vec3fs[1].getX(), (double) vec3fs[1].getY(), (double) vec3fs[1].getZ()).texture(vec3f, m).color(this.red, this.green, this.blue, this.alpha).light(o).next();
vertexConsumer.vertex((double) vec3fs[2].getX(), (double) vec3fs[2].getY(), (double) vec3fs[2].getZ()).texture(l, m).color(this.red, this.green, this.blue, this.alpha).light(o).next();
vertexConsumer.vertex((double) vec3fs[3].getX(), (double) vec3fs[3].getY(), (double) vec3fs[3].getZ()).texture(l, n).color(this.red, this.green, this.blue, this.alpha).light(o).next();
}
Aggregations