Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - AGP

Pages: [1] 2 3 ... 15
Bones / getBindPose() is Late
« on: July 07, 2018, 08:32:52 pm »
Can I forcefully update it in order to have an item keep up with my character's hand?

Support / Asymmetrical Scaling
« on: June 21, 2018, 06:24:00 am »
I'm trying to create a flickering glow. To that end, I wrote the following thickening method in a vertex controller. The problem happens when the base object, from which the glow object is created, is rotated because the glow appears to be modified in worldspace as opposed to in objectspace. What should I do to calculate the x/z distortion in objectspace?

Code: [Select]
     public void thicken(final float deltaTime) {
SimpleVector[] vertices = this.getSourceMesh();
SimpleVector[] destination = this.getDestinationMesh();
for (int i = 0; i < vertices.length; i++) {
     SimpleVector v = vertices[i];
     v.x *= (1f+deltaTime);
     v.z *= (1f+deltaTime);
     destination[i] = v;

...of keyframes? You should put that in the docs.

For now, I'm going to assume that it is. ; )

Projects / 3ds Max OBJ Animation
« on: June 04, 2018, 06:43:14 pm »
I called this MergeAndSerialize because it first exports each frame of your character's animation as an OBJ (I did not write the included MaxScript), then it creates a single serialized file with a jpct animation. Hope it helps someone else:

Support / Merging OBJ Frames
« on: May 30, 2018, 11:49:33 am »
I'm about to post a little project for anyone unable to export either Ogre or MD2-animated versions of their models but are able to export OBJ or 3ds. I found a little maxscript that automates the exporting of the frames, and I'm writing the jpct end of it. Problem is I keep getting a size difference of 1 between frame 1 and all the rest ("ERROR: The sizes of the Animation's Meshes (26938) and the object's Mesh (26937) don't match!").

Code: [Select]
Written by AGP (BR) on May, 2018
import com.threed.jpct.*;

public class MergeAndSerialize {
     public static void main(String[] args) {
float SCALE = 3.6f;
String animationName = "Idle";
if (args == null || args.length < 1) {
     System.err.println("USAGE: java MergeAndSerialize [baseFileName] where the file name needs no extension.\nFOR OBJs ONLY.");
String fileName = args[0].trim();
FilenameFilter filter = new FilenameFilter() {
     public boolean accept(File dir, String name) {
return (name.startsWith(fileName) && name.toLowerCase().endsWith(".obj"));
String[] frames = new File("./").list(filter);
Object3D model = Object3D.mergeAll(Loader.loadOBJ(frames[0], frames[0].substring(0, frames[0].lastIndexOf("."))+".mtl", SCALE));
Animation animation = new Animation(frames.length);
System.out.println("\n\n\nFrames length: "+frames.length);;
for (int i = 1; i < frames.length; i++) {
System.out.println("I: "+i);
     Object3D frame = Object3D.mergeAll(Loader.loadOBJ(frames[i], frames[i].substring(0, frames[i].lastIndexOf("."))+".mtl", SCALE));;
     Mesh mesh = frame.getMesh();
try {
     new DeSerializer().serialize(model, new, fileName.lastIndexOf("."))+".serialized"), false);
catch ( ex) {System.err.println("Trouble saving file: "+ex.getMessage());}

Bones / Parsing SkinClipSequence
« on: May 04, 2018, 10:51:28 pm »
Since EasyOgreExporter exports all clips into a single animation, I'm forced to write a parser. How, then, might I split a SkinClipSequence of one SkinClip into a SkinClipSequence of two or more?

Support / Now this looks like a Java 10 Thing
« on: April 29, 2018, 11:45:19 pm »
I was working a while ago on this fire particle system. I don't remember the rendering getting clipped like this.

Code: [Select]
this.setSize(buffer.getOutputWidth(), buffer.getOutputHeight());
this.add(canvas, BorderLayout.CENTER);
     skyBox.render(theWorld, buffer);
     if (!doShadows()) {

Support / Java 10 Serialization
« on: April 25, 2018, 08:42:07 pm »
I think that you have to update the serialization stuff for Java 10. Would you?

Support / Documentation Error
« on: March 20, 2018, 09:40:16 pm »
The docs for Object3D state:

public Object3D(float[] coordinates,
                float[] normals,
                float[] uvs,
                int[] indices,
                int textureId)
uvs - the texture coordinates [u1,v1,u2,v2,...]

When in fact it seems to read ws too (thus being u1, v1, w1, u2, v2, w2...).

Support / Environment Mapping with Software
« on: February 06, 2018, 06:40:35 pm »
One of my ships is shiny. I have a vague memory of talking to you about environment mapping with the software renderer. I fully expected that the environment map would not work with the software renderer, but my expectation was that the diffuse map would be completely replaced by the environment map and that the environment map would be treated as diffuse. This is not so. Ambient map acts like the ambient map but the diffuse channel disappears. To that end, I tried writing the following method. But obviously, the result is that the ambient map is just colored by the diffuse. My question, then, is since the environment mapping is already performing as expected, would it be possible to just make the diffuse channel work with it?

Code: [Select]
     private void combineAmbientAndDiffuse() {
Texture tex = TextureManager.getInstance().getTexture("EnvironmentMap");
tex.add(TextureManager.getInstance().getTexture("Starfighter.png"), .5f);

Support / Drawing a Graphic on a Separate Thread
« on: February 01, 2018, 03:35:33 am »
Hardware renderer in (lwjgl's frame) fullscreen throws a RuntimeException ("No OpenGL context found in the current thread."). I created a WorldProcessor with two threads as well as tried it the lwjgl way (GLContext.useContext()). Neither worked.

Support / Interact2D
« on: January 16, 2018, 08:38:03 pm »
I'm trying to make a little level editor. Right now, all it will do is to allow you to position some enemies by clicking on the 3d map. I'm not very interested in the y coordinate, because they will place themselves relative to the floor's height). But the following code always places the enemiies in the same (marked) spot:

Code: [Select]
     public void mouseClicked(MouseEvent e) {
Point p = e.getPoint();
SimpleVector p3d = Interact2D.reproject2D3DWS(camera, buffer, p.x, p.y);
System.out.println("p3d: "+p3d);
p3d.y = -2000f;
objects[numberOfObjects++] = Primitives.getCube(100f);

Support / Does TextureManager Operate on a Parallel Thread?
« on: January 12, 2018, 05:45:37 pm »
If so, how do I wait for it? My app is failing to find a texture after it's been added to the TextureManager.

Support / rotateMesh Bug
« on: January 10, 2018, 03:16:28 pm »
The following code doesn't crash with Object3D.rotateY(...) but crashes with a NullPointerException on Object3D.rotateMesh().

Code: [Select]
if (ship instanceof Blah) {

Support / Too Bright With Software Renderer
« on: December 20, 2017, 06:52:49 am »
I even wrote the following (where "amount" refers to color intensity for all three colors):

Code: [Select]
int amount = 15;
float attenuation = 3.6f, dist = 1f;
theWorld.setAmbientLight(25, 25, 25);//-20
if (b.usesRenderer(IRenderer.RENDERER_OPENGL)) {
theWorld.setAmbientLight(125, 125, 125);//-20
     amount = 55;
     attenuation = 3600f;
     dist = 10f;
else Config.lightMul = 1;

Pages: [1] 2 3 ... 15