dbawel

Members
  • Content count

    988
  • Joined

  • Last visited

  • Days Won

    19

dbawel last won the day on August 28 2016

dbawel had the most liked content!

3 Followers

About dbawel

  • Rank
    Advanced Member

Profile Information

  • Gender
    Male
  • Location
    California
  • Interests
    Film, Television, Animation, Technology

Recent Profile Visitors

2,959 profile views
  1. @lihis - If you're going to use right mouse events to trigger 'something', your browser will pop up the default context menu for each specific browser; which makes right mouse events annoying at best. However, you can disable the browser's default context menu by returning "false" in the event handler when capturing the onContextMenu event. Example: <body oncontextmenu="return false;"> If this is something you're already aware of, great. However, it's good for others to know as most Devs don't use right mouse events due to the various browser's displaying the context menu by default. DB
  2. Texture caching

    Hi @JCPalmer @RaananW - Your description above is how the Asset Manager is supposed to function, but as previously mentioned when loading many assets, the Asset Manager often returned true without all assets loaded. And it's not that the Asset Manager continued to load after returning true, but failed to complete loading assets following the return of true to report that all assets have been loaded. However, I just tried loading a heavy scene which has consistently failed to load all textures for the GUI, as all textures are loaded though the Asset Manager. But loading the scene multiple times this evening with the "dummy" textures removed, the scene loaded correctly every time. However, I am using an updated babylon.js file, whereas when I had problems previously, I was using the then current versions of 2.2 and prior. So perhaps the bug I regularly encountered using the Asset Manager has been fixed. I'll test further, but am currently not able to repro the bug I used to find consistently. I simply got in the habit of adding "dummy" assets to load as a routine action; but it appears this is not necessary any longer. I'll report to the forum if I see this again, however, it's been a while since I've needed to use the Asset Manager as I've recently been working outside of WebGL for the most part. If the problem no longer exists, then ignore my recent posts. Thanks for following up on this, as I would not have realized that perhaps this particular bug has been fixed. I'm still not entirely confident, but since I'm not able to repro anymore, I have to assume it's no longer an issue. Thanks, DB
  3. @Herbert - I've found the assetsManager.onFinish to cause errors for several BJS versions all the way back to before 2.0. It often reports that all assets are loaded before it has finished and everything is actually cached. It happens most often in my scenes when I'm loading allot of small assets such as low res textures - especially when building GUIs and loading the assets to use in extensions. So I often find that once my scene is loaded, there are images missing from my scene and/or from the GUI. And since the AssetsManager loads in sequence, as logic dictates, it will always be the assets at the very end if the list which aren't loaded when my scene initializes when onLoad reports true. I gave up trying to solve this problem at least 2 years ago, and do have a work around. I create 2 or 3 very small power of two textures at 32px X 32px and simply call them "dummy_texture1.png", "dummy_texture2.png", and so on. These are never meant to be used, and in all of my testing, I've rarely seen the Assets Manager miss more than 1 or 2 textures at most. 2 appears to be the limit for me generally. I know this is a ridiculous solution, but I don't have another and can't have my scenes initializing with missing assets. So I place 2 or 3 of these tiny "dummy" textures at the end of my list of assets to load, and my scene is still often loaded before all assets are cached - however I receive no errors as the "dummy" textures are never called, and don't really use any resources to ever consider when they do load. Again, not a very eloquent solution, however I never have the problem of my scene initializing with missing assets - forcing the user to reload. And I'll mention again that I've worked on trying to solve this in every way I can think of down to memory allocation calls; but had to give up as I simply couldn't find a consistent solution. And I never want users to be forced to refresh their scenes due to missing textures and/or assets. Of course this generally happens when I'm loading allot of assets prior to scene initialization - but create and load small dummy textures to the end of the list and it will never happen. I hate to even mention that I do this routinely, but I've found no better choice personally. Cheers, DB
  4. Texture caching

    Keep in mind that you may have issues with the scene initializing before all textures and assets are loaded. My workaround for this is to creat a couple of "dummy" textures and load them last, so that when the scene sometimes initializes before everything is loaded, it loads in sequence so the missing assets are never missed as they were never meant to be used. So FYI - the issue I often find in your case is that I wait for the assets manager to verify that everything is loaded before initializing; however, setting your scene up the way that @RaananW suggests sometimes causes odd behaviors in initializing before the loader has completed - even though it reports that the assets Manager is finished. Just a heads up. DB
  5. I don't know which controller you're using, but if it's the Vive controllers, they have issues with connectivity - not a babylon issue. For development, I use the Moga Pro bluetooth controller as it connects 100% of the time to every device and can handle 95% of my control setups. I only develop with the Vive controllers when necessary, as I can't handle interruptions during development. DB
  6. Hello, @Pryme8 is correct in his last post, and I personally would be using Ajax to _Post the variable - or echo the PHP variable in javascript text which is very straight forward; and there are many examples on the Stack Overflow forum with jsfiddle code examples for this and other methods - depending on your needs. In the script example above, I was passing an event to a specific case incorrectly; whereas he added a 'CHANGE:' function which allows me to change values when passing the event to specific cases - however, it's no obvious in the example above as there's more to the code which would require far more than a single post to expand upon. It's also a very different approach architecturally than what most Developers would choose for what is generally required to simply pass variables between JS and PHP. My issue was that I didn't fully understand that I wasn't passing the correct event at the correct time within the code that @Pryme8 initially set up for me governing how variables and functions are called and passed within the app until I got too frustrated on my own and contacted him directly - which he then solved in about about 20 minutes following my wasting 2 days of my time prior. After working on several projects with him, I find he is always at least 10 steps ahead of me when it comes to solving coding issues. If anyone else is truly having issues passing variables between JS and PHP, then create a post and I can point you to a few simple examples of what is normally used as methods in passing variables between PHP and Javascript - which actually wasn't my problem - but valuable to know. Otherwise, I'm back on track and moving quickly through building the UI which is built in HTML and CSS primarily using PHP - with Javascript to handle most of the dynamic functions within the app. I would have to say that whenever I need serious help, it's been well worth hiring @Pryme8 to handle much of the "heavy lifting" when it comes to finding solutions to unique problems in games and apps - worth every penny I've ever spent bringing him into a project. I know this sounds like an ad for hiring him, but it actually is - as I'd have developed a far different and less efficient architecture on two different projects recently - as he saved my ass on both building something I could work with and easily expand, once I could mentally grasp what he'd built. Otherwise, the process in working to find solutions on my own has schooled me and made me a far better developer, so I owe him a great deal for building the elements and leaving me to finish the work - as he was busy on other projects. And now I can assist other developers in areas which I had absolutely no clue - and am thinking way out of the box to solve many problems by anticipating functionality far in advance. So I'll mark this question as solved, however, if anyone needs help with PHP and JS, I'm happy to say I can now assist in most areas. Create a new post if there is still an issue for other developers on this forum, and I'm certainly happy to help with what I've recently learned the hard way. Cheers, DB
  7. Hello, I have a form built using PHP, and need to pass the text input value to an external .js file. Here is the PHP code: <?php $brsh_size = 1; ?> <span> <div><span><center><input class = 'sp-flat' type="color" id="picker" value="#000" act="get-color" /></center></div> <center class='font-brush'>Brush Size:</a><input type="text" size="3" maxlength="3" id="br_size" act="get-brushsize" value="<?php echo $brsh_size;?>"></div></center> </span> I have a case is an external .js file where the case is called correctly: case 'get-brushsize': //var myPhpValue = $("#brsh_size").val(); //console.log(myPhpValue); //var brush_size_i = document.getElementById("br_size").value; //console.log("brush size is " + brush_size_i); break; I left some of my trial code for reference, but please ignore as I've gotten much farther with this - but run into issues. I've tried every method on stack overflow and other sites, and am unable to '_GET' the value of the PHP variable (not my first choice) but preferably the text input from the input 'id'. Any help is appreciated. Thanks, DB
  8. Creation of ground

    @juanmajr93 Have you tried a normal map within a bumpTexture channel? Normal maps are simple to create in photoshop if you install a free plugin by NVidea. DB
  9. @RaananW of course, is correct in declaring his fondness for babylon.js. Most of us have worked with practically every other WebGL framework, and there is no question currently that baylon.js is not only more functional and powerul 'straight out of the box', but BJS is far more flexible when the project requires unique tools to be built. Not only are there dramatic limitations within other WebGL frameworks, but you'll find that there is generally less code to write and a shorter path to creating most anything you might accomplish using OpenGL. DB
  10. I'm not certain what isn't working for you. As @RaananW mentioned: Perhaps if you can define your goal so we might understand, we can help you find a solution. DB
  11. Creation of ground

    I would personally create the ground as a squre, and use a material/texture with an alpha channel to create any shape you wish to be rendered. I believe this would be far simple than what is currently being discussed; however, I'm not certain what the final use will be, and there may be a few rare cases where masking the geometry with an alpha channel for renderig may not produce the results you require - such as in the case of particle collisions. DB
  12. Work offer

    @simon_bg- A simple job... just a few hours. If I was certain I had time, I'd throw my hat in the ring. But I'm hoping you already have quite a few qualified devs. in the que. Just make certain that whomever Developer you chose knows how to capture a single touch event by passing touch events to an array and only using the first posX and posY in a 'touch_array'[0] - and to completely avoid using FillRect() except in clearing the canvas - or you'll be forced to write two seperate apps; one to draw on touchscreens and one to draw with a mouse, as fillRect() won't remotely accomplish both. However using: ctx.fill(); following with ctx.beginPath(); and ctx.closePath(); will allow you to draw with both your touch events and your mouse events on all hardware, in all browsers, and OS. I just went through this, and after several dozen "seasoned" developers on sites such as stackoverflow told me it was not at all possible to draw using both touch and mouse events in a single app, I found out they were very mis-guided. So just make certain that whomever developer you chose is familiar with capturing touch events and filling paths to draw, or you'll be writing more than one app., and spending far more budget than necessary. There is a bit more math needed to accomplish this, but it's not difficult stuff - and so many devs will either tell you this cannot be done or will spend countless hours trying to figure out what I'm even talking about. However, this should be a cakewalk. DB
  13. Issue in loading image

    I know this doesn't relate to your current issue, but I thought I'd provide an answer to a seperate problem which appears often when loading a large # of textures for a scene - where the last few image files don't buffer and appear black in your scene. Again, that's not what's happenning here, but it occurs so often for myself and others, that I tought it might be valuable to methion for future reference by others. As an example, I have a GUI which requires approx. 30 power of 2 image files to use as GUI buttons, and the last one or two appear black as they don't load before the scene is initialized. The code is as follows: var assets = []; var loader = new BABYLON.AssetsManager(scene); //Load textures for GUI var toLoad = [ {name : "bgnd_color", src : "./textures/bgnd_color.png" }, {name : "color_picker", src : "./textures/color_picker.png" }, {name : "brush_size_icon", src : "./textures/brush_size_icon.png" }, {name : "increase_brush", src : "./textures/increase_brush.png" }, {name : "decrease_brush", src : "./textures/decrease_brush.png" }, {name : "eraser", src : "./textures/eraser.png" }, {name : "video_slate", src : "./textures/video_slate.png" }, {name : "button_d", src : "./textures/3d_icon.png" }, {name : "frame_start", src : "./textures/frame_start.png" }, {name : "frame_end", src : "./textures/frame_end.png" }, {name : "video_pause", src : "./textures/video_pause.png" }, {name : "video_play", src : "./textures/video_play.png" }, {name : "button_play", src : "./textures/button_play.png" }, {name : "button_pause", src : "./textures/button_pause.png" }, {name : "button_rev", src : "./textures/button_rev.png" }, {name : "button_fwd", src : "./textures/button_fwd.png" }, {name : "button_notes", src : "./textures/session_notes.png" }, {name : "button_slider1", src : "./textures/slider1.png" }, {name : "button_slider2", src : "./textures/slider2.png" }, {name : "admin_button", src : "./textures/admin_button.png" }, {name : "console_button", src : "./textures/console_button.png" }, {name : "s_notes_button", src : "./textures/s_notes.png" }, {name : "m_list_button", src : "./textures/m_list.png" }, {name : "login_button", src : "./textures/login_button.png" }, {name : "about_button", src : "./textures/about_button.png" }, {name : "erase_all", src : "./textures/erase_all_button.png" }, {name : "brush_size", src : "./textures/brush_size.png" }, {name : "undo_icon", src : "./textures/undo_icon.png" }, {name : "redo_icon", src : "./textures/redo_icon.png" }, ]; toLoad.forEach(function(obj) { var img = loader.addTextureTask(obj.name, obj.src); img.onSuccess = function(t) { assets[t.name] = t.texture; }; }); loader.onFinish = function() { /* I initialize my scene, canvas, GUI extension, etc from this point forward within this function*/ }; As you can see, I attempt to verify that all textures are loaded before I initialize the scene and canvas, yet practically 50% of the time, one or many more of my GUI images and textures are not loaded and appear black in the scene. The only solution I've found for this is to load additional "dummy images" into my texture array which are not used. This allows me to always load all essential textures into the texture array, as the loader still skips loading all textures, but will miss the last one or more textures I call simply to ensure all textures are loaded. In the following case, I load two additional "dummy textures" immediately following my rquired textures which the two dummy textures are never called in my scene: {name : "dummy_image", src : "./textures/dummy_image.png" }, {name : "dummy_image_2", src : "./textures/dummy_image_2.png" }, As I find that missing textures and other assets to be a problem when loading large scenes and/or large dynamic GUIs, adding these "dummy textures" or other assets always assure that I do load the assets my scene requires as the loader will load from the list in order, missing only the last textures I'm loading ito my image array. Again, this doesn't apply to the initial question in this post, but as I thought this might initially be the problem until I read through the post, I thought I'd add this scenario ad solution so others don't have to waste considerable time on a solution when it happens to them - and if you are building large scenes, it almost always will happen to you at some time. DB
  14. Can you rip this code?

    @imerso I'm not sure why you would want to do this - unless you were hard coding passwords and other high security info in your JS - which would be a huge mistake anyway. Otherwise, I've found practically nothing that is written in JavaScript which needs to be hidden as there's practically very little "new" approaches to accomplishing what is seen on-screen, and most any JS developer can recrete whatever they see. If you're trying to hide server side operations, then you can look at Socket.IO and Node.IO to hide much of what you are doing which you wish to remain secure. Also look at exmples of obfuscation - which to me is more wasted time than what you wish to accomplish - and you had better be a creatinve developer as there's no reason or logic which will take you step by step through how you choose to create machine code which makes sense within your application. My company has built a node.js server brain which determines operations on the srver side, and is remote from the application and local functions - as again, show me a function locally, and I'll be able to recreate it with little effort generally. Perhaps if you describe "why" you need to hide your JS code, then we might be able to assist. Otherwise, it simply makes no sense as to why hide your JS files in the first place. It also depends on who you are trying to hide the scripts from. If you're attempting to hide from most common front end developers, then perhaps use a combination of PHP and run your "secret" scripts server side using ASP - then call it via AJAX. However, almot anything can still be read by anyone who really wants to read it. Once again, why? DB
  15. @ian- The gamepad is always crucial to me. I primarily develop for the MOGA Pro - as this will provide support for every device and OS with minimal effort. Other controllers can cause real functionality issues. DB