We use this in a shader previewer for Planeshift:
First create a new shader var:
csRef<iStringSet> strings = csQueryRegistryTagInterface<iStringSet>
(GetObjectRegistry(), "crystalspace.shared.stringset");
lightSV = new csShaderVariable(strings->Request("lightPos"));
lightSV->SetType(csShaderVariable::VariableType::VECTOR3);
Later on, attach in to an iMeshWrapper:
meshwrapper->GetSVContext()->AddVariable(lightSV);
Whenever value changes:
lightSV->SetValue(lightPos);
--
Andrew Robberts
On 8/8/07, Vincent Knecht <[EMAIL PROTECTED]> wrote:
>
> > Hi,
> > there are some changes wrt shader variable names are handled in code in
> > the render manager branch. We're a bit unsure right now how (if) we
> > preserve code compatibility. To this end I'd like to conduct a little
> > survey on your use of shader variables in code (not world files etc!).
> >
> > So: do you manipulate SVs from code? If so, can you perhaps paste a
> > small representative snippet?
> >
> > -f.r.
>
> Hello,
>
> we have one shader var manipulation from code in Ecksdee,
> used to modulate ship's thruster visibility if player accelerates.
> Python code init:
>
> matw = thruster.Mesh.GetMeshObject().GetFactory().GetMaterialWrapper()
> mat = matw.GetMaterial()
> strings = CS_QUERY_REGISTRY_TAG_INTERFACE(oreg,
> 'crystalspace.shared.stringset', iStringSet)
> self.shaderVars.append(mat.GetVariable(strings.Request('glow alpha')))
>
> Then, to change thruster glow visibility:
> for shadervar in self.shaderVars:
> shadervar.SetValue(x)
>
> Really a simple usage...
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Crystal-main mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/crystal-main
> Unsubscribe: mailto:[EMAIL PROTECTED]
> ?subject=unsubscribe
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Crystal-main mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/crystal-main
Unsubscribe: mailto:[EMAIL PROTECTED]