Jump to content

shader inside a variable ?


phil1234
 Share

Recommended Posts

Hello,

 

a bit of documentation first: http://blogs.msdn.com/b/eternalcoding/archive/2014/04/17/learning-shaders-create-your-own-shaders-with-babylon-js.aspx

 

To answer your question, just copy your shader to BABYLON.Effect.ShadersStore["MyShaderVertexShader"] and BABYLON.Effect.ShadersStore["MyShaderFragmentShader"]

Link to comment
Share on other sites

I got a problem with code and coments //

seems like the code is contatenated into a big line, so everything after the ferst // is discared

one solution is to use /* */ but is there no other way ? like injecting \r\n or something ?

 

[edit : solution in php : str_replace("\r\n", "\\r\\n\\\r\n", $text);  ]

Link to comment
Share on other sites

Hi Phil,

 

Can you provide an example and paste the code where you're having issues with remarks?  (example "//")  I'm not certain why this would be causing any issues for you.  But if you can post a real example where the script fails, it should be very easy to see what the problem is.

 

DB

Link to comment
Share on other sites

Hi Phil,

 

Can you provide an example and paste the code where you're having issues with remarks?  (example "//")  I'm not certain why this would be causing any issues for you.  But if you can post a real example where the script fails, it should be very easy to see what the problem is.

 

DB

 

just take any shader(the one in http://www.babylonjs-playground.com/#BLA36#4) and add a comment with //

I mean it's quiet predictable, since if there is no line break, there is noway for the compiler to wknow where comments stops and new line starts

 

to solve this I had to add \n\r inside the string, and voilà

(the shader code is read in php and injected in javascript code)

Link to comment
Share on other sites

Hi Phil,

 

I must not understand at all what problems you are running into.  I added dozens of remarks in your playground script, and in pllces where I thought I might have a problem completing a line.  I looked at the shaders, and couldn't break them either.  I saved out a layground scene, however, it's simply a bunch of remarks placed in random lines as well as potentially problematic lines.  But it's so remedial, I won't post unless you ask - but it's really is a worthless example.

 

As I must be misiing the point here, I'll let the dialogue continue, and see what others say concerning your issues.  By the way, the scene is a practicle example of a useful shader for many types of projects and scenes.  It looks great and works well.

 

Cheers,

 

DB

Link to comment
Share on other sites

Hi Phil,

 

I must not understand at all what problems you are running into.  I added dozens of remarks in your playground script, and in pllces where I thought I might have a problem completing a line.  I looked at the shaders, and couldn't break them either.  I saved out a layground scene, however, it's simply a bunch of remarks placed in random lines as well as potentially problematic lines.  But it's so remedial, I won't post unless you ask - but it's really is a worthless example.

 

As I must be misiing the point here, I'll let the dialogue continue, and see what others say concerning your issues.  By the way, the scene is a practicle example of a useful shader for many types of projects and scenes.  It looks great and works well.

 

Cheers,

 

DB

 

??? ok whatever, I dont really follow you, we're like chating at the wrong frequencies or something

nevermind

I could make it work anyway

sheers

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...