### 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
1
##### Support / Mouse-Walking on a Simple Plane
« on: October 23, 2018, 06:59:02 am »
I've made three dozen attempts. I have had success on a plane with multiple polygons, but I'd like to make it work on a large plane with only two triangles. My best (unsuccesful) attempt:

Code: [Select]
`     public void mouseClicked(MouseEvent e) {        moveByMouse(e.getX(), e.getY());     }     private void moveByMouse(int mouseX, int mouseY) {//WALKBYMOUSE; CALLED ONCE TO SETUP THE WALK DIRECTION SimpleVector ray = Interact2D.reproject2D3DWS(camera, buffer, mouseX, mouseY); if (ray != null) {      SimpleVector norm = ray.normalize();      float f = theWorld.calcMinDistance(camera.getPosition(), norm, 1000);      if (1==1/*f != Object3D.COLLISION_NONE*/) { SimpleVector offset = new SimpleVector(norm); norm.scalarMul(f); norm = norm.calcSub(offset); origin = hero.getRoot().getTransformedCenter(); SimpleVector destination = new SimpleVector(norm); destination.x += camera.getPosition().x; destination.z += camera.getPosition().z; destination.y = origin.y; // Make y the same as for the hero to avoid moving up/down. hero.getRoot().setRotationMatrix(destination.calcSub(origin).getRotationMatrix()); this.destination = new SimpleVector(destination);      } } go = true;     }`

2
##### Support / Orthographic Camera
« on: September 26, 2018, 05:35:15 am »
Is it at all possible to extend the Camera instance to create an orthographic camera?

3
##### 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?

4
##### 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; } this.updateMesh();     }`

5
##### Support / Is Animation.getKeyFrames().length always the exact size of the total number...
« on: June 14, 2018, 09:39:34 pm »
...of keyframes? You should put that in the docs.

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

6
##### 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: https://www.dropbox.com/s/1aumqalafjmietb/MergeAndSerialize.rar?dl=0

7
##### 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 java.io.*;import com.threed.jpct.*;public class MergeAndSerialize {     public static void main(String[] args) { Logger.setLogLevel(Logger.LL_ERRORS_AND_WARNINGS); 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.");      return; } 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); animation.createSubSequence(animationName); System.out.println("\n\n\nFrames length: "+frames.length); model.build(); 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));      frame.build();      Mesh mesh = frame.getMesh();      animation.addKeyFrame(mesh); } model.setAnimationSequence(animation); try {      new DeSerializer().serialize(model, new java.io.FileOutputStream(fileName.substring(0, fileName.lastIndexOf("."))+".serialized"), false); } catch (java.io.IOException ex) {System.err.println("Trouble saving file: "+ex.getMessage());} java.awt.Toolkit.getDefaultToolkit().beep();     }}`

8
##### 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?

9
##### 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); this.setVisible(true);...      buffer.clear(Color.blue);      flameManager.update(deltaTime);      smokeManager.update(deltaTime);      skyBox.render(theWorld, buffer);      if (!doShadows()) { theWorld.renderScene(buffer); theWorld.draw(buffer);      }      buffer.update();      buffer.displayGLOnly();      canvas.repaint();`
https://www.dropbox.com/s/jpkrg93a6vi03db/ClippingThing.jpg?dl=0

10
##### 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?

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

Quote
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...).

12
##### 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);     }`

13
##### 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.

14
##### 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:
https://www.dropbox.com/s/r73iukqn0wdtcjs/LE.jpg?dl=0

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); objects[numberOfObjects-1].build(); objects[numberOfObjects-1].translate(p3d); theWorld.addObject(objects[numberOfObjects-1]);     }`

15
##### 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.

Pages: [1] 2 3 ... 15