View Full Version : MetaSL and native functions
July 21st, 2008, 04:14
Im creating my own shaders for Mentall Mill (beta or Artistic Edition - they're available for me both) using MetaSL, however somehow I need to apply native shader code. I read in documentation that for this purpose there is 'native'keyword exists. But could you be more specific how to use this keyword? Any examples, frankly anything :)
I will really appreciate that.
July 21st, 2008, 23:58
I have not yet done this myself, but I asked a developer here for more information.
Native functions are not directly supported by the mental mill application yet. You can use one in a shader, but if that shader is used in mental mill, the preview rendering will fail because the application doesn't locate the native function implementation.
It is possible to use one and export the shader though. For example if the following appeared in the MetaSL shader source:
native Color foo(Color x);
Then elsewhere in the code the function 'foo' can be called and passed a Color. The generated shader will contain a call to foo(), which has no implementation and so the shader would fail to compile in the mental mill application (previews will have a red wireframe).
If the shader is exported, then it can be combined with the implementation of foo() and the shader will work.
(Note: By "combined", I meant that the text can be concatenated with the exported shader. Literally just paste the implementation of the native function at the start of the file.)
I hope this helps!
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.