Jump to content
  • Advertisement
Sign in to follow this  

Scripting, shader integration idea (need input)

This topic is 3749 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

-- Situation -- Cg for shaders, Squirrel for scripting, SqPlus for binding. -- Idea -- ____To use Squirrel's table data structure to store uniform names as keys, and their values in the slot corresponding to that key. Then the uniform names can be treated like members of a struct, so that setting the uniforms is conceptually simpler for the scripter. This would also allow adding new uniforms without messing with the C++ code at all. I could also overload the _set metamethod so that assigning them calls the uniform upload method, though I figure uploading them all at once would be more efficient. -- Example script --
// Squirrel code, using my bound math classes

params = {};

params.worldViewProj = Matrix4x4.RotateZXY(30, 40, 50);
params.upDirection = Vector3(0.0, 0.0, 1.0);
params.eyePosWorld = eyePosition;

setMaterialParams("SoldierClothing", params);

-- Concerns -- ____I'm not sure how well this technique will scale, and what kind of performance hit it will cause. I expect a fair hit from having to iterate over the table in my C++ code, checking the types of each slot in the table, to determine correct uniform upload method. Then having to get the actual data from the Squirrel VM. -- Questions -- ____Can you guys offer your thoughts on this system? What kinds of pitfalls might I encounter? Any suggestions from your personal experience working with Squirrel, or scripting in general? Thanks. [Edited by - n00body on August 16, 2008 12:49:04 AM]

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!