use of am2.api.math.AMVector3 in project ArsMagica2 by Mithion.
the class AMRibbon method draw.
void draw() {
ribbonTarget = new AMVector3(random(-movement, movement), random(-movement, movement), random(-movement, movement));
ribbonSeparation = lerp(-MAXSEPARATION, MAXSEPARATION, noise.noise1(noisePosn += NOISESTEP));
currentCurve.addSegment();
int size = curves.size();
if (size > NUMCURVES - 1) {
RibbonCurve c = (RibbonCurve) curves.get(0);
c.removeSegment();
}
stepId++;
if (stepId > CURVERESOLUTION)
addRibbonCurve();
// draw curves
for (int i = 0; i < size; i++) {
RibbonCurve c = (RibbonCurve) curves.get(i);
c.draw();
}
}
use of am2.api.math.AMVector3 in project ArsMagica2 by Mithion.
the class AMRibbon method addRibbonCurve.
void addRibbonCurve() {
// add new point
pts.addElement(getRandPt());
AMVector3 nextPt = (AMVector3) pts.elementAt(pts.size() - 1);
AMVector3 curPt = (AMVector3) pts.elementAt(pts.size() - 2);
AMVector3 lastPt = (AMVector3) pts.elementAt(pts.size() - 3);
AMVector3 lastMidPt = new AMVector3((curPt.x + lastPt.x) / 2, (curPt.y + lastPt.y) / 2, (curPt.z + lastPt.z) / 2);
AMVector3 midPt = new AMVector3((curPt.x + nextPt.x) / 2, (curPt.y + nextPt.y) / 2, (curPt.z + nextPt.z) / 2);
/*float width = 0.00003F * (getRelativeViewVector(midPt).length()) * 1.5f;
if (width > 0.2f)
width = 0.2f;
if (width < 0.1f)
width = 0.1f;*/
float width = 0.2f;
currentCurve = new RibbonCurve(lastMidPt, midPt, curPt, width, CURVERESOLUTION, ribbonColor);
curves.add(currentCurve);
// remove old curves
if (curves.size() > NUMCURVES) {
curves.removeFirst();
}
stepId = 0;
}
use of am2.api.math.AMVector3 in project ArsMagica2 by Mithion.
the class Quad3D method calcNormal.
void calcNormal(AMVector3 v1, AMVector3 v2, AMVector3 v3) {
float Qx, Qy, Qz, Px, Py, Pz;
Qx = v2.x - v1.x;
Qy = v2.y - v1.y;
Qz = v2.z - v1.z;
Px = v3.x - v1.x;
Py = v3.y - v1.y;
Pz = v3.z - v1.z;
normal = new AMVector3(Py * Qz - Pz * Qy, Pz * Qx - Px * Qz, Px * Qy - Py * Qx);
}
use of am2.api.math.AMVector3 in project ArsMagica2 by Mithion.
the class Quad3D method draw.
void draw() {
// noStroke();
// GL11.glBegin(GL11.GL_QUADS);
Tessellator t = Tessellator.instance;
t.startDrawingQuads();
t.setBrightness(0xF00F0);
t.addVertexWithUV(p0.x, p0.y, p0.z, icon.getMinU(), icon.getMinV());
t.addVertexWithUV(p1.x, p1.y, p1.z, icon.getMaxU(), icon.getMinV());
t.addVertexWithUV(p2.x, p2.y, p2.z, icon.getMaxU(), icon.getMaxV());
t.addVertexWithUV(p3.x, p3.y, p3.z, icon.getMinU(), icon.getMaxV());
t.draw();
if (AMCore.config.FullGFX()) {
double off = 0.005;
t.startDrawingQuads();
t.setBrightness(0xF00F0);
GL11.glColor4f(0, 0.5f, 1.0f, 0.6f);
t.addVertexWithUV(p0.x + off, p0.y + off, p0.z + off, icon.getMinU(), icon.getMinV());
t.addVertexWithUV(p1.x + off, p1.y + off, p1.z + off, icon.getMaxU(), icon.getMinV());
t.addVertexWithUV(p2.x + off, p2.y + off, p2.z + off, icon.getMaxU(), icon.getMaxV());
t.addVertexWithUV(p3.x + off, p3.y + off, p3.z + off, icon.getMinU(), icon.getMaxV());
t.draw();
GL11.glColor4f(1, 1, 1, 0.6f);
}
double mul = 0.0025;
double halfMul = 0.00125;
AMVector3 vecOffset = new AMVector3(rand.nextDouble() * mul - halfMul, rand.nextDouble() * mul - halfMul, rand.nextDouble() * mul - halfMul);
p0.add(vecOffset);
p1.add(vecOffset);
p2.add(vecOffset);
p3.add(vecOffset);
}
use of am2.api.math.AMVector3 in project ArsMagica2 by Mithion.
the class AffinityData method onAffinityAbility.
public void onAffinityAbility() {
if (getAffinityDepth(Affinity.ENDER) >= 0.75) {
if (this.entity.isSneaking()) {
this.hasActivatedNightVision = !this.hasActivatedNightVision;
} else {
if (this.lastGroundPosition != null) {
if (positionIsValid(lastGroundPosition)) {
spawnParticlesAt(lastGroundPosition);
spawnParticlesAt(new AMVector3(entity));
this.entity.setPosition(this.lastGroundPosition.x, this.lastGroundPosition.y + 1, this.lastGroundPosition.z);
ExtendedProperties.For((EntityLivingBase) this.entity).setFallProtection(20000);
this.entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, "mob.endermen.portal", 1.0F, 1.0F);
this.setCooldown(AMCore.config.getEnderAffinityAbilityCooldown());
} else {
((EntityPlayer) this.entity).addChatMessage(new ChatComponentText("am2.affinity.enderTPFailed"));
}
} else {
((EntityPlayer) this.entity).addChatMessage(new ChatComponentText("am2.affinity.enderTPFailed"));
}
}
}
// beyond here we can handle other affinities that have activatable abilities
}
Aggregations