Deprecated: Return type of ExplodeIterator::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /zstore/backups/cn10/home/ws10522/public_html/wiki/includes/utils/StringUtils.php on line 576

Deprecated: Return type of ExplodeIterator::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /zstore/backups/cn10/home/ws10522/public_html/wiki/includes/utils/StringUtils.php on line 592

Deprecated: Return type of ExplodeIterator::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /zstore/backups/cn10/home/ws10522/public_html/wiki/includes/utils/StringUtils.php on line 611

Deprecated: Return type of ExplodeIterator::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /zstore/backups/cn10/home/ws10522/public_html/wiki/includes/utils/StringUtils.php on line 558

Deprecated: Return type of ResultWrapper::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /zstore/backups/cn10/home/ws10522/public_html/wiki/includes/db/DatabaseUtility.php on line 197

Deprecated: Return type of ResultWrapper::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /zstore/backups/cn10/home/ws10522/public_html/wiki/includes/db/DatabaseUtility.php on line 215

Deprecated: Return type of ResultWrapper::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /zstore/backups/cn10/home/ws10522/public_html/wiki/includes/db/DatabaseUtility.php on line 208

Deprecated: Return type of ResultWrapper::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /zstore/backups/cn10/home/ws10522/public_html/wiki/includes/db/DatabaseUtility.php on line 225

Deprecated: Return type of ResultWrapper::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /zstore/backups/cn10/home/ws10522/public_html/wiki/includes/db/DatabaseUtility.php on line 186

Deprecated: header(): Passing null to parameter #3 ($response_code) of type int is deprecated in /zstore/backups/cn10/home/ws10522/public_html/wiki/includes/WebResponse.php on line 37

Deprecated: header(): Passing null to parameter #3 ($response_code) of type int is deprecated in /zstore/backups/cn10/home/ws10522/public_html/wiki/includes/WebResponse.php on line 37

Deprecated: header(): Passing null to parameter #3 ($response_code) of type int is deprecated in /zstore/backups/cn10/home/ws10522/public_html/wiki/includes/WebResponse.php on line 37
https://www.jpct.net/wiki/api.php?action=feedcontributions&user=Kaiidyn&feedformat=atom JPCT - User contributions [en] 2024-03-19T05:38:39Z User contributions MediaWiki 1.23.15 https://www.jpct.net/wiki/index.php?title=Heightmap Heightmap 2010-11-30T11:15:20Z <p>Kaiidyn: </p> <hr /> <div>A Heightmap class I wrote (more like edited Egon&#039;s random terrain)<br /> <br /> Egon&#039;s Terrain script that randomly generates terrain heights.<br /> &lt;pre&gt;/**<br /> * This is where the terrain-array is filled with some data, i.e. the<br /> * terrain is build. Keep in mind that this approach to build a terrain<br /> * is quite simple and slow. But it&#039;s easy to understand and the results<br /> * are not that bad, so....<br /> */<br /> for (int x = 0; x &lt; X_SIZE; x++) {<br /> for (int z = 0; z &lt; Z_SIZE; z++) {<br /> terrain[x][z] = -20 + (float) Math.random() * 40f; // Very<br /> // simple....<br /> }<br /> }<br /> <br /> /**<br /> * We are now smoothing the terrain heights. This looks better because<br /> * it removes sharp edges from the terrain.<br /> */<br /> for (int x = 0; x &lt; X_SIZE - 1; x++) {<br /> for (int z = 0; z &lt; Z_SIZE - 1; z++) {<br /> terrain[x][z] = (terrain[x][z] + terrain[x + 1][z] + terrain[x][z + 1] + terrain[x + 1][z + 1]) / 4;<br /> }<br /> }<br /> <br /> /**<br /> * The terrain heights are calculated now. Now we have to build an<br /> * Object3D from them.<br /> */<br /> ground = new Object3D(X_SIZE * Z_SIZE * 2);<br /> <br /> /**<br /> * We have 50 tiles in x and z direction and 2 polygons per tile.<br /> */<br /> float xSizeF = (float) X_SIZE;<br /> float zSizeF = (float) Z_SIZE;<br /> <br /> int id = texMan.getTextureID(&quot;base&quot;);<br /> <br /> for (int x = 0; x &lt; X_SIZE - 1; x++) {<br /> for (int z = 0; z &lt; Z_SIZE - 1; z++) {<br /> /**<br /> * We are now taking the heights calculated above and build the<br /> * actual triangles using this data. The terrain&#039;s grid is fixed<br /> * in x and z direction and so are the texture coordinates. The<br /> * only part that varies is the height, represented by the data<br /> * in terrain[][]. jPCT automatically takes care of vertex<br /> * sharing and mesh optimizations (this is why building objects<br /> * this way isn&#039;t blazing fast...but it pays out in the<br /> * end...:-)) The Mesh is build with triangle strips in mind<br /> * here. The format for these strips is equal to that of<br /> * OpenGL&#039;s triangle strips.<br /> */<br /> <br /> TextureInfo ti = new TextureInfo(id, (x / xSizeF), (z / zSizeF), ((x + 1) / xSizeF), (z / zSizeF), (x / xSizeF), ((z + 1) / zSizeF));<br /> ground.addTriangle(new SimpleVector(x * 10, terrain[x][z], z * 10), new SimpleVector((x + 1) * 10, terrain[x + 1][z], z * 10),<br /> new SimpleVector(x * 10, terrain[x][z + 1], (z + 1) * 10), ti);<br /> <br /> ti = new TextureInfo(id, (x / xSizeF), ((z + 1) / zSizeF), ((x + 1) / xSizeF), (z / zSizeF), ((x + 1) / xSizeF), ((z + 1) / zSizeF));<br /> ground.addTriangle(new SimpleVector(x * 10, terrain[x][z + 1], (z + 1) * 10), new SimpleVector((x + 1) * 10, terrain[x + 1][z], z * 10), new SimpleVector((x + 1) * 10,<br /> terrain[x + 1][z + 1], (z + 1) * 10), ti);<br /> }<br /> }&lt;/pre&gt;<br /> <br /> <br /> My terrain class that uses a bitmap.<br /> <br /> When using it make sure you have a Texture Manager with a TextureID ready, (I used a flat gray 128x128 image for this)<br /> <br /> &lt;pre&gt;public class Terrain {<br /> <br /> public static float HighestPoint = 0;<br /> <br /> <br /> static Bitmap bmp = null;<br /> static String pixel = null;<br /> public static Object3D Generate(int X_SIZE, int Z_SIZE, TextureManager tm, String TextureID){<br /> <br /> bmp = BitmapFactory.decodeResource(SpaceGrabber.resources, R.drawable.terrain); // the heightmap texture (128x128 due to memory limitations?)<br /> <br /> float[][] terrain = new float[X_SIZE][Z_SIZE];<br /> <br /> for (int x = 0; x &lt; X_SIZE-1; x++) {<br /> for (int z = 0; z &lt; Z_SIZE-1; z++) {<br /> <br /> pixel = Integer.toString(bmp.getPixel(x, z), 16);<br /> terrain[x][z] = Integer.parseInt(pixel.charAt(1) + &quot;&quot; + pixel.charAt(2), 16);<br /> <br /> if(terrain[x][z] &gt; HighestPoint){<br /> HighestPoint = terrain[x][z];<br /> }<br /> }<br /> <br /> }<br /> for (int x = 0; x &lt; X_SIZE - 1; x++) {<br /> for (int z = 0; z &lt; Z_SIZE - 1; z++) {<br /> terrain[x][z] = (terrain[x][z] + terrain[x + 1][z] + terrain[x][z + 1] + terrain[x + 1][z + 1]) / 4;<br /> }<br /> }<br /> Object3D ground = new Object3D(X_SIZE * Z_SIZE * 2);<br /> <br /> float xSizeF = (float) X_SIZE;<br /> float zSizeF = (float) Z_SIZE;<br /> <br /> int id = tm.getTextureID(TextureID); // I used a gray 128x128 texture<br /> <br /> for (int x = 0; x &lt; X_SIZE - 1; x++) {<br /> for (int z = 0; z &lt; Z_SIZE - 1; z++) {<br /> <br /> TextureInfo ti = new TextureInfo(id, (x / xSizeF), (z / zSizeF), ((x + 1) / xSizeF), (z / zSizeF), (x / xSizeF), ((z + 1) / zSizeF));<br /> ground.addTriangle(new SimpleVector(x * 10, terrain[x][z], z * 10), new SimpleVector((x + 1) * 10, terrain[x + 1][z], z * 10),<br /> new SimpleVector(x * 10, terrain[x][z + 1], (z + 1) * 10), ti);<br /> <br /> ti = new TextureInfo(id, (x / xSizeF), ((z + 1) / zSizeF), ((x + 1) / xSizeF), (z / zSizeF), ((x + 1) / xSizeF), ((z + 1) / zSizeF));<br /> ground.addTriangle(new SimpleVector(x * 10, terrain[x][z + 1], (z + 1) * 10), new SimpleVector((x + 1) * 10, terrain[x + 1][z], z * 10), new SimpleVector((x + 1) * 10,<br /> terrain[x + 1][z + 1], (z + 1) * 10), ti);<br /> }<br /> }<br /> <br /> return ground;<br /> }<br /> }&lt;/pre&gt;<br /> <br /> Note that this is originally written for jPCT-ae so it might need editing to work on pc version.<br /> <br /> It might need some modification to work in your application, but it&#039;s something to start with :)<br /> <br /> Kind regards,<br /> Kaiidyn.</div> Kaiidyn https://www.jpct.net/wiki/index.php?title=Heightmap Heightmap 2010-11-30T11:13:41Z <p>Kaiidyn: </p> <hr /> <div>A Heightmap class I wrote (more like edited Egon&#039;s random terrain)<br /> <br /> Egon&#039;s Terrain script that randomly generates terrain heights.<br /> &lt;pre&gt;/**<br /> * This is where the terrain-array is filled with some data, i.e. the<br /> * terrain is build. Keep in mind that this approach to build a terrain<br /> * is quite simple and slow. But it&#039;s easy to understand and the results<br /> * are not that bad, so....<br /> */<br /> for (int x = 0; x &lt; X_SIZE; x++) {<br /> for (int z = 0; z &lt; Z_SIZE; z++) {<br /> terrain[x][z] = -20 + (float) Math.random() * 40f; // Very<br /> // simple....<br /> }<br /> }<br /> <br /> /**<br /> * We are now smoothing the terrain heights. This looks better because<br /> * it removes sharp edges from the terrain.<br /> */<br /> for (int x = 0; x &lt; X_SIZE - 1; x++) {<br /> for (int z = 0; z &lt; Z_SIZE - 1; z++) {<br /> terrain[x][z] = (terrain[x][z] + terrain[x + 1][z] + terrain[x][z + 1] + terrain[x + 1][z + 1]) / 4;<br /> }<br /> }<br /> <br /> /**<br /> * The terrain heights are calculated now. Now we have to build an<br /> * Object3D from them.<br /> */<br /> ground = new Object3D(X_SIZE * Z_SIZE * 2);<br /> <br /> /**<br /> * We have 50 tiles in x and z direction and 2 polygons per tile.<br /> */<br /> float xSizeF = (float) X_SIZE;<br /> float zSizeF = (float) Z_SIZE;<br /> <br /> int id = texMan.getTextureID(&quot;base&quot;);<br /> <br /> for (int x = 0; x &lt; X_SIZE - 1; x++) {<br /> for (int z = 0; z &lt; Z_SIZE - 1; z++) {<br /> /**<br /> * We are now taking the heights calculated above and build the<br /> * actual triangles using this data. The terrain&#039;s grid is fixed<br /> * in x and z direction and so are the texture coordinates. The<br /> * only part that varies is the height, represented by the data<br /> * in terrain[][]. jPCT automatically takes care of vertex<br /> * sharing and mesh optimizations (this is why building objects<br /> * this way isn&#039;t blazing fast...but it pays out in the<br /> * end...:-)) The Mesh is build with triangle strips in mind<br /> * here. The format for these strips is equal to that of<br /> * OpenGL&#039;s triangle strips.<br /> */<br /> <br /> TextureInfo ti = new TextureInfo(id, (x / xSizeF), (z / zSizeF), ((x + 1) / xSizeF), (z / zSizeF), (x / xSizeF), ((z + 1) / zSizeF));<br /> ground.addTriangle(new SimpleVector(x * 10, terrain[x][z], z * 10), new SimpleVector((x + 1) * 10, terrain[x + 1][z], z * 10),<br /> new SimpleVector(x * 10, terrain[x][z + 1], (z + 1) * 10), ti);<br /> <br /> ti = new TextureInfo(id, (x / xSizeF), ((z + 1) / zSizeF), ((x + 1) / xSizeF), (z / zSizeF), ((x + 1) / xSizeF), ((z + 1) / zSizeF));<br /> ground.addTriangle(new SimpleVector(x * 10, terrain[x][z + 1], (z + 1) * 10), new SimpleVector((x + 1) * 10, terrain[x + 1][z], z * 10), new SimpleVector((x + 1) * 10,<br /> terrain[x + 1][z + 1], (z + 1) * 10), ti);<br /> }<br /> }&lt;/pre&gt;<br /> <br /> <br /> My terrain class that uses a bitmap.<br /> <br /> When using it make sure you have a Texture Manager with a TextureID ready, (I used a flat gray 128x128 image for this)<br /> <br /> &lt;pre&gt;public class Terrain {<br /> <br /> public static float HighestPoint = 0;<br /> <br /> <br /> static Bitmap bmp = null;<br /> static String pixel = null;<br /> public static Object3D Generate(int X_SIZE, int Z_SIZE, TextureManager tm, String TextureID){<br /> <br /> bmp = BitmapFactory.decodeResource(SpaceGrabber.resources, R.drawable.terrain); // the heightmap texture (128x128 due to memory limitations?)<br /> <br /> float[][] terrain = new float[X_SIZE][Z_SIZE];<br /> <br /> for (int x = 0; x &lt; X_SIZE-1; x++) {<br /> for (int z = 0; z &lt; Z_SIZE-1; z++) {<br /> <br /> pixel = Integer.toString(bmp.getPixel(x, z), 16);<br /> terrain[x][z] = Integer.parseInt(pixel.charAt(1) + &quot;&quot; + pixel.charAt(2), 16);<br /> <br /> if(terrain[x][z] &gt; HighestPoint){<br /> HighestPoint = terrain[x][z];<br /> }<br /> }<br /> <br /> }<br /> for (int x = 0; x &lt; X_SIZE - 1; x++) {<br /> for (int z = 0; z &lt; Z_SIZE - 1; z++) {<br /> terrain[x][z] = (terrain[x][z] + terrain[x + 1][z] + terrain[x][z + 1] + terrain[x + 1][z + 1]) / 4;<br /> }<br /> }<br /> Object3D ground = new Object3D(X_SIZE * Z_SIZE * 2);<br /> <br /> float xSizeF = (float) X_SIZE;<br /> float zSizeF = (float) Z_SIZE;<br /> <br /> int id = tm.getTextureID(TextureID); // I used a gray 128x128 texture<br /> <br /> for (int x = 0; x &lt; X_SIZE - 1; x++) {<br /> for (int z = 0; z &lt; Z_SIZE - 1; z++) {<br /> <br /> TextureInfo ti = new TextureInfo(id, (x / xSizeF), (z / zSizeF), ((x + 1) / xSizeF), (z / zSizeF), (x / xSizeF), ((z + 1) / zSizeF));<br /> ground.addTriangle(new SimpleVector(x * 10, terrain[x][z], z * 10), new SimpleVector((x + 1) * 10, terrain[x + 1][z], z * 10),<br /> new SimpleVector(x * 10, terrain[x][z + 1], (z + 1) * 10), ti);<br /> <br /> ti = new TextureInfo(id, (x / xSizeF), ((z + 1) / zSizeF), ((x + 1) / xSizeF), (z / zSizeF), ((x + 1) / xSizeF), ((z + 1) / zSizeF));<br /> ground.addTriangle(new SimpleVector(x * 10, terrain[x][z + 1], (z + 1) * 10), new SimpleVector((x + 1) * 10, terrain[x + 1][z], z * 10), new SimpleVector((x + 1) * 10,<br /> terrain[x + 1][z + 1], (z + 1) * 10), ti);<br /> }<br /> }<br /> <br /> return ground;<br /> }<br /> }&lt;/pre&gt;<br /> <br /> It might need some modification to work in your application, but it&#039;s something to start with :)<br /> <br /> Kind regards,<br /> Kaiidyn.</div> Kaiidyn https://www.jpct.net/wiki/index.php?title=Main_Page Main Page 2010-11-30T11:13:19Z <p>Kaiidyn: /* Code Snippets */</p> <hr /> <div>&lt;big&gt;&#039;&#039;&#039;The jPCT wiki&#039;&#039;&#039;&lt;/big&gt;<br /> <br /> <br /> jPCT is a free, small, fast and easy to learn 3D engine for Java. It offers support for software and hardware rendering. This Wiki should help people with tutorials, instructions and samples. If you think that you have something to contribute, just create an account and go for it... <br /> <br /> <br /> <br /> == jPCT ressources ==<br /> <br /> [http://www.jpct.net The jPCT homepage]<br /> <br /> [http://www.jpct.net/forum2 The jPCT community]<br /> <br /> [http://www.jpct.net/jpct-ae jPCT-AE - jPCT for Android]<br /> <br /> <br /> == Installation ==<br /> <br /> [[ Requirements ]]<br /> <br /> [[ How to install ]]<br /> <br /> <br /> == How to start ==<br /> <br /> [[ First steps ]]<br /> <br /> [[ Coordinate system ]]<br /> <br /> [[ Hello World ]]<br /> <br /> [[ Loading models ]]<br /> <br /> [[ Lighting ]]<br /> <br /> [[ Advanced example ]]<br /> <br /> [[ Applets ]]<br /> <br /> <br /> == Advanced topics ==<br /> <br /> [[ The different renderers ]]<br /> <br /> [[ Collision detection ]]<br /> <br /> [[ Multithreading ]]<br /> <br /> [[ Compiled objects ]]<br /> <br /> [[ Picking ]]<br /> <br /> [[ Shaders ]]<br /> <br /> [[ Physics ]]<br /> <br /> [[ Reducing high-poly models ]]<br /> <br /> [[ Mip mapping ]]<br /> <br /> <br /> == Code Snippets ==<br /> <br /> [[ Applet using the lwjgl joystick ]]<br /> <br /> [[ Changing applet&#039;s heap size via HTML ]]<br /> <br /> [[ FPS-like camera controls ]]<br /> <br /> [[ Heightmap ]]<br /> <br /> == jPCT-AE - a port of jPCT to Android ==<br /> <br /> [[ Hello World for Android ]]<br /> <br /> [[ Differences between jPCT and jPCT-AE ]]<br /> <br /> [[ Performance tips for Android ]]<br /> <br /> [[ Profiling Android Applications ]]</div> Kaiidyn https://www.jpct.net/wiki/index.php?title=Heightmap Heightmap 2010-11-30T11:12:44Z <p>Kaiidyn: Created page with &#039;A Heightmap class I wrote (more like edited Egon&#039;s random terrain) Egon&#039;s Terrain script that randomly generates terrain heights. &lt;pre&gt;/** * This is where the terrain-array is …&#039;</p> <hr /> <div>A Heightmap class I wrote (more like edited Egon&#039;s random terrain)<br /> <br /> Egon&#039;s Terrain script that randomly generates terrain heights.<br /> &lt;pre&gt;/**<br /> * This is where the terrain-array is filled with some data, i.e. the<br /> * terrain is build. Keep in mind that this approach to build a terrain<br /> * is quite simple and slow. But it&#039;s easy to understand and the results<br /> * are not that bad, so....<br /> */<br /> for (int x = 0; x &lt; X_SIZE; x++) {<br /> for (int z = 0; z &lt; Z_SIZE; z++) {<br /> terrain[x][z] = -20 + (float) Math.random() * 40f; // Very<br /> // simple....<br /> }<br /> }<br /> <br /> /**<br /> * We are now smoothing the terrain heights. This looks better because<br /> * it removes sharp edges from the terrain.<br /> */<br /> for (int x = 0; x &lt; X_SIZE - 1; x++) {<br /> for (int z = 0; z &lt; Z_SIZE - 1; z++) {<br /> terrain[x][z] = (terrain[x][z] + terrain[x + 1][z] + terrain[x][z + 1] + terrain[x + 1][z + 1]) / 4;<br /> }<br /> }<br /> <br /> /**<br /> * The terrain heights are calculated now. Now we have to build an<br /> * Object3D from them.<br /> */<br /> ground = new Object3D(X_SIZE * Z_SIZE * 2);<br /> <br /> /**<br /> * We have 50 tiles in x and z direction and 2 polygons per tile.<br /> */<br /> float xSizeF = (float) X_SIZE;<br /> float zSizeF = (float) Z_SIZE;<br /> <br /> int id = texMan.getTextureID(&quot;base&quot;);<br /> <br /> for (int x = 0; x &lt; X_SIZE - 1; x++) {<br /> for (int z = 0; z &lt; Z_SIZE - 1; z++) {<br /> /**<br /> * We are now taking the heights calculated above and build the<br /> * actual triangles using this data. The terrain&#039;s grid is fixed<br /> * in x and z direction and so are the texture coordinates. The<br /> * only part that varies is the height, represented by the data<br /> * in terrain[][]. jPCT automatically takes care of vertex<br /> * sharing and mesh optimizations (this is why building objects<br /> * this way isn&#039;t blazing fast...but it pays out in the<br /> * end...:-)) The Mesh is build with triangle strips in mind<br /> * here. The format for these strips is equal to that of<br /> * OpenGL&#039;s triangle strips.<br /> */<br /> <br /> TextureInfo ti = new TextureInfo(id, (x / xSizeF), (z / zSizeF), ((x + 1) / xSizeF), (z / zSizeF), (x / xSizeF), ((z + 1) / zSizeF));<br /> ground.addTriangle(new SimpleVector(x * 10, terrain[x][z], z * 10), new SimpleVector((x + 1) * 10, terrain[x + 1][z], z * 10),<br /> new SimpleVector(x * 10, terrain[x][z + 1], (z + 1) * 10), ti);<br /> <br /> ti = new TextureInfo(id, (x / xSizeF), ((z + 1) / zSizeF), ((x + 1) / xSizeF), (z / zSizeF), ((x + 1) / xSizeF), ((z + 1) / zSizeF));<br /> ground.addTriangle(new SimpleVector(x * 10, terrain[x][z + 1], (z + 1) * 10), new SimpleVector((x + 1) * 10, terrain[x + 1][z], z * 10), new SimpleVector((x + 1) * 10,<br /> terrain[x + 1][z + 1], (z + 1) * 10), ti);<br /> }<br /> }&lt;/pre&gt;<br /> <br /> <br /> My terrain class that uses a bitmap.<br /> <br /> When using it make sure you have a Texture Manager with a TextureID ready, (I used a flat gray 128x128 image for this)<br /> <br /> &lt;pre&gt;public class Terrain {<br /> <br /> public static float HighestPoint = 0;<br /> <br /> <br /> static Bitmap bmp = null;<br /> static String pixel = null;<br /> public static Object3D Generate(int X_SIZE, int Z_SIZE, TextureManager tm, String TextureID){<br /> <br /> bmp = BitmapFactory.decodeResource(SpaceGrabber.resources, R.drawable.terrain); // the heightmap texture (128x128 due to memory limitations?)<br /> <br /> float[][] terrain = new float[X_SIZE][Z_SIZE];<br /> <br /> for (int x = 0; x &lt; X_SIZE-1; x++) {<br /> for (int z = 0; z &lt; Z_SIZE-1; z++) {<br /> <br /> pixel = Integer.toString(bmp.getPixel(x, z), 16);<br /> terrain[x][z] = Integer.parseInt(pixel.charAt(1) + &quot;&quot; + pixel.charAt(2), 16);<br /> <br /> if(terrain[x][z] &gt; HighestPoint){<br /> HighestPoint = terrain[x][z];<br /> }<br /> }<br /> <br /> }<br /> for (int x = 0; x &lt; X_SIZE - 1; x++) {<br /> for (int z = 0; z &lt; Z_SIZE - 1; z++) {<br /> terrain[x][z] = (terrain[x][z] + terrain[x + 1][z] + terrain[x][z + 1] + terrain[x + 1][z + 1]) / 4;<br /> }<br /> }<br /> Object3D ground = new Object3D(X_SIZE * Z_SIZE * 2);<br /> <br /> float xSizeF = (float) X_SIZE;<br /> float zSizeF = (float) Z_SIZE;<br /> <br /> int id = tm.getTextureID(TextureID); // I used a gray 128x128 texture<br /> <br /> for (int x = 0; x &lt; X_SIZE - 1; x++) {<br /> for (int z = 0; z &lt; Z_SIZE - 1; z++) {<br /> <br /> TextureInfo ti = new TextureInfo(id, (x / xSizeF), (z / zSizeF), ((x + 1) / xSizeF), (z / zSizeF), (x / xSizeF), ((z + 1) / zSizeF));<br /> ground.addTriangle(new SimpleVector(x * 10, terrain[x][z], z * 10), new SimpleVector((x + 1) * 10, terrain[x + 1][z], z * 10),<br /> new SimpleVector(x * 10, terrain[x][z + 1], (z + 1) * 10), ti);<br /> <br /> ti = new TextureInfo(id, (x / xSizeF), ((z + 1) / zSizeF), ((x + 1) / xSizeF), (z / zSizeF), ((x + 1) / xSizeF), ((z + 1) / zSizeF));<br /> ground.addTriangle(new SimpleVector(x * 10, terrain[x][z + 1], (z + 1) * 10), new SimpleVector((x + 1) * 10, terrain[x + 1][z], z * 10), new SimpleVector((x + 1) * 10,<br /> terrain[x + 1][z + 1], (z + 1) * 10), ti);<br /> }<br /> }<br /> <br /> return ground;<br /> }<br /> }&lt;/pre&gt;<br /> <br /> It might need some modification to work in your application, but it&#039;s something to start with :)</div> Kaiidyn
Deprecated: header(): Passing null to parameter #3 ($response_code) of type int is deprecated in /zstore/backups/cn10/home/ws10522/public_html/wiki/includes/WebResponse.php on line 37