ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > CopperCube > Programming and Scripting
forum topic indicator Question about all those shader scripts
person icon
gazzauk
Registered User
Quote
2026-04-14 04:00:52

I see alot of ccb shader scripts out there that load the shader script code embed in quotes using the following format:


var vertexShader =
" float4x4 mWorldViewProj;// World * View * Projection \n" +
" float4x4 mTransWorld; // Transposed world matrix \n" +
" float4x4 mInvWorld; // Inverted world matrix \n" +
" float4 CamPos; // camera position \n" +
" \n" + etc..etc..etc..etc..


My question is, why don't the creators of these scripts load the shader script code from an external file using this function instead:

var vertexShader = ccbReadFileContent('shader.hlsl');


It's alot more practical than peppering the scripts with all those embeded strings and "/n" lines. The shader code is also much easier to edit stored in it's own file.

Anyone else ever thought of this ??

person icon
okeoke
Registered User
Quote
2026-04-14 18:42:30

It is done to keep all the code in the same file.

While writing shaders I also read from separate files - as soon as it is done merge them into js file.

person icon
gazzauk
Registered User
Quote
2026-04-14 19:04:08

wrote:
It is done to keep all the code in the same file.

While writing shaders I also read from separate files - as soon as it is done merge them into js file.


I know it keeps everything in a single file, but really, what's the benefit of this ?? Having to add all those strings must take some extra time and effort, apart from that, reading the code is a jumbled mess.

person icon
okeoke
Registered User
Quote
2026-04-14 22:19:09

* If someone sends you one script, it always contains the shader source. No missing dependencies
* It works the same way on desktop and web, you can't simply read local files using ccbReadFile on web
* You close your code in case you only publish .exe
* It is so happen historically

It literally takes seconds to do so.

What is your problem? - you want to distribute your stuff that way feel free to do so.

person icon
gazzauk
Registered User
Quote
2026-04-15 06:54:40

wrote:
* If someone sends you one script, it always contains the shader source. No missing dependencies
* It works the same way on desktop and web, you can't simply read local files using ccbReadFile on web
* You close your code in case you only publish .exe
* It is so happen historically

It literally takes seconds to do so.

What is your problem? - you want to distribute your stuff that way feel free to do so.


I didn't know some people had a hard time handling more than 1 file.I don't have a problem with how someone decides to code, I was simply pointing out a much cleaner way of coding.

Sorry I upset you.


Create reply:










 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


icon_holyicon_cryicon_devilicon_lookicon_grinicon_kissicon_monkeyicon_hmpf
icon_sadicon_happyicon_smileicon_uhicon_blink   






Copyright© Ambiera e.U. all rights reserved.
Contact | Imprint | Products | Privacy Policy | Terms and Conditions |