From 4b4ac31a3d45587ebecc5d28f33a54e69969244d Mon Sep 17 00:00:00 2001 From: kaetemi Date: Wed, 2 Apr 2014 11:18:36 +0200 Subject: [PATCH] Remove branch unrelated features (must backout this changeset after merging into parent feature branch) --HG-- branch : opengl3 --- code/nel/include/nel/3d/driver.h | 11 - .../include/nel/3d/driver_material_inline.h | 2 +- code/nel/include/nel/3d/driver_user.h | 6 - code/nel/include/nel/3d/dyn_mat_loader.h | 45 - code/nel/include/nel/3d/dynamic_material.h | 121 - code/nel/include/nel/3d/material.h | 25 +- .../nel/3d/shape_material_serializer.h | 37 - code/nel/include/nel/3d/u_driver.h | 6 - code/nel/include/nel/3d/usr_shader_loader.h | 44 - code/nel/include/nel/3d/usr_shader_manager.h | 65 - code/nel/include/nel/3d/usr_shader_program.h | 71 - code/nel/include/nel/3d/usr_shader_saver.h | 50 - code/nel/include/nel/3d/usr_shader_visitor.h | 40 - code/nel/include/nel/misc/rgba.h | 9 - code/nel/include/nel/misc/variant.h | 109 - code/nel/src/3d/CMakeLists.txt | 17 - .../src/3d/driver/direct3d/driver_direct3d.h | 2 - .../driver/direct3d/driver_direct3d_light.cpp | 17 - code/nel/src/3d/driver/opengl/driver_opengl.h | 4 - .../3d/driver/opengl/driver_opengl_light.cpp | 16 - .../3d/driver/opengl/unix_event_emitter.cpp | 2 +- .../opengl3/driver_glsl_shader_generator.cpp | 516 +--- .../src/3d/driver/opengl3/driver_opengl.cpp | 24 +- .../nel/src/3d/driver/opengl3/driver_opengl.h | 13 +- .../driver/opengl3/driver_opengl_material.cpp | 16 - .../driver/opengl3/driver_opengl_program.cpp | 3 - code/nel/src/3d/driver_user.cpp | 39 - code/nel/src/3d/dyn_mat_loader.cpp | 61 - code/nel/src/3d/dynamic_material.cpp | 383 --- code/nel/src/3d/material.cpp | 195 -- code/nel/src/3d/meshvp_per_pixel_light.cpp | 2 +- code/nel/src/3d/shape_material_serializer.cpp | 102 - code/nel/src/3d/usr_shader_loader.cpp | 74 - code/nel/src/3d/usr_shader_manager.cpp | 157 -- code/nel/src/3d/usr_shader_program.cpp | 59 - code/nel/src/3d/usr_shader_saver.cpp | 71 - code/nel/src/misc/variant.cpp | 320 --- .../src/plugins/CMakeLists.txt | 1 - .../src/plugins/gui_editor/action_editor.ui | 120 - .../plugins/material_editor/CMakeLists.txt | 79 - .../material_editor/doc/material_editor.uml | 2507 ----------------- .../plugins/material_editor/fog_widget.cpp | 116 - .../src/plugins/material_editor/fog_widget.h | 56 - .../src/plugins/material_editor/fog_widget.ui | 83 - .../plugins/material_editor/lights_widget.cpp | 270 -- .../plugins/material_editor/lights_widget.h | 72 - .../plugins/material_editor/lights_widget.ui | 229 -- .../material_editor_constants.h | 33 - .../material_editor_context.cpp | 58 - .../material_editor/material_editor_context.h | 64 - .../material_editor_core_listener.cpp | 28 - .../material_editor_core_listener.h | 41 - .../material_editor/material_editor_global.h | 30 - .../material_editor_plugin.cpp | 82 - .../material_editor/material_editor_plugin.h | 69 - .../material_editor_window.cpp | 381 --- .../material_editor/material_editor_window.h | 83 - .../material_editor/material_editor_window.ui | 33 - .../material_editor/material_observer.h | 43 - .../material_editor/material_properties.cpp | 274 -- .../material_editor/material_properties.h | 60 - .../material_editor/material_properties.ui | 183 -- .../material_property_editor.cpp | 73 - .../material_property_editor.h | 70 - .../material_property_editor.ui | 140 - .../material_editor/material_splitter.cpp | 141 - .../material_editor/material_splitter.h | 73 - .../material_editor/material_widget.cpp | 270 -- .../plugins/material_editor/material_widget.h | 76 - .../material_editor/material_widget.ui | 126 - .../material_editor/nel3d_interface.cpp | 743 ----- .../plugins/material_editor/nel3d_interface.h | 331 --- .../ovqt_plugin_material_editor.xml | 10 - .../material_editor/primitives/cube.shape | Bin 1196 -> 0 bytes .../material_editor/primitives/cylinder.shape | Bin 6572 -> 0 bytes .../material_editor/primitives/sphere.shape | Bin 23564 -> 0 bytes .../material_editor/primitives/teapot.shape | Bin 25484 -> 0 bytes .../material_editor/prop_browser_ctrl.cpp | 394 --- .../material_editor/prop_browser_ctrl.h | 64 - .../plugins/material_editor/render_passes.cpp | 257 -- .../plugins/material_editor/render_passes.h | 59 - .../plugins/material_editor/render_passes.ui | 147 - .../plugins/material_editor/shader_editor.cpp | 90 - .../plugins/material_editor/shader_editor.h | 52 - .../plugins/material_editor/shader_editor.ui | 127 - .../plugins/material_editor/shader_widget.cpp | 220 -- .../plugins/material_editor/shader_widget.h | 61 - .../plugins/material_editor/shader_widget.ui | 116 - .../material_editor/viewport_widget.cpp | 154 - .../plugins/material_editor/viewport_widget.h | 68 - .../nel_export/nel_export_export.cpp | 9 +- .../nel_mesh_lib/export_material.cpp | 14 - .../scripts/startup/nel_material.ms | 82 +- 93 files changed, 49 insertions(+), 11647 deletions(-) delete mode 100644 code/nel/include/nel/3d/dyn_mat_loader.h delete mode 100644 code/nel/include/nel/3d/dynamic_material.h delete mode 100644 code/nel/include/nel/3d/shape_material_serializer.h delete mode 100644 code/nel/include/nel/3d/usr_shader_loader.h delete mode 100644 code/nel/include/nel/3d/usr_shader_manager.h delete mode 100644 code/nel/include/nel/3d/usr_shader_program.h delete mode 100644 code/nel/include/nel/3d/usr_shader_saver.h delete mode 100644 code/nel/include/nel/3d/usr_shader_visitor.h delete mode 100644 code/nel/include/nel/misc/variant.h delete mode 100644 code/nel/src/3d/dyn_mat_loader.cpp delete mode 100644 code/nel/src/3d/dynamic_material.cpp delete mode 100644 code/nel/src/3d/shape_material_serializer.cpp delete mode 100644 code/nel/src/3d/usr_shader_loader.cpp delete mode 100644 code/nel/src/3d/usr_shader_manager.cpp delete mode 100644 code/nel/src/3d/usr_shader_program.cpp delete mode 100644 code/nel/src/3d/usr_shader_saver.cpp delete mode 100644 code/nel/src/misc/variant.cpp delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/action_editor.ui delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/CMakeLists.txt delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/doc/material_editor.uml delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/fog_widget.cpp delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/fog_widget.h delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/fog_widget.ui delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/lights_widget.cpp delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/lights_widget.h delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/lights_widget.ui delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_constants.h delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_context.cpp delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_context.h delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_core_listener.cpp delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_core_listener.h delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_global.h delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_plugin.cpp delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_plugin.h delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.cpp delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.h delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.ui delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_observer.h delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_properties.cpp delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_properties.h delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_properties.ui delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_property_editor.cpp delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_property_editor.h delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_property_editor.ui delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_splitter.cpp delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_splitter.h delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_widget.cpp delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_widget.h delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_widget.ui delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/nel3d_interface.cpp delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/nel3d_interface.h delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/ovqt_plugin_material_editor.xml delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/primitives/cube.shape delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/primitives/cylinder.shape delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/primitives/sphere.shape delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/primitives/teapot.shape delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/prop_browser_ctrl.cpp delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/prop_browser_ctrl.h delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/render_passes.cpp delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/render_passes.h delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/render_passes.ui delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/shader_editor.cpp delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/shader_editor.h delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/shader_editor.ui delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/shader_widget.cpp delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/shader_widget.h delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/shader_widget.ui delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/viewport_widget.cpp delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/viewport_widget.h diff --git a/code/nel/include/nel/3d/driver.h b/code/nel/include/nel/3d/driver.h index 6147bbbb8..3eb5823ca 100644 --- a/code/nel/include/nel/3d/driver.h +++ b/code/nel/include/nel/3d/driver.h @@ -106,8 +106,6 @@ struct EBadDisplay : public NLMISC::Exception // **************************************************************************** typedef void (*emptyProc)(void); -class IProgram; - // **************************************************************************** // *** IMPORTANT ******************** // *** IF YOU MODIFY THE STRUCTURE OF THIS CLASS, PLEASE INCREMENT IDriver::InterfaceVersion TO INVALIDATE OLD DRIVER DLL @@ -1055,9 +1053,6 @@ public: */ virtual void setLight(uint8 num, const CLight &light) = 0; - /// Get light data for the specified light - virtual CLight getLight(uint8 num) = 0; - /** * Enable / disable light. * @@ -1069,8 +1064,6 @@ public: */ virtual void enableLight(uint8 num, bool enable = true) = 0; - virtual bool isLightEnabled(uint8 num) = 0; - /** * Set ambient. * @@ -1457,10 +1450,6 @@ protected: private: bool _StaticMemoryToVRAM; -public: - /// Reloads the user shaders - virtual void reloadUserShaders(){} - }; // -------------------------------------------------- diff --git a/code/nel/include/nel/3d/driver_material_inline.h b/code/nel/include/nel/3d/driver_material_inline.h index 69ac8d125..9384dd2a0 100644 --- a/code/nel/include/nel/3d/driver_material_inline.h +++ b/code/nel/include/nel/3d/driver_material_inline.h @@ -307,7 +307,7 @@ inline void CMaterial::texConstantColor(uint stage, CRGBA color) // *************************************************************************** inline uint32 CMaterial::getTexEnvMode(uint stage) { - // nlassert(_ShaderType==CMaterial::Normal); // GL3 DEBUG + nlassert(_ShaderType==CMaterial::Normal); nlassert(stage -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - - -#ifndef DYN_MAT_LOADER_H -#define DYN_MAT_LOADER_H - -#include - -namespace NL3D -{ - class CDynMaterial; - - class CDynMatLoader - { - public: - CDynMatLoader(); - ~CDynMatLoader(); - - bool loadFrom( const std::string &fileName ); - - CDynMaterial* getDynMat() const{ return mat; } - - private: - CDynMaterial *mat; - - }; -} - -#endif - - diff --git a/code/nel/include/nel/3d/dynamic_material.h b/code/nel/include/nel/3d/dynamic_material.h deleted file mode 100644 index cf0fb671b..000000000 --- a/code/nel/include/nel/3d/dynamic_material.h +++ /dev/null @@ -1,121 +0,0 @@ -// NeL - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - - -#ifndef DYN_MATERIAL_H -#define DYN_MATERIAL_H - -#include "nel/misc/stream.h" -#include "nel/misc/variant.h" -#include -#include - -namespace NL3D -{ - /// Rendering property - struct SDynMaterialProp - { - enum EPropertyType - { - Color, - Vector4, - Float, - Double, - Int, - Uint, - Matrix4, - Texture - }; - - /// Id of the property - std::string prop; - - /// Label of the property ( user-friendly name ) - std::string label; - - /// type of the property ( see EPropertyType ) - uint8 type; - - NLMISC::CVariant value; - - void serial( NLMISC::IStream &f ); - }; - - - /// Rendering pass data, contains the rendering properties for the pass - struct SRenderPass - { - public: - void addProperty( const SDynMaterialProp &prop ); - void removeProperty( const std::string &name ); - bool changeProperty( const std::string &name, const SDynMaterialProp &prop ); - void setName( const std::string &n ){ name = n; } - void getName( std::string &n ) const { n = name; } - void getShaderRef( std::string &s ) const{ s = shaderRef; } - void setShaderRef( const std::string &s ){ shaderRef = s; } - void serial( NLMISC::IStream &f ); - - /// Returns the number of properties this pass has - uint32 count(){ return properties.size(); } - - /// Clears all properties - void clear(){ properties.clear(); } - - const SDynMaterialProp* getProperty( uint32 i ) const; - - private: - std::vector< SDynMaterialProp > properties; - std::string shaderRef; - std::string name; - }; - - - - /// Multi-pass material for rendering using user shaders - class CDynMaterial : public NLMISC::IStreamable - { - public: - CDynMaterial(); - ~CDynMaterial(); - CDynMaterial& operator=( const CDynMaterial &other ); - - /// Clears all passes, and then adds a new pass - void reconstruct(); - - /// Clears all passes - void clear(); - void serial( NLMISC::IStream &f ); - std::string getClassName(){ return "CDynMaterial"; } - - void addPass( const SRenderPass &pass ); - void removePass( const std::string &name ); - void renamePass( const std::string &from, const std::string &to ); - void movePassUp( const std::string &name ); - void movePassDown( const std::string &name ); - - SRenderPass* getPass( const std::string &name ); - SRenderPass* getPass( uint32 i ); - uint32 getPassCount(){ return passes.size(); } - void getPassList( std::vector< std::string > &l ); - - private: - std::vector< SRenderPass* > passes; - }; -} - -#endif - - diff --git a/code/nel/include/nel/3d/material.h b/code/nel/include/nel/3d/material.h index 03faf477c..671f3339a 100644 --- a/code/nel/include/nel/3d/material.h +++ b/code/nel/include/nel/3d/material.h @@ -32,8 +32,6 @@ using NLMISC::CRGBA; using NLMISC::CSmartPtr; using NLMISC::CRefPtr; -class CDynMaterial; - // -------------------------------------------------- const uint32 IDRV_MAT_MAXTEXTURES = 4; @@ -263,7 +261,7 @@ public: */ CMaterial(); /// see operator=. - CMaterial(const CMaterial &mat); + CMaterial(const CMaterial &mat) : CRefCount() {_Touched= 0;_Flags=0; operator=(mat);} /// dtor. ~CMaterial(); /// Do not copy DrvInfos, copy all infos and set IDRV_TOUCHED_ALL. @@ -620,7 +618,7 @@ public: } // helpers - inline uint getColorArg(uint index) const + inline uint getColorArg(uint index) { switch(index) { @@ -633,7 +631,7 @@ public: } return 0; } - inline uint getAlphaArg(uint index) const + inline uint getAlphaArg(uint index) { switch(index) { @@ -646,7 +644,7 @@ public: } return 0; } - inline uint getColorOperand(uint index) const + inline uint getColorOperand(uint index) { switch(index) { @@ -659,7 +657,7 @@ public: } return 0; } - inline uint getAlphaOperand(uint index) const + inline uint getAlphaOperand(uint index) { switch(index) { @@ -696,20 +694,7 @@ private: }; std::auto_ptr _TexUserMat; // user texture matrix - /// Dynamic material for the new driver - CDynMaterial *dynMat; - public: - - CDynMaterial* getDynMat() const{ return dynMat; } - void setDynMat( CDynMaterial *newDynMat ){ dynMat = newDynMat; } - - /// Create the dynamic material from the current material parameters - void createDynMat(); - - /// Creates a clean dynamic material instance - void createCleanDynMat(); - // Private. For Driver only. CSmartPtr _Textures[IDRV_MAT_MAXTEXTURES]; uint8 _TexAddrMode[IDRV_MAT_MAXTEXTURES]; // texture addressing enum packed as bytes diff --git a/code/nel/include/nel/3d/shape_material_serializer.h b/code/nel/include/nel/3d/shape_material_serializer.h deleted file mode 100644 index b505bbbc6..000000000 --- a/code/nel/include/nel/3d/shape_material_serializer.h +++ /dev/null @@ -1,37 +0,0 @@ -// NeL - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -#ifndef SHAPE_MAT_SERIALIZER_H -#define SHAPE_MAT_SERIALIZER_H - -namespace NL3D -{ - class IShape; - - class ShapeMatSerial - { - public: - ShapeMatSerial(); - ~ShapeMatSerial(); - void setShape( IShape *s ){ shape = s; } - void serial( const char *sPath ); - - private: - IShape *shape; - }; -} - -#endif diff --git a/code/nel/include/nel/3d/u_driver.h b/code/nel/include/nel/3d/u_driver.h index 2330b850d..7e0138292 100644 --- a/code/nel/include/nel/3d/u_driver.h +++ b/code/nel/include/nel/3d/u_driver.h @@ -265,18 +265,12 @@ public: virtual void enableFog(bool enable)=0; /// $ fog parameters. fog must enabled to see result. start and end are in [0,1] range. virtual void setupFog(float start, float end, CRGBA color)=0; - virtual float getFogStart() = 0; - virtual float getFogEnd() = 0; - virtual CRGBA getFogColor() = 0; // @} /// \name Light support. // @{ virtual void setLight (uint8 num, const ULight& light) = 0; - virtual ULight* getLight (uint8 num) = 0; - virtual uint8 getMaxDriverLights() const = 0; virtual void enableLight (uint8 num, bool enable=true) = 0; - virtual bool isLightEnabled (uint8 num) = 0; virtual void setAmbientColor (CRGBA color) = 0; // @} diff --git a/code/nel/include/nel/3d/usr_shader_loader.h b/code/nel/include/nel/3d/usr_shader_loader.h deleted file mode 100644 index d4d5a9c78..000000000 --- a/code/nel/include/nel/3d/usr_shader_loader.h +++ /dev/null @@ -1,44 +0,0 @@ -// NeL - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - - -#ifndef SHADER_LOADER_H -#define SHADER_LOADER_H - -#include - -namespace NL3D -{ - class CUsrShaderManager; - - class CUsrShaderLoader - { - public: - CUsrShaderLoader(); - ~CUsrShaderLoader(); - void setManager( CUsrShaderManager *mgr ){ manager = mgr; } - void loadShaders( const std::string &directory ); - - private: - void loadShader( const std::string &file ); - - CUsrShaderManager *manager; - }; -} - - -#endif - diff --git a/code/nel/include/nel/3d/usr_shader_manager.h b/code/nel/include/nel/3d/usr_shader_manager.h deleted file mode 100644 index 0afe4ce27..000000000 --- a/code/nel/include/nel/3d/usr_shader_manager.h +++ /dev/null @@ -1,65 +0,0 @@ -// NeL - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - - -#ifndef USR_SHADER_MANAGER_H -#define USR_SHADER_MANAGER_H - -#include -#include -#include - -namespace NL3D -{ - class CUsrShaderProgram; - class IUsrShaderVisitor; - - /// Manages user defined shaders ( add, remove, change ) - class CUsrShaderManager - { - public: - CUsrShaderManager(); - ~CUsrShaderManager(); - - /// Throw away the currently loaded shaders - void clear(); - - /// Returns a list of the currently loaded shaders - void getShaderList( std::vector< std::string > &v ); - - /// Adds a shader - bool addShader( CUsrShaderProgram *program ); - - /// Removes a shader - bool removeShader( const std::string &name ); - - /// Changes a shader - bool changeShader( const std::string &name, CUsrShaderProgram *program ); - - /// Looks up and returns a shader - bool getShader( const std::string &name, CUsrShaderProgram *program ); - - - void visitShaders( IUsrShaderVisitor *visitor ); - void visitShader( const std::string &name, IUsrShaderVisitor *visitor ); - - private: - std::map< std::string, CUsrShaderProgram* > programs; - }; -} - -#endif - diff --git a/code/nel/include/nel/3d/usr_shader_program.h b/code/nel/include/nel/3d/usr_shader_program.h deleted file mode 100644 index 705ba3385..000000000 --- a/code/nel/include/nel/3d/usr_shader_program.h +++ /dev/null @@ -1,71 +0,0 @@ -// NeL - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - - -#ifndef SHADER_PROGRAM_H -#define SHADER_PROGRAM_H - -#include "nel/misc/stream.h" -#include - -namespace NL3D -{ - class CUsrShaderProgram : public NLMISC::IStreamable - { - public: - CUsrShaderProgram(); - - ~CUsrShaderProgram(); - - std::string getClassName(){ return "CUsrShaderProgram"; } - - void serial( NLMISC::IStream &f ); - - void getName( std::string &n ) const{ n = name; } - void getDescription( std::string &d ) const{ d = description; } - void getVP( std::string &vp ) const{ vp = vertexProgram; } - void getFP( std::string &fp ) const{ fp = fragmentProgram; } - - void setName( const std::string &n ){ name = n; } - void setDescription( const std::string &d ){ description = d; } - void setVP( const std::string &vp ){ vertexProgram = vp; } - void setFP( const std::string &fp ){ fragmentProgram = fp; } - - uint32 getVPId() const{ return vpId; } - uint32 getFPId() const{ return fpId; } - uint32 getPId() const{ return pId; } - - void setVPId( uint32 id ){ vpId = id; } - void setFPId( uint32 id ){ fpId = id;} - void setPid( uint32 id ){ pId = id; } - - private: - std::string name; - std::string description; - std::string vertexProgram; - std::string fragmentProgram; - - - uint32 vpId; - uint32 fpId; - uint32 pId; - }; -} - - -#endif - - diff --git a/code/nel/include/nel/3d/usr_shader_saver.h b/code/nel/include/nel/3d/usr_shader_saver.h deleted file mode 100644 index de1704ce4..000000000 --- a/code/nel/include/nel/3d/usr_shader_saver.h +++ /dev/null @@ -1,50 +0,0 @@ -// NeL - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - - -#ifndef USR_SHADER_SAVER_H -#define USR_SHADER_SAVER_H - -#include "nel/3d/usr_shader_visitor.h" -#include - -namespace NL3D -{ - class CUsrShaderProgram; - class CUsrShaderManager; - - class CUsrShaderSaver : public IUsrShaderVisitor - { - public: - CUsrShaderSaver(); - ~CUsrShaderSaver(); - - void setManager( CUsrShaderManager *mgr ){ manager = mgr; } - - void visit( CUsrShaderProgram *program ); - - void saveShaders( const std::string &directory ); - void saveShader( const std::string &directory, const std::string &name ); - - private: - CUsrShaderManager *manager; - std::string outputDir; - }; -} - -#endif - - diff --git a/code/nel/include/nel/3d/usr_shader_visitor.h b/code/nel/include/nel/3d/usr_shader_visitor.h deleted file mode 100644 index 4a0a6e9a2..000000000 --- a/code/nel/include/nel/3d/usr_shader_visitor.h +++ /dev/null @@ -1,40 +0,0 @@ -// NeL - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - - -#ifndef USR_SHADER_VISITOR_H -#define USR_SHADER_VISITOR_H - -namespace NL3D -{ - class CUsrShaderProgram; - - class IUsrShaderVisitor - { - public: - IUsrShaderVisitor(){} - ~IUsrShaderVisitor(){} - - virtual void visit( CUsrShaderProgram *program ) = 0; - - }; - -} - - -#endif - - diff --git a/code/nel/include/nel/misc/rgba.h b/code/nel/include/nel/misc/rgba.h index c73bb9fcb..db9ed892a 100644 --- a/code/nel/include/nel/misc/rgba.h +++ b/code/nel/include/nel/misc/rgba.h @@ -338,15 +338,6 @@ public: std::swap(R,B); } - /// Write the RGBA values to a float vector - void toFloatVector( float *v ) const - { - v[ 0 ] = R; - v[ 1 ] = G; - v[ 2 ] = B; - v[ 3 ] = A; - } - /// Red componant. uint8 R; diff --git a/code/nel/include/nel/misc/variant.h b/code/nel/include/nel/misc/variant.h deleted file mode 100644 index 140d878dd..000000000 --- a/code/nel/include/nel/misc/variant.h +++ /dev/null @@ -1,109 +0,0 @@ -// NeL - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - - -#ifndef NLVARIANT_H -#define NLVARIANT_H - -#include "nel/misc/stream.h" -#include - -#define VARIANT_VVAL_END 16 - -namespace NLMISC -{ - class CVariant : public IStreamable - { - public: - - enum EVarType - { - Float, - Double, - Int, - UInt, - String, - Vector4, - Matrix4 - }; - - CVariant(); - ~CVariant(); - - std::string getClassName(){ return "CVariant"; } - - void serial( IStream &f ); - - void setDouble( double d ){ - type = Double; - uvalue.dval = d; - } - - void setFloat( float f ){ - type = Float; - uvalue.fval = f; - } - - void setInt( int i ){ - type = Int; - uvalue.ival = i; - } - - void setUInt( unsigned int u ){ - type = UInt; - uvalue.uval = u; - } - - void setString( const std::string &s ){ - type = String; - sval = s; - } - - void setVector4( const float *v ); - void setMatrix4( const float *m ); - - double toDouble() const{ return uvalue.dval; } - float toFloat() const{ return uvalue.fval; } - int toInt() const{ return uvalue.ival; } - unsigned int toUInt() const{ return uvalue.uval; } - std::string toString() const{ return sval; } - void getVector4( float *v ) const; - void getMatrix4( float *m ) const; - - bool valueAsString( std::string &s ) const; - void fromString( const std::string &s, EVarType t ); - - EVarType getType() const{ return type; } - - private: - - union{ - double dval; - float fval; - int ival; - unsigned int uval; - float vval[ VARIANT_VVAL_END ]; - }uvalue; - - std::string sval; - - EVarType type; - }; -} - - -#endif - diff --git a/code/nel/src/3d/CMakeLists.txt b/code/nel/src/3d/CMakeLists.txt index 100c3ab9b..fff343915 100644 --- a/code/nel/src/3d/CMakeLists.txt +++ b/code/nel/src/3d/CMakeLists.txt @@ -144,10 +144,6 @@ SOURCE_GROUP(Driver FILES ../../include/nel/3d/light.h material.cpp ../../include/nel/3d/material.h - dynamic_material.cpp - ../../include/nel/3d/dynamic_material.h - dyn_mat_loader.cpp - ../../include/nel/3d/dyb_mat_loader.h nelu.cpp ../../include/nel/3d/nelu.h ../../include/nel/3d/occlusion_query.h @@ -157,17 +153,6 @@ SOURCE_GROUP(Driver FILES ../../include/nel/3d/scene.h scene_group.cpp ../../include/nel/3d/scene_group.h - shader.cpp - ../../include/nel/3d/shader.h - shader_loader.cpp - ../../include/nel/3d/shader_loader.h - shader_manager.cpp - ../../include/nel/3d/shader_manager.h - shader_program.cpp - ../../include/nel/3d/shader_program.h - shader_saver.cpp - ../../include/nel/3d/shader_saver.h - ../../include/nel/3d/shader_visitor.h texture.cpp ../../include/nel/3d/texture.h vertex_buffer.cpp @@ -269,8 +254,6 @@ SOURCE_GROUP(Shapes FILES ../../include/nel/3d/shape.h shape_bank.cpp ../../include/nel/3d/shape_bank.h - shape_material_serializer.cpp - ../../include/nel/3d/shape_material_serializer.h shifted_triangle_cache.cpp ../../include/nel/3d/shifted_triangle_cache.h skeleton_shape.cpp diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d.h b/code/nel/src/3d/driver/direct3d/driver_direct3d.h index 8cfc46d9d..1055e105c 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d.h +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d.h @@ -1041,9 +1041,7 @@ public: // Lights virtual uint getMaxLight () const; virtual void setLight (uint8 num, const CLight& light); - virtual CLight getLight (uint8 num); virtual void enableLight (uint8 num, bool enable=true); - virtual bool isLightEnabled (uint8 num); virtual void setLightMapDynamicLight (bool enable, const CLight& light); // todo hulud d3d light virtual void setPerPixelLightingLight(CRGBA /* diffuse */, CRGBA /* specular */, float /* shininess */) {} diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d_light.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d_light.cpp index 64f9ddf0a..4ad5b46c0 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d_light.cpp +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d_light.cpp @@ -59,15 +59,6 @@ void CDriverD3D::setLight (uint8 index, const CLight &light) } -CLight CDriverD3D::getLight (uint8 index) -{ - // Not yet implemented - nlinfo( "This feature isn't yet implemented in this driver!" ); - nlassert( false ); - return CLight(); -} - - // *************************************************************************** void CDriverD3D::enableLight (uint8 index, bool enable) { @@ -85,14 +76,6 @@ void CDriverD3D::enableLight (uint8 index, bool enable) _LightMapDynamicLightDirty= true; } -bool CDriverD3D::isLightEnabled (uint8 num) -{ - if(num. -//#include "stdopengl.h" +#include "stdopengl.h" #include "unix_event_emitter.h" #if defined(NL_OS_UNIX) && !defined(NL_OS_MAC) diff --git a/code/nel/src/3d/driver/opengl3/driver_glsl_shader_generator.cpp b/code/nel/src/3d/driver/opengl3/driver_glsl_shader_generator.cpp index 4d6e48a15..deed18c96 100644 --- a/code/nel/src/3d/driver/opengl3/driver_glsl_shader_generator.cpp +++ b/code/nel/src/3d/driver/opengl3/driver_glsl_shader_generator.cpp @@ -57,73 +57,6 @@ namespace NL3D ss.clear(); } - void CGLSLShaderGenerator::generatePS(std::string &ps) - { - ss.str(""); - ss.clear(); - - ss << "// " << shaderNames[ material->getShader() ] << " Pixel Shader" << std::endl; - ss << std::endl; - - ss << "#version 330" << std::endl; - ss << std::endl; - - ss << "out vec4 fragColor;" << std::endl; - - for (int i = Weight; i < NumOffsets; i++) - { - if (hasFlag(desc->vbFlags, g_VertexFlags[i])) - { - ss << "smooth in vec4 "; - ss << g_AttribNames[i] << ";" << std::endl; - } - } - ss << std::endl; - -#if 0 // LIGHTING DEBUG - if (desc->lightingEnabled() || material->getShader() != CMaterial::Normal) - { - generateInvalidPS(); - } - else - { - generateNormalPS(); - } -#else - switch(material->getShader()) - { - case CMaterial::Normal: - case CMaterial::UserColor: - case CMaterial::Specular: - generateNormalPS(); - break; - - case CMaterial::LightMap: - generateLightMapPS(); - break; - - /*case CMaterial::Specular: - generateSpecularPS(); - break;*/ - - case CMaterial::PerPixelLighting: - case CMaterial::PerPixelLightingNoSpec: - generatePPLPS(); - break; - - case CMaterial::Water: - generateWaterPS(); - break; - - case CMaterial::Cloud: - generateCloudPS(); - break; - } -#endif - - ps.assign(ss.str()); - } - void CGLSLShaderGenerator::addAmbient() { ss << "uniform vec4 ambientColor;" << std::endl; @@ -442,399 +375,9 @@ namespace NL3D ss << "}" << std::endl; }*/ - void CGLSLShaderGenerator::generateInvalidPS() - { - /*uint sampler = 0; - for (int i = 0; i < IDRV_MAT_MAXTEXTURES; i++) - { - if (desc->getUseTexStage(i)) - ss << "uniform sampler2D sampler" << sampler << ";" << std::endl; - sampler++; - } - - addColor(); - addConstants(); - addAlphaTreshold(); - addFogUniform();*/ - - if (desc->fogEnabled()) - ss << "smooth in vec4 ecPos;" << std::endl; - - ss << std::endl; - - if (desc->lightingEnabled()) - { - addLightUniformsFS(); - addLightInsFS(); - ss << std::endl; - - addLightsFunctionFS(); - ss << std::endl; - } - - /*if (desc->fogEnabled()) - addFogFunction();*/ - - ss << "void main(void)" << std::endl; - ss << "{" << std::endl; - - /*bool textures = false; - sampler = 0; - for (int i = 0; i < IDRV_MAT_MAXTEXTURES; i++) - { - if (desc->getUseTexStage(i)) - { - ss << "vec4 texel" << sampler << " = texture(sampler" << sampler << ","; - - if (!desc->getUseFirstTexCoords()) - ss << g_AttribNames[ TexCoord0 + i ] << ".st);"; - else - ss << g_AttribNames[ TexCoord0 ] << ".st);"; - - ss << std::endl; - - textures = true; - } - sampler++; - } - - bool vertexColor = false; - if (hasFlag(vbFormat, g_VertexFlags[ PrimaryColor ])) - vertexColor = true; - - if (textures && !vertexColor) - ss << "vec4 texel = vec4(1.0, 1.0, 1.0, 1.0);" << std::endl; - else - if (vertexColor) - ss << "vec4 texel = color;" << std::endl; - else - ss << "vec4 texel = vec4(0.5, 0.5, 0.5, 1.0);" << std::endl; - - generateTexEnv(); - - // This is just an idea I had, but it seems to be working. - // Unfortunately it's not documented anywhere I looked in the GL spec, but if I don't have this modulation here, - // the Ryzom UI looks horrific. - if (vertexColor) - ss << "texel = color * texel;" << std::endl;*/ - - ss << "fragColor = vec4(1.0, 1.0, 1.0, 1.0);" << std::endl; - - if (desc->lightingEnabled()) - addLightsFS(); - - ss << "fragColor = fragColor + vec4(0.25, 0.0, 0.0, 0.0);" << std::endl; - - /*if (desc->fogEnabled()) - addFog(); - - addAlphaTest();*/ - - ss << "}" << std::endl; - } - - void CGLSLShaderGenerator::generateNormalPS() - { - uint sampler = 0; - for (int i = 0; i < IDRV_MAT_MAXTEXTURES; i++) - { - if (desc->getUseTexStage(i)) - { - ss << "uniform " - << ((desc->textureSamplerMode[i] == SamplerCube) ? "samplerCube" : "sampler2D") - << " sampler" << sampler << ";" << std::endl; - } - sampler++; - } - - addColor(); - addConstants(); - addAlphaTreshold(); - addFogUniform(); - - if (desc->fogEnabled()) - ss << "smooth in vec4 ecPos;" << std::endl; - - ss << std::endl; - - if (desc->lightingEnabled()) - { - addLightUniformsFS(); - addLightInsFS(); - ss << std::endl; - - addLightsFunctionFS(); - ss << std::endl; - } - - if (desc->fogEnabled()) - addFogFunction(); - - ss << "void main(void)" << std::endl; - ss << "{" << std::endl; - - // Light color - ss << "vec4 diffuse = vec4(1.0, 1.0, 1.0, 1.0);" << std::endl; - if (desc->lightingEnabled()) - { - ss << "diffuse = applyLights(diffuse);" << std::endl; - ss << "diffuse.a = 1.0;" << std::endl; - } - if (hasFlag(desc->vbFlags, g_VertexFlags[PrimaryColor])) - ss << "diffuse = color * diffuse;" << std::endl; // TODO: If this is the correct location, we should premultiply light and color in VS. - - bool textures = false; - for (int i = 0; i < IDRV_MAT_MAXTEXTURES; i++) - { - if (desc->getUseTexStage(i)) - { - ss << "vec4 texel" << i << " = texture(sampler" << i << ", "; - if (desc->hasVBFlags(g_VertexFlags[TexCoord0 + i])) - ss << g_AttribNames[TexCoord0 + i]; - else - ss << g_AttribNames[TexCoord0]; - ss << ((desc->textureSamplerMode[i] == SamplerCube) ? ".str);" : ".st);"); - ss << std::endl; - textures = true; - } - } - - /*if (textures && !vertexColor) - ss << "vec4 texel = vec4(1.0, 1.0, 1.0, 1.0);" << std::endl; - else if (vertexColor) - ss << "vec4 texel = color;" << std::endl; - else - ss << "vec4 texel = vec4(0.5, 0.5, 0.5, 1.0);" << std::endl;*/ - - switch (material->getShader()) - { - case CMaterial::Specular: - generateSpecular(); - break; - default: - generateTexEnv(); - break; - } - - if (desc->fogEnabled()) - addFog(); - - addAlphaTest(); - - // ss << "fragColor = fragColor + vec4(0.0, 0.25, 0.0, 0.0);" << std::endl; - - // ss << "fragColor.b = diffuse.b;" << std::endl; - - ss << "}" << std::endl; - } - - void CGLSLShaderGenerator::generateTexEnv() - { - for (uint stage = 0; stage < IDRV_MAT_MAXTEXTURES; ++stage) - { - if (desc->getUseTexStage(stage)) - { - for (uint arg = 0; arg < 3; ++arg) - { - // Texop arg - ss << "vec4 texop" << stage << "arg" << arg << ";" << std::endl; - - // RGB - uint rgbArg = material->_TexEnvs[stage].getColorArg(arg); - uint rgbOp = material->_TexEnvs[stage].getColorOperand(arg); - std::stringstream rgbArgVec; - switch (rgbArg) - { - case CMaterial::Texture: - rgbArgVec << "texel" << stage; - break; - case CMaterial::Previous: - if (stage > 0) - { - rgbArgVec << "texop" << (stage - 1); - break; - } - case CMaterial::Diffuse: - rgbArgVec << "diffuse"; - break; - case CMaterial::Constant: - rgbArgVec << "constant" << stage; - break; - } - ss << "texop" << stage << "arg" << arg << ".rgb = "; - switch (rgbOp) // SrcColor=0, InvSrcColor, SrcAlpha, InvSrcAlpha - { - case CMaterial::SrcColor: - ss << rgbArgVec.str() << ".rgb"; - break; - case CMaterial::InvSrcColor: - ss << "vec3(1.0, 1.0, 1.0) - " << rgbArgVec.str() << ".rgb"; - break; - case CMaterial::SrcAlpha: - ss << rgbArgVec.str() << ".aaa"; - break; - case CMaterial::InvSrcAlpha: - ss << "(1.0 - " << rgbArgVec.str() << ").aaa"; - break; - } - ss << ";" << std::endl; - - // Alpha - uint alphaArg = material->_TexEnvs[stage].getAlphaArg(arg); - uint alphaOp = material->_TexEnvs[stage].getAlphaOperand(arg); - std::stringstream alphaArgVec; - switch (alphaArg) - { - case CMaterial::Texture: - alphaArgVec << "texel" << stage; - break; - case CMaterial::Previous: - if (stage > 0) - { - alphaArgVec << "texop" << (stage - 1); - break; - } - case CMaterial::Diffuse: - alphaArgVec << "diffuse"; - break; - case CMaterial::Constant: - alphaArgVec << "constant" << stage; - break; - } - ss << "texop" << stage << "arg" << arg << ".a = "; - switch (alphaOp) // SrcColor=0, InvSrcColor, SrcAlpha, InvSrcAlpha - { - case CMaterial::SrcColor: - ss << alphaArgVec.str() << ".r"; - break; - case CMaterial::InvSrcColor: - ss << "1.0 - " << alphaArgVec.str() << ".r"; - break; - case CMaterial::SrcAlpha: - ss << alphaArgVec.str() << ".a"; - break; - case CMaterial::InvSrcAlpha: - ss << "1.0 - " << alphaArgVec.str() << ".a"; - break; - } - ss << ";" << std::endl; - } - ss << "vec4 texop" << stage << ";" << std::endl; - - // RGB - switch (material->_TexEnvs[stage].Env.OpRGB) - { - case CMaterial::InterpolateConstant: - ss << "float texop" << stage << "rgbAs = constant" << stage << ".a;" << std::endl; - break; - case CMaterial::InterpolatePrevious: - if (stage > 0) - { - ss << "float texop" << stage << "rgbAs = texop" << stage << ".a;" << std::endl; - break; - } - case CMaterial::InterpolateDiffuse: - ss << "float texop" << stage << "rgbAs = diffuse.a;" << std::endl; - break; - case CMaterial::InterpolateTexture: - ss << "float texop" << stage << "rgbAs = texel" << stage << ".a;" << std::endl; - break; - } - ss << "texop" << stage << ".rgb = "; - switch (material->_TexEnvs[stage].Env.OpRGB) - { - case CMaterial::Replace: - ss << "texop" << stage << "arg0.rgb"; - break; - case CMaterial::Modulate: - ss << "texop" << stage << "arg0.rgb * texop" << stage << "arg1.rgb"; - break; - case CMaterial::Add: - ss << "texop" << stage << "arg0.rgb + texop" << stage << "arg1.rgb"; - break; - case CMaterial::AddSigned: - ss << "texop" << stage << "arg0.rgb + texop" << stage << "arg1.rgb - vec3(0.5, 0.5, 0.5)"; - break; - case CMaterial::InterpolateConstant: - case CMaterial::InterpolateDiffuse: - case CMaterial::InterpolatePrevious: - case CMaterial::InterpolateTexture: - ss << "texop" << stage << "arg0.rgb * texop" << stage << "rgbAs + texop" << stage << "arg1.rgb * (1.0 - texop" << stage << "rgbAs)"; - break; - case CMaterial::Mad: - ss << "texop" << stage << "arg0.rgb * texop" << stage << "arg1.rgb + texop" << stage << "arg2.rgb"; - break; - } - ss << ";" << std::endl; - - // Alpha - switch (material->_TexEnvs[stage].Env.OpAlpha) - { - case CMaterial::InterpolateConstant: - ss << "float texop" << stage << "alphaAs = constant" << stage << ".a;" << std::endl; - break; - case CMaterial::InterpolatePrevious: - if (stage > 0) - { - ss << "float texop" << stage << "alphaAs = texop" << stage << ".a;" << std::endl; - break; - } - case CMaterial::InterpolateDiffuse: - ss << "float texop" << stage << "alphaAs = diffuse.a;" << std::endl; - break; - case CMaterial::InterpolateTexture: - ss << "float texop" << stage << "alphaAs = texel" << stage << ".a;" << std::endl; - break; - } - ss << "texop" << stage << ".a = "; - switch (material->_TexEnvs[stage].Env.OpAlpha) - { - case CMaterial::Replace: - ss << "texop" << stage << "arg0.a"; - break; - case CMaterial::Modulate: - ss << "texop" << stage << "arg0.a * texop" << stage << "arg1.a"; - break; - case CMaterial::Add: - ss << "texop" << stage << "arg0.a + texop" << stage << "arg1.a"; - break; - case CMaterial::AddSigned: - ss << "texop" << stage << "arg0.a + texop" << stage << "arg1.a - 0.5"; - break; - case CMaterial::InterpolateConstant: - case CMaterial::InterpolateDiffuse: - case CMaterial::InterpolatePrevious: - case CMaterial::InterpolateTexture: - ss << "texop" << stage << "arg0.a * texop" << stage << "rgbAs + texop" << stage << "arg1.a * (1.0 - texop" << stage << "rgbAs)"; - break; - case CMaterial::Mad: - ss << "texop" << stage << "arg0.a * texop" << stage << "arg1.a + texop" << stage << "arg2.a"; - break; - } - ss << ";" << std::endl; - } - else if (stage == 0) - { - ss << "vec4 texop" << stage << " = diffuse;" << std::endl; - } - else - { - ss << "vec4 texop" << stage << " = texop" << (stage - 1) << ";" << std::endl; - } - } - ss << "fragColor = texop" << (IDRV_MAT_MAXTEXTURES - 1) << ";" << std::endl; - } - - void CGLSLShaderGenerator::generateSpecular() - { - ss << "vec3 specop0 = texel0.rgb * diffuse.rgb;" << std::endl; - ss << "vec4 specop1 = vec4(texel1.rgb * texel0.a + specop0, diffuse.a);" << std::endl; - ss << "fragColor = specop1;" << std::endl; - } - - void CGLSLShaderGenerator::generateLightMapPS() { +#if 0 int ls = material->_LightMaps.size(); ls++; // lightmaps + color texture @@ -925,59 +468,12 @@ namespace NL3D ss << "}" << std::endl; ss << std::endl; - } - - void CGLSLShaderGenerator::generateSpecularPS() - { - ss << "smooth in vec3 cubeTexCoords;" << std::endl; - ss << "uniform sampler2D sampler0;" << std::endl; - ss << "uniform samplerCube sampler1;" << std::endl; - addDiffuse(); - addAlphaTreshold(); - addFogUniform(); - - if (desc->lightingEnabled()) - { - addLightUniformsFS(); - addLightInsFS(); - ss << std::endl; - - addLightsFunctionFS(); - ss << std::endl; - } - - if (desc->fogEnabled()) - ss << "smooth in vec4 ecPos;" << std::endl; - - ss << std::endl; - - if (desc->fogEnabled()) - addFogFunction(); - - ss << "void main(void)" << std::endl; - ss << "{" << std::endl; - ss << "vec4 texel0 = texture(sampler0, texCoord0.st);" << std::endl; - ss << "vec4 texel1 = texture(sampler1, cubeTexCoords);" << std::endl; - ss << "vec4 texel;" << std::endl; - ss << "texel.rgb = texel0.rgb * diffuseColor.rgb;" << std::endl; - ss << "texel.a = texel0.a;" << std::endl; - ss << "texel.rgb = texel1.rgb * texel.a + texel.rgb;" << std::endl; - ss << "texel.a = texel1.a;" << std::endl; - ss << "fragColor = texel;" << std::endl; - - if (desc->lightingEnabled()) - addLightsFS(); - - if (desc->fogEnabled()) - addFog(); - - addAlphaTest(); - - ss << "}" << std::endl; +#endif } void CGLSLShaderGenerator::generatePPLPS() { +#if 0 ss << "smooth in vec3 cubeTexCoords0;" << std::endl; if (material->getShader() == CMaterial::PerPixelLighting) ss << "smooth in vec3 cubeTexCoords2;" << std::endl; @@ -1027,11 +523,13 @@ namespace NL3D ss << "fragColor = texel;" << std::endl; addAlphaTest(); ss << "}" << std::endl; +#endif } void CGLSLShaderGenerator::generateWaterPS() { +#if 0 bool diffuse = false; if (material->getTexture(3) != NULL) diffuse = true; @@ -1089,10 +587,12 @@ namespace NL3D ss << "}" << std::endl; ss << std::endl; +#endif } void CGLSLShaderGenerator::generateCloudPS() { +#if 0 ss << "uniform sampler2D sampler0;" << std::endl; ss << "uniform sampler2D sampler1;" << std::endl; addDiffuse(); @@ -1109,7 +609,7 @@ namespace NL3D addAlphaTest(); ss << "}" << std::endl; ss << std::endl; - +#endif } } diff --git a/code/nel/src/3d/driver/opengl3/driver_opengl.cpp b/code/nel/src/3d/driver/opengl3/driver_opengl.cpp index 9be3b31f8..0fae4cf17 100644 --- a/code/nel/src/3d/driver/opengl3/driver_opengl.cpp +++ b/code/nel/src/3d/driver/opengl3/driver_opengl.cpp @@ -27,8 +27,6 @@ #include "nel/3d/vertex_buffer.h" #include "nel/3d/light.h" #include "nel/3d/index_buffer.h" -#include "nel/3d/usr_shader_manager.h" -#include "nel/3d/usr_shader_loader.h" #include "nel/misc/rect.h" #include "nel/misc/di_event_emitter.h" #include "nel/misc/mouse_device.h" @@ -315,13 +313,6 @@ CDriverGL3::CDriverGL3() m_DriverPixelProgram = NULL; m_VPBuiltinTouched = true; - - shaderGenerator = new CGLSLShaderGenerator(); - usrShaderManager = new CUsrShaderManager(); - - CUsrShaderLoader loader; - loader.setManager(usrShaderManager); - loader.loadShaders("./shaders"); } // *************************************************************************** @@ -331,11 +322,6 @@ CDriverGL3::~CDriverGL3() release(); - delete shaderGenerator; - shaderGenerator = NULL; - delete usrShaderManager; - usrShaderManager = NULL; - #if defined(NL_OS_MAC) [_autoreleasePool release]; #endif @@ -1845,15 +1831,6 @@ void CDriverGL3::endDialogMode() { } -// *************************************************************************** -void CDriverGL3::reloadUserShaders() -{ - usrShaderManager->clear(); - NL3D::CUsrShaderLoader loader; - loader.setManager(usrShaderManager); - loader.loadShaders("./shaders"); -} - CProgramDrvInfosGL3::CProgramDrvInfosGL3(CDriverGL3 *drv, ItGPUPrgDrvInfoPtrList it) : IProgramDrvInfos(drv, it) { @@ -1862,6 +1839,7 @@ IProgramDrvInfos(drv, it) CProgramDrvInfosGL3::~CProgramDrvInfosGL3() { + // FIXME GL3: Is this not released?! programId = 0; } diff --git a/code/nel/src/3d/driver/opengl3/driver_opengl.h b/code/nel/src/3d/driver/opengl3/driver_opengl.h index 5ca500b42..8079cce9d 100644 --- a/code/nel/src/3d/driver/opengl3/driver_opengl.h +++ b/code/nel/src/3d/driver/opengl3/driver_opengl.h @@ -1319,11 +1319,7 @@ private: NLMISC::CRGBA _CurrentBlendConstantColor; - private: - - CGLSLShaderGenerator *shaderGenerator; - CUsrShaderManager *usrShaderManager; - +private: bool initProgramPipeline(); uint32 ppoId; @@ -1397,13 +1393,6 @@ private: */ inline void setupTextureBasicParameters(ITexture &tex); - -private: - CShaderCache shaderCache; - -public: - void reloadUserShaders(); - }; diff --git a/code/nel/src/3d/driver/opengl3/driver_opengl_material.cpp b/code/nel/src/3d/driver/opengl3/driver_opengl_material.cpp index e4b583c3b..d144b6a59 100644 --- a/code/nel/src/3d/driver/opengl3/driver_opengl_material.cpp +++ b/code/nel/src/3d/driver/opengl3/driver_opengl_material.cpp @@ -20,7 +20,6 @@ #include "nel/3d/texture_mem.h" #include "nel/3d/texture_bump.h" #include "nel/3d/material.h" -#include "nel/3d/dynamic_material.h" namespace NL3D { @@ -237,12 +236,6 @@ bool CDriverGL3::setupMaterial(CMaterial& mat) { H_AUTO_OGL(CDriverGL3_setupMaterial) - if (mat.getDynMat() != NULL) - { - _CurrentMaterial = &mat; - return true; - } - CMaterialDrvInfosGL3* pShader; CMaterial::TShader matShader; GLenum glenum = GL_ZERO; @@ -512,9 +505,6 @@ sint CDriverGL3::beginMultiPass() { H_AUTO_OGL(CDriverGL3_beginMultiPass) - if (_CurrentMaterial->getDynMat() != NULL) - return _CurrentMaterial->getDynMat()->getPassCount(); - // Depending on material type and hardware, return number of pass required to draw this material. switch(_CurrentMaterialSupportedShader) { @@ -543,9 +533,6 @@ bool CDriverGL3::setupPass(uint pass) { H_AUTO_OGL(CDriverGL3_setupPass) - if (_CurrentMaterial->getDynMat() != NULL) - return setupDynMatPass(pass); - switch(_CurrentMaterialSupportedShader) { case CMaterial::Normal: @@ -581,9 +568,6 @@ bool CDriverGL3::setupPass(uint pass) void CDriverGL3::endMultiPass() { H_AUTO_OGL(CDriverGL3_endMultiPass) - - if (_CurrentMaterial->getDynMat() != NULL) - return; switch(_CurrentMaterialSupportedShader) { diff --git a/code/nel/src/3d/driver/opengl3/driver_opengl_program.cpp b/code/nel/src/3d/driver/opengl3/driver_opengl_program.cpp index e23f00f4f..30ea9ddcd 100644 --- a/code/nel/src/3d/driver/opengl3/driver_opengl_program.cpp +++ b/code/nel/src/3d/driver/opengl3/driver_opengl_program.cpp @@ -18,9 +18,6 @@ #include "driver_opengl_program.h" #include "driver_glsl_shader_generator.h" #include "driver_opengl_vertex_buffer_hard.h" -#include "nel/3d/dynamic_material.h" -#include "nel/3d/usr_shader_manager.h" -#include "nel/3d/usr_shader_program.h" namespace NL3D { diff --git a/code/nel/src/3d/driver_user.cpp b/code/nel/src/3d/driver_user.cpp index 478cb9fe9..79f151aee 100644 --- a/code/nel/src/3d/driver_user.cpp +++ b/code/nel/src/3d/driver_user.cpp @@ -1400,21 +1400,6 @@ void CDriverUser::setupFog(float start, float end, CRGBA color) _Driver->setupFog(start, end, color); } -float CDriverUser::getFogStart() -{ - return _Driver->getFogStart(); -} - -float CDriverUser::getFogEnd() -{ - return _Driver->getFogEnd(); -} - -CRGBA CDriverUser::getFogColor() -{ - return _Driver->getFogColor(); -} - // *************************************************************************** void CDriverUser::setLight (uint8 num, const ULight& light) @@ -1424,23 +1409,6 @@ void CDriverUser::setLight (uint8 num, const ULight& light) CLightUser *plight= (CLightUser*)&light; _Driver->setLight (num, plight->_Light); } - - -// *************************************************************************** -ULight* CDriverUser::getLight (uint8 num) -{ - ULight *l = ULight::createLight(); - CLightUser *lu = dynamic_cast< CLightUser* >( l ); - nlassert( lu != NULL ); - lu->_Light =_Driver->getLight( num ); - return l; -} - -uint8 CDriverUser::getMaxDriverLights() const -{ - return static_cast< uint8 >( _Driver->getMaxLight() ); -} - // *************************************************************************** void CDriverUser::enableLight (uint8 num, bool enable) { @@ -1448,13 +1416,6 @@ void CDriverUser::enableLight (uint8 num, bool enable) _Driver->enableLight (num, enable); } - -// *************************************************************************** -bool CDriverUser::isLightEnabled (uint8 num) -{ - return _Driver->isLightEnabled (num); -} - // *************************************************************************** void CDriverUser::setAmbientColor (CRGBA color) { diff --git a/code/nel/src/3d/dyn_mat_loader.cpp b/code/nel/src/3d/dyn_mat_loader.cpp deleted file mode 100644 index 291812f29..000000000 --- a/code/nel/src/3d/dyn_mat_loader.cpp +++ /dev/null @@ -1,61 +0,0 @@ -// NeL - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - - -#include "nel/3d/dyn_mat_loader.h" -#include "nel/3d/dynamic_material.h" -#include "nel/misc/file.h" -#include "nel/misc/i_xml.h" - -namespace NL3D -{ - CDynMatLoader::CDynMatLoader() - { - mat = NULL; - } - - CDynMatLoader::~CDynMatLoader() - { - mat = NULL; - } - - bool CDynMatLoader::loadFrom( const std::string &fileName ) - { - NLMISC::CIFile ifile; - if( !ifile.open( fileName, true ) ) - { - nlinfo( "Error opening file %s", fileName.c_str() ); - return false; - } - - NLMISC::CIXml xml; - if( !xml.init( ifile ) ) - { - ifile.close(); - nlinfo( "Error initializing XML stream for file %s", fileName.c_str() ); - return false; - } - - mat = new CDynMaterial(); - mat->serial( xml ); - - ifile.close(); - - return true; - } -} - - diff --git a/code/nel/src/3d/dynamic_material.cpp b/code/nel/src/3d/dynamic_material.cpp deleted file mode 100644 index 440428836..000000000 --- a/code/nel/src/3d/dynamic_material.cpp +++ /dev/null @@ -1,383 +0,0 @@ -// NeL - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -#include "nel/3d/dynamic_material.h" - -namespace NL3D -{ - void SDynMaterialProp::serial( NLMISC::IStream &f ) - { - f.xmlPush( "property" ); - - f.xmlPush( "id" ); - f.serial( prop ); - f.xmlPop(); - - f.xmlPush( "label" ); - f.serial( label ); - f.xmlPop(); - - f.xmlPush( "type" ); - f.serial( type ); - f.xmlPop(); - - f.xmlPush( "value" ); - f.serial( value ); - f.xmlPop(); - - f.xmlPop(); - } - - void SRenderPass::serial( NLMISC::IStream &f ) - { - f.xmlPush( "pass" ); - - f.xmlPush( "name" ); - f.serial( name ); - f.xmlPop(); - - f.xmlPush( "shader" ); - f.serial( shaderRef ); - f.xmlPop(); - - f.xmlPush( "properties" ); - - if( !f.isReading() ) - { - uint32 n = properties.size(); - f.xmlPush( "count" ); - f.serial( n ); - f.xmlPop(); - - std::vector< SDynMaterialProp >::iterator itr = properties.begin(); - while( itr != properties.end() ) - { - itr->serial( f ); - ++itr; - } - } - else - { - uint32 n; - f.xmlPush( "count" ); - f.serial( n ); - f.xmlPop(); - - for( uint32 i = 0; i < n; i++ ) - { - SDynMaterialProp prop; - prop.serial( f ); - properties.push_back( prop ); - } - } - - f.xmlPop(); - - f.xmlPop(); - } - - void SRenderPass::addProperty( const SDynMaterialProp &prop ) - { - std::vector< SDynMaterialProp >::const_iterator itr = properties.begin(); - while( itr != properties.end() ) - { - if( itr->prop == prop.prop ) - break; - ++itr; - } - if( itr != properties.end() ) - return; - - properties.push_back( prop ); - } - - void SRenderPass::removeProperty( const std::string &name ) - { - std::vector< SDynMaterialProp >::iterator itr = properties.begin(); - while( itr != properties.end() ) - { - if( itr->prop == name ) - break; - ++itr; - } - if( itr == properties.end() ) - return; - - properties.erase( itr ); - } - - bool SRenderPass::changeProperty( const std::string &name, const SDynMaterialProp &prop ) - { - std::vector< SDynMaterialProp >::iterator itr = properties.begin(); - while( itr != properties.end() ) - { - if( itr->prop == name ) - break; - ++itr; - } - if( itr == properties.end() ) - return false; - - itr->prop = prop.prop; - itr->label = prop.label; - itr->type = prop.type; - itr->value = prop.value; - - return true; - } - - - const SDynMaterialProp* SRenderPass::getProperty( uint32 i ) const - { - if( i >= properties.size() ) - return NULL; - - return &( properties[ i ] ); - } - - CDynMaterial::CDynMaterial() - { - reconstruct(); - } - - CDynMaterial::~CDynMaterial() - { - clear(); - } - - CDynMaterial& CDynMaterial::operator=( const CDynMaterial &other ) - { - if( &other != this ) - { - clear(); - - std::vector< SRenderPass* >::const_iterator itr = other.passes.begin(); - while( itr != other.passes.end() ) - { - SRenderPass *pass = new SRenderPass(); - *pass = *(*itr); - passes.push_back( pass ); - ++itr; - } - } - - return *this; - } - - void CDynMaterial::reconstruct() - { - clear(); - SRenderPass *p = new SRenderPass(); - p->setName( "pass1" ); - passes.push_back( p ); - } - - void CDynMaterial::clear() - { - std::vector< SRenderPass* >::iterator itr = passes.begin(); - while( itr != passes.end() ) - { - delete *itr; - ++itr; - } - passes.clear(); - } - - void CDynMaterial::serial( NLMISC::IStream &f ) - { - f.xmlPush( "Material" ); - - int version = f.serialVersion( 1 ); - - f.xmlPush( "passes" ); - - if( !f.isReading() ) - { - uint32 n = passes.size(); - f.xmlPush( "count" ); - f.serial( n ); - f.xmlPop(); - - std::vector< SRenderPass* >::iterator itr = passes.begin(); - while( itr != passes.end() ) - { - (*itr)->serial( f ); - ++itr; - } - } - else - { - clear(); - uint32 n; - f.xmlPush( "count" ); - f.serial( n ); - f.xmlPop(); - - for( uint32 i = 0; i < n; i++ ) - { - SRenderPass *pass = new SRenderPass(); - pass->serial( f ); - passes.push_back( pass ); - } - } - - f.xmlPop(); - - f.xmlPop(); - } - - void CDynMaterial::addPass( const SRenderPass &pass ) - { - std::string n; - std::string name; - pass.getName( name ); - - std::vector< SRenderPass* >::iterator itr = passes.begin(); - while( itr != passes.end() ) - { - (*itr)->getName( n ); - if( n == name ) - break; - ++itr; - } - if( itr != passes.end() ) - return; - - SRenderPass *p = new SRenderPass(); - *p = pass; - passes.push_back( p ); - } - - void CDynMaterial::removePass( const std::string &name ) - { - std::string n; - std::vector< SRenderPass* >::iterator itr = passes.begin(); - while( itr != passes.end() ) - { - (*itr)->getName( n ); - if( n == name ) - break; - ++itr; - } - - if( itr != passes.end() ) - { - delete *itr; - passes.erase( itr ); - } - } - - void CDynMaterial::renamePass( const std::string &from, const std::string &to ) - { - std::string n; - std::vector< SRenderPass* >::iterator itr = passes.begin(); - while( itr != passes.end() ) - { - (*itr)->getName( n ); - if( n == from ) - break; - ++itr; - } - - if( itr != passes.end() ) - (*itr)->setName( to ); - } - - void CDynMaterial::movePassUp( const std::string &name ) - { - std::string n; - uint32 i = 0; - for( i = 0; i < passes.size(); i++ ) - { - passes[ i ]->getName( n ); - if( n == name ) - break; - } - - if( i >= passes.size() ) - return; - - if( i == 0 ) - return; - - SRenderPass *temp = passes[ i ]; - passes[ i ] = passes[ i - 1 ]; - passes[ i - 1 ] = temp; - } - - void CDynMaterial::movePassDown( const std::string &name ) - { - std::string n; - uint32 i = 0; - for( i = 0; i < passes.size(); i++ ) - { - passes[ i ]->getName( n ); - if( n == name ) - break; - } - - if( i >= passes.size() ) - return; - - if( i == ( passes.size() - 1 ) ) - return; - - SRenderPass *temp = passes[ i ]; - passes[ i ] = passes[ i + 1 ]; - passes[ i + 1 ] = temp; - } - - SRenderPass* CDynMaterial::getPass( const std::string &name ) - { - std::string n; - std::vector< SRenderPass* >::iterator itr = passes.begin(); - while( itr != passes.end() ) - { - (*itr)->getName( n ); - if( n == name ) - break; - ++itr; - } - if( itr == passes.end() ) - return NULL; - else - return *itr; - } - - SRenderPass* CDynMaterial::getPass( uint32 i ) - { - if( i >= passes.size() ) - return NULL; - else - return passes[ i ]; - } - - void CDynMaterial::getPassList( std::vector< std::string > &l ) - { - std::vector< SRenderPass* >::iterator itr = passes.begin(); - while( itr != passes.end() ) - { - std::string name; - - (*itr)->getName( name ); - l.push_back( name ); - - ++itr; - } - } -} - - diff --git a/code/nel/src/3d/material.cpp b/code/nel/src/3d/material.cpp index 2d05cd292..886f45308 100644 --- a/code/nel/src/3d/material.cpp +++ b/code/nel/src/3d/material.cpp @@ -19,8 +19,6 @@ #include "nel/3d/material.h" #include "nel/3d/texture.h" #include "nel/3d/driver.h" -#include "nel/3d/dynamic_material.h" -#include "nel/3d/texture_file.h" #include "nel/misc/stream.h" using namespace std; @@ -49,16 +47,6 @@ CMaterial::CMaterial() _AlphaTestThreshold= 0.5f; _TexCoordGenMode= 0; _LightMapsMulx2= false; - dynMat = NULL; -} - -CMaterial::CMaterial( const CMaterial &mat ) : -CRefCount() -{ - _Touched= 0; - _Flags=0; - dynMat = NULL; - operator=(mat); } // *************************************************************************** @@ -131,14 +119,6 @@ CMaterial &CMaterial::operator=(const CMaterial &mat) // All states of material is modified. _Touched= IDRV_TOUCHED_ALL; - if( mat.dynMat != NULL ) - { - if( dynMat == NULL ) - dynMat = new CDynMaterial(); - - *dynMat = *mat.dynMat; - } - return *this; } @@ -153,11 +133,6 @@ CMaterial::~CMaterial() // Must kill the drv mirror of this material. _MatDrvInfo.kill(); - if( dynMat != NULL ) - { - delete dynMat; - dynMat = NULL; - } } @@ -648,175 +623,5 @@ bool CMaterial::isSupportedByDriver(IDriver &drv, bool forceBaseCaps) const return false; } - -void CMaterial::createDynMat() -{ - createCleanDynMat(); - - SRenderPass *p = dynMat->getPass( 0 ); - - float v[ 4 ]; - float m[ 16 ]; - SDynMaterialProp prop; - - prop.type = SDynMaterialProp::Color; - - prop.prop = "color"; - prop.label = "Color"; - _Color.toFloatVector( v ); - prop.value.setVector4( v ); - p->addProperty( prop ); - - prop.prop = "emissive"; - prop.label = "Emissive color"; - _Emissive.toFloatVector( v ); - prop.value.setVector4( v ); - p->addProperty( prop ); - - prop.prop = "ambient"; - prop.label = "Ambient color"; - _Ambient.toFloatVector( v ); - prop.value.setVector4( v ); - p->addProperty( prop ); - - prop.prop = "diffuse"; - prop.label = "Diffuse color"; - _Diffuse.toFloatVector( v ); - prop.value.setVector4( v ); - p->addProperty( prop ); - - prop.prop = "specular"; - prop.label = "Specular color"; - _Specular.toFloatVector( v ); - prop.value.setVector4( v ); - p->addProperty( prop ); - - prop.type = SDynMaterialProp::Float; - prop.prop = "shininess"; - prop.label = "Shininess"; - prop.value.setFloat( _Shininess ); - p->addProperty( prop ); - - prop.prop = "alpha_test_threshold"; - prop.label = "Alpha test threshold"; - prop.value.setFloat( _AlphaTestThreshold ); - p->addProperty( prop ); - - prop.type = SDynMaterialProp::Uint; - prop.prop = "flags"; - prop.label = "Flags"; - prop.value.setUInt( _Flags ); - p->addProperty( prop ); - - prop.prop = "srcblend"; - prop.label = "Source blend"; - prop.value.setUInt( _SrcBlend ); - p->addProperty( prop ); - - prop.prop = "dstblend"; - prop.label = "Destination blend"; - prop.value.setUInt( _DstBlend ); - p->addProperty( prop ); - - prop.prop = "zfunc"; - prop.label = "Z function"; - prop.value.setUInt( _ZFunction ); - p->addProperty( prop ); - - prop.type = SDynMaterialProp::Float; - prop.prop = "zbias"; - prop.label = "Z bias"; - prop.value.setFloat( _ZBias ); - p->addProperty( prop ); - - for( int i = 0; i < IDRV_MAT_MAXTEXTURES; i++ ) - { - if( _Textures[ i ] == NULL ) - continue; - CTextureFile *tf = dynamic_cast< CTextureFile* >( _Textures[ i ].getPtr() ); - if( tf == NULL ) - continue; - - prop.type = SDynMaterialProp::Texture; - prop.prop = "texture"; - prop.prop.push_back( char( '0' + i ) ); - - prop.label = "Texture"; - prop.label.push_back( char( '0' + i ) ); - - prop.value.setString( tf->getFileName() ); - p->addProperty( prop ); - } - - if( _TexUserMat.get() != NULL ) - { - prop.type = SDynMaterialProp::Matrix4; - for( int i = 0; i < IDRV_MAT_MAXTEXTURES; i++ ) - { - prop.prop = "texmat"; - prop.prop.push_back( char( '0' + i ) ); - - prop.label = "Texture matrix"; - prop.label.push_back( char( '0' + i ) ); - - prop.value.setMatrix4( _TexUserMat->TexMat[ i ].get() ); - p->addProperty( prop ); - } - } - - for( int i = 0; i < _LightMaps.size(); i++ ) - { - const CLightMap &lm = _LightMaps[ i ]; - ITexture *t = lm.Texture.getPtr(); - CTextureFile *cf = dynamic_cast< CTextureFile* >( t ); - if( cf != NULL ) - { - prop.type = SDynMaterialProp::Texture; - prop.prop = "lightmap"; - prop.prop.push_back( char( '0' + i ) ); - - prop.label = "Lightmap"; - prop.prop.push_back( char( '0' + i ) ); - - prop.value.setString( cf->getFileName() ); - p->addProperty( prop ); - } - - prop.type = SDynMaterialProp::Color; - prop.prop = "lmfactor"; - prop.prop.push_back( char( '0' + i ) ); - prop.label = "LMFactor"; - prop.label.push_back( char( '0' + i ) ); - lm.Factor.toFloatVector( v ); - prop.value.setVector4( v ); - p->addProperty( prop ); - - prop.prop = "lmcambient"; - prop.prop.push_back( char( '0' + i ) ); - prop.label = "LMCAmbient"; - prop.label.push_back( char( '0' + i ) ); - lm.LMCAmbient.toFloatVector( v ); - prop.value.setVector4( v ); - p->addProperty( prop ); - - prop.prop = "lmcdiffuse"; - prop.prop.push_back( char( '0' + i ) ); - prop.label = "LMCDiffuse"; - prop.label.push_back( char( '0' + i ) ); - lm.LMCDiffuse.toFloatVector( v ); - prop.value.setVector4( v ); - p->addProperty( prop ); - - } -} - -void CMaterial::createCleanDynMat() -{ - if( dynMat == NULL ) - dynMat = new CDynMaterial(); - else - dynMat->reconstruct(); -} - } diff --git a/code/nel/src/3d/meshvp_per_pixel_light.cpp b/code/nel/src/3d/meshvp_per_pixel_light.cpp index 0fd2353a4..816c20f3b 100644 --- a/code/nel/src/3d/meshvp_per_pixel_light.cpp +++ b/code/nel/src/3d/meshvp_per_pixel_light.cpp @@ -97,7 +97,7 @@ MUL R6, v[2], R1; \n\ \n\ #normalize the second vector \n\ DP3 R1, R6, v[9]; \n\ -MAD R1, R6, -R1, v[9]; #subtract the normal component, Gramm-Schmidt process \n\ +MAD R1, R6, -R1, v[9]; #subtract the normal component \n\ DP3 R2, R1, R1; \n\ RSQ R2, R2.x; \n\ MUL R5, R1, R2; #second basis vector in R5 \n\ diff --git a/code/nel/src/3d/shape_material_serializer.cpp b/code/nel/src/3d/shape_material_serializer.cpp deleted file mode 100644 index 691cdf39b..000000000 --- a/code/nel/src/3d/shape_material_serializer.cpp +++ /dev/null @@ -1,102 +0,0 @@ -// NeL - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - - -#include "nel/3d/shape_material_serializer.h" -#include "nel/3d/shape.h" -#include "nel/3d/material.h" -#include "nel/3d/dynamic_material.h" -#include "nel/3d/mesh_base.h" -#include "nel/misc/file.h" -#include "nel/misc/o_xml.h" - -namespace NL3D -{ - ShapeMatSerial::ShapeMatSerial() - { - shape = NULL; - } - - ShapeMatSerial::~ShapeMatSerial() - { - shape = NULL; - } - - void ShapeMatSerial::serial( const char *sPath ) - { - if( shape == NULL ) - return; - - nlinfo( "Exporting materials of %s", sPath ); - - std::string path = sPath; - std::string fname; - std::string::size_type idx; - - idx = path.find_last_of( '.' ); - path = path.substr( 0, idx ); - - CMeshBase *mb = dynamic_cast< CMeshBase* >( shape ); - if( mb != NULL ) - { - uint n = mb->getNbMaterial(); - nlinfo( "exporting %u materials", n ); - - for( int i = 0; i < n; i++ ) - { - CMaterial &m = mb->getMaterial( i ); - CDynMaterial *dm = m.getDynMat(); - if( dm == NULL ) - { - m.createDynMat(); - dm = m.getDynMat(); - } - - fname = path + "_"; - fname += char( '0' + i ); - fname += ".nelmat"; - - nlinfo( "exporting to %s", fname.c_str() ); - - NLMISC::COFile o; - if( o.open( fname ) ) - { - NLMISC::COXml xml; - if( xml.init( &o ) ) - { - dm->serial( xml ); - xml.flush(); - } - else - { - nlerror( "Error initializing XML output stream for %s", fname.c_str() ); - } - o.close(); - } - else - { - nlerror( "Error creating file %s", fname.c_str() ); - } - - } - } - - } -} - - - - diff --git a/code/nel/src/3d/usr_shader_loader.cpp b/code/nel/src/3d/usr_shader_loader.cpp deleted file mode 100644 index bf28dc1d3..000000000 --- a/code/nel/src/3d/usr_shader_loader.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// NeL - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - - -#include "nel/3d/usr_shader_loader.h" -#include "nel/3d/usr_shader_manager.h" -#include "nel/3d/usr_shader_program.h" -#include "nel/misc/file.h" -#include "nel/misc/path.h" -#include "nel/misc/i_xml.h" - -namespace NL3D -{ - CUsrShaderLoader::CUsrShaderLoader() - { - manager = NULL; - } - - CUsrShaderLoader::~CUsrShaderLoader() - { - } - - void CUsrShaderLoader::loadShaders( const std::string &directory ) - { - if( manager == NULL ) - return; - - std::vector< std::string > files; - - NLMISC::CPath::getPathContent( directory, true, false, true, files ); - - std::vector< std::string >::iterator itr = files.begin(); - while( itr != files.end() ) - { - if( NLMISC::CFile::getExtension( *itr ) == "nlshdr" ) - { - loadShader( *itr ); - } - - ++itr; - } - } - - void CUsrShaderLoader::loadShader( const std::string &file ) - { - NLMISC::CIFile f; - if( !f.open( file, true ) ) - return; - - NLMISC::CIXml xml; - if( !xml.init( f ) ) - return; - - CUsrShaderProgram *p = new CUsrShaderProgram(); - p->serial( xml ); - manager->addShader( p ); - - f.close(); - } -} - diff --git a/code/nel/src/3d/usr_shader_manager.cpp b/code/nel/src/3d/usr_shader_manager.cpp deleted file mode 100644 index 08b3eefc8..000000000 --- a/code/nel/src/3d/usr_shader_manager.cpp +++ /dev/null @@ -1,157 +0,0 @@ -// NeL - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - - -#include "nel/3d/usr_shader_manager.h" -#include "nel/3d/usr_shader_program.h" -#include "nel/3d/usr_shader_visitor.h" - -namespace NL3D -{ - CUsrShaderManager::CUsrShaderManager() - { - } - - CUsrShaderManager::~CUsrShaderManager() - { - clear(); - } - - - void CUsrShaderManager::clear() - { - std::map< std::string, CUsrShaderProgram* >::iterator itr = programs.begin(); - while( itr != programs.end() ) - { - delete itr->second; - ++itr; - } - programs.clear(); - } - - void CUsrShaderManager::getShaderList( std::vector< std::string > &v ) - { - v.clear(); - - std::string n; - std::map< std::string, CUsrShaderProgram* >::iterator itr = programs.begin(); - while( itr != programs.end() ) - { - itr->second->getName( n ); - v.push_back( n ); - ++itr; - } - } - - bool CUsrShaderManager::addShader( CUsrShaderProgram *program ) - { - std::string n; - program->getName( n ); - - std::map< std::string, CUsrShaderProgram* >::iterator itr - = programs.find( n ); - if( itr != programs.end() ) - return false; - - programs[ n ] = program; - return true; - } - - bool CUsrShaderManager::removeShader( const std::string &name ) - { - std::map< std::string, CUsrShaderProgram* >::iterator itr - = programs.find( name ); - if( itr == programs.end() ) - return false; - - delete itr->second; - itr->second = NULL; - programs.erase( itr ); - - return true; - } - - bool CUsrShaderManager::changeShader( const std::string &name, CUsrShaderProgram *program ) - { - std::map< std::string, CUsrShaderProgram* >::iterator itr - = programs.find( name ); - if( itr == programs.end() ) - return false; - - CUsrShaderProgram *p = itr->second; - std::string s; - - program->getName( s ); - p->setName( s ); - - program->getDescription( s ); - p->setDescription( s ); - - program->getVP( s ); - p->setVP( s ); - - program->getFP( s ); - p->setFP( s ); - - return true; - } - - bool CUsrShaderManager::getShader( const std::string &name, CUsrShaderProgram *program ) - { - std::map< std::string, CUsrShaderProgram* >::iterator itr - = programs.find( name ); - if( itr == programs.end() ) - return false; - - CUsrShaderProgram *p = itr->second; - std::string s; - - program->setName( name ); - - p->getDescription( s ); - program->setDescription( s ); - - p->getVP( s ); - program->setVP( s ); - - p->getFP( s ); - program->setFP( s ); - - return true; - } - - void CUsrShaderManager::visitShaders( IUsrShaderVisitor *visitor ) - { - std::map< std::string, CUsrShaderProgram* >::iterator itr = programs.begin(); - while( itr != programs.end() ) - { - visitor->visit( itr->second ); - ++itr; - } - } - - void CUsrShaderManager::visitShader( const std::string &name, IUsrShaderVisitor *visitor ) - { - std::map< std::string, CUsrShaderProgram* >::iterator itr = - programs.find( name ); - if( itr == programs.end() ) - return; - - visitor->visit( itr->second ); - } -} - - diff --git a/code/nel/src/3d/usr_shader_program.cpp b/code/nel/src/3d/usr_shader_program.cpp deleted file mode 100644 index fc48a94ad..000000000 --- a/code/nel/src/3d/usr_shader_program.cpp +++ /dev/null @@ -1,59 +0,0 @@ -// NeL - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - - -#include "nel/3d/usr_shader_program.h" - -namespace NL3D -{ - CUsrShaderProgram::CUsrShaderProgram() - { - vpId = 0; - fpId = 0; - pId = 0; - } - - CUsrShaderProgram::~CUsrShaderProgram() - { - } - - void CUsrShaderProgram::serial( NLMISC::IStream &f ) - { - f.xmlPush( "ShaderProgram" ); - - int version = f.serialVersion( 1 ); - - f.xmlPush( "Name" ); - f.serial( name ); - f.xmlPop(); - - f.xmlPush( "Description" ); - f.serial( description ); - f.xmlPop(); - - f.xmlPush( "VertexProgram" ); - f.serial( vertexProgram ); - f.xmlPop(); - - f.xmlPush( "FragmentProgram" ); - f.serial( fragmentProgram ); - f.xmlPop(); - - f.xmlPop(); - } -} - - diff --git a/code/nel/src/3d/usr_shader_saver.cpp b/code/nel/src/3d/usr_shader_saver.cpp deleted file mode 100644 index d28a76ca7..000000000 --- a/code/nel/src/3d/usr_shader_saver.cpp +++ /dev/null @@ -1,71 +0,0 @@ -// NeL - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - - -#include "nel/3d/usr_shader_saver.h" -#include "nel/3d/usr_shader_manager.h" -#include "nel/3d/usr_shader_program.h" -#include "nel/misc/file.h" -#include "nel/misc/o_xml.h" - -namespace NL3D -{ - CUsrShaderSaver::CUsrShaderSaver() - { - manager = NULL; - } - - CUsrShaderSaver::~CUsrShaderSaver() - { - } - - void CUsrShaderSaver::visit( CUsrShaderProgram *program ) - { - std::string fn; - program->getName( fn ); - fn += ".nlshdr"; - - fn = outputDir + "/" + fn; - - NLMISC::COFile of; - if( !of.open( fn, false, true ) ) - return; - - NLMISC::COXml xml; - if( !xml.init( &of ) ) - return; - - program->serial( xml ); - - xml.flush(); - of.close(); - - } - - void CUsrShaderSaver::saveShaders( const std::string &directory ) - { - outputDir = directory; - manager->visitShaders( this ); - } - - void CUsrShaderSaver::saveShader( const std::string &directory, const std::string &name ) - { - outputDir = directory; - manager->visitShader( name, this ); - } -} - - diff --git a/code/nel/src/misc/variant.cpp b/code/nel/src/misc/variant.cpp deleted file mode 100644 index 9a3e63e6d..000000000 --- a/code/nel/src/misc/variant.cpp +++ /dev/null @@ -1,320 +0,0 @@ -// NeL - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - - -#include "nel/misc/variant.h" -#include - - -namespace NLMISC -{ - CVariant::CVariant() - { - std::fill( uvalue.vval, uvalue.vval + VARIANT_VVAL_END, 0.0f ); - type = String; - } - - CVariant::~CVariant() - { - } - - void CVariant::serial( IStream &f ) - { - uint v = f.serialVersion( 1 ); - - f.xmlPush( "type" ); - - if( !f.isReading() ) - { - uint t = type; - f.serial( t ); - } - else - { - uint t; - f.serial( t ); - type = EVarType( t ); - } - - f.xmlPop(); - - f.xmlPush( "value" ); - - switch( type ) - { - case Double: - { - f.serial( uvalue.dval ); - break; - } - - case Float: - { - f.serial( uvalue.fval ); - break; - } - - case Int: - { - f.serial( uvalue.ival ); - break; - } - - case UInt: - { - f.serial( uvalue.uval ); - break; - } - - case String: - { - f.serial( sval ); - break; - } - - } - - - if( !f.isReading() ) - { - switch( type ) - { - case Vector4: - { - float fval; - for( int i = 0; i < 4; i++ ) - { - fval = uvalue.vval[ i ]; - f.serial( fval ); - } - break; - } - - case Matrix4: - { - float fval; - for( int i = 0; i < 16; i++ ) - { - fval = uvalue.vval[ i ]; - f.serial( fval ); - } - break; - } - } - - } - else - { - switch( type ) - { - - case Vector4: - { - float fval; - for( int i = 0; i < 4; i++ ) - { - f.serial( fval ); - uvalue.vval[ i ] = fval; - } - break; - } - - case Matrix4: - { - float fval; - for( int i = 0; i < 16; i++ ) - { - f.serial( fval ); - uvalue.vval[ i ] = fval; - } - break; - } - } - } - - f.xmlPop(); - } - - void CVariant::setVector4( const float *v ) - { - for( int i = 0; i < 4; i++ ) - uvalue.vval[ i ] = v[ i ]; - type = Vector4; - } - - void CVariant::setMatrix4( const float *m ) - { - for( int i = 0; i < 16; i++ ) - uvalue.vval[ i ] = m[ i ]; - type = Matrix4; - } - - void CVariant::getVector4( float *v ) const - { - for( int i = 0; i < 4; i++ ) - v[ i ] = uvalue.vval[ i ]; - } - - void CVariant::getMatrix4( float *m ) const - { - for( int i = 0; i < 16; i++ ) - m[ i ] = uvalue.vval[ i ]; - } - - bool CVariant::valueAsString( std::string &s ) const - { - std::stringstream ss; - - switch( type ) - { - case Double: - { - ss << uvalue.dval; - s = ss.str(); - break; - } - - case Float: - { - ss << uvalue.fval; - s = ss.str(); - break; - } - - case Int: - { - ss << uvalue.ival; - s = ss.str(); - break; - } - - case UInt: - { - ss << uvalue.uval; - s = ss.str(); - break; - } - - case String: - { - s = sval; - break; - } - - case Vector4: - { - for( int i = 0; i < 4; i++ ) - ss << uvalue.vval[ i ] << " "; - s = ss.str(); - s.resize( s.size() - 1 ); - break; - } - - case Matrix4: - { - for( int i = 0; i < 16; i++ ) - ss << uvalue.vval[ i ] << " "; - s = ss.str(); - s.resize( s.size() - 1 ); - break; - } - - default: - { - return false; - break; - } - } - - return true; - } - - - void CVariant::fromString( const std::string &s, EVarType t ) - { - type = t; - sval = ""; - std::fill( uvalue.vval, uvalue.vval + VARIANT_VVAL_END, 0.0 ); - - if( s.empty() ) - return; - - switch( t ) - { - case Double: - { - uvalue.dval = strtod( s.c_str(), NULL ); - break; - } - - case Float: - { - uvalue.fval = strtod( s.c_str(), NULL ); - break; - } - - case Int: - { - uvalue.ival = strtod( s.c_str(), NULL ); - break; - } - - case UInt: - { - uvalue.uval = strtod( s.c_str(), NULL ); - break; - } - - case String: - { - sval = s; - break; - } - - case Vector4: - { - std::stringstream ss( s ); - - for( int i = 0; i < 4; i++ ) - { - ss >> uvalue.vval[ i ]; - if( !ss.good() ) - break; - } - - break; - } - - case Matrix4: - { - std::stringstream ss( s ); - - for( int i = 0; i < 16; i++ ) - { - ss >> uvalue.vval[ i ]; - if( !ss.good() ) - break; - } - break; - } - } - - } - -} - - - diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/CMakeLists.txt b/code/nel/tools/3d/object_viewer_qt/src/plugins/CMakeLists.txt index 5ead8ea58..3e99bdc43 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/CMakeLists.txt +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/CMakeLists.txt @@ -6,7 +6,6 @@ ADD_SUBDIRECTORY(log) ADD_SUBDIRECTORY(disp_sheet_id) ADD_SUBDIRECTORY(object_viewer) ADD_SUBDIRECTORY(georges_editor) -ADD_SUBDIRECTORY(material_editor) ADD_SUBDIRECTORY(world_editor) IF(WITH_GUI) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/action_editor.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/action_editor.ui deleted file mode 100644 index 67e453dc9..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/action_editor.ui +++ /dev/null @@ -1,120 +0,0 @@ - - - ActionEditor - - - Qt::ApplicationModal - - - - 0 - 0 - 340 - 145 - - - - Action Editor - - - - - - - - Handler - - - - - - - Handler - - - - - - - Parameters - - - - - - - Parameters - - - - - - - Conditions - - - - - - - Conditions - - - - - - - - - Qt::Vertical - - - - 20 - 11 - - - - - - - - - - - - OK - - - - - - - Cancel - - - - - - - - - Qt::Horizontal - - - - 38 - 20 - - - - - - - - verticalSpacer - - - - - diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/CMakeLists.txt b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/CMakeLists.txt deleted file mode 100644 index 082133cc4..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/CMakeLists.txt +++ /dev/null @@ -1,79 +0,0 @@ -INCLUDE_DIRECTORIES( - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_SOURCE_DIR} - ${QT_INCLUDES} - ) - -FILE(GLOB SRC *.cpp *.h) - -SET(OVQT_EXT_SYS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin.h - ${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin_manager.h - ${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin_spec.h) - -SET(OVQT_PLUGIN_MATERIAL_EDITOR_HDR - material_editor_context.h - material_editor_plugin.h - material_editor_window.h - material_editor_core_listener.h - material_properties.h - material_property_editor.h - material_widget.h - material_splitter.h - render_passes.h - shader_editor.h - shader_widget.h - prop_browser_ctrl.h - viewport_widget.h - fog_widget.h - lights_widget.h - ) - -SET(OVQT_PLUGIN_MATERIAL_EDITOR_UIS - material_editor_window.ui - material_properties.ui - material_property_editor.ui - material_widget.ui - render_passes.ui - shader_editor.ui - shader_widget.ui - fog_widget.ui - lights_widget.ui - ) - -SET(QT_USE_QTGUI TRUE) -SET(QT_USE_QTOPENGL TRUE) - -QT4_ADD_RESOURCES(OVQT_PLUGIN_MATERIAL_EDITOR_RC_SRCS ${OVQT_PLUGIN_MATERIAL_EDITOR_RCS}) -QT4_WRAP_CPP(OVQT_PLUGIN_MATERIAL_EDITOR_MOC_SRC ${OVQT_PLUGIN_MATERIAL_EDITOR_HDR}) -QT4_WRAP_UI(OVQT_PLUGIN_MATERIAL_EDITOR_UI_HDRS ${OVQT_PLUGIN_MATERIAL_EDITOR_UIS}) - -SOURCE_GROUP(QtResources FILES ${OVQT_PLUGIN_MATERIAL_EDITOR_UIS}) -SOURCE_GROUP(QtGeneratedUiHdr FILES ${OVQT_PLUGIN_MATERIAL_EDITOR_UI_HDRS}) -SOURCE_GROUP(QtGeneratedMocQrcSrc FILES ${OVQT_PLUGIN_MATERIAL_EDITOR_MOC_SRC} OVQT_PLUGIN_MATERIAL_EDITOR_RC_SRCS) -SOURCE_GROUP("Material Editor Plugin" FILES ${SRC}) -SOURCE_GROUP("OVQT Extension System" FILES ${OVQT_EXT_SYS_SRC}) - -ADD_LIBRARY(ovqt_plugin_material_editor MODULE ${SRC} - ${OVQT_PLUGIN_MATERIAL_EDITOR_MOC_SRC} - ${OVQT_EXT_SYS_SRC} - ${OVQT_PLUGIN_MATERIAL_EDITOR_UI_HDRS} - ${OVQT_PLUGIN_MATERIAL_EDITOR_RC_SRCS} - ) - -TARGET_LINK_LIBRARIES( - ovqt_plugin_material_editor - ovqt_plugin_core - qt_property_browser - nelmisc - nel3d - ${QT_LIBRARIES} - ${QT_QTOPENGL_LIBRARY} - ) - -NL_DEFAULT_PROPS(ovqt_plugin_material_editor "NeL, Tools, 3D: Object Viewer Qt Plugin: Material Editor") -NL_ADD_RUNTIME_FLAGS(ovqt_plugin_material_editor) -NL_ADD_LIB_SUFFIX(ovqt_plugin_material_editor) - -ADD_DEFINITIONS(-DMATERIAL_EDITOR_LIBRARY -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS}) - -INSTALL(TARGETS ovqt_plugin_material_editor LIBRARY DESTINATION lib RUNTIME DESTINATION bin ARCHIVE DESTINATION lib COMPONENT tools3d) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/doc/material_editor.uml b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/doc/material_editor.uml deleted file mode 100644 index 81585cd55..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/doc/material_editor.uml +++ /dev/null @@ -1,2507 +0,0 @@ - - - - - - - 0.34 - - - - - - UML 1.4 - false - false - true - false - false - false - false - true - false - true - 1 - true - Dialog - 12 - 0 - Class Diagram - - - - - - - - - - - - - - UML 1.4 - - - GoodPractices - - - CodeGeneration - - - - - ArgoUML (using Netbeans XMI Writer version 1.0) - 0.34(6) revised on $Date: 2010-01-11 22:20:14 +0100 (Mon, 11 Jan 2010) $ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - MaterialEditorWindow - - - - - - - - - - - - - - - - - - - - - - - - - - - CNel3DInterface - - - - - - - - - - - - - - - - - - - - - - - - - - - QtTreePropertyWindow - - - - - - - - - - - - - - - - - - - - - - - - - - - CPropBrowserCtrl - - - - - - - - - - - - - - - - - - - - - - - - - - - MaterialWidget - - - - - - - - - - - - - - - - - - - - - - - - - - - ShaderWidget - - - - - - - - - - - - - - - - - - - - - - - - - - - RenderPassesWidget - - - - - - - - - - - - - - - - - - - - - - - - sourcePortFig="Fig0" - destPortFig="Fig5" - sourceFigNode="Fig0" - destFigNode="Fig5" - - - - - - - - - - - - - - sourcePortFig="Fig0" - destPortFig="Fig4" - sourceFigNode="Fig0" - destFigNode="Fig4" - - - - - - - - - - - - - - sourcePortFig="Fig0" - destPortFig="Fig6" - sourceFigNode="Fig0" - destFigNode="Fig6" - - - - - - - - - - - - - - sourcePortFig="Fig0" - destPortFig="Fig1" - sourceFigNode="Fig0" - destFigNode="Fig1" - - - - - - - - - - - - - - sourcePortFig="Fig3" - destPortFig="Fig2" - sourceFigNode="Fig3" - destFigNode="Fig2" - - - - - - - - - - - - - - - - - CMaterialObserver - - - - - - - - - - - - - - - - - - - - - - - - sourcePortFig="Fig6" - destPortFig="Fig12" - sourceFigNode="Fig6" - destFigNode="Fig12" - - - - - - - - - - - - - - sourcePortFig="Fig6" - destPortFig="Fig1" - sourceFigNode="Fig6" - destFigNode="Fig1" - - - - - - - - - - - - - - sourcePortFig="Fig4" - destPortFig="Fig1" - sourceFigNode="Fig4" - destFigNode="Fig1" - - - - - - - - - - - - - - - - - MatPropWidget - - - - - - - - - - - - - - - - - - - - - - - - sourcePortFig="Fig4" - destPortFig="Fig16" - sourceFigNode="Fig4" - destFigNode="Fig16" - - - - - - - - - - - - - - - - - MaterialSplitter - - - - - - - - - - - - - - - - - - - - - - - - sourcePortFig="Fig0" - destPortFig="Fig18" - sourceFigNode="Fig0" - destFigNode="Fig18" - - - - - - - - - - - - - - sourcePortFig="Fig18" - destPortFig="Fig2" - sourceFigNode="Fig18" - destFigNode="Fig2" - - - - - - - - - - - - - - sourcePortFig="Fig18" - destPortFig="Fig3" - sourceFigNode="Fig18" - destFigNode="Fig3" - - - - - - - - - - - - - - sourcePortFig="Fig18" - destPortFig="Fig4" - sourceFigNode="Fig18" - destFigNode="Fig4" - - - - - - - - - - - - - - sourcePortFig="Fig18.0" - destPortFig="Fig12" - sourceFigNode="Fig18" - destFigNode="Fig12" - - - - - - - - - - - - - - - - - diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/fog_widget.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/fog_widget.cpp deleted file mode 100644 index 7824d167c..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/fog_widget.cpp +++ /dev/null @@ -1,116 +0,0 @@ -// Object Viewer Qt Material Editor plugin -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - - -#include "fog_widget.h" -#include "nel3d_interface.h" -#include - -namespace MaterialEditor -{ - FogWidget::FogWidget( QWidget *parent ) : - QWidget( parent ) - { - iface = NULL; - setupUi( this ); - setupConnections(); - } - - FogWidget::~FogWidget() - { - iface = NULL; - } - - void FogWidget::loadValues() - { - SFogSettings s; - iface->getFogSettings( s ); - - fogCB->setChecked( s.enable ); - startSB->setValue( s.start ); - endSB->setValue( s.end ); - setColorButtonColor( s.color[ 0 ], s.color[ 1 ], s.color[ 2 ] ); - } - - void FogWidget::setupConnections() - { - connect( fogCB, SIGNAL( clicked( bool ) ), this, SLOT( onFogCBClicked() ) ); - connect( startSB, SIGNAL( valueChanged( double ) ), this, SLOT( onStartSBChanged() ) ); - connect( endSB, SIGNAL( valueChanged( double ) ), this, SLOT( onEndSBChanged() ) ); - connect( colorButton, SIGNAL( clicked( bool ) ), this, SLOT( onColorButtonClicked() ) ); - } - - void FogWidget::onFogCBClicked() - { - SFogSettings s; - iface->getFogSettings( s ); - - s.enable = fogCB->isChecked(); - - iface->setFogSettings( s ); - - if( !s.enable ) - iface->setBGColor( 255, 255, 255, 255 ); - } - - void FogWidget::onStartSBChanged() - { - SFogSettings s; - iface->getFogSettings( s ); - - s.start = startSB->value(); - - iface->setFogSettings( s ); - } - - void FogWidget::onEndSBChanged() - { - SFogSettings s; - iface->getFogSettings( s ); - - s.end = endSB->value(); - - iface->setFogSettings( s ); - } - - void FogWidget::onColorButtonClicked() - { - QColor c = QColorDialog::getColor(); - - setColorButtonColor( c.red(), c.green(), c.blue() ); - - SFogSettings s; - iface->getFogSettings( s ); - - s.color[ 0 ] = c.red(); - s.color[ 1 ] = c.green(); - s.color[ 2 ] = c.blue(); - s.color[ 3 ] = 255; - - iface->setFogSettings( s ); - } - - void FogWidget::setColorButtonColor( int r, int g, int b ) - { - QString sh; - sh = QString( "background-color: rgb(%1, %2, %3);" ).arg( r ).arg( g ).arg( b ); - colorButton->setStyleSheet( sh ); - } - -} - - - diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/fog_widget.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/fog_widget.h deleted file mode 100644 index e507c39cd..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/fog_widget.h +++ /dev/null @@ -1,56 +0,0 @@ -// Object Viewer Qt Material Editor plugin -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - - -#ifndef FOG_WIDGET_H -#define FOG_WIDGET_H - -#include "ui_fog_widget.h" - -namespace MaterialEditor -{ - class CNel3DInterface; - - class FogWidget : public QWidget, public Ui::FogWidget - { - Q_OBJECT - - public: - FogWidget( QWidget *parent = NULL ); - ~FogWidget(); - - void loadValues(); - - void setNl3DIface( CNel3DInterface *iface ){ this->iface = iface; } - - private Q_SLOTS: - void onFogCBClicked(); - void onStartSBChanged(); - void onEndSBChanged(); - void onColorButtonClicked(); - - private: - void setupConnections(); - void setColorButtonColor( int r, int g, int b ); - - - CNel3DInterface *iface; - - }; -} - -#endif - diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/fog_widget.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/fog_widget.ui deleted file mode 100644 index c3f692475..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/fog_widget.ui +++ /dev/null @@ -1,83 +0,0 @@ - - - FogWidget - - - Qt::ApplicationModal - - - - 0 - 0 - 278 - 116 - - - - - 0 - 0 - - - - Fog settings - - - - QLayout::SetMaximumSize - - - - - Enable fog - - - - - - - Start - - - - - - - - - - End - - - - - - - - - - Color - - - - - - - - 0 - 0 - - - - - - - - - - - - - - - diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/lights_widget.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/lights_widget.cpp deleted file mode 100644 index b75d63c7d..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/lights_widget.cpp +++ /dev/null @@ -1,270 +0,0 @@ -// Object Viewer Qt Material Editor plugin -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -#include "lights_widget.h" -#include -#include "nel3d_interface.h" - -namespace MaterialEditor -{ - enum LWLightTypes - { - DIRECTIONAL, - POINT, - SPOT - }; - - enum LWColorButton - { - AMBIENT, - DIFFUSE, - SPECULAR - }; - - void LightsWidget::setButtonColor( unsigned char butt, int r, int g, int b ) - { - QString sh; - QPushButton *button; - - if( butt > SPECULAR ) - return; - - switch( butt ) - { - case AMBIENT: - button = ambientButton; - break; - - case DIFFUSE: - button = diffuseButton; - break; - - case SPECULAR: - button = specularButton; - break; - } - - sh = QString( "background-color: rgb(%1, %2, %3);" ).arg( r ).arg( g ).arg( b ); - button->setStyleSheet( sh ); - - buttonColors[ butt ][ 0 ] = r; - buttonColors[ butt ][ 1 ] = g; - buttonColors[ butt ][ 2 ] = b; - } - - - - LightsWidget::LightsWidget( QWidget *parent ) : - QWidget( parent ) - { - setupUi( this ); - setupConnections(); - - typeCB->addItem( "Directional light" ); - typeCB->addItem( "Point light" ); - typeCB->addItem( "Spot light" ); - } - - LightsWidget::~LightsWidget() - { - } - - void LightsWidget::loadValues() - { - disableChangeConnections(); - - unsigned char c = iface->getMaxLights(); - - lightList->clear(); - - for( unsigned char i = 0; i < c; i++ ) - { - QString s = "light"; - s += QString::number( i ); - lightList->addItem( s ); - } - - lightList->setCurrentRow( 0 ); - loadLight( 0 ); - - // loadLight enables it anyways - //setupChangeConnections(); - } - - void LightsWidget::setupConnections() - { - } - - void LightsWidget::setupChangeConnections() - { - connect( enableCB, SIGNAL( toggled( bool ) ), this, SLOT( onChanges() ) ); - connect( ambientButton, SIGNAL( clicked( bool ) ), this, SLOT( onAmbButtonClicked() ) ); - connect( diffuseButton, SIGNAL( clicked( bool ) ), this, SLOT( onDiffButtonClicked() ) ); - connect( specularButton, SIGNAL( clicked( bool ) ), this, SLOT( onSpecButtonClicked() ) ); - connect( lightList, SIGNAL( currentRowChanged( int ) ), this, SLOT( onLightChanged( int ) ) ); - - connect( typeCB, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onChanges() ) ); - connect( xSB, SIGNAL( valueChanged( double ) ), this, SLOT( onChanges() ) ); - connect( ySB, SIGNAL( valueChanged( double ) ), this, SLOT( onChanges() ) ); - connect( zSB, SIGNAL( valueChanged( double ) ), this, SLOT( onChanges() ) ); - connect( constAttnButton, SIGNAL( valueChanged( double ) ), this, SLOT( onChanges() ) ); - connect( linearAttnButton, SIGNAL( valueChanged( double ) ), this, SLOT( onChanges() ) ); - connect( quadAttnButton, SIGNAL( valueChanged( double ) ), this, SLOT( onChanges() ) ); - } - - void LightsWidget::disableChangeConnections() - { - disconnect( enableCB, SIGNAL( toggled( bool ) ), this, SLOT( onChanges() ) ); - disconnect( ambientButton, SIGNAL( clicked( bool ) ), this, SLOT( onAmbButtonClicked() ) ); - disconnect( diffuseButton, SIGNAL( clicked( bool ) ), this, SLOT( onDiffButtonClicked() ) ); - disconnect( specularButton, SIGNAL( clicked( bool ) ), this, SLOT( onSpecButtonClicked() ) ); - disconnect( lightList, SIGNAL( currentRowChanged( int ) ), this, SLOT( onLightChanged( int ) ) ); - - disconnect( typeCB, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onChanges() ) ); - disconnect( xSB, SIGNAL( valueChanged( double ) ), this, SLOT( onChanges() ) ); - disconnect( ySB, SIGNAL( valueChanged( double ) ), this, SLOT( onChanges() ) ); - disconnect( zSB, SIGNAL( valueChanged( double ) ), this, SLOT( onChanges() ) ); - disconnect( constAttnButton, SIGNAL( valueChanged( double ) ), this, SLOT( onChanges() ) ); - disconnect( linearAttnButton, SIGNAL( valueChanged( double ) ), this, SLOT( onChanges() ) ); - disconnect( quadAttnButton, SIGNAL( valueChanged( double ) ), this, SLOT( onChanges() ) ); - } - - void LightsWidget::onAmbButtonClicked() - { - QColor c = QColorDialog::getColor(); - setButtonColor( AMBIENT, c.red(), c.green(), c.blue() ); - applyChanges(); - } - - void LightsWidget::onDiffButtonClicked() - { - QColor c = QColorDialog::getColor(); - setButtonColor( DIFFUSE, c.red(), c.green(), c.blue() ); - applyChanges(); - } - - void LightsWidget::onSpecButtonClicked() - { - QColor c = QColorDialog::getColor(); - setButtonColor( SPECULAR, c.red(), c.green(), c.blue() ); - applyChanges(); - } - - void LightsWidget::onLightChanged( int light ) - { - loadLight( light ); - } - - void LightsWidget::onChanges() - { - applyChanges(); - } - - void LightsWidget::loadLight( unsigned char light ) - { - disableChangeConnections(); - - SLightInfo info; - iface->getLightInfo( light, info ); - - if( info.enabled ) - enableCB->setChecked( true ); - else - enableCB->setChecked( false ); - - switch( info.type ) - { - case SLightInfo::Directional: - typeCB->setCurrentIndex( DIRECTIONAL ); - break; - case SLightInfo::Point: - typeCB->setCurrentIndex( POINT ); - break; - case SLightInfo::Spot: - typeCB->setCurrentIndex( SPOT ); - break; - } - - xSB->setValue( info.posOrDir[ 0 ] ); - ySB->setValue( info.posOrDir[ 1 ] ); - zSB->setValue( info.posOrDir[ 2 ] ); - - constAttnButton->setValue( info.constAttn ); - linearAttnButton->setValue( info.linAttn ); - quadAttnButton->setValue( info.quadAttn ); - - setButtonColor( AMBIENT, info.ambColor[ 0 ] * 255.0f, - info.ambColor[ 1 ] * 255.0f, - info.ambColor[ 2 ] * 255.0f ); - - setButtonColor( DIFFUSE, info.diffColor[ 0 ] * 255.0f, - info.diffColor[ 1 ] * 255.0f, - info.diffColor[ 2 ] * 255.0f ); - - setButtonColor( SPECULAR, info.specColor[ 0 ] * 255.0f, - info.specColor[ 1 ] * 255.0f, - info.specColor[ 2 ] * 255.0f ); - - setupChangeConnections(); - } - - void LightsWidget::saveLight( unsigned char light ) - { - SLightInfo info; - - info.enabled = enableCB->isChecked(); - switch( typeCB->currentIndex() ) - { - case DIRECTIONAL: - info.type = SLightInfo::Directional; - break; - case POINT: - info.type = SLightInfo::Point; - break; - case SPOT: - info.type = SLightInfo::Spot; - break; - } - - info.posOrDir[ 0 ] = static_cast< float >( xSB->value() ); - info.posOrDir[ 1 ] = static_cast< float >( ySB->value() ); - info.posOrDir[ 2 ] = static_cast< float >( zSB->value() ); - - info.constAttn = static_cast< float >( constAttnButton->value() ); - info.linAttn = static_cast< float >( linearAttnButton->value() ); - info.quadAttn = static_cast< float >( quadAttnButton->value() ); - - info.ambColor[ 0 ] = buttonColors[ AMBIENT ][ 0 ] / 255.0f; - info.ambColor[ 1 ] = buttonColors[ AMBIENT ][ 1 ] / 255.0f; - info.ambColor[ 2 ] = buttonColors[ AMBIENT ][ 2 ] / 255.0f; - info.diffColor[ 0 ] = buttonColors[ DIFFUSE ][ 0 ] / 255.0f; - info.diffColor[ 1 ] = buttonColors[ DIFFUSE ][ 1 ] / 255.0f; - info.diffColor[ 2 ] = buttonColors[ DIFFUSE ][ 2 ] / 255.0f; - info.specColor[ 0 ] = buttonColors[ SPECULAR ][ 0 ] / 255.0f; - info.specColor[ 1 ] = buttonColors[ SPECULAR ][ 1 ] / 255.0f; - info.specColor[ 2 ] = buttonColors[ SPECULAR ][ 2 ] / 255.0f; - - iface->setLightInfo( light, info ); - } - - void LightsWidget::applyChanges() - { - int row = lightList->currentRow(); - saveLight( static_cast< unsigned char >( row ) ); - } - -} - diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/lights_widget.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/lights_widget.h deleted file mode 100644 index 4a9cd0faf..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/lights_widget.h +++ /dev/null @@ -1,72 +0,0 @@ -// Object Viewer Qt Material Editor plugin -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - - -#ifndef LIGHTS_WIDGET_H -#define LIGHTS_WIDGET_H - -#include "ui_lights_widget.h" - -namespace MaterialEditor -{ - class CNel3DInterface; - - class LightsWidget : public QWidget, public Ui::LightsWidget - { - Q_OBJECT - - private: - void setButtonColor( unsigned char butt, int r, int g, int b ); - - public: - LightsWidget( QWidget *parent = NULL ); - ~LightsWidget(); - void setNL3DIface( CNel3DInterface *iface ){ this->iface = iface; } - void loadValues(); - - private Q_SLOTS: - void onAmbButtonClicked(); - void onDiffButtonClicked(); - void onSpecButtonClicked(); - void onLightChanged( int light ); - void onChanges(); - - private: - void setupConnections(); - void setupChangeConnections(); - void disableChangeConnections(); - void loadLight( unsigned char light ); - void saveLight( unsigned char light ); - void applyChanges(); - - CNel3DInterface *iface; - - enum LightType - { - Directional, - Point, - Spot - }; - - int buttonColors[ 3 ][ 3 ]; - }; - -} - - -#endif - - diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/lights_widget.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/lights_widget.ui deleted file mode 100644 index ef996e9b5..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/lights_widget.ui +++ /dev/null @@ -1,229 +0,0 @@ - - - LightsWidget - - - - 0 - 0 - 495 - 434 - - - - Light settings - - - - - - Enable - - - - - - - Type - - - - - 10 - 20 - 99 - 20 - - - - - - - - - - 0 - 0 - - - - Direction or Position - - - - - - X - - - - - - - -9999.000000000000000 - - - 9999.000000000000000 - - - - - - - Y - - - - - - - -9999.000000000000000 - - - 9999.000000000000000 - - - - - - - Z - - - - - - - -9999.000000000000000 - - - 9999.000000000000000 - - - - - - - - - - Attenuation - - - - - - Constant - - - - - - - - - - Linear - - - - - - - - - - Quadratic - - - - - - - - - - - - - Color - - - - - - Ambient - - - - - - - - 0 - 0 - - - - - - - - - - - Diffuse - - - - - - - - 0 - 0 - - - - - - - - - - - Specular - - - - - - - - 0 - 0 - - - - - - - - - - - - - - - 0 - 0 - - - - - - - - - diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_constants.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_constants.h deleted file mode 100644 index 1df628298..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_constants.h +++ /dev/null @@ -1,33 +0,0 @@ -// Object Viewer Qt Material Editor plugin -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -#ifndef MATERIAL_EDITOR_CONSTANTS_H -#define MATERIAL_EDITOR_CONSTANTS_H - -namespace MaterialEditor -{ - namespace Constants - { - - const char * const GUI_EDITOR_PLUGIN = "MaterialEditor"; - const char * const GUI_EDITOR_SECTION = "MaterialEditor"; - - } - -} - -#endif - diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_context.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_context.cpp deleted file mode 100644 index 4941b1ae6..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_context.cpp +++ /dev/null @@ -1,58 +0,0 @@ -// Object Viewer Qt Material Editor plugin -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - - -#include "material_editor_context.h" -#include "material_editor_window.h" - -namespace MaterialEditor -{ - MaterialEditorContext::MaterialEditorContext( QObject *parent ) : - IContext( parent ), - m_materialEditorWindow( 0 ) - { - m_materialEditorWindow = new MaterialEditorWindow(); - } - - void MaterialEditorContext::open() - { - m_materialEditorWindow->onOpenClicked(); - } - - void MaterialEditorContext::newDocument() - { - } - - void MaterialEditorContext::save() - { - } - - void MaterialEditorContext::saveAs() - { - } - - void MaterialEditorContext::close() - { - m_materialEditorWindow->close(); - } - - QWidget *MaterialEditorContext::widget() - { - return m_materialEditorWindow; - } - -} - diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_context.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_context.h deleted file mode 100644 index f04e502dd..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_context.h +++ /dev/null @@ -1,64 +0,0 @@ -// Object Viewer Qt Material Editor plugin -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - - -#ifndef MATERIAL_EDITOR_CONTEXT_H -#define MATERIAL_EDITOR_CONTEXT_H - -#include "../core/icontext.h" - -#include "nel/misc/app_context.h" - -#include -#include - -namespace MaterialEditor -{ - class MaterialEditorWindow; - - class MaterialEditorContext: public Core::IContext - { - Q_OBJECT - public: - MaterialEditorContext(QObject *parent = 0); - virtual ~MaterialEditorContext() {} - - virtual QString id() const{ return QLatin1String("MaterialEditorContext"); } - - virtual QString trName() const{ return tr("Material Editor"); } - - virtual QIcon icon() const{ return QIcon(); } - - void open(); - - void newDocument(); - - void save(); - - void saveAs(); - - void close(); - - virtual QUndoStack *undoStack(){ return NULL; } - - virtual QWidget *widget(); - - MaterialEditorWindow *m_materialEditorWindow; - }; - -} - -#endif diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_core_listener.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_core_listener.cpp deleted file mode 100644 index 21d015dd9..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_core_listener.cpp +++ /dev/null @@ -1,28 +0,0 @@ -// Object Viewer Qt Material Editor plugin -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -#include "material_editor_core_listener.h" -#include "material_editor_window.h" - -namespace MaterialEditor -{ - bool MaterialEditorCoreListener::closeMainWindow() const - { - return mainWindow->close(); - } -} - - diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_core_listener.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_core_listener.h deleted file mode 100644 index fd148683e..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_core_listener.h +++ /dev/null @@ -1,41 +0,0 @@ -// Object Viewer Qt Material Editor plugin -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - - -#ifndef MATERIAL_EDITOR_CORE_LISTENER_H -#define MATERIAL_EDITOR_CORE_LISTENER_H - -#include "../core/icore_listener.h" - -namespace MaterialEditor -{ - class MaterialEditorWindow; - - class MaterialEditorCoreListener : public Core::ICoreListener - { - Q_OBJECT - public: - MaterialEditorCoreListener( MaterialEditorWindow *mainWindow, QObject *parent = NULL ){ this->mainWindow = mainWindow; } - ~MaterialEditorCoreListener(){} - bool closeMainWindow() const; - - private: - MaterialEditorWindow *mainWindow; - }; -} - -#endif - diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_global.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_global.h deleted file mode 100644 index 82fb39e14..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_global.h +++ /dev/null @@ -1,30 +0,0 @@ -// Object Viewer Qt Material Editor plugin -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - - -#ifndef MATERIAL_EDITOR_GLOBAL_H -#define MATERIAL_EDITOR_GLOBAL_H - -#include - -#if defined( MATERIAL_EDITOR_LIBRARY ) -# define MATERIAL_EDITOR_EXPORT Q_DECL_EXPORT -#else -# define MATERIAL_EDITOR_EXPORT Q_DECL_IMPORT -#endif - -#endif - diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_plugin.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_plugin.cpp deleted file mode 100644 index af4740c21..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_plugin.cpp +++ /dev/null @@ -1,82 +0,0 @@ -// Object Viewer Qt Material Editor plugin -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -#include "material_editor_plugin.h" -#include "material_editor_window.h" -#include "material_editor_context.h" -#include "material_editor_core_listener.h" - -#include "../core/icore.h" -#include "../core/core_constants.h" - -#include "nel/misc/debug.h" - -#include - -namespace MaterialEditor -{ - MaterialEditorPlugin::~MaterialEditorPlugin() - { - Q_FOREACH(QObject *obj, m_autoReleaseObjects) - { - m_plugMan->removeObject(obj); - } - - qDeleteAll(m_autoReleaseObjects); - m_autoReleaseObjects.clear(); - } - - bool MaterialEditorPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString) - { - Q_UNUSED(errorString); - m_plugMan = pluginManager; - MaterialEditorContext *context = new MaterialEditorContext( this ); - MaterialEditorWindow *window = static_cast< MaterialEditorWindow* >( context->widget() ); - - addAutoReleasedObject( context ); - addAutoReleasedObject( new MaterialEditorCoreListener( window, this ) ); - - return true; - } - - void MaterialEditorPlugin::extensionsInitialized() - { - } - - void MaterialEditorPlugin::shutdown() - { - } - - void MaterialEditorPlugin::setNelContext(NLMISC::INelContext *nelContext) - { - -#ifdef NL_OS_WINDOWS - // Ensure that a context doesn't exist yet. - // This only applies to platforms without PIC, e.g. Windows. - nlassert(!NLMISC::INelContext::isContextInitialised()); -#endif // NL_OS_WINDOWS - m_libContext = new NLMISC::CLibraryContext(*nelContext); - } - - void MaterialEditorPlugin::addAutoReleasedObject(QObject *obj) - { - m_plugMan->addObject(obj); - m_autoReleaseObjects.prepend(obj); - } - -} - -Q_EXPORT_PLUGIN(MaterialEditor::MaterialEditorPlugin) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_plugin.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_plugin.h deleted file mode 100644 index 0e4b1769c..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_plugin.h +++ /dev/null @@ -1,69 +0,0 @@ -// Object Viewer Qt Material Editor plugin -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -#ifndef MATERIAL_EDITOR_PLUGIN_H -#define MATERIAL_EDITOR_PLUGIN_H - -#include "material_editor_constants.h" -#include "../../extension_system/iplugin.h" -#include "../core/icontext.h" - -#include "nel/misc/app_context.h" - -#include -#include - -namespace NLMISC -{ - class CLibraryContext; -} - -namespace ExtensionSystem -{ - class IPluginSpec; -} - -namespace MaterialEditor -{ - class MaterialEditorWindow; - - class MaterialEditorPlugin : public QObject, public ExtensionSystem::IPlugin - { - Q_OBJECT - Q_INTERFACES(ExtensionSystem::IPlugin) - public: - virtual ~MaterialEditorPlugin(); - - bool initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString); - - void extensionsInitialized(); - - void shutdown(); - - void setNelContext(NLMISC::INelContext *nelContext); - - void addAutoReleasedObject(QObject *obj); - - protected: - NLMISC::CLibraryContext *m_libContext; - - private: - ExtensionSystem::IPluginManager *m_plugMan; - QList m_autoReleaseObjects; - }; -} - -#endif diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.cpp deleted file mode 100644 index bcdd8847f..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.cpp +++ /dev/null @@ -1,381 +0,0 @@ -// Object Viewer Qt Material Editor plugin -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -#include "material_editor_window.h" -#include "material_editor_constants.h" -#include "material_splitter.h" -#include "shader_widget.h" -#include "render_passes.h" -#include "nel3d_interface.h" -#include "viewport_widget.h" -#include "fog_widget.h" -#include "lights_widget.h" - -#include "../core/icore.h" -#include "../core/core_constants.h" -#include "../core/core.h" -#include "../core/menu_manager.h" - -#include - -#include -#include -#include -#include -#include -#include - -namespace MaterialEditor -{ - MaterialEditorWindow::MaterialEditorWindow(QWidget *parent) : - QMainWindow(parent) - { - m_ui.setupUi(this); - - nl3dIface = new CNel3DInterface(); - viewPort = new ViewPortWidget(); - viewPort->setNel3DInterface( nl3dIface ); - shaderWidget = new ShaderWidget(); - shaderWidget->setNel3DInterface( nl3dIface ); - materialSplitter = new MaterialSplitter(); - materialSplitter->setNel3DIface( nl3dIface ); - passesWidget = new RenderPassesWidget(); - passesWidget->setMaterialObserver( materialSplitter ); - passesWidget->setNel3dIface( nl3dIface ); - fogWidget = new FogWidget(); - fogWidget->setNl3DIface( nl3dIface ); - lightsWidget = new LightsWidget(); - lightsWidget->setNL3DIface( nl3dIface ); - - //passesWidget->onMaterialLoaded(); - //materialSplitter->onMaterialLoaded(); - - createMenus(); - createDockWidgets(); - setupConnections(); - - setCentralWidget( viewPort ); - - QTimer::singleShot( 1, this, SLOT( onStartup() ) ); - } - - MaterialEditorWindow::~MaterialEditorWindow() - { - delete fogWidget; - fogWidget = NULL; - delete lightsWidget; - lightsWidget = NULL; - delete shaderWidget; - shaderWidget = NULL; - delete passesWidget; - passesWidget = NULL; - viewPort = NULL; - delete nl3dIface; - nl3dIface = NULL; - } - - void MaterialEditorWindow::onOpenClicked() - { - if( lastShapeDir.isEmpty() ) - lastShapeDir = "/"; - - QString fn = QFileDialog::getOpenFileName( - this, - tr( "Open model" ), - lastShapeDir, - tr( "Shape files ( *.shape )" ) - ); - - if( fn.isEmpty() ) - return; - - QFileInfo info; - info.setFile( fn ); - lastShapeDir = info.absolutePath(); - - std::string fname = fn.toUtf8().data(); - bool ok = nl3dIface->loadShape( fname ); - if( !ok ) - { - QMessageBox::critical( - this, - tr( "Error loading shape file" ), - tr( "There was an error while loading the shape file." ) - ); - } - - materialSplitter->onShapeChanged(); - viewPort->startTimedUpdates( 20 ); - } - - void MaterialEditorWindow::onNewMaterialClicked() - { - nl3dIface->newMaterial(); - materialSplitter->onMaterialLoaded(); - passesWidget->onMaterialLoaded(); - } - - void MaterialEditorWindow::onOpenMaterialClicked() - { - if( lastMatDir.isEmpty() ) - lastMatDir = "/"; - - QString fn = QFileDialog::getOpenFileName( - this, - tr( "Open material" ), - lastMatDir, - tr( "Material files ( *.nelmat )" ) - ); - - if( fn.isEmpty() ) - return; - - QFileInfo info; - info.setFile( fn ); - lastMatDir = info.absolutePath(); - - bool ok = nl3dIface->loadMaterial( fn.toUtf8().data() ); - if( !ok ) - { - QMessageBox::critical( - this, - tr( "Error opening material file" ), - tr( "There was an error while trying to open the material file specified!" ), - QMessageBox::Ok - ); - } - - passesWidget->onMaterialLoaded(); - materialSplitter->onMaterialLoaded(); - } - - void MaterialEditorWindow::onSaveMaterialClicked() - { - QString fn = QFileDialog::getSaveFileName( - this, - tr( "Save material" ), - "/", - tr( "Material files ( *.nelmat )" ) - ); - - if( fn.isEmpty() ) - return; - - bool ok = nl3dIface->saveMaterial( fn.toUtf8().data() ); - if( !ok ) - { - QMessageBox::critical( - this, - tr( "Error saving material file" ), - tr( "There was an error while trying to open the material file specified!" ), - QMessageBox::Ok - ); - } - - } - - void MaterialEditorWindow::onGenMaterialsClicked() - { - nl3dIface->genMaterials(); - passesWidget->onMaterialLoaded(); - materialSplitter->onMaterialLoaded(); - } - - void MaterialEditorWindow::onShadersClicked() - { - shaderWidget->show(); - } - - void MaterialEditorWindow::onPassesClicked() - { - passesWidget->show(); - } - - void MaterialEditorWindow::onStartup() - { - nl3dIface->loadShaders(); - shaderWidget->load(); - viewPort->init(); - } - - void MaterialEditorWindow::onAddCubeClicked() - { - if( !nl3dIface->addCube() ) - { - QMessageBox::critical( - this, - tr( "Error adding primitive" ), - tr( "There was an error while adding this primitive" ) - ); - return; - } - materialSplitter->onShapeChanged(); - viewPort->startTimedUpdates( 20 ); - } - - void MaterialEditorWindow::onAddSphereClicked() - { - if( !nl3dIface->addSphere() ) - { - QMessageBox::critical( - this, - tr( "Error adding primitive" ), - tr( "There was an error while adding this primitive" ) - ); - return; - } - materialSplitter->onShapeChanged(); - viewPort->startTimedUpdates( 20 ); - } - - void MaterialEditorWindow::onAddCylinderClicked() - { - if( !nl3dIface->addCylinder() ) - { - QMessageBox::critical( - this, - tr( "Error adding primitive" ), - tr( "There was an error while adding this primitive" ) - ); - return; - } - materialSplitter->onShapeChanged(); - viewPort->startTimedUpdates( 20 ); - } - - void MaterialEditorWindow::onAddTeaPotClicked() - { - if( !nl3dIface->addTeaPot() ) - { - QMessageBox::critical( - this, - tr( "Error adding primitive" ), - tr( "There was an error while adding this primitive" ) - ); - return; - } - materialSplitter->onShapeChanged(); - viewPort->startTimedUpdates( 20 ); - } - - void MaterialEditorWindow::onClearSceneClicked() - { - nl3dIface->clearScene(); - materialSplitter->onSceneCleared(); - viewPort->stopTimedUpdates(); - } - - void MaterialEditorWindow::onFogClicked() - { - fogWidget->loadValues(); - fogWidget->show(); - } - - void MaterialEditorWindow::onLightsClicked() - { - lightsWidget->loadValues(); - lightsWidget->show(); - } - - void MaterialEditorWindow::createMenus() - { - Core::MenuManager *mm = Core::ICore::instance()->menuManager(); - - QMenu *menu = mm->menu( Core::Constants::M_TOOLS ); - if( menu != NULL ) - { - QMenu *m = menu->addMenu( tr( "Material Editor" ) ); - QAction *a; - - QMenu *mm = m->addMenu( tr( "Material" ) ); - { - a = new QAction( tr( "New material" ), NULL ); - connect( a, SIGNAL( triggered( bool ) ), this, SLOT( onNewMaterialClicked() ) ); - mm->addAction( a ); - - a = new QAction( tr( "Open material" ) , NULL ); - connect( a, SIGNAL( triggered( bool ) ), this, SLOT( onOpenMaterialClicked() ) ); - mm->addAction( a ); - - a = new QAction( tr( "Save material" ), NULL ); - connect( a, SIGNAL( triggered( bool ) ), this, SLOT( onSaveMaterialClicked() ) ); - mm->addAction( a ); - - a = new QAction( tr( "Generate materials" ), NULL ); - connect( a, SIGNAL( triggered( bool ) ), this, SLOT( onGenMaterialsClicked() ) ); - mm->addAction( a ); - } - - mm = m->addMenu( tr( "Scene" ) ); - { - QMenu *mmm = mm->addMenu( tr( "Add primitive" ) ); - - a = new QAction( tr( "Cube" ), NULL ); - connect( a, SIGNAL( triggered( bool ) ), this, SLOT( onAddCubeClicked() ) ); - mmm->addAction( a ); - a = new QAction( tr( "Sphere" ), NULL ); - connect( a, SIGNAL( triggered( bool ) ), this, SLOT( onAddSphereClicked() ) ); - mmm->addAction( a ); - a = new QAction( tr( "Cylinder" ), NULL ); - connect( a, SIGNAL( triggered( bool ) ), this, SLOT( onAddCylinderClicked() ) ); - mmm->addAction( a ); - a = new QAction( tr( "Tea pot" ), NULL ); - connect( a, SIGNAL( triggered( bool ) ), this, SLOT( onAddTeaPotClicked() ) ); - mmm->addAction( a ); - - a = new QAction( tr( "Clear scene" ), NULL ); - connect( a, SIGNAL( triggered( bool ) ), this, SLOT( onClearSceneClicked() ) ); - mm->addAction( a ); - - a = new QAction( tr( "Fog" ), NULL ); - connect( a, SIGNAL( triggered( bool ) ), this, SLOT( onFogClicked() ) ); - mm->addAction( a ); - - a = new QAction( tr( "Lights" ), NULL ); - connect( a, SIGNAL( triggered( bool ) ), this, SLOT( onLightsClicked() ) ); - mm->addAction( a ); - } - - a = new QAction( tr( "Shaders" ), NULL ); - connect( a, SIGNAL( triggered( bool ) ), this, SLOT( onShadersClicked() ) ); - m->addAction( a ); - - a = new QAction( tr( "Render passes" ), NULL ); - connect( a, SIGNAL( triggered( bool ) ), this, SLOT( onPassesClicked() ) ); - m->addAction( a ); - } - } - - void MaterialEditorWindow::createDockWidgets() - { - QDockWidget *dock = new QDockWidget( tr( "Material" ), this ); - dock->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea ); - dock->setWidget( materialSplitter ); - addDockWidget( Qt::RightDockWidgetArea, dock ); - } - - void MaterialEditorWindow::setupConnections() - { - connect( shaderWidget, SIGNAL( shaderAdded( const QString& ) ), - materialSplitter, SLOT( onShaderAdded( const QString& ) ) ); - - connect( shaderWidget, SIGNAL( shaderRemoved( const QString& ) ), - materialSplitter, SLOT( onShaderRemoved( const QString& ) ) ); - - - } - -} diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.h deleted file mode 100644 index 2abf2a4dc..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.h +++ /dev/null @@ -1,83 +0,0 @@ -// Object Viewer Qt Material Editor plugin -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -#ifndef MATERIAL_EDITOR_WINDOW_H -#define MATERIAL_EDITOR_WINDOW_H - -#include "ui_material_editor_window.h" - -namespace MaterialEditor -{ - - class ShaderWidget; - class RenderPassesWidget; - class CNel3DInterface; - class MaterialSplitter; - class ViewPortWidget; - class FogWidget; - class LightsWidget; - - class MaterialEditorWindow: public QMainWindow - { - Q_OBJECT -public: - MaterialEditorWindow( QWidget *parent = NULL ); - ~MaterialEditorWindow(); - - void onOpenClicked(); - -private Q_SLOTS: - void onNewMaterialClicked(); - void onOpenMaterialClicked(); - void onSaveMaterialClicked(); - void onGenMaterialsClicked(); - void onShadersClicked(); - void onPassesClicked(); - void onStartup(); - - void onAddCubeClicked(); - void onAddSphereClicked(); - void onAddCylinderClicked(); - void onAddTeaPotClicked(); - - void onClearSceneClicked(); - void onFogClicked(); - void onLightsClicked(); - -private: - void createMenus(); - void createDockWidgets(); - void setupConnections(); - - CNel3DInterface *nl3dIface; - - ShaderWidget *shaderWidget; - RenderPassesWidget *passesWidget; - MaterialSplitter *materialSplitter; - ViewPortWidget *viewPort; - FogWidget *fogWidget; - LightsWidget *lightsWidget; - - Ui::MaterialEditorWindow m_ui; - - QString lastShapeDir; - QString lastMatDir; - }; - -} - -#endif - diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.ui deleted file mode 100644 index f510d5e29..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.ui +++ /dev/null @@ -1,33 +0,0 @@ - - - MaterialEditorWindow - - - - 0 - 0 - 800 - 600 - - - - MainWindow - - - - - - - toolBar - - - TopToolBarArea - - - false - - - - - - diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_observer.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_observer.h deleted file mode 100644 index 4deb1dbfc..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_observer.h +++ /dev/null @@ -1,43 +0,0 @@ -// Object Viewer Qt Material Editor plugin -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -#ifndef MATERIAL_OBSERVER_H -#define MATERIAL_OBSERVER_H - -namespace MaterialEditor -{ - /// Observes material changes - class CMaterialObserver - { - public: - CMaterialObserver(){} - virtual ~CMaterialObserver(){} - - virtual void onNewMaterial() = 0; - virtual void onMaterialLoaded() = 0; - - virtual void onPassAdded( const char *name ) = 0; - virtual void onPassRemoved( const char *name ) = 0; - virtual void onPassMovedUp( const char *name ) = 0; - virtual void onPassMovedDown( const char *name ) = 0; - virtual void onPassRenamed( const char *from, const char *to ) = 0; - }; - -} - - -#endif - diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_properties.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_properties.cpp deleted file mode 100644 index b353ea9ec..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_properties.cpp +++ /dev/null @@ -1,274 +0,0 @@ -// Object Viewer Qt Material Editor plugin -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -#include "material_properties.h" -#include "material_property_editor.h" -#include "nel3d_interface.h" - -#include - -namespace MaterialEditor -{ - - MatPropWidget::MatPropWidget( QWidget *parent ) : - QDialog( parent ) - { - setupUi( this ); - matPropEditWidget = new MatPropEditWidget(); - setupConnections(); - edit = false; - changed = false; - proxy = NULL; - } - - MatPropWidget::~MatPropWidget() - { - clear(); - - delete matPropEditWidget; - matPropEditWidget = NULL; - } - - void MatPropWidget::load( CRenderPassProxy *proxy ) - { - clear(); - changed = false; - this->proxy = new CRenderPassProxy( *proxy ); - - std::string n; - proxy->getName( n ); - nameEdit->setText( n.c_str() ); - - std::vector< SMatProp > v; - proxy->getProperties( v ); - - std::vector< SMatProp >::iterator itr = v.begin(); - while( itr != v.end() ) - { - SMatProp &mp = *itr; - QTreeWidgetItem *item = new QTreeWidgetItem(); - - item->setData( 0, Qt::DisplayRole, QString( mp.id.c_str() ) ); - item->setData( 1, Qt::DisplayRole, QString( mp.label.c_str() ) ); - - QString type = SMatProp::typeIdToString( mp.type ).c_str(); - item->setData( 2, Qt::DisplayRole, type ); - - item->setData( 3, Qt::DisplayRole, mp.value.c_str() ); - - treeWidget->addTopLevelItem( item ); - - ++itr; - } - } - - void MatPropWidget::clear() - { - treeWidget->clear(); - nameEdit->clear(); - if( this->proxy != NULL ) - { - delete this->proxy; - this->proxy = NULL; - } - } - - void MatPropWidget::onOKClicked() - { - if( proxy != NULL ) - { - std::vector< SMatProp > v; - SMatProp p; - QTreeWidgetItem *item = NULL; - std::string s; - - for( int i = 0; i < treeWidget->topLevelItemCount(); i++ ) - { - item = treeWidget->topLevelItem( i ); - p.id = item->text( 0 ).toUtf8().data(); - p.label = item->text( 1 ).toUtf8().data(); - - s = item->text( 2 ).toUtf8().data(); - p.type = SMatProp::typeStringToId( s ); - - p.value = item->text( 3 ).toUtf8().data(); - - v.push_back( p ); - } - - proxy->setProperties( v ); - } - - clear(); - setResult( QDialog::Accepted ); - close(); - } - - void MatPropWidget::onCancelClicked() - { - clear(); - setResult( QDialog::Rejected ); - close(); - } - - void MatPropWidget::onAddClicked() - { - edit = false; - changed = true; - matPropEditWidget->clear(); - matPropEditWidget->show(); - } - - void MatPropWidget::onEditClicked() - { - QTreeWidgetItem *item = treeWidget->currentItem(); - if( item == NULL ) - return; - - MaterialProperty prop; - prop.prop = item->data( 0, Qt::DisplayRole ).toString(); - prop.label = item->data( 1, Qt::DisplayRole ).toString(); - prop.type = item->data( 2, Qt::DisplayRole ).toString(); - - edit = true; - matPropEditWidget->setProperty( prop ); - matPropEditWidget->show(); - } - - void MatPropWidget::onRemoveClicked() - { - QTreeWidgetItem *item = treeWidget->currentItem(); - if( item == NULL ) - return; - - delete item; - changed = true; - } - - void MatPropWidget::onEditorOKClicked() - { - MaterialProperty prop; - matPropEditWidget->getProperty( prop ); - - if( edit ) - { - QTreeWidgetItem *item = treeWidget->currentItem(); - - MaterialProperty old; - old.prop = item->text( 0 ); - old.label = item->text( 1 ); - old.type = item->text( 2 ); - - if( old == prop ) - return; - - - if( idExists( prop.prop ) ) - { - QMessageBox::critical( - this, - tr( "Property Id" ), - tr( "A property with that Id already exists" ) - ); - - return; - } - - if( labelExists( prop.label ) ) - { - QMessageBox::critical( - this, - tr( "Property label" ), - tr( "A property with that label already exists" ) - ); - return; - } - - - item->setData( 0, Qt::DisplayRole, prop.prop ); - item->setData( 1, Qt::DisplayRole, prop.label ); - item->setData( 2, Qt::DisplayRole, prop.type ); - } - else - { - - if( idExists( prop.prop ) ) - { - QMessageBox::critical( - this, - tr( "Property Id" ), - tr( "A property with that Id already exists" ) - ); - - return; - } - - if( labelExists( prop.label ) ) - { - QMessageBox::critical( - this, - tr( "Property label" ), - tr( "A property with that label already exists" ) - ); - return; - } - - QTreeWidgetItem *item = new QTreeWidgetItem(); - item->setData( 0, Qt::DisplayRole, prop.prop ); - item->setData( 1, Qt::DisplayRole, prop.label ); - item->setData( 2, Qt::DisplayRole, prop.type ); - treeWidget->addTopLevelItem( item ); - } - changed = true; - - } - - void MatPropWidget::setupConnections() - { - connect( okButton, SIGNAL( clicked( bool ) ), this, SLOT( onOKClicked() ) ); - connect( cancelButton, SIGNAL( clicked( bool ) ), this, SLOT( onCancelClicked() ) ); - connect( addButton, SIGNAL( clicked( bool ) ), this, SLOT( onAddClicked() ) ); - connect( editButton, SIGNAL( clicked( bool ) ), this, SLOT( onEditClicked() ) ); - connect( removeButton, SIGNAL( clicked( bool ) ), this, SLOT( onRemoveClicked() ) ); - connect( matPropEditWidget, SIGNAL( okClicked() ), this, SLOT( onEditorOKClicked() ) ); - } - - bool MatPropWidget::idExists( const QString &id ) - { - int c = treeWidget->topLevelItemCount(); - for( int i = 0; i < c; i++ ) - { - if( id == treeWidget->topLevelItem( i )->text( 0 ) ) - return true; - } - - return false; - } - - bool MatPropWidget::labelExists( const QString &label ) - { - int c = treeWidget->topLevelItemCount(); - for( int i = 0; i < c; i++ ) - { - if( label == treeWidget->topLevelItem( i )->text( 1 ) ) - return true; - } - - return false; - } - -} - diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_properties.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_properties.h deleted file mode 100644 index d80c5acbd..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_properties.h +++ /dev/null @@ -1,60 +0,0 @@ -// Object Viewer Qt Material Editor plugin -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -#ifndef MATERIAL_PROPERTIES_H -#define MATERIAL_PROPERTIES_H - -#include "ui_material_properties.h" - -namespace MaterialEditor -{ - - class MatPropEditWidget; - class CRenderPassProxy; - - class MatPropWidget : public QDialog, public Ui::MatPropWidget - { - Q_OBJECT - public: - MatPropWidget( QWidget *parent = NULL ); - ~MatPropWidget(); - void load( CRenderPassProxy *proxy ); - void clear(); - bool getChanged() const{ return changed; } - - private Q_SLOTS: - void onOKClicked(); - void onCancelClicked(); - void onAddClicked(); - void onEditClicked(); - void onRemoveClicked(); - void onEditorOKClicked(); - - private: - void setupConnections(); - bool idExists( const QString &id ); - bool labelExists( const QString &id ); - - - bool edit; - bool changed; - MatPropEditWidget *matPropEditWidget; - CRenderPassProxy *proxy; - }; - -} - -#endif diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_properties.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_properties.ui deleted file mode 100644 index 6bdbe616c..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_properties.ui +++ /dev/null @@ -1,183 +0,0 @@ - - - MatPropWidget - - - Qt::ApplicationModal - - - - 0 - 0 - 685 - 441 - - - - Rendering pass properties - - - - - - - - Pass name - - - - - - - true - - - - - - - - - - 0 - 0 - - - - Pass properties - - - - - - - - - Property - - - - - Label - - - - - Type - - - - - - - - - - - - - 0 - 0 - - - - Add - - - - - - - - 0 - 0 - - - - Remove - - - - - - - - 0 - 0 - - - - Edit - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - - - - - - 0 - 0 - - - - OK - - - - - - - - 0 - 0 - - - - Cancel - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_property_editor.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_property_editor.cpp deleted file mode 100644 index c3220db75..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_property_editor.cpp +++ /dev/null @@ -1,73 +0,0 @@ -// Object Viewer Qt Material Editor plugin -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -#include "material_property_editor.h" - -namespace MaterialEditor -{ - MatPropEditWidget::MatPropEditWidget( QWidget *parent ) : - QWidget( parent ) - { - setupUi( this ); - setupConnections(); - } - - MatPropEditWidget::~MatPropEditWidget() - { - } - - void MatPropEditWidget::getProperty( MaterialProperty &prop ) - { - prop.prop = propertyEdit->text(); - prop.label = labelEdit->text(); - prop.type = typeCB->currentText(); - } - - void MatPropEditWidget::setProperty( const MaterialProperty &prop ) - { - propertyEdit->setText( prop.prop ); - labelEdit->setText( prop.label ); - int i = typeCB->findText( prop.type ); - if( i != -1 ) - typeCB->setCurrentIndex( i ); - - } - - void MatPropEditWidget::clear() - { - propertyEdit->clear(); - labelEdit->clear(); - typeCB->setCurrentIndex( 0 ); - } - - void MatPropEditWidget::onOKClicked() - { - close(); - Q_EMIT okClicked(); - } - - void MatPropEditWidget::onCancelClicked() - { - close(); - } - - void MatPropEditWidget::setupConnections() - { - connect( okButton, SIGNAL( clicked( bool ) ), this, SLOT( onOKClicked() ) ); - connect( cancelButton, SIGNAL( clicked( bool ) ), this, SLOT( onCancelClicked() ) ); - } -} - diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_property_editor.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_property_editor.h deleted file mode 100644 index 7fc23e993..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_property_editor.h +++ /dev/null @@ -1,70 +0,0 @@ -// Object Viewer Qt Material Editor plugin -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -#ifndef MATERIAL_PROPERTY_EDITOR_H -#define MATERIAL_PROPERTY_EDITOR_H - -#include "ui_material_property_editor.h" - -namespace MaterialEditor -{ - - struct MaterialProperty - { - QString prop; - QString label; - QString type; - - bool operator==( const MaterialProperty &o ) - { - if( o.prop != prop ) - return false; - - if( o.label != label ) - return false; - - if( o.type != type ) - return false; - - return true; - } - }; - - class MatPropEditWidget : public QWidget, public Ui::MatPropEditWidget - { - Q_OBJECT - public: - MatPropEditWidget( QWidget *parent = NULL ); - ~MatPropEditWidget(); - void getProperty( MaterialProperty &prop ); - void setProperty( const MaterialProperty &prop ); - void clear(); - - Q_SIGNALS: - void okClicked(); - - private Q_SLOTS: - void onOKClicked(); - void onCancelClicked(); - - private: - void setupConnections(); - - }; -} - -#endif - diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_property_editor.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_property_editor.ui deleted file mode 100644 index 2799eee3b..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_property_editor.ui +++ /dev/null @@ -1,140 +0,0 @@ - - - MatPropEditWidget - - - Qt::ApplicationModal - - - - 0 - 0 - 300 - 145 - - - - Material property editor - - - - - - Property - - - - - - - - - - Label - - - - - - - - - - Type - - - - - - - - 0 - 0 - - - - - Color - - - - - Vector4 - - - - - Float - - - - - Int - - - - - UInt - - - - - Double - - - - - Matrix4 - - - - - Texture - - - - - - - - - 0 - 0 - - - - OK - - - - - - - - 0 - 0 - - - - Cancel - - - - - - - Qt::Horizontal - - - - 117 - 20 - - - - - - - - - diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_splitter.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_splitter.cpp deleted file mode 100644 index 566386c45..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_splitter.cpp +++ /dev/null @@ -1,141 +0,0 @@ -// Object Viewer Qt Material Editor plugin -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - - -#include "material_splitter.h" -#include "nel3d_interface.h" -#include "material_widget.h" -#include "prop_browser_ctrl.h" -#include "3rdparty/qtpropertybrowser/qttreepropertybrowser.h" - -namespace MaterialEditor -{ - MaterialSplitter::MaterialSplitter( QWidget *parent ) : - QSplitter( parent ) - { - materialWidget = new MaterialWidget(); - browserCtrl = new CPropBrowserCtrl(); - browser = new QtTreePropertyBrowser(); - browserCtrl->setBrowser( browser ); - - setup(); - setupConnections(); - } - - MaterialSplitter::~MaterialSplitter() - { - delete browserCtrl; - browserCtrl = NULL; - nl3dIface = NULL; - materialWidget = NULL; - browser = NULL; - } - - void MaterialSplitter::setupConnections() - { - connect( materialWidget, SIGNAL( propsChanged() ), this, SLOT( onPropsChanged() ) ); - connect( materialWidget, SIGNAL( passChanged( const QString& ) ), this, SLOT( onPassChanged( const QString& ) ) ); - connect( materialWidget, SIGNAL( subMatChanged( int ) ), this, SLOT( onSubMatChanged( int ) ) ); - } - - void MaterialSplitter::setup() - { - setOrientation( Qt::Vertical ); - addWidget( materialWidget ); - addWidget( browser ); - } - - void MaterialSplitter::setNel3DIface( CNel3DInterface *iface ) - { - nl3dIface = iface; - materialWidget->setNel3DIface( iface ); - browserCtrl->setNel3DIface( iface ); - } - - void MaterialSplitter::onNewMaterial() - { - materialWidget->onNewMaterial(); - } - - void MaterialSplitter::onMaterialLoaded() - { - materialWidget->onMaterialLoaded(); - } - - void MaterialSplitter::onSceneCleared() - { - materialWidget->onSceneCleared(); - browserCtrl->onSceneCleared(); - } - - void MaterialSplitter::onShapeChanged() - { - materialWidget->onShapeChanged(); - } - - void MaterialSplitter::onPassAdded( const char *name ) - { - materialWidget->onPassAdded( name ); - } - - void MaterialSplitter::onPassRemoved( const char *name ) - { - materialWidget->onPassRemoved( name ); - } - - void MaterialSplitter::onPassMovedUp( const char *name ) - { - materialWidget->onPassMovedUp( name ); - } - - void MaterialSplitter::onPassMovedDown( const char *name ) - { - materialWidget->onPassMovedDown( name ); - } - - void MaterialSplitter::onPassRenamed( const char *from, const char *to ) - { - materialWidget->onPassRenamed( from, to ); - } - - void MaterialSplitter::onShaderAdded( const QString &name ) - { - materialWidget->onShaderAdded( name ); - } - - void MaterialSplitter::onShaderRemoved( const QString &name ) - { - materialWidget->onShaderRemoved( name ); - } - - void MaterialSplitter::onPropsChanged() - { - QString pass; - materialWidget->getCurrentPass( pass ); - browserCtrl->onPropsChanged(); - } - - void MaterialSplitter::onPassChanged( const QString &pass ) - { - browserCtrl->loadPropsForPass( pass ); - } - - void MaterialSplitter::onSubMatChanged( int i ) - { - browserCtrl->loadPropsForPass( 0 ); - } -} - diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_splitter.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_splitter.h deleted file mode 100644 index a2edc48b2..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_splitter.h +++ /dev/null @@ -1,73 +0,0 @@ -// Object Viewer Qt Material Editor plugin -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - - -#ifndef MATERIAL_SPLITTER_H -#define MATERIAL_SPLITTER_H - -#include -#include "material_observer.h" - -class QtTreePropertyBrowser; - -namespace MaterialEditor -{ - class CNel3DInterface; - class MaterialWidget; - class CPropBrowserCtrl; - - class MaterialSplitter : public QSplitter, public CMaterialObserver - { - Q_OBJECT - public: - MaterialSplitter( QWidget *parent = NULL ); - ~MaterialSplitter(); - - void setupConnections(); - - void setup(); - - void setNel3DIface( CNel3DInterface *iface ); - - void onNewMaterial(); - void onMaterialLoaded(); - void onSceneCleared(); - void onShapeChanged(); - void onPassAdded( const char *name ); - void onPassRemoved( const char *name ); - void onPassMovedUp( const char *name ); - void onPassMovedDown( const char *name ); - void onPassRenamed( const char *from, const char *to ); - - public Q_SLOTS: - void onShaderAdded( const QString &name ); - void onShaderRemoved( const QString &name ); - - private: - CNel3DInterface *nl3dIface; - MaterialWidget *materialWidget; - CPropBrowserCtrl *browserCtrl; - QtTreePropertyBrowser *browser; - - private Q_SLOTS: - void onPropsChanged(); - void onPassChanged( const QString &pass ); - void onSubMatChanged( int i ); - - }; -} - -#endif diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_widget.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_widget.cpp deleted file mode 100644 index fdc1d3c8d..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_widget.cpp +++ /dev/null @@ -1,270 +0,0 @@ -// Object Viewer Qt Material Editor plugin -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -#include "material_widget.h" -#include "shader_editor.h" -#include "material_properties.h" -#include "nel3d_interface.h" - -namespace MaterialEditor -{ - MaterialWidget::MaterialWidget( QWidget *parent ) : - QWidget( parent ) - { - setupUi( this ); - shaderEditorWidget = new ShaderEditorWidget(); - matPropWidget = new MatPropWidget(); - setNel3DIface( NULL ); - setupConnections(); - } - - MaterialWidget::~MaterialWidget() - { - delete shaderEditorWidget; - shaderEditorWidget = NULL; - delete matPropWidget; - matPropWidget = NULL; - } - - void MaterialWidget::onSceneCleared() - { - passCB->clear(); - subMatCB->clear(); - passCB->setEnabled( false ); - subMatCB->setEnabled( false ); - shaderCB->setEnabled( false ); - passButton->setEnabled( false ); - shaderButton->setEnabled( false ); - } - - void MaterialWidget::onNewMaterial() - { - passCB->clear(); - passButton->setEnabled( false ); - } - - void MaterialWidget::onMaterialLoaded() - { - CNelMaterialProxy mat = nl3dIface->getMaterial(); - if( mat.isEmpty() ) - return; - - std::vector< std::string > l; - mat.getPassList( l ); - - passCB->clear(); - - std::vector< std::string >::const_iterator itr = l.begin(); - while( itr != l.end() ) - { - passCB->addItem( itr->c_str() ); - ++itr; - } - - if( passCB->count() > 0 ) - passButton->setEnabled( true ); - } - - void MaterialWidget::onShapeChanged() - { - unsigned long c = nl3dIface->getShapeMatCount(); - subMatCB->clear(); - subMatCB->addItem( "0" ); - - for( unsigned long i = 1; i < c; i++ ) - subMatCB->addItem( QString::number( i ) ); - - passCB->setEnabled( true ); - passButton->setEnabled( true ); - shaderCB->setEnabled( true ); - - subMatCB->setCurrentIndex( 0 ); - - if( subMatCB->count() > 1 ) - subMatCB->setEnabled( true ); - else - subMatCB->setEnabled( false ); - } - - void MaterialWidget::onPassAdded( const char *name ) - { - passCB->addItem( name ); - passButton->setEnabled( true ); - } - - void MaterialWidget::onPassRemoved( const char *name ) - { - int i = passCB->findText( name ); - if( i == -1 ) - return; - - passCB->removeItem( i ); - if( passCB->count() == 0 ) - passButton->setEnabled( false ); - } - - void MaterialWidget::onPassMovedUp( const char *name ) - { - int i = passCB->findText( name ); - if( i == -1 ) - return; - if( i == 0 ) - return; - - QString t = passCB->itemText( i - 1 ); - passCB->setItemText( i - 1, name ); - passCB->setItemText( i, t ); - passCB->setCurrentIndex( i - 1 ); - } - - void MaterialWidget::onPassMovedDown( const char *name ) - { - int i = passCB->findText( name ); - if( i == -1 ) - return; - if( i == ( passCB->count() - 1 ) ) - return; - - QString t = passCB->itemText( i + 1 ); - passCB->setItemText( i + 1, name ); - passCB->setItemText( i, t ); - passCB->setCurrentIndex( i + 1 ); - } - - void MaterialWidget::onPassRenamed( const char *from, const char *to ) - { - int i = passCB->findText( from ); - if( i == -1 ) - return; - passCB->setItemText( i, to ); - } - - void MaterialWidget::onShaderAdded( const QString &name ) - { - shaderCB->addItem( name ); - } - - void MaterialWidget::onShaderRemoved( const QString &name ) - { - int i = shaderCB->findText( name ); - if( i < 0 ) - return; - - shaderCB->removeItem( i ); - } - - void MaterialWidget::setNel3DIface( CNel3DInterface *iface ) - { - nl3dIface = iface; - shaderEditorWidget->setNel3DInterface( iface ); - } - - void MaterialWidget::getCurrentPass( QString &pass ) - { - pass = passCB->currentText(); - } - - void MaterialWidget::setupConnections() - { - connect( passButton, SIGNAL( clicked( bool ) ), this, SLOT( onPassEditClicked() ) ); - connect( shaderButton, SIGNAL( clicked( bool ) ), this, SLOT( onShaderEditClicked() ) ); - connect( subMatCB, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onSubMatCBChanged( int ) ) ); - connect( passCB, SIGNAL( currentIndexChanged( const QString& ) ), this, SLOT( onPassCBChanged( const QString& ) ) ); - connect( shaderCB, SIGNAL( currentIndexChanged( const QString& ) ), this, SLOT( onShaderCBChanged( const QString& ) ) ); - - connect( shaderEditorWidget, SIGNAL( okClicked() ), this, SLOT( onShaderEditOKClicked() ) ); - } - - void MaterialWidget::onPassEditClicked() - { - if( passCB->count() == 0 ) - return; - - CNelMaterialProxy m = nl3dIface->getMaterial(); - if( m.isEmpty() ) - return; - - CRenderPassProxy p = m.getPass( passCB->currentText().toUtf8().data() ); - matPropWidget->load( &p ); - matPropWidget->exec(); - if( matPropWidget->getChanged() ) - Q_EMIT propsChanged(); - } - - void MaterialWidget::onShaderEditClicked() - { - if( shaderCB->currentIndex() == 0 ) - return; - if( !shaderEditorWidget->load( shaderCB->currentText() ) ) - return; - - int result = shaderEditorWidget->exec(); - } - - void MaterialWidget::onSubMatCBChanged( int i ) - { - // Update the material to the current submaterial - bool ok = nl3dIface->selectSubMaterial( i ); - if( !ok ) - { - subMatCB->setCurrentIndex( 0 ); - return; - } - - onMaterialLoaded(); - Q_EMIT subMatChanged( i ); - } - - void MaterialWidget::onPassCBChanged( const QString &text ) - { - if( text.isEmpty() ) - return; - - CNelMaterialProxy m = nl3dIface->getMaterial(); - if( m.isEmpty() ) - return; - - CRenderPassProxy pass = m.getPass( text.toUtf8().data() ); - std::string s; - pass.getShaderRef( s ); - - int i = shaderCB->findText( s.c_str() ); - if( i > 0 ) - shaderCB->setCurrentIndex( i ); - else - shaderCB->setCurrentIndex( 0 ); - - Q_EMIT passChanged( text ); - } - - void MaterialWidget::onShaderCBChanged( const QString &text ) - { - QString p = passCB->currentText(); - - CNelMaterialProxy m = nl3dIface->getMaterial(); - if( m.isEmpty() ) - return; - - CRenderPassProxy pass = m.getPass( p.toUtf8().data() ); - pass.setShaderRef( text.toUtf8().data() ); - - if( !text.isEmpty() ) - shaderButton->setEnabled( true ); - else - shaderButton->setEnabled( false ); - } -} - diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_widget.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_widget.h deleted file mode 100644 index fd4464bd5..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_widget.h +++ /dev/null @@ -1,76 +0,0 @@ -// Object Viewer Qt Material Editor plugin -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -#ifndef MATERIAL_WIDGET_H -#define MATERIAL_WIDGET_H - -#include "ui_material_widget.h" -#include "material_observer.h" - -namespace MaterialEditor -{ - class ShaderEditorWidget; - class MatPropWidget; - class CNel3DInterface; - - class MaterialWidget : public QWidget, public Ui::MaterialWidget, public CMaterialObserver - { - Q_OBJECT - public: - MaterialWidget( QWidget *parent = NULL ); - ~MaterialWidget(); - - void onSceneCleared(); - void onNewMaterial(); - void onMaterialLoaded(); - void onShapeChanged(); - - void onPassAdded( const char *name ); - void onPassRemoved( const char *name ); - void onPassMovedUp( const char *name ); - void onPassMovedDown( const char *name ); - void onPassRenamed( const char *from, const char *to ); - - void onShaderAdded( const QString &name ); - void onShaderRemoved( const QString &name ); - - void setNel3DIface( CNel3DInterface *iface ); - - void getCurrentPass( QString &pass ); - - Q_SIGNALS: - void propsChanged(); - void passChanged( const QString &pass ); - void subMatChanged( int i ); - - private: - void setupConnections(); - ShaderEditorWidget *shaderEditorWidget; - MatPropWidget *matPropWidget; - CNel3DInterface *nl3dIface; - - private Q_SLOTS: - void onPassEditClicked(); - void onShaderEditClicked(); - void onSubMatCBChanged( int i ); - void onPassCBChanged( const QString &text ); - void onShaderCBChanged( const QString &text ); - - }; - -} - -#endif diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_widget.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_widget.ui deleted file mode 100644 index a87614b23..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_widget.ui +++ /dev/null @@ -1,126 +0,0 @@ - - - MaterialWidget - - - - 0 - 0 - 255 - 179 - - - - Material - - - - - - Sub-material - - - - - - - false - - - - 0 - - - - - - - - Pass - - - - - - - - - false - - - - - - - false - - - - 0 - 0 - - - - Edit - - - - - - - - - Shader - - - - - - - - - false - - - - - - - - - - - - false - - - - 0 - 0 - - - - Edit - - - - - - - - - Qt::Vertical - - - - 20 - 18 - - - - - - - - - diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/nel3d_interface.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/nel3d_interface.cpp deleted file mode 100644 index 73eb6477b..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/nel3d_interface.cpp +++ /dev/null @@ -1,743 +0,0 @@ -// Object Viewer Qt Material Editor plugin -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -#include "nel3d_interface.h" -#include "nel/3d/dynamic_material.h" -#include "nel/3d/usr_shader_manager.h" -#include "nel/3d/usr_shader_program.h" -#include "nel/3d/usr_shader_loader.h" -#include "nel/3d/usr_shader_saver.h" -#include "nel/3d/driver_user.h" -#include "nel/3d/scene_user.h" -#include "nel/3d/u_camera.h" -#include "nel/3d/u_instance.h" -#include "nel/3d/u_light.h" -#include "nel/3d/u_3d_mouse_listener.h" -#include "nel/misc/i_xml.h" -#include "nel/misc/o_xml.h" -#include "nel/misc/file.h" -#include "nel/misc/path.h" - -namespace MaterialEditor -{ - - NL3D::UInstance currentShape; - - const char *SMatProp::idToString[] = - { - "Color", - "Vector4", - "Float", - "Double", - "Int", - "Uint", - "Matrix4", - "Texture" - }; - - const NLMISC::CVariant::EVarType evartypes[] = - { - NLMISC::CVariant::Vector4, - NLMISC::CVariant::Vector4, - NLMISC::CVariant::Float, - NLMISC::CVariant::Double, - NLMISC::CVariant::Int, - NLMISC::CVariant::UInt, - NLMISC::CVariant::Matrix4, - NLMISC::CVariant::String - }; - - NLMISC::CVariant::EVarType toEVarType( uint8 t ) - { - NLMISC::CVariant::EVarType rt = NLMISC::CVariant::Float; - - unsigned long s = sizeof( evartypes ) / sizeof( NLMISC::CVariant::EVarType ); - - if( t >= s ) - return rt; - else - rt = evartypes[ t ]; - - return rt; - - } - - std::string SMatProp::typeIdToString( unsigned char id ) - { - if( id >= EType_count ) - return std::string(); - else - return std::string( idToString[ id ] ); - } - - unsigned char SMatProp::typeStringToId( const std::string &s ) - { - for( unsigned char i = 0; i < EType_count; i++ ) - if( s == idToString[ i ] ) - return i; - return 0; - } - - void CRenderPassProxy::getProperties( std::vector< SMatProp > &v ) - { - uint32 count = pass->count(); - for( uint32 i = 0; i < count; i++ ) - { - const NL3D::SDynMaterialProp &p = *( pass->getProperty( i ) ); - - SMatProp prop; - prop.id = p.prop; - prop.label = p.label; - prop.type = p.type; - p.value.valueAsString( prop.value ); - - v.push_back( prop ); - } - } - - void CRenderPassProxy::setProperties( std::vector< SMatProp > &v ) - { - pass->clear(); - NL3D::SDynMaterialProp p; - - std::vector< SMatProp >::iterator itr = v.begin(); - while( itr != v.end() ) - { - p.prop = itr->id; - p.label = itr->label; - p.type = itr->type; - p.value.fromString( itr->value, toEVarType( p.type ) ); - - pass->addProperty( p ); - - ++itr; - } - } - - void CRenderPassProxy::getName( std::string &name ) - { - pass->getName( name ); - } - - void CRenderPassProxy::setName( const std::string &name ) - { - pass->setName( name ); - } - - void CRenderPassProxy::getShaderRef( std::string &s ) - { - pass->getShaderRef( s ); - } - - void CRenderPassProxy::setShaderRef( const std::string &s ) - { - pass->setShaderRef( s ); - } - - bool CRenderPassProxy::getProperty( const std::string &name, SMatProp &p ) - { - uint32 count = pass->count(); - uint32 i = 0; - - for( i = 0; i < count; i++ ) - { - if( pass->getProperty( i )->prop == name ) - break; - } - - if( i == count ) - return false; - - const NL3D::SDynMaterialProp *prop = pass->getProperty( i ); - p.id = prop->prop; - p.label = prop->label; - p.type = prop->type; - prop->value.valueAsString( p.value ); - - return true; - } - - bool CRenderPassProxy::changeProperty( const SMatProp &p ) - { - NL3D::SDynMaterialProp prop; - prop.prop = p.id; - prop.label = p.label; - prop.type = p.type; - prop.value.fromString( p.value, toEVarType( prop.type ) ); - - return pass->changeProperty( prop.prop, prop ); - } - - void CNelMaterialProxy::getPassList( std::vector< std::string > &l ) - { - material->getPassList( l ); - } - - void CNelMaterialProxy::addPass( const char *name ) - { - NL3D::SRenderPass pass; - pass.setName( name ); - material->addPass( pass ); - } - - void CNelMaterialProxy::removePass( const char *name ) - { - material->removePass( name ); - } - - void CNelMaterialProxy::movePassUp( const char *name ) - { - material->movePassUp( name ); - } - - void CNelMaterialProxy::movePassDown( const char *name ) - { - material->movePassDown( name ); - } - - void CNelMaterialProxy::renamePass( const char *from, const char *to ) - { - material->renamePass( from, to ); - } - - CRenderPassProxy CNelMaterialProxy::getPass( unsigned long i ) - { - if( i >= material->getPassCount() ) - return CRenderPassProxy( NULL ); - else - return CRenderPassProxy( material->getPass( i ) ); - } - - CRenderPassProxy CNelMaterialProxy::getPass( const char *name ) - { - return CRenderPassProxy( material->getPass( name ) ); - } - - - CNel3DInterface::CNel3DInterface() - { - shaderManager = new NL3D::CUsrShaderManager(); - driver = NULL; - scene = NULL; - mouseListener = NULL; - subMatId = 0; - std::fill( bgColor, bgColor + 4, 255 ); - } - - CNel3DInterface::~CNel3DInterface() - { - delete shaderManager; - shaderManager = NULL; - killViewPort(); - } - - bool CNel3DInterface::loadMaterial( const char *fname ) - { - if( currentShape.empty() ) - return false; - - NLMISC::CIFile file; - if( !file.open( fname, true ) ) - return false; - - NLMISC::CIXml xml; - if( !xml.init( file ) ) - return false; - - NL3D::CDynMaterial *mat = currentShape.getMaterial( subMatId ).getObjectPtr()->getDynMat(); - if( mat != NULL ) - mat->clear(); - else - { - currentShape.getMaterial( subMatId ).getObjectPtr()->createCleanDynMat(); - mat = currentShape.getMaterial( subMatId ).getObjectPtr()->getDynMat(); - } - - mat->serial( xml ); - file.close(); - - return true; - } - - bool CNel3DInterface::saveMaterial( const char *fname ) - { - if( currentShape.empty() ) - return false; - - NLMISC::COFile file; - if( !file.open( fname, false, true ) ) - return false; - - NLMISC::COXml xml; - if( !xml.init( &file ) ) - return false; - - currentShape.getMaterial( subMatId ).getObjectPtr()->getDynMat()->serial( xml ); - - xml.flush(); - file.close(); - - return true; - } - - void CNel3DInterface::genMaterials() - { - int c = currentShape.getNumMaterials(); - for( int i = 0; i < c; i++ ) - currentShape.getMaterial( i ).getObjectPtr()->createDynMat(); - } - - void CNel3DInterface::newMaterial() - { - if( currentShape.empty() ) - return; - - for( int i = 0; i < currentShape.getNumMaterials(); i++ ) - currentShape.getMaterial( i ).getObjectPtr()->createCleanDynMat(); - } - - bool CNel3DInterface::selectSubMaterial( int id ) - { - if( currentShape.empty() ) - return false; - - if( currentShape.getNumMaterials() < id ) - return false; - - subMatId = id; - - return true; - } - - CNelMaterialProxy CNel3DInterface::getMaterial() - { - NL3D::CDynMaterial *mat = NULL; - if( !currentShape.empty() && ( currentShape.getNumMaterials() > 0 ) ) - mat = currentShape.getMaterial( subMatId ).getObjectPtr()->getDynMat(); - - return CNelMaterialProxy( mat ); - } - - void CNel3DInterface::getShaderList( std::vector< std::string > &v ) - { - shaderManager->getShaderList( v ); - } - - bool CNel3DInterface::getShaderInfo( const std::string &name, SShaderInfo &info ) - { - NL3D::CUsrShaderProgram program; - bool ok = shaderManager->getShader( name, &program ); - if( !ok ) - return false; - - std::string s; - info.name = name; - - program.getDescription( s ); - info.description = s; - - program.getVP( s ); - info.vp = s; - - program.getFP( s ); - info.fp = s; - - return true; - } - - bool CNel3DInterface::updateShaderInfo( const SShaderInfo &info ) - { - NL3D::CUsrShaderProgram program; - program.setName( info.name ); - program.setDescription( info.description ); - program.setVP( info.vp ); - program.setFP( info.fp ); - - return shaderManager->changeShader( info.name, &program ); - } - - bool CNel3DInterface::addShader( const SShaderInfo &info ) - { - NL3D::CUsrShaderProgram *program = new NL3D::CUsrShaderProgram(); - - program->setName( info.name ); - program->setDescription( info.description ); - program->setVP( info.vp ); - program->setFP( info.fp ); - - bool ok = shaderManager->addShader( program ); - if( !ok ) - { - delete program; - return false; - } - - return true; - } - - bool CNel3DInterface::removeShader( const std::string &name ) - { - return shaderManager->removeShader( name ); - } - - void CNel3DInterface::loadShaders() - { - NL3D::CUsrShaderLoader loader; - loader.setManager( shaderManager ); - loader.loadShaders( "./shaders" ); - } - - void CNel3DInterface::saveShader( const std::string &name ) - { - NL3D::CUsrShaderSaver saver; - saver.setManager( shaderManager ); - saver.saveShader( "./shaders", name ); - NL3D::CDriverUser *d = dynamic_cast< NL3D::CDriverUser* >( driver ); - if( d != NULL ) - d->getDriver()->reloadUserShaders(); - } - - void CNel3DInterface::deleteShader( const std::string &name ) - { - NLMISC::CFile::deleteFile( "./shaders/" + name + ".nlshdr" ); - } - - void CNel3DInterface::initViewPort( unsigned long wnd, unsigned long w, unsigned long h ) - { - //driver = NL3D::UDriver::createDriver( 0, false, 0 ); - driver = NL3D::UDriver::createDriver( 0, NL3D::UDriver::OpenGl3, 0 ); - nlassert( driver != NULL ); - driver->setDisplay( (nlWindow)wnd, NL3D::UDriver::CMode( w, h, 32 ) ); - - scene = driver->createScene( true ); - - - driver->enableFog( true ); - driver->setupFog( 5.0f, 15.0f, NLMISC::CRGBA::White ); - - - NL3D::ULight *ld; - - /* - // Let's add a directional light! - ld = NL3D::ULight::createLight(); - ld->setMode( NL3D::ULight::DirectionalLight ); - ld->setDirection( NLMISC::CVector( -100.0f, 100.0f, 100.0f ) ); - ld->setAmbiant( NLMISC::CRGBA::CRGBA( 0.1f, 0.1f, 0.1f, 0.1f ) ); - ld->setSpecular( NLMISC::CRGBA::White ); - ld->setDiffuse( NLMISC::CRGBA::White ); - driver->setLight( 0, *ld ); - driver->enableLight( 0, true ); - delete ld; - */ - - // Let's add a point light as well! - ld = NL3D::ULight::createLight(); - ld->setMode( NL3D::ULight::PointLight ); - ld->setPosition( NLMISC::CVector( 0.0f, 0.0f, 0.0f ) ); - ld->setAmbiant( NLMISC::CRGBA::CRGBA( 0.1f, 0.1f, 0.1f, 0.1f ) ); - ld->setSpecular( NLMISC::CRGBA::White ); - ld->setDiffuse( NLMISC::CRGBA::White ); - ld->setConstantAttenuation( 1.0f ); - ld->setLinearAttenuation( 0.0f ); - ld->setQuadraticAttenuation( 0.0f ); - driver->setLight( 0, *ld ); - driver->enableLight( 0, true ); - delete ld; - ld = NULL; - - scene->enableLightingSystem( false ); - - - mouseListener = driver->create3dMouseListener(); - mouseListener->setMouseMode( NL3D::U3dMouseListener::nelStyle ); - } - - void CNel3DInterface::killViewPort() - { - driver->deleteScene( scene ); - scene = NULL; - driver->delete3dMouseListener( mouseListener ); - mouseListener = NULL; - delete driver; - driver = NULL; - } - - void CNel3DInterface::resizeViewPort( unsigned long w, unsigned long h ) - { - if( scene != NULL ) - { - scene->getCam().setPerspective( 90.0f, w / (float)h, 0.1f, 1000.0f ); - } - } - - bool CNel3DInterface::addCube() - { - return loadShape( "primitives/cube.shape" ); - } - - bool CNel3DInterface::addSphere() - { - return loadShape( "primitives/sphere.shape" ); - } - - bool CNel3DInterface::addCylinder() - { - return loadShape( "primitives/cylinder.shape" ); - } - - bool CNel3DInterface::addTeaPot() - { - return loadShape( "primitives/teapot.shape" ); - } - - bool CNel3DInterface::loadShape( const std::string &fileName ) - { - NLMISC::CPath::addSearchPath( NLMISC::CFile::getPath( fileName ), false, false ); - NL3D::UInstance instance = scene->createInstance( fileName ); - if( instance.empty() ) - return false; - - clearScene(); - currentShape = instance; - - subMatId = 0; - - setupCamera(); - - return true; - } - - void CNel3DInterface::clearScene() - { - if( scene != NULL ) - { - if( currentShape.empty() ) - return; - scene->deleteInstance( currentShape ); - currentShape = NL3D::UInstance(); - subMatId = 0; - } - - if( driver == NULL ) - return; - - NLMISC::CRGBA c; - c.R = bgColor[ 0 ]; - c.G = bgColor[ 1 ]; - c.B = bgColor[ 2 ]; - c.A = bgColor[ 3 ]; - - driver->clearBuffers( c ); - driver->swapBuffers(); - } - - void CNel3DInterface::updateInput() - { - driver->EventServer.pump(); - } - - void CNel3DInterface::renderScene() - { - if( scene != NULL ) - { - scene->getCam().setTransformMode( NL3D::UTransformable::DirectMatrix ); - scene->getCam().setMatrix( mouseListener->getViewMatrix() ); - - NLMISC::CRGBA c; - c.R = bgColor[ 0 ]; - c.G = bgColor[ 1 ]; - c.B = bgColor[ 2 ]; - c.A = bgColor[ 3 ]; - - driver->clearBuffers( c ); - scene->render(); - driver->swapBuffers(); - } - } - - unsigned long CNel3DInterface::getShapeMatCount() const - { - if( currentShape.empty() ) - return 0; - - return currentShape.getNumMaterials(); - } - - void CNel3DInterface::getFogSettings( SFogSettings &s ) - { - s.enable = driver->fogEnabled(); - s.start = driver->getFogStart(); - s.end = driver->getFogEnd(); - - NLMISC::CRGBA c = driver->getFogColor(); - s.color[ 0 ] = c.R; - s.color[ 1 ] = c.G; - s.color[ 2 ] = c.B; - s.color[ 3 ] = c.A; - } - - void CNel3DInterface::setFogSettings( const SFogSettings &s ) - { - driver->enableFog( s.enable ); - NLMISC::CRGBA c; - c.R = s.color[ 0 ]; - c.G = s.color[ 1 ]; - c.B = s.color[ 2 ]; - c.A = 255; - driver->setupFog( s.start, s.end, c ); - setBGColor( c.R, c.G, c.B, c.A ); - } - - unsigned char CNel3DInterface::getMaxLights() const - { - return driver->getMaxDriverLights(); - } - - void CNel3DInterface::getLightInfo( unsigned char light, SLightInfo &info ) - { - info.enabled = driver->isLightEnabled( light ); - - NL3D::ULight *u = driver->getLight( light ); - info.ambColor[ 0 ] = u->getAmbiant().R / 255.0f; - info.ambColor[ 1 ] = u->getAmbiant().G / 255.0f; - info.ambColor[ 2 ] = u->getAmbiant().B / 255.0f; - info.ambColor[ 3 ] = u->getAmbiant().A / 255.0f; - - info.diffColor[ 0 ] = u->getDiffuse().R / 255.0f; - info.diffColor[ 1 ] = u->getDiffuse().G / 255.0f; - info.diffColor[ 2 ] = u->getDiffuse().B / 255.0f; - info.diffColor[ 3 ] = u->getDiffuse().A / 255.0f; - - info.specColor[ 0 ] = u->getSpecular().R / 255.0f; - info.specColor[ 1 ] = u->getSpecular().G / 255.0f; - info.specColor[ 2 ] = u->getSpecular().B / 255.0f; - info.specColor[ 3 ] = u->getSpecular().A / 255.0f; - - info.constAttn = u->getConstantAttenuation(); - info.linAttn = u->getLinearAttenuation(); - info.quadAttn = u->getQuadraticAttenuation(); - - switch( u->getMode() ) - { - case NL3D::ULight::DirectionalLight: - info.type = SLightInfo::Directional; - break; - - case NL3D::ULight::PointLight: - info.type = SLightInfo::Point; - break; - - case NL3D::ULight::SpotLight: - info.type = SLightInfo::Spot; - break; - } - - if( info.type == SLightInfo::Directional ) - { - info.posOrDir[ 0 ] = u->getDirection().x; - info.posOrDir[ 1 ] = u->getDirection().y; - info.posOrDir[ 2 ] = u->getDirection().z; - } - else - { - info.posOrDir[ 0 ] = u->getPosition().x; - info.posOrDir[ 1 ] = u->getPosition().y; - info.posOrDir[ 2 ] = u->getPosition().z; - } - - delete u; - } - - void CNel3DInterface::setLightInfo( unsigned char light, const SLightInfo &info ) - { - NL3D::ULight *u = NL3D::ULight::createLight(); - - NLMISC::CRGBA c; - c.R = info.ambColor[ 0 ] * 255.0f; - c.G = info.ambColor[ 1 ] * 255.0f; - c.B = info.ambColor[ 2 ] * 255.0f; - c.A = 255; - u->setAmbiant( c ); - - c.R = info.diffColor[ 0 ] * 255.0f; - c.G = info.diffColor[ 1 ] * 255.0f; - c.B = info.diffColor[ 2 ] * 255.0f; - u->setDiffuse( c ); - - c.R = info.specColor[ 0 ] * 255.0f; - c.G = info.specColor[ 1 ] * 255.0f; - c.B = info.specColor[ 2 ] * 255.0f; - u->setSpecular( c ); - - switch( info.type ) - { - case SLightInfo::Directional: - u->setMode( NL3D::ULight::DirectionalLight ); - break; - case SLightInfo::Point: - u->setMode( NL3D::ULight::PointLight ); - break; - case SLightInfo::Spot: - u->setMode( NL3D::ULight::SpotLight ); - break; - } - - if( info.type == SLightInfo::Directional ) - u->setDirection( NLMISC::CVector( info.posOrDir[ 0 ], info.posOrDir[ 1 ], info.posOrDir[ 2 ] ) ); - else - u->setPosition( NLMISC::CVector( info.posOrDir[ 0 ], info.posOrDir[ 1 ], info.posOrDir[ 2 ] ) ); - - u->setConstantAttenuation( info.constAttn ); - u->setLinearAttenuation( info.linAttn ); - u->setQuadraticAttenuation( info.quadAttn ); - - driver->setLight( light, *u ); - driver->enableLight( light, info.enabled ); - - delete u; - u = NULL; - } - - void CNel3DInterface::setupCamera() - { - NLMISC::CAABBox bbox; - currentShape.getShapeAABBox( bbox ); - - NLMISC::CVector center = bbox.getCenter(); - NLMISC::CQuat q( 0.0f, 0.0f, 0.0f, 0.0f ); - currentShape.getDefaultRotQuat( q ); - - NLMISC::CVector max_radius = bbox.getHalfSize(); - float radius = std::max( max_radius.x, std::max( max_radius.y, max_radius.z ) ); - float distance = radius / tan( 45.0f ); - - NLMISC::CVector axis = q.getAxis(); - if( axis.isNull() || ( axis == NLMISC::CVector::I ) ) - axis = NLMISC::CVector::J; - else - if( axis == -NLMISC::CVector::K ) - axis = -NLMISC::CVector::J; - - NLMISC::CVector eye = center - axis * ( radius + distance ); - scene->getCam().lookAt( eye, center ); - - mouseListener->setHotSpot( center ); - mouseListener->setMatrix( scene->getCam().getMatrix() ); - } - -} - diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/nel3d_interface.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/nel3d_interface.h deleted file mode 100644 index 3f638cbda..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/nel3d_interface.h +++ /dev/null @@ -1,331 +0,0 @@ -// Object Viewer Qt Material Editor plugin -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - - -#ifndef NEL3D_INTERFACE_H -#define NEL3D_INTERFACE_H - -#include -#include - -namespace NL3D -{ - class CDynMaterial; - struct SRenderPass; - class CUsrShaderManager; - class UDriver; - class UScene; - class U3dMouseListener; -} - -namespace MaterialEditor -{ - /// Material Property, holds the user shader parameters as string ( for the editor ) - struct SMatProp - { - enum EType - { - Color, - Vector4, - Float, - Double, - Int, - Uint, - Matrix4, - Texture, - EType_count - }; - - /// Creates a string representation of the type id - static std::string typeIdToString( unsigned char type ); - - /// Turns the type id string back to Id - static unsigned char typeStringToId( const std::string &s ); - - std::string id; - std::string label; - unsigned char type; - std::string value; - - private: - static const char *idToString[]; - }; - - - /// Proxy class for the rendering pass - class CRenderPassProxy - { - public: - CRenderPassProxy( NL3D::SRenderPass *p ) - { - pass = p; - } - - ~CRenderPassProxy(){} - - /// Retrieves the rendering properties as a vector - void getProperties( std::vector< SMatProp > &v ); - - /// Clears the properties and then copies the ones from the vector specified - void setProperties( std::vector< SMatProp > &v ); - - /// Retrieves the name of the pass - void getName( std::string &name ); - - /// Sets the name of the pass - void setName( const std::string &name ); - - /// Returns the reference ( just a string ) to the user shader associated - void getShaderRef( std::string &s ); - - /// Sets the reference ( just a string ) to the user shader associated - void setShaderRef( const std::string &s ); - - /// Retrieves a single rendering property - bool getProperty( const std::string &name, SMatProp &p ); - - /// Changes a single rendering property - bool changeProperty( const SMatProp &p ); - - private: - NL3D::SRenderPass *pass; - }; - - /// Proxy class for the dynamic material - class CNelMaterialProxy - { - public: - CNelMaterialProxy( NL3D::CDynMaterial *mat ) - { - material = mat; - } - - ~CNelMaterialProxy(){} - - /// Retrieves the list of rendering passes - void getPassList( std::vector< std::string > &l ); - - /// Adds a new pass - void addPass( const char *name ); - - /// Removes the specified pass, if exists - void removePass( const char *name ); - - /// Moves the pass up by one position - void movePassUp( const char *name ); - - /// Moves the pass down by one position - void movePassDown( const char *name ); - - /// Renames the specified pass - void renamePass( const char *from, const char *to ); - - /// Retrieves the specified pass, by position - CRenderPassProxy getPass( unsigned long i ); - - /// Retrieves the specified pass, by name - CRenderPassProxy getPass( const char *name ); - - bool isEmpty() const{ - if( material == NULL ) - return true; - else - return false; - } - - private: - NL3D::CDynMaterial *material; - }; - - - struct SShaderInfo - { - std::string name; - std::string description; - std::string vp; - std::string fp; - }; - - struct SFogSettings - { - bool enable; - float start; - float end; - unsigned char color[ 4 ]; - - SFogSettings() - { - enable = false; - start = 0.0f; - end = 0.0f; - color[ 0 ] = 0.0f; - color[ 1 ] = 0.0f; - color[ 2 ] = 0.0f; - color[ 3 ] = 0.0f; - } - - }; - - struct SLightInfo - { - enum LightType - { - Directional, - Point, - Spot - }; - - bool enabled; - unsigned char type; - float posOrDir[ 3 ]; - float ambColor[ 3 ]; - float diffColor[ 3 ]; - float specColor[ 3 ]; - float constAttn; - float linAttn; - float quadAttn; - - SLightInfo() - { - enabled = true; - type = Directional; - posOrDir[ 0 ] = posOrDir[ 1 ] = posOrDir[ 2 ] = 0.0f; - ambColor[ 0 ] = ambColor[ 1 ] = ambColor[ 2 ] = 255; - diffColor[ 0 ] = diffColor[ 1 ] = diffColor[ 2 ] = 255; - specColor[ 0 ] = specColor[ 1 ] = specColor[ 2 ] = 255; - constAttn = 1.0f; - linAttn = quadAttn = 0.0f; - } - - }; - - /// Proxy class for Nel3D, so the material editor and Nel3D can interface - class CNel3DInterface - { - public: - CNel3DInterface(); - ~CNel3DInterface(); - - /// Load a material for the current (sub)object - bool loadMaterial( const char *fname ); - - /// Save the current (sub)object's material - bool saveMaterial( const char *fname ); - - /// Generate materials from the current (sub)object(s) "old" material(s) - void genMaterials(); - - /// Creates new material(s) for the current (sub)object(s) - void newMaterial(); - - /// Makes the specified sub-material current - bool selectSubMaterial( int id ); - - /// Returns a proxy object to the current sub-material - CNelMaterialProxy getMaterial(); - - /// Retrieves a list of user shaders loaded - void getShaderList( std::vector< std::string > &v ); - - /// Retrieves the specified user shader if exists - bool getShaderInfo( const std::string &name, SShaderInfo &info ); - - /// Updates a user shader - bool updateShaderInfo( const SShaderInfo &info ); - - /// Adds a new user shader - bool addShader( const SShaderInfo &info ); - - /// Removes a user shader - bool removeShader( const std::string &name ); - - /// Loads the user shaders - void loadShaders(); - - /// Saves the specified user shader - void saveShader( const std::string &name ); - - /// Deletes the specified user shader - void deleteShader( const std::string &name ); - - /// Sets up the viewport widget - void initViewPort( unsigned long wnd, unsigned long w, unsigned long h ); - - /// Shuts down the viewport widget - void killViewPort(); - - /// Resizes the viewport widget - void resizeViewPort( unsigned long w, unsigned long h ); - NL3D::UDriver* getDriver(){ return driver; } - - /// Clears the scene then adds a cube - bool addCube(); - - /// Clears the scene then adds a sphere - bool addSphere(); - - /// Clears the scene then add a cylinder - bool addCylinder(); - - /// Clears the scene the adds a teapot - bool addTeaPot(); - - - /// Clears the scene then loads a shape - bool loadShape( const std::string &fileName ); - - /// Clears the scene, as the name suggests - void clearScene(); - - /// Sends the input events to Nel3D - void updateInput(); - - /// Renders the scene - void renderScene(); - - unsigned long getShapeMatCount() const; - - void getFogSettings( SFogSettings &s ); - void setFogSettings( const SFogSettings &s ); - - unsigned char getMaxLights() const; - void getLightInfo( unsigned char light, SLightInfo &info ); - void setLightInfo( unsigned char light, const SLightInfo &info ); - - void setBGColor( unsigned char R, unsigned char G, unsigned char B, unsigned char A ){ - bgColor[ 0 ] = R; - bgColor[ 1 ] = G; - bgColor[ 2 ] = B; - bgColor[ 3 ] = A; - } - - private: - void setupCamera(); - - unsigned long subMatId; - - NL3D::CUsrShaderManager *shaderManager; - NL3D::UDriver *driver; - NL3D::UScene *scene; - NL3D::U3dMouseListener *mouseListener; - unsigned char bgColor[ 4 ]; - }; -} - - -#endif - - diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/ovqt_plugin_material_editor.xml b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/ovqt_plugin_material_editor.xml deleted file mode 100644 index 6ca757caa..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/ovqt_plugin_material_editor.xml +++ /dev/null @@ -1,10 +0,0 @@ - - ovqt_plugin_material_editor - Material Editor - 0.0.1 - Ryzom Core - Material Editor plugin. - - - - \ No newline at end of file diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/primitives/cube.shape b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/primitives/cube.shape deleted file mode 100644 index bec36973e5ff3269c7b91f5d94336fa5a6550833..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1196 zcmb`HJyOFk5QQb#u_2iM-!cW4pu(9@&@jWm85rp4sC*P|f{wva=-|E8t`W9FmGwNY z^sVwF%T^w5m-pVKm?5q1o?c(7Z2=Eo&$0WwimCeFy+cveeXxCPqPMu6pb?+~;zW#Z zgeEqn?c8Ds1_KLNc)5bdrQ@Wy*@{^@_jY4*GnaWs+My_1U6&e7GjF`VV1*CJKwiWo z>FbSqBfQNiwu&5#%A@Bor#c>tUhnO1joU6h>o~@a#$zmhGs#i2koSs?`LE;V(~pmT z*V*$nar$uG7UJKg-V~?*h{v@45mz6&S#7xgL*B1n*JSG%am>jY!=8!l{Jl?c`iwZ( zfcsFCv#RFt*+}$8;Szo(TC);VJe&-E@;s!Ks#dmz%+owq?I4pi&@Qy6+E;dfd Vj*-duXK)Igsm_%l<-z^U^aF8-aQgrN diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/primitives/cylinder.shape b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/primitives/cylinder.shape deleted file mode 100644 index 912861a533d5ee831d02bc70b3ab2578d77bf53a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6572 zcmb`L>$j9+7{+JsU2U?-A(Dzp&XFjG)SgMZgk7R?sCIIQa*PsEnh2qUZ~EvD5bdy5 zmd09IT9}qTGN6&wQHck zj5*6!uNZWEW~>?Z>1QkEzFW$~|Nd3ByFSVlcrgZZXR{48(rTm425-dmuU!t%j28-{ zr<-RJ#AQ>oWPe&)?2p%FH;?U|n6gk<*A?##4p5Qt*0#1nd;0*tIywe-w6wg<9UhP? zu%_yNmn*xruPSzp+SysRGQyg%WcjOH*)XE3_{p|$xqIb`twQGyy*+*WZw^lE>>0Vf zkAL{!#Jx)rzO7*8`@}r3BL_wjq}d6y>q-)wyjC+1me>-l-&ec!WO79~Dsb1voL7vrbw z<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E1jFWo=2QyCY5xm-rlW_!-b+krWD^Y{fb!y}u!RyR8xkqrG87KD$ zUT?<9J%TrwadMB~jb@zOBY2Y;C-(?`-;9%c1aCIuJfOadMB~Pt7>FNANZ?PVN!B-Hela1n)58qW`zcl0I9>KfKIJrmg9y3nv5&V@IC-(^6YsSev zg7=wmGLB%f{%?tFr^?v{+gW(zg diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/primitives/teapot.shape b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/primitives/teapot.shape deleted file mode 100644 index a6e2eedb19cf61ac6bcfa41f6560d0ca965cc6ee..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 25484 zcmb`Pd7RHx`~N@oJ$n+BrLiXr88h>KAE83ZUG79h5<^i5S+dO7Qdvri%-E8OkZtVd z^FBnPX1FV9UzEBjEm}lme%JHNb-F)){r>v8AFuno&+DA`>pJIkUFXc_Gj4aUuGjvn zSghzzDQP<2GMql(yGG*7yj^LkPG{~mi6AxcC z)1q<38k(0jKN%(WT4H)^8)U!vD=+-D>a;L9x0Ta@e{;%MyS{COwzCdQ4R2eUWQLue z9c6sC)TA9)9p5^lYVgd@lTA)`QC#@ovAp=U@n0rKCnlSY4d(-Y1)mP7M(lsS154%I(Dw5{pwsxb9bF- zVe7Jmz^(tCKc~m{{W(2o_QPZ|VN(fUSL%f;-`2P_FkK0@h5LY)%fKHRy*Is zn@~J*aohBn5l(4W-(D~NhzFr~;q)hVT^0Vk>n8h)^C1?K96SDxRjE4%-9Fa5T6%g! z@+D_3?$nCscYHZ#toeNSRPikqliawt6-Le4KKo2wFzonb=cVMp#VxgEfBQ)bTiP`7 zpZVgo(_e3H*(hFHe7t=cJ6sJy~>5Zf(vIRnbUjcMSj1fmd}W8UeUldtCZ?;?)N)2ZB?}W*iH6a z%kyE+IVG&**yT69VW)q3XEUhhS~=H{WH06Q8fxk$zP2E4hWIo*#OtrG2Q%rVi27xs~(lcsajD&ac(;>&`H7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{K^(@s{t|fxXu{FbU#dXU$Af!Ofu@fK zw@g7C#=QPZ@(j>~qou!Gfu@fK_p$;_9}n&o1#uYj`mf3}KogFZ{t5+}J|5gk1)4q{ z+-nNrFy{4F$umF`j+Xvv1)4q{+!_U%J|5ib3gR&4_1DTXKogFZ{yGJkJ|5h91)4q{ z+y(`481woYN{<$AjCZK-0&A z+pZuEV_tuUJOec0XzA}%py}hmL*{XGgaeLT3m3N(E@xHlEVVa)6AlV^Y?94-B~6lnT*aQhW#`gm{$ z6vSc7>%T3}08Kbr`tK;v^zq>G6=?c+a0LqDFy{3S$}>O{j+Xu*1)4q{+mzni0jt`_ql?#F!q%I zo_AOackdSp^!@tazEm*R$A&}WYXNh3A3eCE3Sz=B#@*}Z(te{r$H#y>ra;HXfcsW~ zHe)BW&luX=z27O&_wnHVt3cn!hC8l6!^eh08$IsZ?-l6y7;rx*(D5M@(j@NG3b|3pyOk}l~thQW5AVDpv_n%?K4K40zr9s2I%|P^eZUP z_p#wBD$ww;;n3zT<6W;yzp{dNy)Il81@C%YxT*^D82eb(2 -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - - -#include "prop_browser_ctrl.h" -#include "3rdparty/qtpropertybrowser/qttreepropertybrowser.h" -#include "3rdparty/qtpropertybrowser/qtvariantproperty.h" -#include "nel3d_interface.h" - -#include - -#include - -namespace MaterialEditor -{ - bool QStringToQMatrix4x4( const QString &s, QMatrix4x4 &m ) - { - QString ms = s; - bool ok = false; - bool success = true; - double da[ 16 ]; - - QStringList sl = ms.split( " " ); - QStringListIterator it( sl ); - int i = 0; - - while( it.hasNext() ) - { - double d = it.next().toDouble( &ok ); - - if( ok ) - { - da[ i ] = d; - } - else - { - da[ i ] = 0.0; - success = false; - } - - i++; - } - - m = QMatrix4x4( da ); - - return success; - } - - - int propToQVariant( unsigned char t ) - { - int type = 0; - - switch( t ) - { - case SMatProp::Color: - type = QVariant::Color; - break; - - case SMatProp::Double: - type = QVariant::Double; - break; - - case SMatProp::Float: - type = QVariant::Double; - break; - - case SMatProp::Int: - type = QVariant::Int; - break; - - case SMatProp::Matrix4: - type = QVariant::String; - break; - - case SMatProp::Texture: - type = QVariant::String; - break; - - case SMatProp::Uint: - type = QVariant::Int; - break; - - case SMatProp::Vector4: - type = QVariant::String; - break; - - default: - type = QVariant::String; - break; - } - - return type; - } - - void propValToQVariant( const SMatProp &p, QVariant &v ) - { - bool ok = false; - QString s; - - switch( p.type ) - { - case SMatProp::Color: - { - std::stringstream ss = p.value; - float c[ 4 ]; - std::fill( c, c + 4, 0.0f ); - - for( int i = 0; i < 4; i++ ) - { - ss >> c[ i ]; - if( !ss.good() ) - break; - } - - QColor color; - color.setRedF( c[ 0 ] / 255.0f ); - color.setGreenF( c[ 1 ] / 255.0f ); - color.setBlueF( c[ 2 ] / 255.0f ); - color.setAlphaF( c[ 3 ] / 255.0f ); - - v = color; - - break; - } - - case SMatProp::Double: - double d; - - s = p.value.c_str(); - d = s.toDouble( &ok ); - if( ok ) - v = d; - else - v = 0.0; - - break; - - case SMatProp::Float: - float f; - - s = p.value.c_str(); - f = s.toFloat( &ok ); - if( ok ) - v = f; - else - v = 0.0f; - - break; - - case SMatProp::Int: - int i; - - s = p.value.c_str(); - i = s.toInt( &ok ); - if( ok ) - v = i; - else - v = 0; - - break; - - case SMatProp::Matrix4: - { - /* - QMatrix4x4 m; - m.fill( 0.0 ); - QStringToQMatrix4x4( p.value.c_str(), m ); - v = QVariant( m ); - */ - v = p.value.c_str(); - } - break; - - case SMatProp::Texture: - v = p.value.c_str(); - break; - - case SMatProp::Uint: - unsigned int u; - - s = p.value.c_str(); - u = s.toUInt( &ok ); - if( ok ) - v = u; - else - v = 0u; - - break; - - case SMatProp::Vector4: - v = p.value.c_str(); - break; - - default: - v = ""; - break; - } - } - - - - - - - - CPropBrowserCtrl::CPropBrowserCtrl( QObject *parent ) : - QObject( parent ) - { - browser = NULL; - nel3dIface = NULL; - manager = new QtVariantPropertyManager(); - factory = new QtVariantEditorFactory(); - - setupConnections(); - } - - CPropBrowserCtrl::~CPropBrowserCtrl() - { - browser = NULL; - nel3dIface = NULL; - delete manager; - manager = NULL; - delete factory; - factory = NULL; - } - - void CPropBrowserCtrl::setBrowser( QtTreePropertyBrowser *b ) - { - browser = b; - browser->setFactoryForManager( manager, factory ); - } - - void CPropBrowserCtrl::setNel3DIface( CNel3DInterface *iface ) - { - nel3dIface = iface; - } - - void CPropBrowserCtrl::setupConnections() - { - connect( manager, SIGNAL( valueChanged( QtProperty*, const QVariant& ) ), - this, SLOT( onValueChanged( QtProperty*, const QVariant& ) ) ); - } - - void CPropBrowserCtrl::onSceneCleared() - { - clearProps(); - } - - void CPropBrowserCtrl::onPropsChanged() - { - clearProps(); - loadPropsForPass( currentPass ); - } - - void CPropBrowserCtrl::clearProps() - { - browser->clear(); - propToId.clear(); - } - - void CPropBrowserCtrl::loadPropsForPass( const QString &pass ) - { - currentPass = pass; - clearProps(); - - if( pass.isEmpty() ) - return; - - CNelMaterialProxy m = nel3dIface->getMaterial(); - if( m.isEmpty() ) - return; - - CRenderPassProxy p = m.getPass( pass.toUtf8().data() ); - - std::vector< SMatProp > v; - p.getProperties( v ); - - QtVariantProperty *vp = NULL; - int type = 0; - QVariant qv; - - std::vector< SMatProp >::const_iterator itr = v.begin(); - while( itr != v.end() ) - { - const SMatProp &prop = *itr; - - type = propToQVariant( prop.type ); - - vp = manager->addProperty( type, prop.label.c_str() ); - - if( vp != NULL ) - { - propValToQVariant( prop, qv ); - vp->setValue( qv ); - browser->addProperty( vp ); - propToId[ vp ] = prop.id; - } - ++itr; - } - } - - void CPropBrowserCtrl::loadPropsForPass( int i ) - { - clearProps(); - - CNelMaterialProxy m = nel3dIface->getMaterial(); - if( m.isEmpty() ) - return; - - CRenderPassProxy p = m.getPass( i ); - - std::string n; - p.getName( n ); - currentPass = n.c_str(); - - std::vector< SMatProp > v; - p.getProperties( v ); - - QtVariantProperty *vp = NULL; - int type = 0; - QVariant qv; - - std::vector< SMatProp >::const_iterator itr = v.begin(); - while( itr != v.end() ) - { - const SMatProp &prop = *itr; - - type = propToQVariant( prop.type ); - - vp = manager->addProperty( type, prop.label.c_str() ); - - if( vp != NULL ) - { - propValToQVariant( prop, qv ); - vp->setValue( qv ); - browser->addProperty( vp ); - propToId[ vp ] = prop.id; - } - ++itr; - } - } - - void CPropBrowserCtrl::onValueChanged( QtProperty *p, const QVariant &v ) - { - QString label = p->propertyName(); - std::string value = p->valueText().toUtf8().data(); - - if( v.type() == QVariant::Color ) - { - QColor c = v.value< QColor >(); - value.clear(); - QString val = "%1 %2 %3 %4"; - val = val.arg( c.red() ).arg( c.green() ).arg( c.blue() ).arg( c.alpha() ); - value = val.toUtf8().data(); - } - - CNelMaterialProxy m = nel3dIface->getMaterial(); - if( m.isEmpty() ) - return; - - CRenderPassProxy pass = m.getPass( currentPass.toUtf8().data() ); - - std::map< QtProperty*, std::string >::const_iterator itr - = propToId.find( p ); - if( itr == propToId.end() ) - return; - - SMatProp prop; - bool ok = pass.getProperty( itr->second, prop ); - if( !ok ) - return; - - prop.value = value; - pass.changeProperty( prop ); - - - } - -} - diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/prop_browser_ctrl.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/prop_browser_ctrl.h deleted file mode 100644 index 87f70a67d..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/prop_browser_ctrl.h +++ /dev/null @@ -1,64 +0,0 @@ -// Object Viewer Qt Material Editor plugin -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - - -#ifndef PROP_BROWSER_CTRL_H -#define PROP_BROWSER_CTRL_H - -#include -#include -#include - -class QtTreePropertyBrowser; -class QtVariantPropertyManager; -class QtVariantEditorFactory; -class QtProperty; - -namespace MaterialEditor -{ - class CNel3DInterface; - - class CPropBrowserCtrl : public QObject - { - Q_OBJECT - public: - CPropBrowserCtrl( QObject *parent = NULL ); - ~CPropBrowserCtrl(); - void setBrowser( QtTreePropertyBrowser *b ); - void setNel3DIface( CNel3DInterface *iface ); - void setupConnections(); - void onSceneCleared(); - void onPropsChanged(); - void clearProps(); - void loadPropsForPass( const QString &pass ); - void loadPropsForPass( int i ); - - private Q_SLOTS: - void onValueChanged( QtProperty *p, const QVariant &v ); - - private: - QtTreePropertyBrowser *browser; - QtVariantPropertyManager *manager; - QtVariantEditorFactory *factory; - - CNel3DInterface *nel3dIface; - QString currentPass; - - std::map< QtProperty*, std::string > propToId; - }; -} - -#endif diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/render_passes.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/render_passes.cpp deleted file mode 100644 index 189066745..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/render_passes.cpp +++ /dev/null @@ -1,257 +0,0 @@ -// Object Viewer Qt Material Editor plugin -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -#include "render_passes.h" -#include "nel3d_interface.h" -#include "material_observer.h" -#include -#include - -namespace MaterialEditor -{ - RenderPassesWidget::RenderPassesWidget( QWidget *parent ) : - QWidget( parent ) - { - setupUi( this ); - setupConnections(); - nl3dIface = NULL; - observer = NULL; - } - - RenderPassesWidget::~RenderPassesWidget() - { - } - - void RenderPassesWidget::fillList( const QStringList &list ) - { - listWidget->clear(); - - QStringListIterator itr( list ); - while( itr.hasNext() ) - { - listWidget->addItem( itr.next() ); - } - } - - void RenderPassesWidget::getList( QStringList &list ) - { - for( int i = 0; i < listWidget->count(); i++ ) - { - list.push_back( listWidget->item( i )->text() ); - } - } - - void RenderPassesWidget::clear() - { - listWidget->clear(); - } - - void RenderPassesWidget::onMaterialLoaded() - { - clear(); - CNelMaterialProxy m = nl3dIface->getMaterial(); - if( m.isEmpty() ) - return; - - std::vector< std::string > pl; - m.getPassList( pl ); - - std::vector< std::string >::const_iterator itr = pl.begin(); - while( itr != pl.end() ) - { - listWidget->addItem( QString( itr->c_str() ) ); - ++itr; - } - } - - void RenderPassesWidget::setupConnections() - { - connect( okButton, SIGNAL( clicked( bool ) ), this, SLOT( onOKClicked() ) ); - connect( addButton, SIGNAL( clicked( bool ) ), this, SLOT( onAddClicked() ) ); - connect( removeButton, SIGNAL( clicked( bool ) ), this, SLOT( onRemoveClicked() ) ); - connect( editButton, SIGNAL( clicked( bool ) ), this, SLOT( onEditClicked() ) ); - connect( upButton, SIGNAL( clicked( bool ) ), this, SLOT( onUpClicked() ) ); - connect( downButton, SIGNAL( clicked( bool ) ), this, SLOT( onDownClicked() ) ); - } - - bool RenderPassesWidget::passExists( const QString &label ) - { - int c = listWidget->count(); - - for( int i = 0; i < c; i++ ) - { - if( label == listWidget->item( i )->text() ) - return true; - } - - return false; - } - - void RenderPassesWidget::onOKClicked() - { - close(); - } - - void RenderPassesWidget::onAddClicked() - { - QString label = - QInputDialog::getText( - NULL, - tr( "Pass label" ), - tr( "Please enter the new pass' label" ) - ); - - if( label.isEmpty() ) - return; - - if( passExists( label ) ) - { - QMessageBox::warning( - NULL, - tr( "Pass label" ), - tr( "Pass label already exists!" ) - ); - - return; - } - - listWidget->addItem( label ); - - CNelMaterialProxy material = nl3dIface->getMaterial(); - material.addPass( label.toUtf8().data() ); - - if( observer != NULL ) - observer->onPassAdded( label.toUtf8().data() ); - } - - void RenderPassesWidget::onRemoveClicked() - { - int row = listWidget->currentRow(); - if( row == -1 ) - return; - QString pass; - - QListWidgetItem *item = listWidget->takeItem( row ); - pass = item->text(); - delete item; - - CNelMaterialProxy material = nl3dIface->getMaterial(); - if( material.isEmpty() ) - return; - - material.removePass( pass.toUtf8().data() ); - - if( observer != NULL ) - observer->onPassRemoved( pass.toUtf8().data() ); - } - - void RenderPassesWidget::onEditClicked() - { - QListWidgetItem *item = listWidget->currentItem(); - if( item == NULL ) - return; - - QString from = item->text(); - QString to = - QInputDialog::getText( - NULL, - tr( "Editing pass label" ), - tr( "Please enter the new label" ), - QLineEdit::Normal, - from - ); - - if( to.isEmpty() ) - return; - - if( from == to ) - return; - - if( passExists( to ) ) - { - QMessageBox::warning( - NULL, - tr( "Pass label" ), - tr( "Pass label already exists!" ) - ); - return; - } - - item->setText( to ); - - CNelMaterialProxy material = nl3dIface->getMaterial(); - if( material.isEmpty() ) - return; - - material.renamePass( from.toUtf8().data(), to.toUtf8().data() ); - - if( observer != NULL ) - observer->onPassRenamed( from.toUtf8().data(), to.toUtf8().data() ); - } - - void RenderPassesWidget::onUpClicked() - { - QListWidgetItem *item = listWidget->currentItem(); - if( item == NULL ) - return; - - int row = listWidget->currentRow(); - if( row == 0 ) - return; - - item = listWidget->takeItem( row ); - listWidget->insertItem( row - 1, item ); - listWidget->setCurrentRow( row - 1 ); - - QString s = item->text(); - - CNelMaterialProxy material = nl3dIface->getMaterial(); - if( material.isEmpty() ) - return; - - material.movePassUp( s.toUtf8().data() ); - - if( observer != NULL ) - observer->onPassMovedUp( s.toUtf8().data() ); - } - - void RenderPassesWidget::onDownClicked() - { - QListWidgetItem *item = listWidget->currentItem(); - if( item == NULL ) - return; - - int row = listWidget->currentRow(); - if( row == ( listWidget->count() - 1 ) ) - return; - - item = listWidget->takeItem( row ); - listWidget->insertItem( row + 1, item ); - listWidget->setCurrentRow( row + 1 ); - - QString s = item->text(); - - CNelMaterialProxy material = nl3dIface->getMaterial(); - if( material.isEmpty() ) - return; - - material.movePassDown( s.toUtf8().data() ); - - if( observer != NULL ) - observer->onPassMovedDown( s.toUtf8().data() ); - } -} - diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/render_passes.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/render_passes.h deleted file mode 100644 index 1fe891363..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/render_passes.h +++ /dev/null @@ -1,59 +0,0 @@ -// Object Viewer Qt Material Editor plugin -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -#ifndef RENDER_PASSES_H -#define RENDER_PASSES_H - -#include "ui_render_passes.h" -#include - -namespace MaterialEditor -{ - class CNel3DInterface; - class CMaterialObserver; - - class RenderPassesWidget : public QWidget, public Ui::RenderPassesWidget - { - Q_OBJECT - public: - RenderPassesWidget( QWidget *parent = NULL ); - ~RenderPassesWidget(); - void fillList( const QStringList &list ); - void getList( QStringList &list ); - void clear(); - void onMaterialLoaded(); - void setNel3dIface( CNel3DInterface *iface ){ nl3dIface = iface; } - void setMaterialObserver( CMaterialObserver *obs ){ observer = obs; } - - private: - void setupConnections(); - bool passExists( const QString &label ); - - CNel3DInterface *nl3dIface; - CMaterialObserver *observer; - - private Q_SLOTS: - void onOKClicked(); - void onAddClicked(); - void onRemoveClicked(); - void onEditClicked(); - void onUpClicked(); - void onDownClicked(); - }; -} - -#endif - diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/render_passes.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/render_passes.ui deleted file mode 100644 index c8907d4f4..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/render_passes.ui +++ /dev/null @@ -1,147 +0,0 @@ - - - RenderPassesWidget - - - Qt::ApplicationModal - - - - 0 - 0 - 498 - 297 - - - - Rendering passes - - - - - - - - - - - - - - - - 0 - 0 - - - - Add - - - - - - - - 0 - 0 - - - - Remove - - - - - - - - 0 - 0 - - - - Edit - - - - - - - - 0 - 0 - - - - Up - - - - - - - - 0 - 0 - - - - Down - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - - - 0 - 0 - - - - OK - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/shader_editor.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/shader_editor.cpp deleted file mode 100644 index cc4cdb69c..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/shader_editor.cpp +++ /dev/null @@ -1,90 +0,0 @@ -// Object Viewer Qt Material Editor plugin -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - - -#include "shader_editor.h" -#include "nel3d_interface.h" - -namespace MaterialEditor -{ - ShaderEditorWidget::ShaderEditorWidget( QDialog *parent ) : - QDialog( parent ) - { - setupUi( this ); - nl3dIface = NULL; - setupConnections(); - } - - ShaderEditorWidget::~ShaderEditorWidget() - { - } - - void ShaderEditorWidget::getDescription( QString &desc ) - { - desc = descriptionEdit->toPlainText(); - } - - void ShaderEditorWidget::setupConnections() - { - connect( okButton, SIGNAL( clicked( bool ) ), this, SLOT( onOKClicked() ) ) ; - connect( cancelButton, SIGNAL( clicked( bool ) ), this, SLOT( onCancelClicked() ) ); - } - - void ShaderEditorWidget::onOKClicked() - { - SShaderInfo info; - info.name = nameEdit->text().toUtf8().data(); - info.description = descriptionEdit->toPlainText().toUtf8().data(); - info.vp = vsEdit->toPlainText().toUtf8().data(); - info.fp = fsEdit->toPlainText().toUtf8().data(); - - bool ok = nl3dIface->updateShaderInfo( info ); - if( ok ) - nl3dIface->saveShader( info.name ); - - accept(); - } - - void ShaderEditorWidget::onCancelClicked() - { - reject(); - } - - void ShaderEditorWidget::reset() - { - QString empty; - nameEdit->setText( empty ); - descriptionEdit->setPlainText( empty ); - vsEdit->setPlainText( empty ); - fsEdit->setPlainText( empty ); - setResult( QDialog::Rejected ); - } - - bool ShaderEditorWidget::load( const QString &name ) - { - SShaderInfo info; - if( !nl3dIface->getShaderInfo( name.toUtf8().data(), info ) ) - return false; - - nameEdit->setText( info.name.c_str() ); - descriptionEdit->setPlainText( info.description.c_str() ); - vsEdit->setPlainText( info.vp.c_str() ); - fsEdit->setPlainText( info.fp.c_str() ); - return true; - } -} - - diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/shader_editor.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/shader_editor.h deleted file mode 100644 index 7daa8bb55..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/shader_editor.h +++ /dev/null @@ -1,52 +0,0 @@ -// Object Viewer Qt Material Editor plugin -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - - -#ifndef SHADER_EDITOR_H -#define SHADER_EDITOR_H - -#include "ui_shader_editor.h" - -namespace MaterialEditor -{ - class CNel3DInterface; - - class ShaderEditorWidget : public QDialog, public Ui::ShaderEditorWidget - { - Q_OBJECT - public: - ShaderEditorWidget( QDialog *parent = NULL ); - ~ShaderEditorWidget(); - - void getDescription( QString &desc ); - - void setNel3DInterface( CNel3DInterface *iface ){ nl3dIface = iface; } - - void reset(); - bool load( const QString &name ); - - private Q_SLOTS: - void onOKClicked(); - void onCancelClicked(); - - private: - void setupConnections(); - CNel3DInterface *nl3dIface; - }; -} - -#endif - diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/shader_editor.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/shader_editor.ui deleted file mode 100644 index 73d57b975..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/shader_editor.ui +++ /dev/null @@ -1,127 +0,0 @@ - - - ShaderEditorWidget - - - - 0 - 0 - 861 - 735 - - - - Shader Editor - - - true - - - - - - - - Name - - - - - - - false - - - - - - - - - - - Description - - - - - - - - - - - - - - Vertex Shader - - - - - - - - - - - - - - Fragment Shader - - - - - - - - - - - - - - - 0 - 0 - - - - OK - - - - - - - - 0 - 0 - - - - Cancel - - - - - - - Qt::Horizontal - - - - 468 - 20 - - - - - - - - - - - diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/shader_widget.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/shader_widget.cpp deleted file mode 100644 index 5dde3ae70..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/shader_widget.cpp +++ /dev/null @@ -1,220 +0,0 @@ -// Object Viewer Qt Material Editor plugin -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -#include "shader_widget.h" -#include "shader_editor.h" -#include "nel3d_interface.h" -#include -#include -#include - -namespace MaterialEditor -{ - ShaderWidget::ShaderWidget( QWidget *parent ) : - QWidget( parent ) - { - setupUi( this ); - setupConnections(); - - shaderEditorWidget = new ShaderEditorWidget(); - nl3dIface = NULL; - } - - ShaderWidget::~ShaderWidget() - { - delete shaderEditorWidget; - shaderEditorWidget = NULL; - } - - void ShaderWidget::setNel3DInterface( CNel3DInterface *iface ) - { - nl3dIface = iface; - shaderEditorWidget->setNel3DInterface( iface ); - } - - void ShaderWidget::load() - { - std::vector< std::string > v; - - nl3dIface->getShaderList( v ); - - shaderList->clear(); - - QString name; - - std::vector< std::string >::const_iterator itr = v.begin(); - while( itr != v.end() ) - { - name = itr->c_str(); - shaderList->addItem( name ); - Q_EMIT shaderAdded( name ); - - ++itr; - } - } - - void ShaderWidget::setupConnections() - { - connect( okButton, SIGNAL( clicked( bool ) ), this, SLOT( onOKClicked() ) ); - - connect( addButton, SIGNAL( clicked( bool ) ), this, SLOT( onAddClicked() ) ); - connect( removeButton, SIGNAL( clicked( bool ) ), this, SLOT( onRemoveClicked() ) ); - connect( editButton, SIGNAL( clicked( bool ) ), this, SLOT( onEditClicked() ) ); - - connect( shaderList, SIGNAL( currentRowChanged( int ) ), this, SLOT( onRowChanged( int ) ) ); - } - - void ShaderWidget::onOKClicked() - { - close(); - } - - bool ShaderWidget::nameExists( const QString &name ) - { - for( int i = 0; i < shaderList->count(); i++ ) - { - if( shaderList->item( i )->text() == name ) - return true; - } - - return false; - } - - void ShaderWidget::nameExistsMessage() - { - QMessageBox::critical( - this, - tr( "Shader already exists" ), - tr( "A shader with that name already exists!" ), - QMessageBox::Ok - ); - } - - void ShaderWidget::onAddClicked() - { - QString name = - QInputDialog::getText( - this, - tr( "New shader" ), - tr( "Enter the new shader's name" ) - ); - - if( name.isEmpty() ) - { - QMessageBox::critical( - this, - tr( "New shader" ), - tr( "You must enter a name for the new shader" ), - QMessageBox::Ok - ); - return; - } - - if( nameExists( name ) ) - { - nameExistsMessage(); - return; - } - - SShaderInfo info; - info.name = name.toUtf8().data(); - bool ok = nl3dIface->addShader( info ); - nl3dIface->saveShader( info.name ); - if( !ok ) - { - QMessageBox::critical( - this, - tr( "Error adding shader" ), - tr( "There was an error while trying to add the shader" ) - ); - - return; - } - - shaderList->addItem( name ); - - Q_EMIT shaderAdded( name ); - } - - void ShaderWidget::onRemoveClicked() - { - int i = shaderList->currentRow(); - if( i < 0 ) - return; - - int selection = - QMessageBox::question( - this, - tr( "Removing shader" ), - tr( "Are you sure you want to remove this shader?" ), - QMessageBox::Yes, - QMessageBox::Cancel - ); - - if( selection == QMessageBox::Yes ) - { - QListWidgetItem *item = shaderList->takeItem( i ); - QString name = item->text(); - std::string n = name.toUtf8().data(); - delete item; - - nl3dIface->removeShader( n ); - nl3dIface->deleteShader( n ); - - if( shaderList->count() == 0 ) - description->setPlainText( "" ); - - Q_EMIT shaderRemoved( name ); - } - - } - - void ShaderWidget::onEditClicked() - { - int i = shaderList->currentRow(); - if( i < 0 ) - return; - - QString name = shaderList->item( i )->text(); - - shaderEditorWidget->reset(); - shaderEditorWidget->load( name ); - - int res = shaderEditorWidget->exec(); - if( res == QDialog::Rejected ) - return; - - QString descr; - shaderEditorWidget->getDescription( descr ); - description->setPlainText( descr ); - } - - void ShaderWidget::onRowChanged( int i ) - { - if( i < 0 ) - return; - - std::string s = shaderList->item( i )->text().toUtf8().data(); - - SShaderInfo info; - bool ok = nl3dIface->getShaderInfo( s, info ); - if( !ok ) - return; - - description->setPlainText( info.description.c_str() ); - } -} - diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/shader_widget.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/shader_widget.h deleted file mode 100644 index 236051d6c..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/shader_widget.h +++ /dev/null @@ -1,61 +0,0 @@ -// Object Viewer Qt Material Editor plugin -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - - -#ifndef SHADER_WIDGET_H -#define SHADER_WIDGET_H - -#include "ui_shader_widget.h" - -namespace MaterialEditor -{ - class ShaderEditorWidget; - class CNel3DInterface; - - class ShaderWidget : public QWidget, public Ui::ShaderWidget - { - Q_OBJECT - - public: - ShaderWidget( QWidget *parent = NULL ); - ~ShaderWidget(); - - void setNel3DInterface( CNel3DInterface *iface ); - void load(); - - Q_SIGNALS: - void shaderAdded( const QString &name ); - void shaderRemoved( const QString &name ); - - private: - void setupConnections(); - bool nameExists( const QString &name ); - void nameExistsMessage(); - - ShaderEditorWidget *shaderEditorWidget; - CNel3DInterface *nl3dIface; - - private Q_SLOTS: - void onOKClicked(); - void onAddClicked(); - void onRemoveClicked(); - void onEditClicked(); - void onRowChanged( int i ); - }; -} - -#endif - diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/shader_widget.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/shader_widget.ui deleted file mode 100644 index 3d0a0e151..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/shader_widget.ui +++ /dev/null @@ -1,116 +0,0 @@ - - - ShaderWidget - - - Qt::ApplicationModal - - - - 0 - 0 - 502 - 401 - - - - Shaders - - - - - - Shaders - - - - - - - - - - - 0 - 0 - - - - Add - - - - - - - - 0 - 0 - - - - Remove - - - - - - - Edit - - - - - - - Qt::Vertical - - - - 20 - 123 - - - - - - - - Description - - - - - - - - - - - 0 - 0 - - - - OK - - - - - - - Qt::Horizontal - - - - 664 - 20 - - - - - - - - - diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/viewport_widget.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/viewport_widget.cpp deleted file mode 100644 index 97be13699..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/viewport_widget.cpp +++ /dev/null @@ -1,154 +0,0 @@ -// Object Viewer Qt Material Editor plugin -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - - -#include "viewport_widget.h" -#include -#include "nel3d_interface.h" -#include "nel/3d/driver.h" -#include "nel/3d/driver_user.h" - -#ifdef NL_OS_WINDOWS -#include -#endif - - -namespace MaterialEditor -{ - ViewPortWidget::ViewPortWidget( QWidget *parent ) : - QWidget( parent ) - { - nl3dIface = NULL; - timerId = 0; - setAttribute( Qt::WA_PaintOnScreen ); - } - - ViewPortWidget::~ViewPortWidget() - { - } - - void ViewPortWidget::init() - { - nl3dIface->initViewPort( (unsigned long)winId(), width(), height() ); - - } - - void ViewPortWidget::resizeEvent( QResizeEvent *evnt ) - { - uint32 w = evnt->size().width(); - uint32 h = evnt->size().height(); - - nl3dIface->resizeViewPort( w, h ); - - QWidget::resizeEvent( evnt ); - } - - void ViewPortWidget::startTimedUpdates( int interval ) - { - if( interval == 0 ) - return; - - timerId = startTimer( interval ); - } - - void ViewPortWidget::stopTimedUpdates() - { - killTimer( timerId ); - timerId = 0; - } - - void ViewPortWidget::timerEvent( QTimerEvent *evnt ) - { - int id = evnt->timerId(); - if( id == timerId ) - update(); - } - -#if defined( NL_OS_WINDOWS ) - - typedef bool ( *winProc )( NL3D::IDriver *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); - - bool ViewPortWidget::winEvent( MSG *message, long *result ) - { - NL3D::UDriver *udriver = nl3dIface->getDriver(); - if( ( udriver != NULL ) && udriver->isActive() ) - { - NL3D::IDriver *driver = dynamic_cast< NL3D::CDriverUser* >( udriver )->getDriver(); - if( driver != NULL ) - { - winProc proc = (winProc)driver->getWindowProc(); - return proc( driver, message->hwnd, message->message, message->wParam, message->lParam ); - } - } - - return false; - } - -#elif defined( NL_OS_MAC ) - - typedef bool ( *cocoaProc )( NL3D::IDriver *, const void *e ); - - bool ViewPortWidget::macEvent( EventHandlerCallRef caller, EventRef event ) - { - if( caller ) - nlerror("You are using QtCarbon! Only QtCocoa supported, please upgrade Qt"); - - NL3D::UDriver *udriver = nl3dIface->getDriver(); - if( ( udriver != NULL ) && udriver->isActive() ) - { - NL3D::IDriver *driver = dynamic_cast< NL3D::CDriverUser* >( udriver )->getDriver(); - if( driver != NULL ) - { - cocoaProc proc = ( cocoaProc )driver->getWindowProc(); - proc( driver, event ); - } - } - - return false; - } - -#elif defined( NL_OS_UNIX ) - - typedef bool ( *x11Proc )( NL3D::IDriver *drv, XEvent *e ); - - bool ViewPortWidget::x11Event( XEvent *event ) - { - NL3D::UDriver *udriver = nl3dIface->getDriver(); - - if( ( udriver != NULL ) && udriver->isActive() ) - { - NL3D::IDriver *driver = dynamic_cast< NL3D::CDriverUser* >( udriver )->getDriver(); - if( driver != NULL ) - { - x11Proc proc = ( x11Proc )driver->getWindowProc(); - proc( driver, event ); - } - - } - return false; - } - -#endif - - void ViewPortWidget::update() - { - nl3dIface->updateInput(); - nl3dIface->renderScene(); - } - -} - - diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/viewport_widget.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/viewport_widget.h deleted file mode 100644 index 6a2578a9f..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/viewport_widget.h +++ /dev/null @@ -1,68 +0,0 @@ -// Object Viewer Qt Material Editor plugin -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - - -#ifndef VIEWPORT_WIDGET_H -#define VIEWPORT_WIDGET_H - -#include -#include "nel/misc/types_nl.h" -#include "nel/misc/event_emitter.h" - -namespace MaterialEditor -{ - class CNel3DInterface; - - class ViewPortWidget : public QWidget - { - Q_OBJECT - public: - ViewPortWidget( QWidget *parent = NULL ); - ~ViewPortWidget(); - void setNel3DInterface( CNel3DInterface *iface ){ nl3dIface = iface; } - void init(); - - void resizeEvent( QResizeEvent *evnt ); - - QPaintEngine* paintEngine() const{ return NULL; } - - void startTimedUpdates( int interval ); - void stopTimedUpdates(); - - protected: - - void timerEvent( QTimerEvent *evnt ); - -#if defined ( NL_OS_WINDOWS ) - bool winEvent( MSG *message, long *result ); -#elif defined( NL_OS_MAC ) - bool macEvent( EventHandlerCallRef caller, EventRef event ) ; -#elif defined( NL_OS_UNIX ) - bool x11Event( XEvent *event ); -#endif - - private: - void update(); - - CNel3DInterface *nl3dIface; - int timerId; - }; -} - - -#endif - - diff --git a/code/nel/tools/3d/plugin_max/nel_export/nel_export_export.cpp b/code/nel/tools/3d/plugin_max/nel_export/nel_export_export.cpp index cb2d90137..46d88757b 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/nel_export_export.cpp +++ b/code/nel/tools/3d/plugin_max/nel_export/nel_export_export.cpp @@ -23,7 +23,6 @@ #include "nel/3d/skeleton_shape.h" #include "nel/3d/vegetable_shape.h" #include "nel/3d/lod_character_shape.h" -#include "nel/3d/shape_material_serializer.h" #include "../nel_mesh_lib/export_nel.h" #include "../nel_mesh_lib/export_appdata.h" @@ -92,10 +91,9 @@ bool CNelExport::exportMesh (const char *sPath, INode& node, TimeValue time) InfoLog->display("Beg buildShape %s \n", node.GetName()); // Export in mesh format IShape *pShape = _ExportNel->buildShape(node, time, mapIdPtr, true); - if (InfoLog) InfoLog->display("End buildShape in %d ms \n", timeGetTime()-t); - + // Conversion success ? if (pShape) { @@ -138,11 +136,6 @@ bool CNelExport::exportMesh (const char *sPath, INode& node, TimeValue time) nelExportTerminateProcess(); } - // Export here - ShapeMatSerial sms; - sms.setShape( pShape ); - sms.serial( sPath ); - // Delete the pointer nldebug("Delete the pointer"); try diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_material.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_material.cpp index 99ad7e35a..afe64907b 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_material.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_material.cpp @@ -23,7 +23,6 @@ #include "nel/3d/texture_cube.h" #include "nel/3d/tangent_space_build.h" #include "nel/3d/meshvp_per_pixel_light.h" -#include "nel/3d/dyn_mat_loader.h" #include #include @@ -278,19 +277,6 @@ void CExportNel::buildAMaterial (NL3D::CMaterial& material, CMaxMaterialInfo& ma // It is a NeL material ? if (isClassIdCompatible (mtl, Class_ID(NEL_MTL_A,NEL_MTL_B))) { - std::string sMaterialFile; - if( CExportNel::getValueByNameUsingParamBlock2( mtl, "sMaterialFile", (ParamType2)TYPE_STRING, &sMaterialFile, time ) ) - { - if( !sMaterialFile.empty() ) - { - nlinfo( "Using material file %s", sMaterialFile.c_str() ); - CDynMatLoader loader; - if( loader.loadFrom( sMaterialFile ) ) - material.setDynMat( loader.getDynMat() ); - else - nlinfo( "Error loading material file %s", sMaterialFile.c_str() ); - } - } // Get the shader value now int iShaderType = 0; diff --git a/code/nel/tools/3d/plugin_max/scripts/startup/nel_material.ms b/code/nel/tools/3d/plugin_max/scripts/startup/nel_material.ms index efd3ab88b..06021c45f 100644 --- a/code/nel/tools/3d/plugin_max/scripts/startup/nel_material.ms +++ b/code/nel/tools/3d/plugin_max/scripts/startup/nel_material.ms @@ -349,7 +349,6 @@ plugin material NelMaterial cSelfIllumColor type:#color pSelfIllumAmount type:#percent bUseSelfIllumColor type:#boolean - sMaterialFile type:#string default:"" ) parameters main rollout:NelParams @@ -549,12 +548,6 @@ plugin material NelMaterial Label lblNlbpB "http://dev.ryzom.com/" align:#center CheckBox cbTwoSided "2-Sided" checked:false align:#right - group "Material file" - ( - edittext mfEdit - button materialButton "browse" - ) - group "Standard Lighting" ( -- Label lblNlbpslA "Diffuse is the color in light, ambient in the dark." align:#right @@ -581,49 +574,6 @@ plugin material NelMaterial CheckBox cbUseSelfIllumColor "Use Color" checked:false align:#right ) - on materialButton pressed do - ( - fname = getOpenFileName caption:"Open material file" types:"Nel material (*.nelmat)" - if fname == undefined then ( - if mfEdit.text == "" then - sMaterialFile = "" - ) - else - sMaterialFile = fname - - mfEdit.text = sMaterialFile - ) - - on cbTwoSided changed bval do - updateUI false - - on cpAmbient changed cval do - updateUI false - - on cpDiffuse changed cval do - updateUI false - - on spOpacity changed pval do - updateUI false - - on cpSpecular changed cval do - updateUI false - - on spSpecularLevel changed pval do - updateUI false - - on spGlossiness changed pval do - updateUI false - - on cpSelfIllumColor changed cval do - updateUI false - - on spSelfIllumAmount changed bval do - updateUI false - - on cbUseSelfIllumColor changed bval do - updateUI false - Fn updateUI update = ( if (version >= 14) then @@ -631,7 +581,6 @@ plugin material NelMaterial if update == true then ( cbTwoSided.checked = bTwoSided - mfEdit.text = sMaterialFile cpAmbient.color = cAmbient cpDiffuse.color = cDiffuse spOpacity.value = pOpacity @@ -648,7 +597,6 @@ plugin material NelMaterial else ( bTwoSided = cbTwoSided.checked - sMaterial = mfEdit.text cAmbient = cpAmbient.color cDiffuse = cpDiffuse.color pOpacity = spOpacity.value @@ -677,6 +625,36 @@ plugin material NelMaterial ) ) + on cbTwoSided changed bval do + updateUI false + + on cpAmbient changed cval do + updateUI false + + on cpDiffuse changed cval do + updateUI false + + on spOpacity changed pval do + updateUI false + + on cpSpecular changed cval do + updateUI false + + on spSpecularLevel changed pval do + updateUI false + + on spGlossiness changed pval do + updateUI false + + on cpSelfIllumColor changed cval do + updateUI false + + on spSelfIllumAmount changed bval do + updateUI false + + on cbUseSelfIllumColor changed bval do + updateUI false + on nelBasicParameters open do ( updateUI true