Jump to content

Brutile

Members
  • Posts

    314
  • Joined

  • Last visited

Everything posted by Brutile

  1. I'm working on a voxel game, and I'm using camera->Pick() to get the position to add or remove a block, but it seems to be really slow. between 5 and 10 ms on its own. I've set all objects to pick mode 0 except the chunks close to the player. Is there something I can do to speed things up, like use a different method or something?
  2. To anyone creating mesh at runtime, like an endless terrain or something, you don't have to call Update() on the surface you just created. It was in the documentation, so I thought it was something you had to do when you created a model, but you only need to call model->UpdateAABB() with local and global parameters, like in the docs. Updating the surface took around 15-20 milliseconds, which was causing frame drops when I was creating chunks of terrain, and there was nothing I could do to speed it up. But I tried it without surface->Update() and it now runs at a steady 100fps, instead of 100 and constantly dropping to 40fps. Hope this helped a few people
  3. Recentering everything will better in the long run, so I'll do that. Thanks everyone
  4. The camera goes black when you move past 1512 units in either direction. There's probably a good reason for it, but its a bit hard to have an endless terrain when you can't go too far from 0,0,0
  5. Thanks man I use: surface->Update(false); model->UpdateAABB(Entity::LocalAABB | Entity::GlobalAABB); The view distance on that shot was 30x30 chunks at 16x16x64 each, but it doesn't run smoothly. Mostly because the surface->Update() and model->UpdateAABB() are quite slow. The code to generate the mesh is around 0-1 millisecond and the updates are around 10 milliseconds or more, so nothing much I can do at the moment about that
  6. I too am fiddling around with a voxel game Haven't gotten around to adding and removing tho, but I think you can use surface->Clear(), then rebuild the surface of the mesh BTW how do I upload images?
  7. Sorry, the difference was 0.03 to 0.05, not 0.3 to 0.5. But It is much larger at higher fall heights.
  8. After testing a standard player and camera script, I noticed some glitching about from the camera. It isn't bad, but everytime you jump, land, then move the mouse a little, the camera would drop. The amount would depend on the height you jumped from. I used output to test this, and found that if you stand at a point at 5 units, then jumped, you would land and stay at around 5.3 to 5.5 units. Then when you move the camera, it would drop back to 5 units. My code doesn't have anything that would stop it from updating the position, so something strange with the physics or something is going on. When I say move the camera, I mean move the mouse. And by units, I mean y coordinates
  9. Ok, It was my fault all along I changed a pointer to another position in my array, then deleted the old one, which was still used. Then when I tried to access model, it wasn't there.
  10. There's something wrong with the model->Release(). Is there a better/proper way of removing a model from the world? Because I'm checking if it exists, then trying to remove it to recreate another model in its place.
  11. Here's another question... can I access a #define from another class? Can it be accessed if I include the header or something?
  12. catch22, you are a life saver! that #define works just how I wanted it to. Thank you and everyone else that helped. I can now clean up my code a bit.
  13. I have an object declared in a header file in C++ as follows: Model* model; How do I check to see if it is null? I've tried: if(model == NULL) and if(model == nullptr) But it seems the object exists, but is not created, therefore it will always be true. Then when I go: model->Release(); I get an error. So, how do I check if it has been created?
  14. I kinda found a solution. I just declared the array as bool*** stuff; then did stuff*** = new bool**[num]; then looped and did stuff**[x] = new bool*[num]; then another loop and did stuff*[x][y] = new bool[num]; etc. It isn't as quick as declaring the array at compile time, but it works, so I'm happy
  15. I can't pass it directly into the stuff array either. The errors are: 1. use of undefined type 'a' 2. 'worldHeight': undeclared identifier 3. expected constant expression Even though everything is declared at compile time. Alternatively, If anyone knows how to make a class that holds variables that only need to be assigned once, and can be used for all classes. I'm only doing this so I don't need to make multiple instances of the same value.
  16. If anyone knows C++, please help... I'm trying to initialize a constant variable using a static variable from another class. I want to assign: // a.h static const short worldHeight = 128; To: // b.h static const short height = a::worldHeight; So I can then do this: // b.h bool stuff[height]; But I get errors. Anyone know how to achieve this?
  17. I think multiple worlds is a good way of doing things, but I still think you shouldn't need to use textures and buffers. There should simply be a way of culling the background of a camera, then rendering the two worlds.
  18. SetAnisotropy gives me a script error: error in function 'SetAnisotropy' argument #1 is 'Texture'; 'Texture' expeced. I'm using Lua.
  19. Thanks shadmar, that worked, but the objects in the worlds are now pixellated, even with multisampling turned up. Is there a way to fix it?
  20. Ok, that makes sense and I got it mostly working, but when I render, it will only show the last world that I rendered. It was rendering the background, which rendered over the top of the first one.
  21. Not sure if there is something already in Leadwerks to do this, but I would like something similar to Unity3D's camera layer system, where you could set an object (like a gun) on a layer that the camera could cull. You could then setup two cameras, one that renders the environment, and another that just rendered the gun. This would be helpful in stopping weapons passing through walls, and would also allow higher FOV without making the gun look stretched and horrible.
  22. I'm getting a script error with the surface:UpdateAABB(). I've also tried surface:Update() and surface:Update(true) but I get the error: "attempt to call method 'Update' (a nil value)'. and It doesn't update the colour of the model. Any ideas?
  23. Is it possible to create geometry in a script at runtime? I'm looking to convert a voxel engine (Minecraft terrain) I made in Unity3d to Leadwerks, but I don't know what can and can't be done in Lua. I need to be able to create a mesh using polygons (not just creating cubes). Can this be done? and if so, how?
×
×
  • Create New...