Horde3D

Next-Generation Graphics Engine
It is currently 02.05.2025, 19:02

All times are UTC + 1 hour




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: User shader constants
PostPosted: 24.03.2008, 12:53 
Offline

Joined: 20.12.2007, 00:18
Posts: 23
Hi,

Is there currently a 'approved' method of adding your own shader constants? I could do this simply by adding constants to the ShaderContext, but I'd rather not have to change the actual Horde code to do this. Similarly I don't want to expose the shader context to the app itself but do require the ability to set constants based on input for example. Ideally I'd be able to add things in a similar way to how the integrationlib currently functions so I don't have to explose Horde's internals, or make changes to Horde that I then have to integrate with each new release.

Cheers!


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: 24.03.2008, 17:44 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
You can use arbitrarily named vec4-uniforms in your shaders. You just need to define them in the material file that references your shader. Please have a look at the material format specification for the syntax.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: 24.03.2008, 20:08 
Offline

Joined: 19.11.2007, 19:35
Posts: 218
Horde3D::setMaterialUniform(resource handle, uniform name, a, b, c, d);

Though 0.14 doesn't have private duplication of resources so setting a material uniform will affect everything that uses the material. That's all in the next release.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: 24.03.2008, 20:34 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
Horde3D::setMaterialUniform sets the uniform globally for a material. There is also Horde3D::setMeshUniform with which you can overwrite a uniform for a single mesh.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 75 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group