Skip to content

Commit

Permalink
replaced tabs with spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
Cubitect committed Oct 3, 2016
1 parent 7687a0a commit c896e5c
Show file tree
Hide file tree
Showing 13 changed files with 397 additions and 397 deletions.
156 changes: 78 additions & 78 deletions Templates/asmrender/ASMRender.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@
public class ASMRender
{
public static Minecraft minecraft = Minecraft.getMinecraft();
static boolean gl_lighting;
static boolean gl_texture_2d;
static boolean gl_point_smooth;
static boolean gl_line_smooth;
static boolean gl_depth_test;
static boolean gl_blend;
static float gl_point_size;
static float gl_line_width;
static int gl_blend_src;
static int gl_blend_dst;
static boolean gl_lighting;
static boolean gl_texture_2d;
static boolean gl_point_smooth;
static boolean gl_line_smooth;
static boolean gl_depth_test;
static boolean gl_blend;
static float gl_point_size;
static float gl_line_width;
static int gl_blend_src;
static int gl_blend_dst;
public static void translate(float x, float y, float z)
{
GL11.glTranslatef(-x, -y, -z);
Expand All @@ -30,9 +30,9 @@ public static void translate(float x, float y, float z)
private static void setGLConst(int glconst, boolean value)
{
if(value)
GL11.glEnable(glconst);
GL11.glEnable(glconst);
else
GL11.glDisable(glconst);
GL11.glDisable(glconst);
}

public static void setup(boolean doDepth)
Expand Down Expand Up @@ -63,23 +63,23 @@ public static void setup(boolean doDepth)

public static void restore()
{
setGLConst(GL11.GL_LIGHTING, gl_lighting);
setGLConst(GL11.GL_TEXTURE_2D, gl_texture_2d);
setGLConst(GL11.GL_POINT_SMOOTH, gl_point_smooth);
setGLConst(GL11.GL_LINE_SMOOTH, gl_line_smooth);
setGLConst(GL11.GL_DEPTH_TEST, gl_depth_test);
setGLConst(GL11.GL_BLEND, gl_blend);
GL11.glBlendFunc(gl_blend_src, gl_blend_dst);
setGLConst(GL11.GL_LIGHTING, gl_lighting);
setGLConst(GL11.GL_TEXTURE_2D, gl_texture_2d);
setGLConst(GL11.GL_POINT_SMOOTH, gl_point_smooth);
setGLConst(GL11.GL_LINE_SMOOTH, gl_line_smooth);
setGLConst(GL11.GL_DEPTH_TEST, gl_depth_test);
setGLConst(GL11.GL_BLEND, gl_blend);
GL11.glBlendFunc(gl_blend_src, gl_blend_dst);
GL11.glLineWidth(gl_line_width);
GL11.glPointSize(gl_point_size);
GL11.glPopMatrix();
}

public static void drawLine(float startx, float starty, float startz, float endx, float endy, float endz, Color color, float width)
{
GL11.glColor3f(color.getRed()/255.0F, color.getGreen()/255.0F, color.getBlue()/255.0F);
GL11.glColor3f(color.getRed()/255.0F, color.getGreen()/255.0F, color.getBlue()/255.0F);
GL11.glLineWidth(width);
GL11.glBegin(GL11.GL_LINE_STRIP);
GL11.glVertex3f(startx, starty, startz);
Expand All @@ -89,7 +89,7 @@ public static void drawLine(float startx, float starty, float startz, float endx

public static void drawBox(float ax, float ay, float az, float bx, float by, float bz, Color color, float width)
{
GL11.glColor3f(color.getRed()/255.0F, color.getGreen()/255.0F, color.getBlue()/255.0F);
GL11.glColor3f(color.getRed()/255.0F, color.getGreen()/255.0F, color.getBlue()/255.0F);
GL11.glLineWidth(width);

GL11.glBegin(GL11.GL_LINE_STRIP);
Expand Down Expand Up @@ -126,58 +126,58 @@ public static void drawBox(float ax, float ay, float az, float bx, float by, flo

private static void drawBoxPart(float args[][], int m[][])
{
GL11.glBegin(GL11.GL_QUADS);
for(int i = 0; i < m.length; i++)
GL11.glVertex3f(args[m[i][0]][0], args[m[i][1]][1], args[m[i][2]][2]);
GL11.glEnd();
GL11.glBegin(GL11.GL_QUADS);
for(int i = 0; i < m.length; i++)
GL11.glVertex3f(args[m[i][0]][0], args[m[i][1]][1], args[m[i][2]][2]);
GL11.glEnd();
}

public static void drawBoxWalls(float ax, float ay, float az, float bx, float by, float bz, Color color, float alpha)
{
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
GL11.glDepthMask(false);
GL11.glColor4f(color.getRed()/255.0F, color.getGreen()/255.0F, color.getBlue()/255.0F, alpha);
float args[][] = new float[][] { {ax,ay,az}, {bx,by,bz} };
// Outside
drawBoxPart(args, new int[][] {{0,0,0},{0,0,1},{0,1,1},{0,1,0}}); // Neg X
drawBoxPart(args, new int[][] {{1,0,0},{1,1,0},{1,1,1},{1,0,1}}); // Pos X
drawBoxPart(args, new int[][] {{0,0,0},{1,0,0},{1,0,1},{0,0,1}}); // Neg Y
drawBoxPart(args, new int[][] {{0,1,0},{0,1,1},{1,1,1},{1,1,0}}); // Pos Y
drawBoxPart(args, new int[][] {{0,0,0},{0,1,0},{1,1,0},{1,0,0}}); // Neg Z
drawBoxPart(args, new int[][] {{0,0,1},{1,0,1},{1,1,1},{0,1,1}}); // Pos Z
// Inside
drawBoxPart(args, new int[][] {{0,0,0},{0,1,0},{0,1,1},{0,0,1}}); // Neg X
drawBoxPart(args, new int[][] {{1,0,0},{1,0,1},{1,1,1},{1,1,0}}); // Pos X
drawBoxPart(args, new int[][] {{0,0,0},{0,0,1},{1,0,1},{1,0,0}}); // Neg Y
drawBoxPart(args, new int[][] {{0,1,0},{1,1,0},{1,1,1},{0,1,1}}); // Pos Y
drawBoxPart(args, new int[][] {{0,0,0},{1,0,0},{1,1,0},{0,1,0}}); // Neg Z
drawBoxPart(args, new int[][] {{0,0,1},{0,1,1},{1,1,1},{1,0,1}}); // Pos Z
GL11.glDepthMask(true);
GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ZERO);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
GL11.glDepthMask(false);
GL11.glColor4f(color.getRed()/255.0F, color.getGreen()/255.0F, color.getBlue()/255.0F, alpha);
float args[][] = new float[][] { {ax,ay,az}, {bx,by,bz} };
// Outside
drawBoxPart(args, new int[][] {{0,0,0},{0,0,1},{0,1,1},{0,1,0}}); // Neg X
drawBoxPart(args, new int[][] {{1,0,0},{1,1,0},{1,1,1},{1,0,1}}); // Pos X
drawBoxPart(args, new int[][] {{0,0,0},{1,0,0},{1,0,1},{0,0,1}}); // Neg Y
drawBoxPart(args, new int[][] {{0,1,0},{0,1,1},{1,1,1},{1,1,0}}); // Pos Y
drawBoxPart(args, new int[][] {{0,0,0},{0,1,0},{1,1,0},{1,0,0}}); // Neg Z
drawBoxPart(args, new int[][] {{0,0,1},{1,0,1},{1,1,1},{0,1,1}}); // Pos Z
// Inside
drawBoxPart(args, new int[][] {{0,0,0},{0,1,0},{0,1,1},{0,0,1}}); // Neg X
drawBoxPart(args, new int[][] {{1,0,0},{1,0,1},{1,1,1},{1,1,0}}); // Pos X
drawBoxPart(args, new int[][] {{0,0,0},{0,0,1},{1,0,1},{1,0,0}}); // Neg Y
drawBoxPart(args, new int[][] {{0,1,0},{1,1,0},{1,1,1},{0,1,1}}); // Pos Y
drawBoxPart(args, new int[][] {{0,0,0},{1,0,0},{1,1,0},{0,1,0}}); // Neg Z
drawBoxPart(args, new int[][] {{0,0,1},{0,1,1},{1,1,1},{1,0,1}}); // Pos Z
GL11.glDepthMask(true);
GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ZERO);
GL11.glDisable(GL11.GL_BLEND);
}

public static void drawSphere(float cx, float cy, float cz, double rad, int sphereSegments, Color color, float width)
{
GL11.glColor3f(color.getRed()/255.0F, color.getGreen()/255.0F, color.getBlue()/255.0F);
GL11.glColor3f(color.getRed()/255.0F, color.getGreen()/255.0F, color.getBlue()/255.0F);
GL11.glPointSize(width);

final double dPhi = 2*Math.PI / sphereSegments;

for(double phi = 0.0; phi < 2*Math.PI; phi += dPhi)
{
double sinPhi = Math.sin(phi);
double dTheta = Math.PI / (1 + (int)(sphereSegments * Math.abs(sinPhi/2)));
GL11.glBegin(GL11.GL_POINTS);
double sinPhi = Math.sin(phi);
double dTheta = Math.PI / (1 + (int)(sphereSegments * Math.abs(sinPhi/2)));
GL11.glBegin(GL11.GL_POINTS);
for(double theta = 0.0; theta < Math.PI; theta += dTheta)
{
float dx = (float)(rad * sinPhi * Math.cos(theta));
Expand All @@ -193,15 +193,15 @@ public static void drawSphere(float cx, float cy, float cz, double rad, int sphe

public static void updateSphereBuf(int sphereSegments)
{
float dvec[][] = new float[1+(int)(sphereSegments*sphereSegments*Math.PI/4.0)][];
int dveclen = 0;
float dvec[][] = new float[1+(int)(sphereSegments*sphereSegments*Math.PI/4.0)][];
int dveclen = 0;
double dPhi = 2*Math.PI / sphereSegments;

for(double phi = 0.0; phi < 2*Math.PI; phi += dPhi)
{
double sinPhi = Math.sin(phi);
double dTheta = Math.PI / (1 + (int)(sphereSegments * Math.abs(sinPhi/2)));
double sinPhi = Math.sin(phi);
double dTheta = Math.PI / (1 + (int)(sphereSegments * Math.abs(sinPhi/2)));
for(double theta = 0.0; theta < Math.PI; theta += dTheta)
{
float dx = (float)(sinPhi * Math.cos(theta));
Expand All @@ -213,19 +213,19 @@ public static void updateSphereBuf(int sphereSegments)

sphereBufDVec = new float[dveclen][];
for(int i = 0; i < dveclen; i++)
sphereBufDVec[i] = dvec[i];
sphereBufDVec[i] = dvec[i];
}

public static void drawBufferedSphere(float cx, float cy, float cz, float rad, Color color, float width)
{
GL11.glColor3f(color.getRed()/255.0F, color.getGreen()/255.0F, color.getBlue()/255.0F);
GL11.glColor3f(color.getRed()/255.0F, color.getGreen()/255.0F, color.getBlue()/255.0F);
GL11.glPointSize(width);

int cnt = 0;
GL11.glBegin(GL11.GL_POINTS);
for(float unitvec[] : sphereBufDVec)
{
GL11.glVertex3f(cx+unitvec[0]*rad, cy+unitvec[1]*rad, cz+unitvec[2]*rad);
GL11.glVertex3f(cx+unitvec[0]*rad, cy+unitvec[1]*rad, cz+unitvec[2]*rad);
}
GL11.glEnd();
}
Expand All @@ -237,13 +237,13 @@ public static void markBlock(String[] text, float x, float y, float z, Color col
GL11.glPushMatrix();
GL11.glTranslatef(x, y, z);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
GL11.glColor4f(
(color.getRed() / 255.0f) * alpha,
(color.getBlue() / 255.0f) * alpha,
(color.getGreen() / 255.0f) * alpha,
alpha);
(color.getRed() / 255.0f) * alpha,
(color.getBlue() / 255.0f) * alpha,
(color.getGreen() / 255.0f) * alpha,
alpha);


int lineHeight = 10;
Expand All @@ -264,7 +264,7 @@ public static void markBlock(String[] text, float x, float y, float z, Color col

GL11.glTranslatef(0f, 0f, 0f);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
}
6 changes: 3 additions & 3 deletions Templates/asmtick/ASMTick.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ public static long serverSleep(long ms)

if(sleepLock)
{
try {
try {
Thread.sleep(ms2Tick);
} catch (InterruptedException e) {
e.printStackTrace();
}
return 0;
}
return 0;
}

do {
try {
Expand Down
Loading

0 comments on commit c896e5c

Please sign in to comment.