Jump to content

Masterxilo

Members
  • Posts

    379
  • Joined

  • Last visited

Everything posted by Masterxilo

  1. @Rick: Your CreatePatch function creates triangles with vertices that don't exist, hence the access violation. It should read "z <= zegs" and "x <= xsegs" like the framewerk function: TMesh CreatePatch(int xsegs, int zsegs) { int x,z; TMesh mesh; int count; TSurface surf; mesh=CreateMesh(); surf=CreateSurface(mesh); for(z=0;z<=zsegs;z++) { for(x=0;x<=xsegs;x++) { count=AddVertex(surf, Vec3( (flt)(x)/(flt)(xsegs)-0.5f, 0, (flt)(z)/(flt)(zsegs)-0.5f ), Vec3( 0, 1, 0), Vec2( (flt)(x)/(flt)(xsegs), 1- (flt)(z)/(flt)(zsegs) )); if( (x>0) && (z>0) ) { AddTriangle(surf, count-1, count, count-xsegs-1); AddTriangle(surf, count-1, count-xsegs-1, count-xsegs-2); } } } UpdateMesh(mesh); return mesh; }
  2. I know I could save what I set it to on creation and so on...
  3. Would you mind making a non installer zip version? I don't like installing and I honestly don't know why Microsoft invented it. The only thing installing does more than unpacking a zip is creating links on the desktop and in the startup folder (which you can do yourself) and WRITING THINGS TO THE REGISTRY, which shouldn't be (and isn't often) used by any application. But however...
  4. The size of the terrain (in patches). E.g. 1024, 2048, 4096 (the parameter specified at terrain creation).
  5. For example for: http://leadwerks.com/werkspace/index.php?/topic/1250-plane-to-hug-terrain/page__view__findpost__p__11632 ^^this post also contains a more accurate TerrainElevation() that doesn't just do a LERP between the closest 4 points...
  6. Correct TerrainElevation command (tested): This takes into account the traingle layout of the terrain. flt WorkingTerrainElevation(TTerrain terrain, const int resolution, flt x, flt y) { TVec3 s = EntityScale(terrain); x /= s.X; y /= s.Z; x += resolution/2; y += resolution/2; int _x = int(x), _y = int(y); flt ox = x - _x; flt oy = y - _y; flt z0 = TerrainHeight(terrain, _x, _y); flt z1 = TerrainHeight(terrain, _x+1, _y); flt z2 = TerrainHeight(terrain, _x+1, _y+1); flt z3 = TerrainHeight(terrain, _x, _y+1); float resultingz; if(ox > oy) // in which triangle are we? { resultingz = z0 - ox*(z0-z1) - oy*(z1-z2); // the first } else { resultingz = z0 - ox*(z3-z2) - oy*(z0-z3); // the second } return resultingz * s.Y; } Unfortunately, there's no command to get the terrain's resolution so you'll have to pass that as an argument.
  7. I'm sure the TerrainElevation function is just not taking into account the actual layout of the triangles but just performing a linear interpolation between the closest 4 terrain vertices. It should be easy to use TerrainHeight on the 4 closest grid points and calculating the interpolation yourself. I'll try to write a TerrainElevation command replacement that way. Because a raycast would still be many times slower I guess.
  8. I guess these are both easy to implement. The current camera is the only camera visible in the world that will be used for rendering (if the scene would be rendered at that moment). I think there must be an internal command used by the rendering functions for that too. These to would for example simplify this command (leglBegin): http://leadwerks.com/werkspace/index.php?/page/resources?record=19
  9. No, I meant if your terrain has one grid/vertice per meter, the mesh patch needs to have that too. Did the patch in your first shot also have that much polygons (then I saw that wrong)? Do you this still have problems with this high res patch?
  10. Try using a different culling mode in the leglBegin() function (e.g. CULL_NONE). Can you show me a short example where those start/end functions work and mine not? I'd like to fix that.
  11. No it's not, your plane just has a lower resolution (from the picture, I'd say you have one square for 8 terrain squares) than the terrain and your vertices aren't perfectly aligned to the terrain vertices. A patch that should perfectly align to the terrain must have AT LEAST the res of the terrain.
  12. Make sure this code is called after drawing everything 3D. Also make sure to set the back buffer as the current buffer AGAIN, after 3D drawing. Check the example.
  13. Yeah, you can put transparent meshes into the main world fine as long as you don't need to be able to see (the shading) through them. Depending on what you want to use these for, you should add normals calculation to the code (but for a selection highlight, no normals are fine). The whole thing including perfect alignment of the vertices to the terrain vertices can in fact be done very efficiently in a shader: http://forum.leadwerks.com/viewtopic.php?f=32&t=4254, ... But if you don't need GPU mesh instancing to work on the patches and don't have too much, too large, too often moving/updating patches then a CPU mesh does fine as well.
  14. Just finished the tutorial/example article: Using OpenGL for drawing
  15. You can use the textures loaded by the engine. I'll quickly add how to do this to my wiki article. Or better I add a "Page"/"Resource"/Tutorial on how to use OpenGl for drawing.
  16. Yes, you'll have to use opengl. It's not difficult to use the opengl functions. Another way would be to use a textured plane entity in another world and render that world on top of the other things.
  17. How is that an addition? Do you mean you want to assign an int to a char? Then your code should work. You can also do an explicit conversion: int x = 5; char a; a = (char)x; For 2.: char a[80]; strcpy(a, "HELLO "); strcat (a, "WORLD");
  18. Sounds OK, now there needs to be something special about the game, some super gameplay or graphical feautre that'll set it apart. Because games just like the described have already been made... Btw., did the leadwerks soldier model finally get any animations? I guess it'll be used as the character model for this game. Though I wouldn't use it, it looks too much like the nanosuit from crysis... Or is the game only being made to show people how to do stuff, and not to be a game one should/would want to play? That sounds like an interesting idea.
  19. Yeah why not. Thanks again. Really Photoshop? I would have guessed Illustrator. How did you manage to draw something so precise using photoshop? I should really learn that program...
  20. Really well done. The bar at the bottom of the page changes the size when switching languages and the flags are in different positions. Also, once it says "© Pure³d" and then "© Pure³d Vizualisation" And it would be cool if it could stay on the same subpage when changing language.
  21. Thanks. What program did you use?
  22. There might be some programs to download the whole wiki, but yes, right now there's only online doc.
  23. @Michael Well it's not exactly these, but they are similar. Thanks anyways.
×
×
  • Create New...