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 - davec64

Pages: [1]
1
Support / wrapping a ground plane.
« on: December 20, 2013, 12:47:15 pm »
Is it possible to make a ground plane wrap back on itself. My plane is large but not large enough to hold all of my  map at once. So I have to re build my vertex map when I move over 700 m  to display the current modified plane.
It would be ideal if the right edge connected to the left edge like a cylinder and the bottom connected to the top.
So I would only need to update areas beyond the clipping range in the direction I am traveling. This is an old method to reduce the amount of processing needed to update a map/plane.
Eg if I am moving up the map I would update y max line then y max -1 then -2
Where the map is x*y .
If going right update xmin then xmin+1
For num vertical lines
if y goes thru 0 y =ymax
If x >xmax x=0
So we just update the Poly's in the direction of travel.
Other techniques???

2
I am calling checkForCollisionEllipsoid to detect collisions around a polygon in 6 places per frame.
I am running at 25 fps and at around 15 seconds the GC kicks off pausing my app by 200ms.
Removing this check stops the pause.
Dave

 

3
Support / itexture apply effect causing GC compaction on overlay
« on: December 16, 2013, 12:26:37 pm »
I am using overlays to place some text on the 3d view .if I do not apply the effect GC is firing about 1 time in 25 seconds. I normally call apply 1 time per second. And GC is firing almost every second causing a pause of 100 ms which even pauses my async tasks as well.
I am running at 25 fps with plenty of spare CPU. It frees around 8000k in 100ms.
Any ideas how to stop the memory being allocated and deallocated.
Dave

4
Support / Adding / modifying textures on a plane primitive on the fly.
« on: November 28, 2013, 04:57:53 am »
Hi
I Have manged to get most of my visual effects working. However I have once again become stuck on changing textures based on the deformed plane height. spent over 2 days trying to work this one out.
If I change them to different incremental textures at the retexture stage. I see similar to what I expect see image each polygon clearly visible. Although I am not 100% on the output except that there are 2 polys per square.
 
When I try to get a polygon and apply a new texture. all the textures go back to my default texture and no polygons are visible any more.
I am sure this is just a misunderstanding of how to change the texture.
Any help greatly appreciated.
this is from my vertexcontroller that sets the z value that is done in a loop outside of this snippet.
When this code is applied it seems to apply to all the the polygons ( as if  there is one poly per column).

Code: [Select]
if (polyindex < maxPolygonID) {
            int depthiD = TextureManager.getInstance().getTextureID("depth" + (int) data % 29);
            if (depthiD == -1) {
             depthiD =  TextureManager.getInstance().getTextureID("depth0");

            }
            Logger.log("texture id = " + depthiD + "data = " + (int) data + "polyindex ="
                + polyindex);
            int t1 = pm.getPolygonTexture(polyindex);
            uv0 = pm.getTextureUV(polyindex, 0);
            uv1 = pm.getTextureUV(polyindex, 1);
            uv2 = pm.getTextureUV(polyindex, 2);
            TextureInfo ti = new TextureInfo(t1, uv0.x, uv0.y, uv1.x, uv1.y, uv2.x, uv2.y);
            ti.add(depthiD, uv0.x, uv0.y, uv1.x, uv1.y, uv2.x, uv2.y, TextureInfo.MODE_MODULATE);
            pm.setPolygonTexture(polyindex++, ti);

            t1 = pm.getPolygonTexture(polyindex);
            uv0 = pm.getTextureUV(polyindex, 0);
            uv1 = pm.getTextureUV(polyindex, 1);
            uv2 = pm.getTextureUV(polyindex, 2);
            ti = new TextureInfo(t1, uv0.x, uv0.y, uv1.x, uv1.y, uv2.x, uv2.y);
           ti.add(depthiD, uv0.x, uv0.y, uv1.x, uv1.y, uv2.x, uv2.y, TextureInfo.MODE_MODULATE);
            pm.setPolygonTexture(polyindex++, ti);
          }
Second attachment is with this code. It seems to upset the whole texture.
https://www.dropbox.com/sh/0epa1c6jved3dxu/XGq4d9ItAu

5
I had this
Code: [Select]
tm.addTexture("platform", new Texture(0, 0, 0));
TextureInfo coneTex = new TextureInfo(tm.getTextureID("platform"));
    coneTex.add(tm.getTextureID("normals"), TextureInfo.MODE_MODULATE);
    tm.unloadTexture(fb, tm.getTexture("platform"));
    tm.replaceTexture("platform", new Texture(128, 128, red));


or
Code: [Select]
    tm.unloadTexture(fb, tm.getTexture("platform"));
    tm.replaceTexture("platform", new Texture(128, 128, green));

I just want to do this if possible.

 depthColor = green;
        coneobj.setAdditionalColor(depthColor);

Dave

6
Hi
I have just spent a couple of days looking for bug in my code to finally work out it is not a bug but how the plane mesh is structured.
Here is what I think I have found by trial and error.
The first row of the mesh contains double the normal data of a normal row?
Writing the same data twice works for this case ie  dest[i++].z twice if row = 0
The array I have created is 174 *174
but the length comes back 30625 not 30276 as expected.
So it is 175 *175
So I assume I need to also add another duplicate point per row in the mesh. but where?
Any help gratefully received trail and error is to time consuming.
Thanks  code attached from my controller apply code 
Dave
Code: [Select]

 SimpleVector[] d = getDestinationMesh();
 i=0;
 int length = d.length;
 for (y = 0; y <= VesselRenderer.PANELSIZE; y++) {
      for (x = 0; x <= VesselRenderer.PANELSIZE; x++) {

        float data = (float) getData(x + VesselRenderer.m_panelxoffset, y
            + VesselRenderer.m_panelyoffset);
        // because I do not know where else to duplicate check length and do not go out of array bounds
        if (i < length) {
          d[i++].z = data;

          if (y == 0)
            d[i++].z = data;
        }
      }

    }


7
Support / vertex controller problem.(Solved)
« on: November 13, 2013, 12:39:22 pm »
I am having an issue applying a vertex controller to a plane. Once I have added it to the world.
I update the plane in an async task it works fine the first time (this is done  just before i add the object to the world), but the second time even though it succeeds there is no visible change to my plane.
Is there anything else I need to do to get the new mesh to appear  instead of the old mesh.
I tried touch but that did nothing.
My next test is to apply a second vertex before I add the object to the world.
Any thoughts or explanation on why the second apply does not work .lazy transformations are off.
Dave

8
Support / collisions and triangles solved.
« on: October 29, 2013, 12:38:04 pm »
Hi all. I had quite a battle working out what was wrong with my collision shield. Only one triangle was detected by my  pointy object.
Details
Create an array to represent the corners
V1 v2 V3 v4 using v1-v3 create the fist triangle.
Addtriangle to rectangle object.
Change v1 coords to v4
Adddtriangle. To rectangle object.
Add to world
Fails miserably. It gives a perfect rectangle but only the first rectangle registers a collision.
Cause and Solution?
Moving v1 only causes the face to flip.
I found moving v1 to v2 and v2 to v4 addtriangle works a treat.
I assume this stuff is done automatically by 3d packages and those in the know?
Any way hope this helps other newbies.
No code as this is just a technique. If you found this you must have gone down the same path as me.
Davec64
Retro assembly game coder.

Pages: [1]