diff options
7 files changed, 116 insertions, 0 deletions
diff --git a/source/blender/freestyle/CMakeLists.txt b/source/blender/freestyle/CMakeLists.txt index cb187eca6ac..6860afe64c2 100644 --- a/source/blender/freestyle/CMakeLists.txt +++ b/source/blender/freestyle/CMakeLists.txt @@ -392,6 +392,8 @@ set(SRC intern/scene_graph/NodeGroup.h intern/scene_graph/NodeLight.cpp intern/scene_graph/NodeLight.h + intern/scene_graph/NodeSceneRenderLayer.cpp + intern/scene_graph/NodeSceneRenderLayer.h intern/scene_graph/NodeShape.cpp intern/scene_graph/NodeShape.h intern/scene_graph/NodeTransform.cpp diff --git a/source/blender/freestyle/intern/application/Controller.cpp b/source/blender/freestyle/intern/application/Controller.cpp index 237176df5e3..7c8a0c9d079 100644 --- a/source/blender/freestyle/intern/application/Controller.cpp +++ b/source/blender/freestyle/intern/application/Controller.cpp @@ -40,6 +40,7 @@ extern "C" { #include "../scene_graph/NodeDrawingStyle.h" #include "../scene_graph/NodeShape.h" #include "../scene_graph/NodeTransform.h" +#include "../scene_graph/NodeSceneRenderLayer.h" #include "../scene_graph/ScenePrettyPrinter.h" #include "../scene_graph/VertexRep.h" @@ -294,6 +295,7 @@ int Controller::LoadMesh(Render *re, SceneRenderLayer *srl) } cam->setProjectionMatrix(proj); _RootNode->AddChild(cam); + _RootNode->AddChild(new NodeSceneRenderLayer(*srl)); sceneHashFunc.reset(); //blenderScene->accept(sceneHashFunc); diff --git a/source/blender/freestyle/intern/scene_graph/NodeSceneRenderLayer.cpp b/source/blender/freestyle/intern/scene_graph/NodeSceneRenderLayer.cpp new file mode 100644 index 00000000000..24c56ff4e28 --- /dev/null +++ b/source/blender/freestyle/intern/scene_graph/NodeSceneRenderLayer.cpp @@ -0,0 +1,35 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/freestyle/intern/scene_graph/NodeSceneRenderLayer.cpp + * \ingroup freestyle + * \brief Class to represent a scene render layer in Blender. + */ + +#include "NodeSceneRenderLayer.h" + +namespace Freestyle { + +void NodeSceneRenderLayer::accept(SceneVisitor& v) +{ + v.visitNodeSceneRenderLayer(*this); +} + +} /* namespace Freestyle */ diff --git a/source/blender/freestyle/intern/scene_graph/NodeSceneRenderLayer.h b/source/blender/freestyle/intern/scene_graph/NodeSceneRenderLayer.h new file mode 100644 index 00000000000..2fc08bb1175 --- /dev/null +++ b/source/blender/freestyle/intern/scene_graph/NodeSceneRenderLayer.h @@ -0,0 +1,64 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef __FREESTYLE_NODE_SCENE_RENDER_LAYER_H__ +#define __FREESTYLE_NODE_SCENE_RENDER_LAYER_H__ + +/** \file blender/freestyle/intern/scene_graph/NodeSceneRenderLayer.h + * \ingroup freestyle + * \brief Class to represent a scene render layer in Blender. + */ + +#include "Node.h" + +extern "C" { +#include "DNA_scene_types.h" /* for SceneRenderLayer */ +} + +using namespace std; + +namespace Freestyle { + +class NodeSceneRenderLayer : public Node +{ +public: + inline NodeSceneRenderLayer(SceneRenderLayer& srl) : Node(), _SceneRenderLayer(srl) {} + virtual ~NodeSceneRenderLayer() {} + + inline struct SceneRenderLayer& sceneRenderLayer() const + { + return _SceneRenderLayer; + } + + inline void setSceneRenderLayer(SceneRenderLayer& srl) + { + _SceneRenderLayer = srl; + } + + /*! Accept the corresponding visitor */ + virtual void accept(SceneVisitor& v); + +protected: + SceneRenderLayer& _SceneRenderLayer; +}; + +} /* namespace Freestyle */ + +#endif // __FREESTYLE_NODE_SCENE_RENDER_LAYER_H__ diff --git a/source/blender/freestyle/intern/scene_graph/SceneHash.cpp b/source/blender/freestyle/intern/scene_graph/SceneHash.cpp index 60b95aaf6c5..ee1d0c53b87 100644 --- a/source/blender/freestyle/intern/scene_graph/SceneHash.cpp +++ b/source/blender/freestyle/intern/scene_graph/SceneHash.cpp @@ -35,6 +35,15 @@ string SceneHash::toString() return ss.str(); } +void SceneHash::visitNodeSceneRenderLayer(NodeSceneRenderLayer& srl) +{ + struct FreestyleConfig *config = &srl.sceneRenderLayer().freestyleConfig; + adler32((unsigned char *)&config->flags, sizeof(int)); + adler32((unsigned char *)&config->crease_angle, sizeof(float)); + adler32((unsigned char *)&config->sphere_radius, sizeof(float)); + adler32((unsigned char *)&config->dkr_epsilon, sizeof(float)); +} + void SceneHash::visitNodeCamera(NodeCamera& cam) { double *proj = cam.projectionMatrix(); diff --git a/source/blender/freestyle/intern/scene_graph/SceneHash.h b/source/blender/freestyle/intern/scene_graph/SceneHash.h index 5521b792e89..9da711673f0 100644 --- a/source/blender/freestyle/intern/scene_graph/SceneHash.h +++ b/source/blender/freestyle/intern/scene_graph/SceneHash.h @@ -26,6 +26,7 @@ */ #include "IndexedFaceSet.h" +#include "NodeSceneRenderLayer.h" #include "NodeCamera.h" #include "SceneVisitor.h" @@ -48,6 +49,7 @@ public: virtual ~SceneHash() {} VISIT_DECL(NodeCamera) + VISIT_DECL(NodeSceneRenderLayer) VISIT_DECL(IndexedFaceSet) string toString(); diff --git a/source/blender/freestyle/intern/scene_graph/SceneVisitor.h b/source/blender/freestyle/intern/scene_graph/SceneVisitor.h index c00f5124a31..712585c4064 100644 --- a/source/blender/freestyle/intern/scene_graph/SceneVisitor.h +++ b/source/blender/freestyle/intern/scene_graph/SceneVisitor.h @@ -56,6 +56,7 @@ class NodeLight; class NodeCamera; class NodeDrawingStyle; class NodeTransform; +class NodeSceneRenderLayer; class Rep; class LineRep; @@ -87,6 +88,7 @@ public: VISIT_COMPLETE_DEF(NodeCamera) VISIT_COMPLETE_DEF(NodeDrawingStyle) VISIT_COMPLETE_DEF(NodeTransform) + VISIT_COMPLETE_DEF(NodeSceneRenderLayer) VISIT_COMPLETE_DEF(Rep) VISIT_COMPLETE_DEF(LineRep) |