Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2012-11-03 18:32:35 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2012-11-03 18:32:35 +0400
commiteb87529e23cdc744ed52b00f3de25e208b29d7f1 (patch)
treea0579a1bfb292d8908c8e704a6d82f4dc3f47ecb /intern/cycles/render/osl.h
parente02b23b81ab05579c0ee11ee3a1acb283643e528 (diff)
Cycles OSL: shader script node
Documentation here: http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Nodes/OSL http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.65/Cycles These changes require an OSL build from this repository: https://github.com/DingTo/OpenShadingLanguage The lib/ OSL has not been updated yet, so you might want to keep OSL disabled until that is done. Still todo: * Auto update for external .osl files not working currently, press update manually * Node could indicate better when a refresh is needed * Attributes like UV or generated coordinates may be missing when requested from an OSL shader, need a way to request them to be loaded by cycles * Expose string, enum and other non-socket parameters * Scons build support Thanks to Thomas, Lukas and Dalai for the implementation.
Diffstat (limited to 'intern/cycles/render/osl.h')
-rw-r--r--intern/cycles/render/osl.h23
1 files changed, 20 insertions, 3 deletions
diff --git a/intern/cycles/render/osl.h b/intern/cycles/render/osl.h
index 90107a34a98..cee37c58d74 100644
--- a/intern/cycles/render/osl.h
+++ b/intern/cycles/render/osl.h
@@ -20,11 +20,14 @@
#define __OSL_H__
#include "util_set.h"
+#include "util_string.h"
#include "shader.h"
#ifdef WITH_OSL
+#include <OSL/oslcomp.h>
#include <OSL/oslexec.h>
+#include <OSL/oslquery.h>
#endif
CCL_NAMESPACE_BEGIN
@@ -52,11 +55,24 @@ public:
void device_update(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress);
void device_free(Device *device, DeviceScene *dscene);
-private:
+ /* osl compile and query */
+ static bool osl_compile(const string& inputfile, const string& outputfile);
+ static bool osl_query(OSL::OSLQuery& query, const string& filepath);
+
+ /* shader file loading, all functions return pointer to hash string if found */
+ const char *shader_test_loaded(const string& hash);
+ const char *shader_load_bytecode(const string& hash, const string& bytecode);
+ const char *shader_load_filepath(string filepath);
+
+protected:
+ void texture_system_init();
+ void shading_system_init();
+
OSL::ShadingSystem *ss;
OSL::TextureSystem *ts;
OSLRenderServices *services;
OSL::ErrorHandler errhandler;
+ set<string> loaded_shaders;
};
#endif
@@ -65,10 +81,10 @@ private:
class OSLCompiler {
public:
- OSLCompiler(void *shadingsys);
+ OSLCompiler(void *manager, void *shadingsys);
void compile(OSLGlobals *og, Shader *shader);
- void add(ShaderNode *node, const char *name);
+ void add(ShaderNode *node, const char *name, bool isfilepath = false);
void parameter(const char *name, float f);
void parameter_color(const char *name, float3 f);
@@ -104,6 +120,7 @@ private:
void generate_nodes(const set<ShaderNode*>& nodes);
void *shadingsys;
+ void *manager;
ShaderType current_type;
Shader *current_shader;
};