diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2014-05-07 05:56:42 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2014-05-07 05:57:32 +0400 |
commit | a351ff7264558c2aa271ad0ad9adf517538e5777 (patch) | |
tree | 8fbebf4a1d6f3a13023a43cfff9828ec0d719ea6 /source/blender/freestyle | |
parent | 2e07109febc31f86763a53d08bae66f7fe421619 (diff) |
Freestyle: removed the dummy implementation of a texture manager.
Legacy texture shaders from the original stand-alone Freestyle program are also
declared as deprecated, in favor of Blender's new line style textures.
Patch contribution by Paolo Acampora. Thanks!
Diffstat (limited to 'source/blender/freestyle')
5 files changed, 3 insertions, 245 deletions
diff --git a/source/blender/freestyle/CMakeLists.txt b/source/blender/freestyle/CMakeLists.txt index c786a2d5d35..c94a5ac9f92 100644 --- a/source/blender/freestyle/CMakeLists.txt +++ b/source/blender/freestyle/CMakeLists.txt @@ -38,8 +38,6 @@ set(SRC intern/blender_interface/BlenderStrokeRenderer.cpp intern/blender_interface/BlenderStrokeRenderer.h intern/blender_interface/BlenderStyleModule.h - intern/blender_interface/BlenderTextureManager.cpp - intern/blender_interface/BlenderTextureManager.h intern/blender_interface/FRS_freestyle.cpp intern/geometry/BBox.h intern/geometry/Bezier.cpp diff --git a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp index 93f720fc006..a77dbff17fd 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp +++ b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp @@ -23,7 +23,6 @@ */ #include "BlenderStrokeRenderer.h" -#include "BlenderTextureManager.h" #include "../application/AppConfig.h" #include "../stroke/Canvas.h" @@ -61,10 +60,6 @@ BlenderStrokeRenderer::BlenderStrokeRenderer(Render *re, int render_count) : Str { freestyle_bmain = &re->freestyle_bmain; - // TEMPORARY - need a texture manager - _textureManager = new BlenderTextureManager; - _textureManager->load(); - // for stroke mesh generation _width = re->winx; _height = re->winy; @@ -161,11 +156,6 @@ BlenderStrokeRenderer::~BlenderStrokeRenderer() BKE_libblock_free(freestyle_bmain, ma); } - if (0 != _textureManager) { - delete _textureManager; - _textureManager = NULL; - } - // The freestyle_scene object is not released here. Instead, // the scene is released in free_all_freestyle_renders() in // source/blender/render/intern/source/pipeline.c, after the diff --git a/source/blender/freestyle/intern/blender_interface/BlenderTextureManager.cpp b/source/blender/freestyle/intern/blender_interface/BlenderTextureManager.cpp deleted file mode 100644 index e58a219aede..00000000000 --- a/source/blender/freestyle/intern/blender_interface/BlenderTextureManager.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - * ***** 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/blender_interface/BlenderTextureManager.cpp - * \ingroup freestyle - */ - -#include "BlenderTextureManager.h" - -#include "BKE_global.h" - -namespace Freestyle { - -BlenderTextureManager::BlenderTextureManager() -: TextureManager() -{ - //_brushes_path = Config::getInstance()... -} - -BlenderTextureManager::~BlenderTextureManager() -{ -} - -void BlenderTextureManager::loadStandardBrushes() -{ -#if 0 - getBrushTextureIndex(TEXTURES_DIR "/brushes/charcoalAlpha.bmp", Stroke::HUMID_MEDIUM); - getBrushTextureIndex(TEXTURES_DIR "/brushes/washbrushAlpha.bmp", Stroke::HUMID_MEDIUM); - getBrushTextureIndex(TEXTURES_DIR "/brushes/oil.bmp", Stroke::HUMID_MEDIUM); - getBrushTextureIndex(TEXTURES_DIR "/brushes/oilnoblend.bmp", Stroke::HUMID_MEDIUM); - getBrushTextureIndex(TEXTURES_DIR "/brushes/charcoalAlpha.bmp", Stroke::DRY_MEDIUM); - getBrushTextureIndex(TEXTURES_DIR "/brushes/washbrushAlpha.bmp", Stroke::DRY_MEDIUM); - getBrushTextureIndex(TEXTURES_DIR "/brushes/opaqueDryBrushAlpha.bmp", Stroke::OPAQUE_MEDIUM); - getBrushTextureIndex(TEXTURES_DIR "/brushes/opaqueBrushAlpha.bmp", Stroke::OPAQUE_MEDIUM); - _defaultTextureId = getBrushTextureIndex("smoothAlpha.bmp", Stroke::OPAQUE_MEDIUM); -#endif -} - -unsigned int BlenderTextureManager::loadBrush(string sname, Stroke::MediumType mediumType) -{ -#if 0 - GLuint texId; - glGenTextures(1, &texId); - bool found = false; - vector<string> pathnames; - string path; //soc - StringUtils::getPathName(TextureManager::Options::getBrushesPath(), sname, pathnames); - for (vector<string>::const_iterator j = pathnames.begin(); j != pathnames.end(); j++) { - path = j->c_str(); - //soc if (QFile::exists(path)) { - if (BLI_exists( const_cast<char *>(path.c_str()))) { - found = true; - break; - } - } - if (!found) - return 0; - // Brush texture - if (G.debug & G_DEBUG_FREESTYLE) { - cout << "Loading brush texture..." << endl; - } - switch (mediumType) { - case Stroke::DRY_MEDIUM: - //soc prepareTextureLuminance((const char*)path.toAscii(), texId); - prepareTextureLuminance(path, texId); - break; - case Stroke::HUMID_MEDIUM: - case Stroke::OPAQUE_MEDIUM: - default: - //soc prepareTextureAlpha((const char*)path.toAscii(), texId); - prepareTextureAlpha(path, texId); - break; - } - if (G.debug & G_DEBUG_FREESTYLE) { - cout << "Done." << endl << endl; - } - - return texId; -#else - return 0; -#endif -} - -} /* namespace Freestyle */ diff --git a/source/blender/freestyle/intern/blender_interface/BlenderTextureManager.h b/source/blender/freestyle/intern/blender_interface/BlenderTextureManager.h deleted file mode 100644 index 7edbefd327b..00000000000 --- a/source/blender/freestyle/intern/blender_interface/BlenderTextureManager.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * ***** 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 __BLENDERTEXTUREMANAGER_H__ -#define __BLENDERTEXTUREMANAGER_H__ - -/** \file blender/freestyle/intern/blender_interface/BlenderTextureManager.h - * \ingroup freestyle - */ - -# include "../stroke/StrokeRenderer.h" -# include "../stroke/StrokeRep.h" -# include "../system/FreestyleConfig.h" - -namespace Freestyle { - -/*! Class to load textures */ -class BlenderTextureManager : public TextureManager -{ -public: - BlenderTextureManager(); - virtual ~BlenderTextureManager(); - -protected: - virtual unsigned int loadBrush(string fileName, Stroke::MediumType=Stroke::OPAQUE_MEDIUM); - -protected: - virtual void loadStandardBrushes(); - -#ifdef WITH_CXX_GUARDEDALLOC - MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:BlenderTextureManager") -#endif - -}; - -} /* namespace Freestyle */ - -#endif // __BLENDERTEXTUREMANAGER_H__ diff --git a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp index a9138704290..e92913d097e 100644 --- a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp +++ b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp @@ -460,90 +460,16 @@ int StrokeTextureStepShader::shade(Stroke& stroke) const return 0; } +// Legacy shaders from freestyle standalone texture system int TextureAssignerShader::shade(Stroke& stroke) const { -#if 0 - getBrushTextureIndex(TEXTURES_DIR "/brushes/charcoalAlpha.bmp", Stroke::HUMID_MEDIUM); - getBrushTextureIndex(TEXTURES_DIR "/brushes/washbrushAlpha.bmp", Stroke::HUMID_MEDIUM); - getBrushTextureIndex(TEXTURES_DIR "/brushes/oil.bmp", Stroke::HUMID_MEDIUM); - getBrushTextureIndex(TEXTURES_DIR "/brushes/oilnoblend.bmp", Stroke::HUMID_MEDIUM); - getBrushTextureIndex(TEXTURES_DIR "/brushes/charcoalAlpha.bmp", Stroke::DRY_MEDIUM); - getBrushTextureIndex(TEXTURES_DIR "/brushes/washbrushAlpha.bmp", Stroke::DRY_MEDIUM); - getBrushTextureIndex(TEXTURES_DIR "/brushes/opaqueDryBrushAlpha.bmp", Stroke::OPAQUE_MEDIUM); - getBrushTextureIndex(TEXTURES_DIR "/brushes/opaqueBrushAlpha.bmp", Stroke::OPAQUE_MEDIUM); -#endif - - TextureManager *instance = TextureManager::getInstance(); - if (!instance) - return 0; - string pathname; - Stroke::MediumType mediumType; - bool hasTips = false; - switch (_textureId) { - case 0: - //pathname = TextureManager::Options::getBrushesPath() + "/charcoalAlpha.bmp"; - pathname = "/charcoalAlpha.bmp"; - mediumType = Stroke::HUMID_MEDIUM; - hasTips = false; - break; - case 1: - pathname = "/washbrushAlpha.bmp"; - mediumType = Stroke::HUMID_MEDIUM; - hasTips = true; - break; - case 2: - pathname = "/oil.bmp"; - mediumType = Stroke::HUMID_MEDIUM; - hasTips = true; - break; - case 3: - pathname = "/oilnoblend.bmp"; - mediumType = Stroke::HUMID_MEDIUM; - hasTips = true; - break; - case 4: - pathname = "/charcoalAlpha.bmp"; - mediumType = Stroke::DRY_MEDIUM; - hasTips = false; - break; - case 5: - mediumType = Stroke::DRY_MEDIUM; - hasTips = true; - break; - case 6: - pathname = "/opaqueDryBrushAlpha.bmp"; - mediumType = Stroke::OPAQUE_MEDIUM; - hasTips = true; - break; - case 7: - pathname = "/opaqueBrushAlpha.bmp"; - mediumType = Stroke::OPAQUE_MEDIUM; - hasTips = true; - break; - default: - pathname = "/smoothAlpha.bmp"; - mediumType = Stroke::OPAQUE_MEDIUM; - hasTips = false; - break; - } - unsigned int texId = instance->getBrushTextureIndex(pathname, mediumType); - stroke.setMediumType(mediumType); - stroke.setTips(hasTips); - stroke.setTextureId(texId); + cout << "TextureAssignerShader is not supported in blender, please use the BlenderTextureShader" << endl; return 0; } -// FIXME int StrokeTextureShader::shade(Stroke& stroke) const { - TextureManager *instance = TextureManager::getInstance(); - if (!instance) - return 0; - string pathname = TextureManager::Options::getBrushesPath() + "/" + _texturePath; - unsigned int texId = instance->getBrushTextureIndex(pathname, _mediumType); - stroke.setMediumType(_mediumType); - stroke.setTips(_tips); - stroke.setTextureId(texId); + cout << "StrokeTextureShader is not supported in blender, please use the BlenderTextureShader" << endl; return 0; } |