Commit bf82da44 authored by Human Gamer's avatar Human Gamer

Test of Texture UVs

parent 61986e36
......@@ -4,11 +4,14 @@ import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JOptionPane;
import com.matt.difinspector.interior.Interior;
import com.matt.difinspector.interior.InteriorSimpleMesh;
import com.matt.difinspector.interior.InteriorSubObject;
import com.matt.difinspector.main.DifInspector;
import com.matt.difinspector.materials.MaterialList;
import com.matt.difinspector.materials.TexData;
import com.matt.difinspector.materials.TexGenList;
import com.matt.difinspector.structures.AnimatedLight;
import com.matt.difinspector.structures.BSPNode;
......@@ -31,6 +34,8 @@ import com.matt.difinspector.structures.TexMatrix;
import com.matt.difinspector.structures.TriFan;
import com.matt.difinspector.structures.TriangleF;
import com.matt.difinspector.structures.Zone;
import com.matt.difinspector.util.ImageData;
import com.matt.difinspector.util.Util;
import com.matt.jmatt.lists.OptimizedList;
public class InteriorBuilder
......@@ -94,8 +99,9 @@ public class InteriorBuilder
OptimizedList<Point2F> texCoords = new OptimizedList<Point2F>(mesh.getTextureCoords(), mesh.getTexCoordIndices());
OptimizedList<TexGenPlanes> texGenEQs = new OptimizedList<TexGenPlanes>();
for (Point2F uv : texCoords)
for (int i = 0; i < texCoords.sizeIndices(); i++)
{
Point2F uv = texCoords.getObject(i);
TexGenPlanes texGenPlanes = new TexGenPlanes(uv);
texGenEQs.add(texGenPlanes);
}
......@@ -139,9 +145,40 @@ public class InteriorBuilder
String texture = mesh.getTextures()[textureIndices[i]];
Face face = new Face(p1, p2, p3, texture, texGenEQs.getObject(i));
// temporary texture stuff
/*float xs;
float ys;
if (texture.equalsIgnoreCase("edge_white"))
{
xs = 0.125f;
ys = 0.125f;
} else {
xs = 0.25f;
ys = 0.25f;
}
TexData data = new TexData(face.getPlane(), new Point2F(0, 0), 0, new Point2F(xs, ys));
ImageData texture1 = ImageData.loadImage("textures/" + texture);
TexGenPlanes planes;
if (texture1 == null)
{
planes = new TexGenPlanes();
} else {
planes = Util.getTexGen(data, texture1);
}
texGenEQs.add(planes);
face.setTexGen(planes);*/
faces.add(face);
}
//temp
TexGenList texGenList2 = new TexGenList();
for (TexGenPlanes planes : texGenEQs.getObjects())
texGenList2.add(planes);
result.setTexGenEQs(texGenList2);
/*System.out.print("Windings: ");
for (int i = 0; i < mesh.getIndices().length; i++)
{
......@@ -194,7 +231,7 @@ public class InteriorBuilder
int windingCount = 3;
short planeIndex = (short)planes.indexOfObject(face.getPlane());
short textureIndex = (short)textures.indexOfObject(face.getTexture());
int texGenIndex = texGenEQs.indexOfIndex(face.getTexGen());
int texGenIndex = texGenEQs.indexOfObject(face.getTexGen());
short lightCount = 0;
byte surfaceFlags = 16;
int fanMask = 15;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment