Kilombo

Members
  • Content Count

    145
  • Joined

  • Last visited

Everything posted by Kilombo

  1. I want to turn the lens flare not visible when the distance from the emitter is bigger then the light range. This could be solved with a turn visible/not visible method or private var.
  2. Sorry to reactivet DK, but I come back to this today. The problem is the same. I think you are talking about the light. But I'm talking about the particleSystem. In particleSystem.js I don't see any reference to distance. Anyway, I tried do do dispose if distance from emitter or bigger then the light range, and if not it would render again. It happens that this doesn't work has visible or not visible, it has to be instanciated again. Is it possible to had a setVisible(true/false) that would change the private visible var in the class, and that would rather turn visible or not the particleSystem ?
  3. Hi viktov. Has far has i know. Dispose(), so something similar has the delete() (javascript). This function cut's the objects reference to the memory (so you cannot access it anymore since it just lost it's pointer). This doesn't mean that memory will get free imediatly. Although it does something. When garbage collector comes to clean up the memory it will take all this to trash (since there's no way to reference it). By saying this. I have to tell you.... I personally don't like very much the garbage collector. I prefer the good old times of ansi C, you could clean the memory directly . Is your specific case, the best way to solve your problem is by assigning to that array a value of null, by that your saying that the information contained in the array is illegible to the garbage collector. Something like: var newArray = new Array(); for (bla bla bla){ newArray[bla]; } then when you don't needed it no more, you do: newArray = null; Hope I've been helpfull.
  4. Djee... mate. I totally agree with you. But..... I think you are beeing a but hard in your speech. After all.... It's open source. The community it's speechless (by this i mean, everyone helps everyone, and the developers listen the users everyday). I feel that the developers do make one hell of one effort do answer and help anyone. We can ask if it is possible to implement stuff. But i don't think that the users are in a position to claim anything. By this i don't want to be hard on you also. Since you are a really good contributor (in my point of view) and one of the most active members of the community (and the funniest also), and you probably should stay has you are.... What the hell, I don't know what i'm talking about anymore. Lol.
  5. Hi Metal. I'm kind of a newbie on this, but has far has i know, there isn't, anyway.... It's quite easy to implement. I'll pass you the code I implemented in opengl 2 years ago, you just have to adapt to javascript. //varáveis da curva de besierGLfloat ctrlpoints[4][3] = { { 12000.0, 0.0, 0.0}, { 17000.0, 0.0, -12800.0}, {-9000.0, 0.0, 0.0}, {12000.0, 0.0, 0.0}};GLfloat besx,besy,besz;float tempo = 0.0f;//Calculo de cruva de beziervoid calculatePoly(float t){ int i=1; float a = -t*t*t + 3*t*t - 3*t + 1; float b = 3*t*t*t + -6*t*t + 3*t; float c = -3*t*t*t + 3*t*t; float d = t*t*t; besx = (ctrlpoints[i-1][0]*a + ctrlpoints[i][0]*b + ctrlpoints[i+1][0]*c + ctrlpoints[i+2][0]*d); besy = (ctrlpoints[i-1][1]*a + ctrlpoints[i][1]*b + ctrlpoints[i+1][1]*c + ctrlpoints[i+2][1]*d); besz = (ctrlpoints[i-1][2]*a + ctrlpoints[i][2]*b + ctrlpoints[i+1][2]*c + ctrlpoints[i+2][2]*d); }desenhaObj(2,besx,besy,besz,rotacao,3);The "desenhaobj" method receives has args the number of the mesh, besier position x, and so on, rotation (calcultated in another place) and the size of the mesh. Hope I've been helpfull.
  6. It would be a good idea to define paths using bezier curves. This is quite powerfull, theres a tutorial. http://devmag.org.za/2011/04/05/bzier-curves-a-tutorial/
  7. I just declared the var face has global, end removed it from the hidedetails and showdetails functions, and I think it sorted it out. can you check in your browser? http://www.babylonjs.com/playground/#1MBN2C#1
  8. Hey viktov, check this loop: In my point of view, I think you are instantiating a new segmentPosition object by each iteration, then if not loaded it instantiates a new standard material and color3 by each iteration. By saying this it's a lot of stuff that you are instantiating, where is this all going, and how do you reference this earlier? I f I where you, I would implement an array to put all this materials and segment positions, so that you can reference them earlier. Something like: for (i = 0; i < segments.length; i++) { segment = segments; segmentPosition = new BABYLON.Vector3(segment.position.x, segment.position.y, segment.position.z); And then do the same with the materials, that way you can reference them on the hide function. It looks to me that the problem is there. Or else, you can implement some queues and them put what you whant there (on the showdetail function), and get and dispose them later (on the hide function). Hope I helped something for (i = 0; i < segments.length; i++) { segment = segments[i]; segmentPosition = new BABYLON.Vector3(segment.position.x, segment.position.y, segment.position.z); if (!loaded[i] && i == Math.round(Math.random() * segments.length)) { for (j = 0; j < 100; j++) { face = BABYLON.Mesh.CreateBox("f_" + i + "_" + j, 1, scene); face.scaling.x = Math.random() * 20 + 5; face.scaling.y = Math.random() * 20 + 5; face.position.x = segment.position.x + Math.random() * 50 - 25; face.position.y = 100 + Math.random() * 50; face.position.z = segment.position.z + Math.random() * 50 - 25; material = new BABYLON.StandardMaterial("m_" + i + "_" + j, scene); material.diffuseColor = new BABYLON.Color3(Math.random(), Math.random(), Math.random()); face.material = material; } loaded[i] = true; } }
  9. Don't forget we have a render loop in here, it's not only a matter of scoping. I'm just saying that there could be a relation. I'm working on a project and had some similar problems relationed to those kind of problems. Actually I don't know enough javascipt to be sure of that. Anyway. The dispose by it self doesn't delete the actual object, just the reference to it, right? He still have to wait for the garbage collector to be cleaned. So it's not 100% sure that the dispose will take the object out of memory, right?
  10. hmmmm.. Viktov, I see you are declaring some vars inside some for scope (Ex: createsegments, showdetails and hidedetails), although the vars had the same name, and the value inside it is in fact substituted, the system will instantiate a new var in memory by each loop. And that consumes a lot of memory, and will keep growing and growing. Can you plz try do declare those vars outside of the loop scopes to see if the problem is relationed with that?
  11. Indeed, I'm working on a project that uses that also. I calculate everything in the client then I post the coordinates on the database (in a PHP server). In the beggining I thought the same has you, but rapidly I saw that it would be impossible to run it smoothly (and my project is not smooth enough, i can assure you, cause of the delay to get the coords for drawing the meshes).
  12. Hello again, I'm kind a newbie also, so I'm not completely sure of what I'm going to say. But, in the way I see, it's not completely possible to do what you want. But you do own some control over the particle system. In first place the particle system is "associated" to a mesh, so if the particle system is started and you move the mesh, the particle system will move with it. In second place, you can control the direction of the particles with .direction1 and .direction2 vectors. I hope i helped you out, but i doubt
  13. Hello Soul Linker. I'm not really sure what you mean. Did you checked the tutorial ? (https://github.com/BabylonJS/Babylon.js/wiki/12-Particles) Anyway, you do have to create a particle system, you can always change the emiterate do 1 (by setting particlesystem.emitrate = 1), but I suspect that is not what you are looking for. Can you try to be a bit more clear ?
  14. Hey guys. I didn't test it but it maybe helpfull. It explains how to simulate the "keypressed" event that you are looking for. Although it's not a good practice. function simulateKeyPress(character) {jQuery.event.trigger({ type : 'keypress', which : character.charCodeAt(keycodethatyouwant) });}$(function() {$('body').keypress(function(e) {yourfunction();});simulateKeyPress("thekeythatyouwanttobepressed");});
  15. Hello everyone. (Merfoo, sorry if I'll "kidnap" your topic , but I think it applies to this topic). Did some one already tried to use octree in collision detection? I'm trying to shoot a mesh against other mesh, how do i use octree on this? I already used "dynamicContent.push(mesh)" in all my mesh's (that move) and the octree is beeing updated on the render loop.
  16. Thanks Delta. I can finally close this "never ending" topic.
  17. Man..... That's really a great feature I have to try it.
  18. Nope, wrong answer Wingnut , You did answer my question, because, in line 1086 says if (!noMipmap) do generateMipmap, and thats the point, if I don't use the parameter, noMipmap will be empty or Null, so... there will be noMipmap, and by that it will generate a Mipmap texture. Now... the real question, is.... What do I put there so that it doesn't generate mipmap textures ? So, you actually helped out
  19. Hello Delta, I thought about it, and almost implemented something like that, although when I checked the babylon.lensflare.js file, I saw a this method (LensFlareSystem.prototype.render = function ()), it has one intensity property that works with two away vars (awayX and awayY), but this doesn't seem to be working properly. And I want to understand if i'm doing something wrong or if this is not supposed to work the way I'm thinking.
  20. I checked out the constructor. But by default the cubetexture receives what I put in the constructor in the "noMipmap" variable, well the thing is. I don't use the last two parameters on the signature (function CubeTexture(rootUrl, scene, extensions, noMipmap)), I only use rootUrl and scene, the other two that I'm not putting anything what will it assume? Null ?
  21. Hello guys. I don't use the Y axis, so I don't need a octree, a quadtree would be suficient, and would reduce calculation complexity. Is there any, or I have to use the octree anyway. BTW, is there any demo/tutorial so that we can check it out?
  22. Indeed mate. You see, it happens the same in the demo, you can zoom out of the skybox but the lens flare are still visible. I need somehow to limit that to a view distance limit or else fade out.
  23. Hello everyone, I've been trying for the past few hours to put out a lens flare that would fade away if the camera was more then at certain distance from the light. When I check the babylon.lensFlare.js it appears that the solution is on the borderlimit variable. Although, somehow if i put the borderlimit bigger then one the lensflare never disapear from the screen. And if i put him negative or zero, it doesn't appear at all. Anyone worked around with this already ? (Delta, I'll test the mipmap in this evening no worry, I promise you )
  24. You are right mate!. Indeed.... 2048*2048 is to big. Altough, there wasn't a problem when running on 1.11 and now we have a problem running on 1.12. And that's the point. We have to find out what's happening. I'll change my res to 1024*1024. Thanks anyway dad72.