From 971dc87b09333019aa588669b07c7723473e30ab Mon Sep 17 00:00:00 2001 From: Xottab_DUTY Date: Wed, 3 Apr 2019 00:38:59 +0500 Subject: [PATCH] Removed plugins --- cs/engine.sln | 317 -- cs/engine/plugins/Max/Export/BoneDef.cpp | 46 - .../plugins/Max/Export/EditMeshExportMAX.cpp | 267 - .../Max/Export/EditObjectExportLWO.cpp | 92 - .../Max/Export/EditObjectExportMAX.cpp | 188 - cs/engine/plugins/Max/Export/ExportKeys.cpp | 574 -- cs/engine/plugins/Max/Export/Exporter.cpp | 451 -- cs/engine/plugins/Max/Export/Exporter.h | 99 - .../plugins/Max/Export/ExporterMotion.cpp | 91 - cs/engine/plugins/Max/Export/ExporterSkin.cpp | 29 - cs/engine/plugins/Max/Export/FS2.CPP | 23 - cs/engine/plugins/Max/Export/FS2.H | 281 - .../plugins/Max/Export/MeshExpPlugin.cpp | 86 - .../plugins/Max/Export/MeshExpUtility.cpp | 383 -- cs/engine/plugins/Max/Export/MeshExpUtility.h | 77 - .../plugins/Max/Export/MeshExpUtility.rc | 182 - .../plugins/Max/Export/MeshExpUtility.rh | 33 - cs/engine/plugins/Max/Export/NetDeviceLog.cpp | 154 - cs/engine/plugins/Max/Export/NetDeviceLog.h | 63 - cs/engine/plugins/Max/Export/Stdafx.h | 93 - cs/engine/plugins/Max/Export/Utility.def | 7 - cs/engine/plugins/Max/Export/lwchunks.h | 162 - cs/engine/plugins/Max/Export/resource.h | 273 - cs/engine/plugins/Max/Export/stdafx.cpp | 3 - cs/engine/plugins/Max/MAX_Export60.vcxproj | 287 - .../plugins/Max/MAX_Export60.vcxproj.filters | 139 - cs/engine/plugins/Max/MAX_Material60.vcxproj | 188 - .../Max/MAX_Material60.vcxproj.filters | 54 - cs/engine/plugins/Max/Material/DllEntry.cpp | 72 - .../plugins/Max/Material/GameMaterial.rc | 608 --- cs/engine/plugins/Max/Material/Stdafx.h | 93 - cs/engine/plugins/Max/Material/XRayMtlRes.h | 276 - cs/engine/plugins/Max/Material/dmtlbut.bmp | Bin 478 -> 0 bytes cs/engine/plugins/Max/Material/dmtlmsk.bmp | Bin 478 -> 0 bytes cs/engine/plugins/Max/Material/resource.h | 273 - cs/engine/plugins/Max/Material/stdafx.cpp | 3 - .../plugins/Maya/Export/ExportDefines.cpp | 112 - cs/engine/plugins/Maya/Export/ExportDefines.h | 32 - cs/engine/plugins/Maya/Export/MayaExport.cpp | 531 -- cs/engine/plugins/Maya/Export/SmdBone.cpp | 27 - cs/engine/plugins/Maya/Export/SmdBone.h | 34 - cs/engine/plugins/Maya/Export/SmdMaya.cpp | 1534 ------ cs/engine/plugins/Maya/Export/SmdMaya.h | 105 - cs/engine/plugins/Maya/Export/SmdTriangle.cpp | 44 - cs/engine/plugins/Maya/Export/SmdTriangle.h | 58 - cs/engine/plugins/Maya/Export/Stdafx.h | 117 - cs/engine/plugins/Maya/Export/XRayExport.cpp | 73 - .../plugins/Maya/Export/maTranslator.cpp | 1104 ---- cs/engine/plugins/Maya/Export/maTranslator.h | 120 - cs/engine/plugins/Maya/Export/smoth_flags.h | 32 - cs/engine/plugins/Maya/Export/stdafx.cpp | 3 - .../Maya/Export/xrayObjectExportOptions.mel | 55 - .../Maya/Export/xraySkinExportOptions.mel | 102 - .../Export/xraySkinMotionExportOptions.mel | 102 - .../Maya/Material/AEXRayMtlTemplate.mel | 64 - .../Maya/Material/AElambertShaderTemplate.mel | 30 - .../Maya/Material/MNormalMapConverter.cpp | 147 - .../Maya/Material/MNormalMapConverter.h | 71 - cs/engine/plugins/Maya/Material/MTexture.cpp | 259 - cs/engine/plugins/Maya/Material/MTexture.h | 199 - .../plugins/Maya/Material/MTextureCache.cpp | 152 - .../plugins/Maya/Material/MTextureCache.h | 128 - .../plugins/Maya/Material/NodeMonitor.cpp | 223 - cs/engine/plugins/Maya/Material/NodeMonitor.h | 76 - .../Maya/Material/ShadingConnection.cpp | 191 - .../plugins/Maya/Material/ShadingConnection.h | 90 - cs/engine/plugins/Maya/Material/Stdafx.h | 100 - cs/engine/plugins/Maya/Material/crc16.cpp | 116 - .../plugins/Maya/Material/hwUnlitShader.cpp | 557 -- .../plugins/Maya/Material/hwUnlitShader.h | 107 - .../plugins/Maya/Material/lambertShader.cpp | 1052 ---- .../plugins/Maya/Material/phongShader.cpp | 620 --- cs/engine/plugins/Maya/Material/stdafx.cpp | 3 - .../plugins/Maya/Maya_Export2008.vcxproj | 214 - .../Maya/Maya_Export2008.vcxproj.filters | 122 - cs/engine/plugins/Maya/Maya_Export85.vcxproj | 195 - .../Maya/Maya_Export85.vcxproj.filters | 105 - .../plugins/Maya/Maya_Material2008.vcxproj | 171 - .../Maya/Maya_Material2008.vcxproj.filters | 55 - .../plugins/Maya/Maya_Material85.vcxproj | 183 - .../Maya/Maya_Material85.vcxproj.filters | 55 - .../Maya/data/icons/render_XRayMtl.xpm | 55 - .../Maya/data/scripts/AEXRayMtlTemplate.mel | 30 - .../data/scripts/xrayObjectExportOptions.mel | 55 - .../data/scripts/xraySkinExportOptions.mel | 102 - .../scripts/xraySkinMotionExportOptions.mel | 102 - .../plugins/lw/Export/EditObjectImport.cpp | 349 -- .../plugins/lw/Export/EditObjectImportDB.cpp | 243 - cs/engine/plugins/lw/Export/LWO/clip.c | 249 - cs/engine/plugins/lw/Export/LWO/envelope.c | 610 --- cs/engine/plugins/lw/Export/LWO/envelope.h | 49 - cs/engine/plugins/lw/Export/LWO/list.c | 102 - cs/engine/plugins/lw/Export/LWO/lwio.c | 444 -- cs/engine/plugins/lw/Export/LWO/lwo2.c | 275 - cs/engine/plugins/lw/Export/LWO/lwo2.h | 649 --- cs/engine/plugins/lw/Export/LWO/lwob.c | 682 --- cs/engine/plugins/lw/Export/LWO/pntspols.c | 540 -- cs/engine/plugins/lw/Export/LWO/surface.c | 1006 ---- cs/engine/plugins/lw/Export/LWO/vecmath.c | 37 - cs/engine/plugins/lw/Export/LWO/vmap.c | 244 - .../plugins/lw/Export/LW_export_keys.cpp | 118 - .../plugins/lw/Export/LW_export_motion.cpp | 76 - .../plugins/lw/Export/LW_export_object.cpp | 151 - cs/engine/plugins/lw/Export/SceneObject.h | 111 - cs/engine/plugins/lw/Export/bone_lw.cpp | 25 - cs/engine/plugins/lw/Export/envtest.c | 110 - cs/engine/plugins/lw/Export/lwo2.h | 660 --- cs/engine/plugins/lw/Export/motion_lw.cpp | 157 - cs/engine/plugins/lw/Export/resource.h | 27 - .../plugins/lw/Export/scenscan/objectdb.cpp | 478 -- .../plugins/lw/Export/scenscan/objectdb.h | 138 - .../plugins/lw/Export/scenscan/ptsearch.cpp | 210 - .../plugins/lw/Export/scenscan/scenscan.h | 24 - .../plugins/lw/Export/scenscan/surface.cpp | 224 - .../plugins/lw/Export/scenscan/vecmat.cpp | 38 - cs/engine/plugins/lw/Export/scenscan/vecmat.h | 19 - cs/engine/plugins/lw/Export/scenscan/vmap.cpp | 376 -- cs/engine/plugins/lw/Export/stdafx.cpp | 5 - cs/engine/plugins/lw/Export/stdafx.h | 49 - cs/engine/plugins/lw/LW_Export70.vcxproj | 339 -- .../plugins/lw/LW_Export70.vcxproj.filters | 123 - cs/engine/plugins/lw/LW_Export75.vcxproj | 335 -- .../plugins/lw/LW_Export75.vcxproj.filters | 123 - cs/engine/plugins/lw/LW_Export80.vcxproj | 335 -- .../plugins/lw/LW_Export80.vcxproj.filters | 123 - cs/engine/plugins/lw/LW_Server.vcxproj | 113 - .../plugins/lw/LW_Server.vcxproj.filters | 30 - cs/engine/plugins/lw/LW_Shader70.vcxproj | 186 - .../plugins/lw/LW_Shader70.vcxproj.filters | 58 - cs/engine/plugins/lw/LW_Shader75.vcxproj | 185 - .../plugins/lw/LW_Shader75.vcxproj.filters | 58 - cs/engine/plugins/lw/LW_Shader80.vcxproj | 185 - .../plugins/lw/LW_Shader80.vcxproj.filters | 58 - cs/engine/plugins/lw/Server/.gitignore | 3 - cs/engine/plugins/lw/Server/serv.def | 3 - cs/engine/plugins/lw/Server/servdesc.c | 24 - cs/engine/plugins/lw/Server/servmain.c | 25 - cs/engine/plugins/lw/Server/shutdown.c | 14 - cs/engine/plugins/lw/Server/startup.c | 14 - cs/engine/plugins/lw/Server/username.c | 15 - cs/engine/plugins/lw/Shader/LW_Shader.cpp | 28 - cs/engine/plugins/lw/Shader/LW_Shader.h | 14 - cs/engine/plugins/lw/Shader/blotch.c | 543 -- cs/engine/plugins/lw/Shader/resource.h | 27 - cs/engine/plugins/lw/Shader/stdafx.cpp | 5 - cs/engine/plugins/lw/Shader/stdafx.h | 49 - cs/engine/plugins/lw/lw_shared/LW_ShaderDef.h | 20 - .../plugins/shared/BlenderListLoader.cpp | 73 - cs/engine/plugins/shared/BlenderListLoader.h | 13 - cs/engine/plugins/shared/BoneDef.h | 37 - cs/engine/plugins/shared/ELog.cpp | 179 - cs/engine/plugins/shared/ELog.h | 23 - cs/engine/plugins/shared/Envelope.cpp | 229 - cs/engine/plugins/shared/Face.h | 15 - cs/engine/plugins/shared/GameMaterial.cpp | 4747 ----------------- cs/engine/plugins/shared/GameMaterial.def | 7 - cs/engine/plugins/shared/GameMaterial.h | 535 -- cs/engine/plugins/shared/GameMaterial.rc | 608 --- cs/engine/plugins/shared/GameMtlLib.cpp | 153 - cs/engine/plugins/shared/GameMtlLib.h | 341 -- cs/engine/plugins/shared/Helper.cpp | 136 - cs/engine/plugins/shared/Helper.h | 87 - cs/engine/plugins/shared/Shader_xrLC.h | 124 - cs/engine/plugins/shared/TexMaps.cpp | 273 - cs/engine/plugins/shared/TexMaps.h | 109 - cs/engine/plugins/shared/Vert.h | 66 - cs/engine/plugins/shared/XRayMtlRes.h | 276 - cs/engine/plugins/shared/bone.cpp | 189 - cs/engine/plugins/shared/bone.h | 258 - cs/engine/plugins/shared/envelope.h | 141 - cs/engine/plugins/shared/interp.cpp | 346 -- cs/engine/plugins/shared/motion.cpp | 588 -- cs/engine/plugins/shared/motion.h | 217 - cs/engine/plugins/shared/pick_definition.cpp | 170 - cs/engine/xrCore/xrCoreStatic.vcxproj | 399 -- cs/engine/xrCore/xrCoreStatic.vcxproj.filters | 582 -- 176 files changed, 38212 deletions(-) delete mode 100644 cs/engine/plugins/Max/Export/BoneDef.cpp delete mode 100644 cs/engine/plugins/Max/Export/EditMeshExportMAX.cpp delete mode 100644 cs/engine/plugins/Max/Export/EditObjectExportLWO.cpp delete mode 100644 cs/engine/plugins/Max/Export/EditObjectExportMAX.cpp delete mode 100644 cs/engine/plugins/Max/Export/ExportKeys.cpp delete mode 100644 cs/engine/plugins/Max/Export/Exporter.cpp delete mode 100644 cs/engine/plugins/Max/Export/Exporter.h delete mode 100644 cs/engine/plugins/Max/Export/ExporterMotion.cpp delete mode 100644 cs/engine/plugins/Max/Export/ExporterSkin.cpp delete mode 100644 cs/engine/plugins/Max/Export/FS2.CPP delete mode 100644 cs/engine/plugins/Max/Export/FS2.H delete mode 100644 cs/engine/plugins/Max/Export/MeshExpPlugin.cpp delete mode 100644 cs/engine/plugins/Max/Export/MeshExpUtility.cpp delete mode 100644 cs/engine/plugins/Max/Export/MeshExpUtility.h delete mode 100644 cs/engine/plugins/Max/Export/MeshExpUtility.rc delete mode 100644 cs/engine/plugins/Max/Export/MeshExpUtility.rh delete mode 100644 cs/engine/plugins/Max/Export/NetDeviceLog.cpp delete mode 100644 cs/engine/plugins/Max/Export/NetDeviceLog.h delete mode 100644 cs/engine/plugins/Max/Export/Stdafx.h delete mode 100644 cs/engine/plugins/Max/Export/Utility.def delete mode 100644 cs/engine/plugins/Max/Export/lwchunks.h delete mode 100644 cs/engine/plugins/Max/Export/resource.h delete mode 100644 cs/engine/plugins/Max/Export/stdafx.cpp delete mode 100644 cs/engine/plugins/Max/MAX_Export60.vcxproj delete mode 100644 cs/engine/plugins/Max/MAX_Export60.vcxproj.filters delete mode 100644 cs/engine/plugins/Max/MAX_Material60.vcxproj delete mode 100644 cs/engine/plugins/Max/MAX_Material60.vcxproj.filters delete mode 100644 cs/engine/plugins/Max/Material/DllEntry.cpp delete mode 100644 cs/engine/plugins/Max/Material/GameMaterial.rc delete mode 100644 cs/engine/plugins/Max/Material/Stdafx.h delete mode 100644 cs/engine/plugins/Max/Material/XRayMtlRes.h delete mode 100644 cs/engine/plugins/Max/Material/dmtlbut.bmp delete mode 100644 cs/engine/plugins/Max/Material/dmtlmsk.bmp delete mode 100644 cs/engine/plugins/Max/Material/resource.h delete mode 100644 cs/engine/plugins/Max/Material/stdafx.cpp delete mode 100644 cs/engine/plugins/Maya/Export/ExportDefines.cpp delete mode 100644 cs/engine/plugins/Maya/Export/ExportDefines.h delete mode 100644 cs/engine/plugins/Maya/Export/MayaExport.cpp delete mode 100644 cs/engine/plugins/Maya/Export/SmdBone.cpp delete mode 100644 cs/engine/plugins/Maya/Export/SmdBone.h delete mode 100644 cs/engine/plugins/Maya/Export/SmdMaya.cpp delete mode 100644 cs/engine/plugins/Maya/Export/SmdMaya.h delete mode 100644 cs/engine/plugins/Maya/Export/SmdTriangle.cpp delete mode 100644 cs/engine/plugins/Maya/Export/SmdTriangle.h delete mode 100644 cs/engine/plugins/Maya/Export/Stdafx.h delete mode 100644 cs/engine/plugins/Maya/Export/XRayExport.cpp delete mode 100644 cs/engine/plugins/Maya/Export/maTranslator.cpp delete mode 100644 cs/engine/plugins/Maya/Export/maTranslator.h delete mode 100644 cs/engine/plugins/Maya/Export/smoth_flags.h delete mode 100644 cs/engine/plugins/Maya/Export/stdafx.cpp delete mode 100644 cs/engine/plugins/Maya/Export/xrayObjectExportOptions.mel delete mode 100644 cs/engine/plugins/Maya/Export/xraySkinExportOptions.mel delete mode 100644 cs/engine/plugins/Maya/Export/xraySkinMotionExportOptions.mel delete mode 100644 cs/engine/plugins/Maya/Material/AEXRayMtlTemplate.mel delete mode 100644 cs/engine/plugins/Maya/Material/AElambertShaderTemplate.mel delete mode 100644 cs/engine/plugins/Maya/Material/MNormalMapConverter.cpp delete mode 100644 cs/engine/plugins/Maya/Material/MNormalMapConverter.h delete mode 100644 cs/engine/plugins/Maya/Material/MTexture.cpp delete mode 100644 cs/engine/plugins/Maya/Material/MTexture.h delete mode 100644 cs/engine/plugins/Maya/Material/MTextureCache.cpp delete mode 100644 cs/engine/plugins/Maya/Material/MTextureCache.h delete mode 100644 cs/engine/plugins/Maya/Material/NodeMonitor.cpp delete mode 100644 cs/engine/plugins/Maya/Material/NodeMonitor.h delete mode 100644 cs/engine/plugins/Maya/Material/ShadingConnection.cpp delete mode 100644 cs/engine/plugins/Maya/Material/ShadingConnection.h delete mode 100644 cs/engine/plugins/Maya/Material/Stdafx.h delete mode 100644 cs/engine/plugins/Maya/Material/crc16.cpp delete mode 100644 cs/engine/plugins/Maya/Material/hwUnlitShader.cpp delete mode 100644 cs/engine/plugins/Maya/Material/hwUnlitShader.h delete mode 100644 cs/engine/plugins/Maya/Material/lambertShader.cpp delete mode 100644 cs/engine/plugins/Maya/Material/phongShader.cpp delete mode 100644 cs/engine/plugins/Maya/Material/stdafx.cpp delete mode 100644 cs/engine/plugins/Maya/Maya_Export2008.vcxproj delete mode 100644 cs/engine/plugins/Maya/Maya_Export2008.vcxproj.filters delete mode 100644 cs/engine/plugins/Maya/Maya_Export85.vcxproj delete mode 100644 cs/engine/plugins/Maya/Maya_Export85.vcxproj.filters delete mode 100644 cs/engine/plugins/Maya/Maya_Material2008.vcxproj delete mode 100644 cs/engine/plugins/Maya/Maya_Material2008.vcxproj.filters delete mode 100644 cs/engine/plugins/Maya/Maya_Material85.vcxproj delete mode 100644 cs/engine/plugins/Maya/Maya_Material85.vcxproj.filters delete mode 100644 cs/engine/plugins/Maya/data/icons/render_XRayMtl.xpm delete mode 100644 cs/engine/plugins/Maya/data/scripts/AEXRayMtlTemplate.mel delete mode 100644 cs/engine/plugins/Maya/data/scripts/xrayObjectExportOptions.mel delete mode 100644 cs/engine/plugins/Maya/data/scripts/xraySkinExportOptions.mel delete mode 100644 cs/engine/plugins/Maya/data/scripts/xraySkinMotionExportOptions.mel delete mode 100644 cs/engine/plugins/lw/Export/EditObjectImport.cpp delete mode 100644 cs/engine/plugins/lw/Export/EditObjectImportDB.cpp delete mode 100644 cs/engine/plugins/lw/Export/LWO/clip.c delete mode 100644 cs/engine/plugins/lw/Export/LWO/envelope.c delete mode 100644 cs/engine/plugins/lw/Export/LWO/envelope.h delete mode 100644 cs/engine/plugins/lw/Export/LWO/list.c delete mode 100644 cs/engine/plugins/lw/Export/LWO/lwio.c delete mode 100644 cs/engine/plugins/lw/Export/LWO/lwo2.c delete mode 100644 cs/engine/plugins/lw/Export/LWO/lwo2.h delete mode 100644 cs/engine/plugins/lw/Export/LWO/lwob.c delete mode 100644 cs/engine/plugins/lw/Export/LWO/pntspols.c delete mode 100644 cs/engine/plugins/lw/Export/LWO/surface.c delete mode 100644 cs/engine/plugins/lw/Export/LWO/vecmath.c delete mode 100644 cs/engine/plugins/lw/Export/LWO/vmap.c delete mode 100644 cs/engine/plugins/lw/Export/LW_export_keys.cpp delete mode 100644 cs/engine/plugins/lw/Export/LW_export_motion.cpp delete mode 100644 cs/engine/plugins/lw/Export/LW_export_object.cpp delete mode 100644 cs/engine/plugins/lw/Export/SceneObject.h delete mode 100644 cs/engine/plugins/lw/Export/bone_lw.cpp delete mode 100644 cs/engine/plugins/lw/Export/envtest.c delete mode 100644 cs/engine/plugins/lw/Export/lwo2.h delete mode 100644 cs/engine/plugins/lw/Export/motion_lw.cpp delete mode 100644 cs/engine/plugins/lw/Export/resource.h delete mode 100644 cs/engine/plugins/lw/Export/scenscan/objectdb.cpp delete mode 100644 cs/engine/plugins/lw/Export/scenscan/objectdb.h delete mode 100644 cs/engine/plugins/lw/Export/scenscan/ptsearch.cpp delete mode 100644 cs/engine/plugins/lw/Export/scenscan/scenscan.h delete mode 100644 cs/engine/plugins/lw/Export/scenscan/surface.cpp delete mode 100644 cs/engine/plugins/lw/Export/scenscan/vecmat.cpp delete mode 100644 cs/engine/plugins/lw/Export/scenscan/vecmat.h delete mode 100644 cs/engine/plugins/lw/Export/scenscan/vmap.cpp delete mode 100644 cs/engine/plugins/lw/Export/stdafx.cpp delete mode 100644 cs/engine/plugins/lw/Export/stdafx.h delete mode 100644 cs/engine/plugins/lw/LW_Export70.vcxproj delete mode 100644 cs/engine/plugins/lw/LW_Export70.vcxproj.filters delete mode 100644 cs/engine/plugins/lw/LW_Export75.vcxproj delete mode 100644 cs/engine/plugins/lw/LW_Export75.vcxproj.filters delete mode 100644 cs/engine/plugins/lw/LW_Export80.vcxproj delete mode 100644 cs/engine/plugins/lw/LW_Export80.vcxproj.filters delete mode 100644 cs/engine/plugins/lw/LW_Server.vcxproj delete mode 100644 cs/engine/plugins/lw/LW_Server.vcxproj.filters delete mode 100644 cs/engine/plugins/lw/LW_Shader70.vcxproj delete mode 100644 cs/engine/plugins/lw/LW_Shader70.vcxproj.filters delete mode 100644 cs/engine/plugins/lw/LW_Shader75.vcxproj delete mode 100644 cs/engine/plugins/lw/LW_Shader75.vcxproj.filters delete mode 100644 cs/engine/plugins/lw/LW_Shader80.vcxproj delete mode 100644 cs/engine/plugins/lw/LW_Shader80.vcxproj.filters delete mode 100644 cs/engine/plugins/lw/Server/.gitignore delete mode 100644 cs/engine/plugins/lw/Server/serv.def delete mode 100644 cs/engine/plugins/lw/Server/servdesc.c delete mode 100644 cs/engine/plugins/lw/Server/servmain.c delete mode 100644 cs/engine/plugins/lw/Server/shutdown.c delete mode 100644 cs/engine/plugins/lw/Server/startup.c delete mode 100644 cs/engine/plugins/lw/Server/username.c delete mode 100644 cs/engine/plugins/lw/Shader/LW_Shader.cpp delete mode 100644 cs/engine/plugins/lw/Shader/LW_Shader.h delete mode 100644 cs/engine/plugins/lw/Shader/blotch.c delete mode 100644 cs/engine/plugins/lw/Shader/resource.h delete mode 100644 cs/engine/plugins/lw/Shader/stdafx.cpp delete mode 100644 cs/engine/plugins/lw/Shader/stdafx.h delete mode 100644 cs/engine/plugins/lw/lw_shared/LW_ShaderDef.h delete mode 100644 cs/engine/plugins/shared/BlenderListLoader.cpp delete mode 100644 cs/engine/plugins/shared/BlenderListLoader.h delete mode 100644 cs/engine/plugins/shared/BoneDef.h delete mode 100644 cs/engine/plugins/shared/ELog.cpp delete mode 100644 cs/engine/plugins/shared/ELog.h delete mode 100644 cs/engine/plugins/shared/Envelope.cpp delete mode 100644 cs/engine/plugins/shared/Face.h delete mode 100644 cs/engine/plugins/shared/GameMaterial.cpp delete mode 100644 cs/engine/plugins/shared/GameMaterial.def delete mode 100644 cs/engine/plugins/shared/GameMaterial.h delete mode 100644 cs/engine/plugins/shared/GameMaterial.rc delete mode 100644 cs/engine/plugins/shared/GameMtlLib.cpp delete mode 100644 cs/engine/plugins/shared/GameMtlLib.h delete mode 100644 cs/engine/plugins/shared/Helper.cpp delete mode 100644 cs/engine/plugins/shared/Helper.h delete mode 100644 cs/engine/plugins/shared/Shader_xrLC.h delete mode 100644 cs/engine/plugins/shared/TexMaps.cpp delete mode 100644 cs/engine/plugins/shared/TexMaps.h delete mode 100644 cs/engine/plugins/shared/Vert.h delete mode 100644 cs/engine/plugins/shared/XRayMtlRes.h delete mode 100644 cs/engine/plugins/shared/bone.cpp delete mode 100644 cs/engine/plugins/shared/bone.h delete mode 100644 cs/engine/plugins/shared/envelope.h delete mode 100644 cs/engine/plugins/shared/interp.cpp delete mode 100644 cs/engine/plugins/shared/motion.cpp delete mode 100644 cs/engine/plugins/shared/motion.h delete mode 100644 cs/engine/plugins/shared/pick_definition.cpp delete mode 100644 cs/engine/xrCore/xrCoreStatic.vcxproj delete mode 100644 cs/engine/xrCore/xrCoreStatic.vcxproj.filters diff --git a/cs/engine.sln b/cs/engine.sln index e0b92410e..9cd1a59bb 100644 --- a/cs/engine.sln +++ b/cs/engine.sln @@ -8,22 +8,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dedicated", "dedicated", "{ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "3rd party", "3rd party", "{2BFC806B-CE92-4EA4-8FE8-5F2EA54BA348}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "plugins", "plugins", "{A074ECE0-24F4-497F-99BD-AD45D5C51382}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "max", "max", "{901F5C6A-BA06-4727-B9BC-762891749A46}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "maya", "maya", "{68CB7CEC-F907-47AD-B624-B8432F53AAE3}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "lw", "lw", "{AB0D87B3-0937-4B2D-AB01-7A613B3EEF0D}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "editor", "editor", "{2DDE8FE4-6490-4AC5-B020-7E6A203F6318}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OpenAL32", "3rd party\OpenAL\OpenAL-Windows\Router\Router.vcxproj", "{566551F4-4EF1-4CB4-A131-F982E7606907}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xrD3D9-Null", "engine\xrD3D9-Null\xrD3D9-Null.vcxproj", "{0899B131-F1D4-4876-9BA1-67AC821DB9E1}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xrCoreStatic", "engine\xrCore\xrCoreStatic.vcxproj", "{F1066EAC-EE25-4C7A-9023-5957A6F7BA27}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CompressionTest", "engine\utils\CompressionTest\CompressionTest.vcxproj", "{C961EA19-716C-4A6D-BB13-689F8FB78B01}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ctool", "engine\utils\ctool\ctool.vcxproj", "{2FAAC8BA-369F-465E-B465-2235963FD377}" @@ -64,32 +54,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xrRender_R2", "engine\layer EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xrSound", "engine\xrSound\xrSound.vcxproj", "{CCCA7859-EB86-493E-9B53-C4235F45B3C5}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LW_Export_70", "engine\plugins\lw\LW_Export70.vcxproj", "{F573DE85-0866-4775-955F-6C3241D2AE70}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LW_Export_75", "engine\plugins\lw\LW_Export75.vcxproj", "{F573DE85-0866-4775-955F-6C3241D2AE75}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LW_Export_80", "engine\plugins\lw\LW_Export80.vcxproj", "{F573DE85-0866-4775-955F-6C3241D2AE80}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LW_Server", "engine\plugins\lw\LW_Server.vcxproj", "{6BA3121A-ACBC-4685-9246-4549CA1EFFFD}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LW_Shader_70", "engine\plugins\lw\LW_Shader70.vcxproj", "{39EE310B-4F1D-4716-A39F-4AB844DB3670}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LW_Shader_75", "engine\plugins\lw\LW_Shader75.vcxproj", "{39EE310B-4F1D-4716-A39F-4AB844DB3675}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LW_Shader_80", "engine\plugins\lw\LW_Shader80.vcxproj", "{39EE310B-4F1D-4716-A39F-4AB844DB3680}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Max_Export_60", "engine\plugins\Max\MAX_Export60.vcxproj", "{93AD3B7E-71DE-4FA2-90E7-A79782ED4960}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Max_Material_60", "engine\plugins\Max\MAX_Material60.vcxproj", "{56AD8F54-F89E-4B5A-93F8-8A617BFD1160}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Maya_Export_85", "engine\plugins\Maya\Maya_Export85.vcxproj", "{C2A6CB42-D6EC-4045-9452-B73FE1A4FABB}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Maya_Material_85", "engine\plugins\Maya\Maya_Material85.vcxproj", "{F5FE7239-50EB-4AC0-AD32-6374C1A6DD6C}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Maya_Export_2008", "engine\plugins\Maya\Maya_Export2008.vcxproj", "{C928FBB1-EDD8-4198-90DC-170A54C2AD72}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Maya_Material_2008", "engine\plugins\Maya\Maya_Material2008.vcxproj", "{84D91673-C1A1-47FF-9A75-4E73F31F4C63}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xrRender_R3", "engine\layers\xrRenderPC_R3\xrRender_R3.vcxproj", "{3F383D3C-FCD8-4170-990B-EB4833F09248}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "editor", "engine\editor\editor.vcxproj", "{492D3DFE-9068-4E7E-A008-7C2420A651C0}" @@ -190,24 +154,6 @@ Global {0899B131-F1D4-4876-9BA1-67AC821DB9E1}.Release|x64.ActiveCfg = Release|Win32 {0899B131-F1D4-4876-9BA1-67AC821DB9E1}.Release|x86.ActiveCfg = Release|Win32 {0899B131-F1D4-4876-9BA1-67AC821DB9E1}.Release|x86.Build.0 = Release|Win32 - {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Debug_Dedicated|x64.ActiveCfg = Release|Win32 - {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Debug_Dedicated|x64.Build.0 = Release|Win32 - {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Debug_Dedicated|x86.ActiveCfg = Debug|Win32 - {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Debug|x64.ActiveCfg = Debug|Win32 - {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Debug|x86.ActiveCfg = Debug|Win32 - {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Debug|x86.Build.0 = Debug|Win32 - {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Mixed_Dedicated|x64.ActiveCfg = Release|Win32 - {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Mixed_Dedicated|x64.Build.0 = Release|Win32 - {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Mixed_Dedicated|x86.ActiveCfg = Mixed|Win32 - {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Mixed|x64.ActiveCfg = Mixed|Win32 - {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Mixed|x86.ActiveCfg = Release|Win32 - {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Mixed|x86.Build.0 = Release|Win32 - {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Release_Dedicated|x64.ActiveCfg = Release|Win32 - {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Release_Dedicated|x64.Build.0 = Release|Win32 - {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Release_Dedicated|x86.ActiveCfg = Release|Win32 - {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Release|x64.ActiveCfg = Release|Win32 - {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Release|x86.ActiveCfg = Release|Win32 - {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Release|x86.Build.0 = Release|Win32 {C961EA19-716C-4A6D-BB13-689F8FB78B01}.Debug_Dedicated|x64.ActiveCfg = Release|Win32 {C961EA19-716C-4A6D-BB13-689F8FB78B01}.Debug_Dedicated|x64.Build.0 = Release|Win32 {C961EA19-716C-4A6D-BB13-689F8FB78B01}.Debug_Dedicated|x86.ActiveCfg = Debug|Win32 @@ -572,252 +518,6 @@ Global {CCCA7859-EB86-493E-9B53-C4235F45B3C5}.Release|x64.ActiveCfg = Release|Win32 {CCCA7859-EB86-493E-9B53-C4235F45B3C5}.Release|x86.ActiveCfg = Release|Win32 {CCCA7859-EB86-493E-9B53-C4235F45B3C5}.Release|x86.Build.0 = Release|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE70}.Debug_Dedicated|x64.ActiveCfg = Release|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE70}.Debug_Dedicated|x64.Build.0 = Release|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE70}.Debug_Dedicated|x86.ActiveCfg = Debug|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE70}.Debug|x64.ActiveCfg = Debug|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE70}.Debug|x86.ActiveCfg = Debug|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE70}.Debug|x86.Build.0 = Debug|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE70}.Mixed_Dedicated|x64.ActiveCfg = Release|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE70}.Mixed_Dedicated|x64.Build.0 = Release|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE70}.Mixed_Dedicated|x86.ActiveCfg = Debug|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE70}.Mixed|x64.ActiveCfg = Release|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE70}.Mixed|x64.Build.0 = Release|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE70}.Mixed|x86.ActiveCfg = Release|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE70}.Mixed|x86.Build.0 = Release|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE70}.Release_Dedicated|x64.ActiveCfg = Release|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE70}.Release_Dedicated|x64.Build.0 = Release|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE70}.Release_Dedicated|x86.ActiveCfg = Release|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE70}.Release|x64.ActiveCfg = Release|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE70}.Release|x86.ActiveCfg = Release|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE70}.Release|x86.Build.0 = Release|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE75}.Debug_Dedicated|x64.ActiveCfg = Release|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE75}.Debug_Dedicated|x64.Build.0 = Release|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE75}.Debug_Dedicated|x86.ActiveCfg = Debug|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE75}.Debug|x64.ActiveCfg = Debug|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE75}.Debug|x86.ActiveCfg = Debug|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE75}.Debug|x86.Build.0 = Debug|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE75}.Mixed_Dedicated|x64.ActiveCfg = Release|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE75}.Mixed_Dedicated|x64.Build.0 = Release|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE75}.Mixed_Dedicated|x86.ActiveCfg = Debug|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE75}.Mixed|x64.ActiveCfg = Release|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE75}.Mixed|x64.Build.0 = Release|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE75}.Mixed|x86.ActiveCfg = Release|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE75}.Mixed|x86.Build.0 = Release|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE75}.Release_Dedicated|x64.ActiveCfg = Release|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE75}.Release_Dedicated|x64.Build.0 = Release|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE75}.Release_Dedicated|x86.ActiveCfg = Release|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE75}.Release|x64.ActiveCfg = Release|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE75}.Release|x86.ActiveCfg = Release|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE75}.Release|x86.Build.0 = Release|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE80}.Debug_Dedicated|x64.ActiveCfg = Release|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE80}.Debug_Dedicated|x64.Build.0 = Release|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE80}.Debug_Dedicated|x86.ActiveCfg = Debug|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE80}.Debug|x64.ActiveCfg = Debug|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE80}.Debug|x86.ActiveCfg = Debug|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE80}.Debug|x86.Build.0 = Debug|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE80}.Mixed_Dedicated|x64.ActiveCfg = Release|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE80}.Mixed_Dedicated|x64.Build.0 = Release|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE80}.Mixed_Dedicated|x86.ActiveCfg = Debug|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE80}.Mixed|x64.ActiveCfg = Release|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE80}.Mixed|x64.Build.0 = Release|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE80}.Mixed|x86.ActiveCfg = Release|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE80}.Mixed|x86.Build.0 = Release|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE80}.Release_Dedicated|x64.ActiveCfg = Release|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE80}.Release_Dedicated|x64.Build.0 = Release|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE80}.Release_Dedicated|x86.ActiveCfg = Release|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE80}.Release|x64.ActiveCfg = Release|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE80}.Release|x86.ActiveCfg = Release|Win32 - {F573DE85-0866-4775-955F-6C3241D2AE80}.Release|x86.Build.0 = Release|Win32 - {6BA3121A-ACBC-4685-9246-4549CA1EFFFD}.Debug_Dedicated|x64.ActiveCfg = Release|Win32 - {6BA3121A-ACBC-4685-9246-4549CA1EFFFD}.Debug_Dedicated|x64.Build.0 = Release|Win32 - {6BA3121A-ACBC-4685-9246-4549CA1EFFFD}.Debug_Dedicated|x86.ActiveCfg = Debug|Win32 - {6BA3121A-ACBC-4685-9246-4549CA1EFFFD}.Debug|x64.ActiveCfg = Debug|Win32 - {6BA3121A-ACBC-4685-9246-4549CA1EFFFD}.Debug|x86.ActiveCfg = Debug|Win32 - {6BA3121A-ACBC-4685-9246-4549CA1EFFFD}.Debug|x86.Build.0 = Debug|Win32 - {6BA3121A-ACBC-4685-9246-4549CA1EFFFD}.Mixed_Dedicated|x64.ActiveCfg = Release|Win32 - {6BA3121A-ACBC-4685-9246-4549CA1EFFFD}.Mixed_Dedicated|x64.Build.0 = Release|Win32 - {6BA3121A-ACBC-4685-9246-4549CA1EFFFD}.Mixed_Dedicated|x86.ActiveCfg = Debug|Win32 - {6BA3121A-ACBC-4685-9246-4549CA1EFFFD}.Mixed|x64.ActiveCfg = Release|Win32 - {6BA3121A-ACBC-4685-9246-4549CA1EFFFD}.Mixed|x64.Build.0 = Release|Win32 - {6BA3121A-ACBC-4685-9246-4549CA1EFFFD}.Mixed|x86.ActiveCfg = Release|Win32 - {6BA3121A-ACBC-4685-9246-4549CA1EFFFD}.Mixed|x86.Build.0 = Release|Win32 - {6BA3121A-ACBC-4685-9246-4549CA1EFFFD}.Release_Dedicated|x64.ActiveCfg = Release|Win32 - {6BA3121A-ACBC-4685-9246-4549CA1EFFFD}.Release_Dedicated|x64.Build.0 = Release|Win32 - {6BA3121A-ACBC-4685-9246-4549CA1EFFFD}.Release_Dedicated|x86.ActiveCfg = Release|Win32 - {6BA3121A-ACBC-4685-9246-4549CA1EFFFD}.Release|x64.ActiveCfg = Release|Win32 - {6BA3121A-ACBC-4685-9246-4549CA1EFFFD}.Release|x86.ActiveCfg = Release|Win32 - {6BA3121A-ACBC-4685-9246-4549CA1EFFFD}.Release|x86.Build.0 = Release|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3670}.Debug_Dedicated|x64.ActiveCfg = Release|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3670}.Debug_Dedicated|x64.Build.0 = Release|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3670}.Debug_Dedicated|x86.ActiveCfg = Debug|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3670}.Debug|x64.ActiveCfg = Debug|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3670}.Debug|x86.ActiveCfg = Debug|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3670}.Debug|x86.Build.0 = Debug|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3670}.Mixed_Dedicated|x64.ActiveCfg = Release|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3670}.Mixed_Dedicated|x64.Build.0 = Release|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3670}.Mixed_Dedicated|x86.ActiveCfg = Debug|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3670}.Mixed|x64.ActiveCfg = Release|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3670}.Mixed|x64.Build.0 = Release|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3670}.Mixed|x86.ActiveCfg = Release|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3670}.Mixed|x86.Build.0 = Release|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3670}.Release_Dedicated|x64.ActiveCfg = Release|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3670}.Release_Dedicated|x64.Build.0 = Release|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3670}.Release_Dedicated|x86.ActiveCfg = Release|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3670}.Release|x64.ActiveCfg = Release|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3670}.Release|x86.ActiveCfg = Release|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3670}.Release|x86.Build.0 = Release|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3675}.Debug_Dedicated|x64.ActiveCfg = Release|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3675}.Debug_Dedicated|x64.Build.0 = Release|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3675}.Debug_Dedicated|x86.ActiveCfg = Debug|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3675}.Debug|x64.ActiveCfg = Debug|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3675}.Debug|x86.ActiveCfg = Debug|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3675}.Debug|x86.Build.0 = Debug|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3675}.Mixed_Dedicated|x64.ActiveCfg = Release|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3675}.Mixed_Dedicated|x64.Build.0 = Release|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3675}.Mixed_Dedicated|x86.ActiveCfg = Debug|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3675}.Mixed|x64.ActiveCfg = Release|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3675}.Mixed|x64.Build.0 = Release|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3675}.Mixed|x86.ActiveCfg = Release|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3675}.Mixed|x86.Build.0 = Release|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3675}.Release_Dedicated|x64.ActiveCfg = Release|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3675}.Release_Dedicated|x64.Build.0 = Release|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3675}.Release_Dedicated|x86.ActiveCfg = Release|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3675}.Release|x64.ActiveCfg = Release|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3675}.Release|x86.ActiveCfg = Release|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3675}.Release|x86.Build.0 = Release|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3680}.Debug_Dedicated|x64.ActiveCfg = Release|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3680}.Debug_Dedicated|x64.Build.0 = Release|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3680}.Debug_Dedicated|x86.ActiveCfg = Debug|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3680}.Debug|x64.ActiveCfg = Debug|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3680}.Debug|x86.ActiveCfg = Debug|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3680}.Debug|x86.Build.0 = Debug|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3680}.Mixed_Dedicated|x64.ActiveCfg = Release|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3680}.Mixed_Dedicated|x64.Build.0 = Release|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3680}.Mixed_Dedicated|x86.ActiveCfg = Debug|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3680}.Mixed|x64.ActiveCfg = Release|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3680}.Mixed|x64.Build.0 = Release|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3680}.Mixed|x86.ActiveCfg = Release|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3680}.Mixed|x86.Build.0 = Release|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3680}.Release_Dedicated|x64.ActiveCfg = Release|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3680}.Release_Dedicated|x64.Build.0 = Release|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3680}.Release_Dedicated|x86.ActiveCfg = Release|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3680}.Release|x64.ActiveCfg = Release|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3680}.Release|x86.ActiveCfg = Release|Win32 - {39EE310B-4F1D-4716-A39F-4AB844DB3680}.Release|x86.Build.0 = Release|Win32 - {93AD3B7E-71DE-4FA2-90E7-A79782ED4960}.Debug_Dedicated|x64.ActiveCfg = Release|Win32 - {93AD3B7E-71DE-4FA2-90E7-A79782ED4960}.Debug_Dedicated|x64.Build.0 = Release|Win32 - {93AD3B7E-71DE-4FA2-90E7-A79782ED4960}.Debug_Dedicated|x86.ActiveCfg = Debug|Win32 - {93AD3B7E-71DE-4FA2-90E7-A79782ED4960}.Debug|x64.ActiveCfg = Debug|Win32 - {93AD3B7E-71DE-4FA2-90E7-A79782ED4960}.Debug|x86.ActiveCfg = Debug|Win32 - {93AD3B7E-71DE-4FA2-90E7-A79782ED4960}.Debug|x86.Build.0 = Debug|Win32 - {93AD3B7E-71DE-4FA2-90E7-A79782ED4960}.Mixed_Dedicated|x64.ActiveCfg = Release|Win32 - {93AD3B7E-71DE-4FA2-90E7-A79782ED4960}.Mixed_Dedicated|x64.Build.0 = Release|Win32 - {93AD3B7E-71DE-4FA2-90E7-A79782ED4960}.Mixed_Dedicated|x86.ActiveCfg = Mixed|Win32 - {93AD3B7E-71DE-4FA2-90E7-A79782ED4960}.Mixed|x64.ActiveCfg = Mixed|Win32 - {93AD3B7E-71DE-4FA2-90E7-A79782ED4960}.Mixed|x86.ActiveCfg = Release|Win32 - {93AD3B7E-71DE-4FA2-90E7-A79782ED4960}.Mixed|x86.Build.0 = Release|Win32 - {93AD3B7E-71DE-4FA2-90E7-A79782ED4960}.Release_Dedicated|x64.ActiveCfg = Release|Win32 - {93AD3B7E-71DE-4FA2-90E7-A79782ED4960}.Release_Dedicated|x64.Build.0 = Release|Win32 - {93AD3B7E-71DE-4FA2-90E7-A79782ED4960}.Release_Dedicated|x86.ActiveCfg = Release|Win32 - {93AD3B7E-71DE-4FA2-90E7-A79782ED4960}.Release|x64.ActiveCfg = Release|Win32 - {93AD3B7E-71DE-4FA2-90E7-A79782ED4960}.Release|x86.ActiveCfg = Release|Win32 - {93AD3B7E-71DE-4FA2-90E7-A79782ED4960}.Release|x86.Build.0 = Release|Win32 - {56AD8F54-F89E-4B5A-93F8-8A617BFD1160}.Debug_Dedicated|x64.ActiveCfg = Release|Win32 - {56AD8F54-F89E-4B5A-93F8-8A617BFD1160}.Debug_Dedicated|x64.Build.0 = Release|Win32 - {56AD8F54-F89E-4B5A-93F8-8A617BFD1160}.Debug_Dedicated|x86.ActiveCfg = Debug|Win32 - {56AD8F54-F89E-4B5A-93F8-8A617BFD1160}.Debug|x64.ActiveCfg = Debug|Win32 - {56AD8F54-F89E-4B5A-93F8-8A617BFD1160}.Debug|x86.ActiveCfg = Debug|Win32 - {56AD8F54-F89E-4B5A-93F8-8A617BFD1160}.Debug|x86.Build.0 = Debug|Win32 - {56AD8F54-F89E-4B5A-93F8-8A617BFD1160}.Mixed_Dedicated|x64.ActiveCfg = Release|Win32 - {56AD8F54-F89E-4B5A-93F8-8A617BFD1160}.Mixed_Dedicated|x64.Build.0 = Release|Win32 - {56AD8F54-F89E-4B5A-93F8-8A617BFD1160}.Mixed_Dedicated|x86.ActiveCfg = Release|Win32 - {56AD8F54-F89E-4B5A-93F8-8A617BFD1160}.Mixed|x64.ActiveCfg = Release|Win32 - {56AD8F54-F89E-4B5A-93F8-8A617BFD1160}.Mixed|x64.Build.0 = Release|Win32 - {56AD8F54-F89E-4B5A-93F8-8A617BFD1160}.Mixed|x86.ActiveCfg = Release|Win32 - {56AD8F54-F89E-4B5A-93F8-8A617BFD1160}.Mixed|x86.Build.0 = Release|Win32 - {56AD8F54-F89E-4B5A-93F8-8A617BFD1160}.Release_Dedicated|x64.ActiveCfg = Release|Win32 - {56AD8F54-F89E-4B5A-93F8-8A617BFD1160}.Release_Dedicated|x64.Build.0 = Release|Win32 - {56AD8F54-F89E-4B5A-93F8-8A617BFD1160}.Release_Dedicated|x86.ActiveCfg = Release|Win32 - {56AD8F54-F89E-4B5A-93F8-8A617BFD1160}.Release|x64.ActiveCfg = Release|Win32 - {56AD8F54-F89E-4B5A-93F8-8A617BFD1160}.Release|x86.ActiveCfg = Release|Win32 - {56AD8F54-F89E-4B5A-93F8-8A617BFD1160}.Release|x86.Build.0 = Release|Win32 - {C2A6CB42-D6EC-4045-9452-B73FE1A4FABB}.Debug_Dedicated|x64.ActiveCfg = Release|Win32 - {C2A6CB42-D6EC-4045-9452-B73FE1A4FABB}.Debug_Dedicated|x64.Build.0 = Release|Win32 - {C2A6CB42-D6EC-4045-9452-B73FE1A4FABB}.Debug_Dedicated|x86.ActiveCfg = Debug|Win32 - {C2A6CB42-D6EC-4045-9452-B73FE1A4FABB}.Debug|x64.ActiveCfg = Debug|Win32 - {C2A6CB42-D6EC-4045-9452-B73FE1A4FABB}.Debug|x86.ActiveCfg = Debug|Win32 - {C2A6CB42-D6EC-4045-9452-B73FE1A4FABB}.Debug|x86.Build.0 = Debug|Win32 - {C2A6CB42-D6EC-4045-9452-B73FE1A4FABB}.Mixed_Dedicated|x64.ActiveCfg = Release|Win32 - {C2A6CB42-D6EC-4045-9452-B73FE1A4FABB}.Mixed_Dedicated|x64.Build.0 = Release|Win32 - {C2A6CB42-D6EC-4045-9452-B73FE1A4FABB}.Mixed_Dedicated|x86.ActiveCfg = Release|Win32 - {C2A6CB42-D6EC-4045-9452-B73FE1A4FABB}.Mixed|x64.ActiveCfg = Release|Win32 - {C2A6CB42-D6EC-4045-9452-B73FE1A4FABB}.Mixed|x64.Build.0 = Release|Win32 - {C2A6CB42-D6EC-4045-9452-B73FE1A4FABB}.Mixed|x86.ActiveCfg = Release|Win32 - {C2A6CB42-D6EC-4045-9452-B73FE1A4FABB}.Mixed|x86.Build.0 = Release|Win32 - {C2A6CB42-D6EC-4045-9452-B73FE1A4FABB}.Release_Dedicated|x64.ActiveCfg = Release|Win32 - {C2A6CB42-D6EC-4045-9452-B73FE1A4FABB}.Release_Dedicated|x64.Build.0 = Release|Win32 - {C2A6CB42-D6EC-4045-9452-B73FE1A4FABB}.Release_Dedicated|x86.ActiveCfg = Release|Win32 - {C2A6CB42-D6EC-4045-9452-B73FE1A4FABB}.Release|x64.ActiveCfg = Release|Win32 - {C2A6CB42-D6EC-4045-9452-B73FE1A4FABB}.Release|x86.ActiveCfg = Release|Win32 - {C2A6CB42-D6EC-4045-9452-B73FE1A4FABB}.Release|x86.Build.0 = Release|Win32 - {F5FE7239-50EB-4AC0-AD32-6374C1A6DD6C}.Debug_Dedicated|x64.ActiveCfg = Release|Win32 - {F5FE7239-50EB-4AC0-AD32-6374C1A6DD6C}.Debug_Dedicated|x64.Build.0 = Release|Win32 - {F5FE7239-50EB-4AC0-AD32-6374C1A6DD6C}.Debug_Dedicated|x86.ActiveCfg = Debug|Win32 - {F5FE7239-50EB-4AC0-AD32-6374C1A6DD6C}.Debug|x64.ActiveCfg = Debug|Win32 - {F5FE7239-50EB-4AC0-AD32-6374C1A6DD6C}.Debug|x86.ActiveCfg = Debug|Win32 - {F5FE7239-50EB-4AC0-AD32-6374C1A6DD6C}.Debug|x86.Build.0 = Debug|Win32 - {F5FE7239-50EB-4AC0-AD32-6374C1A6DD6C}.Mixed_Dedicated|x64.ActiveCfg = Release|Win32 - {F5FE7239-50EB-4AC0-AD32-6374C1A6DD6C}.Mixed_Dedicated|x64.Build.0 = Release|Win32 - {F5FE7239-50EB-4AC0-AD32-6374C1A6DD6C}.Mixed_Dedicated|x86.ActiveCfg = Release|Win32 - {F5FE7239-50EB-4AC0-AD32-6374C1A6DD6C}.Mixed|x64.ActiveCfg = Release|Win32 - {F5FE7239-50EB-4AC0-AD32-6374C1A6DD6C}.Mixed|x64.Build.0 = Release|Win32 - {F5FE7239-50EB-4AC0-AD32-6374C1A6DD6C}.Mixed|x86.ActiveCfg = Release|Win32 - {F5FE7239-50EB-4AC0-AD32-6374C1A6DD6C}.Mixed|x86.Build.0 = Release|Win32 - {F5FE7239-50EB-4AC0-AD32-6374C1A6DD6C}.Release_Dedicated|x64.ActiveCfg = Release|Win32 - {F5FE7239-50EB-4AC0-AD32-6374C1A6DD6C}.Release_Dedicated|x64.Build.0 = Release|Win32 - {F5FE7239-50EB-4AC0-AD32-6374C1A6DD6C}.Release_Dedicated|x86.ActiveCfg = Release|Win32 - {F5FE7239-50EB-4AC0-AD32-6374C1A6DD6C}.Release|x64.ActiveCfg = Release|Win32 - {F5FE7239-50EB-4AC0-AD32-6374C1A6DD6C}.Release|x86.ActiveCfg = Release|Win32 - {F5FE7239-50EB-4AC0-AD32-6374C1A6DD6C}.Release|x86.Build.0 = Release|Win32 - {C928FBB1-EDD8-4198-90DC-170A54C2AD72}.Debug_Dedicated|x64.ActiveCfg = Release|Win32 - {C928FBB1-EDD8-4198-90DC-170A54C2AD72}.Debug_Dedicated|x64.Build.0 = Release|Win32 - {C928FBB1-EDD8-4198-90DC-170A54C2AD72}.Debug_Dedicated|x86.ActiveCfg = Debug|Win32 - {C928FBB1-EDD8-4198-90DC-170A54C2AD72}.Debug|x64.ActiveCfg = Debug|Win32 - {C928FBB1-EDD8-4198-90DC-170A54C2AD72}.Debug|x86.ActiveCfg = Debug|Win32 - {C928FBB1-EDD8-4198-90DC-170A54C2AD72}.Debug|x86.Build.0 = Debug|Win32 - {C928FBB1-EDD8-4198-90DC-170A54C2AD72}.Mixed_Dedicated|x64.ActiveCfg = Release|Win32 - {C928FBB1-EDD8-4198-90DC-170A54C2AD72}.Mixed_Dedicated|x64.Build.0 = Release|Win32 - {C928FBB1-EDD8-4198-90DC-170A54C2AD72}.Mixed_Dedicated|x86.ActiveCfg = Release|Win32 - {C928FBB1-EDD8-4198-90DC-170A54C2AD72}.Mixed|x64.ActiveCfg = Release|Win32 - {C928FBB1-EDD8-4198-90DC-170A54C2AD72}.Mixed|x64.Build.0 = Release|Win32 - {C928FBB1-EDD8-4198-90DC-170A54C2AD72}.Mixed|x86.ActiveCfg = Release|Win32 - {C928FBB1-EDD8-4198-90DC-170A54C2AD72}.Mixed|x86.Build.0 = Release|Win32 - {C928FBB1-EDD8-4198-90DC-170A54C2AD72}.Release_Dedicated|x64.ActiveCfg = Release|Win32 - {C928FBB1-EDD8-4198-90DC-170A54C2AD72}.Release_Dedicated|x64.Build.0 = Release|Win32 - {C928FBB1-EDD8-4198-90DC-170A54C2AD72}.Release_Dedicated|x86.ActiveCfg = Release|Win32 - {C928FBB1-EDD8-4198-90DC-170A54C2AD72}.Release|x64.ActiveCfg = Release|Win32 - {C928FBB1-EDD8-4198-90DC-170A54C2AD72}.Release|x86.ActiveCfg = Release|Win32 - {C928FBB1-EDD8-4198-90DC-170A54C2AD72}.Release|x86.Build.0 = Release|Win32 - {84D91673-C1A1-47FF-9A75-4E73F31F4C63}.Debug_Dedicated|x64.ActiveCfg = Release|Win32 - {84D91673-C1A1-47FF-9A75-4E73F31F4C63}.Debug_Dedicated|x64.Build.0 = Release|Win32 - {84D91673-C1A1-47FF-9A75-4E73F31F4C63}.Debug_Dedicated|x86.ActiveCfg = Debug|Win32 - {84D91673-C1A1-47FF-9A75-4E73F31F4C63}.Debug|x64.ActiveCfg = Debug|Win32 - {84D91673-C1A1-47FF-9A75-4E73F31F4C63}.Debug|x86.ActiveCfg = Debug|Win32 - {84D91673-C1A1-47FF-9A75-4E73F31F4C63}.Debug|x86.Build.0 = Debug|Win32 - {84D91673-C1A1-47FF-9A75-4E73F31F4C63}.Mixed_Dedicated|x64.ActiveCfg = Release|Win32 - {84D91673-C1A1-47FF-9A75-4E73F31F4C63}.Mixed_Dedicated|x64.Build.0 = Release|Win32 - {84D91673-C1A1-47FF-9A75-4E73F31F4C63}.Mixed_Dedicated|x86.ActiveCfg = Release|Win32 - {84D91673-C1A1-47FF-9A75-4E73F31F4C63}.Mixed|x64.ActiveCfg = Release|Win32 - {84D91673-C1A1-47FF-9A75-4E73F31F4C63}.Mixed|x64.Build.0 = Release|Win32 - {84D91673-C1A1-47FF-9A75-4E73F31F4C63}.Mixed|x86.ActiveCfg = Release|Win32 - {84D91673-C1A1-47FF-9A75-4E73F31F4C63}.Mixed|x86.Build.0 = Release|Win32 - {84D91673-C1A1-47FF-9A75-4E73F31F4C63}.Release_Dedicated|x64.ActiveCfg = Release|Win32 - {84D91673-C1A1-47FF-9A75-4E73F31F4C63}.Release_Dedicated|x64.Build.0 = Release|Win32 - {84D91673-C1A1-47FF-9A75-4E73F31F4C63}.Release_Dedicated|x86.ActiveCfg = Release|Win32 - {84D91673-C1A1-47FF-9A75-4E73F31F4C63}.Release|x64.ActiveCfg = Release|Win32 - {84D91673-C1A1-47FF-9A75-4E73F31F4C63}.Release|x86.ActiveCfg = Release|Win32 - {84D91673-C1A1-47FF-9A75-4E73F31F4C63}.Release|x86.Build.0 = Release|Win32 {3F383D3C-FCD8-4170-990B-EB4833F09248}.Debug_Dedicated|x64.ActiveCfg = Release|Win32 {3F383D3C-FCD8-4170-990B-EB4833F09248}.Debug_Dedicated|x64.Build.0 = Release|Win32 {3F383D3C-FCD8-4170-990B-EB4833F09248}.Debug_Dedicated|x86.ActiveCfg = Debug|Win32 @@ -1318,12 +1018,8 @@ Global HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {901F5C6A-BA06-4727-B9BC-762891749A46} = {A074ECE0-24F4-497F-99BD-AD45D5C51382} - {68CB7CEC-F907-47AD-B624-B8432F53AAE3} = {A074ECE0-24F4-497F-99BD-AD45D5C51382} - {AB0D87B3-0937-4B2D-AB01-7A613B3EEF0D} = {A074ECE0-24F4-497F-99BD-AD45D5C51382} {566551F4-4EF1-4CB4-A131-F982E7606907} = {2BFC806B-CE92-4EA4-8FE8-5F2EA54BA348} {0899B131-F1D4-4876-9BA1-67AC821DB9E1} = {3FC858CB-4888-42FF-ABC5-82DAECB59C2C} - {F1066EAC-EE25-4C7A-9023-5957A6F7BA27} = {A074ECE0-24F4-497F-99BD-AD45D5C51382} {C961EA19-716C-4A6D-BB13-689F8FB78B01} = {89F6A7EE-3BBE-45D3-A8A8-5D9366CD987B} {2FAAC8BA-369F-465E-B465-2235963FD377} = {89F6A7EE-3BBE-45D3-A8A8-5D9366CD987B} {65CBB9D0-FBC6-41A4-8316-F5E9B5D7FB33} = {89F6A7EE-3BBE-45D3-A8A8-5D9366CD987B} @@ -1335,19 +1031,6 @@ Global {A4ABD75E-825B-4D09-B3B2-2709682E40C8} = {89F6A7EE-3BBE-45D3-A8A8-5D9366CD987B} {F1836CE2-59EF-4189-8B9C-D103A511CB27} = {89F6A7EE-3BBE-45D3-A8A8-5D9366CD987B} {3AD26FD3-4F52-4E22-A4CF-AD4C49E74C61} = {89F6A7EE-3BBE-45D3-A8A8-5D9366CD987B} - {F573DE85-0866-4775-955F-6C3241D2AE70} = {AB0D87B3-0937-4B2D-AB01-7A613B3EEF0D} - {F573DE85-0866-4775-955F-6C3241D2AE75} = {AB0D87B3-0937-4B2D-AB01-7A613B3EEF0D} - {F573DE85-0866-4775-955F-6C3241D2AE80} = {AB0D87B3-0937-4B2D-AB01-7A613B3EEF0D} - {6BA3121A-ACBC-4685-9246-4549CA1EFFFD} = {AB0D87B3-0937-4B2D-AB01-7A613B3EEF0D} - {39EE310B-4F1D-4716-A39F-4AB844DB3670} = {AB0D87B3-0937-4B2D-AB01-7A613B3EEF0D} - {39EE310B-4F1D-4716-A39F-4AB844DB3675} = {AB0D87B3-0937-4B2D-AB01-7A613B3EEF0D} - {39EE310B-4F1D-4716-A39F-4AB844DB3680} = {AB0D87B3-0937-4B2D-AB01-7A613B3EEF0D} - {93AD3B7E-71DE-4FA2-90E7-A79782ED4960} = {901F5C6A-BA06-4727-B9BC-762891749A46} - {56AD8F54-F89E-4B5A-93F8-8A617BFD1160} = {901F5C6A-BA06-4727-B9BC-762891749A46} - {C2A6CB42-D6EC-4045-9452-B73FE1A4FABB} = {68CB7CEC-F907-47AD-B624-B8432F53AAE3} - {F5FE7239-50EB-4AC0-AD32-6374C1A6DD6C} = {68CB7CEC-F907-47AD-B624-B8432F53AAE3} - {C928FBB1-EDD8-4198-90DC-170A54C2AD72} = {68CB7CEC-F907-47AD-B624-B8432F53AAE3} - {84D91673-C1A1-47FF-9A75-4E73F31F4C63} = {68CB7CEC-F907-47AD-B624-B8432F53AAE3} {492D3DFE-9068-4E7E-A008-7C2420A651C0} = {2DDE8FE4-6490-4AC5-B020-7E6A203F6318} {B45374AA-C7ED-42CF-BBD3-DEAA2B7ACB48} = {2DDE8FE4-6490-4AC5-B020-7E6A203F6318} {CC52E0B3-CC35-4934-9302-035B748F3F2C} = {2BFC806B-CE92-4EA4-8FE8-5F2EA54BA348} diff --git a/cs/engine/plugins/Max/Export/BoneDef.cpp b/cs/engine/plugins/Max/Export/BoneDef.cpp deleted file mode 100644 index ffb7c6a7a..000000000 --- a/cs/engine/plugins/Max/Export/BoneDef.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#include "stdafx.h" -#include "..\..\Shared\BoneDef.h" -#include "Exporter.h" -#include "MeshExpUtility.h" - -CBoneDef::CBoneDef(INode* pNode) -{ - parent = 0; - pBone = pNode; - name = Helper::ConvertSpace(string(pBone->GetName())); - - matInit.identity(); - matOffset.identity(); -} -LPCSTR CBoneDef::GetParentName() -{ - INode* node=pBone->GetParentNode(); - if (Helper::IsBone(node,U.m_SkinAllowDummy)) return node->GetName(); - return 0; -} -BOOL CBoneDef::SetInitTM(IPhysiqueExport* pExport, const Matrix3& matMesh) -{ - BOOL bErr = false; - R_ASSERT(pBone); - R_ASSERT(Helper::IsBone(pBone,U.m_SkinAllowDummy)); - Matrix3 tmp; - //Log("SetInitTM:",pBone->GetName()); - if(Helper::IsBipedBone(pBone)) { - Helper::SetBipedUniform(pBone, TRUE, TRUE); - bErr = CGINTM(pBone,pExport->GetInitNodeTM(pBone, tmp)); - if (bErr) tmp.IdentityMatrix(); - Helper::SetBipedUniform(pBone, FALSE, FALSE); - } else { - bErr = CGINTM(pBone,pExport->GetInitNodeTM(pBone, tmp)); - if (bErr) tmp.IdentityMatrix(); - } - - if (1){//!bErr){ - Helper::ConvertMatrix(tmp,matInit); - matOffset.invert(matInit); - //S matMesh -// pBone->matOffset = matMesh * Inverse(pBone->matInit); - } - - return 1;//!bErr; -} diff --git a/cs/engine/plugins/Max/Export/EditMeshExportMAX.cpp b/cs/engine/plugins/Max/Export/EditMeshExportMAX.cpp deleted file mode 100644 index b7b3bee01..000000000 --- a/cs/engine/plugins/Max/Export/EditMeshExportMAX.cpp +++ /dev/null @@ -1,267 +0,0 @@ -//---------------------------------------------------- -// file: EditMesh.cpp -//---------------------------------------------------- -#include "stdafx.h" -#pragma hdrstop - -//#include "..\..\Shared\EditMesh.h" -//#include "..\..\Shared\EditObject.h" - -#include "..\..\..\editors\ECore\Editor\EditMesh.h" -#include "..\..\..\editors\ECore\Editor\EditObject.h" - -#include "MeshExpUtility.h" - -#include "Exporter.h" -#include "..\..\Shared\GameMaterial.h" -//---------------------------------------------------- -void CEditableMesh::FlipFaces(){ - VERIFY(m_Faces); - for(u32 f = 0; fEvalWorldState(0).obj; - if (obj->CanConvertToType(Class_ID(TRIOBJ_CLASS_ID, 0))) { - TriObject *tri = (TriObject *) obj->ConvertToType(0, - Class_ID(TRIOBJ_CLASS_ID, 0)); - // Note that the TriObject should only be deleted - // if the pointer to it is not equal to the object - // pointer that called ConvertToType() - if (obj != tri) deleteIt = TRUE; - return tri; - }else{ - return NULL; - } -} -//---------------------------------------------------------------------------- - -bool CEditableMesh::Convert( INode *node ) -{ - // prepares & checks - BOOL bDeleteObj; - bool bResult = true; - TriObject *obj = ExtractTriObject( node, bDeleteObj ); - - if( !obj ){ - ELog.Msg(mtError,"%s -> Can't convert to TriObject", node->GetName() ); - return false; } - - if( obj->mesh.getNumFaces() <=0 ){ - ELog.Msg(mtError,"%s -> There are no faces ?", node->GetName() ); - if (bDeleteObj) delete (obj); - return false; } - - Mtl *pMtlMain = node->GetMtl(); - DWORD cSubMaterials=0; - - if (pMtlMain){ - // There is at least one material. We're in case 1) or 2) - cSubMaterials = pMtlMain->NumSubMtls(); - if (cSubMaterials < 1){ - // Count the material itself as a submaterial. - cSubMaterials = 1; - } - } - - // build normals - obj->mesh.buildRenderNormals(); - - // vertices - m_VertCount = obj->mesh.getNumVerts(); - m_Vertices = xr_alloc(m_VertCount); - for (int v_i=0; v_imesh.verts+v_i; - m_Vertices[v_i].set(p->x,p->y,p->z); - } - - // set smooth group MAX type - m_Flags.set(flSGMask,TRUE); - - // faces - m_FaceCount = obj->mesh.getNumFaces(); - m_Faces = xr_alloc (m_FaceCount); - m_SmoothGroups = xr_alloc (m_FaceCount); - - m_VMRefs.reserve(m_FaceCount*3); - if (0==obj->mesh.mapFaces(1)) - { - bResult = false; - ELog.Msg(mtError,"'%s' hasn't UV mapping!", node->GetName()); - } - if (bResult) - { - CSurface* surf=0; - for (int f_i=0; f_imesh.faces+f_i; - TVFace* tf = obj->mesh.mapFaces(1) + f_i; - if (!tf) - { - bResult = false; - ELog.Msg(mtError,"'%s' hasn't UV mapping!", node->GetName()); - break; - } - m_SmoothGroups[f_i] = vf->getSmGroup(); - for (int k=0; k<3; ++k) - { - m_Faces[f_i].pv[k].pindex = vf->v[k]; - m_VMRefs.push_back(st_VMapPtLst()); - st_VMapPtLst& vm_lst = m_VMRefs.back(); - vm_lst.count = 1; - vm_lst.pts = xr_alloc(vm_lst.count); - for (DWORD vm_i=0; vm_it[k]; - } - m_Faces[f_i].pv[k].vmref = m_VMRefs.size()-1; - if (!bResult) break; - } - if (pMtlMain) - { - int m_id = obj->mesh.getFaceMtlIndex(f_i); - if (cSubMaterials == 1) - { - m_id = 0; - }else - { - // SDK recommends mod'ing the material ID by the valid # of materials, - // as sometimes a material number that's too high is returned. - m_id %= cSubMaterials; - } - surf = m_Parent->CreateSurface(pMtlMain,m_id); - if (!surf) bResult = false; - } - if (!bResult) break; - m_SurfFaces[surf].push_back(f_i); - } - } - - // vmaps - if( bResult ){ - int vm_cnt = obj->mesh.getNumTVerts(); - m_VMaps.resize(1); - st_VMap*& VM = m_VMaps.back(); - VM = new st_VMap("Texture",vmtUV,false); - for (int tx_i=0; tx_imesh.tVerts + tx_i; - VM->appendUV(tv->x,1-tv->y); - } - } - - if ((GetVertexCount()<4)||(GetFaceCount()<2)) - { - ELog.Msg(mtError,"Invalid mesh: '%s'. Faces<2 or Verts<4"); - bResult = false; - } - - if (bResult ){ - ELog.Msg(mtInformation,"Model '%s' contains: %d points, %d faces", - node->GetName(), m_VertCount, m_FaceCount); - } - - if (bResult) - { - RecomputeBBox (); - OptimizeMesh (false); - RebuildVMaps (); - ELog.Msg(mtInformation,"Model '%s' converted: %d points, %d faces", - node->GetName(), GetVertexCount(), GetFaceCount()); - } - - if (bDeleteObj) delete (obj); - return bResult; -} -//---------------------------------------------------------------------------- - -bool CEditableMesh::Convert(CExporter* E) -{ - bool bResult = true; - - m_Name = E->m_MeshNode->GetName(); - - // maps - // Weight maps - m_VMaps.resize(E->m_Bones.size()+1); - for (DWORD b_i=0; b_im_Bones.size(); b_i++) - m_VMaps[b_i] = new st_VMap(E->m_Bones[b_i]->name.c_str(),vmtWeight,false);; - // UV map - int VM_UV_idx = m_VMaps.size()-1; - st_VMap*& VM_UV = m_VMaps[VM_UV_idx]; - VM_UV = new st_VMap("texture",vmtUV,false); - - // points - { - m_VertCount = E->m_ExpVertices.size(); - m_Vertices = xr_alloc(m_VertCount); - Fvector* p_it = m_Vertices; - - for (ExpVertIt ev_it=E->m_ExpVertices.begin(); ev_it!=E->m_ExpVertices.end(); ev_it++,p_it++){ - p_it->set ((*ev_it)->P); - VM_UV->appendUV ((*ev_it)->uv.x,(*ev_it)->uv.y); - } - } - // faces - { - // set smooth group MAX type - m_Flags.set(flSGMask,TRUE); - // reserve space for faces and references - m_FaceCount = E->m_ExpFaces.size(); - m_Faces = xr_alloc (m_FaceCount); - m_SmoothGroups = xr_alloc (m_FaceCount); - m_VMRefs.resize (m_VertCount); - - int f_id=0; - for (ExpFaceIt ef_it=E->m_ExpFaces.begin(); ef_it!=E->m_ExpFaces.end(); ef_it++,f_id++){ - // FACES - m_SmoothGroups[f_id] = (*ef_it)->sm_group; - st_Face& F = m_Faces[f_id]; - for (int k=0; k<3; ++k) - { - int v_idx = (*ef_it)->v[k]; - st_FaceVert& vt = F.pv[k]; - st_VERT* V = E->m_ExpVertices[v_idx]; - vt.pindex = v_idx; - st_VMapPtLst& vm_lst= m_VMRefs[vt.pindex]; - vm_lst.count = V->data.size()+1; - vm_lst.pts = xr_alloc(vm_lst.count); - vm_lst.pts[0].vmap_index= VM_UV_idx; - vm_lst.pts[0].index = vt.pindex; - for (VDIt vd_it=V->data.begin(); vd_it!=V->data.end(); vd_it++){ - DWORD idx = vd_it-V->data.begin()+1; - st_VMap* vm = m_VMaps[vd_it->bone]; - vm->appendW (vd_it->weight); - vm_lst.pts[idx].vmap_index = vd_it->bone; - vm_lst.pts[idx].index = vm->size()-1; - } - vt.vmref = vt.pindex; - } - CSurface* surf = m_Parent->CreateSurface(E->m_MtlMain,(*ef_it)->m_id); - if (!surf){ - bResult = FALSE; - break; - } - m_SurfFaces[surf].push_back(f_id); - } - } - if ((GetVertexCount()<4)||(GetFaceCount()<2)) - { - Log("! Invalid mesh: '%s'. Faces<2 or Verts<4",*Name()); - bResult = false; - } - if (bResult) - { - RecomputeBBox (); - OptimizeMesh (true);//false); - RebuildVMaps (); - } - return bResult; -} diff --git a/cs/engine/plugins/Max/Export/EditObjectExportLWO.cpp b/cs/engine/plugins/Max/Export/EditObjectExportLWO.cpp deleted file mode 100644 index 3918fe129..000000000 --- a/cs/engine/plugins/Max/Export/EditObjectExportLWO.cpp +++ /dev/null @@ -1,92 +0,0 @@ -#include "stdafx.h" -#pragma hdrstop - -#include "..\..\..\editors\ECore\Editor\EditObject.h" -#include "..\..\..\editors\ECore\Editor\EditMesh.h" -#include "FS2.h" - -int FindLPCSTR(LPCSTRVec& vec, LPCSTR key){ - for (LPCSTRIt it=vec.begin(); it!=vec.end(); it++) - if (0==xr_strcmp(*it,key)) return it-vec.begin(); - return -1; -} - -bool CEditableObject::ExportLWO(LPCSTR fname) -{ - CLWMemoryStream* F = new CLWMemoryStream(); - - LPCSTRVec images; - - F->begin_save(); - // tags - F->open_chunk(ID_TAGS); - for (SurfaceIt s_it=m_Surfaces.begin(); s_it!=m_Surfaces.end(); s_it++){ - CSurface* S=*s_it; - F->w_stringZ(S->_Name()); - S->tag = s_it-m_Surfaces.begin(); - if (FindLPCSTR(images,S->_Texture())<0) images.push_back(S->_Texture()); - } - F->close_chunk(); - // images - for (LPCSTRIt im_it=images.begin(); im_it!=images.end(); im_it++){ - F->open_chunk(ID_CLIP); - F->w_u32(im_it-images.begin()); - F->open_subchunk(ID_STIL); - F->w_stringZ(*im_it); - F->close_subchunk(); - F->close_chunk (); - } - // surfaces - for (s_it=m_Surfaces.begin(); s_it!=m_Surfaces.end(); s_it++){ - CSurface* S=*s_it; - int im_idx=FindLPCSTR(images,S->_Texture()); - R_ASSERT(im_idx>=0); - LPCSTR vm_name=S->_VMap(); - F->Wsurface(S->_Name(),S->m_Flags.is(CSurface::sf2Sided),(u16)im_idx,(vm_name&&vm_name[0])?vm_name:"Texture",S->_ShaderName(),S->_ShaderXRLCName()); - } - // meshes/layers - for (EditMeshIt mesh_it=FirstMesh(); mesh_it!=LastMesh(); mesh_it++){ - CEditableMesh* MESH=*mesh_it; - F->w_layer(u16(mesh_it-FirstMesh()),MESH->Name().c_str()); - // bounding box - F->open_chunk(ID_BBOX); - F->w_vector(MESH->m_Box.min); - F->w_vector(MESH->m_Box.max); - F->close_chunk(); - // points - F->open_chunk(ID_PNTS); - for (u32 point_id=0; point_idGetVCount(); point_id++) - F->w_vector(MESH->GetVertices()[point_id]); - F->close_chunk(); - // polygons - F->open_chunk(ID_POLS); - F->w_u32(ID_FACE); - for (u32 f_id=0; f_idGetFCount(); f_id++) - F->w_face3(MESH->GetFaces()[f_id].pv[0].pindex,MESH->GetFaces()[f_id].pv[1].pindex,MESH->GetFaces()[f_id].pv[2].pindex); - F->close_chunk(); - // surf<->face - F->open_chunk(ID_PTAG); - F->w_u32(ID_SURF); - for (SurfFacesPairIt sf_it=MESH->m_SurfFaces.begin(); sf_it!=MESH->m_SurfFaces.end(); sf_it++){ - IntVec& lst = sf_it->second; - for (IntIt i_it=lst.begin(); i_it!=lst.end(); i_it++){ - F->w_vx (*i_it); - F->w_u16(WORD(sf_it->first->tag)); - } - } - F->close_chunk(); - // vmap&vmad - for (VMapIt vm_it=MESH->m_VMaps.begin(); vm_it!=MESH->m_VMaps.end(); vm_it++){ - st_VMap* vmap = *vm_it; - F->begin_vmap(vmap->polymap, (vmap->type==vmtUV)?ID_TXUV:ID_WGHT, vmap->dim, vmap->name.c_str()); - if (vmap->polymap) for (int k=0; ksize(); k++) F->w_vmad(vmap->vindices[k],vmap->pindices[k],vmap->dim,vmap->getVMdata(k)); - else for (int k=0; ksize(); k++) F->w_vmap(vmap->vindices[k],vmap->dim,vmap->getVMdata(k)); - F->end_vmap(); - } - } - F->end_save(fname); - - xr_delete(F); - - return true; -} diff --git a/cs/engine/plugins/Max/Export/EditObjectExportMAX.cpp b/cs/engine/plugins/Max/Export/EditObjectExportMAX.cpp deleted file mode 100644 index a1d5785df..000000000 --- a/cs/engine/plugins/Max/Export/EditObjectExportMAX.cpp +++ /dev/null @@ -1,188 +0,0 @@ -//---------------------------------------------------- -// file: CEditableObject.cpp -//---------------------------------------------------- - -#include "stdafx.h" -#pragma hdrstop - -#include "..\..\..\editors\ECore\Editor\EditObject.h" -#include "..\..\..\editors\ECore\Editor\EditMesh.h" -#include "Bone.h" -#include "Exporter.h" -#include "..\..\Shared\GameMaterial.h" - -//---------------------------------------------------------------------------- -// Material parsing -//---------------------------------------------------------------------------- -BOOL CEditableObject::ExtractTexName(Texmap *src, LPSTR dest) -{ - if( src->ClassID() != Class_ID(BMTEX_CLASS_ID,0) ) - return FALSE; - BitmapTex *bmap = (BitmapTex*)src; - _splitpath( bmap->GetMapName(), 0, 0, dest, 0 ); - EFS.AppendFolderToName(dest,1,TRUE); - return TRUE; -} - -//---------------------------------------------------------------------------- -BOOL CEditableObject::ParseStdMaterial(StdMat* src, CSurface* dest) -{ - R_ASSERT(src); - R_ASSERT((src->ClassID()==Class_ID(DMTL_CLASS_ID,0))||(src->ClassID()==XRAYMTL_CLASS_ID)); - Msg("- Processing material '%s' ...", src->GetName() ); - // ------- texture (if exist) - string1024 tname; - if( src->MapEnabled( ID_AM ) ){ - if( src->GetSubTexmap( ID_AM ) ){ - if (!ExtractTexName( src->GetSubTexmap( ID_AM ), tname )) return FALSE; - dest->SetTexture(tname); - }else{ - return FALSE; - } - }else if( src->MapEnabled( ID_DI ) ){ - if( src->GetSubTexmap( ID_DI ) ){ - if (!ExtractTexName( src->GetSubTexmap( ID_DI ), tname )) return FALSE; - dest->SetTexture(tname); - }else{ - return FALSE; - } - }else{ - return FALSE; - } - dest->m_Flags.set(CSurface::sf2Sided,!!src->GetTwoSided()); - if (src->GetTwoSided()) ELog.Msg(mtInformation," - material 2-sided"); - dest->SetName(GenerateSurfaceName(src->GetName())); - dest->SetFVF(D3DFVF_XYZ|D3DFVF_NORMAL|(1<SetVMap("Texture"); - dest->SetShader("default"); - dest->SetShaderXRLC("default"); - return TRUE; -} - -BOOL CEditableObject::ParseMultiMaterial(MultiMtl* src, u32 mid, CSurface* dest) -{ - R_ASSERT(src); - R_ASSERT(src->ClassID()==Class_ID(MULTI_CLASS_ID,0)); - Mtl* M = src->GetSubMtl(mid); - if (M){ - if (M->ClassID()==Class_ID(DMTL_CLASS_ID,0)){ - StdMat *smtl = (StdMat*)src->GetSubMtl(mid); - if (!ParseStdMaterial(smtl,dest)){ - ELog.Msg(mtError,"'%s' -> bad submaterial",src->GetName()); - return FALSE; - } - return TRUE; - }else if (M->ClassID()==XRAYMTL_CLASS_ID){ - XRayMtl *smtl = (XRayMtl*)src->GetSubMtl(mid); - if (!ParseXRayMaterial(smtl,mid,dest)){ - ELog.Msg(mtError,"'%s' -> bad submaterial",src->GetName()); - return FALSE; - } - } - return TRUE; - }else{ - ELog.Msg(mtError,"'%s' -> can't extract multi-material items.",src->GetName()); - return FALSE; - } -} - -BOOL CEditableObject::ParseXRayMaterial(XRayMtl* src, u32 mid, CSurface* dest) -{ - R_ASSERT(src); - R_ASSERT(src->ClassID()==XRAYMTL_CLASS_ID); - if (!ParseStdMaterial((StdMat*)src,dest)){ - ELog.Msg(mtError,"'%s' -> bad material",src->GetName()); - return FALSE; - } - LPCSTR e_shader = src->GetEShaderName(); - LPCSTR c_shader = src->GetCShaderName(); - LPCSTR g_mtl = src->GetGameMtlName(); - dest->SetShader (e_shader?e_shader:"default"); - dest->SetShaderXRLC (c_shader?c_shader:"default"); - dest->SetGameMtl (g_mtl?g_mtl:"default"); - if (e_shader&&c_shader&&g_mtl){ - ELog.Msg(mtInformation," -Found S.T.A.L.K.E.R. shaders [E:'%s', C:'%s', M:'%s']", dest->_ShaderName(), dest->_ShaderXRLCName(), dest->_GameMtlName() ); - }else{ - if (!e_shader) ELog.Msg(mtError," *Empty engine shader! Set 'DEFAULT'."); - if (!c_shader) ELog.Msg(mtError," *Empty compiler shader! Set 'DEFAULT'."); - if (!g_mtl) ELog.Msg(mtError," *Empty game material! Set 'DEFAULT'."); - } - return TRUE; -} - -CSurface* CEditableObject::CreateSurface(Mtl* mtl, u32 mid) -{ - if (!mtl){ ELog.Msg(mtError,"Empty material..."); return 0; } - for (SurfaceIt s_it=m_Surfaces.begin(); s_it!=m_Surfaces.end(); s_it++) - if (((*s_it)->mid==mid)&&((*s_it)->mtl==mtl)) return *s_it; - CSurface* S = new CSurface(); - S->mid = mid; - S->mtl = mtl; - Class_ID cls_id = mtl->ClassID(); - BOOL bRes = FALSE; - if (cls_id==Class_ID(MULTI_CLASS_ID,0)) bRes=ParseMultiMaterial ((MultiMtl*)mtl,mid,S); - else if (cls_id==Class_ID(DMTL_CLASS_ID,0)) bRes=ParseStdMaterial ((StdMat*)mtl,S); - else if (cls_id==XRAYMTL_CLASS_ID) bRes=ParseXRayMaterial ((XRayMtl*)mtl,mid,S); - else{ - ELog.Msg (mtError,"'%s' -> unsuported material class...",mtl->GetName()); - xr_delete (S); - return 0; - } - if (!bRes){ - ELog.Msg (mtError,"'%s' -> can't parse material",mtl->GetName()); - return 0; - } - m_Surfaces.push_back(S); - return S; -} -//---------------------------------------------------------------------------- -// Skeleton functions -//---------------------------------------------------------------------------- -bool CEditableObject::ImportMAXSkeleton(CExporter* E) -{ - bool bResult = true; - CEditableMesh* MESH = new CEditableMesh(this); - m_Meshes.push_back(MESH); - // import mesh - if (!MESH->Convert(E)) return FALSE; - // BONES - m_Bones.reserve(E->m_Bones.size()); - for (int B=0; B!=E->m_Bones.size(); B++){ - m_Bones.push_back(new CBone()); - CBone* BONE = m_Bones.back(); - CBoneDef* bone = E->m_Bones[B]; - CBoneDef* parent_bone = bone->parent; - - Fvector offset,rotate; - float length= 0.1f; - - Fmatrix m; - if (parent_bone) m.mul(parent_bone->matOffset,bone->matInit); - else m.set(bone->matInit); - - m.getXYZi (rotate); - offset.set (m.c); - - BONE->SetWMap (bone->name.c_str()); - BONE->SetName (bone->name.c_str()); - BONE->SetParentName (Helper::ConvertSpace(string(bone->pBone->GetParentNode()->GetName())).c_str()); - BONE->SetRestParams (length,offset,rotate); - } - - // DEFAULT BONE PART - m_BoneParts.push_back(SBonePart()); - SBonePart& BP = m_BoneParts.back(); - BP.alias = "default"; - for (int b_i=0; b_i<(int)m_Bones.size(); b_i++) - BP.bones.push_back(Bones()[b_i]->Name()); - - m_objectFlags.set(CEditableObject::eoDynamic,TRUE); - - if ((0==GetVertexCount())||(0==GetFaceCount())){ - bResult = false; - }else{ - ELog.Msg(mtInformation,"Model '%s' contains: %d points, %d faces, %d bones", E->m_MeshNode->GetName(), GetVertexCount(), GetFaceCount(), Bones().size()); - } - - return bResult; -} diff --git a/cs/engine/plugins/Max/Export/ExportKeys.cpp b/cs/engine/plugins/Max/Export/ExportKeys.cpp deleted file mode 100644 index 9282d5ed9..000000000 --- a/cs/engine/plugins/Max/Export/ExportKeys.cpp +++ /dev/null @@ -1,574 +0,0 @@ -#include "stdafx.h" -#pragma hdrstop - -#include "MeshExpUtility.h" -#include "notetrck.h" - -#define BIP_BONE_CLASS_ID 0x00009125 - -#define OBTYPE_MESH 0 -#define OBTYPE_CAMERA 1 -#define OBTYPE_OMNILIGHT 2 -#define OBTYPE_SPOTLIGHT 3 -#define OBTYPE_DUMMY 5 -#define OBTYPE_CTARGET 6 -#define OBTYPE_LTARGET 7 -#define OBTYPE_BONE 8 - -class SceneEntry { -public: - TSTR name; - INode *node,*tnode; - Object *obj; - int type; // See above - int id; - SceneEntry *next; - SceneEntry(INode *n, Object *o, int t); - void SetID(int id) { this->id = id; } -}; - -SceneEntry::SceneEntry(INode *n, Object *o, int t) { - node = n; obj = o; type = t; next = NULL; - tnode = n->GetTarget(); -} -//------------------------------------------------------------------------------- -class SceneEnumProc : public ITreeEnumProc { -public: - SceneEntry* head; - SceneEntry* tail; - int count; - TimeValue time; - SceneEnumProc(INode *root_node, TimeValue t, Interface *i); - ~SceneEnumProc(); - int Count() { return count; } - void Append(INode *node, Object *obj, int type); - int callback( INode *node ); - void BuildNames(); -}; - -void NodeEnum(SceneEnumProc* se, INode* node){ - // For each child of this node, we recurse into ourselves - // until no more children are found. - for (int c = 0; c < node->NumberOfChildren(); c++){ - se->callback(node->GetChildNode(c)); - NodeEnum(se, node->GetChildNode(c)); - } -} - -SceneEnumProc::SceneEnumProc(INode *root_node, TimeValue t, Interface *ip) { - time = t; - count = 0; - head = tail = NULL; - for (int idx = 0; idx < root_node->NumberOfChildren(); idx++){ - this->callback(root_node->GetChildNode(idx)); - NodeEnum(this, root_node->GetChildNode(idx)); - } -} - -SceneEnumProc::~SceneEnumProc() -{ - while(head) { - SceneEntry *next = head->next; - xr_delete(head); - head = next; - } - head = tail = NULL; - count = 0; -} - -int SceneEnumProc::callback(INode *node) -{ - char line[1024]; - Object *obj = node->EvalWorldState(time).obj; - - strcpy(line, node->GetName()); - //if(strstr(line, "Bip") != NULL) - { - sprintf(line, "%08X %08X", obj->SuperClassID(), obj->ClassID()); - // MessageBox(NULL, line, node->GetName(), MB_OK); - } - - if( (obj->SuperClassID() == GEOMOBJECT_CLASS_ID) && - (obj->ClassID() == Class_ID(BIP_BONE_CLASS_ID, 0)) ) - { - Append(node, obj, OBTYPE_BONE); - return TREE_CONTINUE; - } - - if (obj->CanConvertToType(triObjectClassID)) - { - Append(node, obj, OBTYPE_MESH); - return TREE_CONTINUE; - } - - if (node->IsTarget()) - { - INode* ln = node->GetLookatNode(); - if (ln) - { - Object *lobj = ln->EvalWorldState(time).obj; - switch(lobj->SuperClassID()) - { - case LIGHT_CLASS_ID: Append(node, obj, OBTYPE_LTARGET); break; - case CAMERA_CLASS_ID: Append(node, obj, OBTYPE_CTARGET); break; - } - } - return TREE_CONTINUE; - } - switch (obj->SuperClassID()) - { - case HELPER_CLASS_ID: - if ( obj->ClassID()==Class_ID(DUMMY_CLASS_ID,0)) - Append(node, obj, OBTYPE_DUMMY); - if(obj->ClassID() == Class_ID(BONE_CLASS_ID,0)) - Append(node, obj, OBTYPE_BONE); - break; - case LIGHT_CLASS_ID: - if (obj->ClassID()==Class_ID(OMNI_LIGHT_CLASS_ID,0)) - Append(node, obj, OBTYPE_OMNILIGHT); - else - if (obj->ClassID()==Class_ID(SPOT_LIGHT_CLASS_ID,0)) - Append(node, obj, OBTYPE_SPOTLIGHT); - //export DIR_LIGHT and FSPOT_LIGHT???? - break; - case CAMERA_CLASS_ID: - if (obj->ClassID()==Class_ID(LOOKAT_CAM_CLASS_ID,0)) - Append(node, obj, OBTYPE_CAMERA); - break; - } - return TREE_CONTINUE; // Keep on enumeratin'! -} - - -void SceneEnumProc::Append(INode *node, Object *obj, int type) { - SceneEntry *entry = new SceneEntry(node, obj, type); - - if(tail) - tail->next = entry; - tail = entry; - if(!head) - head = entry; - count++; -} - -// We need to maintain a list of the unique objects in the scene -class ObjectEntry { -public: - TriObject *tri; - SceneEntry *entry; - ObjectEntry *next; - ObjectEntry(SceneEntry *e) { entry = e; next = NULL; tri = NULL; } -}; - -class ObjectList { -public: - ObjectEntry *head; - ObjectEntry *tail; - int count; - ObjectList(SceneEnumProc &scene); - ~ObjectList(); - int Count() { return count; } - void Append(SceneEntry *e); - ObjectEntry *Contains(Object *obj); - ObjectEntry *Contains(INode *node); - ObjectEntry *FindLookatNode(INode *node); -}; - -ObjectList::ObjectList(SceneEnumProc &scene) { - head = tail = NULL; - count = 0; - // Zip thru the object list and record all unique objects (Some may be used by more than one node) - int scount = scene.Count(); - for(SceneEntry *se = scene.head; se!=NULL; se = se->next) { - // can't multiple instance lights and cameras in 3DS - // so make them all unique--DS 4/6/96 - if ( (se->type!=OBTYPE_MESH)|| !Contains(se->obj)) - Append(se); - } -} - -ObjectList::~ObjectList() -{ - while(head) { - ObjectEntry *next = head->next; - xr_delete(head); - head = next; - } - head = tail = NULL; - count = 0; -} - -ObjectEntry *ObjectList::Contains(Object *obj) { - ObjectEntry *e; - for (e=head; e!=NULL; e = e->next) { - if(e->entry->obj == obj) - return e; - } - return NULL; -} - -class FindDepNodeEnum: public DependentEnumProc { -public: - ReferenceTarget *targ; - INode *depNode; - FindDepNodeEnum() { targ = NULL; depNode = NULL; } - // proc should return 1 when it wants enumeration to halt. - virtual int proc(ReferenceMaker *rmaker); -}; - -int FindDepNodeEnum::proc(ReferenceMaker *rmaker) { - if (rmaker->SuperClassID()!=BASENODE_CLASS_ID) return 0; - INode* node = (INode *)rmaker; - if (node->GetTarget()==targ) { - depNode = node; - return 1; - } - return 0; -} - -ObjectEntry *ObjectList::FindLookatNode(INode *node) { - FindDepNodeEnum finder; - ObjectEntry *e; - for (e=head; e!=NULL; e = e->next) { - finder.targ = node; - e->entry->node->EnumDependents(&finder); - if (finder.depNode) return e; - } - return NULL; -} - - -ObjectEntry *ObjectList::Contains(INode *node) { - ObjectEntry *e; - for (e=head; e!=NULL; e = e->next) { - if(e->entry->node == node) - return e; - } - return NULL; -} - -void ObjectList::Append(SceneEntry *e) { - ObjectEntry *entry = new ObjectEntry(e); - if(tail) - tail->next = entry; - tail = entry; - if(!head) - head = entry; - count++; -} -ObjectList *theObjects = NULL; - -//----------------------------------------------------------------------------------------------------- -class ObjName { -public: - TSTR name; - ObjName *next; - ObjName(TSTR n) { name = n; next = NULL; } -}; - -class ObjNameList { -public: - ObjName *head; - ObjName *tail; - int count; - ObjNameList() { head = tail = NULL; count = 0; } - ~ObjNameList(); - int Count() { return count; } - int Contains(TSTR &n); - void Append(TSTR &n); - void MakeUnique(TSTR &n); -}; - -ObjNameList::~ObjNameList() -{ - while(head) { - ObjName *next = head->next; - xr_delete(head); - head = next; - } - head = tail = NULL; - count = 0; -} - -int ObjNameList::Contains(TSTR &n) { - ObjName *e = head; - int index = 0; - while(e) { - if(e->name == n) - return index; - e = e->next; - index++; - } - return -1; -} - -void ObjNameList::Append(TSTR &n) { - ObjName *entry = new ObjName(n); - if(tail) - tail->next = entry; - tail = entry; - if(!head) - head = entry; - count++; -} - -void ObjNameList::MakeUnique(TSTR &n) { - // First make it less than 10 chars. - if (n.Length()>10) n.Resize(10); - - if(Contains(n) < 0) { - Append(n); - return; - } - // Make it unique and keep it 10 chars or less - for(int i = 0; i < 100000; ++i) { - char buf[12]; - sprintf(buf,"%d",i); - TSTR num(buf); - TSTR work = n; - int totlen = num.Length() + work.Length(); - if(totlen > 10) - work.Resize(10 - (totlen - 10)); - work = work + num; - if(Contains(work) < 0) { - Append(work); - n = work; - return; - } - } - // Forget it! -} - -ObjNameList theObjNames; -//-------------------------------------------------------------------------------------------------- - - -void SceneEnumProc::BuildNames() -{ - ObjNameList nameList; - SceneEntry *ptr = head; - - while (ptr) { - // if (ptr->node->IsTarget()) { - // ptr->name = _T(""); - // } - // else { - ptr->name = ptr->node->GetName(); - nameList.MakeUnique(ptr->name); - // } - ptr = ptr->next; - } -} -//-------------------------------------------------------------------------------------------------- - - -bool MeshExpUtility::SaveSkinKeys(const char* n){ - CFS_Memory F; - - int FramesPerSecond = GetFrameRate(); - int TicksPerFrame = GetTicksPerFrame(); - int FirstTick = ip->GetAnimRange().Start(); - int LastTick = ip->GetAnimRange().End(); - - Point3 v; - Matrix3 tm; - - // Write signature and version - char S[MAX_PATH]; - sprintf(S, "KEYEXP 3.0"); - F.Wstring(S); - - INode *node; - ObjectEntry *Current; - - //----------------------------------------------------------------------- - // Count bones and report - - int NumBones = 0; - Current = theObjects->head; - while(Current) - { - /* - if(Current->entry->type != OBTYPE_BONE) - { - Current = Current->next; - continue; - } - */ - - NumBones++; - - Current = Current->next; - } - - sprintf(S, "Number of Bones = %d", NumBones); - F.Wstring(S); - ELog.Msg(mtInformation,S); - - //----------------------------------------------------------------------- - // Write out necessary data for motion keys - - sprintf(S, "Key Data"); - F.Wstring(S); - - TimeValue t; - Quat qq; - Point3 tp, sp; - INode* parent; - Matrix3 tmp; - - sprintf(S, "%d %d %d", FirstTick / TicksPerFrame, LastTick / TicksPerFrame, FramesPerSecond); - F.Wstring(S); - - Current = theObjects->head; - while(Current){ - /* - if(Current->entry->type != OBTYPE_BONE) - { - Current = Current->next; - continue; - } - */ - - Matrix3 tm; - - node = Current->entry->node; - - sprintf(S, "Node: %s", node->GetName()); - F.Wstring(S); - ELog.Msg(mtInformation,S); - - // Print notetrack info - { - int NumNT, n, i, j, NumNotes; - NoteTrack* pNT; - DefNoteTrack* pDNT; - NoteKey* pNK; - - NumNT = node->NumNoteTracks(); - - // count all of the notes on all of the notetracks - NumNotes = 0; - for(n=0;nGetNoteTrack(n); - if(pNT->ClassID() == Class_ID(NOTETRACK_CLASS_ID, 0)){ - pDNT = (DefNoteTrack*)pNT; - j = pDNT->NumKeys(); - for(i=0;ikeys[i]; - if( (pNK->time >= FirstTick) && (pNK->time <= LastTick) ) - NumNotes++; - } - } - } - - sprintf(S, "Number of Notes = %d", NumNotes); - F.Wstring(S); - - for(n=0;nGetNoteTrack(n); - if(pNT->ClassID() == Class_ID(NOTETRACK_CLASS_ID, 0)){ - pDNT = (DefNoteTrack*)pNT; - j = pDNT->NumKeys(); - for(i=0;ikeys[i]; - if( (pNK->time >= FirstTick) && (pNK->time <= LastTick) ){ - sprintf(S, "%d: %s", (pNK->time - FirstTick) / TicksPerFrame, pNK->note); - F.Wstring(S); - } - } - } - } - } - - for(t=FirstTick;t<=LastTick;t+=TicksPerFrame){ - tm = node->GetNodeTM(t); - DecomposeMatrix(tm, tp, qq, sp); - qq.MakeMatrix (tm); - tm.SetTrans (tp); - - parent = node->GetParentNode(); - if(parent){ - tmp = parent->GetNodeTM(t); - DecomposeMatrix(tmp, tp, qq, sp); - qq.MakeMatrix(tmp); - tmp.SetTrans(tp); - tmp = Inverse(tmp); - tm *= tmp; - } - - DecomposeMatrix(tm, tp, qq, sp); - sprintf(S,"%f %f %f %f",qq.x, qq.y, qq.z, qq.w); - F.Wstring(S); - sprintf(S,"%f %f %f",tp.x,tp.y,tp.z); - F.Wstring(S); - - /* - // Euler angles - Point3 E; - QuatToEuler (Quat(tm), E); - fprintf (f,"%f %f %f",E.x,E.y,E.z); - - // Translate - DecomposeMatrix (tm, tp, qq, sp); - fprintf (f,"%f %f %f",tp.x,tp.y,tp.z); - */ - -// Matrix3fprint(f, tm); - } - Current = Current->next; - } - - sprintf(S, "Key Data Complete"); - F.Wstring(S); - ELog.Msg(mtInformation,S); - - F.SaveTo(n,0); - - return true; -} - -void MeshExpUtility::ExportSkinKeys(){ - bool bResult = true; - - // Make sure there are nodes we're interested in! - // Ask the scene to enumerate all its nodes so we can determine if there are any we can use - INode *root_node = ip->GetRootNode(); - if(!root_node){ - ELog.Msg(mtError,"Scene empty." ); - ELog.Msg(mtInformation,"-------------------------------------------------------" ); - return; - } - - SceneEnumProc myScene(root_node, ip->GetTime(), ip); - - // Any useful nodes? - if(!myScene.Count()){ - ELog.Msg(mtError,"Scene has no useful nodes." ); - ELog.Msg(mtError,"-------------------------------------------------------" ); - return; - } - - char m_ExportName[MAX_PATH]; - m_ExportName[0]=0; - if( !Engine.FS.GetSaveName(Engine.FS.m_GameKeys,m_ExportName,MAX_PATH,0) ){ - ELog.Msg(mtInformation,"Export cancelled" ); - ELog.Msg(mtInformation,"-------------------------------------------------------" ); - return; - } - - // Construct unique names < 10 chars. - myScene.BuildNames(); - - ObjectList myObjects(myScene); - - theObjects = &myObjects; - - bResult = SaveSkinKeys(m_ExportName); - - ELog.Msg(mtInformation,"-------------------------------------------------------" ); - if (bResult) ELog.Msg(mtInformation,"Export completed" ); - else ELog.Msg(mtError,"Export failed***********************" ); - ELog.Msg(mtInformation,"-------------------------------------------------------" ); -} - diff --git a/cs/engine/plugins/Max/Export/Exporter.cpp b/cs/engine/plugins/Max/Export/Exporter.cpp deleted file mode 100644 index 29efd0492..000000000 --- a/cs/engine/plugins/Max/Export/Exporter.cpp +++ /dev/null @@ -1,451 +0,0 @@ -#include "stdafx.h" -#pragma hdrstop - -#include "Exporter.h" -#include "MeshExpUtility.h" - -// ================================================== FindPhysiqueModifier() -// Find if a given node contains a Physique Modifier -// DerivedObjectPtr requires you include "modstack.h" from the MAX SDK -Modifier* FindPhysiqueModifier (INode* nodePtr) -{ - // Get object from node. Abort if no object. - Object* ObjectPtr = nodePtr->GetObjectRef(); - - if ( NULL == ObjectPtr) return NULL; - - // Is derived object ? - if (ObjectPtr->SuperClassID() == GEN_DERIVOB_CLASS_ID){ - // Yes -> Cast. - IDerivedObject* DerivedObjectPtr = static_cast(ObjectPtr); - - // Iterate over all entries of the modifier stack. - int ModStackIndex = 0; - while (ModStackIndex < DerivedObjectPtr->NumModifiers()){ - // Get current modifier. - Modifier* ModifierPtr = DerivedObjectPtr->GetModifier(ModStackIndex); - Class_ID clsid = ModifierPtr->ClassID(); - // Is this Physique ? - if (ModifierPtr->ClassID() == Class_ID(PHYSIQUE_CLASS_ID_A, PHYSIQUE_CLASS_ID_B)) - { - // Yes -> Exit. - return ModifierPtr; - } - - // Next modifier stack entry. - ModStackIndex++; - } - } - - // Not found. - return NULL; -} - -// ================================================== GetTriObjectFromObjRef -// Return a pointer to a TriObject given an object reference or return NULL -// if the node cannot be converted to a TriObject -TriObject *GetTriObjectFromObjRef(Object* pObj, BOOL *pbDeleteIt) -{ - TriObject *pTri; - - R_ASSERT(pObj); - R_ASSERT(pbDeleteIt); - - *pbDeleteIt = FALSE; - - if (pObj->CanConvertToType(Class_ID(TRIOBJ_CLASS_ID, 0))){ - pTri = (TriObject *) pObj->ConvertToType(0, Class_ID(TRIOBJ_CLASS_ID, 0)); - - // Note that the TriObject should only be deleted - // if the pointer to it is not equal to the object - // pointer that called ConvertToType() - if (pObj != pTri) - *pbDeleteIt = TRUE; - - return pTri; - }else{ - return NULL; - } -} - -// ================================================== IsExportableMesh() -BOOL IsExportableMesh(INode* pNode, Object* &pObj) -{ - ULONG superClassID; - - R_ASSERT(pNode); - pObj = pNode->GetObjectRef(); - - if (pObj == NULL) return FALSE; - - superClassID = pObj->SuperClassID(); - //find out if mesh is renderable - - if( !pNode->Renderable() || pNode->IsNodeHidden()) return FALSE; - - BOOL bFoundGeomObject = FALSE; - //find out if mesh is renderable (more) - switch(superClassID){ - case GEN_DERIVOB_CLASS_ID: - do{ - pObj = ((IDerivedObject*)pObj)->GetObjRef(); - superClassID = pObj->SuperClassID(); - } - while( superClassID == GEN_DERIVOB_CLASS_ID ); - switch(superClassID){ - case GEOMOBJECT_CLASS_ID: - bFoundGeomObject = TRUE; - break; - } - break; - case GEOMOBJECT_CLASS_ID: - bFoundGeomObject = TRUE; - break; - default: - break; - } - - return bFoundGeomObject; -} -//----------------------------------------------------------------------------- - -CExporter::~CExporter() -{ - for (BoneDefIt b_it=m_Bones.begin(); b_it!=m_Bones.end(); b_it++){ - xr_delete(*b_it); - } - for (VertexDefIt v_it=m_Vertices.begin(); v_it!=m_Vertices.end(); v_it++){ - xr_delete(*v_it); - } - for (ExpVertIt ev_it=m_ExpVertices.begin(); ev_it!=m_ExpVertices.end(); ev_it++){ - xr_delete(*ev_it); - } - for (ExpFaceIt ef_it=m_ExpFaces.begin(); ef_it!=m_ExpFaces.end(); ef_it++){ - xr_delete(*ef_it); - } -} -//----------------------------------------------------------------------------- -int CExporter::AddBone(INode* pNode, Matrix3 &matMesh, IPhysiqueExport* pExport) -{ - if (!Helper::IsBone(pNode,U.m_SkinAllowDummy)) return BONE_NONE; - - for (BoneDefIt it=m_Bones.begin(); it!=m_Bones.end(); it++) - if ((*it)->isEqual(pNode)) return it-m_Bones.begin(); - - CBoneDef* pBone= new CBoneDef(pNode); - if (pBone->SetInitTM(pExport,matMesh)){ - AddBone(pBone->pBone->GetParentNode(),matMesh,pExport); - m_Bones.push_back (pBone); - return m_Bones.size()-1; - } - return BONE_NONE; -} - -void CExporter::ScanBones(INode *pNode) -{ - VERIFY (m_Style!=eExportUndef); - R_ASSERT (pNode); - if (Helper::IsBone(pNode,U.m_SkinAllowDummy)) m_AllBones.push_back(pNode); - // process sub-nodes - int cChildren = pNode->NumberOfChildren(); - for (int iChild = 0; iChild < cChildren; iChild++) - ScanBones(pNode->GetChildNode(iChild)); -} - -//----------------------------------------------------------------------------- -void CExporter::ScanMesh(INode *pNode) -{ - if (m_bHasError) return; - - if (!Helper::IsMesh(pNode)){ -// LPCSTR nm = pNode->GetName(); - int cChildren = pNode->NumberOfChildren(); - for (int iChild = 0; iChild < cChildren; iChild++){ -// LPCSTR nm1 = pNode->GetChildNode(iChild)->GetName(); - ScanMesh (pNode->GetChildNode(iChild)); - } - }else{ -// LPCSTR nm = pNode->GetName(); - if (pNode->Selected()){ - if (m_bFindMesh){ - ERR("Single mesh support only."); - m_bHasError = TRUE; - return; - } - m_MeshNode = pNode; - m_bFindMesh = TRUE; - } - } -} -//----------------------------------------------------------------------------- -BOOL CExporter::Capture() -{ - VERIFY (m_Style!=eExportUndef); - Modifier* pPhysique; - IPhysiqueExport* pExport; - IPhyContextExport* pContext; - Object* pObject; - - Matrix3 matMesh; - Matrix3 matZero; - - if (!m_MeshNode){ - ERR("Select mesh and try again."); - m_bHasError=TRUE; - return FALSE; - } - - - pObject = m_MeshNode->GetObjectRef(); - if (!IsExportableMesh(m_MeshNode,pObject)){ - ERR("Can't receive node references."); - m_bHasError=TRUE; - return FALSE; - } - - // Get export interface - pPhysique = FindPhysiqueModifier(m_MeshNode); - if (!pPhysique){ - ERR("Can't find Physique modifier."); - m_bHasError=TRUE; - return FALSE; - } - pExport = (IPhysiqueExport *)pPhysique->GetInterface(I_PHYINTERFACE); - if (!pExport){ - ERR("Can't find Physique interface."); - m_bHasError=TRUE; - return FALSE; - } - - // Get mesh initial transform (used to mult by the bone matrices) - int rval = CGINTM(m_MeshNode,pExport->GetInitNodeTM(m_MeshNode, matMesh)); - matZero.Zero(); - if (rval || matMesh.Equals(matZero, 0.0)){ - ERR("Old CS version. Can't export mesh"); - matMesh.IdentityMatrix(); - } - - // Add hierrarhy parts that has no effect on vertices, - // but required for hierrarhy stability - - if (eExportMotion==m_Style){ - if (m_AllBones.empty()){ - ERR("Invalid skin object. Bone not found."); - return FALSE; - } - - EConsole.ProgressStart((float)m_AllBones.size(),"..Capturing bones"); - for (DWORD i=0; iGetContextInterface(m_MeshNode); - if (!pContext){ - ERR("Can't find Physique context interface."); - return FALSE; - } - - // convert to rigid with blending - pContext->ConvertToRigid(TRUE); - pContext->AllowBlending (TRUE); - - // process vertices - int numVertices = pContext->GetNumberVertices(); - EConsole.ProgressStart(float(numVertices),"..Capturing vertices"); - for (int iVertex = 0; iVertex < numVertices; iVertex++ ){ - IPhyVertexExport *pVertexExport = (IPhyVertexExport *)pContext->GetVertexInterface(iVertex); - R_ASSERT(pVertexExport); - - // What kind of vertices are these? - int iVertexType = pVertexExport->GetVertexType(); - - IPhyRigidVertex* pRigidVertex=(IPhyRigidVertex*)pContext->GetVertexInterface(iVertex); - R_ASSERT (pRigidVertex); - switch (iVertexType){ - case RIGID_TYPE:{ - INode* node = pRigidVertex->GetNode(); - R_ASSERT (node); - LPCSTR nm = node->GetName(); - // get bone and create vertex - CVertexDef* pVertex = AddVertex(); - int boneId = AddBone(node,matMesh,pExport); - if(BONE_NONE==boneId){ - ERR ("Invalid bone: ",node->GetName()); - bRes = FALSE; - }else pVertex->Append (boneId,1.f); - }break; - case RIGID_BLENDED_TYPE:{ - IPhyBlendedRigidVertex* pBlendedRigidVertex=(IPhyBlendedRigidVertex*)pRigidVertex; - int cnt = pBlendedRigidVertex->GetNumberNodes(); - CVertexDef* pVertex = AddVertex(); - for (int i=0; iGetNode(i); - R_ASSERT (node); - LPCSTR nm = node->GetName(); - // get bone and create vertex - int boneId = AddBone(node,matMesh,pExport); - if(BONE_NONE==boneId){ - ERR ("Invalid bone: ",node->GetName()); - bRes = FALSE; - }else pVertex->Append(boneId,pBlendedRigidVertex->GetWeight(i)); - } - }break; - } - - // release vertex - pContext->ReleaseVertexInterface( pRigidVertex ); - - EConsole.ProgressInc(); - - if (!bRes) break; - } - EConsole.ProgressEnd(); - - if (!bRes) return FALSE; - - static int remap[3]; - if (U.m_SkinFlipFaces){ - remap[0] = 0; - remap[1] = 1; - remap[2] = 2; - }else{ - remap[0] = 0; - remap[1] = 2; - remap[2] = 1; - } - - // Process mesh - // Get object from node. Abort if no object. - Log("..Transforming mesh"); - BOOL bDeleteTriObject; - R_ASSERT (pObject); - TriObject * pTriObject = GetTriObjectFromObjRef(pObject, &bDeleteTriObject); - if (!pTriObject){ - ERR("Can't create tri object."); - return FALSE; - } - Mesh& M = pTriObject->mesh; - - // Vertices - { - // check match with - int iNumVert = M.getNumVerts(); - if (!(iNumVert==numVertices && iNumVert==m_Vertices.size())) - { - ERR("Non attached vertices found."); - if (bDeleteTriObject) delete(pTriObject); - return FALSE; - } - - // transform vertices - for (int i=0; iSetPosition(T); - } - } - - Log("..Parsing materials"); - // Parse Materials - m_MtlMain = m_MeshNode->GetMtl(); - R_ASSERT(m_MtlMain); - - DWORD cSubMaterials=m_MtlMain->NumSubMtls(); - if (cSubMaterials < 1) { - // Count the material itself as a submaterial. - cSubMaterials = 1; - } - - // build normals - M.buildRenderNormals(); - - Log("..Converting vertices"); - // our Faces and Vertices - { - for (int i=0; igetMatID(); - if (cSubMaterials == 1){ - m_id = 0; - }else{ - // SDK recommends mod'ing the material ID by the valid # of materials, - // as sometimes a material number that's too high is returned. - m_id %= cSubMaterials; - } - - st_FACE* nF = new st_FACE(); - nF->m_id = m_id; - nF->sm_group = gF->getSmGroup(); - for (int VVV=0; VVV<3; VVV++){ - int vert_id = gF->v[remap[VVV]]; - - CVertexDef &D = *(m_Vertices[vert_id]); - Point3 &UV = M.tVerts[tF->t[remap[VVV]]]; - - st_VERT v; - v.Set (D); - v.P.set (D.P); - v.SetUV (UV.x,1-UV.y); -// v.sm_group = U.m_SkinSuppressSmoothGroup?0:gF->getSmGroup(); // smooth group - nF->v[VVV] = AddVert(v); - } - m_ExpFaces.push_back(nF); - } - } - if (bDeleteTriObject) delete(pTriObject); - } - UpdateParenting(); - - return bRes; -}; - -BOOL MeshExpUtility::SaveAsSkin(const char* fname) -{ - BOOL bRes=true; - if (!(fname&&fname[0])) return false; - - Log ("Exporting..." ); - Log ("-------------------------------------------------------" ); - - INode *pRootNode; - pRootNode = ip->GetRootNode(); - R_ASSERT (pRootNode); - - // export - CExporter *E = new CExporter(); - bRes = E->ExportSkin(pRootNode,fname); - xr_delete (E); - - return bRes; -} -//------------------------------------------------------------------- - -BOOL MeshExpUtility::SaveSkinKeys(LPCSTR fname){ - BOOL bRes=true; - if (!(fname&&fname[0])) return false; - - Log ("Exporting Skin Keys..." ); - Log ("-------------------------------------------------------" ); - - INode *pRootNode; - pRootNode = ip->GetRootNode(); - R_ASSERT (pRootNode); - - // export - CExporter *E = new CExporter(); - bRes = E->ExportMotion(pRootNode,fname); - xr_delete(E); - - return bRes; -} -//------------------------------------------------------------------- diff --git a/cs/engine/plugins/Max/Export/Exporter.h b/cs/engine/plugins/Max/Export/Exporter.h deleted file mode 100644 index 44bae0952..000000000 --- a/cs/engine/plugins/Max/Export/Exporter.h +++ /dev/null @@ -1,99 +0,0 @@ -#pragma once - -#include "..\..\Shared\helper.h" -#include "..\..\Shared\bonedef.h" -#include "..\..\Shared\face.h" - -using INodeVec = xr_vector; -using INodeIt = INodeVec::iterator; - -//----------------------------------------------------------------------------- -IC void ERR(LPCSTR s, LPCSTR dop="") -{ - Msg("! Error: %s%s",s,dop); -} -IC int CGINTM(INode* node, int r) -{ - char* msg = 0; - switch (r) { - case MATRIX_RETURNED: return r; - case NODE_NOT_FOUND: msg = "NODE_NOT_FOUND"; break; - case NO_MATRIX_SAVED: msg = "NO_MATRIX_SAVED"; break; - case INVALID_MOD_POINTER: msg = "INVALID_MOD_POINTER"; break; - } - if (msg) - Msg("* '%s': GetInitNodeTM failed (%s)",node->GetName(),msg); - return r; -} -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -class CExporter -{ - enum EStyle{ - eExportUndef, - eExportSkin, - eExportMotion - }; - EStyle m_Style; - BOOL m_bHasError; -public: - BOOL m_bFindMesh; - INodeVec m_AllBones; - BoneDefVec m_Bones; - VertexDefVec m_Vertices; - - Mtl* m_MtlMain; - INode* m_MeshNode; - - // prepared - ExpVertVec m_ExpVertices; - ExpFaceVec m_ExpFaces; - - // global scale - float m_fGlobalScale; -private: - void ScanBones (INode *pNode); - void ScanMesh (INode *pNode); - BOOL Capture (); - int AddVert (const st_VERT& pTestV) - { - for (ExpVertIt vI=m_ExpVertices.begin(); vI!=m_ExpVertices.end(); vI++) - if ((*vI)->similar(pTestV)) return vI-m_ExpVertices.begin(); - - st_VERT* V = new st_VERT(); - *V = pTestV; - m_ExpVertices.push_back(V); - return m_ExpVertices.size()-1; - } -public: - //----------------------------------------------------------------------------- - CVertexDef* AddVertex () - { - CVertexDef* V = new CVertexDef(); - m_Vertices.push_back(V); - return V; - } - //----------------------------------------------------------------------------- - CBoneDef* FindBone (LPCSTR name) - { - if (name&&name[0]){ - string nm = Helper::ConvertSpace(string(name)); - for (BoneDefIt it=m_Bones.begin(); it!=m_Bones.end(); it++) - if ((*it)->name==nm) return *it; - return 0; - }else - return 0; - } - void UpdateParenting() - { - for (BoneDefIt it=m_Bones.begin(); it!=m_Bones.end(); it++) - (*it)->parent = FindBone((*it)->GetParentName()); - } - int AddBone(INode* pNode, Matrix3 &matMesh, IPhysiqueExport* pExport); -public: - CExporter (){ m_bHasError=FALSE; m_MtlMain=0; m_Style=eExportUndef; m_bFindMesh = FALSE; m_fGlobalScale=1.f; m_MeshNode=0;}; - virtual ~CExporter (); - BOOL ExportSkin (INode *pNode, LPCSTR fname); - BOOL ExportMotion(INode *pNode, LPCSTR fname); -}; diff --git a/cs/engine/plugins/Max/Export/ExporterMotion.cpp b/cs/engine/plugins/Max/Export/ExporterMotion.cpp deleted file mode 100644 index c982cc98f..000000000 --- a/cs/engine/plugins/Max/Export/ExporterMotion.cpp +++ /dev/null @@ -1,91 +0,0 @@ -// xrSKIN_BUILD.cpp : Defines the entry point for the console application. -// - -#include "stdafx.h" - -#include "Exporter.h" -#include "MeshExpUtility.h" -#include "..\..\..\editors\ECore\Editor\EditObject.h" -#include "..\..\..\editors\ECore\Editor\EditMesh.h" -#include "Bone.h" -#include "Motion.h" -#include "Envelope.h" - -BOOL CExporter::ExportMotion(INode* pNode, LPCSTR fname) -{ - m_Style = eExportMotion; - ScanBones (pNode); - int i = U.ip->GetSelNodeCount(); - while (i--) ScanMesh(U.ip->GetSelNode(i)); - if (!Capture()) return FALSE; - if (m_bHasError) return FALSE; - - int iFPS = GetFrameRate(); - int iTPF = GetTicksPerFrame(); - int iStartTick = U.ip->GetAnimRange().Start(); - int iEndTick = U.ip->GetAnimRange().End(); - - // build motion - CSMotion* MOT = new CSMotion(); - MOT->SetParam (iStartTick/iTPF,iEndTick/iTPF,(float)iFPS); - string64 nm; _splitpath(fname,0,0,nm,0); - MOT->SetName (nm); - - BoneMotionVec& BMVec= MOT->BoneMotions(); - BMVec.reserve (m_Bones.size()); - - EConsole.ProgressStart((float)m_Bones.size(),"..Exporting per bone motions"); - Fmatrix tmBone; - for(int boneId = 0; boneId < int(m_Bones.size()); boneId++){ - CBoneDef* bone = m_Bones[boneId]; - //Log("Bone: ",bone->name.c_str()); - - BMVec.push_back(st_BoneMotion()); - st_BoneMotion& BM = BMVec.back(); - BM.SetName(bone->name.c_str()); - - BM.envs[ctPositionX] = new CEnvelope(); - BM.envs[ctPositionY] = new CEnvelope(); - BM.envs[ctPositionZ] = new CEnvelope(); - BM.envs[ctRotationH] = new CEnvelope(); - BM.envs[ctRotationP] = new CEnvelope(); - BM.envs[ctRotationB] = new CEnvelope(); - - BM.envs[ctPositionX]->behavior[0]=1; BM.envs[ctPositionX]->behavior[1]=1; - BM.envs[ctPositionY]->behavior[0]=1; BM.envs[ctPositionY]->behavior[1]=1; - BM.envs[ctPositionZ]->behavior[0]=1; BM.envs[ctPositionZ]->behavior[1]=1; - BM.envs[ctRotationH]->behavior[0]=1; BM.envs[ctRotationH]->behavior[1]=1; - BM.envs[ctRotationP]->behavior[0]=1; BM.envs[ctRotationP]->behavior[1]=1; - BM.envs[ctRotationB]->behavior[0]=1; BM.envs[ctRotationB]->behavior[1]=1; - - TimeValue tick; - st_Key *X,*Y,*Z,*H,*P,*B; - for(tick = iStartTick; tick < iEndTick; tick+=iTPF) - { - X = new st_Key(); Y = new st_Key(); Z = new st_Key(); - H = new st_Key(); P = new st_Key(); B = new st_Key(); - BM.envs[ctPositionX]->keys.push_back(X); BM.envs[ctPositionY]->keys.push_back(Y); BM.envs[ctPositionZ]->keys.push_back(Z); - BM.envs[ctRotationH]->keys.push_back(H); BM.envs[ctRotationP]->keys.push_back(P); BM.envs[ctRotationB]->keys.push_back(B); - // get the bone transformation matrix - bone->CalculateLocalMatrix(tick,tmBone); - - float displacedTime = (float)(tick)/(float)(iTPF*iFPS); - - float h,p,b, x,y,z; - tmBone.getHPB(h,p,b); - - x=tmBone.c.x; y=tmBone.c.y; z=tmBone.c.z; - X->time = displacedTime; Y->time = displacedTime; Z->time = displacedTime; - H->time = displacedTime; P->time = displacedTime; B->time = displacedTime; - X->shape = 4; Y->shape = 4; Z->shape = 4; - H->shape = 4; P->shape = 4; B->shape = 4; - X->value = x; Y->value = y; Z->value = z; - H->value =-h; P->value =-p; B->value =-b; - } - EConsole.ProgressInc(); - } - EConsole.ProgressEnd(); - MOT->SaveMotion(fname); - xr_delete(MOT); - return TRUE; -} diff --git a/cs/engine/plugins/Max/Export/ExporterSkin.cpp b/cs/engine/plugins/Max/Export/ExporterSkin.cpp deleted file mode 100644 index 9df2d8692..000000000 --- a/cs/engine/plugins/Max/Export/ExporterSkin.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include "stdafx.h" -#pragma hdrstop - -#include "exporter.h" -#include "..\..\..\editors\ECore\Editor\EditObject.h" -#include "MeshExpUtility.h" -//---------------------------------------------------------------------------------------------- - -BOOL CExporter::ExportSkin(INode* pNode, LPCSTR fname) -{ - m_Style = eExportSkin; -// ScanBones (pNode); - - int i = U.ip->GetSelNodeCount(); - while (i--) ScanMesh(U.ip->GetSelNode(i)); - - if (!Capture()) return FALSE; - if (m_bHasError) return FALSE; - CEditableObject* OBJECT = new CEditableObject("object"); - OBJECT->SetVersionToCurrent(TRUE,TRUE); - if (!OBJECT->ImportMAXSkeleton(this)){ - xr_delete(OBJECT); - return FALSE; - } - OBJECT->Optimize (); - OBJECT->SaveObject (fname); - xr_delete (OBJECT); - return TRUE; -}; diff --git a/cs/engine/plugins/Max/Export/FS2.CPP b/cs/engine/plugins/Max/Export/FS2.CPP deleted file mode 100644 index 0302b1980..000000000 --- a/cs/engine/plugins/Max/Export/FS2.CPP +++ /dev/null @@ -1,23 +0,0 @@ -#include "stdafx.h" -#pragma hdrstop - -#include "FS2.h" - -// memory -CMemoryStream::~CMemoryStream() -{ - xr_free(data); -} - -void CMemoryStream::write(const void* ptr, u32 count) -{ - if (position+count > mem_size) { - // reallocate - if (mem_size==0) mem_size=128; - while (mem_size <= (position+count)) mem_size*=2; - data = (u8*)xr_realloc(data,mem_size); - } - CopyMemory(data+position,ptr,count); - position+=count; - if (position>file_size) file_size=position; -} diff --git a/cs/engine/plugins/Max/Export/FS2.H b/cs/engine/plugins/Max/Export/FS2.H deleted file mode 100644 index e8d328ba3..000000000 --- a/cs/engine/plugins/Max/Export/FS2.H +++ /dev/null @@ -1,281 +0,0 @@ -#ifndef fs2H -#define fs2H - -#pragma once - -class ENGINE_API IBasicStream { -private: - std::stack chunk_pos; - std::stack subchunk_pos; - void revbytes ( void *bp, int elsize, int elcount ) - { - register unsigned char *p, *q; - - p = ( unsigned char * ) bp; - - if ( elsize == 2 ) { - q = p + 1; - while ( elcount-- ) { - *p ^= *q; - *q ^= *p; - *p ^= *q; - p += 2; - q += 2; - } - return; - } - - while ( elcount-- ) { - q = p + elsize - 1; - while ( p < q ) { - *p ^= *q; - *q ^= *p; - *p ^= *q; - ++p; - --q; - } - p += elsize >> 1; - } - } -public: - virtual ~IBasicStream () - { - R_ASSERT(subchunk_pos.empty()); - while (!chunk_pos.empty()) - close_chunk(); - } - - // kernel - virtual void write (const void* ptr, u32 count) = 0; - virtual void seek (u32 pos) = 0; - virtual u32 tell () = 0; - - // generalized writing functions - IC void w_u32 (u32 d) { revbytes(&d,4,1); write(&d,sizeof(u32)); } - IC void w_u16 (u16 d) { revbytes(&d,2,1); write(&d,sizeof(u16)); } - IC void w_float (float d) { revbytes(&d,4,1); write(&d,sizeof(float)); } - IC void w_u8 (u8 d) { write(&d,sizeof(u8)); } - IC void w_string(const char *p) - { - write(p,xr_strlen(p)); - w_u8(13); - w_u8(10); - } - IC void w_stringZ(const char *p) { write(p,xr_strlen(p)+1); if (!(xr_strlen(p)&1)) w_u8(0);} - IC void w_vector(Fvector v) { revbytes(&v,4,3); write(&v,3*sizeof(float)); } - IC void w_color (Fcolor c) { revbytes(&c,4,4); write(&c,4*sizeof(float)); } - - // generalized chunking - IC void open_chunk (u32 type) - { - w_u32(type); - chunk_pos.push(tell()); - w_u32(0); // the place for 'size' - } - IC void close_chunk () - { - VERIFY(!chunk_pos.empty()); - - int pos = tell(); - seek (chunk_pos.top()); - w_u32 (pos-chunk_pos.top()-4); - seek (pos); - chunk_pos.pop(); - } - // generalized chunking - IC void open_subchunk (u32 type) - { - w_u32(type); - subchunk_pos.push((u16)tell()); - w_u16(0); // the place for 'size' - } - IC void close_subchunk () - { - VERIFY(!subchunk_pos.empty()); - - int pos = tell(); - seek (subchunk_pos.top()); - w_u16 (u16(pos-subchunk_pos.top()-2)); - seek (pos); - subchunk_pos.pop(); - } - IC void write_chunk (u32 type, void* data, u32 size) - { - open_chunk (type); - write (data,size); - close_chunk (); - } -}; - -class ENGINE_API CMemoryStream : public IBasicStream -{ - u8* data; - u32 position; - u32 mem_size; - u32 file_size; -public: - CMemoryStream() { - data = 0; - position = 0; - mem_size = 0; - file_size = 0; - } - virtual ~CMemoryStream(); - - // kernel - virtual void write (const void* ptr, u32 count); - - virtual void seek (u32 pos) - { position = pos; } - virtual u32 tell () - { return position; } - - // specific - u8* pointer () { return data; } - u32 size () { return file_size; } - void clear () { file_size=0; position=0; } - void SaveTo (const char* fn) - { - #ifdef M_BORLAND - int H = open(fn,O_WRONLY|O_CREAT|O_TRUNC|O_BINARY,S_IREAD|S_IWRITE); - #else - int H = _open(fn,O_WRONLY|O_CREAT|O_TRUNC|O_BINARY,S_IREAD|S_IWRITE); - #endif - R_ASSERT(H>0); - _write(H,pointer(),size()); - _close(H); - } -}; - -#include "lwchunks.h" - -class ENGINE_API CLWMemoryStream: public CMemoryStream{ - IC void make_ord( int nbloks, int index, unsigned char *ord ) - { - int i, d; - - for ( i = 8, d = 16; i < 128; i *= 2 ){ - if ( i >= nbloks ) break; - d /= 2; - } - ord[ 0 ] = u8(128 + index * d); - ord[ 1 ] = 0; - } - -public: - IC void begin_save () { open_chunk(ID_FORM); w_u32(ID_LWO2);} - IC void end_save (LPCSTR name) { close_chunk(); SaveTo(name);} - IC void w_layer (u16 number, LPCSTR name){ - open_chunk(ID_LAYR); - w_u16 (number); // num - w_u16 (0); - w_float (0); // pivot - w_float (0); - w_float (0); - w_stringZ(name); - close_chunk(); - } - IC void w_vx (int idx) - { - if (idx>=0xFF00){ - idx|=0xff000000; - w_u32(idx); - }else - w_u16((u16)idx); - } - - IC void w_face3 (int i0, int i1, int i2) - { w_u16(3); w_vx(i0); w_vx(i1); w_vx(i2); } - - IC void begin_vmap (BOOL polymap, u32 type, int dim, LPCSTR name){ - open_chunk(polymap?ID_VMAD:ID_VMAP); - w_u32 (type); - w_u16 ((u16)dim); - R_ASSERT2(name&&name[0],"Empty vmap name!"); - w_stringZ(name); - } - IC void end_vmap () - { close_chunk();} - - IC void w_vmap (int v_index, int dim, float* uv) - { w_vx(v_index); w_float(uv[0]); if (dim==2) w_float(1.f-uv[1]); } - - IC void w_vmad (int v_index, int f_index, int dim, float* uv) - { w_vx(v_index); w_vx(f_index); w_float(uv[0]); if (dim==2) w_float(1.f-uv[1]); } - - IC void Wsurface(LPCSTR name, BOOL b2Sided, u16 image, LPCSTR vmap, LPCSTR sh_eng, LPCSTR sh_comp){ - // surf screen - char ord[2]; - open_chunk(ID_SURF); - w_stringZ(name); - w_stringZ(""); - open_subchunk(ID_COLR); - w_float(1.f);w_float(1.f);w_float(1.f); w_u16(0); - close_subchunk(); - open_subchunk(ID_SIDE); - w_u16(u16(b2Sided?3:1)); - close_subchunk(); - open_subchunk(ID_BLOK); - open_subchunk(ID_IMAP); - make_ord(128,0,(u8*)ord); - w_stringZ(ord); - open_subchunk(ID_CHAN); - w_u32(ID_COLR); - close_subchunk(); - open_subchunk(ID_OPAC); - w_u16(0); - w_float(1.f); - w_u16(0); - close_subchunk(); - open_subchunk(ID_ENAB); - w_u16(1); - close_subchunk(); - close_subchunk(); - open_subchunk(ID_PROJ); - w_u16(5); - close_subchunk(); - open_subchunk(ID_IMAG); - w_u16(image); - close_subchunk(); - open_subchunk(ID_VMAP); - w_stringZ(vmap); - close_subchunk(); - open_subchunk(ID_AAST); - w_u16(1); w_float(1.f); - close_subchunk(); - open_subchunk(ID_PIXB); - w_u16(1); - close_subchunk(); - open_subchunk(ID_STCK); - w_float(0.f); w_u16(0); - close_subchunk(); - open_subchunk(ID_TAMP); - w_float(1.f); w_u16(0); - close_subchunk(); - close_subchunk(); - // plugins -/* open_subchunk(ID_BLOK); - open_subchunk(ID_SHDR); - make_ord(128,0,(u8*)ord); - w_stringZ(ord); - open_subchunk(ID_ENAB); - w_u16(1); - close_subchunk(); - open_subchunk(ID_FUNC); - w_stringZ("!XRayShader"); - string64 tmp; - strcpy(tmp,sh_eng); - write(tmp,sizeof(tmp)); - w_u32(-1); - strcpy(tmp,sh_comp); - write(tmp,sizeof(tmp)); - w_u32(-1); - write("",128); - close_subchunk(); - close_subchunk(); - close_subchunk(); -*/ close_chunk(); - } -}; - -#endif diff --git a/cs/engine/plugins/Max/Export/MeshExpPlugin.cpp b/cs/engine/plugins/Max/Export/MeshExpPlugin.cpp deleted file mode 100644 index 006d79af3..000000000 --- a/cs/engine/plugins/Max/Export/MeshExpPlugin.cpp +++ /dev/null @@ -1,86 +0,0 @@ -// file: MeshExpPlugin.cpp - -#include "stdafx.h" -#pragma hdrstop - -#include "MeshExpUtility.h" - - -//------------------------------------------------------------------- -// Class Descriptor - -class MeshExpUtilityClassDesc : public ClassDesc { - public: - int IsPublic() { return 1; } - void * Create( BOOL loading ) { return &U; } - const TCHAR * ClassName() { return "S.T.A.L.K.E.R. Export"; } - SClass_ID SuperClassID() { return UTILITY_CLASS_ID; } - Class_ID ClassID() { return Class_ID(EXP_UTILITY_CLASSID,0); } - const TCHAR* Category() { return "S.T.A.L.K.E.R. Export"; } -}; - -MeshExpUtility U; -MeshExpUtilityClassDesc MeshExpUtilityClassDescCD; - -//------------------------------------------------------------------- -// DLL interface -HINSTANCE hInstance; -int controlsInit = FALSE; - - -BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) -{ - hInstance = hinstDLL; - - if ( !controlsInit ) { - controlsInit = TRUE; - Core._initialize("S.T.A.L.K.E.R.Plugin",ELogCallback,FALSE); - FS._initialize (CLocatorAPI::flScanAppRoot,NULL,"xray_path.ltx"); - FPU::m64r (); // нужно чтобы макс не сбрасывал контрольки в 0 - InitCustomControls(hInstance); - InitCommonControls(); - ELog.Msg(mtInformation,"S.T.A.L.K.E.R. Object Export (ver. %d.%02d)",EXPORTER_VERSION,EXPORTER_BUILD); - ELog.Msg(mtInformation,"-------------------------------------------------------" ); - } - - switch(fdwReason) { - - case DLL_PROCESS_ATTACH: - break; - case DLL_THREAD_ATTACH: - break; - case DLL_THREAD_DETACH: - break; - - case DLL_PROCESS_DETACH: - Core._destroy(); - break; - } - return(TRUE); -} - - - -__declspec( dllexport ) const TCHAR * -LibDescription() { return "S.T.A.L.K.E.R. Mesh Export utility"; } - - -__declspec( dllexport ) int LibNumberClasses() { - return 1; -} - - -__declspec( dllexport ) ClassDesc* LibClassDesc(int i) { - switch(i) { - case 0: return &MeshExpUtilityClassDescCD; - default: return 0; - } -} - - -__declspec( dllexport ) ULONG LibVersion() -{ - return VERSION_3DSMAX; -} - - diff --git a/cs/engine/plugins/Max/Export/MeshExpUtility.cpp b/cs/engine/plugins/Max/Export/MeshExpUtility.cpp deleted file mode 100644 index 65aa8c9e3..000000000 --- a/cs/engine/plugins/Max/Export/MeshExpUtility.cpp +++ /dev/null @@ -1,383 +0,0 @@ -// file: MeshExpUtility.cpp - -#include "stdafx.h" -#pragma hdrstop - -#include "MeshExpUtility.h" -#include "..\..\..\xrCore\FileSystem.h" -#include "MeshExpUtility.rh" -#include "..\..\..\editors\ECore\Editor\EditObject.h" -#include "..\..\..\editors\ECore\Editor\EditMesh.h" -//------------------------------------------------------------------- -// Dialog Handler for Utility - - -static BOOL CALLBACK DefaultDlgProc( - HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - switch (msg) { - - case WM_INITDIALOG: - U.Init(hWnd); - break; - - case WM_DESTROY: - U.Destroy(hWnd); - break; - - case WM_COMMAND: - switch (LOWORD(wParam)) { - case IDC_CLOSE: - U.iu->CloseUtility(); - break; - case IDC_EXPORT_AS_OBJECT: - U.ExportObject(); - break; - case IDC_EXPORT_AS_LWO: - U.ExportLWO(); - break; - case IDC_SKIN_EXPORT: - U.ExportSkin(); - break; - case IDC_SKIN_KEYS_EXPORT: - U.ExportSkinKeys(); - break; - } - break; - - - default: - return FALSE; - } - return TRUE; -} - -//------------------------------------------------------------------- -// Utility implimentations - -MeshExpUtility::MeshExpUtility() -{ - iu = 0; - ip = 0; - hPanel = 0; - - m_ObjectFlipFaces = false; - m_SkinFlipFaces = false; - m_SkinAllowDummy = false; -} - -MeshExpUtility::~MeshExpUtility() -{ -} - - -void MeshExpUtility::BeginEditParams(Interface *ip,IUtil *iu) -{ - this->iu = iu; - this->ip = ip; - EConsole.Init( hInstance, 0 ); - - hPanel = ip->AddRollupPage(hInstance, MAKEINTRESOURCE(IDD_MWND), DefaultDlgProc, "S.T.A.L.K.E.R. Export", 0); -} - -void MeshExpUtility::EndEditParams(Interface *ip,IUtil *iu) -{ - m_ObjectFlipFaces = IsDlgButtonChecked( hPanel, IDC_OBJECT_FLIPFACES ); - m_SkinFlipFaces = IsDlgButtonChecked( hPanel, IDC_SKIN_FLIPFACES ); - m_SkinAllowDummy = IsDlgButtonChecked( hPanel, IDC_SKIN_ALLOW_DUMMY ); - - EConsole.Clear(); - - this->iu = 0; - this->ip = 0; - ip->DeleteRollupPage(hPanel); - hPanel = 0; -} - -void MeshExpUtility::SelectionSetChanged(Interface *ip,IUtil *iu) -{ - RefreshExportList(); - UpdateSelectionListBox(); -} - -void MeshExpUtility::Init(HWND hWnd) -{ - hPanel = hWnd; - - hItemList = GetDlgItem(hWnd, IDC_OBJLIST); - - CheckDlgButton( hPanel, IDC_OBJECT_FLIPFACES, m_ObjectFlipFaces ); - CheckDlgButton( hPanel, IDC_SKIN_FLIPFACES, m_SkinFlipFaces ); - CheckDlgButton( hPanel, IDC_SKIN_ALLOW_DUMMY, m_SkinAllowDummy ); - - RefreshExportList(); - UpdateSelectionListBox(); -} - -void MeshExpUtility::Destroy(HWND hWnd) -{ -} - -void MeshExpUtility::RefreshExportList(){ - m_Items.clear(); - ExportItem item; - int i = ip->GetSelNodeCount(); - while( i-- ){ - item.pNode = ip->GetSelNode(i); - m_Items.push_back( item ); - } -} - -void MeshExpUtility::UpdateSelectionListBox() -{ - SendMessage( hItemList, LB_RESETCONTENT, 0, 0 ); - ExportItemIt it = m_Items.begin(); - for(;it!=m_Items.end();it++) - SendMessage( hItemList, LB_ADDSTRING, - 0,(LPARAM) it->pNode->GetName() ); -} -//------------------------------------------------------------------- - -BOOL MeshExpUtility::BuildObject(CEditableObject*& exp_obj, LPCSTR m_ExportName) -{ - bool bResult = true; - - if (m_ExportName[0]==0) return false; - - ELog.Msg(mtInformation,"Building object..." ); - char fname[256]; _splitpath( m_ExportName, 0, 0, fname, 0 ); - exp_obj = new CEditableObject(fname); - exp_obj->SetVersionToCurrent(TRUE,TRUE); - - ExportItemIt it = m_Items.begin(); - for(;it!=m_Items.end();it++){ - CEditableMesh *submesh = new CEditableMesh(exp_obj); - ELog.Msg(mtInformation,"Converting node '%s'...", it->pNode->GetName()); - if( submesh->Convert(it->pNode) ){ - // transform - Matrix3 mMatrix; - mMatrix = it->pNode->GetNodeTM(0)*Inverse(it->pNode->GetParentNode()->GetNodeTM(0)); - - Point3 r1 = mMatrix.GetRow(0); - Point3 r2 = mMatrix.GetRow(1); - Point3 r3 = mMatrix.GetRow(2); - Point3 r4 = mMatrix.GetRow(3); - Fmatrix m; m.identity(); - m.i.set(r1.x, r1.z, r1.y); - m.j.set(r2.x, r2.z, r2.y); - m.k.set(r3.x, r3.z, r3.y); - m.c.set(r4.x, r4.z, r4.y); - - submesh->Transform( m ); - // flip faces - Fvector v; v.crossproduct(m.j, m.k); - if(v.dotproduct(m.i)<0.f) submesh->FlipFaces(); - if(m_ObjectFlipFaces) submesh->FlipFaces(); - submesh->RecomputeBBox(); - // append mesh - submesh->SetName (it->pNode->GetName()); - exp_obj->m_Meshes.push_back (submesh); - }else{ - ELog.Msg(mtError,"! can't convert", it->pNode->GetName()); - xr_delete(submesh); - bResult = false; - break; - } - } - - if (bResult){ - exp_obj->UpdateBox (); - exp_obj->VerifyMeshNames(); - ELog.Msg (mtInformation,"Object '%s' contains: %d points, %d faces", - exp_obj->GetName(), exp_obj->GetVertexCount(), exp_obj->GetFaceCount()); - }else{ - xr_delete(exp_obj); - } -//------------------------------------------------------------------- - return bResult; -} -//------------------------------------------------------------------- - -BOOL MeshExpUtility::SaveAsObject(const char* m_ExportName) -{ - BOOL bResult = TRUE; - - if (m_ExportName[0]==0) return FALSE; - - ELog.Msg(mtInformation,"Exporting..." ); - ELog.Msg(mtInformation,"-------------------------------------------------------" ); - CEditableObject* exp_obj=0; - if (bResult=BuildObject(exp_obj,m_ExportName)){ - ELog.Msg (mtInformation,"Saving object..."); - for (SurfaceIt s_it=exp_obj->FirstSurface(); s_it!=exp_obj->LastSurface(); s_it++){ - LPSTR t=(LPSTR)(*s_it)->_Texture(); - if (strext(t)) *strext(t)=0; - } - exp_obj->Optimize (); - exp_obj->SaveObject (m_ExportName); - } - - xr_delete(exp_obj); - - return bResult; -} -//------------------------------------------------------------------- - -BOOL MeshExpUtility::SaveAsLWO(const char* m_ExportName) -{ - BOOL bResult = TRUE; - - if (m_ExportName[0]==0) return FALSE; - - ELog.Msg(mtInformation,"Exporting..." ); - ELog.Msg(mtInformation,"-------------------------------------------------------" ); - CEditableObject* exp_obj=0; - if (bResult=BuildObject(exp_obj,m_ExportName)){ - ELog.Msg (mtInformation,"Object saved..."); - exp_obj->Optimize (); - exp_obj->ExportLWO (m_ExportName); - } - - xr_delete(exp_obj); - - return bResult; -} -//------------------------------------------------------------------- - -//------------------------------------------------------------------- -// registry access -const char *g_rOptionsKey = "SOFTWARE\\NerGoSoft\\S.T.A.L.K.E.R. Map Editor\\2.0\\Options"; -const char *g_rPathValue = "MainPath"; -const char *g_rObjFlipFacesVal = "Object Flip Faces"; -const char *g_rObjSuppressSMVal = "Object Suppress SM"; -const char *g_rNoOptimizeVal = "Object No Optimize"; -const char *g_rSkinSuppressSMVal= "Skin Suppress SM"; -const char *g_rSkinProgressive = "Skin Progressive"; - -//------------------------------------------------------------------------------------------------- -void MeshExpUtility::ExportObject() -{ - BOOL bResult = FALSE; - - if( m_Items.empty() ){ - ELog.Msg(mtError,"Nothing selected" ); - ELog.Msg(mtError,"-------------------------------------------------------" ); - return; - } - - m_ObjectFlipFaces = IsDlgButtonChecked( hPanel, IDC_OBJECT_FLIPFACES ); - - string_path m_ExportName; - m_ExportName[0]=0; - if( !EFS.GetSaveName("$import$",m_ExportName,0,0) ) - { - ELog.Msg(mtInformation,"Export cancelled" ); - ELog.Msg(mtInformation,"-------------------------------------------------------" ); - return; - } - EConsole.StayOnTop(TRUE); - if (strext(m_ExportName)) *strext(m_ExportName)=0; - strcat(m_ExportName,".object"); - bResult = SaveAsObject(m_ExportName); - - ELog.Msg (mtInformation,bResult?". Export succesfully completed.":"! Export failed."); - ELog.Msg (mtInformation,"-------------------------------------------------------" ); - EConsole.StayOnTop(FALSE); -} -//------------------------------------------------------------------------------------------------- - -void MeshExpUtility::ExportLWO() -{ - BOOL bResult = FALSE; - - if( m_Items.empty() ){ - ELog.Msg(mtError,"Nothing selected" ); - ELog.Msg(mtError,"-------------------------------------------------------" ); - return; - } - - m_ObjectFlipFaces = IsDlgButtonChecked( hPanel, IDC_OBJECT_FLIPFACES ); - - string_path m_ExportName; - m_ExportName[0]=0; - if( !EFS.GetSaveName("$import$",m_ExportName,0,1) ){ - ELog.Msg(mtInformation,"Export cancelled" ); - ELog.Msg(mtInformation,"-------------------------------------------------------" ); - return; - } - if (strext(m_ExportName)) *strext(m_ExportName)=0; - strcat(m_ExportName,".lwo"); - EConsole.StayOnTop(TRUE); - bResult = SaveAsLWO(m_ExportName); - - ELog.Msg (mtInformation,bResult?". Export succesfully completed.":"! Export failed."); - ELog.Msg (mtInformation,"-------------------------------------------------------" ); - EConsole.StayOnTop(FALSE); -} -//------------------------------------------------------------------------------------------------- - -void MeshExpUtility::ExportSkin() -{ - BOOL bResult = true; - - if( m_Items.empty() ){ - ELog.Msg(mtError,"Nothing selected." ); - ELog.Msg(mtError,"-------------------------------------------------------" ); - return; - } - if( m_Items.size()>1 ){ - ELog.Msg(mtInformation,"More than one object selected." ); - ELog.Msg(mtInformation,"-------------------------------------------------------" ); - return; - } - - m_SkinFlipFaces = IsDlgButtonChecked( hPanel, IDC_SKIN_FLIPFACES ); - m_SkinAllowDummy = IsDlgButtonChecked( hPanel, IDC_SKIN_ALLOW_DUMMY ); - - string_path m_ExportName; - m_ExportName[0]=0; - if( !EFS.GetSaveName("$import$",m_ExportName,0,0) ){ - ELog.Msg(mtInformation,"Export cancelled" ); - ELog.Msg(mtInformation,"-------------------------------------------------------" ); - return; - } - - EConsole.StayOnTop(TRUE); - bResult = SaveAsSkin(m_ExportName); - ELog.Msg (mtInformation,bResult?". Export succesfully completed.":"! Export failed."); - ELog.Msg (mtInformation,"-------------------------------------------------------" ); - EConsole.StayOnTop(FALSE); -} - -void MeshExpUtility::ExportSkinKeys() -{ - BOOL bResult = true; - - if( m_Items.empty() ){ - ELog.Msg(mtError,"Nothing selected." ); - ELog.Msg(mtError,"-------------------------------------------------------" ); - return; - } - if( m_Items.size()>1 ){ - ELog.Msg(mtInformation,"More than one object selected." ); - ELog.Msg(mtInformation,"-------------------------------------------------------" ); - return; - } - m_SkinFlipFaces = IsDlgButtonChecked( hPanel, IDC_SKIN_FLIPFACES ); - m_SkinAllowDummy = IsDlgButtonChecked( hPanel, IDC_SKIN_ALLOW_DUMMY ); - - string_path m_ExportName; - m_ExportName[0]=0; - if( !EFS.GetSaveName("$smotion$",m_ExportName,0) ){ - ELog.Msg(mtInformation,"Export cancelled" ); - ELog.Msg(mtInformation,"-------------------------------------------------------" ); - return; - } - - EConsole.StayOnTop(TRUE); - bResult = SaveSkinKeys(m_ExportName); - ELog.Msg (mtInformation,bResult?". Export succesfully completed.":"! Export failed."); - ELog.Msg (mtInformation,"-------------------------------------------------------" ); - EConsole.StayOnTop(FALSE); -} - diff --git a/cs/engine/plugins/Max/Export/MeshExpUtility.h b/cs/engine/plugins/Max/Export/MeshExpUtility.h deleted file mode 100644 index c9228885c..000000000 --- a/cs/engine/plugins/Max/Export/MeshExpUtility.h +++ /dev/null @@ -1,77 +0,0 @@ -// file: MeshExpUtility.h - - -#ifndef __MeshExpUtility__H__INCLUDED__ -#define __MeshExpUtility__H__INCLUDED__ - -#include "NetDeviceLog.h" -#include "MeshExpUtility.rh" - -#define EXPORTER_VERSION 2 -#define EXPORTER_BUILD 03 -//using namespace std; - -// refs -class CEditableObject; - -#define EXP_UTILITY_CLASSID 0x507d29c0 - -class ExportItem { -public: - INode *pNode; - ExportItem(){ pNode = 0;}; - ExportItem( INode* _pNode ){ pNode = _pNode; }; - ~ExportItem(){}; -}; - -using ExportItemVec = xr_vector; -using ExportItemIt = ExportItemVec::iterator; -class MeshExpUtility : public UtilityObj { -public: - - IUtil *iu; - Interface *ip; - - HWND hPanel; - HWND hItemList; - - INode* GetExportNode (); -protected: - ExportItemVec m_Items; - - void RefreshExportList(); - void UpdateSelectionListBox(); - - BOOL BuildObject (CEditableObject*& obj, LPCSTR m_ExportName); - BOOL SaveAsObject (const char* n); - BOOL SaveAsLWO (const char* n); - BOOL SaveAsSkin (const char* n); - BOOL SaveSkinKeys (const char* n); -public: - int m_ObjectFlipFaces; - int m_SkinFlipFaces; - int m_SkinAllowDummy; -public: - MeshExpUtility (); - virtual ~MeshExpUtility (); - - void BeginEditParams (Interface *ip,IUtil *iu); - void EndEditParams (Interface *ip,IUtil *iu); - void SelectionSetChanged(Interface *ip,IUtil *iu); - void DeleteThis () {} - - void Init (HWND hWnd); - void Destroy (HWND hWnd); - void ExportObject (); - void ExportLWO (); - void ExportSkin (); - void ExportSkinKeys (); -}; - -extern MeshExpUtility U; - - - -#endif /*__MeshExpUtility__H__INCLUDED__*/ - - diff --git a/cs/engine/plugins/Max/Export/MeshExpUtility.rc b/cs/engine/plugins/Max/Export/MeshExpUtility.rc deleted file mode 100644 index 2b84fb79d..000000000 --- a/cs/engine/plugins/Max/Export/MeshExpUtility.rc +++ /dev/null @@ -1,182 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "MeshExpUtility.rh" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Russian resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS) -#ifdef _WIN32 -LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT -#pragma code_page(1251) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_MWND DIALOGEX 0, 0, 108, 241 -STYLE DS_SETFONT | WS_CHILD | WS_BORDER -FONT 8, "MS Sans Serif", 0, 0, 0x0 -BEGIN - PUSHBUTTON "Export Editor Object...",IDC_EXPORT_AS_OBJECT,6,26,95, - 12,BS_FLAT - LISTBOX IDC_OBJLIST,4,134,99,86,LBS_NOINTEGRALHEIGHT | LBS_NOSEL | - WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Export Skin...",IDC_SKIN_EXPORT,6,91,95,12,BS_FLAT - PUSHBUTTON "End",IDC_CLOSE,4,222,99,12,BS_FLAT - PUSHBUTTON "Export Motion...",IDC_SKIN_KEYS_EXPORT,6,105,95,12, - BS_FLAT - GROUPBOX "Object",IDC_STATIC,4,3,99,51,BS_FLAT - CONTROL "Flip faces",IDC_OBJECT_FLIPFACES,"Button", - BS_AUTOCHECKBOX | BS_FLAT | WS_TABSTOP,6,14,92,8 - PUSHBUTTON "Export LWO...",IDC_EXPORT_AS_LWO,6,40,95,12,BS_FLAT - CONTROL "Flip faces",IDC_SKIN_FLIPFACES,"Button",BS_AUTOCHECKBOX | - BS_FLAT | WS_TABSTOP,6,67,92,8 - GROUPBOX "Skeleton ",IDC_STATIC,4,56,99,63,BS_FLAT - CONTROL "Allow Dummy",IDC_SKIN_ALLOW_DUMMY,"Button", - BS_AUTOCHECKBOX | BS_FLAT | WS_TABSTOP,6,79,92,8 - LTEXT "Selected:",IDC_STATIC,4,123,99,8 -END - -IDD_CONSOLE DIALOGEX 500, 0, 311, 175 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "X-Ray Export" -FONT 8, "Lucida Console", 0, 0, 0x1 -BEGIN - LISTBOX IDC_MESSAGES,0,0,310,163,NOT LBS_NOTIFY | - LBS_NOINTEGRALHEIGHT | NOT WS_BORDER | WS_VSCROLL | - WS_HSCROLL | WS_TABSTOP,WS_EX_STATICEDGE - CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",0x1,0,163, - 310,9 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_MWND, DIALOG - BEGIN - LEFTMARGIN, 4 - RIGHTMARGIN, 103 - TOPMARGIN, 7 - BOTTOMMARGIN, 235 - END - - IDD_CONSOLE, DIALOG - BEGIN - RIGHTMARGIN, 310 - BOTTOMMARGIN, 163 - END -END -#endif // APSTUDIO_INVOKED - - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "MeshExpUtility.rh\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - -#endif // Russian resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// Ukrainian resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_UKR) -#ifdef _WIN32 -LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT -#pragma code_page(1251) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_SHADERDIALOG DIALOGEX 0, 0, 227, 95 -STYLE DS_SYSMODAL | DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | - WS_SYSMENU -EXSTYLE WS_EX_TOOLWINDOW -CAPTION "Select shader" -FONT 8, "MS Sans Serif", 0, 0, 0x1 -BEGIN - DEFPUSHBUTTON "OK",ID_SHOK,174,15,50,12,BS_FLAT - PUSHBUTTON "Cancel",ID_SHCANCEL,174,31,50,12,BS_FLAT - LISTBOX IDC_SHADERLIST,3,15,164,77,LBS_SORT | - LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP - LTEXT "Texture:",IDC_STATIC,3,4,27,8 - LTEXT "...",IDC_TEXTURE,33,4,191,8 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_SHADERDIALOG, DIALOG - BEGIN - LEFTMARGIN, 3 - RIGHTMARGIN, 224 - TOPMARGIN, 4 - BOTTOMMARGIN, 92 - END -END -#endif // APSTUDIO_INVOKED - -#endif // Ukrainian resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/cs/engine/plugins/Max/Export/MeshExpUtility.rh b/cs/engine/plugins/Max/Export/MeshExpUtility.rh deleted file mode 100644 index fee18890a..000000000 --- a/cs/engine/plugins/Max/Export/MeshExpUtility.rh +++ /dev/null @@ -1,33 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by MeshExpUtility.rc -// -#define IDD_MWND 101 -#define IDD_CONSOLE 103 -#define IDD_SHADERDIALOG 104 -#define IDC_CLOSE 1000 -#define IDC_EXPORT_AS_OBJECT 1001 -#define IDC_OBJLIST 1002 -#define IDC_SKIN_EXPORT 1003 -#define IDC_SKIN_KEYS_EXPORT 1005 -#define IDC_EXPORT_AS_LWO 1006 -#define IDC_MESSAGES 1015 -#define IDC_OBJECT_FLIPFACES 1023 -#define IDC_SKIN_FLIPFACES 1025 -#define IDC_PROGRESS 1026 -#define ID_SHOK 1028 -#define IDC_SKIN_ALLOW_DUMMY 1028 -#define ID_SHCANCEL 1029 -#define IDC_SHADERLIST 1030 -#define IDC_TEXTURE 1032 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 105 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1035 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/cs/engine/plugins/Max/Export/NetDeviceLog.cpp b/cs/engine/plugins/Max/Export/NetDeviceLog.cpp deleted file mode 100644 index c5ee9d225..000000000 --- a/cs/engine/plugins/Max/Export/NetDeviceLog.cpp +++ /dev/null @@ -1,154 +0,0 @@ -//---------------------------------------------------- -// file: NetDeviceLog.cpp -//---------------------------------------------------- - -#include "stdafx.h" -#pragma hdrstop - -#include "NetDeviceLog.h" -#include "MeshExpUtility.h" -#include "MeshExpUtility.rh" - -//---------------------------------------------------- - -CExportConsole EConsole; - -//---------------------------------------------------- -BOOL CALLBACK ConsoleDialogProc( HWND hw, UINT msg, WPARAM wp, LPARAM lp){ - - std::list::iterator _F; - std::list::iterator _E; - - switch( msg ){ - - case WM_INITDIALOG: - SetWindowPos(hw,HWND_TOP,0,0,0,0,SWP_NOSIZE|SWP_NOMOVE); - EConsole.m_hWindow = hw; - EnterCriticalSection( &EConsole.m_CSection ); - if( !EConsole.m_Messages.empty() ){ - _F = EConsole.m_Messages.begin(); - _E = EConsole.m_Messages.end(); - for(;_F!=_E;_F++){ - int k = SendDlgItemMessage( hw, IDC_MESSAGES, LB_ADDSTRING, 0, (LPARAM)_F->buf ); - SendDlgItemMessage( hw, IDC_MESSAGES, LB_SETCURSEL, k, 0 ); - } - SendDlgItemMessage( hw, IDC_PROGRESS, PBM_SETRANGE, 0, MAKELPARAM(0, 100) ); - SendDlgItemMessage( hw, IDC_PROGRESS, PBM_SETPOS, 0, 0); - } - LeaveCriticalSection( &EConsole.m_CSection ); - break; - case WM_CLOSE: - SendMessage(U.hPanel,WM_COMMAND,IDC_CLOSE,0); - break; - default: - return FALSE; - } - return TRUE; -} - -DWORD WINAPI ConsoleThreadProc( LPVOID ){ - DialogBox( EConsole.m_hInstance, - MAKEINTRESOURCE(IDD_CONSOLE), - 0/*GetForegroundWindow()*/, ConsoleDialogProc ); - return 0; -} - -void CExportConsole::StayOnTop(BOOL flag) -{ - if (flag){ - SetWindowPos(m_hWindow,HWND_TOPMOST,0,0,0,0,SWP_NOSIZE|SWP_NOMOVE); - }else{ - SetWindowPos(m_hWindow,HWND_NOTOPMOST,0,0,0,0,SWP_NOSIZE|SWP_NOMOVE); - SetWindowPos(m_hWindow,HWND_TOP,0,0,0,0,SWP_NOSIZE|SWP_NOMOVE); - } -} - -bool CExportConsole::Init( HINSTANCE _Inst, HWND _Window ){ - - if( m_Valid ){ - SetForegroundWindow(m_hWindow); - return true;} - - m_Enter = false; - m_hInstance = _Inst; - m_hParent = _Window; - InitializeCriticalSection( &m_CSection ); - m_hThread = CreateThread( 0, 0, ConsoleThreadProc, 0, 0, &m_ThreadId ); - m_Valid = true; - - return true; -} - -void CExportConsole::Clear(){ - - if( !m_Valid ) - return; - - m_Valid = false; - TerminateThread( m_hThread, 0 ); - CloseHandle( m_hThread ); - DeleteCriticalSection( &m_CSection ); -} - -void CExportConsole::print(TMsgDlgType mt, const char *buf){ - _ConsoleMsg msg(buf); - - if( m_Messages.size() > 1000 ) m_Messages.pop_front(); - m_Messages.push_back( buf ); - - if( !m_Valid ) - return; - - EnterCriticalSection( &m_CSection ); - if( SendDlgItemMessage( m_hWindow, IDC_MESSAGES, LB_GETCOUNT, 0, 0 ) > 1000 ) - SendDlgItemMessage( m_hWindow, IDC_MESSAGES,LB_DELETESTRING, 0, 0 ); - int k = SendDlgItemMessage( m_hWindow, IDC_MESSAGES,LB_ADDSTRING, 0, (LPARAM)buf ); - SendDlgItemMessage( m_hWindow, IDC_MESSAGES,LB_SETCURSEL, k, 0 ); - DWORD dwCnt = SendMessage ( m_hWindow, LB_GETCOUNT, 0, 0); - SendMessage ( m_hWindow, LB_SETTOPINDEX, dwCnt-1, 0); - LeaveCriticalSection( &m_CSection ); -} - -bool CExportConsole::valid(){ - return m_Valid; -} - -CExportConsole::CExportConsole(){ - VERIFY( this == &EConsole ); - m_Valid = false; -} - -CExportConsole::~CExportConsole(){ - VERIFY( m_Valid == false ); - m_Messages.clear(); -} - -//---------------------------------------------------- -void CExportConsole::ProgressStart(float max_val, const char* text){ - fMaxVal=max_val; - fStatusProgress=0; - Msg(text?text:""); - ProgressUpdate(0); -} -void CExportConsole::ProgressEnd(){ - ProgressUpdate(0); -} -void CExportConsole::ProgressInc(){ - ProgressUpdate(fStatusProgress+1); -} -void CExportConsole::ProgressUpdate(float val){ - if (_abs(val-fStatusProgress)<1) return; - fStatusProgress=val; - EnterCriticalSection( &m_CSection ); - if (fMaxVal>0){ - DWORD progress = (DWORD)((fStatusProgress/fMaxVal)*100); - SendDlgItemMessage( m_hWindow, IDC_PROGRESS,PBM_SETPOS, progress, 0 ); - }else{ - DWORD progress = 0; - SendDlgItemMessage( m_hWindow, IDC_PROGRESS,PBM_SETPOS, progress, 0 ); - } - LeaveCriticalSection( &m_CSection ); -} -//---------------------------------------------------- - - diff --git a/cs/engine/plugins/Max/Export/NetDeviceLog.h b/cs/engine/plugins/Max/Export/NetDeviceLog.h deleted file mode 100644 index 8aabef5d8..000000000 --- a/cs/engine/plugins/Max/Export/NetDeviceLog.h +++ /dev/null @@ -1,63 +0,0 @@ -//---------------------------------------------------- -// file: NetDeviceLog.h -//---------------------------------------------------- - -#ifndef _INCDEF_NETDEVICELOG_H_ -#define _INCDEF_NETDEVICELOG_H_ - -// ------- -#define NLOG_CONSOLE_OUT -// ------- - -class CExportConsole{ -protected: - - bool m_Valid; - HANDLE m_hThread; - DWORD m_ThreadId; - - -public: - - HWND m_hParent; - HWND m_hWindow; - HINSTANCE m_hInstance; - - CRITICAL_SECTION m_CSection; - - bool m_Enter; - char m_EnterBuffer[256]; - - class _ConsoleMsg{ - public: - char buf[1024]; - _ConsoleMsg(LPCSTR b){ strcpy(buf,b); } - }; - - std::list<_ConsoleMsg> m_Messages; - - float fMaxVal, fStatusProgress; -public: - - bool Init( HINSTANCE _Inst, HWND _Window ); - void Clear(); - - void print (TMsgDlgType mt, const char *buf); - - bool valid(); - - void ProgressStart(float max_val, const char* text=0); - void ProgressEnd(); - void ProgressInc(); - void ProgressUpdate(float val); - - void StayOnTop (BOOL flag); - - CExportConsole(); - ~CExportConsole(); -}; - -extern CExportConsole EConsole; - -#endif /*_INCDEF_NETDEVICELOG_H_*/ - diff --git a/cs/engine/plugins/Max/Export/Stdafx.h b/cs/engine/plugins/Max/Export/Stdafx.h deleted file mode 100644 index f1e9eb9a5..000000000 --- a/cs/engine/plugins/Max/Export/Stdafx.h +++ /dev/null @@ -1,93 +0,0 @@ -//---------------------------------------------------- -// file: stdafx.h -//---------------------------------------------------- -#ifndef __INCDEF_STDAFX_H_ -#define __INCDEF_STDAFX_H_ - -#pragma once - -#define _WIN32_WINNT 0x0500 - -#pragma warning (disable:4995) -#include "Max.h" - -#include "../../../xrCore/xrCore.h" - -#undef _MIN -#undef _MAX -#define _MIN(a,b) (a)<(b)?(a):(b) -#define _MAX(a,b) (a)>(b)?(a):(b) -template -T min(T a, T b) { return _MIN(a,b); } -template -T max(T a, T b) { return _MAX(a,b); } -using std::string; -#undef _MIN -#undef _MAX - -#define FLT_MAX flt_max - -#ifdef FLT_MIN -#undef FLT_MIN -#endif - -#define FLT_MIN flt_max - -#include -#include -#include -#include - -#include "istdplug.h" -#include "iparamb2.h" -#include "iparamm2.h" -#include "stdmat.h" -#include "UTILAPI.H" - -// CS SDK -#ifdef _MAX_EXPORT -# include "phyexp.h" -# include "bipexp.h" -#endif - -#include - -#define ENGINE_API -#define ECORE_API - -enum TMsgDlgType { mtWarning, mtError, mtInformation, mtConfirmation, mtCustom }; -enum TMsgDlgBtn { mbYes, mbNo, mbOK, mbCancel, mbAbort, mbRetry, mbIgnore, mbAll, mbNoToAll, mbYesToAll, mbHelp }; -typedef TMsgDlgBtn TMsgDlgButtons[mbHelp]; - -#include - -#define AnsiString string -using AStringVec = xr_vector; -using AStringIt = AStringVec::iterator; - -//#include "clsid.h" -//#include "Engine.h" -//#include "Properties.h" -#include "..\..\Shared\ELog.h" - -#define THROW R_ASSERT(0) - -#ifdef _MAX_EXPORT - #define _EDITOR_FILE_NAME_ "max_export" -#else - #ifdef _MAX_MATERIAL - #define _EDITOR_FILE_NAME_ "max_material" - #endif -#endif - -#define GAMEMTL_NONE u32(-1) -#define _game_data_ "$game_data$" - -#pragma warning (default:4995) - -#endif /*_INCDEF_STDAFX_H_*/ - - - - - diff --git a/cs/engine/plugins/Max/Export/Utility.def b/cs/engine/plugins/Max/Export/Utility.def deleted file mode 100644 index 4d975d1ca..000000000 --- a/cs/engine/plugins/Max/Export/Utility.def +++ /dev/null @@ -1,7 +0,0 @@ -EXPORTS - LibDescription @1 - LibNumberClasses @2 - LibClassDesc @3 - LibVersion @4 -SECTIONS - .data READ WRITE diff --git a/cs/engine/plugins/Max/Export/lwchunks.h b/cs/engine/plugins/Max/Export/lwchunks.h deleted file mode 100644 index 3b30f53e7..000000000 --- a/cs/engine/plugins/Max/Export/lwchunks.h +++ /dev/null @@ -1,162 +0,0 @@ -#ifndef LWCHUNKS_H -#define LWCHUNKS_H - -#ifndef LWID_ -#define LWID_(a,b,c,d) (((a)<<24)|((b)<<16)|((c)<<8)|(d)) -#endif -/* chunk and subchunk IDs */ - -#define ID_FORM LWID_('F','O','R','M') -#define ID_LWO2 LWID_('L','W','O','2') -#define ID_LWOB LWID_('L','W','O','B') - -/* top-level chunks */ -#define ID_LAYR LWID_('L','A','Y','R') -#define ID_TAGS LWID_('T','A','G','S') -#define ID_PNTS LWID_('P','N','T','S') -#define ID_BBOX LWID_('B','B','O','X') -#define ID_VMAP LWID_('V','M','A','P') -#define ID_VMAD LWID_('V','M','A','D') -#define ID_POLS LWID_('P','O','L','S') -#define ID_PTAG LWID_('P','T','A','G') -#define ID_ENVL LWID_('E','N','V','L') -#define ID_CLIP LWID_('C','L','I','P') -#define ID_SURF LWID_('S','U','R','F') -#define ID_DESC LWID_('D','E','S','C') -#define ID_TEXT LWID_('T','E','X','T') -#define ID_ICON LWID_('I','C','O','N') - -/* polygon types */ -#define ID_FACE LWID_('F','A','C','E') -#define ID_CURV LWID_('C','U','R','V') -#define ID_PTCH LWID_('P','T','C','H') -#define ID_MBAL LWID_('M','B','A','L') -#define ID_BONE LWID_('B','O','N','E') - -/* polygon tags */ -#define ID_SURF LWID_('S','U','R','F') -#define ID_PART LWID_('P','A','R','T') -#define ID_SMGP LWID_('S','M','G','P') - -/* envelopes */ -#define ID_PRE LWID_('P','R','E',' ') -#define ID_POST LWID_('P','O','S','T') -#define ID_KEY LWID_('K','E','Y',' ') -#define ID_SPAN LWID_('S','P','A','N') -#define ID_TCB LWID_('T','C','B',' ') -#define ID_HERM LWID_('H','E','R','M') -#define ID_BEZI LWID_('B','E','Z','I') -#define ID_BEZ2 LWID_('B','E','Z','2') -#define ID_LINE LWID_('L','I','N','E') -#define ID_STEP LWID_('S','T','E','P') - -/* clips */ -#define ID_STIL LWID_('S','T','I','L') -#define ID_ISEQ LWID_('I','S','E','Q') -#define ID_ANIM LWID_('A','N','I','M') -#define ID_XREF LWID_('X','R','E','F') -#define ID_STCC LWID_('S','T','C','C') -#define ID_TIME LWID_('T','I','M','E') -#define ID_CONT LWID_('C','O','N','T') -#define ID_BRIT LWID_('B','R','I','T') -#define ID_SATR LWID_('S','A','T','R') -#define ID_HUE LWID_('H','U','E',' ') -#define ID_GAMM LWID_('G','A','M','M') -#define ID_NEGA LWID_('N','E','G','A') -#define ID_IFLT LWID_('I','F','L','T') -#define ID_PFLT LWID_('P','F','L','T') - -/* surfaces */ -#define ID_COLR LWID_('C','O','L','R') -#define ID_LUMI LWID_('L','U','M','I') -#define ID_DIFF LWID_('D','I','F','F') -#define ID_SPEC LWID_('S','P','E','C') -#define ID_GLOS LWID_('G','L','O','S') -#define ID_REFL LWID_('R','E','F','L') -#define ID_RFOP LWID_('R','F','O','P') -#define ID_RIMG LWID_('R','I','M','G') -#define ID_RSAN LWID_('R','S','A','N') -#define ID_TRAN LWID_('T','R','A','N') -#define ID_TROP LWID_('T','R','O','P') -#define ID_TIMG LWID_('T','I','M','G') -#define ID_RIND LWID_('R','I','N','D') -#define ID_TRNL LWID_('T','R','N','L') -#define ID_BUMP LWID_('B','U','M','P') -#define ID_SMAN LWID_('S','M','A','N') -#define ID_SIDE LWID_('S','I','D','E') -#define ID_CLRH LWID_('C','L','R','H') -#define ID_CLRF LWID_('C','L','R','F') -#define ID_ADTR LWID_('A','D','T','R') -#define ID_SHRP LWID_('S','H','R','P') -#define ID_LINE LWID_('L','I','N','E') -#define ID_LSIZ LWID_('L','S','I','Z') -#define ID_ALPH LWID_('A','L','P','H') -#define ID_AVAL LWID_('A','V','A','L') -#define ID_GVAL LWID_('G','V','A','L') -#define ID_BLOK LWID_('B','L','O','K') - -/* texture layer */ -#define ID_TYPE LWID_('T','Y','P','E') -#define ID_CHAN LWID_('C','H','A','N') -#define ID_NAME LWID_('N','A','M','E') -#define ID_ENAB LWID_('E','N','A','B') -#define ID_OPAC LWID_('O','P','A','C') -#define ID_FLAG LWID_('F','L','A','G') -#define ID_PROJ LWID_('P','R','O','J') -#define ID_STCK LWID_('S','T','C','K') -#define ID_TAMP LWID_('T','A','M','P') - -/* texture coordinates */ -#define ID_TMAP LWID_('T','M','A','P') -#define ID_AXIS LWID_('A','X','I','S') -#define ID_CNTR LWID_('C','N','T','R') -#define ID_SIZE LWID_('S','I','Z','E') -#define ID_ROTA LWID_('R','O','T','A') -#define ID_OREF LWID_('O','R','E','F') -#define ID_FALL LWID_('F','A','L','L') -#define ID_CSYS LWID_('C','S','Y','S') - -/* image map */ -#define ID_IMAP LWID_('I','M','A','P') -#define ID_IMAG LWID_('I','M','A','G') -#define ID_WRAP LWID_('W','R','A','P') -#define ID_WRPW LWID_('W','R','P','W') -#define ID_WRPH LWID_('W','R','P','H') -#define ID_VMAP LWID_('V','M','A','P') -#define ID_AAST LWID_('A','A','S','T') -#define ID_PIXB LWID_('P','I','X','B') - -/* procedural */ -#define ID_PROC LWID_('P','R','O','C') -#define ID_COLR LWID_('C','O','L','R') -#define ID_VALU LWID_('V','A','L','U') -#define ID_FUNC LWID_('F','U','N','C') -#define ID_FTPS LWID_('F','T','P','S') -#define ID_ITPS LWID_('I','T','P','S') -#define ID_ETPS LWID_('E','T','P','S') - -/* gradient */ -#define ID_GRAD LWID_('G','R','A','D') -#define ID_GRST LWID_('G','R','S','T') -#define ID_GREN LWID_('G','R','E','N') -#define ID_PNAM LWID_('P','N','A','M') -#define ID_INAM LWID_('I','N','A','M') -#define ID_GRPT LWID_('G','R','P','T') -#define ID_FKEY LWID_('F','K','E','Y') -#define ID_IKEY LWID_('I','K','E','Y') - -/* shader */ -#define ID_SHDR LWID_('S','H','D','R') -#define ID_DATA LWID_('D','A','T','A') - -/* vmap type */ -#define ID_PICK LWID_('P','I','C','K') -#define ID_WGHT LWID_('W','G','H','T') -#define ID_MNVW LWID_('M','N','V','W') -#define ID_TXUV LWID_('T','X','U','V') -#define ID_RGB LWID_('R','G','B',' ') -#define ID_RGBA LWID_('R','G','B','A') -#define ID_MORF LWID_('M','O','R','F') -#define ID_SPOT LWID_('S','P','O','T') - -#endif diff --git a/cs/engine/plugins/Max/Export/resource.h b/cs/engine/plugins/Max/Export/resource.h deleted file mode 100644 index 2239109c5..000000000 --- a/cs/engine/plugins/Max/Export/resource.h +++ /dev/null @@ -1,273 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by GameMaterial.rc -// -#define IDS_LIBDESCRIPTION 1 -#define IDS_CATEGORY 2 -#define IDS_CLASS_NAME 3 -#define IDS_PARAMS 4 -#define IDS_SPIN 5 -#define IDS_COMMENT 6 -#define IDS_MN_DIFFUSE 7 -#define IDS_MN_BRIGHTNESS 8 -#define IDS_MN_OPACITY 9 -#define IDS_MN_NONE 10 -#define IDS_COLOR 11 -#define IDS_PARAMCHG 12 -#define IDS_MN_DIFFUSE_I 13 -#define IDS_MN_BRIGHTNESS_I 14 -#define IDS_MN_OPACITY_I 15 -#define IDD_PANEL 101 -#define IDD_DMTL_EXTRA6 116 -#define IDB_DMTL_BUTTONS 122 -#define IDB_DMTL_MASKBUTTONS 123 -#define IDD_DMTL_SHADER4 125 -#define IDD_DMTL_TEXMAP4 145 -#define IDD_SHADER_SKEL1 148 -#define IDD_DMTL_SAMPLING3 151 -#define IDC_TF_EDIT 218 -#define IDC_IOR_EDIT 219 -#define IDC_TR_EDIT 220 -#define IDC_DIM_AMT 220 -#define IDC_WIRE_EDIT 221 -#define IDC_DIM_MULT 222 -#define IDC_TF_SPIN 328 -#define IDC_IOR_SPIN 329 -#define IDC_TR_SPIN 330 -#define IDC_DIM_AMTSPIN 330 -#define IDC_DIM_MULTSPIN 331 -#define IDC_WIRE_SPIN 332 -#define IDC_CLOSEBUTTON 1000 -#define IDC_DOSTUFF 1000 -#define IDC_TR_SUB2 1001 -#define IDC_TR_SUB 1002 -#define IDC_TR_ADD 1003 -#define IDC_CSHADER1 1003 -#define IDC_MAPON_TR 1038 -#define IDC_PIXELS 1043 -#define IDC_UNITS 1044 -#define IDC_WIRE 1048 -#define IDD_DMTL_DYNAM 1057 -#define IDD_DMTL_XRAY 1058 -#define IDC_FACE_MAP 1059 -#define IDC_FACETED 1060 -#define IDC_HIGHLIGHT 1062 -#define IDC_2SIDE 1067 -#define IDC_SUPER_SAMP 1068 -#define IDC_ADAPT_ON 1069 -#define IDC_SAMPLE_TEX 1070 -#define IDC_MAPON_FI 1107 -#define IDC_BOUNCE_EDIT 1193 -#define IDC_BOUNCE_SPIN 1194 -#define IDC_STATFRIC_EDIT 1195 -#define IDC_STATFRIC_SPIN 1196 -#define IDC_SLIDFRIC_EDIT 1197 -#define IDC_SLIDFRIC_SPIN 1198 -#define IDC_DIM_REFL 1252 -#define IDC_TF_IN 1300 -#define IDC_TF_OUT 1301 -#define IDC_COLOR_NEW 1456 -#define IDC_EDIT 1490 -#define IDC_SPIN 1496 -#define IDC_SHADER 1728 -#define IDC_ESHADER 1729 -#define IDC_SAMPLEQUALITY_SPIN 1729 -#define IDC_SHADER2 1729 -#define IDC_CSHADER 1730 -#define IDC_SAMPLEQUALITY_EDIT 1730 -#define IDC_PIX_SAMPLER 1731 -#define IDC_THRESHOLD_EDIT 1732 -#define IDC_THRESHOLD_SPIN 1733 -#define IDC_PARAM0_EDIT 1734 -#define IDC_PARAM0_SPIN 1735 -#define IDC_PARAM1_EDIT 1736 -#define IDC_FILTER_CS 1736 -#define IDC_USEMAP_0 1737 -#define IDC_PARAM1_SPIN 1737 -#define IDC_AMTEDIT_0 1738 -#define IDC_AMTSPIN_0 1739 -#define IDC_MAP_0 1740 -#define IDC_USEMAP_1 1741 -#define IDC_AMTEDIT_1 1742 -#define IDC_AMTSPIN_1 1743 -#define IDC_MAP_1 1744 -#define IDC_USEMAP_2 1745 -#define IDC_AMTEDIT_2 1746 -#define IDC_AMTSPIN_2 1747 -#define IDC_MAP_2 1748 -#define IDC_USEMAP_3 1749 -#define IDC_AMTEDIT_3 1750 -#define IDC_AMTSPIN_3 1751 -#define IDC_MAP_3 1752 -#define IDC_USEMAP_4 1753 -#define IDC_AMTEDIT_4 1754 -#define IDC_AMTSPIN_4 1755 -#define IDC_MAP_4 1756 -#define IDC_USEMAP_5 1757 -#define IDC_AMTEDIT_5 1758 -#define IDC_AMTSPIN_5 1759 -#define IDC_MAP_5 1760 -#define IDC_USEMAP_6 1761 -#define IDC_AMTEDIT_6 1762 -#define IDC_AMTSPIN_6 1763 -#define IDC_MAP_6 1764 -#define IDC_USEMAP_7 1765 -#define IDC_AMTEDIT_7 1766 -#define IDC_AMTSPIN_7 1767 -#define IDC_MAP_7 1768 -#define IDC_USEMAP_8 1769 -#define IDC_AMTEDIT_8 1770 -#define IDC_AMTSPIN_8 1771 -#define IDC_MAP_8 1772 -#define IDC_USEMAP_9 1773 -#define IDC_AMTEDIT_9 1774 -#define IDC_AMTSPIN_9 1775 -#define IDC_MAP_9 1776 -#define IDC_USEMAP_10 1777 -#define IDC_AMTEDIT_10 1778 -#define IDC_AMTSPIN_10 1779 -#define IDC_MAP_10 1780 -#define IDC_USEMAP_11 1781 -#define IDC_AMTEDIT_11 1782 -#define IDC_AMTSPIN_11 1783 -#define IDC_MAP_11 1784 -#define IDC_LOCK_TEX01 1785 -#define IDC_USEMAP_12 1786 -#define IDC_AMTEDIT_12 1787 -#define IDC_USEMAP_13 1788 -#define IDC_AMTEDIT_13 1789 -#define IDC_USEMAP_14 1790 -#define IDC_AMTEDIT_14 1791 -#define IDC_AMTSPIN_12 1792 -#define IDC_AMTSPIN_13 1793 -#define IDC_AMTSPIN_14 1794 -#define IDC_MAP_12 1795 -#define IDC_MAP_13 1796 -#define IDC_MAP_14 1797 -#define IDC_USEMAP_15 1798 -#define IDC_AMTEDIT_15 1799 -#define IDC_AMTSPIN_15 1800 -#define IDC_MAP_15 1801 -#define IDC_USEMAP_16 1802 -#define IDC_AMTEDIT_16 1803 -#define IDC_AMTSPIN_16 1804 -#define IDC_MAP_16 1805 -#define IDC_USEMAP_17 1806 -#define IDC_BR_EDIT 1807 -#define IDC_AMTEDIT_17 1807 -#define IDC_BR_SPIN 1808 -#define IDC_AMTSPIN_17 1808 -#define IDC_MAPON_BR 1809 -#define IDC_MAP_17 1809 -#define IDC_USEMAP_18 1810 -#define IDC_AMTEDIT_18 1811 -#define IDC_AMTSPIN_18 1812 -#define IDC_MAP_18 1813 -#define IDC_MAPON_CLR 1814 -#define IDC_USEMAP_19 1814 -#define IDC_AMTEDIT_19 1815 -#define IDC_AMTSPIN_19 1816 -#define IDC_MAP_19 1817 -#define IDC_USEMAP_20 1818 -#define IDC_AMTEDIT_20 1819 -#define IDC_AMTSPIN_20 1820 -#define IDC_MAP_20 1821 -#define IDC_USEMAP_21 1822 -#define IDC_AMTEDIT_21 1823 -#define IDC_AMTSPIN_21 1824 -#define IDC_MAP_21 1825 -#define IDC_USEMAP_22 1826 -#define IDC_AMTEDIT_22 1827 -#define IDC_AMTSPIN_22 1828 -#define IDC_MAP_22 1829 -#define IDC_USEMAP_23 1830 -#define IDC_AMTEDIT_23 1831 -#define IDC_AMTSPIN_23 1832 -#define IDC_MAP_23 1833 -#define IDC_ADAPT_STATIC 1861 -#define IDC_ADVANCED_BUTTON 1862 -#define IDC_OPAC_TEXT1 1865 -#define IDC_OPAC_TEXT2 1866 -#define IDC_REFR_TEXT1 1867 -#define IDC_OPAC_TEXT3 1868 -#define IDC_REFL_TEXT1 1869 -#define IDC_REFL_TEXT2 1870 -#define IDC_REFL_BOX 1871 -#define IDC_OPAC_BOX 1872 -#define IDC_FILTER_OVERLAY 1873 -#define IDC_COMMENT_BOX 1874 -#define IDC_QUALITY_TEXT 1875 -#define IDC_COMMENT_TEXT 1876 -#define IDC_PARAM0_TEXT 1877 -#define IDC_PARAM1_TEXT 1878 -#define IDS_DS_WIREFRAME 10049 -#define IDS_DS_SHIN_STR 10052 -#define IDS_DS_OPACITY 10053 -#define IDS_JW_SHADERTYPE 10057 -#define IDS_DS_EXTRA 10059 -#define IDS_DS_TEXMAP 10060 -#define IDS_JW_MAPENABLES 10064 -#define IDS_DS_BU 10067 -#define IDS_DS_RL 10068 -#define IDS_DS_RR 10069 -#define IDS_DS_TEXMAPS 10070 -#define IDS_DS_FILTER 10071 -#define IDS_DS_WIRESZ 10114 -#define IDS_DS_IOR 10115 -#define IDS_JW_MAPS 10127 -#define IDS_JW_MAPAMOUNTS 10128 -#define IDS_JW_ENABLE 10133 -#define IDS_JW_AMOUNT 10134 -#define IDS_JW_SHADERBYNAME 10139 -#define IDS_JW_SAMPLERBYNAME 10140 -#define IDS_DS_AMOUNT 11442 -#define IDS_DS_CLASSTEXMAPS 11471 -#define IDS_DS_DYNAMICS 11484 -#define IDS_DS_BOUNCE 11485 -#define IDS_DS_STATFRIC 11486 -#define IDS_DS_SLIDFRIC 11487 -#define IDS_DS_FALLOFF 11495 -#define IDS_DS_DIMLEV 11514 -#define IDS_DS_DIMMULT 11515 -#define IDS_DS_DP 11530 -#define IDS_KE_STANDARD2 11534 -#define IDS_KE_SHADER 11535 -#define IDS_KE_SAMPLING 11536 -#define IDS_KE_XRAY 11537 -#define IDS_KE_NONE 11547 -#define IDS_JW_TWOSIDED 11585 -#define IDS_JW_FACEMAP 11586 -#define IDS_JW_OPACITYTYPE 11587 -#define IDS_JW_FILTERMAP 11588 -#define IDS_JW_FALLOFFTYPE 11589 -#define IDS_JW_WIREUNITS 11590 -#define IDS_JW_APPLYREFDIM 11591 -#define IDS_JW_PIXELSAMPLER 11592 -#define IDS_JW_SAMPLERQUAL 11593 -#define IDS_JW_SAMPLERENABLE 11594 -#define IDS_KE_STANDARD2_CDESC 11600 -#define IDS_JW_ADTEXLOCK 11620 -#define IDS_KE_FACETED 11672 -#define IDS_STRING_1 11673 -#define IDS_JW_ESHADERTYPE 11673 -#define IDS_STRING_2 11674 -#define IDS_JW_CSHADERTYPE 11674 -#define IDS_KE_SAMPLERADAPTTHRESH 11675 -#define IDS_KE_SAMPLERADAPTON 11676 -#define IDS_KE_SAMPLERADVANCED 11677 -#define IDS_JW_ESHADERBYNAME 11678 -#define IDS_JW_CSHADERBYNAME 11679 -#define IDS_KE_SUBSAMPLE_TEX_ON 11683 -#define IDS_KE_SAMPLER_PARAM0 11696 -#define IDS_KE_SAMPLER_PARAM1 11697 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 102 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1004 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/cs/engine/plugins/Max/Export/stdafx.cpp b/cs/engine/plugins/Max/Export/stdafx.cpp deleted file mode 100644 index 47ba18575..000000000 --- a/cs/engine/plugins/Max/Export/stdafx.cpp +++ /dev/null @@ -1,3 +0,0 @@ -#include "stdafx.h" -#pragma hdrstop - diff --git a/cs/engine/plugins/Max/MAX_Export60.vcxproj b/cs/engine/plugins/Max/MAX_Export60.vcxproj deleted file mode 100644 index 42705c0f6..000000000 --- a/cs/engine/plugins/Max/MAX_Export60.vcxproj +++ /dev/null @@ -1,287 +0,0 @@ - - - - - Debug - Win32 - - - Mixed - Win32 - - - Release - Win32 - - - - Max_Export_60 - {93AD3B7E-71DE-4FA2-90E7-A79782ED4960} - Max_Export_60 - 8.1 - - - - DynamicLibrary - v140 - false - MultiByte - - - DynamicLibrary - v140 - false - MultiByte - true - - - DynamicLibrary - v140 - false - MultiByte - - - - - - - - - - - - - - - - - - - - - - true - - - false - - - false - - - - _DEBUG;%(PreprocessorDefinitions) - true - true - Win32 - .\Debug\Utility.tlb - - - Disabled - $(DXSDK_DIR)Include;$(SolutionDir)engine;$(SolutionDir)sdk/3d_sdk/3dsmax/ver-6.0/include;$(SolutionDir)sdk/3d_sdk/3dsmax/ver-6.0/cssdk/include;$(SolutionDir)engine\plugins\shared;%(AdditionalIncludeDirectories) - DEBUG;WIN32;_WINDOWS;_USRDLL;_EXPORT;_MAX_EXPORT;_MAX_PLUGIN;XRCORE_STATIC;%(PreprocessorDefinitions) - true - Sync - EnableFastChecks - MultiThreadedDLL - Fast - false - true - Use - stdafx.h - $(IntDir)$(ProjectName).pch - $(IntDir) - $(IntDir) - $(IntDir) - true - Level3 - true - EditAndContinue - Cdecl - - - _DEBUG;%(PreprocessorDefinitions) - 0x0809 - - - mesh.lib;geom.lib;gfx.lib;maxutil.lib;core.lib;paramblk2.lib;comctl32.lib;odbc32.lib;odbccp32.lib;Winmm.lib;xrcorestatic.lib;%(AdditionalDependencies) - $(OutDir)xray_export.dlu - true - $(SolutionDir)sdk/3d_sdk/3dsmax/ver-6.0/lib;$(SolutionDir)libraries\$(Configuration);$(SolutionDir)sdk\libraries;$(DXSDK_DIR)Lib\x86;%(AdditionalLibraryDirectories) - Export\Utility.def - true - $(OutDir)xray_export.pdb - 0x08970000 - - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - Win32 - .\Release\Utility.tlb - - - AnySuitable - true - $(DXSDK_DIR)Include;$(SolutionDir)engine;$(SolutionDir)sdk/3d_sdk/3dsmax/ver-6.0/include;$(SolutionDir)sdk/3d_sdk/3dsmax/ver-6.0/cssdk/include;$(SolutionDir)engine\plugins\shared;%(AdditionalIncludeDirectories) - UTILITY_EXPORTS;WIN32;_WINDOWS;_USRDLL;_MAX_EXPORT;_MAX_PLUGIN;XRCORE_STATIC;%(PreprocessorDefinitions) - true - false - - MultiThreadedDLL - true - Fast - false - true - Use - stdafx.h - $(IntDir)$(ProjectName).pch - $(IntDir) - $(IntDir) - $(IntDir) - - Level3 - true - false - - - NDEBUG;%(PreprocessorDefinitions) - 0x0809 - - - mesh.lib;geom.lib;gfx.lib;maxutil.lib;core.lib;paramblk2.lib;comctl32.lib;odbc32.lib;odbccp32.lib;Winmm.lib;xrcorestatic.lib;%(AdditionalDependencies) - $(OutDir)xray_export.dlu - true - $(SolutionDir)sdk/3d_sdk/3dsmax/ver-6.0/lib;$(SolutionDir)libraries\$(Configuration);$(SolutionDir)sdk\libraries;$(DXSDK_DIR)Lib\x86;%(AdditionalLibraryDirectories) - Export\Utility.def - - - true - 0x08970000 - - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - Win32 - .\Release\Utility.tlb - - - Disabled - AnySuitable - $(DXSDK_DIR)Include;$(SolutionDir)engine;$(SolutionDir)sdk/3d_sdk/3dsmax/ver-6.0/include;$(SolutionDir)sdk/3d_sdk/3dsmax/ver-6.0/cssdk/include;$(SolutionDir)engine\plugins\shared;%(AdditionalIncludeDirectories) - UTILITY_EXPORTS;WIN32;_WINDOWS;_USRDLL;_MAX_EXPORT;_MAX_PLUGIN;%(PreprocessorDefinitions) - true - MultiThreadedDLL - true - true - Use - stdafx.h - $(IntDir)$(ProjectName).pch - $(IntDir) - $(IntDir) - $(IntDir) - true - Level3 - true - ProgramDatabase - - - NDEBUG;%(PreprocessorDefinitions) - 0x0809 - - - d3dx.lib;mesh.lib;geom.lib;gfx.lib;maxutil.lib;core.lib;paramblk2.lib;comctl32.lib;odbc32.lib;odbccp32.lib;Winmm.lib;R:\MagicFM\Sdk\Library\Release\MagicFM.lib;%(AdditionalDependencies) - $(OutDir)xray_export.dlu - true - $(SolutionDir)sdk/3d_sdk/3dsmax/ver-6.0/lib;$(SolutionDir)libraries\$(Configuration);$(SolutionDir)sdk\libraries;$(DXSDK_DIR)Lib\x86;%(AdditionalLibraryDirectories) - .\Utility.def - true - .\Release\XRayExportUtility.pdb - false - false - true - 0x08970000 - - - - - - - - - - - - - - - - - - - - - - - - true - true - true - - - - - - - Create - Create - Create - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {f1066eac-ee25-4c7a-9023-5957a6f7ba27} - false - - - {e8cf1ada-264a-4127-86c2-fd7057d3792c} - - - - - - \ No newline at end of file diff --git a/cs/engine/plugins/Max/MAX_Export60.vcxproj.filters b/cs/engine/plugins/Max/MAX_Export60.vcxproj.filters deleted file mode 100644 index e338fdc74..000000000 --- a/cs/engine/plugins/Max/MAX_Export60.vcxproj.filters +++ /dev/null @@ -1,139 +0,0 @@ -п»ї - - - - {bf7adc68-f6ee-4cc9-a327-54484e7860b9} - - - {75de593d-3ae2-4266-9475-0a238c3374b6} - - - {38dbd0fe-fbc7-4e1b-ab68-829721d861b7} - - - {b8a28331-1f3d-47ab-be3e-f0cc7fd94ded} - - - {880db153-e212-41e1-8733-d5fe8898d07e} - - - {12f6a1f8-2e8e-49ad-9f92-96b0f1edf675} - - - {d2f09be9-3b5c-42ee-a5af-b1e175092767} - - - {94115d95-9608-47f5-87bd-d6764cfd80c9} - - - - - Kernel - - - Kernel - - - Kernel - - - Kernel - - - Shared Files\Editor - - - Export Object - - - Export Object - - - Export Object - - - Export Skin - - - Export Skin - - - Export Skin - - - Export Skin - - - Export Skin Keys - - - - - - - - - - - - - - - - - Kernel - - - Kernel - - - Kernel - - - Shared Files\Engine - - - Shared Files\Editor - - - Shared Files\Editor - - - Shared Files\Editor - - - Shared Files\Material - - - Shared Files\Material - - - Shared Files\Material - - - Export Skin - - - - - - - - - - - - - - Kernel - - - - - Kernel - - - Kernel - - - \ No newline at end of file diff --git a/cs/engine/plugins/Max/MAX_Material60.vcxproj b/cs/engine/plugins/Max/MAX_Material60.vcxproj deleted file mode 100644 index cfe77b428..000000000 --- a/cs/engine/plugins/Max/MAX_Material60.vcxproj +++ /dev/null @@ -1,188 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - Max_Material_60 - {56AD8F54-F89E-4B5A-93F8-8A617BFD1160} - Max_Material_60 - 8.1 - - - - DynamicLibrary - v140 - false - - - DynamicLibrary - v140 - false - - - - - - - - - - - - - - - - - true - - - false - - - - _DEBUG;%(PreprocessorDefinitions) - true - true - Win32 - .\Debug\GameMaterial.tlb - - - /LD %(AdditionalOptions) - Disabled - $(DXSDK_DIR)Include;$(SolutionDir)engine;$(SolutionDir)sdk/3d_sdk/3dsmax/ver-6.0/include;$(SolutionDir)sdk/3d_sdk/3dsmax/ver-6.0/cssdk/include;$(SolutionDir)engine\plugins\shared;%(AdditionalIncludeDirectories) - DEBUG;WIN32;_WINDOWS;_USRDLL;_MAX_MATERIAL;_MAX_PLUGIN;XRCORE_STATIC;%(PreprocessorDefinitions) - true - Sync - MultiThreadedDLL - Fast - false - true - Use - $(IntDir)$(ProjectName).pch - $(IntDir) - $(IntDir) - $(IntDir) - Level3 - true - EditAndContinue - Cdecl - Default - - - _DEBUG;%(PreprocessorDefinitions) - 0x0419 - - - Winmm.lib;comctl32.lib;bmm.lib;core.lib;geom.lib;gfx.lib;mesh.lib;maxutil.lib;maxscrpt.lib;manipsys.lib;paramblk2.lib;xrcorestatic.lib;%(AdditionalDependencies) - $(OutDir)xray_material.dlt - true - $(SolutionDir)sdk/3d_sdk/3dsmax/ver-6.0/lib;$(SolutionDir)libraries\$(Configuration);$(SolutionDir)sdk\libraries;$(DXSDK_DIR)Lib\x86;%(AdditionalLibraryDirectories) - $(SolutionDir)engine\plugins\shared\GameMaterial.def - true - $(OutDir)xray_material.pdb - Windows - 0x3e0e0000 - - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - Win32 - .\Release\GameMaterial.tlb - - - /LD %(AdditionalOptions) - OnlyExplicitInline - $(DXSDK_DIR)Include;$(SolutionDir)engine;$(SolutionDir)sdk/3d_sdk/3dsmax/ver-6.0/include;$(SolutionDir)sdk/3d_sdk/3dsmax/ver-6.0/cssdk/include;$(SolutionDir)engine\plugins\shared;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;_USRDLL;_MAX_MATERIAL;_MAX_PLUGIN;XRCORE_STATIC;%(PreprocessorDefinitions) - true - false - - MultiThreadedDLL - true - Fast - false - true - Use - $(IntDir)$(ProjectName).pch - $(IntDir) - $(IntDir) - $(IntDir) - Level3 - true - Cdecl - Default - - - NDEBUG;%(PreprocessorDefinitions) - 0x0419 - - - Winmm.lib;comctl32.lib;core.lib;geom.lib;gfx.lib;mesh.lib;maxutil.lib;maxscrpt.lib;manipsys.lib;paramblk2.lib;xrcorestatic.lib;%(AdditionalDependencies) - $(OutDir)xray_material.dlt - true - $(SolutionDir)sdk/3d_sdk/3dsmax/ver-6.0/lib;$(SolutionDir)libraries\$(Configuration);$(SolutionDir)sdk\libraries;$(DXSDK_DIR)Lib\x86;%(AdditionalLibraryDirectories) - $(SolutionDir)engine\plugins\shared\GameMaterial.def - - - Windows - true - 0x3e0e0000 - - - - - - - - - - - Create - Create - - - - - - - - - - - - - - - - - - - - - - - - - {f1066eac-ee25-4c7a-9023-5957a6f7ba27} - false - - - {e8cf1ada-264a-4127-86c2-fd7057d3792c} - - - - - - \ No newline at end of file diff --git a/cs/engine/plugins/Max/MAX_Material60.vcxproj.filters b/cs/engine/plugins/Max/MAX_Material60.vcxproj.filters deleted file mode 100644 index bbab1e860..000000000 --- a/cs/engine/plugins/Max/MAX_Material60.vcxproj.filters +++ /dev/null @@ -1,54 +0,0 @@ -п»ї - - - - {ac0cd223-0328-4b8a-a422-5482c0949145} - - - {720e522f-5795-4274-bb57-32853708dbd8} - - - {89e5eeb9-1315-4a77-899a-6e0215d47e8e} - - - {63ead822-dd80-424b-887e-0f0f62fe4238} - - - - - Kernel - - - Kernel - - - - - - - - - - - - - Kernel - - - - - - - - - - - - Kernel - - - - - - - \ No newline at end of file diff --git a/cs/engine/plugins/Max/Material/DllEntry.cpp b/cs/engine/plugins/Max/Material/DllEntry.cpp deleted file mode 100644 index 1c6c88411..000000000 --- a/cs/engine/plugins/Max/Material/DllEntry.cpp +++ /dev/null @@ -1,72 +0,0 @@ -#include "stdafx.h" -#pragma hdrstop - -#include "..\..\Shared\GameMaterial.h" - -extern ClassDesc2* GetXRayMtlDesc (); -extern TCHAR* GetString (int id); - -HINSTANCE hInstance; -int controlsInit = FALSE; - -BOOL WINAPI DllMain(HINSTANCE hinstDLL, - ULONG fdwReason, - LPVOID lpvReserved) -{ - hInstance = hinstDLL; // Hang on to this DLL's instance handle. - - if(!controlsInit) - { - controlsInit = TRUE; - Core._initialize("S.T.A.L.K.E.R.Plugin",0,FALSE); - FS._initialize (CLocatorAPI::flScanAppRoot,NULL,"xray_path.ltx"); - FPU::m64r (); // нужно чтобы макс не сбрасывал контрольки в 0 - InitCustomControls(hInstance); // Initialize MAX's custom controls - InitCommonControls(); // Initialize Win95 controls - // load shader list - XRayMtl::LoadXRayShaderList(); - } - - if (DLL_PROCESS_DETACH==fdwReason){ - Core._destroy(); - XRayMtl::UnloadXRayShaderList(); - } - - return (TRUE); -} - -__declspec(dllexport) const TCHAR* LibDescription() -{ - return GetString(IDS_LIBDESCRIPTION); -} - -__declspec(dllexport) int LibNumberClasses() -{ - return 1; -} - -__declspec(dllexport) ClassDesc* LibClassDesc(int i) -{ - switch(i) - { - case 0: - return GetXRayMtlDesc(); - default: - return 0; - } -} - -__declspec(dllexport) ULONG LibVersion() -{ - return VERSION_3DSMAX; -} - -TCHAR *GetString(int id) -{ - static TCHAR buf[256]; - - if(hInstance) - return LoadString(hInstance, id, buf, sizeof(buf)) ? buf : NULL; - - return NULL; -} diff --git a/cs/engine/plugins/Max/Material/GameMaterial.rc b/cs/engine/plugins/Max/Material/GameMaterial.rc deleted file mode 100644 index d8fe25101..000000000 --- a/cs/engine/plugins/Max/Material/GameMaterial.rc +++ /dev/null @@ -1,608 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "XRayMtlRes.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_PANEL DIALOGEX 0, 0, 216, 80 -STYLE DS_SETFONT | WS_CHILD -FONT 8, "MS Sans Serif", 0, 0, 0x0 -BEGIN - RTEXT " Color :",IDC_STATIC,22,26,26,10 - CONTROL "User1",IDC_COLOR_NEW,"ColorSwatch",0x0,51,18,50,26 - CONTROL "M",IDC_MAPON_CLR,"CustButton",0x0,106,27,10,10 - CONTROL "",IDC_HIGHLIGHT,"Static",SS_BLACKFRAME,135,25,67,47 - LTEXT " Opacity :",IDC_STATIC,19,60,31,8 - CONTROL "",IDC_TR_EDIT,"CustEdit",WS_TABSTOP,52,60,22,10 - CONTROL "0,255,0",IDC_TR_SPIN,"SpinnerControl",WS_TABSTOP,74,60, - 11,10 - CONTROL "M",IDC_MAPON_TR,"CustButton",0x0,91,60,10,10 - RTEXT "Brightness :",IDC_STATIC,12,48,37,8 - CONTROL "",IDC_BR_EDIT,"CustEdit",WS_TABSTOP,52,48,22,10 - CONTROL "0,255,0",IDC_BR_SPIN,"SpinnerControl",WS_TABSTOP,74,48, - 11,10 - CONTROL "M",IDC_MAPON_BR,"CustButton",0x0,91,48,10,10 - GROUPBOX "Shading Settings",IDC_STATIC,4,4,119,72 - CTEXT "Specular Curve",IDC_STATIC,135,11,67,12,SS_CENTERIMAGE | - SS_SUNKEN -END - -IDD_DMTL_SHADER4 DIALOGEX 0, 0, 216, 28 -STYLE DS_SETFONT | WS_CHILD -FONT 8, "MS Sans Serif", 0, 0, 0x0 -BEGIN - COMBOBOX IDC_SHADER,8,3,85,75,CBS_DROPDOWNLIST | WS_VSCROLL | - WS_TABSTOP - CONTROL "Wire",IDC_WIRE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, - 109,2,27,10 - CONTROL "2-Sided",IDC_2SIDE,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,162,2,36,10 - CONTROL "Face Map",IDC_FACE_MAP,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,110,14,44,10 - CONTROL "Faceted",IDC_FACETED,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,162,14,44,10 -END - -IDD_DMTL_DYNAM DIALOG 0, 0, 216, 49 -STYLE DS_SETFONT | WS_CHILD | WS_VISIBLE -FONT 8, "MS Sans Serif" -BEGIN - CONTROL "",IDC_BOUNCE_EDIT,"CustEdit",WS_TABSTOP,108,6,35,10 - LTEXT "Bounce Coefficient:",IDC_STATIC,44,7,63,9 - CONTROL "0,255,0",IDC_BOUNCE_SPIN,"SpinnerControl",0x0,144,6,11, - 10 - CONTROL "",IDC_STATFRIC_EDIT,"CustEdit",WS_TABSTOP,108,20,35,10 - LTEXT "Static Friction:",IDC_STATIC,58,21,49,9 - CONTROL "0,255,0",IDC_STATFRIC_SPIN,"SpinnerControl",0x0,144,20, - 11,10 - CONTROL "",IDC_SLIDFRIC_EDIT,"CustEdit",WS_TABSTOP,108,33,35,10 - LTEXT "Sliding Friction:",IDC_STATIC,56,33,50,9 - CONTROL "0,255,0",IDC_SLIDFRIC_SPIN,"SpinnerControl",0x0,144,33, - 11,10 -END - -IDD_DMTL_TEXMAP4 DIALOG 0, 0, 216, 309 -STYLE DS_SETFONT | WS_CHILD -FONT 8, "MS Sans Serif" -BEGIN - LTEXT "Amount",IDC_STATIC,76,4,24,8 - LTEXT "Map Type",IDC_STATIC,152,4,16,8 - CONTROL "",IDC_USEMAP_0,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 16,68,10 - CONTROL "",IDC_AMTEDIT_0,"CustEdit",WS_TABSTOP,72,16,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_0,"SpinnerControl",0x0,92,16,11,10 - CONTROL "",IDC_MAP_0,"CustButton",WS_TABSTOP,104,16,100,10 - CONTROL "User1",IDC_LOCK_TEX01,"CustButton",0x0,206,22,10,10 - CONTROL "",IDC_USEMAP_1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 28,68,10 - CONTROL "",IDC_AMTEDIT_1,"CustEdit",WS_TABSTOP,72,28,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_1,"SpinnerControl",0x0,92,28,11,10 - CONTROL "",IDC_MAP_1,"CustButton",WS_TABSTOP,104,28,100,10 - CONTROL "",IDC_USEMAP_2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 40,68,10 - CONTROL "",IDC_AMTEDIT_2,"CustEdit",WS_TABSTOP,72,40,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_2,"SpinnerControl",0x0,92,40,11,10 - CONTROL "",IDC_MAP_2,"CustButton",WS_TABSTOP,104,40,100,10 - CONTROL "",IDC_USEMAP_3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 52,68,10 - CONTROL "",IDC_AMTEDIT_3,"CustEdit",WS_TABSTOP,72,52,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_3,"SpinnerControl",0x0,92,52,11,10 - CONTROL "",IDC_MAP_3,"CustButton",WS_TABSTOP,104,52,100,10 - CONTROL "",IDC_USEMAP_4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 64,68,10 - CONTROL "",IDC_AMTEDIT_4,"CustEdit",WS_TABSTOP,72,64,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_4,"SpinnerControl",0x0,92,64,11,10 - CONTROL "",IDC_MAP_4,"CustButton",WS_TABSTOP,104,64,100,10 - CONTROL "",IDC_USEMAP_5,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 76,68,10 - CONTROL "",IDC_AMTEDIT_5,"CustEdit",WS_TABSTOP,72,76,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_5,"SpinnerControl",0x0,92,76,11,10 - CONTROL "",IDC_MAP_5,"CustButton",WS_TABSTOP,104,76,100,10 - CONTROL "",IDC_USEMAP_6,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 88,68,10 - CONTROL "",IDC_AMTEDIT_6,"CustEdit",WS_TABSTOP,72,88,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_6,"SpinnerControl",0x0,92,88,11,10 - CONTROL "",IDC_MAP_6,"CustButton",WS_TABSTOP,104,88,100,10 - CONTROL "",IDC_USEMAP_7,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 100,68,10 - CONTROL "",IDC_AMTEDIT_7,"CustEdit",WS_TABSTOP,72,100,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_7,"SpinnerControl",0x0,92,100,11, - 10 - CONTROL "",IDC_MAP_7,"CustButton",WS_TABSTOP,104,100,100,10 - CONTROL "",IDC_USEMAP_8,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 112,68,10 - CONTROL "",IDC_AMTEDIT_8,"CustEdit",WS_TABSTOP,72,112,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_8,"SpinnerControl",0x0,92,112,11, - 10 - CONTROL "",IDC_MAP_8,"CustButton",WS_TABSTOP,104,112,100,10 - CONTROL "",IDC_USEMAP_9,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 124,68,10 - CONTROL "",IDC_AMTEDIT_9,"CustEdit",WS_TABSTOP,72,124,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_9,"SpinnerControl",0x0,92,124,11, - 10 - CONTROL "",IDC_MAP_9,"CustButton",WS_TABSTOP,104,124,100,10 - CONTROL "",IDC_USEMAP_10,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 136,68,10 - CONTROL "",IDC_AMTEDIT_10,"CustEdit",WS_TABSTOP,72,136,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_10,"SpinnerControl",0x0,92,136,11, - 10 - CONTROL "",IDC_MAP_10,"CustButton",WS_TABSTOP,104,136,100,10 - CONTROL "",IDC_USEMAP_11,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 148,68,10 - CONTROL "",IDC_AMTEDIT_11,"CustEdit",WS_TABSTOP,72,148,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_11,"SpinnerControl",0x0,92,148,11, - 10 - CONTROL "",IDC_MAP_11,"CustButton",WS_TABSTOP,104,148,100,10 - CONTROL "",IDC_USEMAP_12,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 160,68,10 - CONTROL "",IDC_AMTEDIT_12,"CustEdit",WS_TABSTOP,72,160,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_12,"SpinnerControl",0x0,92,160,11, - 10 - CONTROL "",IDC_MAP_12,"CustButton",WS_TABSTOP,104,160,100,10 - CONTROL "",IDC_USEMAP_13,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 172,68,10 - CONTROL "",IDC_AMTEDIT_13,"CustEdit",WS_TABSTOP,72,172,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_13,"SpinnerControl",0x0,92,172,11, - 10 - CONTROL "",IDC_MAP_13,"CustButton",WS_TABSTOP,104,172,100,10 - CONTROL "",IDC_USEMAP_14,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 184,68,10 - CONTROL "",IDC_AMTEDIT_14,"CustEdit",WS_TABSTOP,72,184,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_14,"SpinnerControl",0x0,92,184,11, - 10 - CONTROL "",IDC_MAP_14,"CustButton",WS_TABSTOP,104,184,100,10 - CONTROL "",IDC_USEMAP_15,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 196,68,10 - CONTROL "",IDC_AMTEDIT_15,"CustEdit",WS_TABSTOP,72,196,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_15,"SpinnerControl",0x0,92,196,11, - 10 - CONTROL "",IDC_MAP_15,"CustButton",WS_TABSTOP,104,196,100,10 - CONTROL "",IDC_USEMAP_16,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 208,68,10 - CONTROL "",IDC_AMTEDIT_16,"CustEdit",WS_TABSTOP,72,208,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_16,"SpinnerControl",0x0,92,208,11, - 10 - CONTROL "",IDC_MAP_16,"CustButton",WS_TABSTOP,104,208,100,10 - CONTROL "",IDC_USEMAP_17,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 220,68,10 - CONTROL "",IDC_AMTEDIT_17,"CustEdit",WS_TABSTOP,72,220,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_17,"SpinnerControl",0x0,92,220,11, - 10 - CONTROL "",IDC_MAP_17,"CustButton",WS_TABSTOP,104,220,100,10 - CONTROL "",IDC_USEMAP_18,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 232,68,10 - CONTROL "",IDC_AMTEDIT_18,"CustEdit",WS_TABSTOP,72,232,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_18,"SpinnerControl",0x0,92,232,11, - 10 - CONTROL "",IDC_MAP_18,"CustButton",WS_TABSTOP,104,232,100,10 - CONTROL "",IDC_USEMAP_19,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 244,68,10 - CONTROL "",IDC_AMTEDIT_19,"CustEdit",WS_TABSTOP,72,244,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_19,"SpinnerControl",0x0,92,244,11, - 10 - CONTROL "",IDC_MAP_19,"CustButton",WS_TABSTOP,104,244,100,10 - CONTROL "",IDC_USEMAP_20,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 256,68,10 - CONTROL "",IDC_AMTEDIT_20,"CustEdit",WS_TABSTOP,72,256,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_20,"SpinnerControl",0x0,92,256,11, - 10 - CONTROL "",IDC_MAP_20,"CustButton",WS_TABSTOP,104,256,100,10 - CONTROL "",IDC_USEMAP_21,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 268,68,10 - CONTROL "",IDC_AMTEDIT_21,"CustEdit",WS_TABSTOP,72,268,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_21,"SpinnerControl",0x0,92,268,11, - 10 - CONTROL "",IDC_MAP_21,"CustButton",WS_TABSTOP,104,268,100,10 - CONTROL "",IDC_USEMAP_22,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 280,68,10 - CONTROL "",IDC_AMTEDIT_22,"CustEdit",WS_TABSTOP,72,280,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_22,"SpinnerControl",0x0,92,280,11, - 10 - CONTROL "",IDC_MAP_22,"CustButton",WS_TABSTOP,104,280,100,10 - CONTROL "",IDC_USEMAP_23,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 292,68,10 - CONTROL "",IDC_AMTEDIT_23,"CustEdit",WS_TABSTOP,72,292,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_23,"SpinnerControl",0x0,92,292,11, - 10 - CONTROL "",IDC_MAP_23,"CustButton",WS_TABSTOP,104,292,100,10 -END - -IDD_DMTL_SAMPLING3 DIALOG 0, 0, 216, 59 -STYLE DS_SETFONT | WS_CHILD -FONT 8, "MS Sans Serif" -BEGIN - CONTROL "Enable Sampler",IDC_SUPER_SAMP,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,3,5,64,10 - COMBOBOX IDC_PIX_SAMPLER,75,3,80,84,CBS_DROPDOWNLIST | WS_VSCROLL | - WS_TABSTOP - RTEXT "Quality:",IDC_QUALITY_TEXT,155,4,27,9,NOT WS_GROUP - CONTROL "",IDC_SAMPLEQUALITY_EDIT,"CustEdit",WS_TABSTOP,183,3,19, - 10 - CONTROL "0,255,0",IDC_SAMPLEQUALITY_SPIN,"SpinnerControl", - WS_TABSTOP,202,3,11,10 - CONTROL "Supersamp. Tex.",IDC_SAMPLE_TEX,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,3,18,71,10 - GROUPBOX "",IDC_COMMENT_BOX,75,16,80,41 - LTEXT "No Comment",IDC_COMMENT_TEXT,77,21,76,34 - RTEXT "Param0",IDC_PARAM0_TEXT,155,17,27,9,NOT WS_GROUP - CONTROL "",IDC_PARAM0_EDIT,"CustEdit",WS_TABSTOP,183,16,19,10 - CONTROL "0,255,0",IDC_PARAM0_SPIN,"SpinnerControl",WS_TABSTOP, - 202,16,11,10 - CONTROL "Adaptive",IDC_ADAPT_ON,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,3,32,56,10 - RTEXT "Param1",IDC_PARAM1_TEXT,155,30,27,9,NOT WS_GROUP - CONTROL "",IDC_PARAM1_EDIT,"CustEdit",WS_TABSTOP,183,30,19,10 - CONTROL "0,255,0",IDC_PARAM1_SPIN,"SpinnerControl",WS_TABSTOP, - 201,30,11,10 - RTEXT "Threshold:",IDC_ADAPT_STATIC,2,46,34,8,NOT WS_GROUP - CONTROL "",IDC_THRESHOLD_EDIT,"CustEdit",WS_TABSTOP,38,45,25,10 - CONTROL "0,255,0",IDC_THRESHOLD_SPIN,"SpinnerControl",WS_TABSTOP, - 63,45,11,10 - PUSHBUTTON "Advanced...",IDC_ADVANCED_BUTTON,166,43,46,12 -END - -IDD_DMTL_EXTRA6 DIALOGEX 0, 0, 216, 101 -STYLE DS_SETFONT | WS_CHILD -FONT 8, "MS Sans Serif", 0, 0, 0x1 -BEGIN - GROUPBOX "Advanced Transparency",IDC_OPAC_BOX,4,1,147,71 - LTEXT "Falloff:",IDC_OPAC_TEXT1,9,11,22,8 - LTEXT "Type:",IDC_OPAC_TEXT3,56,11,18,8 - CONTROL "In",IDC_TF_IN,"Button",BS_AUTORADIOBUTTON | WS_GROUP | - WS_TABSTOP,26,21,20,8 - CONTROL "Out",IDC_TF_OUT,"Button",BS_AUTORADIOBUTTON | - WS_TABSTOP,26,32,24,10 - RTEXT "Refraction Filter: ",IDC_FILTER_OVERLAY,44,19,59,11 - CONTROL "Filter:",IDC_TR_SUB2,"Button",BS_AUTORADIOBUTTON | - WS_GROUP | WS_TABSTOP,72,20,29,8 - CONTROL "Subtractive",IDC_TR_SUB,"Button",BS_AUTORADIOBUTTON | - WS_TABSTOP,72,33,52,8 - CONTROL "Additive",IDC_TR_ADD,"Button",BS_AUTORADIOBUTTON | - WS_TABSTOP,72,45,37,8 - CONTROL "User1",IDC_FILTER_CS,"ColorSwatch",WS_TABSTOP,105,17,27, - 14 - CONTROL "M",IDC_MAPON_FI,"CustButton",WS_TABSTOP,136,20,10,10 - GROUPBOX "Wire",IDC_STATIC,153,1,59,71 - LTEXT "Size:",IDC_STATIC,156,21,16,9,0,WS_EX_RIGHT - CONTROL "",IDC_WIRE_EDIT,"CustEdit",WS_TABSTOP,174,20,22,10 - CONTROL "0,255,0",IDC_WIRE_SPIN,"SpinnerControl",0x0,196,20,11, - 10 - LTEXT "In:",IDC_STATIC,160,45,8,8 - CONTROL "Pixels",IDC_PIXELS,"Button",BS_AUTORADIOBUTTON | - WS_GROUP | WS_TABSTOP,172,41,32,8 - CONTROL "Units",IDC_UNITS,"Button",BS_AUTORADIOBUTTON | - WS_TABSTOP,172,52,28,8 - LTEXT "Index of Refraction:",IDC_REFR_TEXT1,11,57,91,9,0, - WS_EX_RIGHT - CONTROL "",IDC_IOR_EDIT,"CustEdit",WS_TABSTOP,105,57,19,10 - CONTROL "0,255,0",IDC_IOR_SPIN,"SpinnerControl",0x0,124,57,11,10 - GROUPBOX "Reflection Dimming",IDC_REFL_BOX,4,72,209,27 - CONTROL "Apply",IDC_DIM_REFL,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,11,83,36,10 - LTEXT "Dim Level:",IDC_REFL_TEXT1,52,84,33,8,0,WS_EX_RIGHT - CONTROL "",IDC_DIM_AMT,"CustEdit",WS_TABSTOP,87,83,24,10 - CONTROL "0,255,0",IDC_DIM_AMTSPIN,"SpinnerControl",0x0,112,83,11, - 10 - LTEXT "Refl. Level:",IDC_REFL_TEXT2,132,84,38,8 - CONTROL "",IDC_DIM_MULT,"CustEdit",WS_TABSTOP,173,83,24,10 - CONTROL "0,255,0",IDC_DIM_MULTSPIN,"SpinnerControl",0x0,198,83, - 11,10 - LTEXT "Amt:",IDC_OPAC_TEXT2,12,44,16,8 - CONTROL "",IDC_TF_EDIT,"CustEdit",WS_TABSTOP,28,44,20,10 - CONTROL "0,255,0",IDC_TF_SPIN,"SpinnerControl",0x0,48,44,11,10 -END - -IDD_DMTL_XRAY DIALOGEX 0, 0, 216, 50 -STYLE DS_SETFONT | WS_CHILD -FONT 8, "MS Sans Serif", 0, 0, 0x0 -BEGIN - LTEXT "Engine Shader",IDC_STATIC,8,7,52,8 - COMBOBOX IDC_ESHADER,63,4,143,75,CBS_DROPDOWNLIST | WS_VSCROLL | - WS_TABSTOP - COMBOBOX IDC_CSHADER,63,19,143,75,CBS_DROPDOWNLIST | WS_VSCROLL | - WS_TABSTOP - LTEXT "Compiler Shader",IDC_STATIC,8,22,52,8 - COMBOBOX IDC_GAMEMTL,63,34,143,75,CBS_DROPDOWNLIST | WS_VSCROLL | - WS_TABSTOP - LTEXT "Game Material",IDC_STATIC,8,37,46,8 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_PANEL, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 101 - TOPMARGIN, 7 - END - - IDD_DMTL_SHADER4, DIALOG - BEGIN - VERTGUIDE, 8 - VERTGUIDE, 206 - END - - IDD_DMTL_EXTRA6, DIALOG - BEGIN - TOPMARGIN, 1 - END - - IDD_DMTL_XRAY, DIALOG - BEGIN - VERTGUIDE, 8 - VERTGUIDE, 206 - BOTTOMMARGIN, 46 - END -END -#endif // APSTUDIO_INVOKED - - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "XRayMtlRes.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,0,0,0 - PRODUCTVERSION 3,0,0,0 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x40004L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "Comments", "TECH: " - VALUE "FileDescription", "Demo Material for testing" - VALUE "FileVersion", "4.0.0.0" - VALUE "InternalName", "DemoMtl" - VALUE "LegalTrademarks", "3D Studio MAX, Biped, Character Studio, Heidi, Kinetix and Physique are registered trademarks and 3ds max, combustion, Discreet, DWG Unplugged, DXF, FLI and FLC are trademarks of Autodesk, Inc." - VALUE "OriginalFilename", "DemoMtl.dlb" - VALUE "ProductName", "3ds max" - VALUE "ProductVersion", "4.0.0.0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - - -///////////////////////////////////////////////////////////////////////////// -// -// Bitmap -// - -IDB_DMTL_MASKBUTTONS BITMAP "dmtlmsk.bmp" -IDB_DMTL_BUTTONS BITMAP "dmtlbut.bmp" - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE -BEGIN - IDS_LIBDESCRIPTION "Demo Shader for testing" - IDS_CATEGORY "S.T.A.L.K.E.R. Game Material" - IDS_CLASS_NAME "S.T.A.L.K.E.R.Mtl" - IDS_PARAMS "Parameters" - IDS_SPIN "Spin" - IDS_COMMENT "Appwizard generated Plugin" - IDS_MN_DIFFUSE "Diffuse" - IDS_MN_BRIGHTNESS "Brightness" - IDS_MN_OPACITY "Opacity" - IDS_MN_NONE "None" - IDS_COLOR "Diffuse Color" - IDS_PARAMCHG "Parameter Change" - IDS_MN_DIFFUSE_I "Diffuse" - IDS_MN_BRIGHTNESS_I "Brightness" - IDS_MN_OPACITY_I "Opacity" -END - -STRINGTABLE -BEGIN - IDS_DS_DP "Displacement" - IDS_KE_STANDARD2 "Standard" - IDS_KE_SHADER "Shader Basic Parameters" -END - -STRINGTABLE -BEGIN - IDS_DS_WIREFRAME "Wire" - IDS_DS_SHIN_STR "Specular Level" - IDS_DS_OPACITY "Opacity" - IDS_JW_SHADERTYPE "Shader Type" - IDS_DS_EXTRA "Extended Parameters" - IDS_DS_TEXMAP "Maps" -END - -STRINGTABLE -BEGIN - IDS_JW_TWOSIDED "Two-sided" - IDS_JW_FACEMAP "Face Map" - IDS_JW_OPACITYTYPE "Opacity Type" - IDS_JW_FILTERMAP "Filter Map" - IDS_JW_FALLOFFTYPE "Falloff Type" - IDS_JW_WIREUNITS "Wire Units" - IDS_JW_APPLYREFDIM "Apply Reflection Dimming" - IDS_JW_PIXELSAMPLER "Pixel Sampler" - IDS_JW_SAMPLERQUAL "Sampler Quality" - IDS_JW_SAMPLERENABLE "Sampler Enable" -END - -STRINGTABLE -BEGIN - IDS_JW_MAPAMOUNTS "Map Amounts" - IDS_JW_ENABLE "Enable" - IDS_JW_AMOUNT "Amount" - IDS_JW_SHADERBYNAME "Shader Name" - IDS_JW_SAMPLERBYNAME "Sampler Name" -END - -STRINGTABLE -BEGIN - IDS_KE_FACETED "Faceted" - IDS_JW_ESHADERTYPE "EShader Type" - IDS_JW_CSHADERTYPE "CShader Type" - IDS_KE_SAMPLERADAPTTHRESH "Adaptive Threshold" - IDS_KE_SAMPLERADAPTON "Adaptive On" - IDS_KE_SAMPLERADVANCED "Advanced Options..." - IDS_JW_ESHADERBYNAME "EShader Name" - IDS_JW_CSHADERBYNAME "CShader Name" -END - -STRINGTABLE -BEGIN - IDS_KE_STANDARD2_CDESC "Standard" -END - -STRINGTABLE -BEGIN - IDS_DS_DYNAMICS "Dynamics Properties" - IDS_DS_BOUNCE "Bounce Coefficient" - IDS_DS_STATFRIC "Static Friction" - IDS_DS_SLIDFRIC "Sliding Friction" -END - -STRINGTABLE -BEGIN - IDS_JW_MAPENABLES "Map Enables" - IDS_DS_BU "Bump" - IDS_DS_RL "Reflection" - IDS_DS_RR "Refraction" - IDS_DS_TEXMAPS "Maps" - IDS_DS_FILTER "Filter Color" -END - -STRINGTABLE -BEGIN - IDS_DS_DIMLEV "Dim Level" - IDS_DS_DIMMULT "Reflection Level" -END - -STRINGTABLE -BEGIN - IDS_DS_FALLOFF "Falloff" -END - -STRINGTABLE -BEGIN - IDS_DS_WIRESZ "Wire Size" - IDS_DS_IOR "Index of Refraction" - IDS_JW_MAPS "Maps" -END - -STRINGTABLE -BEGIN - IDS_JW_ADTEXLOCK "Ambient-Diffuse Texture Lock" -END - -STRINGTABLE -BEGIN - IDS_KE_SAMPLING "SuperSampling" - IDS_KE_XRAY "S.T.A.L.K.E.R. Params" - IDS_KE_NONE "None" -END - -STRINGTABLE -BEGIN - IDS_KE_SAMPLER_PARAM0 "Optional Param0" - IDS_KE_SAMPLER_PARAM1 "Optional Param1" -END - -STRINGTABLE -BEGIN - IDS_KE_SUBSAMPLE_TEX_ON "SubSample Textures" -END - -STRINGTABLE -BEGIN - IDS_DS_CLASSTEXMAPS "Texmaps" -END - -STRINGTABLE -BEGIN - IDS_DS_AMOUNT "Amount" - IDS_JW_GAMEMTLTYPE "Game Mtl Type" - IDS_JW_GAMEMTLBYNAME "Game Mtl Name" -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/cs/engine/plugins/Max/Material/Stdafx.h b/cs/engine/plugins/Max/Material/Stdafx.h deleted file mode 100644 index f1e9eb9a5..000000000 --- a/cs/engine/plugins/Max/Material/Stdafx.h +++ /dev/null @@ -1,93 +0,0 @@ -//---------------------------------------------------- -// file: stdafx.h -//---------------------------------------------------- -#ifndef __INCDEF_STDAFX_H_ -#define __INCDEF_STDAFX_H_ - -#pragma once - -#define _WIN32_WINNT 0x0500 - -#pragma warning (disable:4995) -#include "Max.h" - -#include "../../../xrCore/xrCore.h" - -#undef _MIN -#undef _MAX -#define _MIN(a,b) (a)<(b)?(a):(b) -#define _MAX(a,b) (a)>(b)?(a):(b) -template -T min(T a, T b) { return _MIN(a,b); } -template -T max(T a, T b) { return _MAX(a,b); } -using std::string; -#undef _MIN -#undef _MAX - -#define FLT_MAX flt_max - -#ifdef FLT_MIN -#undef FLT_MIN -#endif - -#define FLT_MIN flt_max - -#include -#include -#include -#include - -#include "istdplug.h" -#include "iparamb2.h" -#include "iparamm2.h" -#include "stdmat.h" -#include "UTILAPI.H" - -// CS SDK -#ifdef _MAX_EXPORT -# include "phyexp.h" -# include "bipexp.h" -#endif - -#include - -#define ENGINE_API -#define ECORE_API - -enum TMsgDlgType { mtWarning, mtError, mtInformation, mtConfirmation, mtCustom }; -enum TMsgDlgBtn { mbYes, mbNo, mbOK, mbCancel, mbAbort, mbRetry, mbIgnore, mbAll, mbNoToAll, mbYesToAll, mbHelp }; -typedef TMsgDlgBtn TMsgDlgButtons[mbHelp]; - -#include - -#define AnsiString string -using AStringVec = xr_vector; -using AStringIt = AStringVec::iterator; - -//#include "clsid.h" -//#include "Engine.h" -//#include "Properties.h" -#include "..\..\Shared\ELog.h" - -#define THROW R_ASSERT(0) - -#ifdef _MAX_EXPORT - #define _EDITOR_FILE_NAME_ "max_export" -#else - #ifdef _MAX_MATERIAL - #define _EDITOR_FILE_NAME_ "max_material" - #endif -#endif - -#define GAMEMTL_NONE u32(-1) -#define _game_data_ "$game_data$" - -#pragma warning (default:4995) - -#endif /*_INCDEF_STDAFX_H_*/ - - - - - diff --git a/cs/engine/plugins/Max/Material/XRayMtlRes.h b/cs/engine/plugins/Max/Material/XRayMtlRes.h deleted file mode 100644 index 5b5cb043e..000000000 --- a/cs/engine/plugins/Max/Material/XRayMtlRes.h +++ /dev/null @@ -1,276 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by GameMaterial.rc -// -#define IDS_LIBDESCRIPTION 1 -#define IDS_CATEGORY 2 -#define IDS_CLASS_NAME 3 -#define IDS_PARAMS 4 -#define IDS_SPIN 5 -#define IDS_COMMENT 6 -#define IDS_MN_DIFFUSE 7 -#define IDS_MN_BRIGHTNESS 8 -#define IDS_MN_OPACITY 9 -#define IDS_MN_NONE 10 -#define IDS_COLOR 11 -#define IDS_PARAMCHG 12 -#define IDS_MN_DIFFUSE_I 13 -#define IDS_MN_BRIGHTNESS_I 14 -#define IDS_MN_OPACITY_I 15 -#define IDD_PANEL 101 -#define IDD_DMTL_EXTRA6 116 -#define IDB_DMTL_BUTTONS 122 -#define IDB_DMTL_MASKBUTTONS 123 -#define IDD_DMTL_SHADER4 125 -#define IDD_DMTL_TEXMAP4 145 -#define IDD_SHADER_SKEL1 148 -#define IDD_DMTL_SAMPLING3 151 -#define IDC_TF_EDIT 218 -#define IDC_IOR_EDIT 219 -#define IDC_TR_EDIT 220 -#define IDC_DIM_AMT 220 -#define IDC_WIRE_EDIT 221 -#define IDC_DIM_MULT 222 -#define IDC_TF_SPIN 328 -#define IDC_IOR_SPIN 329 -#define IDC_TR_SPIN 330 -#define IDC_DIM_AMTSPIN 330 -#define IDC_DIM_MULTSPIN 331 -#define IDC_WIRE_SPIN 332 -#define IDC_CLOSEBUTTON 1000 -#define IDC_DOSTUFF 1000 -#define IDC_TR_SUB2 1001 -#define IDC_TR_SUB 1002 -#define IDC_TR_ADD 1003 -#define IDC_CSHADER1 1003 -#define IDC_MAPON_TR 1038 -#define IDC_PIXELS 1043 -#define IDC_UNITS 1044 -#define IDC_WIRE 1048 -#define IDD_DMTL_DYNAM 1057 -#define IDD_DMTL_XRAY 1058 -#define IDC_FACE_MAP 1059 -#define IDC_FACETED 1060 -#define IDC_HIGHLIGHT 1062 -#define IDC_2SIDE 1067 -#define IDC_SUPER_SAMP 1068 -#define IDC_ADAPT_ON 1069 -#define IDC_SAMPLE_TEX 1070 -#define IDC_MAPON_FI 1107 -#define IDC_BOUNCE_EDIT 1193 -#define IDC_BOUNCE_SPIN 1194 -#define IDC_STATFRIC_EDIT 1195 -#define IDC_STATFRIC_SPIN 1196 -#define IDC_SLIDFRIC_EDIT 1197 -#define IDC_SLIDFRIC_SPIN 1198 -#define IDC_DIM_REFL 1252 -#define IDC_TF_IN 1300 -#define IDC_TF_OUT 1301 -#define IDC_COLOR_NEW 1456 -#define IDC_EDIT 1490 -#define IDC_SPIN 1496 -#define IDC_SHADER 1728 -#define IDC_ESHADER 1729 -#define IDC_SAMPLEQUALITY_SPIN 1729 -#define IDC_SHADER2 1729 -#define IDC_CSHADER 1730 -#define IDC_SAMPLEQUALITY_EDIT 1730 -#define IDC_PIX_SAMPLER 1731 -#define IDC_GAMEMTL 1731 -#define IDC_THRESHOLD_EDIT 1732 -#define IDC_THRESHOLD_SPIN 1733 -#define IDC_PARAM0_EDIT 1734 -#define IDC_PARAM0_SPIN 1735 -#define IDC_PARAM1_EDIT 1736 -#define IDC_FILTER_CS 1736 -#define IDC_USEMAP_0 1737 -#define IDC_PARAM1_SPIN 1737 -#define IDC_AMTEDIT_0 1738 -#define IDC_AMTSPIN_0 1739 -#define IDC_MAP_0 1740 -#define IDC_USEMAP_1 1741 -#define IDC_AMTEDIT_1 1742 -#define IDC_AMTSPIN_1 1743 -#define IDC_MAP_1 1744 -#define IDC_USEMAP_2 1745 -#define IDC_AMTEDIT_2 1746 -#define IDC_AMTSPIN_2 1747 -#define IDC_MAP_2 1748 -#define IDC_USEMAP_3 1749 -#define IDC_AMTEDIT_3 1750 -#define IDC_AMTSPIN_3 1751 -#define IDC_MAP_3 1752 -#define IDC_USEMAP_4 1753 -#define IDC_AMTEDIT_4 1754 -#define IDC_AMTSPIN_4 1755 -#define IDC_MAP_4 1756 -#define IDC_USEMAP_5 1757 -#define IDC_AMTEDIT_5 1758 -#define IDC_AMTSPIN_5 1759 -#define IDC_MAP_5 1760 -#define IDC_USEMAP_6 1761 -#define IDC_AMTEDIT_6 1762 -#define IDC_AMTSPIN_6 1763 -#define IDC_MAP_6 1764 -#define IDC_USEMAP_7 1765 -#define IDC_AMTEDIT_7 1766 -#define IDC_AMTSPIN_7 1767 -#define IDC_MAP_7 1768 -#define IDC_USEMAP_8 1769 -#define IDC_AMTEDIT_8 1770 -#define IDC_AMTSPIN_8 1771 -#define IDC_MAP_8 1772 -#define IDC_USEMAP_9 1773 -#define IDC_AMTEDIT_9 1774 -#define IDC_AMTSPIN_9 1775 -#define IDC_MAP_9 1776 -#define IDC_USEMAP_10 1777 -#define IDC_AMTEDIT_10 1778 -#define IDC_AMTSPIN_10 1779 -#define IDC_MAP_10 1780 -#define IDC_USEMAP_11 1781 -#define IDC_AMTEDIT_11 1782 -#define IDC_AMTSPIN_11 1783 -#define IDC_MAP_11 1784 -#define IDC_LOCK_TEX01 1785 -#define IDC_USEMAP_12 1786 -#define IDC_AMTEDIT_12 1787 -#define IDC_USEMAP_13 1788 -#define IDC_AMTEDIT_13 1789 -#define IDC_USEMAP_14 1790 -#define IDC_AMTEDIT_14 1791 -#define IDC_AMTSPIN_12 1792 -#define IDC_AMTSPIN_13 1793 -#define IDC_AMTSPIN_14 1794 -#define IDC_MAP_12 1795 -#define IDC_MAP_13 1796 -#define IDC_MAP_14 1797 -#define IDC_USEMAP_15 1798 -#define IDC_AMTEDIT_15 1799 -#define IDC_AMTSPIN_15 1800 -#define IDC_MAP_15 1801 -#define IDC_USEMAP_16 1802 -#define IDC_AMTEDIT_16 1803 -#define IDC_AMTSPIN_16 1804 -#define IDC_MAP_16 1805 -#define IDC_USEMAP_17 1806 -#define IDC_BR_EDIT 1807 -#define IDC_AMTEDIT_17 1807 -#define IDC_BR_SPIN 1808 -#define IDC_AMTSPIN_17 1808 -#define IDC_MAPON_BR 1809 -#define IDC_MAP_17 1809 -#define IDC_USEMAP_18 1810 -#define IDC_AMTEDIT_18 1811 -#define IDC_AMTSPIN_18 1812 -#define IDC_MAP_18 1813 -#define IDC_MAPON_CLR 1814 -#define IDC_USEMAP_19 1814 -#define IDC_AMTEDIT_19 1815 -#define IDC_AMTSPIN_19 1816 -#define IDC_MAP_19 1817 -#define IDC_USEMAP_20 1818 -#define IDC_AMTEDIT_20 1819 -#define IDC_AMTSPIN_20 1820 -#define IDC_MAP_20 1821 -#define IDC_USEMAP_21 1822 -#define IDC_AMTEDIT_21 1823 -#define IDC_AMTSPIN_21 1824 -#define IDC_MAP_21 1825 -#define IDC_USEMAP_22 1826 -#define IDC_AMTEDIT_22 1827 -#define IDC_AMTSPIN_22 1828 -#define IDC_MAP_22 1829 -#define IDC_USEMAP_23 1830 -#define IDC_AMTEDIT_23 1831 -#define IDC_AMTSPIN_23 1832 -#define IDC_MAP_23 1833 -#define IDC_ADAPT_STATIC 1861 -#define IDC_ADVANCED_BUTTON 1862 -#define IDC_OPAC_TEXT1 1865 -#define IDC_OPAC_TEXT2 1866 -#define IDC_REFR_TEXT1 1867 -#define IDC_OPAC_TEXT3 1868 -#define IDC_REFL_TEXT1 1869 -#define IDC_REFL_TEXT2 1870 -#define IDC_REFL_BOX 1871 -#define IDC_OPAC_BOX 1872 -#define IDC_FILTER_OVERLAY 1873 -#define IDC_COMMENT_BOX 1874 -#define IDC_QUALITY_TEXT 1875 -#define IDC_COMMENT_TEXT 1876 -#define IDC_PARAM0_TEXT 1877 -#define IDC_PARAM1_TEXT 1878 -#define IDS_DS_WIREFRAME 10049 -#define IDS_DS_SHIN_STR 10052 -#define IDS_DS_OPACITY 10053 -#define IDS_JW_SHADERTYPE 10057 -#define IDS_DS_EXTRA 10059 -#define IDS_DS_TEXMAP 10060 -#define IDS_JW_MAPENABLES 10064 -#define IDS_DS_BU 10067 -#define IDS_DS_RL 10068 -#define IDS_DS_RR 10069 -#define IDS_DS_TEXMAPS 10070 -#define IDS_DS_FILTER 10071 -#define IDS_DS_WIRESZ 10114 -#define IDS_DS_IOR 10115 -#define IDS_JW_MAPS 10127 -#define IDS_JW_MAPAMOUNTS 10128 -#define IDS_JW_ENABLE 10133 -#define IDS_JW_AMOUNT 10134 -#define IDS_JW_SHADERBYNAME 10139 -#define IDS_JW_SAMPLERBYNAME 10140 -#define IDS_DS_AMOUNT 11442 -#define IDS_JW_GAMEMTLTYPE 11443 -#define IDS_JW_GAMEMTLBYNAME 11444 -#define IDS_DS_CLASSTEXMAPS 11471 -#define IDS_DS_DYNAMICS 11484 -#define IDS_DS_BOUNCE 11485 -#define IDS_DS_STATFRIC 11486 -#define IDS_DS_SLIDFRIC 11487 -#define IDS_DS_FALLOFF 11495 -#define IDS_DS_DIMLEV 11514 -#define IDS_DS_DIMMULT 11515 -#define IDS_DS_DP 11530 -#define IDS_KE_STANDARD2 11534 -#define IDS_KE_SHADER 11535 -#define IDS_KE_SAMPLING 11536 -#define IDS_KE_XRAY 11537 -#define IDS_KE_NONE 11547 -#define IDS_JW_TWOSIDED 11585 -#define IDS_JW_FACEMAP 11586 -#define IDS_JW_OPACITYTYPE 11587 -#define IDS_JW_FILTERMAP 11588 -#define IDS_JW_FALLOFFTYPE 11589 -#define IDS_JW_WIREUNITS 11590 -#define IDS_JW_APPLYREFDIM 11591 -#define IDS_JW_PIXELSAMPLER 11592 -#define IDS_JW_SAMPLERQUAL 11593 -#define IDS_JW_SAMPLERENABLE 11594 -#define IDS_KE_STANDARD2_CDESC 11600 -#define IDS_JW_ADTEXLOCK 11620 -#define IDS_KE_FACETED 11672 -#define IDS_STRING_1 11673 -#define IDS_JW_ESHADERTYPE 11673 -#define IDS_STRING_2 11674 -#define IDS_JW_CSHADERTYPE 11674 -#define IDS_KE_SAMPLERADAPTTHRESH 11675 -#define IDS_KE_SAMPLERADAPTON 11676 -#define IDS_KE_SAMPLERADVANCED 11677 -#define IDS_JW_ESHADERBYNAME 11678 -#define IDS_JW_CSHADERBYNAME 11679 -#define IDS_KE_SUBSAMPLE_TEX_ON 11683 -#define IDS_KE_SAMPLER_PARAM0 11696 -#define IDS_KE_SAMPLER_PARAM1 11697 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 102 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1004 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/cs/engine/plugins/Max/Material/dmtlbut.bmp b/cs/engine/plugins/Max/Material/dmtlbut.bmp deleted file mode 100644 index 1a0a058e63a0456ccdc42c4b49c3ee9223979eb7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 478 zcmZ`!F%H5o40I(VM!vzw8&D*&@DIig7512+QnT@;zJzyV3uh;$0)cDa#b?)v&)4Tb zW_REbaY7sr1MPrBw_dm80}>IOQfdUmk=AtuYoVG`t$IS>QwhNTZA7cqoxL-wA?ZAY z5VRx@%&Qwm)Gw-6ZQM9!Fr#^KTv^KD_(D$@~*3lZY z^uWB=ExEV=@FIi)^b8SWB&v|@B4Tmtk@W-6Km;Ts!U*; -using XRShaderDataIt = XRShaderDataVec::iterator; - -extern MStatus parseShader (MObject &src, SXRShaderData& d); -extern MObject findShader (MObject& setNode, SXRShaderData& d); -#endif \ No newline at end of file diff --git a/cs/engine/plugins/Maya/Export/MayaExport.cpp b/cs/engine/plugins/Maya/Export/MayaExport.cpp deleted file mode 100644 index 06b999a02..000000000 --- a/cs/engine/plugins/Maya/Export/MayaExport.cpp +++ /dev/null @@ -1,531 +0,0 @@ -#include "stdafx.h" -#pragma hdrstop - -#include "maTranslator.h" -#include "..\..\..\editors\Ecore\editor\EditObject.h" -#include "..\..\..\editors\Ecore\editor\EditMesh.h" -#include "smoth_flags.h" -//----------------------------------------------------------------------------------------- -BOOL CEditableObject::ParseMAMaterial(CSurface* dest, SXRShaderData& d) -{ - string1024 tmp; - strcpy (tmp,d.tex_name.asChar()); if (strext(tmp)) *strext(tmp)=0; - dest->SetTexture (EFS.AppendFolderToName(tmp,1,TRUE)); - dest->SetFVF (D3DFVF_XYZ|D3DFVF_NORMAL|(1<SetVMap ("Texture"); - dest->m_Flags.set (CSurface::sf2Sided,d.double_side); - LPCSTR sh_name = _ChangeSymbol(strcpy(tmp,d.eng_name.asChar()),'/','\\'); - if (!sh_name||!sh_name[0]){ - Log("! Empty shader name, material: ",d.name.asChar()); - return FALSE; - } - dest->SetShader (sh_name); - dest->SetShaderXRLC (_ChangeSymbol(strcpy(tmp,d.comp_name.asChar()),'/','\\')); - dest->SetGameMtl (_ChangeSymbol(strcpy(tmp,d.gmat_name.asChar()),'/','\\')); - return TRUE; -} - -CSurface* CEditableObject::CreateSurface(LPCSTR m_name, SXRShaderData& d) -{ - CSurface* S = FindSurfaceByName(m_name); - if (!S){ - S = new CSurface(); - S->SetName (m_name); - if (!ParseMAMaterial(S,d)){ xr_delete(S); return 0; } - m_Surfaces.push_back(S); - } - return S; -} - -MStatus CXRayObjectExport::ExportAll(CEditableObject* O) -{ - MStatus status = MS::kSuccess; - - if (initializeSetsAndLookupTables( true )){ - MItDag dagIterator( MItDag::kBreadthFirst, MFn::kInvalid, &status); - - if ( MS::kSuccess != status) { - fprintf(stderr,"Failure in DAG iterator setup.\n"); - return MS::kFailure; - } - - for ( ; !dagIterator.isDone(); dagIterator.next() ){ - MDagPath dagPath; - MObject component = MObject::kNullObj; - status = dagIterator.getPath(dagPath); - - if (!status) { - fprintf(stderr,"Failure getting DAG path.\n"); - freeLookupTables(); - return MS::kFailure; - } - - // skip over intermediate objects - // - MFnDagNode dagNode( dagPath, &status ); - if (dagNode.isIntermediateObject()) continue; - - if ((dagPath.hasFn(MFn::kNurbsSurface)) && (dagPath.hasFn(MFn::kTransform))){ - status = MS::kSuccess; - fprintf(stderr,"Warning: skipping Nurbs Surface.\n"); - }else if ((dagPath.hasFn(MFn::kMesh)) && (dagPath.hasFn(MFn::kTransform))){ - // We want only the shape, - // not the transform-extended-to-shape. - continue; - }else if (dagPath.hasFn(MFn::kMesh)){ - // Build a lookup table so we can determine which - // polygons belong to a particular edge as well as - // smoothing information - // - buildEdgeTable( dagPath ); - - // Now output the polygon information - // - status = ExportPart(O, dagPath, component); - objectId++; - if (status != MS::kSuccess) { - fprintf(stderr,"Error: exporting geom failed.\n"); - freeLookupTables(); - destroyEdgeTable(); // Free up the edge table - return MS::kFailure; - } - destroyEdgeTable(); // Free up the edge table - } - } - }else{ - status = MS::kFailure; - } - - freeLookupTables(); - - return status; -} -//----------------------------------------------------------------------------------------- - -MStatus CXRayObjectExport::ExportSelected(CEditableObject* O) -{ - MStatus status; - MString filename; - - if (initializeSetsAndLookupTables( false )){ - // Create an iterator for the active selection list - // - MSelectionList slist; - MGlobal::getActiveSelectionList( slist ); - MItSelectionList iter( slist ); - - if (iter.isDone()){ - fprintf(stderr,"Error: Nothing is selected.\n"); - return MS::kFailure; - } - - // We will need to interate over a selected node's heirarchy - // in the case where shapes are grouped, and the group is selected. - MItDag dagIterator( MItDag::kDepthFirst, MFn::kInvalid, &status); - - // Selection list loop - for ( ; !iter.isDone(); iter.next()) - { - MDagPath objectPath; - // get the selected node - status = iter.getDagPath( objectPath); - - // reset iterator's root node to be the selected node. - status = dagIterator.reset (objectPath.node(), - MItDag::kDepthFirst, MFn::kInvalid ); - - // DAG iteration beginning at at selected node - for ( ; !dagIterator.isDone(); dagIterator.next()){ - MDagPath dagPath; - MObject component = MObject::kNullObj; - status = dagIterator.getPath(dagPath); - - if (!status) { - fprintf(stderr,"Failure getting DAG path.\n"); - freeLookupTables(); - return MS::kFailure; - } - - if (status ){ - // skip over intermediate objects - // - MFnDagNode dagNode( dagPath, &status ); - if (dagNode.isIntermediateObject()) - continue; - - if (dagPath.hasFn(MFn::kNurbsSurface)){ - status = MS::kSuccess; - fprintf(stderr,"Warning: skipping Nurbs Surface.\n"); - }else if (( dagPath.hasFn(MFn::kMesh)) && ( dagPath.hasFn(MFn::kTransform))){ - // We want only the shape, - // not the transform-extended-to-shape. - continue; - }else if ( dagPath.hasFn(MFn::kMesh)){ - // Build a lookup table so we can determine which - // polygons belong to a particular edge as well as - // smoothing information - // - buildEdgeTable( dagPath ); - - status = ExportPart(O, dagPath, component); - objectId++; - if (status != MS::kSuccess) { - fprintf(stderr, "Error: exporting geom failed, check your selection.\n"); - freeLookupTables(); - destroyEdgeTable(); // Free up the edge table - return MS::kFailure; - } - destroyEdgeTable(); // Free up the edge table - } - } - } - } - }else{ - status = MS::kFailure; - } - - freeLookupTables(); - - return status; -} -//----------------------------------------------------------------------------------------- -typedef xr_map PtLookupMap; -int AppendVertex(FvectorVec& _points, MPoint& _pt) -{ - Fvector pt; - // convert from internal units to the current ui units - MDistance dst_x (_pt.x); - MDistance dst_y (_pt.y); - MDistance dst_z (_pt.z); - pt.set ((float)dst_x.asMeters(),(float)dst_y.asMeters(),-(float)dst_z.asMeters()); - - for (FvectorIt it=_points.begin(); it!=_points.end(); it++) - if (it->similar(pt)) return it-_points.begin(); - _points.push_back(pt); - return _points.size()-1; -} -int AppendUV(st_VMap*& VM, Fvector2& _uv) -{ - int sz = VM->size(); - VM->appendUV(_uv); - return sz; -} - - -MStatus CXRayObjectExport::set_smoth_flags( u32 &flags, const MIntArray& tri_vert_indeces )// const MFnMesh &fnMesh, const MItMeshPolygon &meshPoly, -{ - return t_set_smoth_flags( *this, flags, tri_vert_indeces ); -} - -MStatus CXRayObjectExport::ExportPart(CEditableObject* O, MDagPath& mdagPath, MObject& mComponent) -{ - MStatus stat = MS::kSuccess; - MSpace::Space space = MSpace::kWorld; - - MFnMesh fnMesh( mdagPath, &stat ); - if ( MS::kSuccess != stat) { - fprintf(stderr,"Failure in MFnMesh initialization.\n"); - return MS::kFailure; - } - - MString mdagPathNodeName = fnMesh.name(); - - MFnDagNode dagNode1(mdagPath); - u32 pc = dagNode1.parentCount(); - for(u32 ip=0;ipSetName(mdagPathNodeName.asChar()); - O->AppendMesh(MESH); - - int objectIdx, length; - - // Find i such that objectGroupsTablePtr[i] corresponds to the - // object node pointed to by mdagPath - length = objectNodeNamesArray.length(); - { - for( int i=0; im_VMaps; - _vmaps.resize (1); - st_VMap*& VM = _vmaps.back(); - VM = new st_VMap("Texture",vmtUV,false); - } - - // write faces - { - using FaceVec = xr_vector; - using FaceIt = FaceVec::iterator; - - VMapVec& _vmaps = MESH->m_VMaps; - SurfFaces& _surf_faces = MESH->m_SurfFaces; - VMRefsVec& _vmrefs = MESH->m_VMRefs; - - // temp variables - FvectorVec _points; - FaceVec _faces; - U32Vec _sgs; - - int f_cnt = fnMesh.numPolygons(); - - _sgs.reserve (f_cnt); - _faces.reserve (f_cnt); - _vmrefs.reserve (f_cnt*3); - -// int lastSmoothingGroup = INITIALIZE_SMOOTHING; - MPointArray rgpt; - MIntArray rgint; - - PtLookupMap ptMap; - CSurface* surf = 0; - for ( ; !meshPoly.isDone(); meshPoly.next()){ - // Write out the smoothing group that this polygon belongs to - // We only write out the smoothing group if it is different - // from the last polygon. - // - int compIdx = meshPoly.index(); - int smoothingGroup = polySmoothingGroups[ compIdx ]; - // for each polygon, first setup the reverse mapping - // between object-relative vertex indices and face-relative - // vertex indices - ptMap.clear(); - for (int i=0; i<(int)meshPoly.polygonVertexCount(); i++) - ptMap.insert (PtLookupMap::value_type(meshPoly.vertexIndex(i), i) ); - - // verify polygon zero area - if (meshPoly.zeroArea()){ - status = MS::kFailure; - Log("! polygon have zero area:",meshPoly.index()); - return status; - } - - // verify polygon zero UV area -/* if (meshPoly.zeroUVArea()){ - status = MS::kFailure; - Log("! polygon have zero UV area:",meshPoly.index()); - return status; - } -*/ - // verify polygon has UV information - if (!meshPoly.hasUVs (&status)) { - status = MS::kFailure; - Log("! polygon is missing UV information:",meshPoly.index()); - return status; - } - - int cTri; - // now iterate through each triangle on this polygon and create a triangle object in our list - status = meshPoly.numTriangles (cTri); - if (!status) { - Log("! can't getting triangle count"); - return status; - } - - for (int i=0; i < cTri; i++) { - - // for each triangle, first get the triangle data - rgpt.clear();//triangle vertices - rgint.clear();//triangle vertex indices - - // triangles that come from object are retrieved in world space - status = meshPoly.getTriangle (i, rgpt, rgint, MSpace::kWorld); - - if (!status) { - Log("! can't getting triangle for mesh poly"); - return status; - } - - if ((rgpt.length() != 3) || (rgint.length() != 3)) { - Msg("! 3 points not returned for triangle"); - return MS::kFailure; - } - - // Write out vertex/uv index information - // - R_ASSERT2(fnMesh.numUVs()>0,"Can't find uvmaps."); - _faces.push_back(st_Face()); - _sgs.push_back(smoothingGroup); - //set_smooth - set_smoth_flags( _sgs.back(), rgint ); - - st_Face& f_it = _faces.back(); - for ( int vtx=0; vtx<3; vtx++ ) { - // get face-relative vertex - PtLookupMap::iterator mapIt; - - int vtLocal, vtUV; - int vt = rgint[vtx]; - mapIt = ptMap.find(vt); - Fvector2 uv; - if (mapIt == ptMap.end()){ - Msg("! Can't find local index."); - return MS::kFailure; - } - vtLocal = (*mapIt).second; - - status = meshPoly.getUVIndex (vtLocal, vtUV, uv.x, uv.y); - if (!status) { - Msg("! error getting UV Index for local vertex '%d' and object vertex '%d'",vtLocal,vt); - return status; - } - - // flip v-part - uv.y=1.f-uv.y; - - f_it.pv[2-vtx].pindex = AppendVertex(_points,rgpt[vtx]); - f_it.pv[2-vtx].vmref = _vmrefs.size(); - _vmrefs.push_back (st_VMapPtLst()); - st_VMapPtLst& vm_lst = _vmrefs.back(); - vm_lst.count = 1; - vm_lst.pts = xr_alloc(vm_lst.count); - vm_lst.pts[0].vmap_index= 0; - vm_lst.pts[0].index = AppendUV(_vmaps.back(),uv); - } - // out face material - int iTexture = texMap[meshPoly.index()]; - if (iTexture<0) - xrDebug::Fatal(DEBUG_INFO,"Can't find material for polygon: %d",meshPoly.index()); - SXRShaderData& D= xr_data[iTexture]; - - int compIdx = meshPoly.index(); - surf = MESH->Parent()->CreateSurface(getMaterialName(mdagPath, compIdx, objectIdx),D); - if (!surf) return MStatus::kFailure; - _surf_faces[surf].push_back(_faces.size()-1); - } - } - { - // copy from temp - MESH->m_VertCount = _points.size(); - MESH->m_FaceCount = _faces.size(); - MESH->m_Vertices = xr_alloc(MESH->m_VertCount); - Memory.mem_copy (MESH->m_Vertices,&*_points.begin(),MESH->m_VertCount*sizeof(Fvector)); - MESH->m_Faces = xr_alloc(MESH->m_FaceCount); - Memory.mem_copy (MESH->m_Faces,&*_faces.begin(),MESH->m_FaceCount*sizeof(st_Face)); - MESH->m_SmoothGroups = xr_alloc(MESH->m_FaceCount); - Memory.mem_copy (MESH->m_SmoothGroups,&*_sgs.begin(),MESH->m_FaceCount*sizeof(u32)); - - MESH->RecomputeBBox (); - } - if ((MESH->GetVertexCount()<4)||(MESH->GetFaceCount()<2)) - { - Log ("! Invalid mesh: '%s'. Faces<2 or Verts<4",*MESH->Name()); - return MS::kFailure; - } - } - return stat; -} -//----------------------------------------------------------------------------------------- -LPCSTR CXRayObjectExport::getMaterialName(MDagPath & mdagPath, int cid, int objectIdx) -{ - MStatus stat; - - int i, length; - MIntArray * currentMaterials = new MIntArray(); - MStringArray mArray; - - - for ( i=0; iappend( i ); - mArray.append( fnSet.name() ); - } - } - } - - // Test for equivalent materials - // - bool materialsEqual = false; - if ((lastMaterials != NULL) && (lastMaterials->length() == currentMaterials->length())){ - materialsEqual = true; - length = lastMaterials->length(); - for (i=0; i1){ - xrDebug::Fatal(DEBUG_INFO,"Object '%s' has polygon '%d' with more than one material.",0,cid); - } - }else{ - xr_delete(currentMaterials); - } - return mArray[0].asChar(); -} \ No newline at end of file diff --git a/cs/engine/plugins/Maya/Export/SmdBone.cpp b/cs/engine/plugins/Maya/Export/SmdBone.cpp deleted file mode 100644 index ae7844668..000000000 --- a/cs/engine/plugins/Maya/Export/SmdBone.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/*** -* -* Copyright (c) 2001 Escape Factory, Ltd. All rights reserved. -* -****/ - -// -////////////////////////////////////////////////////////////////////// -#include "stdafx.h" - -#include "SmdBone.h" - -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// - -SmdBone::SmdBone() -{ - id = -1; - parentId = -1; - name = NULL; -} - -SmdBone::~SmdBone() -{ - xr_free(name); -} diff --git a/cs/engine/plugins/Maya/Export/SmdBone.h b/cs/engine/plugins/Maya/Export/SmdBone.h deleted file mode 100644 index ea91b2f9e..000000000 --- a/cs/engine/plugins/Maya/Export/SmdBone.h +++ /dev/null @@ -1,34 +0,0 @@ -/*** -* -* Copyright (c) 2001 Escape Factory, Ltd. All rights reserved. -* -****/ -// -////////////////////////////////////////////////////////////////////// - -#if !defined(AFX_SMDBONE_H__27691F7E_CEE4_422A_9FDE_7972C7C13819__INCLUDED_) -#define AFX_SMDBONE_H__27691F7E_CEE4_422A_9FDE_7972C7C13819__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#include -#include - -class SmdBone -{ -public: - Fvector trans; - Fvector orient; - - int id; - int parentId; - LPSTR name; - MDagPath path; -public: - SmdBone(); - virtual ~SmdBone(); -}; - -#endif // !defined(AFX_SMDBONE_H__27691F7E_CEE4_422A_9FDE_7972C7C13819__INCLUDED_) diff --git a/cs/engine/plugins/Maya/Export/SmdMaya.cpp b/cs/engine/plugins/Maya/Export/SmdMaya.cpp deleted file mode 100644 index 7d39a5b74..000000000 --- a/cs/engine/plugins/Maya/Export/SmdMaya.cpp +++ /dev/null @@ -1,1534 +0,0 @@ -#include "stdafx.h" - -#include "SmdMaya.h" -#include "..\..\..\editors\Ecore\editor\EditObject.h" -#include "..\..\..\editors\Ecore\editor\EditMesh.h" -#include "Motion.h" -#include "Envelope.h" -#include "smoth_flags.h" - -#pragma warning ( disable : 4786 ) - -//using namespace std; -#define NO_SMOOTHING_GROUP -1 -#define INITIALIZE_SMOOTHING -2 -#define INVALID_ID -1 - -CXRaySkinExport::CXRaySkinExport(bool bReference) -{ - m_bReferenceFile = bReference; - polySmoothingGroups = 0; - edgeTable = 0; - m_rgWeights = 0; -}; - -CXRaySkinExport::~CXRaySkinExport() -{ -} - -//////////////////////////////////////////////////// -// set up the plug-in - -////////////////////////////////////////////////////////////// - -MString CXRaySkinExport::filter()const -{ - std::cerr <<"Dbg : MString CXRaySkinExport::filter()const\n"; - return m_bReferenceFile?"*.ob*":"*.skl"; -} - -bool CXRaySkinExport::haveWriteMethod () const -{ - std::cerr <<"Dbg : bool CXRaySkinExport::haveWriteMethod () const\n"; - return true; -} - -/* -MString CXRaySkinExport::defaultExtension () const -{ - std::cerr <<"Dbg : MString CXRaySkinExport::defaultExtension () const\n"; - return m_bReferenceFile?"object":"skl"; -} -*/ -MPxFileTranslator::MFileKind CXRaySkinExport::identifyFile (const MFileObject& fileName, const char* buffer, short size) const -{ - const char * name = fileName.name().asChar(); - int nameLength = xr_strlen(name); - - if (m_bReferenceFile){ - if ((nameLength > 7) && !strcasecmp(name+nameLength-7, ".object")) - return kCouldBeMyFileType; - else - return kNotMyFileType; - }else{ - if ((nameLength > 4) && !strcasecmp(name+nameLength-7, ".skl")) - return kCouldBeMyFileType; - else - return kNotMyFileType; - } -} - -void* CXRaySkinExport::creator_skin() -{ - return new CXRaySkinExport(true); -} - -void* CXRaySkinExport::creator_skin_motion() -{ - return new CXRaySkinExport(false); -} -////////////////////////////////////////////////////////////// -// the key routine which does all the work -MStatus CXRaySkinExport::writer (const MFileObject& file, const MString& options, FileAccessMode mode) -{ - MStatus status; - clearData(); // initialize all data structures - - // parse the file options - // cout << "Options: " << options.asChar() << "\n"; - if (options.length() > 0) { - int i, length; - // Start parsing. - MStringArray optionList; - MStringArray theOption; - options.split(';', optionList); // break out all the options. - - length = optionList.length(); - for( i = 0; i < length; ++i ){ - theOption.clear(); - optionList[i].split( '=', theOption ); - if( theOption[0] == MString("SkinCluster") ) { - if (theOption.length() > 1 ) { - m_strSkinCluster = theOption[1]; - } else { - m_strSkinCluster.clear(); - } - } - } - } - - // sanity check the options - if (m_strSkinCluster.length() == 0) { - m_fSkinCluster = false; - } else { - m_fSkinCluster = true; - } - MString mname; - if (m_bReferenceFile){ - mname = file.fullName()+".object"; - }else{ - mname = file.fullName()+".skl"; - } - LPCSTR fname = mname.asChar(); - - - - // now load the bones themselves and store the skeleton hierarchy in memory - if (mode == kExportActiveAccessMode) - { - - MSelectionList activeList; - MGlobal::getActiveSelectionList(activeList); - MItSelectionList iter( activeList); - int count = 0; - for ( ; !iter.isDone(); iter.next() ) { - - MObject obj; - MDagPath DagPath; - iter.getDagPath(DagPath, obj); - const char * aptTypePtr = obj.apiTypeStr(); - - - DagPath.extendToShape(); - const char* fullpath = DagPath.fullPathName().asChar(); - - - obj = DagPath.node(); - aptTypePtr = obj.apiTypeStr(); - //------------------------------- - MStatus stat; - MFnDagNode dagNode(DagPath); // path to the visible mesh - MFnMesh meshFn(DagPath, &stat); // this is the visible mesh - MObject inObj; - MObject dataObj1; - - // the deformed mesh comes into the visible mesh - // through its "inmesh" plug - MPlug inMeshPlug = dagNode.findPlug("inMesh", &stat); - - if (stat == MS::kSuccess && inMeshPlug.isConnected()) - { - // walk the tree of stuff upstream from this plug - MItDependencyGraph dgIt(inMeshPlug, - MFn::kInvalid, - MItDependencyGraph::kUpstream, - MItDependencyGraph::kDepthFirst, - MItDependencyGraph::kPlugLevel, - &stat); - - if (MS::kSuccess == stat) - { - dgIt.disablePruningOnFilter(); - int count = 0; - - for ( ; ! dgIt.isDone(); dgIt.next() ) - { - MObject thisNode = dgIt.thisNode(); - aptTypePtr = thisNode.apiTypeStr(); - - // go until we find a skinCluster - - if (thisNode.apiType() == MFn::kSkinClusterFilter) - { - MFnSkinCluster skinCluster(thisNode); - const char* Name = skinCluster.name().asChar(); - Msg("Found Selected skin - %s", Name); - m_fSkinCluster = true; - m_strSkinCluster = skinCluster.name(); - - status = setUpBoneMap(&(thisNode)); - -/* - // get the mesh coming into the skinCluster. This - // is the mesh before being deformed but after - // being edited/tweaked/etc. - - MPlug inputPlug = skinCluster.findPlug("input", &stat); - if (stat == MS::kSuccess) - { - MPlug childPlug = inputPlug.elementByLogicalIndex(0); - MPlug geomPlug = childPlug.child(0); - - geomPlug.getValue(dataObj1); - - // let use this mesh instead of the visible one - meshFn.setObject(dataObj1); - } -*/ - } - } - } - } - //------------------------------- - } - } - else - { - status = setUpBoneMap (NULL); - } - Msg("Starting skin export..."); - - if (m_fSkinCluster) - Msg("Trying to export mesh - %s",m_strSkinCluster.asChar()); - - if (!status) { - Msg("! problem setting up bone table"); - return status; - } - - // first look through the scene for skin cluster objects. Find any bones used in these - // clusters and load and store their weights in table by vertex. - status = getBones(); - if (!status) - Msg("! problem loading bone weights"); - - // now look through the scene for any geometry directly attached to bones - // this is most commonly found when creating mechanical models vs. organic models - status = parseBoneGeometry (); - if (!status) - Msg("! problem loading skin information"); - - // now load the geometry information for any skin cluster objects detected earlier - if (m_skinPath.isValid()) { - status = parseShape (m_skinPath); - if (!status) { - Msg("! problem loading skin information"); - return status; - } - } - - // now create the actual SMD file - if((mode==MPxFileTranslator::kExportAccessMode)||(mode==MPxFileTranslator::kSaveAccessMode)||(mode==MPxFileTranslator::kExportActiveAccessMode)) - status = (m_bReferenceFile)?exportObject(fname):exportMotion(fname); - if (MS::kSuccess==status){ - Msg("Object succesfully exported."); - }else{ - Msg("! Export failed."); - } - - return status; -} - -MStatus CXRaySkinExport::reader (const MFileObject& file, const MString& options, FileAccessMode mode) -{ - Msg("! reader called in error."); - return MS::kFailure; -} - -////////////////////////////////////////////////////////////// - -CSurface* CEditableObject::CreateSurface(MObject shader) -{ - CSurface* S = 0; - for(SurfaceIt s_it=m_Surfaces.begin(); s_it!=m_Surfaces.end(); s_it++) - if ((*s_it)->tag==*((int*)&shader)) return *s_it; - if (!S){ - S = new CSurface(); - S->tag = *((int*)&shader); - SXRShaderData d; - MStatus status = parseShader(shader, d); - if (status == MStatus::kFailure) { - Msg ("! Unable to retrieve filename of texture"); - xr_delete (S); - return 0; - } - S->SetName (d.name.asChar()); - if (!ParseMAMaterial(S,d)){ xr_delete(S); return 0; } - m_Surfaces.push_back(S); - } - return S; -} - -//////////////////////////////////////////////////// -// routines for printing out animation data to files -// -// createFile sets up the file on disk and calls the other routines -// dumpHeader prints the header -// dumpTriangles prints out the triangle info -// dumpNodes prints out the list of bones -// dumpAnimation prints out animation for all frames of data -// dumpPose prints out the position & rotation of each bone -//////////////////////////////////////////////////// - -MStatus CXRaySkinExport::gotoBindPose(void) -{ - MStatus status; - if (m_bReferenceFile){ - for (SmdBoneIt itBones = m_boneList.begin(); itBones != m_boneList.end(); itBones++){ - if ((*itBones)->parentId==-1){ - MFnTransform fnJoint = (*itBones)->path.node(&status); - if (!status) { - Msg("! Unable to cast as Transform!"); - break; - } - MString cmd = "dagPose -r -g -bp "+fnJoint.fullPathName(); - MGlobal::executeCommand(cmd, status ); - if (!status) { - Msg("! Unable goto bind pose!"); - break; - } - } - } - } - return status; -} - -MStatus CXRaySkinExport::exportObject(LPCSTR fn) -{ - MStatus status; - MGlobal::executeCommand("DisableAll"); - - R_ASSERT(m_bReferenceFile); - - - string_path fname; - strcpy (fname,fn); - if (strext(fname)) - *strext(fname)=0; - - CEditableObject* OBJECT = new CEditableObject(fname); - OBJECT->SetVersionToCurrent(TRUE,TRUE); - CEditableMesh* MESH = new CEditableMesh(OBJECT); - MESH->SetName ("skin"); - OBJECT->Meshes().push_back(MESH); - // IMPORT MESH - SurfFaces& _surf_faces = MESH->m_SurfFaces; - VMRefsVec& _vmrefs = MESH->m_VMRefs; - VMapVec& _vmaps = MESH->m_VMaps; - Fvector*& _points = MESH->m_Vertices; - // temp variables - st_Face*& _faces = MESH->m_Faces; - u32*& _sgs = MESH->m_SmoothGroups; - // maps - // Weight maps - _vmaps.resize (m_boneList.size()+1); - for (DWORD b_i=0; b_iname,vmtWeight,false); - // UV map - int VM_UV_idx = _vmaps.size()-1; - st_VMap*& VM_UV = _vmaps[VM_UV_idx]; - VM_UV = new st_VMap("texture",vmtUV,false); - // Write out the vertex table - { - MESH->m_VertCount = m_vertList.size(); - MESH->m_Vertices = xr_alloc(MESH->m_VertCount); - Fvector* pt_it = _points; - - for (SmdVertIt it=m_vertList.begin(); it!=m_vertList.end(); it++,pt_it++){ - // convert from internal units to the current ui units - MDistance dst_x ((*it)->pos.x); - MDistance dst_y ((*it)->pos.y); - MDistance dst_z ((*it)->pos.z); - pt_it->set ((float)dst_x.asMeters(),(float)dst_y.asMeters(),(float)dst_z.asMeters()); - VM_UV->appendUV ((*it)->uv.x,(*it)->uv.y); - } - } - - // faces - { - // reserve space for faces and references - MESH->m_FaceCount = m_triList.size(); - _sgs = xr_alloc(MESH->m_FaceCount); - _faces = xr_alloc(MESH->m_FaceCount); - _vmrefs.resize (m_vertList.size()); - - int f_id = 0; - CSurface* surf = 0; - for (SmdTriIt it=m_triList.begin(); it!=m_triList.end(); it++,f_id++){ - // FACES - _sgs[f_id] = ((*it)->sm_group); - - //set_smooth - //set_smoth_flags( _sgs.back(), rgint ); - - st_Face& F = _faces[f_id]; - for (int k=0; k<3; k++){ - int v_idx = (*it)->v[k]; - st_FaceVert& vt = F.pv[k]; - SmdVertex* V = m_vertList[v_idx]; - vt.pindex = v_idx; - st_VMapPtLst& vm_lst= _vmrefs[vt.pindex]; - vm_lst.count = V->influence.size()+1; - vm_lst.pts = xr_alloc(vm_lst.count); - vm_lst.pts[0].vmap_index= VM_UV_idx; - vm_lst.pts[0].index = vt.pindex; - for (WBIt vd_it=V->influence.begin(); vd_it!=V->influence.end(); vd_it++){ - u32 idx = vd_it-V->influence.begin()+1; - st_VMap* vm = _vmaps[vd_it->bone]; - vm->appendW (vd_it->weight); - vm_lst.pts[idx].vmap_index = vd_it->bone; - vm_lst.pts[idx].index = vm->size()-1; - } - vt.vmref = vt.pindex; - } - SXRShaderData D; - surf = MESH->Parent()->CreateSurface((*it)->shader); - if (!surf) return MStatus::kFailure; - _surf_faces[surf].push_back(f_id); - } - } - - // BONES - OBJECT->Bones().reserve(m_boneList.size()); - status = getBoneData(); - if (!status) - { - Msg("! error getting bind pose."); - MGlobal::executeCommand("doEnableNodeItems true all"); - return status; - } - for (SmdBoneIt boneIt = m_boneList.begin(); boneIt != m_boneList.end(); boneIt++) - { - float length = 0.5f; - Fvector offset,rotate; - offset.set ((*boneIt)->trans); - rotate.set ((*boneIt)->orient); - OBJECT->Bones().push_back(new CBone()); - CBone* BONE = OBJECT->Bones().back(); - BONE->SetWMap ((*boneIt)->name); - BONE->SetName ((*boneIt)->name); - BONE->SetParentName ((*boneIt)->parentId>-1?m_boneList[(*boneIt)->parentId]->name:0); //. need convert space - BONE->SetRestParams (length,offset,rotate); - } - - // default bone part - OBJECT->BoneParts().push_back(SBonePart()); - SBonePart& BP = OBJECT->BoneParts().back(); - BP.alias = "default"; - for (int b_i=0; b_i<(int)OBJECT->Bones().size(); b_i++) - BP.bones.push_back(OBJECT->Bones()[b_i]->Name()); - OBJECT->m_objectFlags.set(CEditableObject::eoDynamic,TRUE); - - if ((MESH->GetVertexCount()<4)||(MESH->GetFaceCount()<2)) - { - Log ("! Invalid mesh: '%s'. Faces<2 or Verts<4",*MESH->Name()); - MGlobal::executeCommand("doEnableNodeItems true all"); - return MStatus::kFailure; - } - - MESH->RecomputeBBox (); - - strcat (fname,".object"); - OBJECT->Optimize (); - OBJECT->SaveObject (fname); - xr_delete (OBJECT); - - MGlobal::executeCommand("doEnableNodeItems true all"); - - return MStatus::kSuccess; -} - -MStatus CXRaySkinExport::exportMotion(LPCSTR fn) -{ - R_ASSERT(!m_bReferenceFile); - string256 nm; - strcpy(nm,fn); - if (strext(nm)) *strext(nm)=0; - - int frameFirst; - int frameLast; - MTime tmNew; - MStatus status; - - // Remember the frame the scene was at so we can restore it later. - MTime currentFrame = MAnimControl::currentTime(); - MTime startFrame = MAnimControl::minTime(); - MTime endFrame = MAnimControl::maxTime(); - - frameFirst = (int) startFrame.as( MTime::uiUnit() ); - frameLast = (int) endFrame.as( MTime::uiUnit() ); - tmNew.setUnit (MTime::uiUnit()); - - if (currentFrame.unit()!=MTime::kNTSCFrame){ - Msg("! Can't export animation with FPS!=30.f"); - return MStatus::kFailure; - } - float iFPS = 30.f; - - // build motion - CSMotion* MOT = new CSMotion(); - MOT->SetParam (frameFirst,frameLast,(float)iFPS); - MOT->SetName (nm); - - // cout << "Exporting animation frames from " << frameFirst << " to " << frameLast << "\n"; - { - BoneMotionVec& BMVec= MOT->BoneMotions(); - BMVec.reserve (m_boneList.size()); - - for (SmdBoneIt boneIt = m_boneList.begin(); boneIt != m_boneList.end(); boneIt++) - { - SmdBone* bone = *boneIt; - - BMVec.push_back (st_BoneMotion()); - st_BoneMotion& BM = BMVec.back(); - BM.SetName (bone->name); - - BM.envs[ctPositionX] = new CEnvelope(); - BM.envs[ctPositionY] = new CEnvelope(); - BM.envs[ctPositionZ] = new CEnvelope(); - BM.envs[ctRotationH] = new CEnvelope(); - BM.envs[ctRotationP] = new CEnvelope(); - BM.envs[ctRotationB] = new CEnvelope(); - - BM.envs[ctPositionX]->behavior[0]=1; BM.envs[ctPositionX]->behavior[1]=1; - BM.envs[ctPositionY]->behavior[0]=1; BM.envs[ctPositionY]->behavior[1]=1; - BM.envs[ctPositionZ]->behavior[0]=1; BM.envs[ctPositionZ]->behavior[1]=1; - BM.envs[ctRotationH]->behavior[0]=1; BM.envs[ctRotationH]->behavior[1]=1; - BM.envs[ctRotationP]->behavior[0]=1; BM.envs[ctRotationP]->behavior[1]=1; - BM.envs[ctRotationB]->behavior[0]=1; BM.envs[ctRotationB]->behavior[1]=1; - } - - for (int i=frameFirst; i<=frameLast; i++) - { - tmNew.setValue (i); - MGlobal::viewFrame( tmNew ); - - status = getBoneData(); - if (!status){ - Msg("! error getting bone data at frame: ",i); - continue; - } - - float displacedTime = (float)tmNew.as(MTime::kSeconds); - - st_Key *X,*Y,*Z,*H,*P,*B; - for (SmdBoneIt boneIt = m_boneList.begin(); boneIt != m_boneList.end(); boneIt++) - { - SmdBone* bone = *boneIt; - st_BoneMotion& BM = BMVec[boneIt-m_boneList.begin()]; - - X = new st_Key(); Y = new st_Key(); Z = new st_Key(); - H = new st_Key(); P = new st_Key(); B = new st_Key(); - BM.envs[ctPositionX]->keys.push_back(X); BM.envs[ctPositionY]->keys.push_back(Y); BM.envs[ctPositionZ]->keys.push_back(Z); - BM.envs[ctRotationH]->keys.push_back(H); BM.envs[ctRotationP]->keys.push_back(P); BM.envs[ctRotationB]->keys.push_back(B); - - float h,p,b, x,y,z; - x=bone->trans.x; y=bone->trans.y; z=bone->trans.z; - h=bone->orient.y;p=bone->orient.x;b=bone->orient.z; - X->time = displacedTime; Y->time = displacedTime; Z->time = displacedTime; - H->time = displacedTime; P->time = displacedTime; B->time = displacedTime; - X->shape = 4; Y->shape = 4; Z->shape = 4; - H->shape = 4; P->shape = 4; B->shape = 4; - X->value = x; Y->value = y; Z->value = z; - H->value = h; P->value = p; B->value = b; - } - } - strcat(nm,".skl"); - MOT->SaveMotion(nm); - xr_delete(MOT); - } - - // now restore the original frame - MGlobal::viewFrame( currentFrame ); - - return MStatus::kSuccess; -} - -int CXRaySkinExport::AppendVertex(MPoint pt, float u, float v, const WBVec& wb) -{ - for (SmdVertIt it=m_vertList.begin(); it!=m_vertList.end(); it++) - { - if ( (*it)->similar( pt.x, pt.y, pt.z, u, v, wb ) ) - return it-m_vertList.begin(); - } - { - m_vertList.push_back( new SmdVertex( pt, u, v, wb ) ); - return m_vertList.size()-1; - } -} - -//////////////////////////////////////////////////// -// routines for loading data from the Maya scene file -// -// pass in the array of u, v, and normals for this mesh -// look up these values using the vertices that come from the "get triangles" function -// -// note: there is one major hack needed in here -// getTriangle returns a list of object-relative vertices... -// unfortunately, the "GetNormal" and "GetUV" calls both require face-relative -// vertices... and there is no way to go from an object-relative vertex to -// a face-relative vertex. so I need to write my own (so broken!!!) -// -// if presetBone is set to anything other than -1 then it will force vertices to be set to it -// otherwise vertex influences are pulled from the mesh directly -//////////////////////////////////////////////////// - -MStatus CXRaySkinExport::parsePolySet(MItMeshPolygon &meshPoly, MObjectArray& rgShaders, MIntArray texMap, int presetBone = -1) -{ - SmdTriangle *tri; - MPointArray rgpt; - MIntArray rgint; - MVector pt; - float u,v; - int weight; - - MStatus status; - int cTri; -// u32 i; - - PtLookupMap ptMap; - - // cout << "Mesh has " << meshPoly.count() << " polygons\n"; - - for ( ; !meshPoly.isDone(); meshPoly.next() ) { - // Write out the smoothing group that this polygon belongs to - // We only write out the smoothing group if it is different - // from the last polygon. - // - int compIdx = meshPoly.index(); - int smoothingGroup = polySmoothingGroups[ compIdx ]; - // for each polygon, first setup the reverse mapping - // between object-relative vertex indices and face-relative - // vertex indices - ptMap.clear(); - for (int i=0; i<(int)meshPoly.polygonVertexCount(); i++) { - ptMap.insert (PtLookupMap::value_type(meshPoly.vertexIndex(i), i) ); - } - - // verify polygon zero area - if (meshPoly.zeroArea()){ - status = MS::kFailure; - Log("! polygon have zero area:",meshPoly.index()); - return status; - } - - // verify polygon zero UV area -/* if (meshPoly.zeroUVArea()){ - status = MS::kFailure; - Log("! polygon have zero UV area:",meshPoly.index()); - return status; - } -*/ - // verify polygon has UV information - if (!meshPoly.hasUVs ()) { - status = MS::kFailure; - Log("! polygon is missing UV information:",meshPoly.index()); - return status; - } - - // now iterate through each triangle on this polygon and create a triangle object in our list - status = meshPoly.numTriangles (cTri); - if (!status) { - status.perror ("error getting triangle count"); - return status; - } - - for (u32 i=0; i < u32(cTri); ++i) - { - // for each triangle, first get the triangle data - rgpt.clear(); - rgint.clear(); - - // triangles that come from a skin are retrieved in world space - // trianges that are directly attached are retrieved in object space - if (presetBone > -1) - status = meshPoly.getTriangle (i, rgpt, rgint, MSpace::kObject); - else - status = meshPoly.getTriangle (i, rgpt, rgint, MSpace::kWorld); - - if (!status) { - status.perror ("error getting triangle for mesh poly"); - return status; - } - - if ((rgpt.length() != 3) || (rgint.length() != 3)) { - Msg("! 3 points not returned for triangle"); - status = MS::kFailure; - return status; - } - - tri = new SmdTriangle(); - if (tri == NULL) { - Msg("! error creating triangle"); - status = MS::kFailure; - return status; - } - - // set the bitmap filename for the triangle - int iMat = texMap[meshPoly.index()]; - if (iMat >= 0) - tri->shader = rgShaders[iMat]; - - WBVec wb; - // VERTEX #1 - wb.clear(); - pt = rgpt[2]; pt.z = -pt.z; - CalculateTriangleVertex (rgint[2], pt, u, v, wb, meshPoly, ptMap); - if (presetBone > -1) - weight = presetBone; - tri->v[0] = AppendVertex(pt, u, 1.f-v, wb); - - // VERTEX #2 - wb.clear(); - pt = rgpt[1]; pt.z = -pt.z; - CalculateTriangleVertex (rgint[1], pt, u, v, wb, meshPoly, ptMap); - if (presetBone > -1) - weight = presetBone; - tri->v[1] = AppendVertex(pt, u, 1.f-v, wb); - - // VERTEX #3 - wb.clear(); - pt = rgpt[0]; pt.z = -pt.z; - CalculateTriangleVertex (rgint[0], pt, u, v, wb, meshPoly, ptMap); - if (presetBone > -1) - weight = presetBone; - tri->v[2] = AppendVertex(pt, u, 1.f-v, wb); - - tri->sm_group = smoothingGroup; -// - //set_smooth - t_set_smoth_flags(*this, tri->sm_group, rgint ); -// - m_triList.push_back (tri); - } - } - - return MS::kSuccess; -} - -// this function is at the heart of the polygon parsing routine -// given a mesh-relative vertex index it returns all the information -// needed to fill in a single vertex of the triangle -MStatus CXRaySkinExport::CalculateTriangleVertex (int vt, MVector &pt, float &u, float &v, WBVec& weights, MItMeshPolygon &meshPoly, PtLookupMap &ptMap) -{ - MStatus status; - int vtLocal; - int vtUV; - - // get face-relative vertex - PtLookupMap::iterator mapIt; - - mapIt = ptMap.find(vt); - if (mapIt != ptMap.end()) { - vtLocal = (*mapIt).second; - } - -/* - status = meshPoly.getNormal (vtLocal, n, MSpace::kWorld); - if (!status) { - Msg("! error getting normal for local vertex '%d' and object vertex '%d'",vtLocal,vt); - return status; - } -*/ - - status = meshPoly.getUVIndex (vtLocal, vtUV, u, v); - if (!status) { - Msg("! error getting UV Index for local vertex '%d' and object vertex '%d'",vtLocal,vt); - return status; - } - - weights = (*m_rgWeights)[vt]; -/* -//. - // determine which bone affects this vertex - if (!m_rgWeights.empty()) { - weight = m_rgWeights[vt]; - - // now need to look up appropriate bone for this vertex - MDagPath path = m_rgInfs[weight]; - MFnDependencyNode joint (path.node()); - char *name = (char *)joint.name().asChar(); - NameIntMap::iterator mapIt2; - mapIt2 = m_jointMap.find(name); - if (mapIt2 != m_jointMap.end()) { - weight = (*mapIt2).second; - } else { - // error - bone not found! - Msg("! can't find weight bone with index '%d' and name '%s' in joint map.",weight,name); - return MS::kFailure; - } - } else { - weight = 0; - } -*/ - - return MS::kSuccess; -} - -// iterate through entire scene and find all interesting objects -// looks for mesh objects. for each mesh objects, locate skin clusters -// for each skin cluster, find out its bones and other data -MStatus CXRaySkinExport::getBones(void) -{ - size_t count = 0; - - // Iterate through graph and search for skinCluster nodes - MItDependencyNodes iter( MFn::kSkinClusterFilter ); - for ( ; !iter.isDone(); iter.next() ) { - MObject object = iter.item(); - count++; - - MFnSkinCluster skinCluster(object); - - // did the user specify a skin cluster? - if (m_fSkinCluster) { - // If so, is this not it? - if (xr_strcmp(skinCluster.name().asChar(), m_strSkinCluster.asChar())) { - continue; - } - } else { - m_strSkinCluster = skinCluster.name(); - } - - // otherwise proceed with analyzing this skinCluster - // get the list of influence objects. store all influence objects in the array "m_rgInfs" - // only used if the user decides not to export all bones - - MStatus stat; - unsigned int nInfs = skinCluster.influenceObjects(m_rgInfs, &stat); - if (!stat) { - stat.perror("Error getting influence objects"); - continue; - } - - if (0 == nInfs) { - stat = MStatus::kFailure; - stat.perror("Error: No influence objects found."); - return stat; - } - - // loop through the geometries affected by this cluster - unsigned int nGeoms = skinCluster.numOutputConnections(); - for (size_t ii = 0; ii < nGeoms; ++ii) { - unsigned int index = skinCluster.indexForOutputConnection(ii,&stat); - if (!stat) { - Msg("! Error getting geometry index."); - return stat; - } - - // get the dag path of the ii'th geometry - stat = skinCluster.getPathAtIndex(index,m_skinPath); - if (!stat) { - Msg("! Error getting geometry path."); - return stat; - } - - // iterate through the components of this geometry - MItGeometry gIter(m_skinPath); - - // print out the path name of the skin, vertexCount & influenceCount - // cout << "found skin: '" << m_skinPath.partialPathName().asChar() << "' with " << gIter.count() << " vertices " << "and " << nInfs << " influences\n"; - - // set up the array for all vertices - xr_delete(m_rgWeights); - m_rgWeights = new VWBVec(); - m_rgWeights->resize(gIter.count(&stat)); - if (!stat) { - Msg("! Error creating array of vertices"); - return stat; - } - - for (; !gIter.isDone(); gIter.next()) { - MObject comp = gIter.component(&stat); - if (!stat) { - Msg("! Error getting component."); - return stat; - } - - // Get the weights for this vertex (one per influence object) - MFloatArray wts; - unsigned int infCount; - stat = skinCluster.getWeights(m_skinPath,comp,wts,infCount); - if (!stat) { - Msg("! Error getting weights."); - return stat; - } - - if (0==infCount) { Msg("! 0 influence objects."); return MStatus::kFailure; } - - // find the strongest influencer for this vertex - st_VertexWB& wb = (*m_rgWeights)[gIter.index()]; - for (u32 iInf = 0; iInf < infCount ; ++iInf ) { - if (!fis_zero(wts[iInf])){ - int bone_idx=-1; - { - int cnt = m_rgInfs.length(); - // now need to look up appropriate bone for this vertex - MDagPath path = m_rgInfs[iInf]; - MFnDependencyNode joint (path.node()); - char *name = (char *)joint.name().asChar(); - NameIntMap::iterator mapIt2; - mapIt2 = m_jointMap.find(name); - if (mapIt2 != m_jointMap.end()) { - bone_idx = (*mapIt2).second; - } else { - // error - bone not found! - Msg("! can't find weight bone with name '%s' in joint map.",name); - return MS::kFailure; - } - } - if (bone_idx!=iInf){ - Msg("! bone_idx!=iInf.[%d-%d]",bone_idx,iInf); - } - wb.push_back (st_WB(bone_idx,wts[iInf])); - } - } - wb.prepare_weights(4/*2*/); - } - } - } - - - if (0 == count) { - Msg("! No skinned meshes found in this scene. Is your mesh bound to a skeleton?"); - return MStatus::kFailure; - } else if (m_skinPath.partialPathName().length() == 0) { - Msg("! Could not find desired skin cluster '%s'",m_strSkinCluster.asChar()); - return MStatus::kFailure; - } else { - Msg("Processing skin cluster '%s'",m_strSkinCluster.asChar()); - } - return MStatus::kSuccess; -} - -// create the bone mapping that we will use to store animation data for each -// frame of animation -MStatus CXRaySkinExport::setUpBoneMap(MObject* pSkinObject) -{ - MStatus status; - int lastJointID = -1; - m_jointMap.clear(); - -// if (m_fAllBones) { - if (!pSkinObject) { - // get list of all bones that are in this file - MItDependencyNodes iter( MFn::kJoint); - for ( ; !iter.isDone(); iter.next() ) { - MObject object = iter.item(); - MDagPath jointPath; - - MFnDagNode joint(object); - char *name = (char *)joint.name().asChar(); - NameIntMap::iterator mapIt; - mapIt = m_jointMap.find(name); - if (mapIt == m_jointMap.end()) { - // this is a new bone; need to add it to the list - - // cout << "Bone found: " << joint.name().asChar(); - if (joint.isFromReferencedFile(&status)) { - MString nspace = joint.parentNamespace (&status); - // cout << " (from referenced file " << nspace.asChar() << ")\n"; - } else { - // cout << "\n"; - } - - SmdBone *bone = new SmdBone(); - bone->id = ++lastJointID; - bone->name = xr_strdup(joint.name().asChar()); - joint.getPath(jointPath); - bone->path = jointPath; - - // Add this joint to our joint map so we can look it up by name - m_jointMap.insert( NameIntMap::value_type(bone->name, bone->id) ); - bone->parentId = -1; - - // Pop one up the path stack to get our parent - jointPath.pop(1); - - MFnDagNode parentNode(jointPath, &status); - if ( !status ) { - status.perror("MFnDagNode constructor"); - return status; - } - else { - char *parentName = (char *)parentNode.name().asChar(); - mapIt = m_jointMap.find(parentName); - if (mapIt != m_jointMap.end()) { - bone->parentId = (*mapIt).second; - } - } - - m_boneList.push_back(bone); - } - } - } else { - MFnSkinCluster skinCluster(*pSkinObject); - - MDagPathArray tmp_rgInfs; - MStatus stat; - unsigned int nInfs = skinCluster.influenceObjects(tmp_rgInfs, &stat); - if (!stat) { - stat.perror("Error getting influence objects"); - return MStatus::kFailure; - } - // now go through only the skinned bones... - for (u32 i=0; iid = ++lastJointID; - bone->name = xr_strdup(fnJoint.name().asChar()); - bone->path = jointPath; - - // Add this joint to our joint map so we can look it up by name - // cout << "Added bone '" << bone->m_name << "' to bone map\n"; - m_jointMap.insert( NameIntMap::value_type(bone->name, bone->id) ); - bone->parentId = -1; - - // Pop one up the path stack to get our parent - jointPath.pop(1); - - MFnDagNode parentNode(jointPath, &status); - if ( !status ) { - status.perror("MFnDagNode constructor"); - return status; - } - else { - char *parentName = (char *)parentNode.name().asChar(); - NameIntMap::iterator mapIt; - mapIt = m_jointMap.find(parentName); - if (mapIt != m_jointMap.end()) { - bone->parentId = (*mapIt).second; - } - } - - m_boneList.push_back(bone); - } - } - - - return MStatus::kSuccess; -} - -static IC void ParseMatrix (MTransformationMatrix& mat, Fvector& t, Fvector& r, bool bRoot) -{ - MEulerRotation rot; - MTransformationMatrix::RotationOrder ro=MTransformationMatrix::kZXY; - mat.reorderRotation(ro); - rot = mat.eulerRotation(); - - r.set(-(float)rot.x,-(float)rot.y,(float)rot.z); - - MVector trans; - trans = mat.translation(MSpace::kTransform); - - MDistance dst_x(trans.x); - MDistance dst_y(trans.y); - MDistance dst_z(trans.z); - t.set((float)dst_x.asMeters(),(float)dst_y.asMeters(),-(float)dst_z.asMeters()); - - if (bRoot){ - t.set((float)dst_x.asMeters(),(float)dst_y.asMeters(),-(float)dst_z.asMeters()); - } -} - -IC MMatrix CalculateFullTransform(MFnTransform node) -{ - MStatus status; - MMatrix mat = node.transformationMatrix(&status); - int pcnt=node.parentCount(); - R_ASSERT3(pcnt<=1,"Joint has more than 1 parent: ",node.name().asChar()); - if (1==pcnt){ - MObject obj=node.parent(0); - if (obj.hasFn(MFn::kTransform)){ - mat *= CalculateFullTransform(obj); - } - } - return mat; -} - -// this function goes through the list of bones for this model and updates -// the bone positions and rotations for the current animation frame -// note: the "m_rgInfs" array must already be set up with the DAG path to each bone -MStatus CXRaySkinExport::getBoneData (void) -{ - MStatus status; - - status = gotoBindPose(); - - if (status==MS::kSuccess){ - for (SmdBoneIt itBones = m_boneList.begin(); itBones != m_boneList.end(); itBones++){ - MFnTransform fnJoint = (*itBones)->path.node(&status); - LPCSTR nm = fnJoint.name().asChar(); - if (!status) { - Msg("! Unable to cast as Transform!"); - return status; - } - - // get rotation/translation from the transformation matrix - MTransformationMatrix mat = fnJoint.transformationMatrix(&status); - if (!status) { - Msg("! Unable to get transformation matrix!"); - return status; - } - - if ((*itBones)->parentId==-1) - mat = CalculateFullTransform(fnJoint); - - ParseMatrix(mat,(*itBones)->trans,(*itBones)->orient,(*itBones)->parentId==-1); - - } - } - - return status; -} - -// export all objects parented to bones -// this is designed for mechanical objects where we simply want to parent -// geometry to bones -MStatus CXRaySkinExport::parseBoneGeometry( ) -// we want to iterate through all bones -// for each bone, find list of all meshes attached to it -// for each mesh, export geometry -// -{ - MStatus status; - - // goto bind pose - status = gotoBindPose(); - - if (MStatus::kSuccess==status){ - for (SmdBoneIt itBones = m_boneList.begin(); itBones != m_boneList.end(); itBones++){ - MFnDagNode fnJoint = (*itBones)->path.node(&status); - // go through children looking for geometry - for (unsigned int i=0; i < fnJoint.childCount (&status); i++) { - MObject obj = fnJoint.child(i, &status); - if (status == MStatus::kFailure) - { - status.perror("Unable to load child for bone"); - return (MStatus::kFailure); - } - MFnDagNode fnNode (obj); - MDagPath path; - status = fnNode.getPath (path); - if (status == MStatus::kFailure) - { - status.perror ("unable to lookup path for child of bone"); - return (MStatus::kFailure); - } - - - // Have to make the path include the shape below it so that - // we can determine if the underlying shape node is instanced. - // By default, dag paths only include transform nodes. - // - status = path.extendToShape(); - if (status != MStatus::kSuccess) { - // no geometry under this node... - continue; - } - - // If the shape is instanced then we need to determine which - // instance this path refers to. - // - int instanceNum = 0; - if (path.isInstanced()) - instanceNum = path.instanceNumber(); - - MFnMesh fnMesh(path, &status); - if (status != MStatus::kSuccess) { - // this object is not a mesh - continue; - } - - // cout << "processing mesh " << fnMesh.name().asChar() << "\n"; - - // Get a list of all shaders attached to this mesh - - MObjectArray rgShaders; - MIntArray rgFaces; - status = fnMesh.getConnectedShaders (instanceNum, rgShaders, rgFaces); - if (status == MStatus::kFailure) - { - Msg("! Unable to load shaders for mesh"); - return (MStatus::kFailure); - } - - buildEdgeTable(path); - - // now iterate through all polygons and set up that data - MItMeshPolygon piter(path, MObject::kNullObj, &status); - parsePolySet(piter, rgShaders, rgFaces, (*itBones)->id); - - destroyEdgeTable(); // Free up the edge table - } - } - } - return status; -} - - -MStatus CXRaySkinExport::parseShape( MDagPath path) -// -// Description: -// Find the texture files that apply to the color of each polygon of -// a selected shape if the shape has its polygons organized into sets. -// -{ - - // cout << "processing mesh " << path.partialPathName().asChar() << "\n"; - MStatus status; - - // Have to make the path include the shape below it so that - // we can determine if the underlying shape node is instanced. - // By default, dag paths only include transform nodes. - // - path.extendToShape(); - - // If the shape is instanced then we need to determine which - // instance this path refers to. - // - int instanceNum = 0; - if (path.isInstanced()) - instanceNum = path.instanceNumber(); - - MFnMesh fnMesh(path); - - // Get a list of all shaders attached to this mesh - - MObjectArray rgShaders; - MIntArray rgFaces; - status = fnMesh.getConnectedShaders (instanceNum, rgShaders, rgFaces); - if (status == MStatus::kFailure) - { - status.perror("Unable to load shaders for mesh"); - return (MStatus::kFailure); - } - - buildEdgeTable(path); - - // now iterate through all polygons and set up that data - MItMeshPolygon piter(path, MObject::kNullObj, &status); - parsePolySet(piter, rgShaders, rgFaces); - - destroyEdgeTable(); // Free up the edge table - - return MStatus::kSuccess; -} - -// reset all data tables in between function calls -void CXRaySkinExport::clearData(void) -{ - for (SmdTriIt t_it=m_triList.begin(); t_it!=m_triList.end(); t_it++) - { - xr_delete(*t_it); - } - - for (SmdVertIt v_it=m_vertList.begin(); v_it!=m_vertList.end(); v_it++) - { - xr_delete(*v_it); - } - - for (SmdBoneIt b_it=m_boneList.begin(); b_it!=m_boneList.end(); b_it++) - { - xr_delete(*b_it); - } - xr_delete (m_rgWeights); - xr_free (polySmoothingGroups); - - m_triList.clear (); - m_vertList.clear(); - m_jointMap.clear(); - m_boneList.clear(); - m_rgInfs.clear (); - m_strSkinCluster.clear(); -} -void CXRaySkinExport::CreateSMGFacegroups ( MFnMesh& fnMesh ) -{ - // Now create a polyId->smoothingGroup table - // - int numPolygons = fnMesh.numPolygons(); - polySmoothingGroups = xr_alloc(numPolygons); //(int*)malloc( sizeof(int) * numPolygons ); - for ( int i=0; i< numPolygons; i++ ) { - polySmoothingGroups[i] = NO_SMOOTHING_GROUP; - } - - // Now call the smoothingAlgorithm to fill in the polySmoothingGroups - // table. - // Note: we have to traverse ALL polygons to handle the case - // of disjoint polygons. - // - nextSmoothingGroup = 1; - currSmoothingGroup = 1; - for ( int pid=0; pid(edgeTableSize); - ZeroMemory(edgeTable,edgeTableSize*sizeof(int)); - - // Add entries, for each edge, to the lookup table - // - MItMeshEdge eIt( mesh ); - for ( ; !eIt.isDone(); eIt.next() ) - { - bool smooth = eIt.isSmooth(); - addEdgeInfo( eIt.index(0), eIt.index(1), smooth ); - } - - // Fill in referenced polygons - // - MItMeshPolygon pIt( mesh ); - for ( ; !pIt.isDone(); pIt.next() ) - { - int pvc = pIt.polygonVertexCount(); - for ( int v=0; vpolyIds[0] ) { - elem->polyIds[0] = edgeId; - } - else { - elem->polyIds[1] = edgeId; - } - - } - } - } - - CreateSmoothingGroups ( fnMesh ); -} - -bool CXRaySkinExport::smoothingAlgorithm( int polyId, MFnMesh& fnMesh ) -{ - MIntArray vertexList; - fnMesh.getPolygonVertices( polyId, vertexList ); - int vcount = vertexList.length(); - bool smoothEdgeFound = false; - - for ( int vid=0; vidpolyIds[1] ) { // Edge not a border - - // We are starting a new smoothing group - // - if ( newSmoothingGroup ) { - currSmoothingGroup = nextSmoothingGroup++; - newSmoothingGroup = false; - - // This is a SEED (starting) polygon and so we always - // give it the new smoothing group id. - // Even if all edges are hard this must be done so - // that we know we have visited the polygon. - // - polySmoothingGroups[polyId] = currSmoothingGroup; - } - - // If we have a smooth edge then this poly must be a member - // of the current smoothing group. - // - if ( elem->smooth ) { - polySmoothingGroups[polyId] = currSmoothingGroup; - smoothEdgeFound = true; - } - else { // Hard edge so ignore this polygon - continue; - } - - // Find the adjacent poly id - // - int adjPoly = elem->polyIds[0]; - if ( adjPoly == polyId ) { - adjPoly = elem->polyIds[1]; - } - - // If we are this far then adjacent poly belongs in this - // smoothing group. - // If the adjacent polygon's smoothing group is not - // NO_SMOOTHING_GROUP then it has already been visited - // so we ignore it. - // - if ( NO_SMOOTHING_GROUP == polySmoothingGroups[adjPoly] ) { - smoothingAlgorithm( adjPoly, fnMesh ); - } - else if ( polySmoothingGroups[adjPoly] != currSmoothingGroup ) { - Msg("! smoothing group problem at polygon %d",adjPoly); - } - } - } - } - return smoothEdgeFound; -} - -////////////////////////////////////////////////////////////// - -void CXRaySkinExport::addEdgeInfo( int v1, int v2, bool smooth ) -// -// Adds a new edge info element to the vertex table. -// -{ - SXREdgeInfoPtr element = NULL; - - if ( NULL == edgeTable[v1] ) { - edgeTable[v1] = xr_alloc(1);//(EdgeInfoPtr)malloc( sizeof(struct EdgeInfo) ); - element = edgeTable[v1]; - } - else { - element = edgeTable[v1]; - while ( NULL != element->next ) { - element = element->next; - } - element->next = xr_alloc(1);//(EdgeInfoPtr)malloc( sizeof(struct EdgeInfo) ); - element = element->next; - } - - // Setup data for new edge - // - element->vertId = v2; - element->smooth = smooth; - element->next = NULL; - - // Initialize array of id's of polygons that reference this edge. - // There are at most 2 polygons per edge. - // - element->polyIds[0] = INVALID_ID; - element->polyIds[1] = INVALID_ID; -} - -////////////////////////////////////////////////////////////// - -SXREdgeInfoPtr CXRaySkinExport::findEdgeInfo( int v1, int v2 ) -// -// Finds the info for the specified edge. -// -{ - SXREdgeInfoPtr element = NULL; - element = edgeTable[v1]; - - while ( NULL != element ) { - if ( v2 == element->vertId ) { - return element; - } - element = element->next; - } - - if ( element == NULL ) { - element = edgeTable[v2]; - - while ( NULL != element ) { - if ( v1 == element->vertId ) { - return element; - } - element = element->next; - } - } - - return NULL; -} - -////////////////////////////////////////////////////////////// - -void CXRaySkinExport::destroyEdgeTable() -// -// Free up all of the memory used by the edgeTable. -// -{ - SXREdgeInfoPtr element = NULL; - SXREdgeInfoPtr tmp = NULL; - - for ( int v=0; vnext; - xr_free( tmp ); - } - } - - if ( NULL != edgeTable ) { - xr_free( edgeTable ); - edgeTable = NULL; - } - - if ( NULL != polySmoothingGroups ) { - xr_free( polySmoothingGroups ); - polySmoothingGroups = NULL; - } -} -////////////////////////////////////////////////////////////// diff --git a/cs/engine/plugins/Maya/Export/SmdMaya.h b/cs/engine/plugins/Maya/Export/SmdMaya.h deleted file mode 100644 index f47f550cd..000000000 --- a/cs/engine/plugins/Maya/Export/SmdMaya.h +++ /dev/null @@ -1,105 +0,0 @@ -#ifndef SmdMayaH -#define SmdMayaH - -#include "..\..\..\editors\Ecore\editor\EditMesh.H" -#include "ExportDefines.H" -#include "SmdBone.h" -#include "SmdTriangle.h" - -// refs -class CEditableObject; - -struct lstr { - bool operator() (char *s1, char *s2) const - { - return (xr_strcmp(s1, s2)< 0); - } -}; - -typedef xr_map NameIntMap; -typedef xr_map PtLookupMap; - -using SmdBoneVec = xr_vector; -using SmdBoneIt = SmdBoneVec::iterator; -using SmdTriVec = xr_vector; -using SmdTriIt = SmdTriVec::iterator; -using SmdVertVec = xr_vector; -using SmdVertIt = SmdVertVec::iterator; - -class CXRaySkinExport: public MPxFileTranslator -{ -public: - CXRaySkinExport (bool bReference); - virtual ~CXRaySkinExport (); - - // these functions are all used to initialize this as a Maya - // file exporter plug-in - static void* creator_skin (); - static void* creator_skin_motion (); - MStatus reader (const MFileObject& file, const MString& optionsString, FileAccessMode mode); - MStatus writer (const MFileObject& file, const MString& optionsString, FileAccessMode mode); - - bool haveWriteMethod () const ; - virtual MString filter () const; - //virtual MString defaultExtension () const; - MFileKind identifyFile (const MFileObject& fileName, const char* buffer, short size) const; -private: - // these functions are all used to iterate across geometry, filling data structures - MStatus gotoBindPose (void); - MStatus getBones (void); // loads geometry from scene - MStatus getBoneData (void); // loads bone position per animation frame - MStatus setUpBoneMap (MObject* pSkinObject); // creates data structure to store data - void parseMesh (MObject &mesh, MDagPath path); - MStatus parseBoneGeometry (); - MStatus parseShape (MDagPath path); - MStatus parsePolySet (MItMeshPolygon &meshPoly, MObjectArray& rgShaders, MIntArray texMap, int weight); - MStatus CalculateTriangleVertex (int vt, MVector &pt, float &u, float &v, WBVec& weights, MItMeshPolygon &meshPoly, PtLookupMap &ptMap); - void clearData (void); // call inbetween function calls -// MStatus GetShaderFileName (MString &filename, MObject &set); - int AppendVertex (MPoint pt, float u, float v, const WBVec& wb); - - // Edge lookup methods - // - void buildEdgeTable (MDagPath&); - void CreateSmoothingGroups ( MFnMesh& ); - void CreateSMGFacegroups ( MFnMesh& ); - void CreateSMGEdgeAttrs ( MFnMesh& ); - void addEdgeInfo (int, int, bool); - -public: - SXREdgeInfoPtr findEdgeInfo (int, int); - -private: - void destroyEdgeTable (); - bool smoothingAlgorithm (int, MFnMesh&); - // Edge lookup table (by vertex id) and smoothing group info - // - SXREdgeInfoPtr* edgeTable; - int * polySmoothingGroups; - int edgeTableSize; - int nextSmoothingGroup; - int currSmoothingGroup; - bool newSmoothingGroup; - - // functions for printing out the animation data into files - MStatus exportObject (LPCSTR fname); - MStatus exportMotion (LPCSTR fname); - - // these are various data structures used to store scene geometry - NameIntMap m_jointMap; - SmdBoneVec m_boneList; - SmdTriVec m_triList; - SmdVertVec m_vertList; - MDagPath m_skinPath; // path to the mesh we discover - MDagPathArray m_rgInfs; // array of paths to the bones we discover - - VWBVec* m_rgWeights; // for each vertex, store index of influence joint - MString m_strFilename; // filename for file - - // options used to drive export behavior - bool m_bReferenceFile; // true for a reference file, false for an animation file - bool m_fSkinCluster; // true if we should only export the cluster named by "m_strSkinCluster" - MString m_strSkinCluster; // name of skin cluster selected by user to be exported. if empty, use first cluster in list -}; - -#endif //SmdMayaH \ No newline at end of file diff --git a/cs/engine/plugins/Maya/Export/SmdTriangle.cpp b/cs/engine/plugins/Maya/Export/SmdTriangle.cpp deleted file mode 100644 index efbb4b025..000000000 --- a/cs/engine/plugins/Maya/Export/SmdTriangle.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/*** -* -* Copyright (c) 2001 Escape Factory, Ltd. All rights reserved. -* -****/ -// -////////////////////////////////////////////////////////////////////// - -#include "stdafx.h" - -#include "SmdTriangle.h" - -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// - - -SmdVertex::SmdVertex() -{ - id = -1; -} - -SmdVertex::~SmdVertex() -{ - -} - -SmdVertex::SmdVertex(MPoint pt, float u, float v, const WBVec& wb) -{ - pos.set ((float)pt.x,(float)pt.y,(float)pt.z); - uv.set (u,v); - influence = wb; - id = -1; -} - -SmdTriangle::SmdTriangle() -{ - id = -1; - sm_group = -1; -} - -SmdTriangle::~SmdTriangle() -{ -} diff --git a/cs/engine/plugins/Maya/Export/SmdTriangle.h b/cs/engine/plugins/Maya/Export/SmdTriangle.h deleted file mode 100644 index cd679b2f2..000000000 --- a/cs/engine/plugins/Maya/Export/SmdTriangle.h +++ /dev/null @@ -1,58 +0,0 @@ -/*** -* -* Copyright (c) 2001 Escape Factory, Ltd. All rights reserved. -* -****/ -// -////////////////////////////////////////////////////////////////////// - -#if !defined(TRIANGLE_H) -#define TRIANGLE_H - -#include "SmdBone.h" -#include "..\..\..\editors\Ecore\editor\EditMesh.h" - -class SmdVertex -{ -public: - WBVec influence; - Fvector pos; - Fvector2 uv; - int id; -public: - SmdVertex (); - SmdVertex (MPoint pt, float u, float v, const WBVec& wb); - virtual ~SmdVertex (); - - void set (double x, double y, double z, float u, float v); - void set (MPoint pt, float u, float v, int ID); - - IC bool similar (double x, double y, double z, float u, float v, const WBVec& wb)const - { - if (influence.size()!=wb.size()) return false; - if (!fsimilar(pos.x,(float)x)) return false; - if (!fsimilar(pos.y,(float)y)) return false; - if (!fsimilar(pos.z,(float)z)) return false; - if (!fsimilar(uv.x,u)) return false; - if (!fsimilar(uv.y,v)) return false; - for (u32 k=0; k - -#define REQUIRE_IOSTREAM -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#pragma warning(pop) - -#define ENGINE_API -#define ECORE_API - -enum TMsgDlgType { mtWarning, mtError, mtInformation, mtConfirmation, mtCustom }; -enum TMsgDlgBtn { mbYes, mbNo, mbOK, mbCancel, mbAbort, mbRetry, mbIgnore, mbAll, mbNoToAll, mbYesToAll, mbHelp }; -typedef TMsgDlgBtn TMsgDlgButtons[mbHelp]; - -#pragma warning(push) -#pragma warning(disable:4995) -# include "..\..\shared\ELog.h" -#pragma warning(pop) - -//#include "bone.h" -#include "../../../xrEngine/bone.h" - -#pragma warning(push) -#pragma warning(disable:4995) -# include -# include -# include -#pragma warning(pop) - -#include - -#include - -#define AnsiString std::string -using AStringVec = xr_vector; -using AStringIt = AStringVec::iterator; - -#define THROW R_ASSERT(0) - -#ifdef _MAYA_EXPORT - #define _EDITOR_FILE_NAME_ "maya_export" -#else - #ifdef _MAYA_MATERIAL - #define _EDITOR_FILE_NAME_ "maya_material" - #endif -#endif - -#define GAMEMTL_NONE u32(-1) -#define _game_data_ "$game_data$" - -#endif /*_INCDEF_STDAFX_H_*/ - - - - - diff --git a/cs/engine/plugins/Maya/Export/XRayExport.cpp b/cs/engine/plugins/Maya/Export/XRayExport.cpp deleted file mode 100644 index 011b3204b..000000000 --- a/cs/engine/plugins/Maya/Export/XRayExport.cpp +++ /dev/null @@ -1,73 +0,0 @@ -#include "stdafx.h" -#pragma hdrstop - -#include "SmdMaya.h" -#include "maTranslator.h" - -const char *const xrayObjectOptionScript = "xrayObjectExportOptions"; -const char *const xrayObjectDefaultOptions = 0; -const char *const xrayCameraMotionDefaultOptions = 0; - -const char *const xraySkinOptionScript = "xraySkinExportOptions"; -const char *const xraySkinDefaultOptions = - "SkinCluster=;" - ; - -const char *const xraySkinMotionOptionScript = "xraySkinMotionExportOptions"; -const char *const xraySkinMotionDefaultOptions = - "SkinCluster=;" -; - -MStatus uninitializePlugin( MObject obj ) -{ - MFnPlugin plugin( obj ); - MStatus status; - plugin.deregisterFileTranslator("XRay_Object_Export"); - plugin.deregisterFileTranslator("XRay_Skin_Export"); - plugin.deregisterFileTranslator("XRay_Skin_Motion_Export"); - - Core._destroy(); - - return status; -} -////////////////////////////////////////////////////////////// - -static MObject INIT_OBJ=MObject::kNullObj; - -void uninitialize(void*) -{ - if (!INIT_OBJ.isNull()){ - uninitializePlugin(INIT_OBJ); - INIT_OBJ=MObject::kNullObj; - } - Core._destroy(); -} - -MStatus initializePlugin( MObject obj ) -{ - INIT_OBJ = obj; - Core._initialize("XRayMayaPlugin",ELogCallback,FALSE); - FS._initialize (CLocatorAPI::flScanAppRoot,NULL,"xray_path.ltx"); - R_ASSERT2(0!=Memory.mem_fill,"Incorrect xrCore.dll version."); - - MFnPlugin plugin( obj, "GSC Game World", "1.00", "Any"); - - // add callbacks -// MSceneMessage::addCallback(MSceneMessage::kMayaExiting, uninitialize, 0); - - MStatus status; - // Register the translator with the system - status = plugin.registerFileTranslator("XRay_Object_Export", "none", CXRayObjectExport::creator, (char *)xrayObjectOptionScript, (char *)xrayObjectDefaultOptions ); - if (status!=MS::kSuccess) return status; - status = plugin.registerFileTranslator("XRay_Skin_Export", "none", CXRaySkinExport::creator_skin, (char *)xraySkinOptionScript, (char *)xraySkinDefaultOptions); - if (status!=MS::kSuccess) return status; - status = plugin.registerFileTranslator("XRay_Skin_Motion_Export", "none", CXRaySkinExport::creator_skin_motion, (char *)xraySkinMotionOptionScript, (char *)xraySkinMotionDefaultOptions); - if (status!=MS::kSuccess) return status; - status = plugin.registerFileTranslator("XRay_Camera_Motion_Export", "none", CXRayCameraExport::creator, (char *)xraySkinMotionOptionScript, (char *)xrayCameraMotionDefaultOptions); - if (status!=MS::kSuccess) return status; - - return status; -} -////////////////////////////////////////////////////////////// - - diff --git a/cs/engine/plugins/Maya/Export/maTranslator.cpp b/cs/engine/plugins/Maya/Export/maTranslator.cpp deleted file mode 100644 index 648270e92..000000000 --- a/cs/engine/plugins/Maya/Export/maTranslator.cpp +++ /dev/null @@ -1,1104 +0,0 @@ -#include "stdafx.h" -#pragma hdrstop - -#include "maTranslator.h" -#include "..\..\..\editors\Ecore\editor\EditObject.h" - -#define NO_SMOOTHING_GROUP -1 -#define INITIALIZE_SMOOTHING -2 -#define INVALID_ID -1 - -////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////// - -void* CXRayObjectExport::creator() -{ - return new CXRayObjectExport(); -} - -////////////////////////////////////////////////////////////// - -MStatus CXRayObjectExport::reader ( const MFileObject& file, const MString& options, FileAccessMode mode) -{ - fprintf(stderr, "CXRayObjectExport::reader called in error\n"); - return MS::kFailure; -} -////////////////////////////////////////////////////////////// - -MStatus CXRayObjectExport::writer ( const MFileObject& file, const MString& options, FileAccessMode mode ) -{ - MStatus status= MS::kFailure; - - //move default extesion here.. - MString mname = file.fullName()+".object"; - LPCSTR fname = mname.asChar(); - - Log("Export object: ",fname); - CEditableObject* OBJECT = new CEditableObject(fname); - OBJECT->SetVersionToCurrent(TRUE,TRUE); - if((mode==MPxFileTranslator::kExportAccessMode)||(mode==MPxFileTranslator::kSaveAccessMode)){ - status = ExportAll(OBJECT)?MS::kSuccess:MS::kFailure; - }else if(mode==MPxFileTranslator::kExportActiveAccessMode){ - status = ExportSelected(OBJECT)?MS::kSuccess:MS::kFailure; - } - if (MS::kSuccess==status){ - OBJECT->Optimize (); - OBJECT->SaveObject (fname); - Log("Object succesfully exported."); - Msg("%d vertices, %d faces", OBJECT->GetVertexCount(), OBJECT->GetFaceCount()); - }else{ - Log("! Export failed."); - } - xr_delete(OBJECT); - - return status; -} -////////////////////////////////////////////////////////////// - -MString CXRayObjectExport::filter()const -{ - std::cerr <<"Dbg : MString CXRayObjectExport::filter()const\n"; - return "*.ob*"; -} - -////////////////////////////////////////////////////////////// - -bool CXRayObjectExport::haveReadMethod () const -{ - return false; -} -////////////////////////////////////////////////////////////// - -bool CXRayObjectExport::haveWriteMethod () const -{ - std::cerr <<"Dbg : bool CXRayObjectExport::haveWriteMethod () const\n"; - return true; -} -////////////////////////////////////////////////////////////// -/* -MString CXRayObjectExport::defaultExtension () const -{ - std::cerr <<"Dbg : MString CXRayObjectExport::defaultExtension () const\n"; - return "object"; -} -*/ -////////////////////////////////////////////////////////////// - -MPxFileTranslator::MFileKind CXRayObjectExport::identifyFile ( - const MFileObject& fileName, - const char* buffer, - short size) const -{ - const char * name = fileName.name().asChar(); - int nameLength = xr_strlen(name); - - //if ((nameLength > 7) && !stricmp(name+nameLength-7, ".object")) - if ((nameLength > 4) && !stricmp(name+nameLength-4, ".xro")) - return kCouldBeMyFileType; - else - return kNotMyFileType; -} -////////////////////////////////////////////////////////////// - -bool CXRayObjectExport::initializeSetsAndLookupTables( bool exportAll ) -// -// Description : -// Creates a list of all sets in Maya, a list of mesh objects, -// and polygon/vertex lookup tables that will be used to -// determine which sets are referenced by the poly components. -// -{ - int i=0,j=0, length; - MStatus stat; - - // Initialize class data. - // Note: we cannot do this in the constructor as it - // only gets called upon registry of the plug-in. - // - numSets = 0; - sets = NULL; - lastSets = NULL; - lastMaterials = NULL; - objectId = 0; - objectCount = 0; - polygonTable = NULL; - vertexTable = NULL; - polygonTablePtr = NULL; - vertexTablePtr = NULL; - objectGroupsTablePtr = NULL; - objectNodeNamesArray.clear(); - transformNodeNameArray.clear(); - - ////////////////////////////////////////////////////////////////// - // - // Find all sets in Maya and store the ones we care about in - // the 'sets' array. Also make note of the number of sets. - // - ////////////////////////////////////////////////////////////////// - - // Get all of the sets in maya and put them into - // a selection list - // - MStringArray result; - MGlobal::executeCommand( "ls -sets", result ); - MSelectionList * setList = new MSelectionList(); - length = result.length(); - for ( i=0; iadd( result[i] ); - } - - // Extract each set as an MObject and add them to the - // sets array. - // We may be excluding groups, matierials, or ptGroups - // in which case we can ignore those sets. - // - MObject mset; - sets = new MObjectArray(); - length = setList->length(); - for ( i=0; igetDependNode( i, mset ); - - MFnSet fnSet( mset, &stat ); - if ( stat ) { - if ( MFnSet::kRenderableOnly == fnSet.restriction(&stat) ) { - sets->append( mset ); - } - } - } - xr_delete(setList); - - numSets = sets->length(); - - ////////////////////////////////////////////////////////////////// - // - // Do a dag-iteration and for every mesh found, create facet and - // vertex look-up tables. These tables will keep track of which - // sets each component belongs to. - // - // If exportAll is false then iterate over the activeSelection - // list instead of the entire DAG. - // - // These arrays have a corrisponding entry in the name - // stringArray. - // - ////////////////////////////////////////////////////////////////// - MIntArray vertexCounts; - MIntArray polygonCounts; - - if ( exportAll ) { - MItDag dagIterator( MItDag::kBreadthFirst, MFn::kInvalid, &stat); - - if ( MS::kSuccess != stat) { - fprintf(stderr,"Failure in DAG iterator setup.\n"); - return false; - } - - objectNames = new MStringArray(); - - for ( ; !dagIterator.isDone(); dagIterator.next() ) - { - MDagPath dagPath; - stat = dagIterator.getPath( dagPath ); - - if ( stat ) - { - // skip over intermediate objects - // - MFnDagNode dagNode( dagPath, &stat ); - if (dagNode.isIntermediateObject()) - { - continue; - } - - if (( dagPath.hasFn(MFn::kMesh)) && - ( dagPath.hasFn(MFn::kTransform))) - { - // We want only the shape, - // not the transform-extended-to-shape. - continue; - } - else if ( dagPath.hasFn(MFn::kMesh)) - { - // We have a mesh so create a vertex and polygon table - // for this object. - // - MFnMesh fnMesh( dagPath ); - int vtxCount = fnMesh.numVertices(); - int polygonCount = fnMesh.numPolygons(); - // we do not need this call anymore, we have the shape. - // dagPath.extendToShape(); - MString name = dagPath.fullPathName(); - objectNames->append( name ); - objectNodeNamesArray.append( fnMesh.name() ); - - vertexCounts.append( vtxCount ); - polygonCounts.append( polygonCount ); - - objectCount++; - } - } - } - }else{ - MSelectionList slist; - MGlobal::getActiveSelectionList( slist ); - MItSelectionList iter( slist ); - MStatus status; - - objectNames = new MStringArray(); - - // We will need to interate over a selected node's heirarchy - // in the case where shapes are grouped, and the group is selected. - MItDag dagIterator( MItDag::kDepthFirst, MFn::kInvalid, &status); - - for ( ; !iter.isDone(); iter.next() ){ - MDagPath objectPath; - stat = iter.getDagPath( objectPath ); - - // reset iterator's root node to be the selected node. - status = dagIterator.reset (objectPath.node(), - MItDag::kDepthFirst, MFn::kInvalid ); - - // DAG iteration beginning at at selected node - for ( ; !dagIterator.isDone(); dagIterator.next() ){ - MDagPath dagPath; - MObject component = MObject::kNullObj; - status = dagIterator.getPath(dagPath); - - if (!status){ - fprintf(stderr,"Failure getting DAG path.\n"); - freeLookupTables(); - return false; - } - - // skip over intermediate objects - // - MFnDagNode dagNode( dagPath, &stat ); - if (dagNode.isIntermediateObject()) continue; - - if (( dagPath.hasFn(MFn::kMesh)) && ( dagPath.hasFn(MFn::kTransform))){ - // We want only the shape, - // not the transform-extended-to-shape. - continue; - }else if ( dagPath.hasFn(MFn::kMesh)){ - // We have a mesh so create a vertex and polygon table - // for this object. - // - MFnMesh fnMesh( dagPath ); - int vtxCount = fnMesh.numVertices(); - int polygonCount = fnMesh.numPolygons(); - - // we do not need this call anymore, we have the shape. - // dagPath.extendToShape(); - MString name = dagPath.fullPathName(); - objectNames->append( name ); - objectNodeNamesArray.append( fnMesh.name() ); - - vertexCounts.append( vtxCount ); - polygonCounts.append( polygonCount ); - - objectCount++; - } - } - } - } - - // Now we know how many objects we are dealing with - // and we have counts of the vertices/polygons for each - // object so create the maya group look-up table. - // - if( objectCount > 0 ) { - // To export Maya groups we traverse the hierarchy starting at - // each objectNodeNamesArray[i] going towards the root collecting transform - // nodes as we go. - length = objectNodeNamesArray.length(); - for( i=0; i 0 ) { - objectGroupsTablePtr = xr_alloc(objectCount);// (bool**) malloc( sizeof(bool*)*objectCount ); - length = transformNodeNameArray.length(); - for ( i=0; i(length); - ZeroMemory(objectGroupsTablePtr[i],length*sizeof(bool)); - // XXX nitrocaster: remove this 'cause malloc failure shouldn't be handled there - if ( objectGroupsTablePtr[i] == NULL ) { - Log("! calloc returned NULL (objectGroupsTablePtr)"); - return false; - } - } - } -// else{ -// Log("! Can't find transform for node."); -// return false; -// } - } - - // Create the vertex/polygon look-up tables. - // - if ( objectCount > 0 ) { - - vertexTablePtr = xr_alloc(objectCount); //(bool**) malloc( sizeof(bool*)*objectCount ); - polygonTablePtr = xr_alloc(objectCount); //(bool**) malloc( sizeof(bool*)*objectCount ); - - for ( i=0; i(vertexCounts[i]*numSets); - ZeroMemory(vertexTablePtr[i],vertexCounts[i]*numSets*sizeof(bool)); - // XXX nitrocaster: remove this 'cause malloc failure shouldn't be handled there - if ( vertexTablePtr[i] == NULL ) { - Log("! calloc returned NULL (vertexTable)"); - return false; - } - -// polygonTablePtr[i] = (bool*)calloc( polygonCounts[i]*numSets, sizeof(bool) ); - polygonTablePtr[i] = xr_alloc(polygonCounts[i]*numSets); - ZeroMemory(polygonTablePtr[i],polygonCounts[i]*numSets*sizeof(bool)); - // XXX nitrocaster: remove this 'cause malloc failure shouldn't be handled there - if ( polygonTablePtr[i] == NULL ) { - Log("! calloc returned NULL (polygonTable)"); - return false; - } - } - } - - // If we found no meshes then return - // - if ( objectCount == 0 ) { - return false; - } - - ////////////////////////////////////////////////////////////////// - // - // Go through all of the set members (flattened lists) and mark - // in the lookup-tables, the sets that each mesh component belongs - // to. - // - // - ////////////////////////////////////////////////////////////////// - bool flattenedList = true; - MDagPath object; - MObject component; - MSelectionList memberList; - - - for ( i=0; ilength(); - for ( o=0; olength(); - for ( o=0; o= polygonCounts[o] ) { - Msg("! Bad polygon index '%d' found. Polygon skipped",compIdx); - break; - } - - polygonTable = polygonTablePtr[o]; - *(polygonTable + numSets*compIdx + i) = true; - break; - } - } - } - } - } - else { - - // There are no components, therefore we can mark - // all polygons as members of the given set. - // - - if (object.hasFn(MFn::kMesh)) { - - MFnMesh fnMesh( object, &stat ); - if ( MS::kSuccess != stat) { - fprintf(stderr,"Failure in MFnMesh initialization.\n"); - return false; - } - - // We are going to iterate over all the polygons. - // - MItMeshPolygon piter( object, MObject::kNullObj, &stat ); - if ( MS::kSuccess != stat) { - fprintf(stderr, - "Failure in MItMeshPolygon initialization.\n"); - return false; - } - for ( ; !piter.isDone(); piter.next() ) - { - int compIdx = piter.index(); - MString name = object.fullPathName(); - - // Figure out which object polygonTable to get. - // - int o, numObjectNames; - numObjectNames = objectNames->length(); - for ( o=0; o= polygonCounts[o] ) { - Msg("! Bad polygon index '%d' found. Polygon skipped",compIdx); - break; - } - // Mark set i as true in the table - // - polygonTable = polygonTablePtr[o]; - *(polygonTable + numSets*compIdx + i) = true; - break; - } - } - } // end of piter.next() loop - } // end of condition if (object.hasFn(MFn::kMesh)) - } // end of else condifion if (!component.isNull()) - } // end of memberList.getDagPath(m,object,component) - } // end of memberList loop - } // end of for-loop for sets - - // Go through all of the group members and mark in the - // lookup-table, the group that each shape belongs to. - length = objectNodeNamesArray.length(); - if (objectGroupsTablePtr){ - for( i=0; i(edgeTableSize); - ZeroMemory(edgeTable,edgeTableSize*sizeof(int)); - - // Add entries, for each edge, to the lookup table - // - MItMeshEdge eIt( mesh ); - for ( ; !eIt.isDone(); eIt.next() ) - { - bool smooth = eIt.isSmooth(); - addEdgeInfo( eIt.index(0), eIt.index(1), smooth ); - } - - // Fill in referenced polygons - // - MItMeshPolygon pIt( mesh ); - for ( ; !pIt.isDone(); pIt.next() ) - { - int pvc = pIt.polygonVertexCount(); - for ( int v=0; vpolyIds[0] ) { - elem->polyIds[0] = edgeId; - } - else { - elem->polyIds[1] = edgeId; - } - - } - } - } - - CreateSmoothingGroups( fnMesh ); -} - -////////////////////////////////////////////////////////////// -void CXRayObjectExport:: CreateSmoothingGroups ( MFnMesh& fnMesh ) -{ - // Now create a polyId->smoothingGroup table - // - int numPolygons = fnMesh.numPolygons(); - polySmoothingGroups = xr_alloc(numPolygons); //(int*)malloc( sizeof(int) * numPolygons ); - for ( int i=0; i< numPolygons; i++ ) { - polySmoothingGroups[i] = NO_SMOOTHING_GROUP; - } - //CreateSMGFacegroups( fnMesh ); - // CreateSMGEdgeAttrs( fnMesh ); -} -void CXRayObjectExport:: CreateSMGFacegroups ( MFnMesh& fnMesh ) -{ - // Now call the smoothingAlgorithm to fill in the polySmoothingGroups - // table. - // Note: we have to traverse ALL polygons to handle the case - // of disjoint polygons. - // - int numPolygons = fnMesh.numPolygons(); - nextSmoothingGroup = 1; - currSmoothingGroup = 1; - for ( int pid=0; pidsmooth ); - } - } - } -} - -bool CXRayObjectExport::smoothingAlgorithm( int polyId, MFnMesh& fnMesh ) -{ - MIntArray vertexList; - fnMesh.getPolygonVertices( polyId, vertexList ); - int vcount = vertexList.length(); - bool smoothEdgeFound = false; - - for ( int vid=0; vidpolyIds[1] ) { // Edge not a border - - // We are starting a new smoothing group - // - if ( newSmoothingGroup ) { - currSmoothingGroup = nextSmoothingGroup++; - newSmoothingGroup = false; - - // This is a SEED (starting) polygon and so we always - // give it the new smoothing group id. - // Even if all edges are hard this must be done so - // that we know we have visited the polygon. - // - polySmoothingGroups[polyId] = currSmoothingGroup; - } - - // If we have a smooth edge then this poly must be a member - // of the current smoothing group. - // - if ( elem->smooth ) { - polySmoothingGroups[polyId] = currSmoothingGroup; - smoothEdgeFound = true; - } - else { // Hard edge so ignore this polygon - continue; - } - - // Find the adjacent poly id - // - int adjPoly = elem->polyIds[0]; - if ( adjPoly == polyId ) { - adjPoly = elem->polyIds[1]; - } - - // If we are this far then adjacent poly belongs in this - // smoothing group. - // If the adjacent polygon's smoothing group is not - // NO_SMOOTHING_GROUP then it has already been visited - // so we ignore it. - // - if ( NO_SMOOTHING_GROUP == polySmoothingGroups[adjPoly] ) { - smoothingAlgorithm( adjPoly, fnMesh ); - } - else if ( polySmoothingGroups[adjPoly] != currSmoothingGroup ) { - Msg("! smoothing group problem at polygon %d",adjPoly); - } - } - } - } - return smoothEdgeFound; -} - -////////////////////////////////////////////////////////////// - -void CXRayObjectExport::addEdgeInfo( int v1, int v2, bool smooth ) -// -// Adds a new edge info element to the vertex table. -// -{ - SXREdgeInfoPtr element = NULL; - - if ( NULL == edgeTable[v1] ) { - edgeTable[v1] = xr_alloc(1);//(EdgeInfoPtr)malloc( sizeof(struct EdgeInfo) ); - element = edgeTable[v1]; - } - else { - element = edgeTable[v1]; - while ( NULL != element->next ) { - element = element->next; - } - element->next = xr_alloc(1);//(EdgeInfoPtr)malloc( sizeof(struct EdgeInfo) ); - element = element->next; - } - - // Setup data for new edge - // - element->vertId = v2; - element->smooth = smooth; - element->next = NULL; - - // Initialize array of id's of polygons that reference this edge. - // There are at most 2 polygons per edge. - // - element->polyIds[0] = INVALID_ID; - element->polyIds[1] = INVALID_ID; -} - -////////////////////////////////////////////////////////////// - -SXREdgeInfoPtr CXRayObjectExport::findEdgeInfo( int v1, int v2 ) -// -// Finds the info for the specified edge. -// -{ - SXREdgeInfoPtr element = NULL; - element = edgeTable[v1]; - - while ( NULL != element ) { - if ( v2 == element->vertId ) { - return element; - } - element = element->next; - } - - if ( element == NULL ) { - element = edgeTable[v2]; - - while ( NULL != element ) { - if ( v1 == element->vertId ) { - return element; - } - element = element->next; - } - } - - return NULL; -} - -////////////////////////////////////////////////////////////// - -void CXRayObjectExport::destroyEdgeTable() -// -// Free up all of the memory used by the edgeTable. -// -{ -//. if ( !smoothing ) return; - - SXREdgeInfoPtr element = NULL; - SXREdgeInfoPtr tmp = NULL; - - for ( int v=0; vnext; - xr_free( tmp ); - } - } - - if ( NULL != edgeTable ) { - xr_free( edgeTable ); - edgeTable = NULL; - } - - if ( NULL != polySmoothingGroups ) { - xr_free( polySmoothingGroups ); - polySmoothingGroups = NULL; - } -} -////////////////////////////////////////////////////////////// - -void CXRayObjectExport::recFindTransformDAGNodes( MString& nodeName, MIntArray& transformNodeIndicesArray ) -{ - // To handle Maya groups we traverse the hierarchy starting at - // each objectNames[i] going towards the root collecting transform - // nodes as we go. - MStringArray result; - MString cmdStr = "listRelatives -ap " + nodeName; - MGlobal::executeCommand( cmdStr, result ); - - if( result.length() == 0 ) - // nodeName must be at the root of the DAG. Stop recursing - return; - - for( unsigned int j=0; j 4) && !stricmp(name+nameLength-4, ".anm")) - return kCouldBeMyFileType; - else - return kNotMyFileType; -} - -MStatus CXRayCameraExport::ExportCamera(const MFileObject& file) -{ - MDagPath node; - MObject component; - MSelectionList list; - MFnDagNode nodeFn; - MFnCamera C; - MStatus st ; - - MGlobal::getActiveSelectionList( list ); - for ( u32 index = 0; index < list.length(); ++index ) - { - list.getDagPath ( index, node, component ); - nodeFn.setObject ( node ); - st = C.setObject (node); - if(st!=MStatus::kSuccess) - { - Msg ("Selected object is not a camera"); - return MStatus::kInvalidParameter; - } - - } - - Msg("exporting camera named [%s]", C.name().asChar()); - - MTime tmTemp,tmTemp2; - MTime tmQuant; - - // Remember the frame the scene was at so we can restore it later. - MTime storedFrame = MAnimControl::currentTime(); - MTime startFrame = MAnimControl::minTime(); - MTime endFrame = MAnimControl::maxTime(); - - tmTemp.setUnit (MTime::uiUnit()); - tmTemp2.setUnit (MTime::uiUnit()); - tmQuant.setUnit (MTime::uiUnit()); - tmQuant = 10.0; //3 time in sec. temporary - - COMotion M; - M.SetParam (0, (int)(endFrame-startFrame).as(MTime::uiUnit()), 30); - - Fvector P,R; - tmTemp = startFrame; - - MObject cam_parent = C.parent(0); - MFnTransform parentTransform(cam_parent); - - - MDistance dist; - while(tmTemp <= endFrame) - { - MAnimControl::setCurrentTime( tmTemp ); - - MMatrix parentMatrix = parentTransform.transformation().asMatrix(); - MMatrix cv; - cv.setToIdentity (); - cv[2][2] = -1.0; - MMatrix TM; - TM = (cv*parentMatrix)*cv; - TM = cv*TM; - parentMatrix = TM; - - Msg ("frame[%d]",(int)tmTemp.as(MTime::uiUnit())); - - dist.setValue (parentMatrix[3][0]); - P.x = (float)dist.asMeters(); - dist.setValue (parentMatrix[3][1]); - P.y = (float)dist.asMeters(); - dist.setValue (parentMatrix[3][2]); - P.z = (float)dist.asMeters(); - - Msg ("P %3.3f,%3.3f,%3.3f",P.x,P.y,P.z); - - double rot[3]; - MTransformationMatrix::RotationOrder rot_order = MTransformationMatrix::kXYZ; - - st = parentTransform.getRotation( rot, rot_order ); - - R.x = -(float)rot[0]; - R.y = -(float)rot[1]; - R.z = -(float)rot[2]; -//. Msg ("rt %3.3f,%3.3f,%3.3f kWorld",R.x,R.y,R.z); - - tmTemp2 = tmTemp-startFrame; - M.CreateKey (float(tmTemp2.as(MTime::uiUnit()))/30.0f,P,R); - - if(tmTemp==endFrame) - break; - - tmTemp += tmQuant; - - if(tmTemp>endFrame) - tmTemp=endFrame; - }; - - - MString fn_save_to = file.fullName(); - fn_save_to += ".anm"; - - Msg("file full name [%s]", fn_save_to); - M.SaveMotion (fn_save_to.asChar()); - - MAnimControl::setCurrentTime( storedFrame ); - - return MS::kSuccess; -} diff --git a/cs/engine/plugins/Maya/Export/maTranslator.h b/cs/engine/plugins/Maya/Export/maTranslator.h deleted file mode 100644 index 7195f21df..000000000 --- a/cs/engine/plugins/Maya/Export/maTranslator.h +++ /dev/null @@ -1,120 +0,0 @@ -#ifndef maTranslatorH -#define maTranslatorH - -#include "ExportDefines.H" -// refs -class CEditableObject; - -class CXRayObjectExport: public MPxFileTranslator { -public: - CXRayObjectExport () {}; - virtual ~CXRayObjectExport () {}; - static void* creator (); - - MStatus reader (const MFileObject& file, const MString& optionsString, FileAccessMode mode); - - MStatus writer (const MFileObject& file, const MString& optionsString, FileAccessMode mode); - bool haveReadMethod () const; - bool haveWriteMethod () const; - //virtual MString defaultExtension () const; - virtual MString filter () const; - MFileKind identifyFile (const MFileObject& fileName, const char* buffer, short size) const; -private: - LPCSTR getMaterialName (MDagPath & mdagPath, int cid, int objectIdx); - MStatus ExportPart (CEditableObject* O, MDagPath&, MObject& ); - MStatus set_smoth_flags ( u32 &flags, const MIntArray& tri_vert_indeces );//const MFnMesh &fnMesh, const MItMeshPolygon &meshPoly, - MStatus ExportSelected (CEditableObject* O); - MStatus ExportAll (CEditableObject* O); - - bool initializeSetsAndLookupTables( bool exportAll); - void freeLookupTables (); - bool lookup (MDagPath&, int, int); - void recFindTransformDAGNodes(MString&, MIntArray&); - - // Edge lookup methods - // - void buildEdgeTable (MDagPath&); - void addEdgeInfo (int, int, bool); - -public: - SXREdgeInfoPtr findEdgeInfo (int, int); - -private: - void destroyEdgeTable (); - // smoothing groups - bool smoothingAlgorithm (int, MFnMesh&); - void CreateSmoothingGroups ( MFnMesh& ); - void CreateSMGFacegroups ( MFnMesh& ); - void CreateSMGEdgeAttrs ( MFnMesh& ); -private: - // Keeps track of all sets. - // - int numSets; - MObjectArray *sets; - - // Keeps track of all objects and components. - // The Tables are used to mark which sets each - // component belongs to. - // - MStringArray *objectNames; - - bool **polygonTablePtr; - bool **vertexTablePtr; - bool * polygonTable; - bool * vertexTable; - bool **objectGroupsTablePtr; - - - // Used to determine if the last set(s) written out are the same - // as the current sets to be written. We don't need to write out - // sets unless they change between components. Same goes for - // materials. - // - MIntArray *lastSets; - MIntArray *lastMaterials; - - // We have to do 2 dag iterations so keep track of the - // objects found in the first iteration by this index. - // - int objectId; - int objectCount; - - // Edge lookup table (by vertex id) and smoothing group info - // - SXREdgeInfoPtr* edgeTable; - int * polySmoothingGroups; - int edgeTableSize; - int nextSmoothingGroup; - int currSmoothingGroup; - bool newSmoothingGroup; - - // List of names of the mesh shapes that we export from maya - MStringArray objectNodeNamesArray; - - // Used to keep track of Maya groups (transform DAG nodes) that - // contain objects being exported - MStringArray transformNodeNameArray; -}; - - -class CXRayCameraExport: public MPxFileTranslator -{ -public: - CXRayCameraExport () {}; - virtual ~CXRayCameraExport () {}; - static void* creator (); - - MStatus reader (const MFileObject& file, const MString& optionsString, FileAccessMode mode); - MStatus writer (const MFileObject& file, const MString& optionsString, FileAccessMode mode); - - bool haveReadMethod () const; - bool haveWriteMethod () const; - - virtual MString filter () const; - MFileKind identifyFile (const MFileObject& fileName, const char* buffer, short size) const; -private: - - MStatus ExportCamera (const MFileObject& file); - -}; -#endif //maTranslatorH \ No newline at end of file diff --git a/cs/engine/plugins/Maya/Export/smoth_flags.h b/cs/engine/plugins/Maya/Export/smoth_flags.h deleted file mode 100644 index 55351d4f5..000000000 --- a/cs/engine/plugins/Maya/Export/smoth_flags.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef _SMOTH_FLAGS_H_ -#define _SMOTH_FLAGS_H_ - -IC void set_face_adge_hard ( u32 &flags, u16 edge_idx ) -{ - VERIFY( edge_idx<3 ); - flags |= ( 1<< (4-edge_idx)%3 ); -} - -template< typename export_class > -MStatus t_set_smoth_flags( export_class& export_obj, u32 &flags, const MIntArray& tri_vert_indeces ) -{ - if( tri_vert_indeces.length()!=3 ) - { - Msg("XRAY Plagin ERROR"); - return MS::kFailure; - } - flags = u32(0); - for( u16 i = 0; 3 > i; ++i ) - { - int a = tri_vert_indeces[ i ]; - int b = tri_vert_indeces[ (i+1)%3 ]; - SXREdgeInfoPtr elem = export_obj.findEdgeInfo( a, b ); - - if( elem && !elem->smooth ) - set_face_adge_hard( flags, i ); - } - - return MS::kSuccess; -} - -#endif \ No newline at end of file diff --git a/cs/engine/plugins/Maya/Export/stdafx.cpp b/cs/engine/plugins/Maya/Export/stdafx.cpp deleted file mode 100644 index 47ba18575..000000000 --- a/cs/engine/plugins/Maya/Export/stdafx.cpp +++ /dev/null @@ -1,3 +0,0 @@ -#include "stdafx.h" -#pragma hdrstop - diff --git a/cs/engine/plugins/Maya/Export/xrayObjectExportOptions.mel b/cs/engine/plugins/Maya/Export/xrayObjectExportOptions.mel deleted file mode 100644 index 3fc48c775..000000000 --- a/cs/engine/plugins/Maya/Export/xrayObjectExportOptions.mel +++ /dev/null @@ -1,55 +0,0 @@ -global proc int xrayObjectExportOptions ( string $parent, - string $action, - string $initialSettings, - string $resultCallback ) -{ - int $bResult; - string $currentOptions; - string $optionList[]; - string $optionBreakDown[]; - int $index; - - if ($action == "post") { - setParent $parent; - - setUITemplate -pushTemplate DefaultTemplate; - - formLayout -e -vis false optionsBoxForm; - - frameLayout - -cll true - -cl false - -bv true - -bs "etchedIn" - -l "About" - xrayAboutFrame; - - columnLayout -adj true; - - text -al "left" -l "Maya -> X-Ray Object Exporter ver. 1.0"; - - // Now set to current settings. - $currentOptions = $initialSettings; - if (size($currentOptions) > 0) { - tokenize($currentOptions, ";", $optionList); - for ($index = 0; $index < size($optionList); $index++) { - tokenize($optionList[$index], "=", $optionBreakDown); - - } - } - $result = 1; - - formLayout -e -vis true optionsBoxForm; - - setUITemplate -popTemplate; - - } else if ($action == "query") { - - eval($resultCallback+" \""+$currentOptions+"\""); - $result = 1; - } else { - $bResult = 0; - } - - return $bResult; -} diff --git a/cs/engine/plugins/Maya/Export/xraySkinExportOptions.mel b/cs/engine/plugins/Maya/Export/xraySkinExportOptions.mel deleted file mode 100644 index 1c6515e76..000000000 --- a/cs/engine/plugins/Maya/Export/xraySkinExportOptions.mel +++ /dev/null @@ -1,102 +0,0 @@ -global proc int xraySkinExportOptions( string $parent, - string $action, - string $initialSettings, - string $resultCallback ) -{ - int $bResult; - string $currentOptions; - string $optionList[]; - string $optionBreakDown[]; - int $index; - - if ($action == "post") { - setParent $parent; - - setUITemplate -pushTemplate DefaultTemplate; - - formLayout -e -vis false optionsBoxForm; - - columnLayout -adj true objTypeCol; - - frameLayout - -cll true - -cl false - -bv true - -bs "etchedIn" - -l "Export Options" - xrayExportFrame; - - columnLayout -adj true xrayExpOptions; - - rowLayout -nc 2 -cw2 210 200 -rat 1 "top" 0 -cal 1 "left"; - text -al "left" -l "Select skin cluster to export:"; - textScrollList -nr 5 -ams false xrayClusterList; - string $clusters[] = `ls -typ skinCluster`; - int $i; - for ($i = 0; $i < `size($clusters)`; $i++) - { - textScrollList -e -append $clusters[$i] xrayClusterList; - } - setParent ..; - setParent ..; - setParent ..; - - frameLayout - -cll true - -cl false - -bv true - -bs "etchedIn" - -l "About" - xrayAboutFrame; - - columnLayout -adj true; - - text -al "left" -l "Maya -> X-Ray Skin Exporter ver. 1.0"; - - // Now set to current settings. - $currentOptions = $initialSettings; - if (size($currentOptions) > 0) { - tokenize($currentOptions, ";", $optionList); - for ($index = 0; $index < size($optionList); $index++) { - tokenize($optionList[$index], "=", $optionBreakDown); - - // Frame settings - - if ( $optionBreakDown[0] == "exportFrame") { - $intVal = $optionBreakDown[1]; - if ( $intVal == 1 ) { - frameLayout -e -cl true xrayExportFrame; - } else { - frameLayout -e -cl false xrayExportFrame; - } - } - - if ($optionBreakDown[0] == "SkinCluster") { - if (`size($optionBreakDown)` > 1) { - textScrollList -e -si $optionBreakDown[1] xrayClusterList; - } - } - } - } - $result = 1; - - formLayout -e -vis true optionsBoxForm; - - setUITemplate -popTemplate; - - } else if ($action == "query") { - - $intVal = `frameLayout -q -cl xrayExportFrame`; - $currentOptions = $currentOptions + "exportFrame=" + $intVal + ";"; - - string $listSelection[] = `textScrollList -q -si xrayClusterList`; - $currentOptions = $currentOptions + ";SkinCluster=" + $listSelection[0]; - - eval($resultCallback+" \""+$currentOptions+"\""); - $result = 1; - } else { - $bResult = 0; - } - - return $bResult; -} diff --git a/cs/engine/plugins/Maya/Export/xraySkinMotionExportOptions.mel b/cs/engine/plugins/Maya/Export/xraySkinMotionExportOptions.mel deleted file mode 100644 index 0c30a5f4d..000000000 --- a/cs/engine/plugins/Maya/Export/xraySkinMotionExportOptions.mel +++ /dev/null @@ -1,102 +0,0 @@ -global proc int xraySkinMotionExportOptions( string $parent, - string $action, - string $initialSettings, - string $resultCallback ) -{ - int $bResult; - string $currentOptions; - string $optionList[]; - string $optionBreakDown[]; - int $index; - - if ($action == "post") { - setParent $parent; - - setUITemplate -pushTemplate DefaultTemplate; - - formLayout -e -vis false optionsBoxForm; - - columnLayout -adj true objTypeCol; - - frameLayout - -cll true - -cl false - -bv true - -bs "etchedIn" - -l "Export Options" - xrayExportFrame; - - columnLayout -adj true xrayExpOptions; - - rowLayout -nc 2 -cw2 210 200 -rat 1 "top" 0 -cal 1 "left"; - text -al "left" -l "Select skin cluster to export:"; - textScrollList -nr 5 -ams false xrayClusterList; - string $clusters[] = `ls -typ skinCluster`; - int $i; - for ($i = 0; $i < `size($clusters)`; $i++) - { - textScrollList -e -append $clusters[$i] xrayClusterList; - } - setParent ..; - setParent ..; - setParent ..; - - frameLayout - -cll true - -cl false - -bv true - -bs "etchedIn" - -l "About" - xrayAboutFrame; - - columnLayout -adj true; - - text -al "left" -l "Maya -> X-Ray Skin Motion Exporter ver. 1.0"; - - // Now set to current settings. - $currentOptions = $initialSettings; - if (size($currentOptions) > 0) { - tokenize($currentOptions, ";", $optionList); - for ($index = 0; $index < size($optionList); $index++) { - tokenize($optionList[$index], "=", $optionBreakDown); - - // Frame settings - - if ( $optionBreakDown[0] == "exportFrame") { - $intVal = $optionBreakDown[1]; - if ( $intVal == 1 ) { - frameLayout -e -cl true xrayExportFrame; - } else { - frameLayout -e -cl false xrayExportFrame; - } - } - - if ($optionBreakDown[0] == "SkinCluster") { - if (`size($optionBreakDown)` > 1) { - textScrollList -e -si $optionBreakDown[1] xrayClusterList; - } - } - } - } - $result = 1; - - formLayout -e -vis true optionsBoxForm; - - setUITemplate -popTemplate; - - } else if ($action == "query") { - - $intVal = `frameLayout -q -cl xrayExportFrame`; - $currentOptions = $currentOptions + "exportFrame=" + $intVal + ";"; - - string $listSelection[] = `textScrollList -q -si xrayClusterList`; - $currentOptions = $currentOptions + ";SkinCluster=" + $listSelection[0]; - - eval($resultCallback+" \""+$currentOptions+"\""); - $result = 1; - } else { - $bResult = 0; - } - - return $bResult; -} diff --git a/cs/engine/plugins/Maya/Material/AEXRayMtlTemplate.mel b/cs/engine/plugins/Maya/Material/AEXRayMtlTemplate.mel deleted file mode 100644 index 2ef0f67e9..000000000 --- a/cs/engine/plugins/Maya/Material/AEXRayMtlTemplate.mel +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (C) 1997-2002 Alias|Wavefront, -// a division of Silicon Graphics Limited. -// -// The information in this file is provided for the exclusive use of the -// licensees of Alias|Wavefront. Such users have the right to use, modify, -// and incorporate this code into other products for purposes authorized -// by the Alias|Wavefront license agreement, without fee. -// -// ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -// INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO -// EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR -// CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, -// DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -// TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -// PERFORMANCE OF THIS SOFTWARE. -// -// -// Alias|Wavefront Script File -// -// Creation Date: May 16, 1997 -// Author: sw -// -// Procedure Name: -// AEphongTemplate -// -// Description Name; -// Creates the attribute editor controls for the phong Node -// -// Input Value: -// nodeName -// -// Output Value: -// None -// - - -global proc AEXRayMtlTemplate ( string $nodeName ) -{ - AEswatchDisplay $nodeName; - editorTemplate -beginScrollLayout; - - editorTemplate -callCustom AEshaderTypeNew AEshaderTypeReplace "message"; - - editorTemplate -beginLayout "Common Material Attributes" -collapse 0; - editorTemplate -addControl "color"; - editorTemplate -addControl "transparency"; - editorTemplate -endLayout; - - editorTemplate -addExtraControls; - - editorTemplate -beginLayout "Hardware Texturing" -collapse true; - AEhardwareTextureTemplate $nodeName - ("color transparency"); - editorTemplate -endLayout; - - editorTemplate -beginLayout "XRay Params"; - editorTemplate -addControl "xrayDoubleSide"; - editorTemplate -addControl "xrayEngineShader"; - editorTemplate -addControl "xrayCompilerShader"; - editorTemplate -addControl "xrayGameMaterial"; - editorTemplate -endLayout; - - editorTemplate -endScrollLayout; -} diff --git a/cs/engine/plugins/Maya/Material/AElambertShaderTemplate.mel b/cs/engine/plugins/Maya/Material/AElambertShaderTemplate.mel deleted file mode 100644 index 42fe816b1..000000000 --- a/cs/engine/plugins/Maya/Material/AElambertShaderTemplate.mel +++ /dev/null @@ -1,30 +0,0 @@ -global proc AEXRayMtlTemplate ( string $nodeName ) -{ - AEswatchDisplay $nodeName; - editorTemplate -beginScrollLayout; - - editorTemplate -beginLayout "Common Material Attributes" -collapse 0; - editorTemplate -addControl "color"; - editorTemplate -addControl "transparency"; - editorTemplate -addControl "incandescence"; - editorTemplate -addControl "diffuseReflectivity"; - editorTemplate -addControl "translucenceCoeff"; - editorTemplate -endLayout; - - // include/call base class/node attributes - AEdependNodeTemplate $nodeName; - - editorTemplate -beginLayout "Hardware Texturing" -collapse true; - AEhardwareTextureTemplate $nodeName - ("color transparency incandescence"); - editorTemplate -endLayout; - - editorTemplate -beginLayout "XRay Params"; - editorTemplate -addControl "xrayDoubleSide"; - editorTemplate -addControl "xrayEngineShader"; - editorTemplate -addControl "xrayCompilerShader"; - editorTemplate -addControl "xrayGameMaterial"; - editorTemplate -endLayout; - - editorTemplate -endScrollLayout; -} diff --git a/cs/engine/plugins/Maya/Material/MNormalMapConverter.cpp b/cs/engine/plugins/Maya/Material/MNormalMapConverter.cpp deleted file mode 100644 index 3cf42d567..000000000 --- a/cs/engine/plugins/Maya/Material/MNormalMapConverter.cpp +++ /dev/null @@ -1,147 +0,0 @@ -/////////////////////////////////////////////////////////////////// -// DESCRIPTION: -// Some utilities to do file format conversions and others ... -// -/////////////////////////////////////////////////////////////////// -#include "stdafx.h" - -#include "MNormalMapConverter.h" - - -// Convert the heightfield texture to its corresponding normal map texture -// -bool MNormalMapConverter::convertToNormalMap( - unsigned char* inImagePtr, - unsigned int width, - unsigned int height, - OutFormatType outputPixelFormat, - float bumpScale, - unsigned char* outImagePtr ) -{ - bool isOK = true; - - // Firewall: The input image should not be a NULL pointer, - // - if( NULL == inImagePtr ) return false; - - // No output file specified: convert in place - // - if( NULL == outImagePtr ) - { - convertToNormalMap_InPlace( inImagePtr, width, height, outputPixelFormat, bumpScale ); - } - else - { - if( outputPixelFormat == RGBA ) { - // - // Not implemented yet - // - // similar to the convertToNormalMap_InPlace but we store - // the resulting texture in the outImagePtr and not - // in the inImagePtr texture - // - } - else if( outputPixelFormat == HILO ) { - // Not implemented yet - } - else { - isOK = false; - } - } - - return isOK; -} - - -// The heightfield texture inImage will be replaced from grey levels in RGBA -// to the normal map values as specified by the pixel format -// -bool MNormalMapConverter::convertToNormalMap_InPlace( - unsigned char* inImagePtr, - unsigned int width, - unsigned int height, - OutFormatType outputPixelFormat, - float bumpScale ) -{ - bool isOK = true; - - if( outputPixelFormat == RGBA ) { - - bumpScale /= 255.0f; // will be used on unsignedChar - - unsigned int widthMinus1 = width - 1; - unsigned int heightMinus1 = height - 1; - unsigned int offset = (4 * width); // = sizeof(rgba) * width - - // ================== - // Process the texels - // ================== - - // Get the current pointer to the starting texel at (0,0) - // - unsigned char* imagePtr = inImagePtr; - - // For each rows (except the last one) - // - unsigned int m, n; - for( m=0; m(m_numLevels); - for (i=0; i < m_numLevels; i++) - { - m_levels[i] = xr_alloc(width(i) * height(i) * 4); - } - - // Copy the base level. (the actual file texture) - Memory.mem_copy(m_levels[0], image.pixels(), m_width * m_height * 4); - - // Create the mipmapped levels. - // NOTE REGARDING THE width_ratio and height_ratio: - // The smallest mipmap levels of non-square textures must be handled - // carefully. Say we have a 8x2 texture. Mipmap levels will be - // 4x1, 2x1, 1x1. We cannot simply multiply the current st coordinate by - // 2 like we do for square textures to find the source st coordinates, - // or we'll end up fetching outside of the source level. Instead, we - // multiply the target s, t coordinates by the width and height ratio respectively. - for (unsigned int current_level = 1; current_level < m_numLevels; current_level++) - { - unsigned int width_ratio = width(i-1) / width(i); - unsigned int height_ratio = height(i-1) / height(i-1); - unsigned int previous_level = current_level - 1; - - for (unsigned int target_t = 0; target_t < height(current_level); target_t++) - { - for (unsigned int target_s = 0; target_s < width(current_level); target_s++) - { - // The st coordinates from the source level. - unsigned int source_s = target_s * width_ratio; - unsigned int source_t = target_t * height_ratio; - unsigned int source_s2 = source_s + ((width_ratio == 2) ? 1 : 0); - unsigned int source_t2 = source_t + ((height_ratio == 2) ? 1 : 0); - - unsigned char *destination = internalFetch(target_s, target_t, current_level); - unsigned char *source1 = internalFetch(source_s, source_t, previous_level); - unsigned char *source2 = internalFetch(source_s2, source_t, previous_level); - unsigned char *source3 = internalFetch(source_s, source_t2, previous_level); - unsigned char *source4 = internalFetch(source_s2, source_t2, previous_level); - - // Average byte per byte. - unsigned int average1 = (*source1++ + *source2++ + *source3++ + *source4++) / 4; - *destination++ = average1; - - unsigned int average2 = (*source1++ + *source2++ + *source3++ + *source4++) / 4; - *destination++ = average2; - - unsigned int average3 = (*source1++ + *source2++ + *source3++ + *source4++) / 4; - *destination++ = average3; - - unsigned int average4 = (*source1++ + *source2++ + *source3++ + *source4++) / 4; - *destination++ = average4; - } - } - } - - if( type == NMAP ) - { - // Convert each level to the NORMAL map format - // - MNormalMapConverter mapConverter; - - for (unsigned int i = 0; i < m_numLevels; i++) - { - mapConverter.convertToNormalMap( m_levels[i], width(i), height(i), MNormalMapConverter::RGBA, 2.0f ); - } - } - - specify(target); - - return true; -} - -bool MTexture::specify(GLenum target /* = GL_TEXTURE_2D */) -{ - assert(glGetError() == GL_NO_ERROR); - - m_texObj.bind(); - - assert(glGetError() == GL_NO_ERROR); - - for (unsigned int i=0; i < m_numLevels; i++) - { - glTexImage2D(target, i, m_internalFormat, width(i), height(i), 0, - m_format, m_componentFormat, m_levels[i]); - - assert(glGetError() == GL_NO_ERROR); - } - - if (mipmapped()) - { - // Mipmapping enabled - m_texObj.parameter(GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); - assert(glGetError() == GL_NO_ERROR); - - m_texObj.parameter(GL_TEXTURE_MAG_FILTER, GL_LINEAR); - assert(glGetError() == GL_NO_ERROR); - } - else - { - m_texObj.parameter(GL_TEXTURE_MIN_FILTER, GL_LINEAR); - m_texObj.parameter(GL_TEXTURE_MAG_FILTER, GL_LINEAR); - } - - m_texObj.parameter(GL_TEXTURE_WRAP_S, GL_CLAMP); - m_texObj.parameter(GL_TEXTURE_WRAP_T, GL_CLAMP); - - return true; -} - -bool MTexture::bind() -{ - m_texObj.bind(); - //specify(GL_TEXTURE_2D); - - return true; -} - - -int highestPowerOf2(int num) -{ - int power = 0; - - while (num > 1) - { - power++; - num = num >> 1; - } - - return power; -} - - diff --git a/cs/engine/plugins/Maya/Material/MTexture.h b/cs/engine/plugins/Maya/Material/MTexture.h deleted file mode 100644 index 15d8bd731..000000000 --- a/cs/engine/plugins/Maya/Material/MTexture.h +++ /dev/null @@ -1,199 +0,0 @@ -#ifndef MAYA_API_MTexture -#define MAYA_API_MTexture - -/////////////////////////////////////////////////////////////////// -// DESCRIPTION: Texture object, that can be mipmapped. Eventually, this -// class will likely end up in the Maya API. -// -// AUTHOR: Christian Laforte -// -/////////////////////////////////////////////////////////////////// - -#include -#include -#include - -#include -#include - -int highestPowerOf2(int num); - -class TexObj -{ -public: - TexObj(GLenum target = GL_TEXTURE_2D) - { - assert(glGetError() == GL_NO_ERROR); - - // Get a texture identifier. - glGenTextures(1, &fTextureNum); - assert(glGetError() == GL_NO_ERROR); - - fTarget = target; - - // Set up default values for the texture parameters. - // They are the same as the OpenGL default. - fMinFilterParam = GL_NEAREST; - fMagFilterParam = GL_LINEAR; - fWrapSParam = GL_REPEAT; - fWrapTParam = GL_REPEAT; - } - - ~TexObj() - { - glDeleteTextures(1, &fTextureNum); - } - - void bind() - { - assert(glGetError() == GL_NO_ERROR); - - // Bind the texture. - glBindTexture(fTarget, fTextureNum); - assert(glGetError() == GL_NO_ERROR); - - // Set up the texture parameters. - glTexParameteri(fTarget, GL_TEXTURE_MIN_FILTER, fMinFilterParam); - assert(glGetError() == GL_NO_ERROR); - glTexParameteri(fTarget, GL_TEXTURE_MAG_FILTER, fMagFilterParam); - assert(glGetError() == GL_NO_ERROR); - glTexParameteri(fTarget, GL_TEXTURE_WRAP_S, fWrapSParam); - assert(glGetError() == GL_NO_ERROR); - glTexParameteri(fTarget, GL_TEXTURE_WRAP_T, fWrapTParam); - assert(glGetError() == GL_NO_ERROR); - } - - void parameter(GLenum pname, GLint param) - { - switch (pname) - { - case GL_TEXTURE_MIN_FILTER: fMinFilterParam = param; break; - case GL_TEXTURE_MAG_FILTER: fMagFilterParam = param; break; - case GL_TEXTURE_WRAP_S: fWrapSParam = param; break; - case GL_TEXTURE_WRAP_T: fWrapTParam = param; break; - } - } - -private: - GLenum fTarget; - - // Various parameters. See glTexParameterf() in MSDN for more info. - GLint fMinFilterParam; - GLint fMagFilterParam; - GLint fWrapSParam; - GLint fWrapTParam; - - GLuint fTextureNum; -}; - -class MTexture -{ -public: - enum Type - { - RGBA, - HILO, - NMAP - }; - - MTexture(); - - ~MTexture() - { - if (m_levels) - { - for (unsigned int i=0; i < m_numLevels; i++) - { - if (m_levels[i]) - { - xr_free(m_levels[i]); - } - } - - xr_free(m_levels); - } - } - - bool set(MImage &image, Type type, bool mipmapped = true, GLenum target = GL_TEXTURE_2D); - - // This function assumes that the file texture is square, and - // that its dimensions are exponents of 2. - bool load(MString filename, Type type, bool mipmapped = true, GLenum target = GL_TEXTURE_2D); - - bool specify(GLenum target); - - // Returns 1 if no mipmapping, >1 otherwise. - unsigned int levels() { return m_numLevels; } - - bool bind(); - - unsigned char* fetch(unsigned int s, unsigned int t, unsigned int level = 0) - { - // Verify that the mipmap level exists. - if (level > m_numLevels || m_levels == NULL || m_levels[level] == NULL) - return NULL; - - return internalFetch(s, t, level); - } - - inline bool square() - { - return m_width == m_height; - } - - inline bool mipmapped() - { - return levels() > 1; - } - - // Return the width of a specific mipmap level. - // If level == 0, return the width of the base level (source image). - // Width is always >= 1, to prevent non-square textures from having zero-sized levels. - inline unsigned int width(unsigned int level = 0) - { - unsigned int w = m_width >> level; - if (w > 0) - return w; - else - return 1; - } - - inline unsigned int height(unsigned int level = 0) - { - unsigned int h = m_height >> level; - if (h > 0) - return h; - else - return 1; - } - -protected: - - inline unsigned char* internalFetch(unsigned int s, unsigned int t, unsigned int level) - { - assert((s >= 0) && (s < width(level))); - assert((t >= 0) && (t < height(level))); - return m_levels[level] + 4 * ((width(level) * t) + s); - } - - -private: - - // Fairly permanent variables - unsigned int m_width, m_height; - Type m_type; - TexObj m_texObj; - bool m_mipmapped; - - // Pyramid levels (assumes 4 bytes per pixel for now) - unsigned char **m_levels; - unsigned int m_numLevels; // Number of mipmaps + base texture - - // Cached variables (Depend on previous private variables) - GLint m_internalFormat; - GLenum m_format; - GLenum m_componentFormat; -}; - - -#endif // MAYA_API_MTexture diff --git a/cs/engine/plugins/Maya/Material/MTextureCache.cpp b/cs/engine/plugins/Maya/Material/MTextureCache.cpp deleted file mode 100644 index 830a0b0ca..000000000 --- a/cs/engine/plugins/Maya/Material/MTextureCache.cpp +++ /dev/null @@ -1,152 +0,0 @@ -/////////////////////////////////////////////////////////////////// -// DESCRIPTION: Texture cache, used to temporarily store textures. -// Eventually, we'll likely expose the actual Maya -// texture cache to plug-ins to improve memory utilization -// and performance. -// -// PS: Thanks to sbrew@lucasarts.com for contributing several fixes -// to this class! ;-) -// -/////////////////////////////////////////////////////////////////// -#include "stdafx.h" - -#include "MTextureCache.h" -#include "NodeMonitor.h" - -// Initialize the singleton instance, and the refcount is originally 0. -MTextureCache* MTextureCache::m_instance = NULL; -/*static*/ int MTextureCache::refcount = 0; - -MTextureCacheElement::~MTextureCacheElement() -{ - if (m_texture) - { - xr_delete(m_texture); - m_texture = NULL; - } -} - - -MTextureCache::~MTextureCache() -{ - if (m_textureTable.empty()) - return; - - // Delete all texture cache elements. - // - string_to_cacheElement_map::iterator p = m_textureTable.begin(); - for ( ; p != m_textureTable.end(); ++p) - { - xr_delete(p->second); - } -} - -// Return a reference to the texture. Need to dereference by calling "release". -MTexture* MTextureCache::texture(MObject textureObj, - MTexture::Type type /* = MTexture::RGBA */, - bool mipmapped /* = true */, - GLenum target /* = GL_TEXTURE_2D */) -{ - // Get the name of the texture object. - MString textureName = getNameFromObj(textureObj); - - // If this isn't a file texture node, or if it has no valid name, - // return NULL. - if (!textureObj.hasFn(MFn::kFileTexture) || - textureName == "") - return NULL; - - // Check if we already have a texCacheElement assigned to the given texture name. - MTextureCacheElement *texCacheElement = - m_textureTable[textureName.asChar()]; - bool newTexture = !texCacheElement; - bool textureDirty = texCacheElement && texCacheElement->fMonitor.dirty(); - - if (textureDirty) - { - texCacheElement->fMonitor.stopWatching(); - xr_delete(texCacheElement->m_texture); - texCacheElement->m_texture = NULL; - } - - if (newTexture) - { - texCacheElement = xr_new(); - - texCacheElement->fMonitor.setManager(this); - - // Add it to the map. - m_textureTable[textureName.asChar()] = texCacheElement; - } - - if (textureDirty || newTexture) - { - // Get the filename of the file texture node. - MString textureFilename; - MFnDependencyNode textureNode(textureObj); - MPlug filenamePlug( textureObj, - textureNode.attribute(MString("fileTextureName")) ); - filenamePlug.getValue(textureFilename); - - // Create the MTexture - texCacheElement->m_texture = xr_new(); - - // Monitor the given texture node for "dirty" or "rename" messages. - texCacheElement->fMonitor.watch(textureObj); - - // Attempt to load the texture from disk and bind it in the OpenGL driver. - if (texCacheElement->m_texture->load(textureFilename, - type, mipmapped, target) == false) - { - // An error occured. Most likely, it was impossible to - // open the given filename. - // Clean up and return NULL. - xr_delete(texCacheElement); - texCacheElement = NULL; - m_textureTable.erase(textureName.asChar()); - return NULL; - } - } - - // Update the last updated timestamp. - texCacheElement->lastAccessedTimestamp = m_currentTimestamp; - - return texCacheElement->texture(); -} - -// Returns true if the texture was found and bound; -// returns false otherwise. -bool MTextureCache::bind(MObject textureObj, - MTexture::Type type /* = MTexture::RGBA */, - bool mipmapped /* = true */, - GLenum target /* = GL_TEXTURE_2D */) -{ - // Get a reference to the texture, allocating it if necessary. - MTexture* pTex = texture(textureObj, type, mipmapped, target); - - if (pTex) - { - // bind the texture. - pTex->bind(); - - return true; - } - - return false; -} - -void MTextureCache::onNodeRenamed(MObject& node, MString oldName, MString newName) -{ - // Remove the texture from the cache. - MTextureCacheElement *texCacheElement = m_textureTable[oldName.asChar()]; - xr_delete(texCacheElement->m_texture); - texCacheElement->m_texture = NULL; -} - -void MTextureCache::incrementTimestamp(unsigned int increment /* = 1 */) -{ - m_currentTimestamp += increment; - - // Optionally, go through all textures and get rid of each of them that - // is too old. -} diff --git a/cs/engine/plugins/Maya/Material/MTextureCache.h b/cs/engine/plugins/Maya/Material/MTextureCache.h deleted file mode 100644 index 91f43be19..000000000 --- a/cs/engine/plugins/Maya/Material/MTextureCache.h +++ /dev/null @@ -1,128 +0,0 @@ -#ifndef MAYA_API_MTextureCache -#define MAYA_API_MTextureCache - - -/////////////////////////////////////////////////////////////////// -// DESCRIPTION: Texture cache, used to temporarily store textures. -// Eventually, this class will likely end up in the -// Maya API. -// -// This class is not currently thread-safe. -// -// AUTHOR: Christian Laforte -// -/////////////////////////////////////////////////////////////////// - -#ifdef WIN32 -#pragma warning( disable : 4786 ) // Disable stupid STL warnings. -#endif - -#include -#include -#include -#include - -#include "MTexture.h" -#include "NodeMonitor.h" - - -class MTextureCache; - -class MTextureCacheElement -{ -friend class MTextureCache; - -public: - MTextureCacheElement() - { - lastAccessedTimestamp = -1; - m_texture = NULL; - } - - ~MTextureCacheElement(); - - MTexture* texture() { return m_texture; } - -private: - MTexture* m_texture; - unsigned int lastAccessedTimestamp; // can be used to track when the texture was last used. - NodeMonitor fMonitor; -}; - -// This class implements a singleton node with reference counting. -// The refcount starts with a value equal to 0. Everytime instance() -// gets called, the refcount is incremented by one. Everytime -// release() gets called, the refcount is decremented by one, -// and if following that the refcount value is 0, the texture cache -// singleton is destroyed. -class MTextureCache : public NodeMonitorManager -{ -protected: -// MTextureCache() -// { -// m_currentTimestamp = 0; -// } - -public: - MTextureCache() - { - m_currentTimestamp = 0; - } - ~MTextureCache(); - - static MTextureCache* instance() - { - if (!m_instance) - { - m_instance = xr_new(); - } - - refcount++; - - return m_instance; - } - - static void release() - { - assert(m_instance); - - refcount--; - - if (refcount == 0 && m_instance) - { - xr_delete(m_instance); - m_instance = NULL; - } - } - - // Return a reference to the texture. There's no reference counting yet. - MTexture* texture(MObject textureObj, - MTexture::Type type = MTexture::RGBA, - bool mipmapped = true, - GLenum target = GL_TEXTURE_2D); - - // Returns true if the texture was found and bound; returns false otherwise. - bool bind(MObject textureObj, - MTexture::Type type = MTexture::RGBA, - bool mipmapped = true, - GLenum target = GL_TEXTURE_2D); - - void incrementTimestamp(unsigned int increment=1); - - // Called by a node monitor when the watched node is renamed. - void onNodeRenamed(MObject& node, MString oldName, MString newName); - -private: - static int refcount; - - xr_map m_textureTable; - typedef xr_map string_to_cacheElement_map; - - unsigned int m_currentTimestamp; - - static MTextureCache* m_instance; -}; - - - -#endif // MAYA_API_MTextureCache \ No newline at end of file diff --git a/cs/engine/plugins/Maya/Material/NodeMonitor.cpp b/cs/engine/plugins/Maya/Material/NodeMonitor.cpp deleted file mode 100644 index 718b4a29a..000000000 --- a/cs/engine/plugins/Maya/Material/NodeMonitor.cpp +++ /dev/null @@ -1,223 +0,0 @@ -/////////////////////////////////////////////////////////////////// -// DESCRIPTION: This class monitors a given node. -// -// TODO: Take care of renamed nodes. -// -// AUTHOR: Christian Laforte -// -/////////////////////////////////////////////////////////////////// -#include "stdafx.h" - -#include "NodeMonitor.h" - -MObject getObjFromName(MString name, MStatus& stat) -{ - MObject obj; - - MSelectionList list; - - // Attempt to add the given name to the selection list, - // then get the corresponding dependency node handle. - if (!list.add(name) || - !list.getDependNode(0, obj)) - { - // Failed. - stat = MStatus::kInvalidParameter; - return obj; - } - - // Successful. - stat = MStatus::kSuccess; - return obj; -} - -// If a problem occurs, this function returns an empty string. -MString getNameFromObj(MObject obj) -{ - MString nodeName; - - // If this object is a MFnDagNode, we should store the dag name. - // Otherwise, use the MFnDependencyNode name. - if (obj.hasFn(MFn::kDagNode)) - { - MFnDagNode dagNode(obj); - nodeName = dagNode.fullPathName(); - } - else if (obj.hasFn(MFn::kDependencyNode)) - { - MFnDependencyNode node(obj); - nodeName = node.name(); - } - - return nodeName; -} - - -//----------------------------------------------------------- -// Public interface: -//----------------------------------------------------------- - -NodeMonitor::NodeMonitor(NodeMonitorManager* manager /* = NULL */) -{ - fNodeName = ""; - fIsDirty = false; - - fRenamedCallbackId = 0; - fDirtyCallbackId = 0; - - fManager = manager; -} - -NodeMonitor::~NodeMonitor() -{ - stopWatching(); -} - -bool NodeMonitor::watch(MString nodeName) -{ - // if already watching another object, release the callbacks. - stopWatching(); - - fNodeName = nodeName; - return attachCallbacks(); -} - -bool NodeMonitor::watch(MObject nodeObj) -{ - MString newNodeName = getNameFromObj(nodeObj); - - // If already watching another object, release the callbacks. - stopWatching(); - - // Get the name of the given object... since an MObject is not - // persistent. We'll use the name of the object to attach/re-attach - // callbacks when necessary. - if (newNodeName == "") - { - // This is bad. We've been given an invalid node object. - // return false to indicate that an error occured. - - return false; - } - - fNodeName = newNodeName; - return attachCallbacks(); -} - -void NodeMonitor::stopWatching() -{ - if (fNodeName != "") - { - // Clean up the callbacks - detachCallbacks(); - - fNodeName = ""; - fIsDirty = false; - } -} - -bool NodeMonitor::dirty() -{ - return fIsDirty; -} - -void NodeMonitor::cleanIt() -{ - if (dirty()) - { - // We have to re-attach the callback. - attachCallbacks(); - } - - fIsDirty = false; -} - - -//---------------------------------------------------------------- -// Private interface: -//---------------------------------------------------------------- - -bool NodeMonitor::attachCallbacks() -{ - // Make sure that there are no callbacks currently enabled. - detachCallbacks(); - - MStatus stat; - MObject node = getObjFromName(fNodeName, stat); - if (!stat) - { - detachCallbacks(); - return false; - } - - fIsDirty = false; - - fDirtyCallbackId = MNodeMessage::addNodeDirtyCallback(node, watchedObjectDirtyCallback, this, &stat ); - if (stat) - { - fRenamedCallbackId = MNodeMessage::addNameChangedCallback (node, watchedObjectRenamedCallback, this, &stat); - } - - // If an error occured, detach any valid callback. - if (!stat) - { - detachCallbacks(); - return false; - } - - return true; -} - -void NodeMonitor::detachCallbacks() -{ - MStatus stat; - - if (fDirtyCallbackId) - { - stat = MMessage::removeCallback(fDirtyCallbackId); - assert(stat); - } - - if (fRenamedCallbackId) - { - stat = MMessage::removeCallback(fRenamedCallbackId); - assert(stat); - } - - fRenamedCallbackId = 0; - fDirtyCallbackId = 0; -} - -void NodeMonitor::callbackOccured() -{ - fIsDirty = true; - - // Detach the callback so that we don't get called needlessly. We'll - // re-attach when the dirty bit is read back. - detachCallbacks(); -} - -// Callback functions. Those are called, respectively, when a node is dirty (has changed substantially), -// or when a node is renamed. - -/*static*/ void NodeMonitor::watchedObjectDirtyCallback(void* clientData) -{ - NodeMonitor* pMon = (NodeMonitor*) clientData; - - pMon->callbackOccured(); -} - -/*static*/ void NodeMonitor::watchedObjectRenamedCallback(MObject & node, void* clientData) -{ - NodeMonitor* pMon = (NodeMonitor*) clientData; - - // Get the new name of the node, and use it from now on. - MString oldName = pMon->fNodeName; - pMon->fNodeName = getNameFromObj(node); - - // Call the manager, if there's one. - if (pMon->fManager != NULL) - pMon->fManager->onNodeRenamed(node, oldName, pMon->fNodeName); - - pMon->callbackOccured(); -} diff --git a/cs/engine/plugins/Maya/Material/NodeMonitor.h b/cs/engine/plugins/Maya/Material/NodeMonitor.h deleted file mode 100644 index c41da8cf5..000000000 --- a/cs/engine/plugins/Maya/Material/NodeMonitor.h +++ /dev/null @@ -1,76 +0,0 @@ -#ifndef __NodeMonitor_h__ -#define __NodeMonitor_h__ - -// -// -// DESCRIPTION: This class monitors a given node. -// -// AUTHOR: Christian Laforte -// -// - -#include -#include -#include -#include -#include -#include -#include - -MObject getObjFromName(MString name, MStatus& stat); - -// If a problem occurs, this function returns an empty string. -MString getNameFromObj(MObject obj); - -// Classes that implement the NodeMonitorManager interfaces -// can be called back when a node is renamed. -class NodeMonitorManager -{ -public: - virtual void onNodeRenamed(MObject& node, MString oldName, MString newName) = 0; -}; - -class NodeMonitor -{ -public: - NodeMonitor(NodeMonitorManager* manager = NULL); - - ~NodeMonitor(); - - bool watch(MString nodeName); - bool watch(MObject nodeObj); - - void stopWatching(); - - bool dirty(); - - void cleanIt(); - - void setManager(NodeMonitorManager* manager) { fManager = manager; } - -private: - bool attachCallbacks(); - - void detachCallbacks(); - - void callbackOccured(); - - // Callback functions. Those are called, respectively, when a node is dirty (has changed substantially), - // or when a node is renamed. - static void watchedObjectDirtyCallback(void* clientData); - - static void watchedObjectRenamedCallback(MObject & node, void* clientData); - - -private: - MString fNodeName; - bool fIsDirty; - - MCallbackId fRenamedCallbackId; - MCallbackId fDirtyCallbackId; - - NodeMonitorManager* fManager; -}; - - -#endif // MAYA_ShadingConnection \ No newline at end of file diff --git a/cs/engine/plugins/Maya/Material/ShadingConnection.cpp b/cs/engine/plugins/Maya/Material/ShadingConnection.cpp deleted file mode 100644 index 0779e749a..000000000 --- a/cs/engine/plugins/Maya/Material/ShadingConnection.cpp +++ /dev/null @@ -1,191 +0,0 @@ -/////////////////////////////////////////////////////////////////// -// DESCRIPTION: This class stores useful information about -// a shader's attribute, including what's connected upstream of it. -// It also automatically passes through shader switches. -// -// AUTHOR: Christian Laforte -// -/////////////////////////////////////////////////////////////////// -#include "stdafx.h" - -#include "ShadingConnection.h" - -ShadingConnection::ShadingConnection(MObject shaderObj, MString shapeName, MString attribute /* = "" */) -{ - // Store those input values for later use. - this->m_shaderObj = shaderObj; - this->m_shapeName = shapeName; - - // By default, the connection is direct until proven otherwise. - this->m_directConnection = true; - - if (attribute != "") - traverseAttribute(attribute); -} - -ShadingConnection::TYPE ShadingConnection::traverseAttribute(MString attributeName) -{ - // Get a plug to the attribute. - MStatus status; - MFnDependencyNode shaderNode(m_shaderObj); - - MPlug plug = shaderNode.findPlug( attributeName, &status ); - assert(status); - - this->m_attributeName = attributeName; - - return analyzePlug(plug); -} - -ShadingConnection::TYPE ShadingConnection::analyzePlug(MPlug plug) -{ - MStatus status; - - // Find all incoming connections. - MPlugArray connectedElements; - plug.connectedTo( connectedElements, true, false, &status ); - assert(status); - - if (connectedElements.length() == 0) - { - // It's a constant color... set it now and return. - unsigned int numChildren = plug.numChildren(); - assert(numChildren == 3); - - float red, green, blue; - plug.child(0).getValue(red); - plug.child(1).getValue(green); - plug.child(2).getValue(blue); - - return setConstantColor(MColor(red, green, blue, 1.0)); - } - - // The plug is actually connected on a different shading node. - MObject connectedObject = connectedElements[0].node(&status); - assert(status); - - // If this is a triple shading switch, go through it. - if (connectedObject.hasFn(MFn::kTripleShadingSwitch)) - { - return traverseTripleShadingSwitch(connectedObject); - } - - // Set the object and return the appropriate type. - return setTexture(connectedObject); -} - -ShadingConnection::TYPE ShadingConnection::traverseTripleShadingSwitch(MObject connectedObject) -{ - // The connection cannot be direct anymore. - m_directConnection = false; - - MFnDependencyNode node(connectedObject); - - MStatus status; - MPlug inputPlug = node.findPlug( "input" ); - - unsigned int numElements = inputPlug.numElements(); - unsigned int numChildren = inputPlug.numChildren(); - - // It is assumed that the first child of this input compound attribute is - // a "inTexture" attribute and the the second child is the inShape attribute. - // This assumption should always be safe, unless some drastic changes occured in the - // implementation of the shading switches... in which case this code won't work, so - // we would throw an exception. - assert( numChildren >= 2); // "Abnormal hierarchy in switching node." - - // Go through each row of the switch table. - for (unsigned int index = 0; index < numElements; index++) - { - MPlug inTexturePlug = inputPlug.elementByPhysicalIndex(index).child(0); - MPlug inShapePlug = inputPlug.elementByPhysicalIndex(index).child(1); - - MPlugArray inShapeConnections; - inShapePlug.connectedTo( inShapeConnections, true, false, &status ); - - // Check if one of the corresponding shapes matches the given shape name. - unsigned int numCorrespondingShapes = inShapeConnections.length(); - for (unsigned int shapeNum = 0; shapeNum < numCorrespondingShapes; shapeNum++) - { - MObject inShapeObj = inShapeConnections[0].node(&status); - assert(status); - - MFnDependencyNode inShape(inShapeObj); - MString inShapeName = inShape.name(); - - if (inShapeName == m_shapeName) - return analyzePlug(inTexturePlug); - } - } - - // If there was no special case in the switch for our shape, check the default. - MPlug defaultPlug = node.findPlug("default"); - return analyzePlug(defaultPlug); -} - -ShadingConnection::TYPE ShadingConnection::type() -{ - return m_type; -} - -MColor ShadingConnection::constantColor() -{ - assert(m_type == CONSTANT_COLOR); - return m_constantColor; -} - -MObject ShadingConnection::texture() -{ - assert(m_type == TEXTURE); - return m_texture; -} - -MObject ShadingConnection::shaderObj() -{ - return m_shaderObj; -} - -MString ShadingConnection::shaderName() -{ - MStatus stat; - MFnDependencyNode shaderNode(m_shaderObj, &stat); - assert(stat); - return shaderNode.name(); -} - -MString ShadingConnection::attributeName() -{ - return m_attributeName; -} - -MString ShadingConnection::shapeName() -{ - return m_shapeName; -} - -ShadingConnection::TYPE ShadingConnection::setConstantColor(MColor col) -{ - m_constantColor = col; - m_type = CONSTANT_COLOR; - - // Reset m_texture to prevent misinterpretation. - m_texture = MObject(); - - return m_type; -} - -ShadingConnection::TYPE ShadingConnection::setTexture(MObject texture) -{ - m_texture = texture; - m_type = TEXTURE; - - // Reset m_color to prevent misinterpretation. - m_constantColor = MColor(); - - return m_type; -} - -bool ShadingConnection::isDirectConnection() -{ - return m_directConnection; -} diff --git a/cs/engine/plugins/Maya/Material/ShadingConnection.h b/cs/engine/plugins/Maya/Material/ShadingConnection.h deleted file mode 100644 index 3c0f0fc38..000000000 --- a/cs/engine/plugins/Maya/Material/ShadingConnection.h +++ /dev/null @@ -1,90 +0,0 @@ -#ifndef MAYA_ShadingConnection -#define MAYA_ShadingConnection - -/////////////////////////////////////////////////////////////////// -// DESCRIPTION: This class stores useful information about -// a shader's attribute, including what's connected upstream of it. -// It also automatically passes through shader switches. -// -// The ShadingConnection is a helper class that stores useful information -// about a shader's attribute, including what's connected upstream of it. -// -// It can: -// Traverse upstream until it finds if the connection is ultimately -// on a constant color, or a shading object. This process goes through -// shading switches if it encounters some. The object/color found is called -// the "target". -// -// At the end of this process, the following information is stored: -// 1. Target type: whether or not the connection ends up on a shading -// object (for example: file texture), or a constant -// color (ex: bright red). -// 2. Target identity: either the color, or the target object itself. Note -// that the caller is responsible to first check the type -// before calling color() or object(). -// 3. Directness: Whether or not the connection was direct (ie: there was -// no shading switch in between the source and the target) -// or indirect (ie: there were shading switches in between.) -// -// In order to traverse the shading network, we need the name of the shape. -// -// AUTHOR: Christian Laforte -// -/////////////////////////////////////////////////////////////////// - -#include - -class ShadingConnection -{ -public: - enum TYPE - { - CONSTANT_COLOR, - TEXTURE - }; - - ShadingConnection(MObject shaderObj, MString shapeName, MString attribute = ""); - - TYPE traverseAttribute(MString attributeName); - - TYPE analyzePlug(MPlug plug); - - TYPE traverseTripleShadingSwitch(MObject connectedObject); - - TYPE type(); - - MColor constantColor(); - - MObject texture(); - - MObject shaderObj(); - - MString shaderName(); - - MString attributeName(); - - MString shapeName(); - - TYPE setConstantColor(MColor col); - TYPE setTexture(MObject texture); - - bool isDirectConnection(); - - -private: - // Input - MObject m_shaderObj; - MString m_attributeName; - MString m_shapeName; - - // Output - TYPE m_type; - MColor m_constantColor; - MObject m_texture; - bool m_directConnection; - - -}; - - -#endif // MAYA_ShadingConnection \ No newline at end of file diff --git a/cs/engine/plugins/Maya/Material/Stdafx.h b/cs/engine/plugins/Maya/Material/Stdafx.h deleted file mode 100644 index aff3ce137..000000000 --- a/cs/engine/plugins/Maya/Material/Stdafx.h +++ /dev/null @@ -1,100 +0,0 @@ -//---------------------------------------------------- -// file: stdafx.h -//---------------------------------------------------- -#ifndef __INCDEF_STDAFX_H_ -#define __INCDEF_STDAFX_H_ - -#pragma once - -#define _WIN32_WINNT 0x0500 -#include "../../../xrCore/xrCore.h" -#include - -#pragma warning(push) -#pragma warning(disable:4995) -#define REQUIRE_IOSTREAM -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#pragma warning(pop) - -#define ENGINE_API -#define ECORE_API - -enum TMsgDlgType { mtWarning, mtError, mtInformation, mtConfirmation, mtCustom }; -enum TMsgDlgBtn { mbYes, mbNo, mbOK, mbCancel, mbAbort, mbRetry, mbIgnore, mbAll, mbNoToAll, mbYesToAll, mbHelp }; -typedef TMsgDlgBtn TMsgDlgButtons[mbHelp]; - -#pragma warning(push) -#pragma warning(disable:4995) -#include "..\..\Shared\ELog.h" -#include "..\..\Shared\bone.h" -//#include -#include -#include -#include -#pragma warning(pop) - -#define AnsiString std::string -using AStringVec = xr_vector; -using AStringIt = AStringVec::iterator; - -#define THROW R_ASSERT(0) - -#ifdef _MAYA_EXPORT - #define _EDITOR_FILE_NAME_ "maya_export" -#else - #ifdef _MAYA_MATERIAL - #define _EDITOR_FILE_NAME_ "maya_material" - #endif -#endif - -#define GAMEMTL_NONE u32(-1) -#define _game_data_ "$game_data$" - -#endif /*_INCDEF_STDAFX_H_*/ \ No newline at end of file diff --git a/cs/engine/plugins/Maya/Material/crc16.cpp b/cs/engine/plugins/Maya/Material/crc16.cpp deleted file mode 100644 index 16c174b2b..000000000 --- a/cs/engine/plugins/Maya/Material/crc16.cpp +++ /dev/null @@ -1,116 +0,0 @@ -#include "stdafx.h" -#pragma hdrstop - -/* CRC16.C - by Rob Duff, Vancouver, BC, Canada. Not copyrighted. */ -/* -This algorithm is adapted from the classic paper -"Byte-wise CRC Calculations", Aram Perez -IEEE Micro June 1983 pp 40-50 - -CRC16 is used by the popular ARC archiving program. -CCITT is used by XMODEM, SDLC by IBM corp. - -gen16(0) will create table for CRC16 -gen16(1) for CCITT and start crc at -1 for SDLC -*/ - -static BOOL crc16_ready = FALSE; -static int crc16_table [256]; // Lookup table array - -int gen_tab[2][8] = { - { 0xC0C1, 0xC181, 0xC301, 0xC601, 0xCC01, 0xD801, 0xF001, 0xA001 }, - { 0x1189, 0x2312, 0x4624, 0x8C48, 0x1081, 0x2102, 0x4204, 0x8408 } -}; - -void crc16_init(unsigned p) -{ - int i, j, val; - - for (i = 0; i < 256; i++) { - val = 0; - for (j = 0; j < 8; j++) - if (i & (1< 0 && argv[0][0] == '-') { - if (argv[0][1] == 'c') { - poly = 1; - init = 0; - } - if (argv[0][1] == 's') { - poly = 1; - init = -1; - } - argc--; argv++; - } - else { - poly = 0; - init = 0; - } - if (argc < 1) - usage(); - gen16(poly); - while (argc) { - while (findfile(fname, *argv, 0)) { - fd = open(fname, O_RDONLY | O_BINARY); - if (fd == -1) - break; - crc = init; - do { - n = read(fd, buffer[0], sizeof(buffer)); - crc = crc16(buffer[0], n, crc); - } while (n == sizeof(buffer)); - close(fd); - printf("crc of %s is %04X\n", fname, crc); - } - argc--; argv++; - } - return 0; -} -*/ \ No newline at end of file diff --git a/cs/engine/plugins/Maya/Material/hwUnlitShader.cpp b/cs/engine/plugins/Maya/Material/hwUnlitShader.cpp deleted file mode 100644 index c21a07e14..000000000 --- a/cs/engine/plugins/Maya/Material/hwUnlitShader.cpp +++ /dev/null @@ -1,557 +0,0 @@ -/////////////////////////////////////////////////////////////////// -// DESCRIPTION: This is a simple shader, that only -// supports decal texturing using standard OpenGL commands. -// -// How to use this shader: -// -// 1. Compile it and put it in your plug-in path. -// 2. Window->Setting/Preferences->Plug-in Manager. -// Make sure that the CXRayMtl.mll plug-in is there -// and click the "loaded" checkbox next to it to load it. -// 3. Create a new scene. -// 4. Create a poly object (say, a polygon cube). -// 5. Create a new CXRayMtl. You can use the hypershade, or -// right-click on the cube and select Material->Create new Material->CXRayMtl. -// 6. Open the attribute editor and select the CXRayMtl you just created. -// 7. The color attribute can be mapped on a file texture, just like any -// standard maya shader. Try it, press '6' to go in textured mode and see the texture. -// 8. The transparency attribute can be set to a value other than 0.0 to -// display transparent color. If the color attribute is textured and -// transparency is set, the average of the transparency is modulated -// by the texture. -// -// COMPATIBILITY NOTE: Before Maya 4.5, a problem prevented Maya from -// properly using MPxHwShaderNode::hasTransparency(). The work-around is -// to create transparency attributes that mimics standard Lambert shaders, -// and to set the transparency value to a color different than black. -// This forces Maya to properly order geometry from farthest to closest. -// This shader illustrates both the workaround (the transparency attributes -// illustrated in initialize() below) and the recommended way (overloading -// hasTransparency() to return true). If you do not need to support -// earlier versions of Maya, or do not need transparency, then there is -// no need to create the transparency attributes. -// -// -/////////////////////////////////////////////////////////////////// - -#include "stdafx.h" -using namespace std; - -#ifdef WIN32 -#pragma warning( disable : 4786 ) // Disable stupid STL warnings. -#endif - -#include "hwUnlitShader.h" -#include "ShadingConnection.h" - -#include "BlenderListLoader.h" - - -// Plug-in ID and Attributes. -// This ID needs to be unique to prevent clashes. -// -MTypeId CXRayMtl::id( 0x00105440 ); - -MObject CXRayMtl::color; -MObject CXRayMtl::colorR; -MObject CXRayMtl::colorG; -MObject CXRayMtl::colorB; - -MObject CXRayMtl::xrDoubleSide; -MObject CXRayMtl::xrEngineData; -MObject CXRayMtl::xrCompilerData; -MObject CXRayMtl::xrMaterialData; - -MObject CXRayMtl::transparency; -MObject CXRayMtl::transparencyR; -MObject CXRayMtl::transparencyG; -MObject CXRayMtl::transparencyB; - - -#define MAKE_INPUT(attr) \ - CHECK_MSTATUS ( attr.setKeyable(true) ); \ - CHECK_MSTATUS ( attr.setStorable(true) ); \ - CHECK_MSTATUS ( attr.setReadable(true) ); \ - CHECK_MSTATUS ( attr.setWritable(true) ); - -#define MAKE_OUTPUT(attr) \ - CHECK_MSTATUS ( attr.setKeyable(false) ) ; \ - CHECK_MSTATUS ( attr.setStorable(false) ); \ - CHECK_MSTATUS ( attr.setReadable(true) ) ; \ - CHECK_MSTATUS ( attr.setWritable(false) ); - -void CXRayMtl::postConstructor( ) -{ - setMPSafe(false); -} - -CXRayMtl::CXRayMtl() -{ - m_pTextureCache = MTextureCache::instance(); - - attachSceneCallbacks(); -} - -CXRayMtl::~CXRayMtl() -{ - detachSceneCallbacks(); -} - -void CXRayMtl::releaseEverything() -{ - // Clean the texture cache, through refcounting. - m_pTextureCache->release(); -} - -void CXRayMtl::attachSceneCallbacks() -{ - fBeforeNewCB = MSceneMessage::addCallback(MSceneMessage::kBeforeNew, releaseCallback, this); - fBeforeOpenCB = MSceneMessage::addCallback(MSceneMessage::kBeforeOpen, releaseCallback, this); - fBeforeRemoveReferenceCB = MSceneMessage::addCallback(MSceneMessage::kBeforeRemoveReference, - releaseCallback, this); - fMayaExitingCB = MSceneMessage::addCallback(MSceneMessage::kMayaExiting, releaseCallback, this); -} - -/*static*/ -void CXRayMtl::releaseCallback(void* clientData) -{ - CXRayMtl *pThis = (CXRayMtl*) clientData; - pThis->releaseEverything(); -} - -void CXRayMtl::detachSceneCallbacks() -{ - if (fBeforeNewCB) - MMessage::removeCallback(fBeforeNewCB); - if (fBeforeOpenCB) - MMessage::removeCallback(fBeforeOpenCB); - if (fBeforeRemoveReferenceCB) - MMessage::removeCallback(fBeforeRemoveReferenceCB); - if (fMayaExitingCB) - MMessage::removeCallback(fMayaExitingCB); - - fBeforeNewCB = 0; - fBeforeOpenCB = 0; - fBeforeRemoveReferenceCB = 0; - fMayaExitingCB = 0; -} - - -void * CXRayMtl::creator() -{ - return xr_new(); -} - -MStatus initializePlugin( MObject obj ) -{ - MStatus status; - - const MString UserClassify( "shader/surface/utility" ); - - MFnPlugin plugin( obj, "GSC Game World", "1.0.0", "Any"); - status = plugin.registerNode( "XRayMtl", CXRayMtl::id, - CXRayMtl::creator, CXRayMtl::initialize, - MPxNode::kHwShaderNode, &UserClassify ); - if (!status) { - status.perror("registerNode"); - return status; - } - - return MS::kSuccess; -} - -MStatus uninitializePlugin( MObject obj ) -{ - MStatus status; - - MFnPlugin plugin( obj ); - - plugin.deregisterNode( CXRayMtl::id ); - if (!status) { - status.perror("deregisterNode"); - return status; - } - - return MS::kSuccess; -} - -extern unsigned crc16_calc(unsigned char *data, unsigned count, unsigned old_crc=0); - -MStatus CXRayMtl::initialize() -{ - Core._initialize("XRayPlugin",ELogCallback,FALSE); - FS._initialize (CLocatorAPI::flScanAppRoot); - - MFnNumericAttribute nAttr; - MStatus status; - MFnTypedAttribute sAttr; // For string attributes - MFnEnumAttribute eAttr; - - // Create COLOR input attributes - colorR = nAttr.create( "colorR", "cr",MFnNumericData::kFloat); - nAttr.setStorable(true); - nAttr.setKeyable(true); - nAttr.setDefault(1.0f); - - colorG = nAttr.create( "colorG", "cg",MFnNumericData::kFloat); - nAttr.setStorable(true); - nAttr.setKeyable(true); - nAttr.setDefault(0.5f); - - colorB = nAttr.create( "colorB", "cb",MFnNumericData::kFloat); - nAttr.setStorable(true); - nAttr.setKeyable(true); - nAttr.setDefault(0.5f); - - color = nAttr.create( "color", "c", colorR, colorG, colorB); - nAttr.setStorable(true); - nAttr.setKeyable(true); - nAttr.setDefault(1.0f, 0.5f, 0.5f); // ugly pink-salmon color. You can't miss it. - nAttr.setUsedAsColor(true); - - // Create TRANSPARENCY input attributes - transparencyR = nAttr.create( "transparencyR", "itr",MFnNumericData::kFloat); - nAttr.setStorable(true); - nAttr.setKeyable(true); - nAttr.setDefault(1.0f); - - transparencyG = nAttr.create( "transparencyG", "itg",MFnNumericData::kFloat); - nAttr.setStorable(true); - nAttr.setKeyable(true); - nAttr.setDefault(0.5f); - - transparencyB = nAttr.create( "transparencyB", "itb",MFnNumericData::kFloat); - nAttr.setStorable(true); - nAttr.setKeyable(true); - nAttr.setDefault(0.5f); - - transparency = nAttr.create( "transparency", "it", transparencyR, transparencyG, transparencyB); - nAttr.setStorable(true); - nAttr.setKeyable(true); - nAttr.setDefault(0.0001f, 0.0001f, 0.0001f); // very light gray. - nAttr.setUsedAsColor(true); - - // Add the attributes here - addAttribute(color); - addAttribute(transparency); - - - // loading x-ray part - xrDoubleSide = eAttr.create( "xrayDoubleSide", "xrd"); - MAKE_INPUT(eAttr); - CHECK_MSTATUS (eAttr.addField("false",0)); - CHECK_MSTATUS (eAttr.addField("true",1)); - CHECK_MSTATUS (eAttr.setDefault(eAttr.fieldIndex("false"))); - - LPSTRVec lst; - LPSTRIt it; - xrEngineData = eAttr.create( "xrayEngineShader", "xre"); - MAKE_INPUT(eAttr); - LoadBlenderList(lst); - for (it=lst.begin(); it!=lst.end(); it++) - { - _ChangeSymbol(*it,'\\','/'); - CHECK_MSTATUS (eAttr.addField(*it,crc16_calc((u8*)*it,xr_strlen(*it)))); - } - CHECK_MSTATUS ( eAttr.setDefault(eAttr.fieldIndex("default"))); - ClearList(lst); - - xrCompilerData = eAttr.create( "xrayCompilerShader", "xrc"); - MAKE_INPUT(eAttr); - LoadShaderLCList(lst); - for (it=lst.begin(); it!=lst.end(); it++) - { - _ChangeSymbol(*it,'\\','/'); - CHECK_MSTATUS (eAttr.addField(*it,crc16_calc((u8*)*it,xr_strlen(*it)))); - } - CHECK_MSTATUS ( eAttr.setDefault(eAttr.fieldIndex("default"))); - ClearList(lst); - - xrMaterialData = eAttr.create( "xrayGameMaterial", " "); - MAKE_INPUT(eAttr); - LoadGameMtlList(lst); - for (it=lst.begin(); it!=lst.end(); it++) - { - _ChangeSymbol(*it,'\\','/'); - CHECK_MSTATUS (eAttr.addField(*it,crc16_calc((u8*)*it,xr_strlen(*it)))); - } - CHECK_MSTATUS ( eAttr.setDefault(eAttr.fieldIndex("default"))); - ClearList(lst); - - CHECK_MSTATUS ( addAttribute(xrDoubleSide) ); - CHECK_MSTATUS ( addAttribute(xrEngineData) ); - CHECK_MSTATUS ( addAttribute(xrCompilerData) ); - CHECK_MSTATUS ( addAttribute(xrMaterialData) ); - // end x-ray part -// create output attributes here - // outColor is the only output attribute and it is inherited - // so we do not need to create or add it. - // - - return MS::kSuccess; -} - - -/////////////////////////////////////////////////////// -// DESCRIPTION: -// This function gets called by Maya to evaluate the shader. -// -// Get color from the input block. -// Compute the color/alpha of our bump for a given UV coordinate. -// Put the result into the output plug. -/////////////////////////////////////////////////////// - -MStatus CXRayMtl::compute( -const MPlug& plug, - MDataBlock& block ) -{ - if((plug != outColor) && (plug != outColorR) && (plug != outColorG) && (plug != outColorB)) return MS::kUnknownParameter; -/* - bool k = false; - k |= (plug==outColor); - k |= (plug==outColorR); - k |= (plug==outColorG); - k |= (plug==outColorB); - if( !k ) return MS::kUnknownParameter; - // Always return black for now. - MFloatVector resultColor(0.0,0.0,0.0); - - // set ouput color attribute - MDataHandle outColorHandle = block.outputValue( outColor ); - MFloatVector& outColor = outColorHandle.asFloatVector(); - outColor = resultColor; - outColorHandle.setClean(); -*/ - return MS::kSuccess; -} - -MStatus CXRayMtl::getFloat3(MObject attr, float value[3]) -{ - // Get the attr to use - // - MPlug plug(thisMObject(), attr); - - MObject object; - - MStatus status = plug.getValue(object); - if (!status) - { - status.perror("CXRayMtl::bind plug.getValue."); - return status; - } - - - MFnNumericData data(object, &status); - if (!status) - { - status.perror("CXRayMtl::bind construct data."); - return status; - } - - status = data.getData(value[0], value[1], value[2]); - if (!status) - { - status.perror("CXRayMtl::bind get values."); - return status; - } - - return MS::kSuccess; -} - -MStatus CXRayMtl::getString(MObject attr, MString &str) -{ - MPlug plug(thisMObject(), attr); - MStatus status = plug.getValue( str ); - return MS::kSuccess; -} - - -void CXRayMtl::updateTransparencyFlags(MString objectPath) -{ - // Update the transparency flags and values. - // Check if the transparency channel is mapped on a texture, or if - // it is constant. Textured transparency is not supported in this example, - // because it would involve multiplying alpha values of two texture maps... - MString transparencyName = ""; - ShadingConnection transparencyConnection(thisMObject(), objectPath, "transparency"); - if (transparencyConnection.type() == ShadingConnection::CONSTANT_COLOR) - { - // transparency = average of r,g,b transparency channels. - MColor tc = transparencyConnection.constantColor(); - fConstantTransparency = (tc.r + tc.g + tc.b) / 3.0f; - } - else - fConstantTransparency = 0.0f; // will result in alpha=1. -} - - -/* virtual */ -MStatus CXRayMtl::bind(const MDrawRequest& request, - M3dView& view) -{ - MStatus status; - - // white, opaque. - float bgColor[4] = {1,1,1,1}; - - // Get path of current object in draw request - currentObjectPath = request.multiPath(); - MString currentPathName( currentObjectPath.partialPathName() ); - - updateTransparencyFlags(currentPathName); - - // Get decal texture name - MString decalName = ""; - ShadingConnection colorConnection(thisMObject(), currentPathName, "color"); - - // If the color attribute is ultimately connected to a file texture, find its filename. - // otherwise use the default color texture. - if (colorConnection.type() == ShadingConnection::TEXTURE && - colorConnection.texture().hasFn(MFn::kFileTexture)) - { - // Get the filename of the texture. - MFnDependencyNode textureNode(colorConnection.texture()); - MPlug filenamePlug( colorConnection.texture(), textureNode.attribute(MString("fileTextureName")) ); - filenamePlug.getValue(decalName); - if (decalName == "") - getFloat3(color, bgColor); - } - else - { - decalName = ""; - getFloat3(color, bgColor); - } - - assert(glGetError() == GL_NO_ERROR); - - view.beginGL(); - - glPushAttrib( GL_ALL_ATTRIB_BITS ); - glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT); - - // Set the standard OpenGL blending mode. - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - - // Change the constant alpha value. - float alpha = 1.0f - fConstantTransparency; - - // Set a color (with alpha). This color will be used directly if - // the shader is not textured. Otherwise, the texture will get modulated - // by the alpha. - glColor4f(bgColor[0], bgColor[1], bgColor[2], alpha); - - - // If the shader is textured... - if (decalName.length() != 0) - { - // Enable 2D texturing. - glEnable(GL_TEXTURE_2D); - - assert(glGetError() == GL_NO_ERROR); - - // Bind the 2D texture through the texture cache. The cache will keep - // the texture around, so that it will only be loaded in video - // memory once. In this example, the third parameter (mipmapping) is - // false, so no mipmaps are generated. Note that mipmaps only work if - // the texture has even dimensions. - m_pTextureCache->bind(colorConnection.texture(), MTexture::RGBA, false); - - // Set minification and magnification filtering to linear interpolation. - // For better quality, you could enable mipmapping while binding and - // use GL_MIPMAP_LINEAR_MIPMAP in for minification filtering. - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ); - } - - // Disable lighting. - glDisable(GL_LIGHTING); - - view.endGL(); - - return MS::kSuccess; -} - - -/* virtual */ -MStatus CXRayMtl::unbind(const MDrawRequest& request, - M3dView& view) -{ - view.beginGL(); - glPopClientAttrib(); - glPopAttrib(); - - view.endGL(); - - return MS::kSuccess; -} - -/* virtual */ -MStatus CXRayMtl::geometry( const MDrawRequest& request, - M3dView& view, - int prim, - unsigned int writable, - int indexCount, - const unsigned int * indexArray, - int vertexCount, - const int * vertexIDs, - const float * vertexArray, - int normalCount, - const float ** normalArrays, - int colorCount, - const float ** colorArrays, - int texCoordCount, - const float ** texCoordArrays) -{ - view.beginGL(); - - glVertexPointer(3, GL_FLOAT, 0, vertexArray); - glEnableClientState(GL_VERTEX_ARRAY); - - if (normalCount > 0) - { - // Technically, we don't need the normals for this example. But - // most of the 3rd party plug-ins will probably want the normal, - // which is why the following lines were kept. - glNormalPointer(GL_FLOAT, 0, normalArrays[0]); - glEnableClientState(GL_NORMAL_ARRAY); - } - - if (texCoordCount > 0) - { - glTexCoordPointer(2, GL_FLOAT, 0, texCoordArrays[0]); - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - } - - glDrawElements(prim, indexCount, GL_UNSIGNED_INT, indexArray); - - view.endGL(); - - return MS::kSuccess; -} - -/* virtual */ -int CXRayMtl::normalsPerVertex() -{ - // Want only normals - return 1; -} - -/* virtual */ -int CXRayMtl::texCoordsPerVertex() -{ - return 1; -} - -/* virtual */ -bool CXRayMtl::hasTransparency() -{ - // Performance note: if we knew that the texture - // is always opaque, we could return false here - // to avoid the computation cost associated with - // ordering objects from farthest to closest. - return true; -} diff --git a/cs/engine/plugins/Maya/Material/hwUnlitShader.h b/cs/engine/plugins/Maya/Material/hwUnlitShader.h deleted file mode 100644 index f6a3fe3c2..000000000 --- a/cs/engine/plugins/Maya/Material/hwUnlitShader.h +++ /dev/null @@ -1,107 +0,0 @@ -#ifndef XRayMtlH -#define XRayMtlH - -/////////////////////////////////////////////////////////////////// -// -// NOTE: PLEASE READ THE README.TXT FILE FOR INSTRUCTIONS ON -// COMPILING AND USAGE REQUIREMENTS. -// -// DESCRIPTION: Simple hardware shader which uses regular OpenGL -// texturing and disables lighting. -// -// This sample demonstrates how to: -// - Specify a color attribute on your HW shader plug-in -// so that end-users can attach a file texture to it. -// - Traverse what's upstream of the color attribute, including -// going through shading switches if required. -// - Using the MImage API class to load and uncompress a file -// texture in any Maya-supported file format. -// - Setting up the graphics pipeline to display the -// texture correctly. -// -// -/////////////////////////////////////////////////////////////////// - -#include -#include "MTextureCache.h" - -class CXRayMtl : public MPxHwShaderNode -{ -public: - CXRayMtl(); - virtual ~CXRayMtl(); - void releaseEverything(); - - virtual MStatus compute( const MPlug&, MDataBlock& ); - virtual void postConstructor(); - - virtual MStatus bind(const MDrawRequest& request, - M3dView& view); - - virtual MStatus unbind(const MDrawRequest& request, - M3dView& view); - - virtual MStatus geometry( const MDrawRequest& request, - M3dView& view, - int prim, - unsigned int writable, - int indexCount, - const unsigned int * indexArray, - int vertexCount, - const int * vertexIDs, - const float * vertexArray, - int normalCount, - const float ** normalArrays, - int colorCount, - const float ** colorArrays, - int texCoordCount, - const float ** texCoordArrays); - - virtual int normalsPerVertex(); - virtual bool hasTransparency(); - virtual int texCoordsPerVertex(); - - static void * creator(); - static MStatus initialize(); - static MTypeId id; - - MTextureCache* m_pTextureCache; - - MStatus getFloat3(MObject colorAttr, float colorValue[3]); - MStatus getString(MObject attr, MString &str); - - void updateTransparencyFlags(MString objectPath); - -protected: - static MObject colorR; - static MObject colorG; - static MObject colorB; - static MObject color; - - static MObject xrEngineData; - static MObject xrCompilerData; - static MObject xrMaterialData; - static MObject xrDoubleSide; - - static MObject transparencyR; - static MObject transparencyG; - static MObject transparencyB; - static MObject transparency; - float fConstantTransparency; - - MDagPath currentObjectPath; - - // Callbacks that we monitor so we can release OpenGL-dependant resources before - // their context gets destroyed. - MCallbackId fBeforeNewCB; - MCallbackId fBeforeOpenCB; - MCallbackId fBeforeRemoveReferenceCB; - MCallbackId fMayaExitingCB; - - void attachSceneCallbacks(); - void detachSceneCallbacks(); - - static void releaseCallback(void* clientData); -}; - -#endif /* XRayMtlH */ diff --git a/cs/engine/plugins/Maya/Material/lambertShader.cpp b/cs/engine/plugins/Maya/Material/lambertShader.cpp deleted file mode 100644 index 1dd703aba..000000000 --- a/cs/engine/plugins/Maya/Material/lambertShader.cpp +++ /dev/null @@ -1,1052 +0,0 @@ -//+ -// Copyright (C) Alias Systems, a division of Silicon Graphics Limited and/or -// its licensors ("Alias"). All rights reserved. These coded instructions, -// statements, computer programs, and/or related material (collectively, the -// "Material") contain unpublished information proprietary to Alias, which is -// protected by Canadian and US federal copyright law and by international -// treaties. This Material may not be disclosed to third parties, or be copied -// or duplicated, in whole or in part, without the prior written consent of -// Alias. ALIAS HEREBY DISCLAIMS ALL WARRANTIES RELATING TO THE MATERIAL, -// INCLUDING, WITHOUT LIMITATION, ANY AND ALL EXPRESS OR IMPLIED WARRANTIES OF -// NON-INFRINGEMENT, MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. -// IN NO EVENT SHALL ALIAS BE LIABLE FOR ANY DAMAGES WHATSOEVER, WHETHER DIRECT, -// INDIRECT, SPECIAL, OR PUNITIVE, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -// OR OTHER TORTIOUS ACTION, OR IN EQUITY, ARISING OUT OF OR RELATED TO THE -// ACCESS TO, USE OF, OR RELIANCE UPON THE MATERIAL. -//- - -// Example Plugin: lambertShader.cpp -// -// Produces dependency graph node LambertShader -// This node is an example of a Lambert shader and how to build a -// dependency node as a surface shader in Maya. The inputs for this node -// are many, and can be found in the Maya UI on the Attribute Editor for -// the node. The output attributes for the node are "outColor" and -// "outTransparency". To use this shader, create a lambertShader with -// Shading Group or connect the outputs to a Shading Group's -// "SurfaceShader" attribute. -// -#include "stdafx.h" -#pragma hdrstop - -#include "maya/MFnStringData.h" -#include "maya/MFnNumericAttribute.h" -#include "BlenderListLoader.h" -using namespace std; -///////////////////////////////// -// Plugin Lambert Shader Class // -///////////////////////////////// - - -// This class will create a new shader. Shaders are custom dependency -// graph objects so we will derive this class from the basic DG node -// type MPxNode -// - -class CXRayMtl : public MPxNode -{ -public: - CXRayMtl(); - virtual ~CXRayMtl(); - - static void * creator(); - virtual MStatus compute( const MPlug&, MDataBlock& ); - static MStatus initialize (); - - // postConstructor: - // The postConstructor method allows us to call MPxNode member - // functions during initialization. Internally maya creates two - // objects when a user defined node is created, the internal MObject - // and the user derived object. The association between the these - // two objects is not made until after the MPxNode constructor is - // called. This implies that no MPxNode member function can be called - // from the MPxNode constructor. The postConstructor will get called - // immediately after the constructor when it is safe to call any - // MPxNode member function. - // - - virtual void postConstructor(); - - static MTypeId id; // The IFF type id - -protected: - - // Translucence coefficient - static MObject aTranslucenceCoeff; - - // Diffuse Reflectivity - static MObject aDiffuseReflectivity; - - // Red component of surface color - static MObject aColorR; - - // Green component of surface color - static MObject aColorG; - - // Blue component of surface color - static MObject aColorB; - - // Surface color - static MObject aColor; - - // Red component of incandescence - static MObject aIncandescenceR; - - // Green component of incandescence - static MObject aIncandescenceG; - - // Blue component of incandescence - static MObject aIncandescenceB; - - // Incandescence - static MObject aIncandescence; - - // Red component of surface transparency - static MObject aInTransR; - - // Green component of surface transparency - static MObject aInTransG; - - // Blue component of surface transparency - static MObject aInTransB; - - // Surface transparency - static MObject aInTransparency; - - // Red component of output color - static MObject aOutColorR; - - // Green component of output color - static MObject aOutColorG; - - // Blue component of output color - static MObject aOutColorB; - - // Output color - static MObject aOutColor; - - // Red component of output transparency - static MObject aOutTransR; - - // Green component of output transparency - static MObject aOutTransG; - - // Blue component of output transparency - static MObject aOutTransB; - - // Output transparency - static MObject aOutTransparency; - - // X component of surface normal - static MObject aNormalCameraX; - - // Y component of surface normal - static MObject aNormalCameraY; - - // Z component of surface normal - static MObject aNormalCameraZ; - - // Surface normal - static MObject aNormalCamera; - - // X component of light direction vector - static MObject aLightDirectionX; - - // Y component of light direction vector - static MObject aLightDirectionY; - - // Z component of light direction vector - static MObject aLightDirectionZ; - - // Light direction vector - static MObject aLightDirection; - - // Red component of light intensity - static MObject aLightIntensityR; - - // Green component of light intensity - static MObject aLightIntensityG; - - // Blue component of light intensity - static MObject aLightIntensityB; - - // Light Intensity vector - static MObject aLightIntensity; - - // Ambient flag - static MObject aLightAmbient; - - // Diffuse flag - static MObject aLightDiffuse; - - // Specular flag - static MObject aLightSpecular; - - // Shadow Fraction flag - static MObject aLightShadowFraction; - - // Pre Shadow Intensity - static MObject aPreShadowIntensity; - - // Light blind data - static MObject aLightBlindData; - - // Light data array - static MObject aLightData; - - // XRay data - static MObject xrEngineData; - static MObject xrCompilerData; - static MObject xrMaterialData; - static MObject xrDoubleSide; -}; - - -// IFF type ID -// Each node requires a unique identifier which is used by -// MFnDependencyNode::create() to identify which node to create, and by -// the Maya file format. -// -// For local testing of nodes you can use any identifier between -// 0x00000000 and 0x0007ffff, but for any node that you plan to use for -// more permanent purposes, you should get a universally unique id from -// Alias Support. You will be assigned a unique range that you -// can manage on your own. -// -MTypeId CXRayMtl::id( 0x00105440 ); - - -// the postConstructor() function is called immediately after the objects -// constructor. It is not safe to call MPxNode member functions from the -// constructor, instead they should be called here. -// -void CXRayMtl::postConstructor( ) -{ - // setMPSafe indicates that this shader can be used for multiprocessor - // rendering. For a shading node to be MP safe, it cannot access any - // shared global data and should only use attributes in the datablock - // to get input data and store output data. - // - setMPSafe( true ); -} - - -/////////////////////////////////////////////////////// -// DESCRIPTION: attribute information -/////////////////////////////////////////////////////// -// -MObject CXRayMtl::aTranslucenceCoeff; -MObject CXRayMtl::aDiffuseReflectivity; -MObject CXRayMtl::aInTransparency; -MObject CXRayMtl::aInTransR; -MObject CXRayMtl::aInTransG; -MObject CXRayMtl::aInTransB; -MObject CXRayMtl::aColor; -MObject CXRayMtl::aColorR; -MObject CXRayMtl::aColorG; -MObject CXRayMtl::aColorB; -MObject CXRayMtl::aIncandescence; -MObject CXRayMtl::aIncandescenceR; -MObject CXRayMtl::aIncandescenceG; -MObject CXRayMtl::aIncandescenceB; -MObject CXRayMtl::aOutColor; -MObject CXRayMtl::aOutColorR; -MObject CXRayMtl::aOutColorG; -MObject CXRayMtl::aOutColorB; -MObject CXRayMtl::aOutTransparency; -MObject CXRayMtl::aOutTransR; -MObject CXRayMtl::aOutTransG; -MObject CXRayMtl::aOutTransB; -MObject CXRayMtl::aNormalCamera; -MObject CXRayMtl::aNormalCameraX; -MObject CXRayMtl::aNormalCameraY; -MObject CXRayMtl::aNormalCameraZ; -MObject CXRayMtl::aLightData; -MObject CXRayMtl::aLightDirection; -MObject CXRayMtl::aLightDirectionX; -MObject CXRayMtl::aLightDirectionY; -MObject CXRayMtl::aLightDirectionZ; -MObject CXRayMtl::aLightIntensity; -MObject CXRayMtl::aLightIntensityR; -MObject CXRayMtl::aLightIntensityG; -MObject CXRayMtl::aLightIntensityB; -MObject CXRayMtl::aLightAmbient; -MObject CXRayMtl::aLightDiffuse; -MObject CXRayMtl::aLightSpecular; -MObject CXRayMtl::aLightShadowFraction; -MObject CXRayMtl::aPreShadowIntensity; -MObject CXRayMtl::aLightBlindData; - -// XRya data -MObject CXRayMtl::xrDoubleSide; -MObject CXRayMtl::xrEngineData; -MObject CXRayMtl::xrCompilerData; -MObject CXRayMtl::xrMaterialData; - - -// This node does not need to perform any special actions on creation or -// destruction -// - -CXRayMtl::CXRayMtl() {} -CXRayMtl::~CXRayMtl(){} - - -// The creator() method allows Maya to instantiate instances of this node. -// It is called every time a new instance of the node is requested by -// either the createNode command or the MFnDependencyNode::create() -// method. -// -// In this case creator simply returns a new CXRayMtl object. -// - -void* CXRayMtl::creator() -{ - return new CXRayMtl; -} - - -// The initialize method is called only once when the node is first -// registered with Maya. In this method you define the attributes of the -// node, what data comes in and goes out of the node that other nodes may -// want to connect to. -// - -#define MAKE_INPUT(attr) \ - CHECK_MSTATUS ( attr.setKeyable(true) ); \ - CHECK_MSTATUS ( attr.setStorable(true) ); \ - CHECK_MSTATUS ( attr.setReadable(true) ); \ - CHECK_MSTATUS ( attr.setWritable(true) ); - -extern unsigned crc16_calc(unsigned char *data, unsigned count, unsigned old_crc=0); - -MStatus CXRayMtl::initialize() -{ - MFnNumericAttribute nAttr; - MFnLightDataAttribute lAttr; - MFnEnumAttribute eAttr; - MFnTypedAttribute tAttr; - - MStatus status; // Status will be used to hold the MStatus value - // returned by each api function call. It is important - // to check the status returned by a call to aid in - // debugging. Failed API calls can result in subtle - // errors that can be difficult to track down, you may - // wish to use the CHECK_MSTATUS macro for any API - // call where you do not need to provide your own - // error handling. - // - - // Attribute Initialization: - // - // create - The create function creates a new attribute for the - // node, it takes a long name for the attribute, a short - // name for the attribute, the type of the attribute, - // and a status object to determine if the api call was - // successful. - // - // setKeyable - Sets whether this attribute should accept keyframe - // data, Attributes are not keyable by default. - // - // setStorable - Sets whether this attribute should be storable. If an - // attribute is storable, then it will be writen out - // when the node is stored to a file. Attributes are - // storable by default. - // - // setDefault - Sets the default value for this attribute. - // - // setUsedAsColor - Sets whether this attribute should be presented as - // a color in the UI. - // - // setHidden - Sets whether this attribute should be hidden from the - // UI. This is useful if the attribute is being used for - // blind data, or if it is being used as scratch space - // for a geometry calculation (should also be marked - // non-connectable in that case). Attributes are not - // hidden by default. - // - // setReadable - Sets whether this attribute should be readable. If an - // attribute is readable, then it can be used as the - // source in a dependency graph connection. Attributes - // are readable by default. - // - // setWritable - Sets whether this attribute should be readable. If an - // attribute is writable, then it can be used as the - // destination in a dependency graph connection. If an - // attribute is not writable then setAttr commands will - // fail to change the attribute. If both keyable and - // writable for an attribute are set to true it will be - // displayed in the channel box when the node is - // selected. Attributes are writable by default. - // - // setArray - Sets whether this attribute should have an array of - // data. This should be set to true if the attribute - // needs to accept multiple incoming connections. - // Attributes are single elements by default. - // - - - // Input Attributes - // - aTranslucenceCoeff = nAttr.create( "translucenceCoeff", "tc", - MFnNumericData::kFloat, 0, &status ); - CHECK_MSTATUS( status ); - CHECK_MSTATUS( nAttr.setKeyable( true ) ); - CHECK_MSTATUS( nAttr.setStorable( true ) ); - CHECK_MSTATUS( nAttr.setDefault( 0.0f ) ); - - aDiffuseReflectivity = nAttr.create( "diffuseReflectivity", "drfl", - MFnNumericData::kFloat, 0, &status ); - CHECK_MSTATUS( status ); - CHECK_MSTATUS( nAttr.setKeyable( true ) ); - CHECK_MSTATUS( nAttr.setStorable( true ) ); - CHECK_MSTATUS( nAttr.setDefault( 0.8f ) ); - - aColorR = nAttr.create( "colorR", "cr",MFnNumericData::kFloat, 0, - &status ); - CHECK_MSTATUS( status ); - CHECK_MSTATUS( nAttr.setKeyable( true ) ); - CHECK_MSTATUS( nAttr.setStorable( true ) ); - CHECK_MSTATUS( nAttr.setDefault( 0.0f ) ); - - aColorG = nAttr.create( "colorG", "cg", MFnNumericData::kFloat, 0, - &status ); - CHECK_MSTATUS( status ); - CHECK_MSTATUS( nAttr.setKeyable( true ) ); - CHECK_MSTATUS( nAttr.setStorable( true ) ); - CHECK_MSTATUS( nAttr.setDefault( 0.58824f ) ); - - aColorB = nAttr.create( "colorB", "cb",MFnNumericData::kFloat, 0, - &status ); - CHECK_MSTATUS( status ); - CHECK_MSTATUS( nAttr.setKeyable( true ) ); - CHECK_MSTATUS( nAttr.setStorable( true ) ); - CHECK_MSTATUS( nAttr.setDefault( 0.644f ) ); - - aColor = nAttr.create( "color", "c", aColorR, aColorG, aColorB, - &status ); - CHECK_MSTATUS( status ); - CHECK_MSTATUS( nAttr.setKeyable( true ) ); - CHECK_MSTATUS( nAttr.setStorable( true ) ); - CHECK_MSTATUS( nAttr.setDefault( 0.0f, 0.58824f, 0.644f ) ); - CHECK_MSTATUS( nAttr.setUsedAsColor( true ) ); - - aIncandescenceR = nAttr.create( "incandescenceR", "ir", - MFnNumericData::kFloat, 0, &status ); - CHECK_MSTATUS( status ); - CHECK_MSTATUS( nAttr.setKeyable( true ) ); - CHECK_MSTATUS( nAttr.setStorable( true ) ); - CHECK_MSTATUS( nAttr.setDefault( 0.0f ) ); - - aIncandescenceG = nAttr.create( "incandescenceG", "ig", - MFnNumericData::kFloat, 0, &status ); - CHECK_MSTATUS( status ); - CHECK_MSTATUS( nAttr.setKeyable( true ) ); - CHECK_MSTATUS( nAttr.setStorable( true ) ); - CHECK_MSTATUS( nAttr.setDefault( 0.0f ) ); - - aIncandescenceB = nAttr.create( "incandescenceB", "ib", - MFnNumericData::kFloat, 0, &status ); - CHECK_MSTATUS( status); - CHECK_MSTATUS( nAttr.setKeyable( true ) ); - CHECK_MSTATUS( nAttr.setStorable( true ) ); - CHECK_MSTATUS( nAttr.setDefault( 0.0f ) ); - - aIncandescence = nAttr.create( "incandescence", "ic", aIncandescenceR, - aIncandescenceG, aIncandescenceB, &status ); - CHECK_MSTATUS( status ); - CHECK_MSTATUS( nAttr.setKeyable( true ) ); - CHECK_MSTATUS( nAttr.setStorable( true ) ); - CHECK_MSTATUS( nAttr.setDefault( 0.0f, 0.0f, 0.0f ) ); - CHECK_MSTATUS( nAttr.setUsedAsColor( true ) ); - - aInTransR = nAttr.create( "transparencyR", "itr", - MFnNumericData::kFloat, 0, &status ); - CHECK_MSTATUS( status ); - CHECK_MSTATUS( nAttr.setKeyable( true ) ); - CHECK_MSTATUS( nAttr.setStorable( true ) ); - - aInTransG = nAttr.create( "transparencyG", "itg", - MFnNumericData::kFloat, 0, &status ); - CHECK_MSTATUS( status ); - CHECK_MSTATUS( nAttr.setKeyable( true ) ); - CHECK_MSTATUS( nAttr.setStorable( true ) ); - - aInTransB = nAttr.create( "transparencyB", "itb", - MFnNumericData::kFloat, 0, &status ); - CHECK_MSTATUS( status); - CHECK_MSTATUS( nAttr.setKeyable( true ) ); - CHECK_MSTATUS( nAttr.setStorable( true ) ); - - aInTransparency = nAttr.create( "transparency", "it", aInTransR, - aInTransG, aInTransB, &status ); - CHECK_MSTATUS( status ); - CHECK_MSTATUS( nAttr.setKeyable( true ) ); - CHECK_MSTATUS( nAttr.setStorable( true ) ); - CHECK_MSTATUS( nAttr.setDefault( 0.0f, 0.0f, 0.0f ) ); - CHECK_MSTATUS( nAttr.setUsedAsColor( true ) ); - - - // Output Attributes - // - - // Color Output - // - aOutColorR = nAttr.create( "outColorR", "ocr", MFnNumericData::kFloat, - 0, &status ); - CHECK_MSTATUS( status ); - - aOutColorG = nAttr.create( "outColorG", "ocg", MFnNumericData::kFloat, - 0, &status ); - CHECK_MSTATUS( status ); - - aOutColorB = nAttr.create( "outColorB", "ocb", MFnNumericData::kFloat, - 0, &status ); - CHECK_MSTATUS( status ); - - aOutColor = nAttr.create( "outColor", "oc", aOutColorR, aOutColorG, - aOutColorB, &status ); - CHECK_MSTATUS( status ); - - CHECK_MSTATUS( nAttr.setHidden( false ) ); - CHECK_MSTATUS( nAttr.setReadable( true ) ); - CHECK_MSTATUS( nAttr.setWritable( false ) ); - - - // Transparency Output - // - aOutTransR = nAttr.create( "outTransparencyR", "otr", - MFnNumericData::kFloat, 0, &status ); - CHECK_MSTATUS( status ); - - aOutTransG = nAttr.create( "outTransparencyG", "otg", - MFnNumericData::kFloat, 0, &status ); - CHECK_MSTATUS( status ); - - aOutTransB = nAttr.create( "outTransparencyB", "otb", - MFnNumericData::kFloat, 0, &status ); - CHECK_MSTATUS( status ); - - aOutTransparency = nAttr.create( "outTransparency", "ot", - aOutTransR,aOutTransG,aOutTransB, &status ); - CHECK_MSTATUS( status ); - - CHECK_MSTATUS( nAttr.setHidden( false ) ); - CHECK_MSTATUS( nAttr.setReadable( true ) ); - CHECK_MSTATUS( nAttr.setWritable( false ) ); - - - // Camera Normals - // - aNormalCameraX = nAttr.create( "normalCameraX", "nx", - MFnNumericData::kFloat, 0, &status ); - CHECK_MSTATUS( status ); - CHECK_MSTATUS( nAttr.setStorable( false ) ); - CHECK_MSTATUS( nAttr.setDefault( 1.0f ) ); - - aNormalCameraY = nAttr.create( "normalCameraY", "ny", - MFnNumericData::kFloat, 0, &status ); - CHECK_MSTATUS( status ); - CHECK_MSTATUS( nAttr.setStorable( false ) ); - CHECK_MSTATUS( nAttr.setDefault( 1.0f ) ); - - aNormalCameraZ = nAttr.create( "normalCameraZ", "nz", - MFnNumericData::kFloat, 0, &status ); - CHECK_MSTATUS( status ); - CHECK_MSTATUS( nAttr.setStorable( false ) ); - CHECK_MSTATUS( nAttr.setDefault( 1.0f ) ); - - aNormalCamera = nAttr.create( "normalCamera","n", aNormalCameraX, - aNormalCameraY, aNormalCameraZ, &status ); - CHECK_MSTATUS( status ); - CHECK_MSTATUS( nAttr.setStorable( false ) ); - CHECK_MSTATUS( nAttr.setDefault( 1.0f, 1.0f, 1.0f ) ); - CHECK_MSTATUS( nAttr.setHidden( true ) ); - - - // Light Direction - // - aLightDirectionX = nAttr.create( "lightDirectionX", "ldx", - MFnNumericData::kFloat, 0, &status ); - CHECK_MSTATUS( status ); - CHECK_MSTATUS ( nAttr.setStorable(false) ); - CHECK_MSTATUS ( nAttr.setHidden(true) ); - CHECK_MSTATUS ( nAttr.setReadable(true) ); - CHECK_MSTATUS ( nAttr.setWritable(false) ); - CHECK_MSTATUS( nAttr.setDefault( 1.0f ) ); - - aLightDirectionY = nAttr.create( "lightDirectionY", "ldy", - MFnNumericData::kFloat, 0, &status ); - CHECK_MSTATUS( status ); - CHECK_MSTATUS ( nAttr.setStorable(false) ); - CHECK_MSTATUS ( nAttr.setHidden(true) ); - CHECK_MSTATUS ( nAttr.setReadable(true) ); - CHECK_MSTATUS ( nAttr.setWritable(false) ); - CHECK_MSTATUS( nAttr.setDefault( 1.0f ) ); - - aLightDirectionZ = nAttr.create( "lightDirectionZ", "ldz", - MFnNumericData::kFloat, 0, &status ); - CHECK_MSTATUS( status ); - CHECK_MSTATUS ( nAttr.setStorable(false) ); - CHECK_MSTATUS ( nAttr.setHidden(true) ); - CHECK_MSTATUS ( nAttr.setReadable(true) ); - CHECK_MSTATUS ( nAttr.setWritable(false) ); - CHECK_MSTATUS( nAttr.setDefault( 1.0f ) ); - - aLightDirection = nAttr.create( "lightDirection", "ld", - aLightDirectionX, aLightDirectionY, aLightDirectionZ, - &status ); - CHECK_MSTATUS( status ); - CHECK_MSTATUS ( nAttr.setStorable(false) ); - CHECK_MSTATUS ( nAttr.setHidden(true) ); - CHECK_MSTATUS ( nAttr.setReadable(true) ); - CHECK_MSTATUS ( nAttr.setWritable(false) ); - CHECK_MSTATUS( nAttr.setDefault( 1.0f, 1.0f, 1.0f ) ); - - - // Light Intensity - // - aLightIntensityR = nAttr.create( "lightIntensityR", "lir", - MFnNumericData::kFloat, 0, &status ); - CHECK_MSTATUS( status ); - CHECK_MSTATUS ( nAttr.setStorable(false) ); - CHECK_MSTATUS ( nAttr.setHidden(true) ); - CHECK_MSTATUS ( nAttr.setReadable(true) ); - CHECK_MSTATUS ( nAttr.setWritable(false) ); - CHECK_MSTATUS( nAttr.setDefault( 1.0f ) ); - - aLightIntensityG = nAttr.create( "lightIntensityG", "lig", - MFnNumericData::kFloat, 0, &status ); - CHECK_MSTATUS( status ); - CHECK_MSTATUS ( nAttr.setStorable(false) ); - CHECK_MSTATUS ( nAttr.setHidden(true) ); - CHECK_MSTATUS ( nAttr.setReadable(true) ); - CHECK_MSTATUS ( nAttr.setWritable(false) ); - CHECK_MSTATUS( nAttr.setDefault( 1.0f ) ); - - aLightIntensityB = nAttr.create( "lightIntensityB", "lib", - MFnNumericData::kFloat, 0, &status ); - CHECK_MSTATUS( status ); - CHECK_MSTATUS ( nAttr.setStorable(false) ); - CHECK_MSTATUS ( nAttr.setHidden(true) ); - CHECK_MSTATUS ( nAttr.setReadable(true) ); - CHECK_MSTATUS ( nAttr.setWritable(false) ); - CHECK_MSTATUS( nAttr.setDefault( 1.0f ) ); - - aLightIntensity = nAttr.create( "lightIntensity", "li", - aLightIntensityR, aLightIntensityG, aLightIntensityB, - &status ); - CHECK_MSTATUS( status ); - CHECK_MSTATUS ( nAttr.setStorable(false) ); - CHECK_MSTATUS ( nAttr.setHidden(true) ); - CHECK_MSTATUS ( nAttr.setReadable(true) ); - CHECK_MSTATUS ( nAttr.setWritable(false) ); - CHECK_MSTATUS( nAttr.setDefault( 1.0f, 1.0f, 1.0f ) ); - - - // Light - // - aLightAmbient = nAttr.create( "lightAmbient", "la", - MFnNumericData::kBoolean, 0, &status ); - CHECK_MSTATUS( status ); - CHECK_MSTATUS ( nAttr.setStorable(false) ); - CHECK_MSTATUS ( nAttr.setHidden(true) ); - CHECK_MSTATUS ( nAttr.setReadable(true) ); - CHECK_MSTATUS ( nAttr.setWritable(false) ); - CHECK_MSTATUS( nAttr.setDefault( true ) ); - - aLightDiffuse = nAttr.create( "lightDiffuse", "ldf", - MFnNumericData::kBoolean, 0, &status ); - CHECK_MSTATUS( status ); - CHECK_MSTATUS ( nAttr.setStorable(false) ); - CHECK_MSTATUS ( nAttr.setHidden(true) ); - CHECK_MSTATUS ( nAttr.setReadable(true) ); - CHECK_MSTATUS ( nAttr.setWritable(false) ); - CHECK_MSTATUS( nAttr.setDefault( true ) ); - - aLightSpecular = nAttr.create( "lightSpecular", "ls", - MFnNumericData::kBoolean, 0, &status ); - CHECK_MSTATUS( status ); - CHECK_MSTATUS ( nAttr.setStorable(false) ); - CHECK_MSTATUS ( nAttr.setHidden(true) ); - CHECK_MSTATUS ( nAttr.setReadable(true) ); - CHECK_MSTATUS ( nAttr.setWritable(false) ); - CHECK_MSTATUS( nAttr.setDefault( false ) ); - - aLightShadowFraction = nAttr.create( "lightShadowFraction", "lsf", - MFnNumericData::kFloat, 0, &status ); - CHECK_MSTATUS( status ); - CHECK_MSTATUS ( nAttr.setStorable(false) ); - CHECK_MSTATUS ( nAttr.setHidden(true) ); - CHECK_MSTATUS ( nAttr.setReadable(true) ); - CHECK_MSTATUS ( nAttr.setWritable(false) ); - CHECK_MSTATUS( nAttr.setDefault( 1.0f ) ); - - aPreShadowIntensity = nAttr.create( "preShadowIntensity", "psi", - MFnNumericData::kFloat, 0, &status ); - CHECK_MSTATUS( status ); - CHECK_MSTATUS ( nAttr.setStorable(false) ); - CHECK_MSTATUS ( nAttr.setHidden(true) ); - CHECK_MSTATUS ( nAttr.setReadable(true) ); - CHECK_MSTATUS ( nAttr.setWritable(false) ); - CHECK_MSTATUS( nAttr.setDefault( 1.0f ) ); - - aLightBlindData = nAttr.createAddr("lightBlindData", "lbld", - &status ); - CHECK_MSTATUS( status ); - CHECK_MSTATUS ( nAttr.setStorable(false) ); - CHECK_MSTATUS ( nAttr.setHidden(true) ); - CHECK_MSTATUS ( nAttr.setReadable(true) ); - CHECK_MSTATUS ( nAttr.setWritable(false) ); - - aLightData = lAttr.create( "lightDataArray", "ltd", aLightDirection, - aLightIntensity, aLightAmbient, aLightDiffuse, aLightSpecular, - aLightShadowFraction, aPreShadowIntensity, aLightBlindData, - &status ); - CHECK_MSTATUS( status ); - CHECK_MSTATUS( lAttr.setArray( true ) ); - CHECK_MSTATUS( lAttr.setStorable( false ) ); - CHECK_MSTATUS( lAttr.setHidden( true ) ); - CHECK_MSTATUS( lAttr.setDefault( 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, - true, true, false, 1.0f, 1.0f, NULL ) ); - - - // Next we will add the attributes we have defined to the node - // - CHECK_MSTATUS( addAttribute( aTranslucenceCoeff ) ); - CHECK_MSTATUS( addAttribute( aDiffuseReflectivity ) ); - CHECK_MSTATUS( addAttribute( aColor ) ); - CHECK_MSTATUS( addAttribute( aIncandescence ) ); - CHECK_MSTATUS( addAttribute( aInTransparency ) ); - CHECK_MSTATUS( addAttribute( aOutColor ) ); - CHECK_MSTATUS( addAttribute( aOutTransparency ) ); - CHECK_MSTATUS( addAttribute( aNormalCamera ) ); - - // Only add the parent of the compound - CHECK_MSTATUS( addAttribute( aLightData ) ); - - // The attributeAffects() method is used to indicate when the input - // attribute affects the output attribute. This knowledge allows Maya - // to optimize dependencies in the graph in more complex nodes where - // there may be several inputs and outputs, but not all the inputs - // affect all the outputs. - // - CHECK_MSTATUS( attributeAffects( aTranslucenceCoeff, aOutColor ) ); - CHECK_MSTATUS( attributeAffects( aDiffuseReflectivity, aOutColor ) ); - CHECK_MSTATUS( attributeAffects( aColorR, aOutColor ) ); - CHECK_MSTATUS( attributeAffects( aColorG, aOutColor ) ); - CHECK_MSTATUS( attributeAffects( aColorB, aOutColor ) ); - CHECK_MSTATUS( attributeAffects( aColor, aOutColor ) ); - CHECK_MSTATUS( attributeAffects( aInTransR, aOutTransparency ) ); - CHECK_MSTATUS( attributeAffects( aInTransG, aOutTransparency ) ); - CHECK_MSTATUS( attributeAffects( aInTransB, aOutTransparency ) ); - CHECK_MSTATUS( attributeAffects( aInTransparency, aOutTransparency ) ); - CHECK_MSTATUS( attributeAffects( aInTransparency, aOutColor ) ); - CHECK_MSTATUS( attributeAffects( aIncandescenceR, aOutColor ) ); - CHECK_MSTATUS( attributeAffects( aIncandescenceG, aOutColor ) ); - CHECK_MSTATUS( attributeAffects( aIncandescenceB, aOutColor ) ); - CHECK_MSTATUS( attributeAffects( aIncandescence, aOutColor ) ); - CHECK_MSTATUS( attributeAffects( aLightIntensityR, aOutColor ) ); - CHECK_MSTATUS( attributeAffects( aLightIntensityB, aOutColor ) ); - CHECK_MSTATUS( attributeAffects( aLightIntensityG, aOutColor ) ); - CHECK_MSTATUS( attributeAffects( aLightIntensity, aOutColor ) ); - CHECK_MSTATUS( attributeAffects( aNormalCameraX, aOutColor ) ); - CHECK_MSTATUS( attributeAffects( aNormalCameraY, aOutColor ) ); - CHECK_MSTATUS( attributeAffects( aNormalCameraZ, aOutColor ) ); - CHECK_MSTATUS( attributeAffects( aNormalCamera, aOutColor ) ); - CHECK_MSTATUS( attributeAffects( aLightDirectionX, aOutColor ) ); - CHECK_MSTATUS( attributeAffects( aLightDirectionY, aOutColor ) ); - CHECK_MSTATUS( attributeAffects( aLightDirectionZ, aOutColor ) ); - CHECK_MSTATUS( attributeAffects( aLightDirection, aOutColor ) ); - CHECK_MSTATUS( attributeAffects( aLightAmbient, aOutColor ) ); - CHECK_MSTATUS( attributeAffects( aLightSpecular, aOutColor ) ); - CHECK_MSTATUS( attributeAffects( aLightDiffuse, aOutColor ) ); - CHECK_MSTATUS( attributeAffects( aLightShadowFraction, aOutColor ) ); - CHECK_MSTATUS( attributeAffects( aPreShadowIntensity, aOutColor ) ); - CHECK_MSTATUS( attributeAffects( aLightBlindData, aOutColor ) ); - CHECK_MSTATUS( attributeAffects( aLightData, aOutColor ) ); - - // loading x-ray part - xrDoubleSide = nAttr.create( "xrayDoubleSide", "xrd", MFnNumericData::kBoolean, 0, &status ); - MAKE_INPUT(nAttr); - - LPSTRVec lst; - LPSTRIt it; - - xrEngineData = eAttr.create( "xrayEngineShader", "xre"); - MAKE_INPUT(eAttr); - LoadBlenderList(lst); - for (it=lst.begin(); it!=lst.end(); it++) - { - _ChangeSymbol(*it,'\\','/'); - CHECK_MSTATUS (eAttr.addField(*it,crc16_calc((u8*)*it,xr_strlen(*it)))); - } -#if MAYA_API_VERSION > 450 - CHECK_MSTATUS ( eAttr.setDefault(eAttr.fieldIndex("default"))); -#else -#endif - ClearList(lst); - - xrCompilerData = eAttr.create( "xrayCompilerShader", "xrc"); - MAKE_INPUT(eAttr); - LoadShaderLCList(lst); - for (it=lst.begin(); it!=lst.end(); it++){ - _ChangeSymbol(*it,'\\','/'); - CHECK_MSTATUS (eAttr.addField(*it,crc16_calc((u8*)*it,xr_strlen(*it)))); - } -#if MAYA_API_VERSION > 450 - CHECK_MSTATUS ( eAttr.setDefault(eAttr.fieldIndex("default"))); -#else -#endif - ClearList(lst); - - xrMaterialData = eAttr.create( "xrayGameMaterial", " "); - MAKE_INPUT(eAttr); - LoadGameMtlList(lst); - for (it=lst.begin(); it!=lst.end(); it++) - { - _ChangeSymbol(*it,'\\','/'); - CHECK_MSTATUS (eAttr.addField(*it,crc16_calc((u8*)*it,xr_strlen(*it)))); - } -#if MAYA_API_VERSION > 450 - CHECK_MSTATUS ( eAttr.setDefault(eAttr.fieldIndex("default"))); -#else -#endif - ClearList(lst); - - CHECK_MSTATUS ( addAttribute(xrDoubleSide) ); - CHECK_MSTATUS ( addAttribute(xrEngineData) ); - CHECK_MSTATUS ( addAttribute(xrCompilerData) ); - CHECK_MSTATUS ( addAttribute(xrMaterialData) ); - // end x-ray part - - return( MS::kSuccess ); -} - -// The compute() method does the actual work of the node using the inputs -// of the node to generate its output. -// -// Compute takes two parameters: plug and data. -// - Plug is the the data value that needs to be recomputed -// - Data provides handles to all of the nodes attributes, only these -// handles should be used when performing computations. -// -MStatus CXRayMtl::compute( const MPlug& plug, MDataBlock& block ) -{ - // The plug parameter will allow us to determine which output attribute - // needs to be calculated. - // - if( plug == aOutColor - || plug == aOutColorR - || plug == aOutColorG - || plug == aOutColorB - || plug == aOutTransparency - || plug == aOutTransR - || plug == aOutTransG - || plug == aOutTransB ) - { - MStatus status; - MFloatVector resultColor( 0.0, 0.0, 0.0 ); - - - // Get surface shading parameters from input block - // - MFloatVector& surfaceNormal = block.inputValue( aNormalCamera, - &status ).asFloatVector(); - CHECK_MSTATUS( status ); - - MFloatVector& surfaceColor = block.inputValue( aColor, - &status ).asFloatVector(); - CHECK_MSTATUS( status ); - - MFloatVector& incandescence = block.inputValue( aIncandescence, - &status ).asFloatVector(); - CHECK_MSTATUS( status ); - - float diffuseReflectivity = block.inputValue( - aDiffuseReflectivity, &status ).asFloat(); - CHECK_MSTATUS( status ); - -// float translucenceCoeff = block.inputValue( aTranslucenceCoeff, -// &status ).asFloat(); -// CHECK_MSTATUS( status ); - - - // Get light list - // - MArrayDataHandle lightData = block.inputArrayValue( aLightData, - &status ); - CHECK_MSTATUS( status ); - - int numLights = lightData.elementCount( &status ); - CHECK_MSTATUS( status ); - - - // Calculate the effect of the lights in the scene on the color - // - - // Iterate through light list and get ambient/diffuse values - // - for( int count=1; count <= numLights; count++ ) - { - // Get the current light out of the array - // - MDataHandle currentLight = lightData.inputValue( &status ); - CHECK_MSTATUS( status ); - - - // Get the intensity of that light - // - MFloatVector& lightIntensity = currentLight.child( - aLightIntensity ).asFloatVector(); - - - // Find ambient component - // - if ( currentLight.child( aLightAmbient ).asBool() ) - { - resultColor += lightIntensity; - } - - - // Find diffuse component - // - if ( currentLight.child( aLightDiffuse ).asBool() ) - { - MFloatVector& lightDirection = currentLight.child( - aLightDirection ).asFloatVector(); - float cosln = lightDirection * surfaceNormal; - - if ( cosln > 0.0f ) { - resultColor += lightIntensity - * ( cosln * diffuseReflectivity ); - } - } - - - // Advance to the next light. - // - if ( count < numLights ) { - status = lightData.next(); - CHECK_MSTATUS( status ); - } - } - - - // Factor incident light with surface color and add incandescence - // - resultColor[0] = resultColor[0] * surfaceColor[0] + incandescence[0]; - resultColor[1] = resultColor[1] * surfaceColor[1] + incandescence[1]; - resultColor[2] = resultColor[2] * surfaceColor[2] + incandescence[2]; - - - // Set ouput color attribute - // - if ( plug == aOutColor || plug == aOutColorR || plug == aOutColorG - || plug == aOutColorB) - { - // Get the handle to the attribute - // - MDataHandle outColorHandle = block.outputValue( aOutColor, - &status ); - CHECK_MSTATUS( status ); - MFloatVector& outColor = outColorHandle.asFloatVector(); - - outColor = resultColor; // Set the output value - outColorHandle.setClean(); // Mark the output value as clean - } - - - // Set ouput transparency - // - if ( plug == aOutTransparency || plug == aOutTransR - || plug == aOutTransG || plug == aOutTransB ) - { - MFloatVector& transparency = block.inputValue( - aInTransparency, &status ).asFloatVector(); - CHECK_MSTATUS( status ); - - - // Get the handle to the attribute - // - MDataHandle outTransHandle = block.outputValue( - aOutTransparency, &status ); - CHECK_MSTATUS( status ); - MFloatVector& outTrans = outTransHandle.asFloatVector(); - - outTrans = transparency; // Set the output value - outTransHandle.setClean(); // Mark the output value as clean - } - } - else - { - return( MS::kUnknownParameter ); // We got an unexpected plug - } - - return( MS::kSuccess ); -} - - -MStatus uninitializePlugin( MObject obj ) -{ - const MString UserClassify( "shader/surface" ); - - MString command( "if( `window -exists createRenderNodeWindow` ) {refreshCreateRenderNodeWindow(\"" ); - - MFnPlugin plugin( obj ); - - CHECK_MSTATUS( plugin.deregisterNode( CXRayMtl::id ) ); - - command += UserClassify; - command += "\");}\n"; - - CHECK_MSTATUS( MGlobal::executeCommand( command ) ); - - Core._destroy(); - - return MS::kSuccess; -} - -static MObject INIT_OBJ=MObject::kNullObj; - -void uninitialize(void*) -{ - if (!INIT_OBJ.isNull()){ - uninitializePlugin(INIT_OBJ); - INIT_OBJ=MObject::kNullObj; - } - Core._destroy(); -} - -// These methods load and unload the plugin, registerNode registers the -// new node type with maya -// -MStatus initializePlugin( MObject obj ) -{ - INIT_OBJ = obj; - const MString UserClassify( "shader/surface" ); - - Core._initialize("XRayMayaPlugin",ELogCallback,FALSE); - FS._initialize (CLocatorAPI::flScanAppRoot,NULL,"xray_path.ltx"); - R_ASSERT2(0!=Memory.mem_fill,"Incorrect xrCore.dll version."); - - MString command( "if( `window -exists createRenderNodeWindow` ) {refreshCreateRenderNodeWindow(\"" ); - - MFnPlugin plugin( obj, "GSC Game World", "1.00", "Any"); - - CHECK_MSTATUS( plugin.registerNode( "XRayMtl", CXRayMtl::id, - CXRayMtl::creator, CXRayMtl::initialize, MPxNode::kDependNode, - &UserClassify ) ); - - command += UserClassify; - - command += "\");}\n"; - - CHECK_MSTATUS( MGlobal::executeCommand( command ) ); - - // add callbacks -// MSceneMessage::addCallback(MSceneMessage::kMayaExiting, uninitialize, 0); - - return( MS::kSuccess ); -} - diff --git a/cs/engine/plugins/Maya/Material/phongShader.cpp b/cs/engine/plugins/Maya/Material/phongShader.cpp deleted file mode 100644 index 8c8b7c5c6..000000000 --- a/cs/engine/plugins/Maya/Material/phongShader.cpp +++ /dev/null @@ -1,620 +0,0 @@ -#include "stdafx.h" -using namespace std; - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// add for raytracing api enhancement -#include -#include - -#include "BlenderListLoader.h" -// -// DESCRIPTION: -/////////////////////////////////////////////////////// -class CXRayMtl : public MPxNode -{ - public: - CXRayMtl(); - virtual ~CXRayMtl(); - - virtual MStatus compute( const MPlug&, MDataBlock& ); - - virtual void postConstructor(); - - static void * creator(); - static MStatus initialize(); - static MTypeId id; - - private: - static MObject aColor; - static MObject aTranslucenceCoeff; - static MObject aDiffuseReflectivity; - static MObject aIncandescence; - static MObject aPointCamera; - static MObject aNormalCamera; - static MObject aLightDirection; - static MObject aLightIntensity; - static MObject aPower; - static MObject aSpecularity; - static MObject aLightAmbient; - static MObject aLightDiffuse; - static MObject aLightSpecular; - static MObject aLightShadowFraction; - static MObject aPreShadowIntensity; - static MObject aLightBlindData; - static MObject aLightData; - - static MObject aXREngineData; - static MObject aXRCompilerData; - static MObject aXRMaterialData; - - static MObject aRayOrigin; - static MObject aRayDirection; - - static MObject aObjectId; - static MObject aRaySampler; - static MObject aRayDepth; - - static MObject aReflectGain; - - static MObject aTriangleNormalCamera; - - static MObject aOutColor; - -}; - -// Static data -MTypeId CXRayMtl::id( 0x81001 ); - -// Attributes -MObject CXRayMtl::aColor; -MObject CXRayMtl::aTranslucenceCoeff; -MObject CXRayMtl::aDiffuseReflectivity; -MObject CXRayMtl::aIncandescence; -MObject CXRayMtl::aOutColor; -MObject CXRayMtl::aPointCamera; -MObject CXRayMtl::aNormalCamera; -MObject CXRayMtl::aLightData; - -MObject CXRayMtl::aXREngineData; -MObject CXRayMtl::aXRCompilerData; -MObject CXRayMtl::aXRMaterialData; - -MObject CXRayMtl::aLightDirection; -MObject CXRayMtl::aLightIntensity; -MObject CXRayMtl::aLightAmbient; -MObject CXRayMtl::aLightDiffuse; -MObject CXRayMtl::aLightSpecular; -MObject CXRayMtl::aLightShadowFraction; -MObject CXRayMtl::aPreShadowIntensity; -MObject CXRayMtl::aLightBlindData; -MObject CXRayMtl::aPower; -MObject CXRayMtl::aSpecularity; - -MObject CXRayMtl::aRayOrigin; -MObject CXRayMtl::aRayDirection; -MObject CXRayMtl::aObjectId; -MObject CXRayMtl::aRaySampler; -MObject CXRayMtl::aRayDepth; - -MObject CXRayMtl::aReflectGain; - -MObject CXRayMtl::aTriangleNormalCamera; - -#define MAKE_INPUT(attr) \ - CHECK_MSTATUS ( attr.setKeyable(true) ); \ - CHECK_MSTATUS ( attr.setStorable(true) ); \ - CHECK_MSTATUS ( attr.setReadable(true) ); \ - CHECK_MSTATUS ( attr.setWritable(true) ); - -#define MAKE_OUTPUT(attr) \ - CHECK_MSTATUS ( attr.setKeyable(false) ) ; \ - CHECK_MSTATUS ( attr.setStorable(false) ); \ - CHECK_MSTATUS ( attr.setReadable(true) ) ; \ - CHECK_MSTATUS ( attr.setWritable(false) ); - -// -// DESCRIPTION: -/////////////////////////////////////////////////////// -void CXRayMtl::postConstructor( ) -{ - setMPSafe(true); -} - -// -// DESCRIPTION: -/////////////////////////////////////////////////////// -CXRayMtl::CXRayMtl() -{ -} - -// -// DESCRIPTION: -/////////////////////////////////////////////////////// -CXRayMtl::~CXRayMtl() -{ -} - -// -// DESCRIPTION: -/////////////////////////////////////////////////////// -void * CXRayMtl::creator() -{ - Core._initialize("XRayPlugin",ELogCallback,"\\\\X-Ray\\stalker$\\"); - - return new CXRayMtl(); -} - -// -// DESCRIPTION: -/////////////////////////////////////////////////////// -MStatus CXRayMtl::initialize() -{ - MFnNumericAttribute nAttr; - MFnLightDataAttribute lAttr; - MFnEnumAttribute eAttr; -/* - // loading x-ray part - LPSTRVec lst; - LPSTRIt it; - int k=0; - aXREngineData = eAttr.create( "engineShader", "xre"); - MAKE_INPUT(eAttr); - LoadBlenderList(lst); - for (it=lst.begin(); it!=lst.end(); it++){ - _ChangeSymbol(*it,'\\','/'); - CHECK_MSTATUS (eAttr.addField(*it,it-lst.begin())); - } - ClearList(lst); - - aXRCompilerData = eAttr.create( "compilerShader", "xrc"); - MAKE_INPUT(eAttr); - LoadShaderLCList(lst); - for (it=lst.begin(); it!=lst.end(); it++){ - _ChangeSymbol(*it,'\\','/'); - CHECK_MSTATUS (eAttr.addField(*it,it-lst.begin())); - } - ClearList(lst); - - aXRMaterialData = eAttr.create( "gameMaterial", "xrm"); - MAKE_INPUT(eAttr); - LoadGameMtlList(lst); - for (it=lst.begin(); it!=lst.end(); it++){ - _ChangeSymbol(*it,'\\','/'); - CHECK_MSTATUS (eAttr.addField(*it,it-lst.begin())); - } - ClearList(lst); - // end x-ray part -*/ - aTranslucenceCoeff = nAttr.create("translucenceCoeff", "tc", - MFnNumericData::kFloat); - MAKE_INPUT(nAttr); - - aDiffuseReflectivity = nAttr.create("diffuseReflectivity", "drfl", - MFnNumericData::kFloat); - MAKE_INPUT(nAttr); - CHECK_MSTATUS ( nAttr.setDefault(0.8f) ); - - aColor = nAttr.createColor( "color", "c" ); - MAKE_INPUT(nAttr); - CHECK_MSTATUS ( nAttr.setDefault(0.0f, 0.58824f, 0.644f) ); - - aIncandescence = nAttr.createColor( "incandescence", "ic" ); - MAKE_INPUT(nAttr); - - aOutColor = nAttr.createColor( "outColor", "oc" ); - MAKE_OUTPUT(nAttr); - - aPointCamera = nAttr.createPoint( "pointCamera", "pc" ); - MAKE_INPUT(nAttr); - CHECK_MSTATUS ( nAttr.setDefault(1.0f, 1.0f, 1.0f) ); - CHECK_MSTATUS ( nAttr.setHidden(true) ); - - aPower = nAttr.create( "power", "pow", MFnNumericData::kFloat); - MAKE_INPUT(nAttr); - CHECK_MSTATUS ( nAttr.setMin(0.0f) ); - CHECK_MSTATUS ( nAttr.setMax(200.0f) ); - CHECK_MSTATUS ( nAttr.setDefault(10.0f) ); - - aSpecularity = nAttr.create( "specularity", "spc", MFnNumericData::kFloat); - MAKE_INPUT(nAttr); - CHECK_MSTATUS ( nAttr.setMin(0.0f) ); - CHECK_MSTATUS ( nAttr.setMax(1.0f) ) ; - CHECK_MSTATUS ( nAttr.setDefault(0.5f) ); - - aReflectGain = nAttr.create( "reflectionGain", "rg", MFnNumericData::kFloat); - MAKE_INPUT(nAttr); - CHECK_MSTATUS ( nAttr.setMin(0.0f) ); - CHECK_MSTATUS ( nAttr.setMax(1.0f) ); - CHECK_MSTATUS ( nAttr.setDefault(0.5f) ); - - aNormalCamera = nAttr.createPoint( "normalCamera", "n" ); - MAKE_INPUT(nAttr); - CHECK_MSTATUS ( nAttr.setDefault(1.0f, 1.0f, 1.0f) ); - CHECK_MSTATUS ( nAttr.setHidden(true) ); - - aTriangleNormalCamera = nAttr.createPoint( "triangleNormalCamera", "tn" ); - MAKE_INPUT(nAttr); - CHECK_MSTATUS ( nAttr.setDefault(1.0f, 1.0f, 1.0f)); - CHECK_MSTATUS ( nAttr.setHidden(true)); - - aLightDirection = nAttr.createPoint( "lightDirection", "ld" ); - MAKE_INPUT(nAttr); - CHECK_MSTATUS ( nAttr.setDefault(1.0f, 1.0f, 1.0f) ); - CHECK_MSTATUS ( nAttr.setHidden(true) ); - - aLightIntensity = nAttr.createColor( "lightIntensity", "li" ); - MAKE_INPUT(nAttr); - CHECK_MSTATUS ( nAttr.setDefault(1.0f, 1.0f, 1.0f) ); - CHECK_MSTATUS ( nAttr.setHidden(true) ); - - aLightAmbient = nAttr.create( "lightAmbient", "la", - MFnNumericData::kBoolean); - MAKE_INPUT(nAttr); - CHECK_MSTATUS ( nAttr.setHidden(true) ); - - aLightDiffuse = nAttr.create( "lightDiffuse", "ldf", - MFnNumericData::kBoolean); - MAKE_INPUT(nAttr); - CHECK_MSTATUS ( nAttr.setHidden(true) ); - - aLightSpecular = nAttr.create( "lightSpecular", "ls", - MFnNumericData::kBoolean); - MAKE_INPUT(nAttr); - CHECK_MSTATUS ( nAttr.setHidden(true) ); - - aLightShadowFraction = nAttr.create("lightShadowFraction", "lsf", - MFnNumericData::kFloat); - MAKE_INPUT(nAttr); - CHECK_MSTATUS ( nAttr.setHidden(true) ); - - aPreShadowIntensity = nAttr.create("preShadowIntensity", "psi", - MFnNumericData::kFloat); - MAKE_INPUT(nAttr); - CHECK_MSTATUS ( nAttr.setHidden(true) ); - - aLightBlindData = nAttr.create("lightBlindData", "lbld", - MFnNumericData::kLong); - MAKE_INPUT(nAttr); - CHECK_MSTATUS ( nAttr.setHidden(true) ); - - aLightData = lAttr.create( "lightDataArray", "ltd", - aLightDirection, aLightIntensity, aLightAmbient, - aLightDiffuse, aLightSpecular, - aLightShadowFraction, - aPreShadowIntensity, - aLightBlindData); - CHECK_MSTATUS ( lAttr.setArray(true) ); - CHECK_MSTATUS ( lAttr.setStorable(false) ); - CHECK_MSTATUS ( lAttr.setHidden(true) ); - CHECK_MSTATUS ( lAttr.setDefault(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, true, true, - false, 0.0f, 1.0f, 0) ); - - // rayOrigin - MObject RayX = nAttr.create( "rayOx", "rxo", MFnNumericData::kFloat, 0.0 ); - MObject RayY = nAttr.create( "rayOy", "ryo", MFnNumericData::kFloat, 0.0 ); - MObject RayZ = nAttr.create( "rayOz", "rzo", MFnNumericData::kFloat, 0.0 ); - aRayOrigin = nAttr.create( "rayOrigin", "rog", RayX, RayY, RayZ ); - CHECK_MSTATUS ( nAttr.setStorable(false) ); - CHECK_MSTATUS ( nAttr.setHidden(true) ); - CHECK_MSTATUS ( nAttr.setReadable(false) ); - - // rayDirection - RayX = nAttr.create( "rayDirectionX", "rdx", MFnNumericData::kFloat, 1.0 ); - RayY = nAttr.create( "rayDirectionY", "rdy", MFnNumericData::kFloat, 0.0 ); - RayZ = nAttr.create( "rayDirectionZ", "rdz", MFnNumericData::kFloat, 0.0 ); - aRayDirection = nAttr.create( "rayDirection", "rad", RayX, RayY, RayZ ); - CHECK_MSTATUS ( nAttr.setStorable(false) ); - CHECK_MSTATUS ( nAttr.setHidden(true) ); - CHECK_MSTATUS ( nAttr.setReadable(false) ); - - // objectId - aObjectId = nAttr.create( "objectId", "oi", MFnNumericData::kLong, 0.0 ); - CHECK_MSTATUS ( nAttr.setStorable(false) ); - CHECK_MSTATUS ( nAttr.setHidden(true) ); - CHECK_MSTATUS ( nAttr.setReadable(false) ); - - // raySampler - aRaySampler = nAttr.create("raySampler", "rtr", MFnNumericData::kLong,0.0); - CHECK_MSTATUS ( nAttr.setStorable(false)); - CHECK_MSTATUS ( nAttr.setHidden(true) ); - CHECK_MSTATUS ( nAttr.setReadable(false) ); - - // rayDepth - aRayDepth = nAttr.create( "rayDepth", "rd", MFnNumericData::kShort, 0.0 ); - CHECK_MSTATUS ( nAttr.setStorable(false) ); - CHECK_MSTATUS (nAttr.setHidden(true) ) ; - CHECK_MSTATUS ( nAttr.setReadable(false) ); - - CHECK_MSTATUS ( addAttribute(aXREngineData) ); - CHECK_MSTATUS ( addAttribute(aXRCompilerData) ); - CHECK_MSTATUS ( addAttribute(aXRMaterialData) ); - - CHECK_MSTATUS ( addAttribute(aTranslucenceCoeff) ); - CHECK_MSTATUS ( addAttribute(aDiffuseReflectivity) ); - CHECK_MSTATUS ( addAttribute(aColor) ); - CHECK_MSTATUS ( addAttribute(aIncandescence) ); - CHECK_MSTATUS ( addAttribute(aPointCamera) ); - CHECK_MSTATUS ( addAttribute(aNormalCamera) ); - CHECK_MSTATUS ( addAttribute(aTriangleNormalCamera) ); - - CHECK_MSTATUS ( addAttribute(aLightData) ); - - CHECK_MSTATUS ( addAttribute(aPower) ); - CHECK_MSTATUS ( addAttribute(aSpecularity) ); - CHECK_MSTATUS ( addAttribute(aOutColor) ); - - CHECK_MSTATUS ( addAttribute(aRayOrigin) ); - CHECK_MSTATUS ( addAttribute(aRayDirection) ); - CHECK_MSTATUS ( addAttribute(aObjectId) ); - CHECK_MSTATUS ( addAttribute(aRaySampler) ); - CHECK_MSTATUS ( addAttribute(aRayDepth) ); - CHECK_MSTATUS ( addAttribute(aReflectGain) ); - - CHECK_MSTATUS ( attributeAffects (aXREngineData, aXREngineData)); - CHECK_MSTATUS ( attributeAffects (aXRCompilerData, aXRCompilerData)); - CHECK_MSTATUS ( attributeAffects (aXRMaterialData, aXRMaterialData)); - - CHECK_MSTATUS ( attributeAffects (aTranslucenceCoeff, aOutColor)); - CHECK_MSTATUS ( attributeAffects (aDiffuseReflectivity, aOutColor)); - CHECK_MSTATUS ( attributeAffects (aLightIntensity, aOutColor)); - CHECK_MSTATUS ( attributeAffects (aIncandescence, aOutColor)); - CHECK_MSTATUS ( attributeAffects (aPointCamera, aOutColor)); - CHECK_MSTATUS ( attributeAffects (aNormalCamera, aOutColor)); - CHECK_MSTATUS ( attributeAffects (aTriangleNormalCamera, aOutColor)); - CHECK_MSTATUS ( attributeAffects (aLightData, aOutColor)); - CHECK_MSTATUS ( attributeAffects (aLightAmbient, aOutColor)); - CHECK_MSTATUS ( attributeAffects (aLightSpecular, aOutColor)); - CHECK_MSTATUS ( attributeAffects (aLightDiffuse, aOutColor)); - CHECK_MSTATUS ( attributeAffects (aLightDirection, aOutColor)); - CHECK_MSTATUS ( attributeAffects (aLightShadowFraction, aOutColor)); - CHECK_MSTATUS ( attributeAffects (aPreShadowIntensity, aOutColor)); - CHECK_MSTATUS ( attributeAffects (aLightBlindData, aOutColor)); - CHECK_MSTATUS ( attributeAffects (aPower, aOutColor)); - CHECK_MSTATUS ( attributeAffects (aSpecularity, aOutColor)); - CHECK_MSTATUS ( attributeAffects (aColor, aOutColor)); - - CHECK_MSTATUS ( attributeAffects (aRayOrigin,aOutColor)); - CHECK_MSTATUS ( attributeAffects (aRayDirection,aOutColor)); - CHECK_MSTATUS ( attributeAffects (aObjectId,aOutColor)); - CHECK_MSTATUS ( attributeAffects (aRaySampler,aOutColor)); - CHECK_MSTATUS ( attributeAffects (aRayDepth,aOutColor)); - CHECK_MSTATUS ( attributeAffects (aReflectGain,aOutColor) ); - - return MS::kSuccess; -} - - -// -// DESCRIPTION: -/////////////////////////////////////////////////////// -MStatus CXRayMtl::compute( -const MPlug& plug, - MDataBlock& block ) -{ - if ((plug != aOutColor) && (plug.parent() != aOutColor)) - return MS::kUnknownParameter; - - MFloatVector resultColor(0.0,0.0,0.0); - - // get sample surface shading parameters - MFloatVector& surfaceNormal = block.inputValue( aNormalCamera ).asFloatVector(); - MFloatVector& cameraPosition = block.inputValue( aPointCamera ).asFloatVector(); - - // use for raytracing api enhancement below - MFloatVector point = cameraPosition; - MFloatVector normal = surfaceNormal; - - MFloatVector& surfaceColor = block.inputValue( aColor ).asFloatVector(); - MFloatVector& incandescence = block.inputValue( aIncandescence ).asFloatVector(); - float diffuseReflectivity = block.inputValue( aDiffuseReflectivity ).asFloat(); - // float translucenceCoeff = block.inputValue( aTranslucenceCoeff ).asFloat(); - // User-defined Reflection Color Gain - float reflectGain = block.inputValue( aReflectGain ).asFloat(); - - // Phong shading attributes - float power = block.inputValue( aPower ).asFloat(); - float spec = block.inputValue( aSpecularity ).asFloat(); - - float specularR, specularG, specularB; - float diffuseR, diffuseG, diffuseB; - diffuseR = diffuseG = diffuseB = specularR = specularG = specularB = 0.0; - - // get light list - MArrayDataHandle lightData = block.inputArrayValue( aLightData ); - int numLights = lightData.elementCount(); - - // iterate through light list and get ambient/diffuse values - for( int count=1; count <= numLights; count++ ) - { - MDataHandle currentLight = lightData.inputValue(); - MFloatVector& lightIntensity = currentLight.child(aLightIntensity).asFloatVector(); - - // Find the blind data - int& blindData = currentLight.child( aLightBlindData ).asInt(); - - // find ambient component - if( currentLight.child(aLightAmbient).asBool() ) { - diffuseR += lightIntensity[0]; - diffuseG += lightIntensity[1]; - diffuseB += lightIntensity[2]; - } - - MFloatVector& lightDirection = currentLight.child(aLightDirection).asFloatVector(); - - if ( blindData == 0 ) - { - // find diffuse and specular component - if( currentLight.child(aLightDiffuse).asBool() ) - { - float cosln = lightDirection * surfaceNormal;; - if( cosln > 0.0f ) // calculate only if facing light - { - diffuseR += lightIntensity[0] * ( cosln * diffuseReflectivity ); - diffuseG += lightIntensity[1] * ( cosln * diffuseReflectivity ); - diffuseB += lightIntensity[2] * ( cosln * diffuseReflectivity ); - } - - CHECK_MSTATUS( cameraPosition.normalize() ); - - if( cosln > 0.0f ) // calculate only if facing light - { - float RV = ( ( (2*surfaceNormal) * cosln ) - lightDirection ) * cameraPosition; - if( RV > 0.0 ) RV = 0.0; - if( RV < 0.0 ) RV = -RV; - - if ( power < 0 ) power = -power; - - float s = spec * powf( RV, power ); - - specularR += lightIntensity[0] * s; - specularG += lightIntensity[1] * s; - specularB += lightIntensity[2] * s; - } - } - } - else - { - float cosln = MRenderUtil::diffuseReflectance( blindData, lightDirection, point, surfaceNormal, true ); - if( cosln > 0.0f ) // calculate only if facing light - { - diffuseR += lightIntensity[0] * ( cosln * diffuseReflectivity ); - diffuseG += lightIntensity[1] * ( cosln * diffuseReflectivity ); - diffuseB += lightIntensity[2] * ( cosln * diffuseReflectivity ); - } - - CHECK_MSTATUS ( cameraPosition.normalize() ); - - if ( currentLight.child(aLightSpecular).asBool() ) - { - MFloatVector specLightDirection = lightDirection; - MDataHandle directionH = block.inputValue( aRayDirection ); - MFloatVector direction = directionH.asFloatVector(); - float lightAttenuation = 1.0; - - specLightDirection = MRenderUtil::maximumSpecularReflection( blindData, - lightDirection, point, surfaceNormal, direction ); - lightAttenuation = MRenderUtil::lightAttenuation( blindData, point, surfaceNormal, false ); - - // Are we facing the light - if ( specLightDirection * surfaceNormal > 0.0f ) - { - float power = block.inputValue( aPower ).asFloat(); - MFloatVector rv = 2 * surfaceNormal * ( surfaceNormal * direction ) - direction; - float s = spec * powf( rv * specLightDirection, power ); - - specularR += lightIntensity[0] * s * lightAttenuation; - specularG += lightIntensity[1] * s * lightAttenuation; - specularB += lightIntensity[2] * s * lightAttenuation; - } - } - } - if( !lightData.next() ) break; - } - - // factor incident light with surface color and add incandescence - resultColor[0] = ( diffuseR * surfaceColor[0] ) + specularR + incandescence[0]; - resultColor[1] = ( diffuseG * surfaceColor[1] ) + specularG + incandescence[1]; - resultColor[2] = ( diffuseB * surfaceColor[2] ) + specularB + incandescence[2]; - - // add the reflection color - if (reflectGain > 0.0) { - - MStatus status; - - // required attributes for using raytracer - // origin, direction, sampler, depth, and object id. - // - MDataHandle originH = block.inputValue( aRayOrigin, &status); - MFloatVector origin = originH.asFloatVector(); - - MDataHandle directionH = block.inputValue( aRayDirection, &status); - MFloatVector direction = directionH.asFloatVector(); - - MDataHandle samplerH = block.inputValue( aRaySampler, &status); - int samplerPtr = samplerH.asLong(); - - MDataHandle depthH = block.inputValue( aRayDepth, &status); - short depth = depthH.asShort(); - - MDataHandle objH = block.inputValue( aObjectId, &status); - int objId = objH.asLong(); - - MFloatVector reflectColor; - MFloatVector reflectTransparency; - - MFloatVector& triangleNormal = block.inputValue( aTriangleNormalCamera ).asFloatVector(); - - // compute reflected ray - MFloatVector l = -direction; - float dot = l * normal; - if( dot < 0.0 ) dot = -dot; - MFloatVector refVector = 2 * normal * dot - l; // reflection ray - float dotRef = refVector * triangleNormal; - if( dotRef < 0.0 ) { - const float s = 0.01f; - MFloatVector mVec = refVector - dotRef * triangleNormal; - mVec.normalize(); - refVector = mVec + s * triangleNormal; - } - CHECK_MSTATUS ( refVector.normalize() ); - - status = MRenderUtil::raytrace( - point, // origin - refVector, // direction - objId, // object id - samplerPtr, // sampler info - depth, // ray depth - reflectColor, // output color and transp - reflectTransparency); - - // add in the reflection color - resultColor[0] += reflectGain * (reflectColor[0]); - resultColor[1] += reflectGain * (reflectColor[1]); - resultColor[2] += reflectGain * (reflectColor[2]); - } - - // set ouput color attribute - MDataHandle outColorHandle = block.outputValue( aOutColor ); - MFloatVector& outColor = outColorHandle.asFloatVector(); - outColor = resultColor; - outColorHandle.setClean(); - - return MS::kSuccess; -} -// -// DESCRIPTION: -/////////////////////////////////////////////////////// -MStatus initializePlugin( MObject obj ) -{ - const MString UserClassify( "shader/surface" ); - - MFnPlugin plugin( obj, "Alias|Wavefront - Example", "5.0", "Any"); - CHECK_MSTATUS ( plugin.registerNode( "XRayMtl", CXRayMtl::id, - CXRayMtl::creator, CXRayMtl::initialize, - MPxNode::kDependNode, &UserClassify ) ); - - return MS::kSuccess; -} - -// -// DESCRIPTION: -/////////////////////////////////////////////////////// -MStatus uninitializePlugin( MObject obj ) -{ - MFnPlugin plugin( obj ); - CHECK_MSTATUS ( plugin.deregisterNode( CXRayMtl::id ) ); - - return MS::kSuccess; -} diff --git a/cs/engine/plugins/Maya/Material/stdafx.cpp b/cs/engine/plugins/Maya/Material/stdafx.cpp deleted file mode 100644 index 47ba18575..000000000 --- a/cs/engine/plugins/Maya/Material/stdafx.cpp +++ /dev/null @@ -1,3 +0,0 @@ -#include "stdafx.h" -#pragma hdrstop - diff --git a/cs/engine/plugins/Maya/Maya_Export2008.vcxproj b/cs/engine/plugins/Maya/Maya_Export2008.vcxproj deleted file mode 100644 index d40b71e3e..000000000 --- a/cs/engine/plugins/Maya/Maya_Export2008.vcxproj +++ /dev/null @@ -1,214 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - Maya_Export_2008 - {C928FBB1-EDD8-4198-90DC-170A54C2AD72} - Maya_Export_2008 - 8.1 - - - - DynamicLibrary - v140 - false - - - DynamicLibrary - v140 - false - - - - - - - - - - - - - - - - - true - - - false - - - - _DEBUG;%(PreprocessorDefinitions) - true - true - Win32 - Export\Debug\maTranslator.tlb - - - Disabled - $(SolutionDir)sdk\DXSDK\Include;$(SolutionDir)engine;$(SolutionDir)sdk/3d_sdk/maya/ver-2008/include;$(SolutionDir)engine\plugins\shared;%(AdditionalIncludeDirectories) - DEBUG;WIN32;_WINDOWS;NT_PLUGIN;_MAYA_EXPORT;_MAYA_PLUGIN;XRCORE_STATIC;%(PreprocessorDefinitions) - true - Sync - MultiThreadedDLL - Fast - false - true - Use - $(IntDir)$(ProjectName).pch - $(IntDir) - $(IntDir) - $(IntDir) - Level3 - true - EditAndContinue - Cdecl - Default - - - _DEBUG;%(PreprocessorDefinitions) - 0x0409 - - - /export:initializePlugin /export:uninitializePlugin - %(AdditionalOptions) - odbc32.lib;odbccp32.lib;Foundation.lib;OpenMaya.lib;OpenMayaAnim.lib;OpenMayaUI.lib;xrcorestatic.lib;%(AdditionalDependencies) - $(OutDir)xrayMaya_export.mll - true - $(DXSDK_DIR)Lib\x86;$(SolutionDir)sdk/3d_sdk/maya/ver-2008/lib;$(SolutionDir)libraries\$(Configuration);$(SolutionDir)sdk\libraries;%(AdditionalLibraryDirectories) - true - $(OutDir)xrayMaya_export.pdb - Windows - - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - Win32 - Export\Release\maTranslator.tlb - - - OnlyExplicitInline - $(SolutionDir)sdk\DXSDK\Include;$(SolutionDir)engine;$(SolutionDir)sdk/3d_sdk/maya/ver-2008/include;$(SolutionDir)engine\plugins\shared;%(AdditionalIncludeDirectories) - NDEBUG;WIN32;_WINDOWS;NT_PLUGIN;_MAYA_EXPORT;_MAYA_PLUGIN;XRCORE_STATIC;%(PreprocessorDefinitions) - true - false - - MultiThreadedDLL - true - Fast - false - true - Use - $(IntDir)$(ProjectName).pch - $(IntDir) - $(IntDir) - $(IntDir) - Level3 - true - Default - - - NDEBUG;%(PreprocessorDefinitions) - 0x0409 - - - /export:initializePlugin /export:uninitializePlugin %(AdditionalOptions) - odbc32.lib;odbccp32.lib;Foundation.lib;OpenMaya.lib;OpenMayaAnim.lib;xrcorestatic.lib;%(AdditionalDependencies) - $(OutDir)xrayMaya_export.mll - true - $(DXSDK_DIR)Lib\x86;$(SolutionDir)sdk/3d_sdk/maya/ver-2008/lib;$(SolutionDir)libraries\$(Configuration);$(SolutionDir)sdk\libraries;%(AdditionalLibraryDirectories) - - Windows - - - - - $(IntDir)%(Filename)1.obj - $(IntDir)%(Filename)1.xdc - true - $(IntDir)%(Filename)1.obj - $(IntDir)%(Filename)1.xdc - - - - - - - - - true - - - - - - - - - Use - - - - - - - Create - Create - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {f1066eac-ee25-4c7a-9023-5957a6f7ba27} - false - - - {e8cf1ada-264a-4127-86c2-fd7057d3792c} - - - - - - \ No newline at end of file diff --git a/cs/engine/plugins/Maya/Maya_Export2008.vcxproj.filters b/cs/engine/plugins/Maya/Maya_Export2008.vcxproj.filters deleted file mode 100644 index 6289b9eec..000000000 --- a/cs/engine/plugins/Maya/Maya_Export2008.vcxproj.filters +++ /dev/null @@ -1,122 +0,0 @@ -п»ї - - - - {19c3fd16-5549-4239-9172-c4cc62fd80fa} - - - {10f5be13-1fd0-4457-afa5-9f65fc51f92a} - - - {615618f0-65b1-42d5-81b0-95fba5690ee1} - - - {64119876-f5b1-4c51-b808-4ac0983ffcb9} - - - {94a28c08-7af2-402e-b1cf-c57dbc79466b} - - - {aec3c944-dd3f-47b7-ae1e-fe279f383c9e} - - - {4d0da9de-5d72-41dd-b25b-e01f445f72f4} - - - {b5fca0ff-79fc-4e10-aab2-85167fa933d4} - - - - - Kernel - - - Kernel - - - Export - - - Export\Skin - - - Export\Skin - - - Export\Skin - - - Export\Object - - - Export\Object - - - - - - - - - - - - - - - - - - Kernel - - - Shared Files\Engine - - - Shared Files\Editor - - - Export - - - Export - - - - - - - - - - - - - - - - - Export\Skin - - - Export\Skin - - - Export\Object - - - - - Export\Skin - - - Export\Skin - - - Export\Skin - - - Export\Object - - - \ No newline at end of file diff --git a/cs/engine/plugins/Maya/Maya_Export85.vcxproj b/cs/engine/plugins/Maya/Maya_Export85.vcxproj deleted file mode 100644 index ea4bba13e..000000000 --- a/cs/engine/plugins/Maya/Maya_Export85.vcxproj +++ /dev/null @@ -1,195 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - Maya_Export_85 - {C2A6CB42-D6EC-4045-9452-B73FE1A4FABB} - 8.1 - - - - DynamicLibrary - v140 - false - - - DynamicLibrary - v140 - false - - - - - - - - - - - - - - - - - true - - - false - - - - _DEBUG;%(PreprocessorDefinitions) - true - true - Win32 - Export\Debug\maTranslator.tlb - - - Disabled - $(SolutionDir)sdk\DXSDK\Include;$(SolutionDir)engine;$(SolutionDir)sdk/3d_sdk/maya/ver-8.5/include;$(SolutionDir)engine\plugins\shared;%(AdditionalIncludeDirectories) - DEBUG;WIN32;_WINDOWS;NT_PLUGIN;_MAYA_EXPORT;_MAYA_PLUGIN;XRCORE_STATIC;%(PreprocessorDefinitions) - true - Sync - MultiThreadedDLL - Fast - false - true - Use - $(IntDir)$(ProjectName).pch - $(IntDir) - $(IntDir) - $(IntDir) - Level3 - true - EditAndContinue - Cdecl - Default - - - _DEBUG;%(PreprocessorDefinitions) - 0x0409 - - - /export:initializePlugin /export:uninitializePlugin - %(AdditionalOptions) - odbc32.lib;odbccp32.lib;Foundation.lib;OpenMaya.lib;OpenMayaAnim.lib;xrcorestatic.lib;%(AdditionalDependencies) - $(OutDir)xrayMaya_export.mll - true - $(DXSDK_DIR)Lib\x86;$(SolutionDir)sdk/3d_sdk/maya/ver-8.5/lib;$(SolutionDir)libraries\$(Configuration);$(SolutionDir)sdk\libraries;%(AdditionalLibraryDirectories) - true - $(OutDir)xrayMaya_export.pdb - Windows - - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - Win32 - Export\Release\maTranslator.tlb - - - OnlyExplicitInline - $(SolutionDir)sdk\DXSDK\Include;$(SolutionDir)engine;$(SolutionDir)sdk/3d_sdk/maya/ver-8.5/include;$(SolutionDir)engine\plugins\shared;%(AdditionalIncludeDirectories) - NDEBUG;WIN32;_WINDOWS;NT_PLUGIN;_MAYA_EXPORT;_MAYA_PLUGIN;XRCORE_STATIC;%(PreprocessorDefinitions) - true - false - - MultiThreadedDLL - true - Fast - false - true - Use - $(IntDir)$(ProjectName).pch - $(IntDir) - $(IntDir) - $(IntDir) - Level3 - true - Default - - - NDEBUG;%(PreprocessorDefinitions) - 0x0409 - - - /export:initializePlugin /export:uninitializePlugin %(AdditionalOptions) - odbc32.lib;odbccp32.lib;Foundation.lib;OpenMaya.lib;OpenMayaAnim.lib;xrcorestatic.lib;%(AdditionalDependencies) - $(OutDir)xrayMaya_export.mll - true - $(DXSDK_DIR)Lib\x86;$(SolutionDir)sdk/3d_sdk/maya/ver-8.5/lib;$(SolutionDir)libraries\$(Configuration);$(SolutionDir)sdk\libraries;%(AdditionalLibraryDirectories) - - Windows - - - - - - - - - - - - - - - - - Use - - - - - - - Create - Create - - - - - - - - - - - - - - - - - - - - - - - - - - {f1066eac-ee25-4c7a-9023-5957a6f7ba27} - false - - - {e8cf1ada-264a-4127-86c2-fd7057d3792c} - - - - - - \ No newline at end of file diff --git a/cs/engine/plugins/Maya/Maya_Export85.vcxproj.filters b/cs/engine/plugins/Maya/Maya_Export85.vcxproj.filters deleted file mode 100644 index 4564860b6..000000000 --- a/cs/engine/plugins/Maya/Maya_Export85.vcxproj.filters +++ /dev/null @@ -1,105 +0,0 @@ -п»ї - - - - {4fa1651c-0f30-4e72-8a8d-db6cf9f280b4} - - - {376d58e6-745f-446e-a01e-c89e737c1165} - - - {2aafa080-a5b2-4c72-91a0-e7987b023b7d} - - - {6da2f1ca-8f57-46d2-88d8-09a68df32b90} - - - {da2a9dcd-d58e-447c-99e5-610c3cc73715} - - - {980b4074-7ac8-44dd-a118-48d6ced41be9} - - - {ac4e6b9b-7064-45a1-af5a-7ceebbc0a39c} - - - - - Kernel - - - Kernel - - - Export - - - Export\Skin - - - Export\Skin - - - Export\Skin - - - Export\Object - - - Export\Object - - - - - - - - - - - - - - - - Kernel - - - Shared Files\Engine - - - Export - - - - - - - - - - - Export\Skin - - - Export\Skin - - - Export\Object - - - - - Export\Skin - - - Export\Skin - - - Export\Skin - - - Export\Object - - - \ No newline at end of file diff --git a/cs/engine/plugins/Maya/Maya_Material2008.vcxproj b/cs/engine/plugins/Maya/Maya_Material2008.vcxproj deleted file mode 100644 index 222a046b0..000000000 --- a/cs/engine/plugins/Maya/Maya_Material2008.vcxproj +++ /dev/null @@ -1,171 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - Maya_Material_2008 - {84D91673-C1A1-47FF-9A75-4E73F31F4C63} - Maya_Material_85 - 8.1 - - - - DynamicLibrary - v140 - false - - - DynamicLibrary - v140 - false - - - - - - - - - - - - - - - - - true - - - false - - - - _DEBUG;%(PreprocessorDefinitions) - true - true - Win32 - Material\Debug\maTranslator.tlb - - - Disabled - $(DXSDK_DIR)Include;$(SolutionDir)engine;$(SolutionDir)sdk/3d_sdk/maya/ver-2008/include;$(SolutionDir)engine\plugins\shared;%(AdditionalIncludeDirectories) - DEBUG;WIN32;_WINDOWS;NT_PLUGIN;_MAYA_MATERIAL;_MAYA_PLUGIN;XRCORE_STATIC;%(PreprocessorDefinitions) - true - Sync - MultiThreadedDLL - Fast - false - true - Use - $(IntDir)$(ProjectName).pch - $(IntDir) - $(IntDir) - $(IntDir) - Level3 - true - EditAndContinue - Cdecl - Default - - - _DEBUG;%(PreprocessorDefinitions) - 0x0409 - - - /export:initializePlugin /export:uninitializePlugin - %(AdditionalOptions) - odbc32.lib;odbccp32.lib;Foundation.lib;OpenMaya.lib;OpenMayaRender.lib;OpenMayaUI.lib;glu32.lib;opengl32.lib;xrcorestatic.lib;%(AdditionalDependencies) - $(OutDir)xrayMaya_material.mll - true - $(DXSDK_DIR)Lib\x86;$(SolutionDir)sdk/3d_sdk/maya/ver-2008/lib;$(SolutionDir)libraries\$(Configuration);$(SolutionDir)sdk\libraries;%(AdditionalLibraryDirectories) - true - $(OutDir)xrayMaya_material.pdb - Windows - - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - Win32 - Material\Release\maTranslator.tlb - - - OnlyExplicitInline - $(DXSDK_DIR)Include;$(SolutionDir)engine;$(SolutionDir)sdk/3d_sdk/maya/ver-2008/include;$(SolutionDir)engine\plugins\shared;%(AdditionalIncludeDirectories) - NDEBUG;WIN32;_WINDOWS;NT_PLUGIN;_MAYA_MATERIAL;_MAYA_PLUGIN;XRCORE_STATIC;%(PreprocessorDefinitions) - true - false - - MultiThreadedDLL - true - Fast - false - true - Use - $(IntDir)$(ProjectName).pch - $(IntDir) - $(IntDir) - $(IntDir) - Level3 - true - Default - - - NDEBUG;%(PreprocessorDefinitions) - 0x0409 - - - /export:initializePlugin /export:uninitializePlugin %(AdditionalOptions) - odbc32.lib;odbccp32.lib;Foundation.lib;OpenMaya.lib;OpenMayaRender.lib;OpenMayaUI.lib;glu32.lib;opengl32.lib;xrcorestatic.lib;%(AdditionalDependencies) - $(OutDir)xrayMaya_material.mll - true - $(DXSDK_DIR)Lib\x86;$(SolutionDir)sdk/3d_sdk/maya/ver-2008/lib;$(SolutionDir)libraries\$(Configuration);$(SolutionDir)sdk\libraries;%(AdditionalLibraryDirectories) - - Windows - - - - - - - - - - Create - Create - - - - - - - - - - - - - - - {f1066eac-ee25-4c7a-9023-5957a6f7ba27} - false - - - {e8cf1ada-264a-4127-86c2-fd7057d3792c} - - - - - - \ No newline at end of file diff --git a/cs/engine/plugins/Maya/Maya_Material2008.vcxproj.filters b/cs/engine/plugins/Maya/Maya_Material2008.vcxproj.filters deleted file mode 100644 index 7cf2392fe..000000000 --- a/cs/engine/plugins/Maya/Maya_Material2008.vcxproj.filters +++ /dev/null @@ -1,55 +0,0 @@ -п»ї - - - - {184a5fef-cf2b-4cf7-aead-c0cb23e2ebf9} - - - {a99a8452-f894-497e-afdd-26a507b7f354} - - - {a3e78bc6-3a2c-4761-9462-dcd358f1393a} - - - {be5eb25a-2920-4cbc-9d92-1b187a7d2e81} - - - {e4203f8a-a066-4aaf-bffa-5a74afb8d2ce} - - - {31ec4cc8-45e4-463d-a695-9c772ec08a1e} - - - - - Kernel - - - Shader - - - Shader - - - - - - - - - - - - - Shader - - - Shader - - - - - Kernel - - - \ No newline at end of file diff --git a/cs/engine/plugins/Maya/Maya_Material85.vcxproj b/cs/engine/plugins/Maya/Maya_Material85.vcxproj deleted file mode 100644 index e7249c560..000000000 --- a/cs/engine/plugins/Maya/Maya_Material85.vcxproj +++ /dev/null @@ -1,183 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - Maya_Material_85 - {F5FE7239-50EB-4AC0-AD32-6374C1A6DD6C} - Maya_Material_85 - 8.1 - - - - DynamicLibrary - v140 - false - - - DynamicLibrary - v140 - false - - - - - - - - - - - - - - - - - true - - - false - - - - _DEBUG;%(PreprocessorDefinitions) - true - true - Win32 - Material\Debug\maTranslator.tlb - - - Disabled - $(DXSDK_DIR)Include;$(SolutionDir)engine;$(SolutionDir)sdk/3d_sdk/maya/ver-8.5/include;$(SolutionDir)engine\plugins\shared;%(AdditionalIncludeDirectories) - DEBUG;WIN32;_WINDOWS;NT_PLUGIN;_MAYA_MATERIAL;_MAYA_PLUGIN;XRCORE_STATIC;%(PreprocessorDefinitions) - true - Sync - MultiThreadedDLL - Fast - false - true - Use - $(IntDir)$(ProjectName).pch - $(IntDir) - $(IntDir) - $(IntDir) - Level3 - true - EditAndContinue - Cdecl - Default - - - _DEBUG;%(PreprocessorDefinitions) - 0x0409 - - - /export:initializePlugin /export:uninitializePlugin - %(AdditionalOptions) - odbc32.lib;odbccp32.lib;Foundation.lib;OpenMaya.lib;OpenMayaRender.lib;OpenMayaUI.lib;glu32.lib;opengl32.lib;xrcorestatic.lib;%(AdditionalDependencies) - $(OutDir)xrayMaya_material.mll - true - $(DXSDK_DIR)Lib\x86;$(SolutionDir)sdk/3d_sdk/maya/ver-8.5/lib;$(SolutionDir)libraries\$(Configuration);$(SolutionDir)sdk\libraries;%(AdditionalLibraryDirectories) - true - $(OutDir)xrayMaya_material.pdb - Windows - - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - Win32 - Material\Release\maTranslator.tlb - - - OnlyExplicitInline - $(DXSDK_DIR)Include;$(SolutionDir)engine;$(SolutionDir)sdk/3d_sdk/maya/ver-8.5/include;$(SolutionDir)engine\plugins\shared;%(AdditionalIncludeDirectories) - NDEBUG;WIN32;_WINDOWS;NT_PLUGIN;_MAYA_MATERIAL;_MAYA_PLUGIN;XRCORE_STATIC;%(PreprocessorDefinitions) - true - false - - MultiThreadedDLL - true - Fast - false - true - Use - $(IntDir)$(ProjectName).pch - Level3 - true - Default - - - NDEBUG;%(PreprocessorDefinitions) - 0x0409 - - - /export:initializePlugin /export:uninitializePlugin %(AdditionalOptions) - odbc32.lib;odbccp32.lib;Foundation.lib;OpenMaya.lib;OpenMayaRender.lib;OpenMayaUI.lib;glu32.lib;opengl32.lib;xrcorestatic.lib;%(AdditionalDependencies) - $(OutDir)xrayMaya_material.mll - true - $(DXSDK_DIR)Lib\x86;$(SolutionDir)sdk/3d_sdk/maya/ver-8.5/lib;$(SolutionDir)libraries\$(Configuration);$(SolutionDir)sdk\libraries;%(AdditionalLibraryDirectories) - - Windows - - - - - $(IntDir)%(Filename)1.obj - $(IntDir)%(Filename)1.xdc - - - $(IntDir)%(Filename)1.obj - $(IntDir)%(Filename)1.xdc - - - $(IntDir)%(Filename)1.obj - $(IntDir)%(Filename)1.xdc - - - $(IntDir)%(Filename)1.obj - $(IntDir)%(Filename)1.xdc - - - $(IntDir)%(Filename)1.obj - $(IntDir)%(Filename)1.xdc - - - Create - Create - - - - - - - - - - - - - - - {f1066eac-ee25-4c7a-9023-5957a6f7ba27} - false - - - {e8cf1ada-264a-4127-86c2-fd7057d3792c} - - - - - - \ No newline at end of file diff --git a/cs/engine/plugins/Maya/Maya_Material85.vcxproj.filters b/cs/engine/plugins/Maya/Maya_Material85.vcxproj.filters deleted file mode 100644 index 0e32a6628..000000000 --- a/cs/engine/plugins/Maya/Maya_Material85.vcxproj.filters +++ /dev/null @@ -1,55 +0,0 @@ -п»ї - - - - {69da4a02-3a79-4869-ad2f-7fa75b04554f} - - - {ec5fd4f1-e772-4e61-a950-41fe4e23b6bb} - - - {2bdefada-9d0e-490c-9574-c7e7ce3f6382} - - - {1d9681e7-0021-4dc7-bed9-b49eab43885f} - - - {60626201-d79c-4c63-8463-1f1db329ebd1} - - - {7ffe8206-3e42-463c-80e4-656ae17e6190} - - - - - Kernel - - - Shader - - - Shader - - - - - - - - - - - - - Shader - - - Shader - - - - - Kernel - - - \ No newline at end of file diff --git a/cs/engine/plugins/Maya/data/icons/render_XRayMtl.xpm b/cs/engine/plugins/Maya/data/icons/render_XRayMtl.xpm deleted file mode 100644 index da49b97bc..000000000 --- a/cs/engine/plugins/Maya/data/icons/render_XRayMtl.xpm +++ /dev/null @@ -1,55 +0,0 @@ -/* XPM */ -static char *noname[] = { -/* width height ncolors chars_per_pixel */ -"32 32 16 1" -/* colors */ -" c #9F9EA3", -"! c #8F8283", -"# c #F7DCE2", -"$ c #BABABB", -"% c #1B1927", -"& c #1D0A18", -"' c #848289", -"( c #6D6C78", -") c #2C2A38", -"* c #23222D", -"+ c #685A64", -", c #60545B", -"- c #594E5C", -". c #4E444C", -"/ c #000000", -"0 c #42383F", -/* pixels */ -"&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", -"&&******************************", -"&&******************************", -"&&**************000*************", -"&&**********0.......00**********", -"&&*********.-,,,,--...0)********", -"&&********-,,,,,,,,-...0)*******", -"&&*******-,,++++,,,,-..00)******", -"&&******-,+++++++,,,-...00******", -"&&*****.,+++++++++,,,-..00)%****", -"&&*****,,+++++++++,,,-...0)*****", -"&&****.,++++++(((++,,-...00*&***", -"&&****.,++++((!''(+,,-...00)%***", -"&&****-,++++('$$ '+,,-...00)%***", -"&&****-,++++( $#$!+,,-...00)%***", -"&&****-,,+++( $$$'+,--..000)%***", -"&&****.,,+++(! '(+,-...00)*%***", -"&&****.,,,+++(''(+,--...00)*&***", -"&&****.-,,,,+++++,,-...000)*&***", -"&&****0.-,,,,,,,,--....00)*%/***", -"&&****0..-,,,,,,--....000)*&/***", -"&&*****0...-----.....000)*%/****", -"&&*****)0...........000)*%&/****", -"&&******00........0000)**&/*****", -"&&*******)0000000000))**&/******", -"&&********)0000000)))*%&/*******", -"&&*********%))))))**%%&/********", -"&&***********&%%%%%&&/**********", -"&&******************************", -"&&******************************", -"&&******************************", -"&&******************************" -}; diff --git a/cs/engine/plugins/Maya/data/scripts/AEXRayMtlTemplate.mel b/cs/engine/plugins/Maya/data/scripts/AEXRayMtlTemplate.mel deleted file mode 100644 index 42fe816b1..000000000 --- a/cs/engine/plugins/Maya/data/scripts/AEXRayMtlTemplate.mel +++ /dev/null @@ -1,30 +0,0 @@ -global proc AEXRayMtlTemplate ( string $nodeName ) -{ - AEswatchDisplay $nodeName; - editorTemplate -beginScrollLayout; - - editorTemplate -beginLayout "Common Material Attributes" -collapse 0; - editorTemplate -addControl "color"; - editorTemplate -addControl "transparency"; - editorTemplate -addControl "incandescence"; - editorTemplate -addControl "diffuseReflectivity"; - editorTemplate -addControl "translucenceCoeff"; - editorTemplate -endLayout; - - // include/call base class/node attributes - AEdependNodeTemplate $nodeName; - - editorTemplate -beginLayout "Hardware Texturing" -collapse true; - AEhardwareTextureTemplate $nodeName - ("color transparency incandescence"); - editorTemplate -endLayout; - - editorTemplate -beginLayout "XRay Params"; - editorTemplate -addControl "xrayDoubleSide"; - editorTemplate -addControl "xrayEngineShader"; - editorTemplate -addControl "xrayCompilerShader"; - editorTemplate -addControl "xrayGameMaterial"; - editorTemplate -endLayout; - - editorTemplate -endScrollLayout; -} diff --git a/cs/engine/plugins/Maya/data/scripts/xrayObjectExportOptions.mel b/cs/engine/plugins/Maya/data/scripts/xrayObjectExportOptions.mel deleted file mode 100644 index 3fc48c775..000000000 --- a/cs/engine/plugins/Maya/data/scripts/xrayObjectExportOptions.mel +++ /dev/null @@ -1,55 +0,0 @@ -global proc int xrayObjectExportOptions ( string $parent, - string $action, - string $initialSettings, - string $resultCallback ) -{ - int $bResult; - string $currentOptions; - string $optionList[]; - string $optionBreakDown[]; - int $index; - - if ($action == "post") { - setParent $parent; - - setUITemplate -pushTemplate DefaultTemplate; - - formLayout -e -vis false optionsBoxForm; - - frameLayout - -cll true - -cl false - -bv true - -bs "etchedIn" - -l "About" - xrayAboutFrame; - - columnLayout -adj true; - - text -al "left" -l "Maya -> X-Ray Object Exporter ver. 1.0"; - - // Now set to current settings. - $currentOptions = $initialSettings; - if (size($currentOptions) > 0) { - tokenize($currentOptions, ";", $optionList); - for ($index = 0; $index < size($optionList); $index++) { - tokenize($optionList[$index], "=", $optionBreakDown); - - } - } - $result = 1; - - formLayout -e -vis true optionsBoxForm; - - setUITemplate -popTemplate; - - } else if ($action == "query") { - - eval($resultCallback+" \""+$currentOptions+"\""); - $result = 1; - } else { - $bResult = 0; - } - - return $bResult; -} diff --git a/cs/engine/plugins/Maya/data/scripts/xraySkinExportOptions.mel b/cs/engine/plugins/Maya/data/scripts/xraySkinExportOptions.mel deleted file mode 100644 index 1c6515e76..000000000 --- a/cs/engine/plugins/Maya/data/scripts/xraySkinExportOptions.mel +++ /dev/null @@ -1,102 +0,0 @@ -global proc int xraySkinExportOptions( string $parent, - string $action, - string $initialSettings, - string $resultCallback ) -{ - int $bResult; - string $currentOptions; - string $optionList[]; - string $optionBreakDown[]; - int $index; - - if ($action == "post") { - setParent $parent; - - setUITemplate -pushTemplate DefaultTemplate; - - formLayout -e -vis false optionsBoxForm; - - columnLayout -adj true objTypeCol; - - frameLayout - -cll true - -cl false - -bv true - -bs "etchedIn" - -l "Export Options" - xrayExportFrame; - - columnLayout -adj true xrayExpOptions; - - rowLayout -nc 2 -cw2 210 200 -rat 1 "top" 0 -cal 1 "left"; - text -al "left" -l "Select skin cluster to export:"; - textScrollList -nr 5 -ams false xrayClusterList; - string $clusters[] = `ls -typ skinCluster`; - int $i; - for ($i = 0; $i < `size($clusters)`; $i++) - { - textScrollList -e -append $clusters[$i] xrayClusterList; - } - setParent ..; - setParent ..; - setParent ..; - - frameLayout - -cll true - -cl false - -bv true - -bs "etchedIn" - -l "About" - xrayAboutFrame; - - columnLayout -adj true; - - text -al "left" -l "Maya -> X-Ray Skin Exporter ver. 1.0"; - - // Now set to current settings. - $currentOptions = $initialSettings; - if (size($currentOptions) > 0) { - tokenize($currentOptions, ";", $optionList); - for ($index = 0; $index < size($optionList); $index++) { - tokenize($optionList[$index], "=", $optionBreakDown); - - // Frame settings - - if ( $optionBreakDown[0] == "exportFrame") { - $intVal = $optionBreakDown[1]; - if ( $intVal == 1 ) { - frameLayout -e -cl true xrayExportFrame; - } else { - frameLayout -e -cl false xrayExportFrame; - } - } - - if ($optionBreakDown[0] == "SkinCluster") { - if (`size($optionBreakDown)` > 1) { - textScrollList -e -si $optionBreakDown[1] xrayClusterList; - } - } - } - } - $result = 1; - - formLayout -e -vis true optionsBoxForm; - - setUITemplate -popTemplate; - - } else if ($action == "query") { - - $intVal = `frameLayout -q -cl xrayExportFrame`; - $currentOptions = $currentOptions + "exportFrame=" + $intVal + ";"; - - string $listSelection[] = `textScrollList -q -si xrayClusterList`; - $currentOptions = $currentOptions + ";SkinCluster=" + $listSelection[0]; - - eval($resultCallback+" \""+$currentOptions+"\""); - $result = 1; - } else { - $bResult = 0; - } - - return $bResult; -} diff --git a/cs/engine/plugins/Maya/data/scripts/xraySkinMotionExportOptions.mel b/cs/engine/plugins/Maya/data/scripts/xraySkinMotionExportOptions.mel deleted file mode 100644 index 0c30a5f4d..000000000 --- a/cs/engine/plugins/Maya/data/scripts/xraySkinMotionExportOptions.mel +++ /dev/null @@ -1,102 +0,0 @@ -global proc int xraySkinMotionExportOptions( string $parent, - string $action, - string $initialSettings, - string $resultCallback ) -{ - int $bResult; - string $currentOptions; - string $optionList[]; - string $optionBreakDown[]; - int $index; - - if ($action == "post") { - setParent $parent; - - setUITemplate -pushTemplate DefaultTemplate; - - formLayout -e -vis false optionsBoxForm; - - columnLayout -adj true objTypeCol; - - frameLayout - -cll true - -cl false - -bv true - -bs "etchedIn" - -l "Export Options" - xrayExportFrame; - - columnLayout -adj true xrayExpOptions; - - rowLayout -nc 2 -cw2 210 200 -rat 1 "top" 0 -cal 1 "left"; - text -al "left" -l "Select skin cluster to export:"; - textScrollList -nr 5 -ams false xrayClusterList; - string $clusters[] = `ls -typ skinCluster`; - int $i; - for ($i = 0; $i < `size($clusters)`; $i++) - { - textScrollList -e -append $clusters[$i] xrayClusterList; - } - setParent ..; - setParent ..; - setParent ..; - - frameLayout - -cll true - -cl false - -bv true - -bs "etchedIn" - -l "About" - xrayAboutFrame; - - columnLayout -adj true; - - text -al "left" -l "Maya -> X-Ray Skin Motion Exporter ver. 1.0"; - - // Now set to current settings. - $currentOptions = $initialSettings; - if (size($currentOptions) > 0) { - tokenize($currentOptions, ";", $optionList); - for ($index = 0; $index < size($optionList); $index++) { - tokenize($optionList[$index], "=", $optionBreakDown); - - // Frame settings - - if ( $optionBreakDown[0] == "exportFrame") { - $intVal = $optionBreakDown[1]; - if ( $intVal == 1 ) { - frameLayout -e -cl true xrayExportFrame; - } else { - frameLayout -e -cl false xrayExportFrame; - } - } - - if ($optionBreakDown[0] == "SkinCluster") { - if (`size($optionBreakDown)` > 1) { - textScrollList -e -si $optionBreakDown[1] xrayClusterList; - } - } - } - } - $result = 1; - - formLayout -e -vis true optionsBoxForm; - - setUITemplate -popTemplate; - - } else if ($action == "query") { - - $intVal = `frameLayout -q -cl xrayExportFrame`; - $currentOptions = $currentOptions + "exportFrame=" + $intVal + ";"; - - string $listSelection[] = `textScrollList -q -si xrayClusterList`; - $currentOptions = $currentOptions + ";SkinCluster=" + $listSelection[0]; - - eval($resultCallback+" \""+$currentOptions+"\""); - $result = 1; - } else { - $bResult = 0; - } - - return $bResult; -} diff --git a/cs/engine/plugins/lw/Export/EditObjectImport.cpp b/cs/engine/plugins/lw/Export/EditObjectImport.cpp deleted file mode 100644 index a2db70ed0..000000000 --- a/cs/engine/plugins/lw/Export/EditObjectImport.cpp +++ /dev/null @@ -1,349 +0,0 @@ -//---------------------------------------------------- -// file: CEditableObjectImport.cpp -//---------------------------------------------------- - -#include "stdafx.h" -#pragma hdrstop - -#include "..\..\Shared\EditObject.h" -//#include "lwo2.h" -#include "..\lw_shared\LW_SHADERDEF.h" -#include "..\..\Shared\EditMesh.h" - -extern "C" { -#include "lwo2.h" -}; - -#ifdef _EDITOR - #include "ResourceManager.h" - - extern "C" __declspec(dllimport) lwObject* LWO_ImportObject(char* filename, lwObject *new_obj); - extern "C" __declspec(dllimport) void LWO_CloseFile(lwObject *new_obj); -#endif - -DEFINE_MAP(void*,int,VMIndexLink,VMIndexLinkIt); - -bool CompareFunc(const st_VMapPt& vm0, const st_VMapPt& vm1){ - return vm0.vmap_indexSetStatus("Importing..."); -// UI->ProgressStart(100,"Read file:"); -// UI->ProgressUpdate(1); - string512 fname; - strcpy(fname,fn); -#ifdef _EDITOR - I=LWO_ImportObject(fname,I); -#else - unsigned int failID; - int failpos; - I = lwGetObject( fname, &failID, &failpos ); -#endif -// UI->ProgressUpdate(100); - if (I){ - bool bResult=true; - ELog.Msg( mtInformation, "CEditableObject: import lwo %s...", fname ); - - // parse lwo object - { - m_Meshes.reserve (I->nlayers); - m_Surfaces.reserve (I->nsurfs); - - // surfaces - st_lwSurface* Isf=0; - { - int i=0; -// UI->ProgressStart(I->nsurfs,"Check surf:"); - for (Isf=I->surf; Isf; Isf=Isf->next){ -// UI->ProgressUpdate(i); - Isf->alpha_mode=i; // перетираем для внутренних целей !!! - CSurface* Osf = xr_new(); - m_Surfaces.push_back(Osf); - if (Isf->name&&Isf->name[0]) Osf->SetName(Isf->name); else Osf->SetName("Default"); - Osf->m_Flags.set(CSurface::sf2Sided,(Isf->sideflags==3)?TRUE:FALSE); - AnsiString en_name="default", lc_name="default", gm_name="default"; - XRShader* sh_info = 0; - if (Isf->nshaders&&(stricmp(Isf->shader->name,SH_PLUGIN_NAME)==0)){ - sh_info = (XRShader*)Isf->shader->data; - en_name = sh_info->en_name; - lc_name = sh_info->lc_name; - gm_name = sh_info->gm_name; - }else - ELog.Msg(mtError,"CEditableObject: Shader not found on surface '%s'.",Osf->_Name()); -#ifdef _EDITOR - if (!Device.Resources->_FindBlender(en_name.c_str())){ - ELog.Msg(mtError,"CEditableObject: Render shader '%s' - can't find in library.\nUsing 'default' shader on surface '%s'.", en_name.c_str(), Osf->_Name()); - en_name = "default"; - } - if (!Device.ShaderXRLC.Get(lc_name.c_str())){ - ELog.Msg(mtError,"CEditableObject: Compiler shader '%s' - can't find in library.\nUsing 'default' shader on surface '%s'.", lc_name.c_str(), Osf->_Name()); - lc_name = "default"; - } - if (!GMLib.GetMaterial(gm_name.c_str())){ - ELog.Msg(mtError,"CEditableObject: Game material '%s' - can't find in library.\nUsing 'default' material on surface '%s'.", lc_name.c_str(), Osf->_Name()); - gm_name = "default"; - } -#endif - // fill texture layers - int cidx; - st_lwClip* Icl; - u32 dwNumTextures=0; - for (st_lwTexture* Itx=Isf->color.tex; Itx; Itx=Itx->next){ - string1024 tname=""; - dwNumTextures++; - cidx = -1; - if (Itx->type==ID_IMAP) cidx=Itx->param.imap.cindex; - else{ - ELog.DlgMsg(mtError, "Import LWO (Surface '%s'): 'Texture' is not Image Map!",Osf->_Name()); - bResult=false; - break; - } - if (cidx!=-1){ - // get textures - for (Icl=I->clip; Icl; Icl=Icl->next) - if ((cidx==Icl->index)&&(Icl->type==ID_STIL)){ - strcpy(tname,Icl->source.still.name); - break; - } - if (tname[0]==0){ - ELog.DlgMsg(mtError, "Import LWO (Surface '%s'): 'Texture' name is empty or non 'STIL' type!",Osf->_Name()); - bResult=false; - break; - } - string256 tex_name; - _splitpath( tname, 0, 0, tex_name, 0 ); - Osf->SetTexture(EFS.AppendFolderToName(tex_name,1,TRUE)); - // get vmap refs - Osf->SetVMap(Itx->param.imap.vmap_name); - } - } - if (!bResult) break; - if (!Osf->_VMap()||!Osf->_VMap()[0]){ - ELog.DlgMsg(mtError, "Invalid surface '%s'. VMap empty.",Osf->_Name()); - bResult = false; - break; - } - if (!Osf->_Texture()||!Osf->_Texture()[0]){ - ELog.DlgMsg(mtError, "Can't create shader. Invalid surface '%s'. Textures empty.",Osf->_Name()); - bResult = false; - break; - } - if (en_name.c_str()==0){ - ELog.DlgMsg(mtError, "Can't create shader. Invalid surface '%s'. Shader empty.",Osf->_Name()); - bResult = false; - break; - } - - Osf->SetShader (en_name.c_str()); - Osf->SetShaderXRLC (lc_name.c_str()); - Osf->SetGameMtl (gm_name.c_str()); - Osf->SetFVF (D3DFVF_XYZ|D3DFVF_NORMAL|(dwNumTextures<layer; Ilr; Ilr=Ilr->next){ - // create new mesh - CEditableMesh* MESH=xr_new(this); - m_Meshes.push_back(MESH); - - if (Ilr->name) MESH->SetName(Ilr->name); else MESH->SetName(""); - MESH->m_Box.set(Ilr->bbox[0],Ilr->bbox[1],Ilr->bbox[2], Ilr->bbox[3],Ilr->bbox[4],Ilr->bbox[5]); - - // parse mesh(lwo-layer) data - // vmaps - st_lwVMap* Ivmap=0; - int vmap_count=0; - if (Ilr->nvmaps==0){ - ELog.DlgMsg(mtError, "Import LWO: Mesh layer must contain UV!"); - bResult=false; - break; - } - - // индексы соответствия импортируемых мап - static VMIndexLink VMIndices; - VMIndices.clear(); - - for (Ivmap=Ilr->vmap; Ivmap; Ivmap=Ivmap->next){ - switch(Ivmap->type){ - case ID_TXUV:{ - if (Ivmap->dim!=2){ - ELog.DlgMsg(mtError, "Import LWO: 'UV Map' must contain 2 value!"); - bResult=false; - break; - } - MESH->m_VMaps.push_back(xr_new(Ivmap->name,vmtUV,Ivmap->perpoly)); - st_VMap* Mvmap=MESH->m_VMaps.back(); - int vcnt=Ivmap->nverts; - // VMap - Mvmap->copyfrom(*Ivmap->val,vcnt); - // flip uv - for (int k=0; ksize(); k++){ - Fvector2& uv = Mvmap->getUV(k); - uv.y=1.f-uv.y; - } - // vmap index - VMIndices[Ivmap] = vmap_count++; - }break; - case ID_WGHT:{ - if (Ivmap->dim!=1){ - ELog.DlgMsg(mtError, "Import LWO: 'Weight' must contain 1 value!"); - bResult=false; - break; - } - MESH->m_VMaps.push_back(xr_new(Ivmap->name,vmtWeight,FALSE)); - st_VMap* Mvmap=MESH->m_VMaps.back(); - int vcnt=Ivmap->nverts; - // VMap - Mvmap->copyfrom(*Ivmap->val,vcnt); - // vmap index - VMIndices[Ivmap] = vmap_count++; - }break; - case ID_PICK: ELog.Msg(mtError,"Found 'PICK' VMAP. Import failed."); bResult = false; break; - case ID_MNVW: ELog.Msg(mtError,"Found 'MNVW' VMAP. Import failed."); bResult = false; break; - case ID_MORF: ELog.Msg(mtError,"Found 'MORF' VMAP. Import failed."); bResult = false; break; - case ID_SPOT: ELog.Msg(mtError,"Found 'SPOT' VMAP. Import failed."); bResult = false; break; - case ID_RGB: ELog.Msg(mtError,"Found 'RGB' VMAP. Import failed."); bResult = false; break; - case ID_RGBA: ELog.Msg(mtError,"Found 'RGBA' VMAP. Import failed."); bResult = false; break; - } - if (!bResult) break; - } - if (!bResult) break; - // points -// UI->ProgressStart(Ilr->point.count,"Fill points:"); - { - MESH->m_VertCount = Ilr->point.count; - MESH->m_Verts = xr_alloc(MESH->m_VertCount); - int id = Ilr->polygon.count/50; - if (id==0) id = 1; - for (int i=0; ipoint.count; i++){ -// if ((i%id)==0) UI->ProgressUpdate(i); - st_lwPoint& Ipt = Ilr->point.pt[i]; - Fvector& Mpt = MESH->m_Verts[i]; - Mpt.set (Ipt.pos); - } - } - if (!bResult) break; - // polygons -// UI->ProgressStart(Ilr->polygon.count,"Fill polygons:"); - MESH->m_FaceCount = Ilr->polygon.count; - MESH->m_Faces = xr_alloc(MESH->m_FaceCount); - MESH->m_SGs = xr_alloc(MESH->m_FaceCount); - Memory.mem_fill32 (MESH->m_SGs,u32(-1),MESH->m_FaceCount); - MESH->m_VMRefs.reserve (Ilr->polygon.count*3); - IntVec surf_ids; - surf_ids.resize(Ilr->polygon.count); - int id = Ilr->polygon.count/50; - if (id==0) id = 1; - for (int i=0; ipolygon.count; i++){ -// if ((i%id)==0) UI->ProgressUpdate(i); - st_Face& Mpol=MESH->m_Faces[i]; - st_lwPolygon& Ipol=Ilr->polygon.pol[i]; - if (Ipol.nverts!=3) { - ELog.DlgMsg(mtError, "Import LWO: Face must contain only 3 vertices!"); - bResult=false; - break; - } - for (int pv_i=0; pv_i<3; pv_i++){ - st_lwPolVert& Ipv=Ipol.v[pv_i]; - st_FaceVert& Mpv=Mpol.pv[pv_i]; - Mpv.pindex =Ipv.index; - - MESH->m_VMRefs.push_back(st_VMapPtLst()); - st_VMapPtLst& m_vm_lst = MESH->m_VMRefs.back(); - - DEFINE_VECTOR (st_VMapPt,VMapPtVec,VMapPtIt); - VMapPtVec vm_lst; - - Mpv.vmref = MESH->m_VMRefs.size()-1; - - // parse uv-map - int vmpl_cnt =Ipv.nvmaps; - st_lwPoint& Ipt =Ilr->point.pt[Mpv.pindex]; - int vmpt_cnt =Ipt.nvmaps; - if (!vmpl_cnt&&!vmpt_cnt){ - ELog.DlgMsg (mtError,"Found mesh without UV's!",0); - bResult = false; - break; - } - AStringVec names; - if (vmpl_cnt){ - // берем из poly - for (int vm_i=0; vm_itype!=ID_TXUV) continue; - vm_lst.push_back(st_VMapPt()); - st_VMapPt& pt = vm_lst.back(); - pt.vmap_index = VMIndices[Ipv.vm[vm_i].vmap];// номер моей VMap - names.push_back (Ipv.vm[vm_i].vmap->name); - pt.index = Ipv.vm[vm_i].index; - } - } - if (vmpt_cnt){ - // берем из points - for (int vm_i=0; vm_itype!=ID_TXUV) continue; - if (std::find(names.begin(),names.end(),Ipt.vm[vm_i].vmap->name)!=names.end()) continue; - vm_lst.push_back(st_VMapPt()); - st_VMapPt& pt = vm_lst.back(); - pt.vmap_index = VMIndices[Ipt.vm[vm_i].vmap]; // номер моей VMap - pt.index = Ipt.vm[vm_i].index; - } - } - - std::sort(vm_lst.begin(),vm_lst.end(),CompareFunc); - - // parse weight-map - int vm_cnt =Ipt.nvmaps; - for (int vm_i=0; vm_itype!=ID_WGHT) continue; - vm_lst.push_back(st_VMapPt()); - st_VMapPt& pt = vm_lst.back(); - pt.vmap_index = VMIndices[Ipt.vm[vm_i].vmap]; // номер моей VMap - pt.index = Ipt.vm[vm_i].index; - } - m_vm_lst.count = vm_lst.size(); - m_vm_lst.pts = xr_alloc(m_vm_lst.count); - Memory.mem_copy (m_vm_lst.pts,&*vm_lst.begin(),m_vm_lst.count*sizeof(st_VMapPt)); - } - if (!bResult) break; - // Ipol.surf->alpha_mode - заполнено как номер моего surface - surf_ids[i] = Ipol.surf->alpha_mode; - } - if (!bResult) break; - for (u32 pl_id=0; pl_idGetFCount(); pl_id++) - MESH->m_SurfFaces[m_Surfaces[surf_ids[pl_id]]].push_back(pl_id); - - if (!bResult) break; - k++; - //MESH->DumpAdjacency(); - if (bNeedOptimize) MESH->Optimize(false); - //MESH->DumpAdjacency(); - MESH->RebuildVMaps(); // !!!!!! - } - } - } -#ifdef _EDITOR - LWO_CloseFile(I); -#else - lwFreeObject(I); -#endif -// UI->ProgressEnd(); -// UI->SetStatus(""); - if (bResult) VerifyMeshNames(); - else ELog.DlgMsg(mtError,"Can't parse LWO object."); - if (bResult) m_LoadName = (strext(fname))? strcpy(strext(fname),".object"):strcat(strext(fname),".object"); - return bResult; - }else - ELog.DlgMsg(mtError,"Can't import LWO object file."); -// UI->ProgressEnd(); -// UI->SetStatus(""); - return false; -} - - diff --git a/cs/engine/plugins/lw/Export/EditObjectImportDB.cpp b/cs/engine/plugins/lw/Export/EditObjectImportDB.cpp deleted file mode 100644 index 924d3f511..000000000 --- a/cs/engine/plugins/lw/Export/EditObjectImportDB.cpp +++ /dev/null @@ -1,243 +0,0 @@ -//---------------------------------------------------- -// file: CEditObjectImport.cpp -//---------------------------------------------------- - -#include "stdafx.h" -#pragma hdrstop - -#include "EditObject.h" -#include "EditMesh.h" -#include "scenscan\objectdb.h" -#include -#include "bone.h" - -extern "C" LWMessageFuncs *g_msg; -DEFINE_MAP(void*,int,VMIndexLink,VMIndexLinkIt); - -bool CEditableObject::Import_LWO(st_ObjectDB *I){ - if (I){ - bool bResult=true; - - // parse lwo object - { - m_Meshes.resize (1); - m_Surfaces.resize (I->nsurfaces); - - // surfaces - { - for (int i=0; insurfaces; i++){ - DBSurface* Isf=&I->surf[i]; - CSurface* Osf = xr_new(); - m_Surfaces[i] = Osf; - Osf->SetName((Isf->name&&Isf->name[0])?Isf->name:"default"); - Osf->m_Flags.set(CSurface::sf2Sided,Isf->side==3); - // fill texture layers - string256 tex_name; - R_ASSERT(Isf->tex_cnt==1); - _splitpath( Isf->textures[0], 0, 0, tex_name, 0 ); - Osf->SetTexture(EFS.UpdateTextureNameWithFolder(tex_name)); - Osf->SetVMap(""); - - if (!Osf->_Texture()||!Osf->_Texture()[0]){ - g_msg->error("Can't create shader. Textures empty. Invalid surface:. ",Osf->_Name()); - bResult = false; - break; - } - - Osf->SetShader ("model"); - Osf->SetShaderXRLC ("default"); - - Osf->SetFVF(D3DFVF_XYZ|D3DFVF_NORMAL|(Isf->tex_cnt<(this); - m_Meshes[0]=MESH; - - strcpy(MESH->m_Name,"mesh"); - - // parse mesh data - // vmaps - DBVMap* Ivmap=0; - int vmap_count=0; - if (I->nvertmaps==0){ - g_msg->error("Import LWO: Mesh layer must contain UV!",0); - bResult=false; - break; - } - - // индексы соответствия импортируемых мап - static VMIndexLink VMIndices; - VMIndices.clear(); - - for (int vm_i=0; vm_invertmaps; vm_i++){ - Ivmap = &I->vmap[vm_i]; - switch(Ivmap->type){ - case LWVMAP_TXUV:{ - if (Ivmap->dim!=2){ - g_msg->error("Import LWO: 'UV Map' must contain 2 value!",0); - bResult=false; - break; - } - MESH->m_VMaps.push_back(xr_new(Ivmap->name,vmtUV,*Ivmap->vdpol>=0)); - st_VMap* Mvmap=MESH->m_VMaps.back(); - int vcnt=Ivmap->nverts; - // VMap, flip uv - for (int vm_i=0; vm_inverts; vm_i++) - Mvmap->appendUV(Ivmap->val[0][vm_i],1.f-Ivmap->val[1][vm_i]); - // vmap index - VMIndices[Ivmap] = vmap_count++; - }break; - case LWVMAP_WGHT:{ - if (Ivmap->dim!=1){ - g_msg->error("Import LWO: 'Weight' must contain 1 value!",0); - bResult=false; - break; - } - R_ASSERT(*Ivmap->vdpol==-1); - MESH->m_VMaps.push_back(xr_new(Ivmap->name,vmtWeight,FALSE)); - st_VMap* Mvmap=MESH->m_VMaps.back(); - int vcnt=Ivmap->nverts; - // VMap - Mvmap->copyfrom(*Ivmap->val,vcnt); - // vmap index - VMIndices[Ivmap] = vmap_count++; - }break; - case LWVMAP_PICK: g_msg->error("Found 'PICK' VMAP. Import failed.",0); bResult = false; break; - case LWVMAP_MNVW: g_msg->error("Found 'MNVW' VMAP. Import failed.",0); bResult = false; break; - case LWVMAP_MORF: g_msg->error("Found 'MORF' VMAP. Import failed.",0); bResult = false; break; - case LWVMAP_SPOT: g_msg->error("Found 'SPOT' VMAP. Import failed.",0); bResult = false; break; - case LWVMAP_RGB: g_msg->error("Found 'RGB' VMAP. Import failed.",0); bResult = false; break; - case LWVMAP_RGBA: g_msg->error("Found 'RGBA' VMAP. Import failed.",0); bResult = false; break; - } - if (!bResult) break; - } - if (!bResult) break; - // points - { - MESH->m_Points.resize(I->npoints); - MESH->m_Adjs.resize(I->npoints); - for (int i=0; inpoints; i++){ - DBPoint& Ipt = I->pt[i]; - Fvector& Mpt = MESH->m_Points[i]; - IntVec& a_lst = MESH->m_Adjs[i]; - Mpt.set (Ipt.pos[0]); - copy (Ipt.pol,Ipt.pol+Ipt.npols,inserter(a_lst,a_lst.begin())); - sort (a_lst.begin(),a_lst.end()); - } - } - if (!bResult) break; - // polygons - MESH->m_Faces.resize(I->npolygons); - MESH->m_VMRefs.reserve(I->npolygons*3); - IntVec surf_ids; - surf_ids.resize(I->npolygons); - for (int p_i=0; p_inpolygons; p_i++){ - st_Face& Mpol=MESH->m_Faces[p_i]; - DBPolygon& Ipol=I->pol[p_i]; - if (Ipol.nverts!=3) { - g_msg->error("Import LWO: Face must contain only 3 vertices!",0); - bResult=false; - break; - } - for (int pv_i=0; pv_i<3; pv_i++){ - DBPolVert& Ipv=Ipol.v[pv_i]; - st_FaceVert& Mpv=Mpol.pv[pv_i]; - Mpv.pindex =Ipv.index; - - MESH->m_VMRefs.push_back(VMapPtSVec()); - VMapPtSVec& vm_lst = MESH->m_VMRefs.back(); - Mpv.vmref = MESH->m_VMRefs.size()-1; - - // parse uv-map - int vmp_cnt =Ipv.nvmaps; - if (vmp_cnt){ - // берем из poly - for (int vm_i=0; vm_itype!=LWVMAP_TXUV) continue; - vm_lst.push_back(st_VMapPt()); - st_VMapPt& pt = vm_lst.back(); - pt.vmap_index = VMIndices[Ipv.vm[vm_i].vmap];// номер моей VMap - pt.index = Ipv.vm[vm_i].index; - } - }else{ - // берем из points - DBPoint& Ipt = I->pt[Mpv.pindex]; - int vm_cnt =Ipt.nvmaps; - if (!vm_cnt){ - g_msg->error("Can't find polygon/point UV-map!",0); - bResult = false; - break; - } - for (int vm_i=0; vm_itype!=LWVMAP_TXUV) continue; - vm_lst.push_back(st_VMapPt()); - st_VMapPt& pt = vm_lst.back(); - pt.vmap_index = VMIndices[Ipt.vm[vm_i].vmap]; // номер моей VMap - pt.index = Ipt.vm[vm_i].index; - } - } - - // parse weight-map - DBPoint& Ipt = I->pt[Mpv.pindex]; - int vm_cnt =Ipt.nvmaps; - for (int vm_i=0; vm_itype!=LWVMAP_WGHT) continue; - vm_lst.push_back(st_VMapPt()); - st_VMapPt& pt = vm_lst.back(); - pt.vmap_index = VMIndices[Ipt.vm[vm_i].vmap]; // номер моей VMap - pt.index = Ipt.vm[vm_i].index; - } - - } - if (!bResult) break; - // Ipol.surf->alpha_mode - заполнено как номер моего surface - surf_ids[p_i] = Ipol.sindex; - } - if (!bResult) break; - int p_idx=0; - for (FaceIt pl_it=MESH->m_Faces.begin(); pl_it!=MESH->m_Faces.end(); pl_it++){ - MESH->m_SurfFaces[m_Surfaces[surf_ids[p_idx]]].push_back(p_idx); - p_idx++; - } - if ((MESH->GetVertexCount()<4)||(MESH->GetFaceCount()<2)) - { - ELog.Msg(mtError,"Invalid mesh: '%s'. Faces<2 or Verts<4",MESH->GetName()); - bResult = false; - } - if (!bResult) break; - MESH->RecomputeBBox(); - - // check weight maps - if (!m_Bones.empty()){ - for (BoneIt b_it=m_Bones.begin(); b_it!=m_Bones.end(); b_it++){ - if ((*b_it)->WMap()[0]&&(-1==MESH->FindVMapByName(MESH->m_VMaps,(*b_it)->WMap(),vmtWeight,FALSE))){ - g_msg->error("Can't find weight map:",(*b_it)->Name()); - bResult = false; - break; - } - } - } - if (bResult) MESH->RebuildVMaps(); - }while(0); - } - } - if (!bResult) g_msg->error("Can't parse LWO object.",0); - if (bResult){ - // fill default bone part - m_BoneParts.push_back(SBonePart()); - SBonePart& BP = m_BoneParts.back(); - BP.alias = "default"; - for (DWORD b_i=0; b_iName()); - } - - return bResult; - }else - g_msg->error("Can't export LWO object file.",0); - return false; -} - diff --git a/cs/engine/plugins/lw/Export/LWO/clip.c b/cs/engine/plugins/lw/Export/LWO/clip.c deleted file mode 100644 index e651e9c16..000000000 --- a/cs/engine/plugins/lw/Export/LWO/clip.c +++ /dev/null @@ -1,249 +0,0 @@ -/* -====================================================================== -clip.c - -Functions for LWO2 image references. - -Ernie Wright 17 Sep 00 -====================================================================== */ - -#include -#include -#include "lwo2.h" - - -/* -====================================================================== -lwFreeClip() - -Free memory used by an lwClip. -====================================================================== */ - -void lwFreeClip( lwClip *clip ) -{ - if ( clip ) { - lwListFree( clip->ifilter, lwFreePlugin ); - lwListFree( clip->pfilter, lwFreePlugin ); - free( clip ); - } -} - - -/* -====================================================================== -lwGetClip() - -Read image references from a CLIP chunk in an LWO2 file. -====================================================================== */ - -lwClip *lwGetClip( FILE *fp, int cksize ) -{ - lwClip *clip; - lwPlugin *filt; - unsigned int id; - unsigned short sz; - int pos, rlen; - - - /* allocate the Clip structure */ - - clip = calloc( 1, sizeof( lwClip )); - if ( !clip ) goto Fail; - - clip->contrast.val = 1.0f; - clip->brightness.val = 1.0f; - clip->saturation.val = 1.0f; - clip->gamma.val = 1.0f; - - /* remember where we started */ - - set_flen( 0 ); - pos = ftell( fp ); - - /* index */ - - clip->index = getI4( fp ); - - /* first subchunk header */ - - clip->type = getU4( fp ); - sz = getU2( fp ); - if ( 0 > get_flen() ) goto Fail; - - sz += sz & 1; - set_flen( 0 ); - - switch ( clip->type ) { - case ID_STIL: - clip->source.still.name = getS0( fp ); - break; - - case ID_ISEQ: - clip->source.seq.digits = getU1( fp ); - clip->source.seq.flags = getU1( fp ); - clip->source.seq.offset = getI2( fp ); - clip->source.seq.start = getI2( fp ); - clip->source.seq.end = getI2( fp ); - clip->source.seq.prefix = getS0( fp ); - clip->source.seq.suffix = getS0( fp ); - break; - - case ID_ANIM: - clip->source.anim.name = getS0( fp ); - clip->source.anim.server = getS0( fp ); - rlen = get_flen(); - clip->source.anim.data = getbytes( fp, sz - rlen ); - break; - - case ID_XREF: - clip->source.xref.index = getI4( fp ); - clip->source.xref.string = getS0( fp ); - break; - - case ID_STCC: - clip->source.cycle.lo = getI2( fp ); - clip->source.cycle.hi = getI2( fp ); - clip->source.cycle.name = getS0( fp ); - break; - - default: - break; - } - - /* error while reading current subchunk? */ - - rlen = get_flen(); - if ( rlen < 0 || rlen > sz ) goto Fail; - - /* skip unread parts of the current subchunk */ - - if ( rlen < sz ) - fseek( fp, sz - rlen, SEEK_CUR ); - - /* end of the CLIP chunk? */ - - rlen = ftell( fp ) - pos; - if ( cksize < rlen ) goto Fail; - if ( cksize == rlen ) - return clip; - - /* process subchunks as they're encountered */ - - id = getU4( fp ); - sz = getU2( fp ); - if ( 0 > get_flen() ) goto Fail; - - while ( 1 ) { - sz += sz & 1; - set_flen( 0 ); - - switch ( id ) { - case ID_TIME: - clip->start_time = getF4( fp ); - clip->duration = getF4( fp ); - clip->frame_rate = getF4( fp ); - break; - - case ID_CONT: - clip->contrast.val = getF4( fp ); - clip->contrast.eindex = getVX( fp ); - break; - - case ID_BRIT: - clip->brightness.val = getF4( fp ); - clip->brightness.eindex = getVX( fp ); - break; - - case ID_SATR: - clip->saturation.val = getF4( fp ); - clip->saturation.eindex = getVX( fp ); - break; - - case ID_HUE: - clip->hue.val = getF4( fp ); - clip->hue.eindex = getVX( fp ); - break; - - case ID_GAMM: - clip->gamma.val = getF4( fp ); - clip->gamma.eindex = getVX( fp ); - break; - - case ID_NEGA: - clip->negative = getU2( fp ); - break; - - case ID_IFLT: - case ID_PFLT: - filt = calloc( 1, sizeof( lwPlugin )); - if ( !filt ) goto Fail; - - filt->name = getS0( fp ); - filt->flags = getU2( fp ); - rlen = get_flen(); - filt->data = getbytes( fp, sz - rlen ); - - if ( id == ID_IFLT ) { - lwListAdd( &clip->ifilter, filt ); - clip->nifilters++; - } - else { - lwListAdd( &clip->pfilter, filt ); - clip->npfilters++; - } - break; - - default: - break; - } - - /* error while reading current subchunk? */ - - rlen = get_flen(); - if ( rlen < 0 || rlen > sz ) goto Fail; - - /* skip unread parts of the current subchunk */ - - if ( rlen < sz ) - fseek( fp, sz - rlen, SEEK_CUR ); - - /* end of the CLIP chunk? */ - - rlen = ftell( fp ) - pos; - if ( cksize < rlen ) goto Fail; - if ( cksize == rlen ) break; - - /* get the next chunk header */ - - set_flen( 0 ); - id = getU4( fp ); - sz = getU2( fp ); - if ( 6 != get_flen() ) goto Fail; - } - - return clip; - -Fail: - lwFreeClip( clip ); - return NULL; -} - - -/* -====================================================================== -lwFindClip() - -Returns an lwClip pointer, given a clip index. -====================================================================== */ - -lwClip *lwFindClip( lwClip *list, int index ) -{ - lwClip *clip; - - clip = list; - while ( clip ) { - if ( clip->index == index ) break; - clip = clip->next; - } - return clip; -} diff --git a/cs/engine/plugins/lw/Export/LWO/envelope.c b/cs/engine/plugins/lw/Export/LWO/envelope.c deleted file mode 100644 index ca01eed7b..000000000 --- a/cs/engine/plugins/lw/Export/LWO/envelope.c +++ /dev/null @@ -1,610 +0,0 @@ -/* -====================================================================== -envelope.c - -Envelope functions for an LWO2 reader. - -Ernie Wright 17 Sep 00 -====================================================================== */ - -#include -#include -#include -#include "lwo2.h" -#include "envelope.h" - - -/* -====================================================================== -lwFreeEnvelope() - -Free the memory used by an lwEnvelope. -====================================================================== */ - -void w_free(void* p){ - free(p); -} - -void lwFreeEnvelope( lwEnvelope *env ) -{ - if ( env ) { - if ( env->name ) free( env->name ); - lwListFree( env->key, w_free ); - lwListFree( env->cfilter, lwFreePlugin ); - free( env ); - } -} - - -static int compare_keys( lwKey *k1, lwKey *k2 ) -{ - return k1->time > k2->time ? 1 : k1->time < k2->time ? -1 : 0; -} - - -/* -====================================================================== -lwGetEnvelope() - -Read an ENVL chunk from an LWO2 file. -====================================================================== */ - -lwEnvelope *lwGetEnvelope( FILE *fp, int cksize ) -{ - lwEnvelope *env; - lwKey *key; - lwPlugin *plug; - unsigned int id; - unsigned short sz; - float f[ 4 ]; - int i, nparams, pos, rlen; - - - /* allocate the Envelope structure */ - - env = calloc( 1, sizeof( lwEnvelope )); - if ( !env ) goto Fail; - - /* remember where we started */ - - set_flen( 0 ); - pos = ftell( fp ); - - /* index */ - - env->index = getVX( fp ); - - /* first subchunk header */ - - id = getU4( fp ); - sz = getU2( fp ); - if ( 0 > get_flen() ) goto Fail; - - /* process subchunks as they're encountered */ - - while ( 1 ) { - sz += sz & 1; - set_flen( 0 ); - - switch ( id ) { - case ID_TYPE: - env->type = getU2( fp ); - break; - - case ID_NAME: - env->name = getS0( fp ); - break; - - case ID_PRE: - env->behavior[ 0 ] = getU2( fp ); - break; - - case ID_POST: - env->behavior[ 1 ] = getU2( fp ); - break; - - case ID_KEY: - key = calloc( 1, sizeof( lwKey )); - if ( !key ) goto Fail; - key->time = getF4( fp ); - key->value = getF4( fp ); - lwListInsert( &env->key, key, compare_keys ); - env->nkeys++; - break; - - case ID_SPAN: - if ( !key ) goto Fail; - key->shape = getU4( fp ); - - nparams = ( sz - 4 ) / 4; - if ( nparams > 4 ) nparams = 4; - for ( i = 0; i < nparams; i++ ) - f[ i ] = getF4( fp ); - - switch ( key->shape ) { - case ID_TCB: - key->tension = f[ 0 ]; - key->continuity = f[ 1 ]; - key->bias = f[ 2 ]; - break; - - case ID_BEZI: - case ID_HERM: - case ID_BEZ2: - for ( i = 0; i < nparams; i++ ) - key->param[ i ] = f[ i ]; - break; - } - break; - - case ID_CHAN: - plug = calloc( 1, sizeof( lwPlugin )); - if ( !plug ) goto Fail; - - plug->name = getS0( fp ); - plug->flags = getU2( fp ); - plug->data = getbytes( fp, sz - get_flen() ); - - lwListAdd( &env->cfilter, plug ); - env->ncfilters++; - break; - - default: - break; - } - - /* error while reading current subchunk? */ - - rlen = get_flen(); - if ( rlen < 0 || rlen > sz ) goto Fail; - - /* skip unread parts of the current subchunk */ - - if ( rlen < sz ) - fseek( fp, sz - rlen, SEEK_CUR ); - - /* end of the ENVL chunk? */ - - rlen = ftell( fp ) - pos; - if ( cksize < rlen ) goto Fail; - if ( cksize == rlen ) break; - - /* get the next subchunk header */ - - set_flen( 0 ); - id = getU4( fp ); - sz = getU2( fp ); - if ( 6 != get_flen() ) goto Fail; - } - - return env; - -Fail: - lwFreeEnvelope( env ); - return NULL; -} - - -/* -====================================================================== -lwFindEnvelope() - -Returns an lwEnvelope pointer, given an envelope index. -====================================================================== */ - -lwEnvelope *lwFindEnvelope( lwEnvelope *list, int index ) -{ - lwEnvelope *env; - - env = list; - while ( env ) { - if ( env->index == index ) break; - env = env->next; - } - return env; -} - - -/* -====================================================================== -range() - -Given the value v of a periodic function, returns the equivalent value -v2 in the principal interval [lo, hi]. If i isn't NULL, it receives -the number of wavelengths between v and v2. - - v2 = v - i * (hi - lo) - -For example, range( 3 pi, 0, 2 pi, i ) returns pi, with i = 1. -====================================================================== */ - -static float range( float v, float lo, float hi, int *i ) -{ - float v2, r = hi - lo; - - if ( r == 0.0 ) { - if ( i ) *i = 0; - return lo; - } - - v2 = lo + v - r * ( float ) floor(( double ) v / r ); - if ( i ) *i = -( int )(( v2 - v ) / r + ( v2 > v ? 0.5 : -0.5 )); - - return v2; -} - - -/* -====================================================================== -hermite() - -Calculate the Hermite coefficients. -====================================================================== */ - -static void hermite( float t, float *h1, float *h2, float *h3, float *h4 ) -{ - float t2, t3; - - t2 = t * t; - t3 = t * t2; - - *h2 = 3.0f * t2 - t3 - t3; - *h1 = 1.0f - *h2; - *h4 = t3 - t2; - *h3 = *h4 - t2 + t; -} - - -/* -====================================================================== -outgoing() - -Return the outgoing tangent to the curve at key0. -====================================================================== */ - -static float outgoing( lwKey *key0, Key *key1 ) -{ - float a, b, d, t, out; - - switch ( key0->shape ) - { - case SHAPE_TCB: - a = ( 1.0f - key0->tension ) - * ( 1.0f + key0->continuity ) - * ( 1.0f + key0->bias ); - b = ( 1.0f - key0->tension ) - * ( 1.0f - key0->continuity ) - * ( 1.0f - key0->bias ); - d = key1->value - key0->value; - - if ( key0->prev ) { - t = ( key1->time - key0->time ) / ( key1->time - key0->prev->time ); - out = t * ( a * ( key0->value - key0->prev->value ) + b * d ); - } - else - out = 0.5f * ( a + b ) * d; - break; - - case SHAPE_BEZI: - case SHAPE_HERM: - out = key0->param[ 1 ]; - if ( key0->prev ) - out *= ( key1->time - key0->time ) / ( key1->time - key0->prev->time ); - break; - - case SHAPE_LINE: - case SHAPE_STEP: - case SHAPE_BEZ2: - default: - out = 0.0f; - break; - } - - return out; -} - - -/* -====================================================================== -incoming() - -Return the incoming tangent to the curve at key1. This works for -everything except BEZ2, which needs to be treated differently. -====================================================================== */ - -static float incoming( Key *key0, Key *key1 ) -{ - float a, b, d, t, in; - - switch ( key1->shape ) - { - case SHAPE_LINE: - in = ( key1->value - key0->value ) / ( key1->time - key0->time ); - break; - - case SHAPE_TCB: - a = ( 1.0f - key1->tension ) - * ( 1.0f - key1->continuity ) - * ( 1.0f + key1->bias ); - b = ( 1.0f - key1->tension ) - * ( 1.0f + key1->continuity ) - * ( 1.0f - key1->bias ); - d = key1->value - key0->value; - - if ( key1->next ) { - t = ( key1->time - key0->time ) / ( key1->next->time - key0->time ); - in = t * ( b * ( key1->next->value - key1->value ) + a * d ); - } - else - in = 0.5f * ( a + b ) * d; - break; - - case SHAPE_BEZI: - case SHAPE_HERM: - in = key1->param[ 0 ]; - if ( key1->next ) - in *= ( key1->time - key0->time ) / ( key1->next->time - key0->time ); - break; - return in; - - case SHAPE_STEP: - default: - in = 0.0f; - break; - } - - return in; -} - - -/* -====================================================================== -bezier() - -Interpolate the value of a 1D Bezier curve. -====================================================================== */ - -static float bezier( float x0, float x1, float x2, float x3, float t ) -{ - float a, b, c, t2, t3; - - t2 = t * t; - t3 = t2 * t; - - c = 3.0f * ( x1 - x0 ); - b = 3.0f * ( x2 - x1 ) - c; - a = x3 - x0 - c - b; - - return a * t3 + b * t2 + c * t + x0; -} - - -/* -====================================================================== -bez2_time() - -Find the t for which bezier() returns the input time. The handle -endpoints of a BEZ2 curve represent the control points, and these have -(time, value) coordinates, so time is used as both a coordinate and a -parameter for this curve type. -====================================================================== */ - -static float bez2_time( float x0, float x1, float x2, float x3, float time, - float *t0, float *t1 ) -{ - float v, t; - - t = *t0 + ( *t1 - *t0 ) * 0.5f; - v = bezier( x0, x1, x2, x3, t ); - if ( fabs( time - v ) > .0001f ) { - if ( v > time ) - *t1 = t; - else - *t0 = t; - return bez2_time( x0, x1, x2, x3, time, t0, t1 ); - } - else - return t; -} - - -/* -====================================================================== -bez2() - -Interpolate the value of a BEZ2 curve. -====================================================================== */ - -static float bez2( Key *key0, Key *key1, float time ) -{ - float x, y, t, t0 = 0.0f, t1 = 1.0f; - - if ( key0->shape == SHAPE_BEZ2 ) - x = key0->time + key0->param[ 2 ]; - else - x = key0->time + ( key1->time - key0->time ) / 3.0f; - - t = bez2_time( key0->time, x, key1->time + key1->param[ 0 ], key1->time, - time, &t0, &t1 ); - - if ( key0->shape == SHAPE_BEZ2 ) - y = key0->value + key0->param[ 3 ]; - else - y = key0->value + outgoing( key0, key1 ) / 3.0f; - - return bezier( key0->value, y, key1->param[ 1 ] + key1->value, key1->value, t ); -} - - -/* -====================================================================== -lwEvalEnvelope() - -Given a list of keys and a time, returns the interpolated value of the -envelope at that time. -====================================================================== */ - -float lwEvalEnvelope( lwEnvelope *env, float time ) -{ - lwKey *key0, *key1, *skey, *ekey; - float t, h1, h2, h3, h4, in, out, offset = 0.0f; - int noff; - - - /* if there's no key, the value is 0 */ - - if ( env->nkeys == 0 ) return 0.0f; - - /* if there's only one key, the value is constant */ - - if ( env->nkeys == 1 ) - return env->key->value; - - /* find the first and last keys */ - - skey = ekey = env->key; - while ( ekey->next ) ekey = ekey->next; - - /* use pre-behavior if time is before first key time */ - - if ( time < skey->time ) { - switch ( env->behavior[ 0 ] ) - { - case BEH_RESET: - return 0.0f; - - case BEH_CONSTANT: - return skey->value; - - case BEH_REPEAT: - time = range( time, skey->time, ekey->time, NULL ); - break; - - case BEH_OSCILLATE: - time = range( time, skey->time, ekey->time, &noff ); - if ( noff % 2 ) - time = ekey->time - skey->time - time; - break; - - case BEH_OFFSET: - time = range( time, skey->time, ekey->time, &noff ); - offset = noff * ( ekey->value - skey->value ); - break; - - case BEH_LINEAR: - switch ( skey->shape ) { - case SHAPE_STEP: - return skey->value; - case SHAPE_LINE: - return ( skey->value - skey->next->value ) - / ( skey->time - skey->next->time ) - * ( time - skey->next->time ) - + skey->next->value; - case SHAPE_TCB: - case SHAPE_HERM: - case SHAPE_BEZI: - out = outgoing( skey, skey->next ) - / ( skey->next->time - skey->time ); - return out * ( time - skey->time ) + skey->value; - case SHAPE_BEZ2: - return ( skey->param[ 1 ] - skey->param[ 3 ] ) - / ( skey->param[ 0 ] - skey->param[ 2 ] ) - * ( time - skey->time ) - + skey->value; - } - } - } - - /* use post-behavior if time is after last key time */ - - else if ( time > ekey->time ) { - switch ( env->behavior[ 1 ] ) - { - case BEH_RESET: - return 0.0f; - - case BEH_CONSTANT: - return ekey->value; - - case BEH_REPEAT: - time = range( time, skey->time, ekey->time, NULL ); - break; - - case BEH_OSCILLATE: - time = range( time, skey->time, ekey->time, &noff ); - if ( noff % 2 ) - time = ekey->time - skey->time - time; - break; - - case BEH_OFFSET: - time = range( time, skey->time, ekey->time, &noff ); - offset = noff * ( ekey->value - skey->value ); - break; - - case BEH_LINEAR: - switch ( ekey->shape ) { - case SHAPE_STEP: - return ekey->value; - case SHAPE_LINE: - return ( ekey->value - ekey->prev->value ) - / ( ekey->time - ekey->prev->time ) - * ( time - ekey->prev->time ) - + ekey->prev->value; - case SHAPE_TCB: - case SHAPE_HERM: - case SHAPE_BEZI: - in = incoming( ekey->prev, ekey ) - / ( ekey->time - ekey->prev->time ); - return in * ( time - ekey->time ) + ekey->value; - case SHAPE_BEZ2: - return ( ekey->param[ 3 ] - ekey->param[ 1 ] ) - / ( ekey->param[ 2 ] - ekey->param[ 0 ] ) - * ( time - ekey->time ) - + ekey->value; - } - } - } - - /* get the endpoints of the interval being evaluated */ - - key0 = env->key; - while ( time > key0->next->time ) - key0 = key0->next; - key1 = key0->next; - - /* check for singularities first */ - - if ( time == key0->time ) - return key0->value + offset; - else if ( time == key1->time ) - return key1->value + offset; - - /* get interval length, time in [0, 1] */ - - t = ( time - key0->time ) / ( key1->time - key0->time ); - - /* interpolate */ - - switch ( key1->shape ) - { - case SHAPE_TCB: - case SHAPE_BEZI: - case SHAPE_HERM: - out = outgoing( key0, key1 ); - in = incoming( key0, key1 ); - hermite( t, &h1, &h2, &h3, &h4 ); - return h1 * key0->value + h2 * key1->value + h3 * out + h4 * in + offset; - - case SHAPE_BEZ2: - return bez2( key0, key1, time ) + offset; - - case SHAPE_LINE: - return key0->value + t * ( key1->value - key0->value ) + offset; - - case SHAPE_STEP: - return key0->value + offset; - - default: - return offset; - } -} diff --git a/cs/engine/plugins/lw/Export/LWO/envelope.h b/cs/engine/plugins/lw/Export/LWO/envelope.h deleted file mode 100644 index 5c723b4ab..000000000 --- a/cs/engine/plugins/lw/Export/LWO/envelope.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -====================================================================== -envelope.h - -Definitions for local copies of LightWave envelopes. - -Ernie Wright 31 Aug 00 - -The LightWave plug-in SDK provides its own representation of LightWave -envelopes that plug-ins can use. These definitions are for standalone -programs that, for example, read scene or object files and must store -the envelopes. -====================================================================== */ - -#define SHAPE_TCB 0 -#define SHAPE_HERM 1 -#define SHAPE_BEZI 2 -#define SHAPE_LINE 3 -#define SHAPE_STEP 4 -#define SHAPE_BEZ2 5 - -#define BEH_RESET 0 -#define BEH_CONSTANT 1 -#define BEH_REPEAT 2 -#define BEH_OSCILLATE 3 -#define BEH_OFFSET 4 -#define BEH_LINEAR 5 - - -typedef struct st_Key { - struct st_Key *next; - struct st_Key *prev; - float value; - float time; - int shape; - float tension; - float continuity; - float bias; - float param[ 4 ]; -} Key; - -typedef struct st_Envelope { - Key *key; - int nkeys; - int behavior[ 2 ]; -} Envelope; - - -float evalEnvelope( Envelope *env, float time ); diff --git a/cs/engine/plugins/lw/Export/LWO/list.c b/cs/engine/plugins/lw/Export/LWO/list.c deleted file mode 100644 index 431e6fcb7..000000000 --- a/cs/engine/plugins/lw/Export/LWO/list.c +++ /dev/null @@ -1,102 +0,0 @@ -/* -====================================================================== -list.c - -Generic linked list operations. - -Ernie Wright 17 Sep 00 -====================================================================== */ - -#include -#include -#include "lwo2.h" - - -/* -====================================================================== -lwListFree() - -Free the items in a list. -====================================================================== */ - -void lwListFree( void *list, void ( *freeNode )( void * )) -{ - lwNode *node, *next; - - node = ( lwNode * ) list; - while ( node ) { - next = node->next; - freeNode( node ); - node = next; - } -} - - -/* -====================================================================== -lwListAdd() - -Append a node to a list. -====================================================================== */ - -void lwListAdd( void **list, void *node ) -{ - lwNode *head, *tail; - - head = *(( lwNode ** ) list ); - if ( !head ) { - *list = node; - return; - } - while ( head ) { - tail = head; - head = head->next; - } - tail->next = ( lwNode * ) node; - (( lwNode * ) node )->prev = tail; -} - - -/* -====================================================================== -lwListInsert() - -Insert a node into a list in sorted order. -====================================================================== */ - -void lwListInsert( void **vlist, void *vitem, int ( *compare )( void *, void * )) -{ - lwNode **list, *item, *node, *prev; - - if ( !*vlist ) { - *vlist = vitem; - return; - } - - list = ( lwNode ** ) vlist; - item = ( lwNode * ) vitem; - node = *list; - prev = NULL; - - while ( node ) { - if ( 0 < compare( node, item )) break; - prev = node; - node = node->next; - } - - if ( !prev ) { - *list = item; - node->prev = item; - item->next = node; - } - else if ( !node ) { - prev->next = item; - item->prev = prev; - } - else { - item->next = node; - item->prev = prev; - prev->next = item; - node->prev = item; - } -} diff --git a/cs/engine/plugins/lw/Export/LWO/lwio.c b/cs/engine/plugins/lw/Export/LWO/lwio.c deleted file mode 100644 index 7139f8016..000000000 --- a/cs/engine/plugins/lw/Export/LWO/lwio.c +++ /dev/null @@ -1,444 +0,0 @@ -/* -====================================================================== -lwio.c - -Functions for reading basic LWO2 data types. - -Ernie Wright 17 Sep 00 -====================================================================== */ - -#include -#include -#include -#include -#include "lwo2.h" - - -/* -====================================================================== -flen - -This accumulates a count of the number of bytes read. Callers can set -it at the beginning of a sequence of reads and then retrieve it to get -the number of bytes actually read. If one of the I/O functions fails, -flen is set to an error code, after which the I/O functions ignore -read requests until flen is reset. -====================================================================== */ - -#define FLEN_ERROR INT_MIN - -static int flen; - -void set_flen( int i ) { flen = i; } - -int get_flen( void ) { return flen; } - - -#ifdef _WIN32 -/* -===================================================================== -revbytes() - -Reverses byte order in place. - -INPUTS - bp bytes to reverse - elsize size of the underlying data type - elcount number of elements to swap - -RESULTS - Reverses the byte order in each of elcount elements. - -This only needs to be defined on little-endian platforms, most -notably Windows. lwo2.h replaces this with a #define on big-endian -platforms. -===================================================================== */ - -void revbytes( void *bp, int elsize, int elcount ) -{ - register unsigned char *p, *q; - - p = ( unsigned char * ) bp; - - if ( elsize == 2 ) { - q = p + 1; - while ( elcount-- ) { - *p ^= *q; - *q ^= *p; - *p ^= *q; - p += 2; - q += 2; - } - return; - } - - while ( elcount-- ) { - q = p + elsize - 1; - while ( p < q ) { - *p ^= *q; - *q ^= *p; - *p ^= *q; - ++p; - --q; - } - p += elsize >> 1; - } -} -#endif - - -void *getbytes( FILE *fp, int size ) -{ - void *data; - - if ( flen == FLEN_ERROR ) return NULL; - if ( size < 0 ) { - flen = FLEN_ERROR; - return NULL; - } - data = malloc( size ); - if ( !data ) { - flen = FLEN_ERROR; - return NULL; - } - if ( 1 != fread( data, size, 1, fp )) { - flen = FLEN_ERROR; - free( data ); - return NULL; - } - - flen += size; - return data; -} - - -void skipbytes( FILE *fp, int n ) -{ - if ( flen == FLEN_ERROR ) return; - if ( fseek( fp, n, SEEK_CUR )) - flen = FLEN_ERROR; - else - flen += n; -} - - -int getI1( FILE *fp ) -{ - int i; - - if ( flen == FLEN_ERROR ) return 0; - i = fgetc( fp ); - if ( i < 0 ) { - flen = FLEN_ERROR; - return 0; - } - if ( i > 127 ) i -= 256; - flen += 1; - return i; -} - - -short getI2( FILE *fp ) -{ - short i; - - if ( flen == FLEN_ERROR ) return 0; - if ( 1 != fread( &i, 2, 1, fp )) { - flen = FLEN_ERROR; - return 0; - } - revbytes( &i, 2, 1 ); - flen += 2; - return i; -} - - -int getI4( FILE *fp ) -{ - int i; - - if ( flen == FLEN_ERROR ) return 0; - if ( 1 != fread( &i, 4, 1, fp )) { - flen = FLEN_ERROR; - return 0; - } - revbytes( &i, 4, 1 ); - flen += 4; - return i; -} - - -unsigned char getU1( FILE *fp ) -{ - int i; - - if ( flen == FLEN_ERROR ) return 0; - i = fgetc( fp ); - if ( i < 0 ) { - flen = FLEN_ERROR; - return 0; - } - flen += 1; - return i; -} - - -unsigned short getU2( FILE *fp ) -{ - unsigned short i; - - if ( flen == FLEN_ERROR ) return 0; - if ( 1 != fread( &i, 2, 1, fp )) { - flen = FLEN_ERROR; - return 0; - } - revbytes( &i, 2, 1 ); - flen += 2; - return i; -} - - -unsigned int getU4( FILE *fp ) -{ - unsigned int i; - - if ( flen == FLEN_ERROR ) return 0; - if ( 1 != fread( &i, 4, 1, fp )) { - flen = FLEN_ERROR; - return 0; - } - revbytes( &i, 4, 1 ); - flen += 4; - return i; -} - - -int getVX( FILE *fp ) -{ - int i, c; - - if ( flen == FLEN_ERROR ) return 0; - - c = fgetc( fp ); - if ( c != 0xFF ) { - i = c << 8; - c = fgetc( fp ); - i |= c; - flen += 2; - } - else { - c = fgetc( fp ); - i = c << 16; - c = fgetc( fp ); - i |= c << 8; - c = fgetc( fp ); - i |= c; - flen += 4; - } - - if ( ferror( fp )) { - flen = FLEN_ERROR; - return 0; - } - return i; -} - - -float getF4( FILE *fp ) -{ - float f; - - if ( flen == FLEN_ERROR ) return 0.0f; - if ( 1 != fread( &f, 4, 1, fp )) { - flen = FLEN_ERROR; - return 0.0f; - } - revbytes( &f, 4, 1 ); - flen += 4; - return f; -} - - -char *getS0( FILE *fp ) -{ - char *s; - int i, c, len, pos; - - if ( flen == FLEN_ERROR ) return NULL; - - pos = ftell( fp ); - for ( i = 1; ; i++ ) { - c = fgetc( fp ); - if ( c <= 0 ) break; - } - if ( c < 0 ) { - flen = FLEN_ERROR; - return NULL; - } - - if ( i == 1 ) { - if ( fseek( fp, pos + 2, SEEK_SET )) - flen = FLEN_ERROR; - else - flen += 2; - return NULL; - } - - len = i + ( i & 1 ); - s = malloc( len ); - if ( !s ) { - flen = FLEN_ERROR; - return NULL; - } - - if ( fseek( fp, pos, SEEK_SET )) { - flen = FLEN_ERROR; - return NULL; - } - if ( 1 != fread( s, len, 1, fp )) { - flen = FLEN_ERROR; - return NULL; - } - - flen += len; - return s; -} - - -int sgetI1( unsigned char **bp ) -{ - int i; - - if ( flen == FLEN_ERROR ) return 0; - i = **bp; - if ( i > 127 ) i -= 256; - flen += 1; - *bp++; - return i; -} - - -short sgetI2( unsigned char **bp ) -{ - short i; - - if ( flen == FLEN_ERROR ) return 0; - memcpy( &i, *bp, 2 ); - revbytes( &i, 2, 1 ); - flen += 2; - *bp += 2; - return i; -} - - -int sgetI4( unsigned char **bp ) -{ - int i; - - if ( flen == FLEN_ERROR ) return 0; - memcpy( &i, *bp, 4 ); - revbytes( &i, 4, 1 ); - flen += 4; - *bp += 4; - return i; -} - - -unsigned char sgetU1( unsigned char **bp ) -{ - unsigned char c; - - if ( flen == FLEN_ERROR ) return 0; - c = **bp; - flen += 1; - *bp++; - return c; -} - - -unsigned short sgetU2( unsigned char **bp ) -{ - unsigned char *buf = *bp; - unsigned short i; - - if ( flen == FLEN_ERROR ) return 0; - i = ( buf[ 0 ] << 8 ) | buf[ 1 ]; - flen += 2; - *bp += 2; - return i; -} - - -unsigned int sgetU4( unsigned char **bp ) -{ - unsigned int i; - - if ( flen == FLEN_ERROR ) return 0; - memcpy( &i, *bp, 4 ); - revbytes( &i, 4, 1 ); - flen += 4; - *bp += 4; - return i; -} - - -int sgetVX( unsigned char **bp ) -{ - unsigned char *buf = *bp; - int i; - - if ( flen == FLEN_ERROR ) return 0; - - if ( buf[ 0 ] != 0xFF ) { - i = buf[ 0 ] << 8 | buf[ 1 ]; - flen += 2; - *bp += 2; - } - else { - i = ( buf[ 1 ] << 16 ) | ( buf[ 2 ] << 8 ) | buf[ 3 ]; - flen += 4; - *bp += 4; - } - return i; -} - - -float sgetF4( unsigned char **bp ) -{ - float f; - - if ( flen == FLEN_ERROR ) return 0.0f; - memcpy( &f, *bp, 4 ); - revbytes( &f, 4, 1 ); - flen += 4; - *bp += 4; - return f; -} - - -char *sgetS0( unsigned char **bp ) -{ - char *s; - unsigned char *buf = *bp; - int len; - - if ( flen == FLEN_ERROR ) return NULL; - - len = strlen( buf ) + 1; - if ( len == 1 ) { - flen += 2; - *bp += 2; - return NULL; - } - len += len & 1; - s = malloc( len ); - if ( !s ) { - flen = FLEN_ERROR; - return NULL; - } - - memcpy( s, buf, len ); - flen += len; - *bp += len; - return s; -} diff --git a/cs/engine/plugins/lw/Export/LWO/lwo2.c b/cs/engine/plugins/lw/Export/LWO/lwo2.c deleted file mode 100644 index 16941373a..000000000 --- a/cs/engine/plugins/lw/Export/LWO/lwo2.c +++ /dev/null @@ -1,275 +0,0 @@ -/* -====================================================================== -lwo2.c - -The entry point for loading LightWave object files. - -Ernie Wright 17 Sep 00 -====================================================================== */ - -#include -#include -#include "lwo2.h" - - -/* -====================================================================== -lwFreeLayer() - -Free memory used by an lwLayer. -====================================================================== */ - -void lwFreeLayer( lwLayer *layer ) -{ - if ( layer ) { - if ( layer->name ) free( layer->name ); - lwFreePoints( &layer->point ); - lwFreePolygons( &layer->polygon ); - lwListFree( layer->vmap, lwFreeVMap ); - free( layer ); - } -} - - -/* -====================================================================== -lwFreeObject() - -Free memory used by an lwObject. -====================================================================== */ - -void lwFreeObject( lwObject *object ) -{ - if ( object ) { - lwListFree( object->layer, lwFreeLayer ); - lwListFree( object->env, lwFreeEnvelope ); - lwListFree( object->clip, lwFreeClip ); - lwListFree( object->surf, lwFreeSurface ); - lwFreeTags( &object->taglist ); - free( object ); - } -} - - -/* -====================================================================== -getLWObject() - -Returns the contents of a LightWave object, given its filename, or -NULL if the file couldn't be loaded. On failure, failID and failpos -can be used to diagnose the cause. - -1. If the file isn't an LWO2 or an LWOB, failpos will contain 12 and - failID will be unchanged. - -2. If an error occurs while reading, failID will contain the most - recently read IFF chunk ID, and failpos will contain the value - returned by ftell() at the time of the failure. - -3. If the file couldn't be opened, or an error occurs while reading - the first 12 bytes, both failID and failpos will be unchanged. - -If you don't need this information, failID and failpos can be NULL. -====================================================================== */ - -lwObject *lwGetObject( char *filename, unsigned int *failID, int *failpos ) -{ - FILE *fp = NULL; - lwObject *object; - lwLayer *layer; - lwNode *node; - unsigned int id, formsize, type, cksize; - int i, rlen; - - /* open the file */ - - fp = fopen( filename, "rb" ); - if ( !fp ) return NULL; - - /* read the first 12 bytes */ - - set_flen( 0 ); - id = getU4( fp ); - formsize = getU4( fp ); - type = getU4( fp ); - if ( 12 != get_flen() ) { - fclose( fp ); - return NULL; - } - - /* is this a LW object? */ - - if ( id != ID_FORM ) { - fclose( fp ); - if ( failpos ) *failpos = 12; - return NULL; - } - - if ( type != ID_LWO2 ) { - fclose( fp ); - if ( type == ID_LWOB ) - return lwGetObject5( filename, failID, failpos ); - else { - if ( failpos ) *failpos = 12; - return NULL; - } - } - - /* allocate an object and a default layer */ - - object = calloc( 1, sizeof( lwObject )); - if ( !object ) goto Fail; - - layer = calloc( 1, sizeof( lwLayer )); - if ( !layer ) goto Fail; - object->layer = layer; - - /* get the first chunk header */ - - id = getU4( fp ); - cksize = getU4( fp ); - if ( 0 > get_flen() ) goto Fail; - - /* process chunks as they're encountered */ - - while ( 1 ) { - cksize += cksize & 1; - - switch ( id ) - { - case ID_LAYR: - if ( object->nlayers > 0 ) { - layer = calloc( 1, sizeof( lwLayer )); - if ( !layer ) goto Fail; - lwListAdd( &object->layer, layer ); - } - object->nlayers++; - - set_flen( 0 ); - layer->index = getU2( fp ); - layer->flags = getU2( fp ); - layer->pivot[ 0 ] = getF4( fp ); - layer->pivot[ 1 ] = getF4( fp ); - layer->pivot[ 2 ] = getF4( fp ); - layer->name = getS0( fp ); - - rlen = get_flen(); - if ( rlen < 0 || rlen > cksize ) goto Fail; - if ( rlen <= cksize - 2 ) - layer->parent = getU2( fp ); - if ( rlen < cksize ) - fseek( fp, cksize - rlen, SEEK_CUR ); - break; - - case ID_PNTS: - if ( !lwGetPoints( fp, cksize, &layer->point )) - goto Fail; - break; - - case ID_POLS: - if ( !lwGetPolygons( fp, cksize, &layer->polygon, - layer->point.offset )) - goto Fail; - break; - - case ID_VMAP: - case ID_VMAD: - node = ( lwNode * ) lwGetVMap( fp, cksize, layer->point.offset, - layer->polygon.offset, id == ID_VMAD ); - if ( !node ) goto Fail; - lwListAdd( &layer->vmap, node ); - layer->nvmaps++; - break; - - case ID_PTAG: - if ( !lwGetPolygonTags( fp, cksize, &object->taglist, - &layer->polygon )) - goto Fail; - break; - - case ID_BBOX: - set_flen( 0 ); - for ( i = 0; i < 6; i++ ) - layer->bbox[ i ] = getF4( fp ); - rlen = get_flen(); - if ( rlen < 0 || rlen > cksize ) goto Fail; - if ( rlen < cksize ) - fseek( fp, cksize - rlen, SEEK_CUR ); - break; - - case ID_TAGS: - if ( !lwGetTags( fp, cksize, &object->taglist )) - goto Fail; - break; - - case ID_ENVL: - node = ( lwNode * ) lwGetEnvelope( fp, cksize ); - if ( !node ) goto Fail; - lwListAdd( &object->env, node ); - object->nenvs++; - break; - - case ID_CLIP: - node = ( lwNode * ) lwGetClip( fp, cksize ); - if ( !node ) goto Fail; - lwListAdd( &object->clip, node ); - object->nclips++; - break; - - case ID_SURF: - node = ( lwNode * ) lwGetSurface( fp, cksize ); - if ( !node ) goto Fail; - lwListAdd( &object->surf, node ); - object->nsurfs++; - break; - - case ID_DESC: - case ID_TEXT: - case ID_ICON: - default: - fseek( fp, cksize, SEEK_CUR ); - break; - } - - /* end of the file? */ - - if ( formsize <= ftell( fp ) - 8 ) break; - - /* get the next chunk header */ - - set_flen( 0 ); - id = getU4( fp ); - cksize = getU4( fp ); - if ( 8 != get_flen() ) goto Fail; - } - - fclose( fp ); - fp = NULL; - - if ( object->nlayers == 0 ) - object->nlayers = 1; - - layer = object->layer; - while ( layer ) { - lwGetBoundingBox( &layer->point, layer->bbox ); - lwGetPolyNormals( &layer->point, &layer->polygon ); - if ( !lwGetPointPolygons( &layer->point, &layer->polygon )) goto Fail; - if ( !lwResolvePolySurfaces( &layer->polygon, &object->taglist, - &object->surf, &object->nsurfs )) goto Fail; - lwGetVertNormals( &layer->point, &layer->polygon ); - if ( !lwGetPointVMaps( &layer->point, layer->vmap )) goto Fail; - if ( !lwGetPolyVMaps( &layer->polygon, layer->vmap )) goto Fail; - layer = layer->next; - } - - return object; - -Fail: - if ( failID ) *failID = id; - if ( fp ) { - if ( failpos ) *failpos = ftell( fp ); - fclose( fp ); - } - lwFreeObject( object ); - return NULL; -} diff --git a/cs/engine/plugins/lw/Export/LWO/lwo2.h b/cs/engine/plugins/lw/Export/LWO/lwo2.h deleted file mode 100644 index 4fb05aee4..000000000 --- a/cs/engine/plugins/lw/Export/LWO/lwo2.h +++ /dev/null @@ -1,649 +0,0 @@ -/* -====================================================================== -lwo2.h - -Definitions and typedefs for LWO2 files. - -Ernie Wright 17 Sep 00 -====================================================================== */ - -#ifndef LWO2_H -#define LWO2_H - -/* chunk and subchunk IDs */ - -#define LWID_(a,b,c,d) (((a)<<24)|((b)<<16)|((c)<<8)|(d)) - -#define ID_FORM LWID_('F','O','R','M') -#define ID_LWO2 LWID_('L','W','O','2') -#define ID_LWOB LWID_('L','W','O','B') - -/* top-level chunks */ -#define ID_LAYR LWID_('L','A','Y','R') -#define ID_TAGS LWID_('T','A','G','S') -#define ID_PNTS LWID_('P','N','T','S') -#define ID_BBOX LWID_('B','B','O','X') -#define ID_VMAP LWID_('V','M','A','P') -#define ID_VMAD LWID_('V','M','A','D') -#define ID_POLS LWID_('P','O','L','S') -#define ID_PTAG LWID_('P','T','A','G') -#define ID_ENVL LWID_('E','N','V','L') -#define ID_CLIP LWID_('C','L','I','P') -#define ID_SURF LWID_('S','U','R','F') -#define ID_DESC LWID_('D','E','S','C') -#define ID_TEXT LWID_('T','E','X','T') -#define ID_ICON LWID_('I','C','O','N') - -/* polygon types */ -#define ID_FACE LWID_('F','A','C','E') -#define ID_CURV LWID_('C','U','R','V') -#define ID_PTCH LWID_('P','T','C','H') -#define ID_MBAL LWID_('M','B','A','L') -#define ID_BONE LWID_('B','O','N','E') - -/* polygon tags */ -#define ID_SURF LWID_('S','U','R','F') -#define ID_PART LWID_('P','A','R','T') -#define ID_SMGP LWID_('S','M','G','P') - -/* envelopes */ -#define ID_PRE LWID_('P','R','E',' ') -#define ID_POST LWID_('P','O','S','T') -#define ID_KEY LWID_('K','E','Y',' ') -#define ID_SPAN LWID_('S','P','A','N') -#define ID_TCB LWID_('T','C','B',' ') -#define ID_HERM LWID_('H','E','R','M') -#define ID_BEZI LWID_('B','E','Z','I') -#define ID_BEZ2 LWID_('B','E','Z','2') -#define ID_LINE LWID_('L','I','N','E') -#define ID_STEP LWID_('S','T','E','P') - -/* clips */ -#define ID_STIL LWID_('S','T','I','L') -#define ID_ISEQ LWID_('I','S','E','Q') -#define ID_ANIM LWID_('A','N','I','M') -#define ID_XREF LWID_('X','R','E','F') -#define ID_STCC LWID_('S','T','C','C') -#define ID_TIME LWID_('T','I','M','E') -#define ID_CONT LWID_('C','O','N','T') -#define ID_BRIT LWID_('B','R','I','T') -#define ID_SATR LWID_('S','A','T','R') -#define ID_HUE LWID_('H','U','E',' ') -#define ID_GAMM LWID_('G','A','M','M') -#define ID_NEGA LWID_('N','E','G','A') -#define ID_IFLT LWID_('I','F','L','T') -#define ID_PFLT LWID_('P','F','L','T') - -/* surfaces */ -#define ID_COLR LWID_('C','O','L','R') -#define ID_LUMI LWID_('L','U','M','I') -#define ID_DIFF LWID_('D','I','F','F') -#define ID_SPEC LWID_('S','P','E','C') -#define ID_GLOS LWID_('G','L','O','S') -#define ID_REFL LWID_('R','E','F','L') -#define ID_RFOP LWID_('R','F','O','P') -#define ID_RIMG LWID_('R','I','M','G') -#define ID_RSAN LWID_('R','S','A','N') -#define ID_TRAN LWID_('T','R','A','N') -#define ID_TROP LWID_('T','R','O','P') -#define ID_TIMG LWID_('T','I','M','G') -#define ID_RIND LWID_('R','I','N','D') -#define ID_TRNL LWID_('T','R','N','L') -#define ID_BUMP LWID_('B','U','M','P') -#define ID_SMAN LWID_('S','M','A','N') -#define ID_SIDE LWID_('S','I','D','E') -#define ID_CLRH LWID_('C','L','R','H') -#define ID_CLRF LWID_('C','L','R','F') -#define ID_ADTR LWID_('A','D','T','R') -#define ID_SHRP LWID_('S','H','R','P') -#define ID_LINE LWID_('L','I','N','E') -#define ID_LSIZ LWID_('L','S','I','Z') -#define ID_ALPH LWID_('A','L','P','H') -#define ID_AVAL LWID_('A','V','A','L') -#define ID_GVAL LWID_('G','V','A','L') -#define ID_BLOK LWID_('B','L','O','K') - -/* texture layer */ -#define ID_TYPE LWID_('T','Y','P','E') -#define ID_CHAN LWID_('C','H','A','N') -#define ID_NAME LWID_('N','A','M','E') -#define ID_ENAB LWID_('E','N','A','B') -#define ID_OPAC LWID_('O','P','A','C') -#define ID_FLAG LWID_('F','L','A','G') -#define ID_PROJ LWID_('P','R','O','J') -#define ID_STCK LWID_('S','T','C','K') -#define ID_TAMP LWID_('T','A','M','P') - -/* texture coordinates */ -#define ID_TMAP LWID_('T','M','A','P') -#define ID_AXIS LWID_('A','X','I','S') -#define ID_CNTR LWID_('C','N','T','R') -#define ID_SIZE LWID_('S','I','Z','E') -#define ID_ROTA LWID_('R','O','T','A') -#define ID_OREF LWID_('O','R','E','F') -#define ID_FALL LWID_('F','A','L','L') -#define ID_CSYS LWID_('C','S','Y','S') - -/* image map */ -#define ID_IMAP LWID_('I','M','A','P') -#define ID_IMAG LWID_('I','M','A','G') -#define ID_WRAP LWID_('W','R','A','P') -#define ID_WRPW LWID_('W','R','P','W') -#define ID_WRPH LWID_('W','R','P','H') -#define ID_VMAP LWID_('V','M','A','P') -#define ID_AAST LWID_('A','A','S','T') -#define ID_PIXB LWID_('P','I','X','B') - -/* procedural */ -#define ID_PROC LWID_('P','R','O','C') -#define ID_COLR LWID_('C','O','L','R') -#define ID_VALU LWID_('V','A','L','U') -#define ID_FUNC LWID_('F','U','N','C') -#define ID_FTPS LWID_('F','T','P','S') -#define ID_ITPS LWID_('I','T','P','S') -#define ID_ETPS LWID_('E','T','P','S') - -/* gradient */ -#define ID_GRAD LWID_('G','R','A','D') -#define ID_GRST LWID_('G','R','S','T') -#define ID_GREN LWID_('G','R','E','N') -#define ID_PNAM LWID_('P','N','A','M') -#define ID_INAM LWID_('I','N','A','M') -#define ID_GRPT LWID_('G','R','P','T') -#define ID_FKEY LWID_('F','K','E','Y') -#define ID_IKEY LWID_('I','K','E','Y') - -/* shader */ -#define ID_SHDR LWID_('S','H','D','R') -#define ID_DATA LWID_('D','A','T','A') - - -/* generic linked list */ - -typedef struct st_lwNode { - struct st_lwNode *next, *prev; - void *data; -} lwNode; - - -/* plug-in reference */ - -typedef struct st_lwPlugin { - struct st_lwPlugin *next, *prev; - char *ord; - char *name; - int flags; - void *data; -} lwPlugin; - - -/* envelopes */ - -typedef struct st_lwKey { - struct st_lwKey *next, *prev; - float value; - float time; - unsigned int shape; /* ID_TCB, ID_BEZ2, etc. */ - float tension; - float continuity; - float bias; - float param[ 4 ]; -} lwKey; - -typedef struct st_lwEnvelope { - struct st_lwEnvelope *next, *prev; - int index; - int type; - char *name; - lwKey *key; /* linked list of keys */ - int nkeys; - int behavior[ 2 ]; /* pre and post (extrapolation) */ - lwPlugin *cfilter; /* linked list of channel filters */ - int ncfilters; -} lwEnvelope; - -#define BEH_RESET 0 -#define BEH_CONSTANT 1 -#define BEH_REPEAT 2 -#define BEH_OSCILLATE 3 -#define BEH_OFFSET 4 -#define BEH_LINEAR 5 - - -/* values that can be enveloped */ - -typedef struct st_lwEParam { - float val; - int eindex; -} lwEParam; - -typedef struct st_lwVParam { - float val[ 3 ]; - int eindex; -} lwVParam; - - -/* clips */ - -typedef struct st_lwClipStill { - char *name; -} lwClipStill; - -typedef struct st_lwClipSeq { - char *prefix; /* filename before sequence digits */ - char *suffix; /* after digits, e.g. extensions */ - int digits; - int flags; - int offset; - int start; - int end; -} lwClipSeq; - -typedef struct st_lwClipAnim { - char *name; - char *server; /* anim loader plug-in */ - void *data; -} lwClipAnim; - -typedef struct st_lwClipXRef { - char *string; - int index; - struct st_Clip *clip; -} lwClipXRef; - -typedef struct st_lwClipCycle { - char *name; - int lo; - int hi; -} lwClipCycle; - -typedef struct st_lwClip { - struct st_lwClip *next, *prev; - int index; - unsigned int type; /* ID_STIL, ID_ISEQ, etc. */ - union { - lwClipStill still; - lwClipSeq seq; - lwClipAnim anim; - lwClipXRef xref; - lwClipCycle cycle; - } source; - float start_time; - float duration; - float frame_rate; - lwEParam contrast; - lwEParam brightness; - lwEParam saturation; - lwEParam hue; - lwEParam gamma; - int negative; - lwPlugin *ifilter; /* linked list of image filters */ - int nifilters; - lwPlugin *pfilter; /* linked list of pixel filters */ - int npfilters; -} lwClip; - - -/* textures */ - -typedef struct st_lwTMap { - lwVParam size; - lwVParam center; - lwVParam rotate; - lwVParam falloff; - int fall_type; - char *ref_object; - int coord_sys; -} lwTMap; - -typedef struct st_lwImageMap { - int cindex; - int projection; - char *vmap_name; - int axis; - int wrapw_type; - int wraph_type; - lwEParam wrapw; - lwEParam wraph; - float aa_strength; - int aas_flags; - int pblend; - lwEParam stck; - lwEParam amplitude; -} lwImageMap; - -#define PROJ_PLANAR 0 -#define PROJ_CYLINDRICAL 1 -#define PROJ_SPHERICAL 2 -#define PROJ_CUBIC 3 -#define PROJ_FRONT 4 - -#define WRAP_NONE 0 -#define WRAP_EDGE 1 -#define WRAP_REPEAT 2 -#define WRAP_MIRROR 3 - -typedef struct st_lwProcedural { - int axis; - float value[ 3 ]; - char *name; - void *data; -} lwProcedural; - -typedef struct st_lwGradKey { - struct st_lwGradKey *next, *prev; - float value; - float rgba[ 4 ]; -} lwGradKey; - -typedef struct st_lwGradient { - char *paramname; - char *itemname; - float start; - float end; - int repeat; - lwGradKey *key; /* array of gradient keys */ - short *ikey; /* array of interpolation codes */ -} lwGradient; - -typedef struct st_lwTexture { - struct st_lwTexture *next, *prev; - char *ord; - unsigned int type; - unsigned int chan; - lwEParam opacity; - short opac_type; - short enabled; - short negative; - short axis; - union { - lwImageMap imap; - lwProcedural proc; - lwGradient grad; - } param; - lwTMap tmap; -} lwTexture; - - -/* values that can be textured */ - -typedef struct st_lwTParam { - float val; - int eindex; - lwTexture *tex; /* linked list of texture layers */ -} lwTParam; - -typedef struct st_lwCParam { - float rgb[ 3 ]; - int eindex; - lwTexture *tex; /* linked list of texture layers */ -} lwCParam; - - -/* surfaces */ - -typedef struct st_lwGlow { - short enabled; - short type; - lwEParam intensity; - lwEParam size; -} Glow; - -typedef struct st_lwRMap { - lwTParam val; - int options; - int cindex; - float seam_angle; -} lwRMap; - -typedef struct st_lwLine { - short enabled; - unsigned short flags; - lwEParam size; -} lwLine; - -typedef struct st_lwSurface { - struct st_lwSurface *next, *prev; - char *name; - char *srcname; - lwCParam color; - lwTParam luminosity; - lwTParam diffuse; - lwTParam specularity; - lwTParam glossiness; - lwRMap reflection; - lwRMap transparency; - lwTParam eta; - lwTParam translucency; - lwTParam bump; - float smooth; - int sideflags; - float alpha; - int alpha_mode; - lwEParam color_hilite; - lwEParam color_filter; - lwEParam add_trans; - lwEParam dif_sharp; - lwEParam glow; - lwLine line; - lwPlugin *shader; /* linked list of shaders */ - int nshaders; -} lwSurface; - - -/* vertex maps */ - -typedef struct st_lwVMap { - struct st_lwVMap *next, *prev; - char *name; - unsigned int type; - int dim; - int nverts; - int perpoly; - int *vindex; /* array of point indexes */ - int *pindex; /* array of polygon indexes */ - float **val; -} lwVMap; - -typedef struct st_lwVMapPt { - lwVMap *vmap; - int index; /* vindex or pindex element */ -} lwVMapPt; - - -/* points and polygons */ - -typedef struct st_lwPoint { - float pos[ 3 ]; - int npols; /* number of polygons sharing the point */ - int *pol; /* array of polygon indexes */ - int nvmaps; - lwVMapPt *vm; /* array of vmap references */ -} lwPoint; - -typedef struct st_lwPolVert { - int index; /* index into the point array */ - float norm[ 3 ]; - int nvmaps; - lwVMapPt *vm; /* array of vmap references */ -} lwPolVert; - -typedef struct st_lwPolygon { - lwSurface *surf; - int part; /* part index */ - int smoothgrp; /* smoothing group */ - int flags; - unsigned int type; - float norm[ 3 ]; - int nverts; - lwPolVert *v; /* array of vertex records */ -} lwPolygon; - -typedef struct st_lwPointList { - int count; - int offset; /* only used during reading */ - lwPoint *pt; /* array of points */ -} lwPointList; - -typedef struct st_lwPolygonList { - int count; - int offset; /* only used during reading */ - int vcount; /* total number of vertices */ - int voffset; /* only used during reading */ - lwPolygon *pol; /* array of polygons */ -} lwPolygonList; - - -/* geometry layers */ - -typedef struct st_lwLayer { - struct st_lwLayer *next, *prev; - char *name; - int index; - int parent; - int flags; - float pivot[ 3 ]; - float bbox[ 6 ]; - lwPointList point; - lwPolygonList polygon; - int nvmaps; - lwVMap *vmap; /* linked list of vmaps */ -} lwLayer; - - -/* tag strings */ - -typedef struct st_lwTagList { - int count; - int offset; /* only used during reading */ - char **tag; /* array of strings */ -} lwTagList; - - -/* an object */ - -typedef struct st_lwObject { - lwLayer *layer; /* linked list of layers */ - lwEnvelope *env; /* linked list of envelopes */ - lwClip *clip; /* linked list of clips */ - lwSurface *surf; /* linked list of surfaces */ - lwTagList taglist; - int nlayers; - int nenvs; - int nclips; - int nsurfs; -} lwObject; - - -/* lwo2.c */ - -void lwFreeLayer( lwLayer *layer ); -void lwFreeObject( lwObject *object ); -lwObject *lwGetObject( char *filename, unsigned int *failID, int *failpos ); - -/* pntspols.c */ - -void lwFreePoints( lwPointList *point ); -void lwFreePolygons( lwPolygonList *plist ); -int lwGetPoints( FILE *fp, int cksize, lwPointList *point ); -void lwGetBoundingBox( lwPointList *point, float bbox[] ); -int lwAllocPolygons( lwPolygonList *plist, int npols, int nverts ); -int lwGetPolygons( FILE *fp, int cksize, lwPolygonList *plist, int ptoffset ); -void lwGetPolyNormals( lwPointList *point, lwPolygonList *polygon ); -int lwGetPointPolygons( lwPointList *point, lwPolygonList *polygon ); -int lwResolvePolySurfaces( lwPolygonList *polygon, lwTagList *tlist, - lwSurface **surf, int *nsurfs ); -void lwGetVertNormals( lwPointList *point, lwPolygonList *polygon ); -void lwFreeTags( lwTagList *tlist ); -int lwGetTags( FILE *fp, int cksize, lwTagList *tlist ); -int lwGetPolygonTags( FILE *fp, int cksize, lwTagList *tlist, - lwPolygonList *plist ); - -/* vmap.c */ - -void lwFreeVMap( lwVMap *vmap ); -lwVMap *lwGetVMap( FILE *fp, int cksize, int ptoffset, int poloffset, - int perpoly ); -int lwGetPointVMaps( lwPointList *point, lwVMap *vmap ); -int lwGetPolyVMaps( lwPolygonList *polygon, lwVMap *vmap ); - -/* clip.c */ - -void lwFreeClip( lwClip *clip ); -lwClip *lwGetClip( FILE *fp, int cksize ); -lwClip *lwFindClip( lwClip *list, int index ); - -/* envelope.c */ - -void lwFreeEnvelope( lwEnvelope *env ); -lwEnvelope *lwGetEnvelope( FILE *fp, int cksize ); -lwEnvelope *lwFindEnvelope( lwEnvelope *list, int index ); -float lwEvalEnvelope( lwEnvelope *env, float time ); - -/* surface.c */ - -void lwFreePlugin( lwPlugin *p ); -void lwFreeTexture( lwTexture *t ); -void lwFreeSurface( lwSurface *surf ); -int lwGetTHeader( FILE *fp, int hsz, lwTexture *tex ); -int lwGetTMap( FILE *fp, int tmapsz, lwTMap *tmap ); -int lwGetImageMap( FILE *fp, int rsz, lwTexture *tex ); -int lwGetProcedural( FILE *fp, int rsz, lwTexture *tex ); -int lwGetGradient( FILE *fp, int rsz, lwTexture *tex ); -lwTexture *lwGetTexture( FILE *fp, int bloksz, unsigned int type ); -lwPlugin *lwGetShader( FILE *fp, int bloksz ); -lwSurface *lwGetSurface( FILE *fp, int cksize ); -lwSurface *lwDefaultSurface( void ); - -/* lwob.c */ - -lwSurface *lwGetSurface5( FILE *fp, int cksize, lwObject *obj ); -int lwGetPolygons5( FILE *fp, int cksize, lwPolygonList *plist, int ptoffset ); -lwObject *lwGetObject5( char *filename, unsigned int *failID, int *failpos ); - -/* list.c */ - -void lwListFree( void *list, void ( *freeNode )( void * )); -void lwListAdd( void **list, void *node ); -void lwListInsert( void **vlist, void *vitem, - int ( *compare )( void *, void * )); - -/* vecmath.c */ - -float dot( float a[], float b[] ); -void cross( float a[], float b[], float c[] ); -void normalize( float v[] ); -#define vecangle( a, b ) ( float ) acos( dot( a, b )) - -/* lwio.c */ - -void set_flen( int i ); -int get_flen( void ); -void *getbytes( FILE *fp, int size ); -void skipbytes( FILE *fp, int n ); -int getI1( FILE *fp ); -short getI2( FILE *fp ); -int getI4( FILE *fp ); -unsigned char getU1( FILE *fp ); -unsigned short getU2( FILE *fp ); -unsigned int getU4( FILE *fp ); -int getVX( FILE *fp ); -float getF4( FILE *fp ); -char *getS0( FILE *fp ); -int sgetI1( unsigned char **bp ); -short sgetI2( unsigned char **bp ); -int sgetI4( unsigned char **bp ); -unsigned char sgetU1( unsigned char **bp ); -unsigned short sgetU2( unsigned char **bp ); -unsigned int sgetU4( unsigned char **bp ); -int sgetVX( unsigned char **bp ); -float sgetF4( unsigned char **bp ); -char *sgetS0( unsigned char **bp ); - -#ifdef _WIN32 - void revbytes( void *bp, int elsize, int elcount ); -#else - #define revbytes( b, s, c ) -#endif - -#endif diff --git a/cs/engine/plugins/lw/Export/LWO/lwob.c b/cs/engine/plugins/lw/Export/LWO/lwob.c deleted file mode 100644 index 049c631fd..000000000 --- a/cs/engine/plugins/lw/Export/LWO/lwob.c +++ /dev/null @@ -1,682 +0,0 @@ -/* -====================================================================== -lwob.c - -Functions for an LWOB reader. LWOB is the LightWave object format -for versions of LW prior to 6.0. - -Ernie Wright 17 Sep 00 -====================================================================== */ - -#include -#include -#include -#include -#include "lwo2.h" - - -/* IDs specific to LWOB */ - -#define ID_SRFS LWID_('S','R','F','S') -#define ID_FLAG LWID_('F','L','A','G') -#define ID_VLUM LWID_('V','L','U','M') -#define ID_VDIF LWID_('V','D','I','F') -#define ID_VSPC LWID_('V','S','P','C') -#define ID_RFLT LWID_('R','F','L','T') -#define ID_BTEX LWID_('B','T','E','X') -#define ID_CTEX LWID_('C','T','E','X') -#define ID_DTEX LWID_('D','T','E','X') -#define ID_LTEX LWID_('L','T','E','X') -#define ID_RTEX LWID_('R','T','E','X') -#define ID_STEX LWID_('S','T','E','X') -#define ID_TTEX LWID_('T','T','E','X') -#define ID_TFLG LWID_('T','F','L','G') -#define ID_TSIZ LWID_('T','S','I','Z') -#define ID_TCTR LWID_('T','C','T','R') -#define ID_TFAL LWID_('T','F','A','L') -#define ID_TVEL LWID_('T','V','E','L') -#define ID_TCLR LWID_('T','C','L','R') -#define ID_TVAL LWID_('T','V','A','L') -#define ID_TAMP LWID_('T','A','M','P') -#define ID_TIMG LWID_('T','I','M','G') -#define ID_TAAS LWID_('T','A','A','S') -#define ID_TREF LWID_('T','R','E','F') -#define ID_SDAT LWID_('S','D','A','T') - - -/* -====================================================================== -add_clip() - -Add a clip to the clip list. Used to store the contents of an RIMG or -TIMG surface subchunk. -====================================================================== */ - -static int add_clip( char *s, lwClip **clist, int *nclips ) -{ - lwClip *clip; - char *p; - - clip = calloc( 1, sizeof( lwClip )); - if ( !clip ) return 0; - - clip->contrast.val = 1.0f; - clip->brightness.val = 1.0f; - clip->saturation.val = 1.0f; - clip->gamma.val = 1.0f; - - if ( p = strstr( s, "(sequence)" )) { - p[ -1 ] = 0; - clip->type = ID_ISEQ; - clip->source.seq.prefix = s; - clip->source.seq.digits = 3; - } - else { - clip->type = ID_STIL; - clip->source.still.name = s; - } - - *nclips++; - clip->index = *nclips; - - lwListAdd( clist, clip ); - - return clip->index; -} - - -/* -====================================================================== -add_tvel() - -Add a triple of envelopes to simulate the old texture velocity -parameters. -====================================================================== */ - -static int add_tvel( float pos[], float vel[], lwEnvelope **elist, int *nenvs ) -{ - lwEnvelope *env; - lwKey *key0, *key1; - int i; - - for ( i = 0; i < 3; i++ ) { - env = calloc( 1, sizeof( lwEnvelope )); - key0 = calloc( 1, sizeof( lwKey )); - key1 = calloc( 1, sizeof( lwKey )); - if ( !env || !key0 || !key1 ) return 0; - - key0->next = key1; - key0->value = pos[ i ]; - key0->time = 0.0f; - key1->prev = key0; - key1->value = pos[ i ] + vel[ i ] * 30.0f; - key1->time = 1.0f; - key0->shape = key1->shape = ID_LINE; - - env->index = *nenvs + i + 1; - env->type = 0x0301 + i; - env->name = malloc( 11 ); - if ( env->name ) { - strcpy( env->name, "Position.X" ); - env->name[ 9 ] += i; - } - env->key = key0; - env->nkeys = 2; - env->behavior[ 0 ] = BEH_LINEAR; - env->behavior[ 1 ] = BEH_LINEAR; - - lwListAdd( elist, env ); - } - - *nenvs += 3; - return env->index - 2; -} - - -/* -====================================================================== -get_texture() - -Create a new texture for BTEX, CTEX, etc. subchunks. -====================================================================== */ - -static lwTexture *get_texture( char *s ) -{ - lwTexture *tex; - - tex = calloc( 1, sizeof( lwTexture )); - if ( !tex ) return NULL; - - tex->tmap.size.val[ 0 ] = - tex->tmap.size.val[ 1 ] = - tex->tmap.size.val[ 2 ] = 1.0f; - tex->opacity.val = 1.0f; - tex->enabled = 1; - - if ( strstr( s, "Image Map" )) { - tex->type = ID_IMAP; - if ( strstr( s, "Planar" )) tex->param.imap.projection = 0; - else if ( strstr( s, "Cylindrical" )) tex->param.imap.projection = 1; - else if ( strstr( s, "Spherical" )) tex->param.imap.projection = 2; - else if ( strstr( s, "Cubic" )) tex->param.imap.projection = 3; - else if ( strstr( s, "Front" )) tex->param.imap.projection = 4; - tex->param.imap.aa_strength = 1.0f; - tex->param.imap.amplitude.val = 1.0f; - free( s ); - } - else { - tex->type = ID_PROC; - tex->param.proc.name = s; - } - - return tex; -} - - -/* -====================================================================== -lwGetSurface5() - -Read an lwSurface from an LWOB file. -====================================================================== */ - -lwSurface *lwGetSurface5( FILE *fp, int cksize, lwObject *obj ) -{ - lwSurface *surf; - lwTexture *tex; - lwPlugin *shdr; - char *s; - float v[ 3 ]; - unsigned int id, flags; - unsigned short sz; - int pos, rlen, i; - - - /* allocate the Surface structure */ - - surf = calloc( 1, sizeof( lwSurface )); - if ( !surf ) goto Fail; - - /* non-zero defaults */ - - surf->color.rgb[ 0 ] = 0.78431f; - surf->color.rgb[ 1 ] = 0.78431f; - surf->color.rgb[ 2 ] = 0.78431f; - surf->diffuse.val = 1.0f; - surf->glossiness.val = 0.4f; - surf->bump.val = 1.0f; - surf->eta.val = 1.0f; - surf->sideflags = 1; - - /* remember where we started */ - - set_flen( 0 ); - pos = ftell( fp ); - - /* name */ - - surf->name = getS0( fp ); - - /* first subchunk header */ - - id = getU4( fp ); - sz = getU2( fp ); - if ( 0 > get_flen() ) goto Fail; - - /* process subchunks as they're encountered */ - - while ( 1 ) { - sz += sz & 1; - set_flen( 0 ); - - switch ( id ) { - case ID_COLR: - surf->color.rgb[ 0 ] = getU1( fp ) / 255.0f; - surf->color.rgb[ 1 ] = getU1( fp ) / 255.0f; - surf->color.rgb[ 2 ] = getU1( fp ) / 255.0f; - break; - - case ID_FLAG: - flags = getU2( fp ); - if ( flags & 4 ) surf->smooth = 1.56207f; - if ( flags & 8 ) surf->color_hilite.val = 1.0f; - if ( flags & 16 ) surf->color_filter.val = 1.0f; - if ( flags & 128 ) surf->dif_sharp.val = 0.5f; - if ( flags & 256 ) surf->sideflags = 3; - if ( flags & 512 ) surf->add_trans.val = 1.0f; - break; - - case ID_LUMI: - surf->luminosity.val = getI2( fp ) / 256.0f; - break; - - case ID_VLUM: - surf->luminosity.val = getF4( fp ); - break; - - case ID_DIFF: - surf->diffuse.val = getI2( fp ) / 256.0f; - break; - - case ID_VDIF: - surf->diffuse.val = getF4( fp ); - break; - - case ID_SPEC: - surf->specularity.val = getI2( fp ) / 256.0f; - break; - - case ID_VSPC: - surf->specularity.val = getF4( fp ); - break; - - case ID_GLOS: - surf->glossiness.val = ( float ) log( getU2( fp )) / 20.7944f; - break; - - case ID_SMAN: - surf->smooth = getF4( fp ); - break; - - case ID_REFL: - surf->reflection.val.val = getI2( fp ) / 256.0f; - break; - - case ID_RFLT: - surf->reflection.options = getU2( fp ); - break; - - case ID_RIMG: - s = getS0( fp ); - surf->reflection.cindex = add_clip( s, &obj->clip, &obj->nclips ); - surf->reflection.options = 3; - break; - - case ID_RSAN: - surf->reflection.seam_angle = getF4( fp ); - break; - - case ID_TRAN: - surf->transparency.val.val = getI2( fp ) / 256.0f; - break; - - case ID_RIND: - surf->eta.val = getF4( fp ); - break; - - case ID_BTEX: - s = getbytes( fp, sz ); - tex = get_texture( s ); - lwListAdd( &surf->bump.tex, tex ); - break; - - case ID_CTEX: - s = getbytes( fp, sz ); - tex = get_texture( s ); - lwListAdd( &surf->color.tex, tex ); - break; - - case ID_DTEX: - s = getbytes( fp, sz ); - tex = get_texture( s ); - lwListAdd( &surf->diffuse.tex, tex ); - break; - - case ID_LTEX: - s = getbytes( fp, sz ); - tex = get_texture( s ); - lwListAdd( &surf->luminosity.tex, tex ); - break; - - case ID_RTEX: - s = getbytes( fp, sz ); - tex = get_texture( s ); - lwListAdd( &surf->reflection.val.tex, tex ); - break; - - case ID_STEX: - s = getbytes( fp, sz ); - tex = get_texture( s ); - lwListAdd( &surf->specularity.tex, tex ); - break; - - case ID_TTEX: - s = getbytes( fp, sz ); - tex = get_texture( s ); - lwListAdd( &surf->transparency.val.tex, tex ); - break; - - case ID_TFLG: - flags = getU2( fp ); - - if ( flags & 1 ) i = 0; - if ( flags & 2 ) i = 1; - if ( flags & 4 ) i = 2; - tex->axis = i; - if ( tex->type == ID_IMAP ) - tex->param.imap.axis = i; - else - tex->param.proc.axis = i; - - if ( flags & 8 ) tex->tmap.coord_sys = 1; - if ( flags & 16 ) tex->negative = 1; - if ( flags & 32 ) tex->param.imap.pblend = 1; - if ( flags & 64 ) { - tex->param.imap.aa_strength = 1.0f; - tex->param.imap.aas_flags = 1; - } - break; - - case ID_TSIZ: - for ( i = 0; i < 3; i++ ) - tex->tmap.size.val[ i ] = getF4( fp ); - break; - - case ID_TCTR: - for ( i = 0; i < 3; i++ ) - tex->tmap.center.val[ i ] = getF4( fp ); - break; - - case ID_TFAL: - for ( i = 0; i < 3; i++ ) - tex->tmap.falloff.val[ i ] = getF4( fp ); - break; - - case ID_TVEL: - for ( i = 0; i < 3; i++ ) - v[ i ] = getF4( fp ); - tex->tmap.center.eindex = add_tvel( tex->tmap.center.val, v, - &obj->env, &obj->nenvs ); - break; - - case ID_TCLR: - for ( i = 0; i < 3; i++ ) - tex->param.proc.value[ i ] = getU1( fp ) / 255.0f; - break; - - case ID_TVAL: - tex->param.proc.value[ 0 ] = getI2( fp ) / 256.0f; - break; - - case ID_TAMP: - if ( tex->type == ID_IMAP ) - tex->param.imap.amplitude.val = getF4( fp ); - break; - - case ID_TIMG: - s = getS0( fp ); - tex->param.imap.cindex = add_clip( s, &obj->clip, &obj->nclips ); - break; - - case ID_TAAS: - tex->param.imap.aa_strength = getF4( fp ); - tex->param.imap.aas_flags = 1; - break; - - case ID_TREF: - tex->tmap.ref_object = getbytes( fp, sz ); - break; - - case ID_SHDR: - shdr = calloc( 1, sizeof( lwPlugin )); - if ( !shdr ) goto Fail; - shdr->name = getbytes( fp, sz ); - lwListAdd( &surf->shader, shdr ); - surf->nshaders++; - break; - - case ID_SDAT: - shdr->data = getbytes( fp, sz ); - break; - - default: - break; - } - - /* error while reading current subchunk? */ - - rlen = get_flen(); - if ( rlen < 0 || rlen > sz ) goto Fail; - - /* skip unread parts of the current subchunk */ - - if ( rlen < sz ) - fseek( fp, sz - rlen, SEEK_CUR ); - - /* end of the SURF chunk? */ - - if ( cksize <= ftell( fp ) - pos ) - break; - - /* get the next subchunk header */ - - set_flen( 0 ); - id = getU4( fp ); - sz = getU2( fp ); - if ( 6 != get_flen() ) goto Fail; - } - - return surf; - -Fail: - if ( surf ) lwFreeSurface( surf ); - return NULL; -} - - -/* -====================================================================== -lwGetPolygons5() - -Read polygon records from a POLS chunk in an LWOB file. The polygons -are added to the array in the lwPolygonList. -====================================================================== */ - -int lwGetPolygons5( FILE *fp, int cksize, lwPolygonList *plist, int ptoffset ) -{ - lwPolygon *pp; - lwPolVert *pv; - unsigned char *buf, *bp; - int i, j, nv, nverts, npols; - - - if ( cksize == 0 ) return 1; - - /* read the whole chunk */ - - set_flen( 0 ); - buf = getbytes( fp, cksize ); - if ( !buf ) goto Fail; - - /* count the polygons and vertices */ - - nverts = 0; - npols = 0; - bp = buf; - - while ( bp < buf + cksize ) { - nv = sgetU2( &bp ); - nverts += nv; - npols++; - bp += 2 * nv; - i = sgetI2( &bp ); - if ( i < 0 ) bp += 2; /* detail polygons */ - } - - if ( !lwAllocPolygons( plist, npols, nverts )) - goto Fail; - - /* fill in the new polygons */ - - bp = buf; - pp = plist->pol + plist->offset; - pv = plist->pol[ 0 ].v + plist->voffset; - - for ( i = 0; i < npols; i++ ) { - nv = sgetU2( &bp ); - - pp->nverts = nv; - pp->type = ID_FACE; - if ( !pp->v ) pp->v = pv; - for ( j = 0; j < nv; j++ ) - pv[ j ].index = sgetU2( &bp ) + ptoffset; - j = sgetI2( &bp ); - if ( j < 0 ) { - j = -j; - bp += 2; - } - j -= 1; - pp->surf = ( lwSurface * ) j; - - pp++; - pv += nv; - } - - free( buf ); - return 1; - -Fail: - if ( buf ) free( buf ); - lwFreePolygons( plist ); - return 0; -} - - -/* -====================================================================== -getLWObject5() - -Returns the contents of an LWOB, given its filename, or NULL if the -file couldn't be loaded. On failure, failID and failpos can be used -to diagnose the cause. - -1. If the file isn't an LWOB, failpos will contain 12 and failID will - be unchanged. - -2. If an error occurs while reading an LWOB, failID will contain the - most recently read IFF chunk ID, and failpos will contain the - value returned by ftell() at the time of the failure. - -3. If the file couldn't be opened, or an error occurs while reading - the first 12 bytes, both failID and failpos will be unchanged. - -If you don't need this information, failID and failpos can be NULL. -====================================================================== */ - -lwObject *lwGetObject5( char *filename, unsigned int *failID, int *failpos ) -{ - FILE *fp = NULL; - lwObject *object; - lwLayer *layer; - lwNode *node; - unsigned int id, formsize, type, cksize; - - - /* open the file */ - - fp = fopen( filename, "rb" ); - if ( !fp ) return NULL; - - /* read the first 12 bytes */ - - set_flen( 0 ); - id = getU4( fp ); - formsize = getU4( fp ); - type = getU4( fp ); - if ( 12 != get_flen() ) { - fclose( fp ); - return NULL; - } - - /* LWOB? */ - - if ( id != ID_FORM || type != ID_LWOB ) { - fclose( fp ); - if ( failpos ) *failpos = 12; - return NULL; - } - - /* allocate an object and a default layer */ - - object = calloc( 1, sizeof( lwObject )); - if ( !object ) goto Fail; - - layer = calloc( 1, sizeof( lwLayer )); - if ( !layer ) goto Fail; - object->layer = layer; - object->nlayers = 1; - - /* get the first chunk header */ - - id = getU4( fp ); - cksize = getU4( fp ); - if ( 0 > get_flen() ) goto Fail; - - /* process chunks as they're encountered */ - - while ( 1 ) { - cksize += cksize & 1; - - switch ( id ) - { - case ID_PNTS: - if ( !lwGetPoints( fp, cksize, &layer->point )) - goto Fail; - break; - - case ID_POLS: - if ( !lwGetPolygons5( fp, cksize, &layer->polygon, - layer->point.offset )) - goto Fail; - break; - - case ID_SRFS: - if ( !lwGetTags( fp, cksize, &object->taglist )) - goto Fail; - break; - - case ID_SURF: - node = ( lwNode * ) lwGetSurface5( fp, cksize, object ); - if ( !node ) goto Fail; - lwListAdd( &object->surf, node ); - object->nsurfs++; - break; - - default: - fseek( fp, cksize, SEEK_CUR ); - break; - } - - /* end of the file? */ - - if ( formsize <= ftell( fp ) - 8 ) break; - - /* get the next chunk header */ - - set_flen( 0 ); - id = getU4( fp ); - cksize = getU4( fp ); - if ( 8 != get_flen() ) goto Fail; - } - - fclose( fp ); - fp = NULL; - - lwGetBoundingBox( &layer->point, layer->bbox ); - lwGetPolyNormals( &layer->point, &layer->polygon ); - if ( !lwGetPointPolygons( &layer->point, &layer->polygon )) goto Fail; - if ( !lwResolvePolySurfaces( &layer->polygon, &object->taglist, - &object->surf, &object->nsurfs )) goto Fail; - lwGetVertNormals( &layer->point, &layer->polygon ); - - return object; - -Fail: - if ( failID ) *failID = id; - if ( fp ) { - if ( failpos ) *failpos = ftell( fp ); - fclose( fp ); - } - lwFreeObject( object ); - return NULL; -} diff --git a/cs/engine/plugins/lw/Export/LWO/pntspols.c b/cs/engine/plugins/lw/Export/LWO/pntspols.c deleted file mode 100644 index 414a38fdb..000000000 --- a/cs/engine/plugins/lw/Export/LWO/pntspols.c +++ /dev/null @@ -1,540 +0,0 @@ -/* -====================================================================== -pntspols.c - -Point and polygon functions for an LWO2 reader. - -Ernie Wright 17 Sep 00 -====================================================================== */ - -#include -#include -#include -#include -#include "lwo2.h" - - -/* -====================================================================== -lwFreePoints() - -Free the memory used by an lwPointList. -====================================================================== */ - -void lwFreePoints( lwPointList *point ) -{ - int i; - - if ( point ) { - if ( point->pt ) { - for ( i = 0; i < point->count; i++ ) { - if ( point->pt[ i ].pol ) free( point->pt[ i ].pol ); - if ( point->pt[ i ].vm ) free( point->pt[ i ].vm ); - } - free( point->pt ); - } - memset( point, 0, sizeof( lwPointList )); - } -} - - -/* -====================================================================== -lwFreePolygons() - -Free the memory used by an lwPolygonList. -====================================================================== */ - -void lwFreePolygons( lwPolygonList *plist ) -{ - int i, j; - - if ( plist ) { - if ( plist->pol ) { - for ( i = 0; i < plist->count; i++ ) { - if ( plist->pol[ i ].v ) { - for ( j = 0; j < plist->pol[ i ].nverts; j++ ) - if ( plist->pol[ i ].v[ j ].vm ) - free( plist->pol[ i ].v[ j ].vm ); - } - } - if ( plist->pol[ 0 ].v ) - free( plist->pol[ 0 ].v ); - free( plist->pol ); - } - memset( plist, 0, sizeof( lwPolygonList )); - } -} - - -/* -====================================================================== -lwGetPoints() - -Read point records from a PNTS chunk in an LWO2 file. The points are -added to the array in the lwPointList. -====================================================================== */ - -int lwGetPoints( FILE *fp, int cksize, lwPointList *point ) -{ - float *f; - int np, i, j; - - if ( cksize == 1 ) return 1; - - /* extend the point array to hold the new points */ - - np = cksize / 12; - point->offset = point->count; - point->count += np; - point->pt = realloc( point->pt, point->count * sizeof( lwPoint )); - if ( !point->pt ) return 0; - memset( &point->pt[ point->offset ], 0, np * sizeof( lwPoint )); - - /* read the whole chunk */ - - f = ( float * ) getbytes( fp, cksize ); - if ( !f ) return 0; - revbytes( f, 4, np * 3 ); - - /* assign position values */ - - for ( i = 0, j = 0; i < np; i++, j += 3 ) { - point->pt[ i ].pos[ 0 ] = f[ j ]; - point->pt[ i ].pos[ 1 ] = f[ j + 1 ]; - point->pt[ i ].pos[ 2 ] = f[ j + 2 ]; - } - - free( f ); - return 1; -} - - -/* -====================================================================== -lwGetBoundingBox() - -Calculate the bounding box for a point list, but only if the bounding -box hasn't already been initialized. -====================================================================== */ - -void lwGetBoundingBox( lwPointList *point, float bbox[] ) -{ - int i, j; - - if ( point->count == 0 ) return; - - for ( i = 0; i < 6; i++ ) - if ( bbox[ i ] != 0.0f ) return; - - bbox[ 0 ] = bbox[ 1 ] = bbox[ 2 ] = 1e20f; - bbox[ 3 ] = bbox[ 4 ] = bbox[ 5 ] = -1e20f; - for ( i = 0; i < point->count; i++ ) { - for ( j = 0; j < 3; j++ ) { - if ( bbox[ j ] > point->pt[ i ].pos[ j ] ) - bbox[ j ] = point->pt[ i ].pos[ j ]; - if ( bbox[ j + 3 ] < point->pt[ i ].pos[ j ] ) - bbox[ j + 3 ] = point->pt[ i ].pos[ j ]; - } - } -} - - -/* -====================================================================== -lwAllocPolygons() - -Allocate or extend the polygon arrays to hold new records. -====================================================================== */ - -int lwAllocPolygons( lwPolygonList *plist, int npols, int nverts ) -{ - int i; - - plist->offset = plist->count; - plist->count += npols; - plist->pol = realloc( plist->pol, plist->count * sizeof( lwPolygon )); - if ( !plist->pol ) return 0; - memset( plist->pol + plist->offset, 0, npols * sizeof( lwPolygon )); - - plist->voffset = plist->vcount; - plist->vcount += nverts; - plist->pol[ 0 ].v = realloc( plist->pol[ 0 ].v, plist->vcount * sizeof( lwPolVert )); - if ( !plist->pol[ 0 ].v ) return 0; - memset( plist->pol[ 0 ].v + plist->voffset, 0, nverts * sizeof( lwPolVert )); - - /* fix up the old vertex pointers */ - - for ( i = 1; i < plist->offset; i++ ) - plist->pol[ i ].v = plist->pol[ i - 1 ].v + plist->pol[ i - 1 ].nverts; - - return 1; -} - - -/* -====================================================================== -lwGetPolygons() - -Read polygon records from a POLS chunk in an LWO2 file. The polygons -are added to the array in the lwPolygonList. -====================================================================== */ - -int lwGetPolygons( FILE *fp, int cksize, lwPolygonList *plist, int ptoffset ) -{ - lwPolygon *pp; - lwPolVert *pv; - unsigned char *buf, *bp; - int i, j, flags, nv, nverts, npols; - unsigned int type; - - - if ( cksize == 0 ) return 1; - - /* read the whole chunk */ - - set_flen( 0 ); - type = getU4( fp ); - buf = getbytes( fp, cksize - 4 ); - if ( cksize != get_flen() ) goto Fail; - - /* count the polygons and vertices */ - - nverts = 0; - npols = 0; - bp = buf; - - while ( bp < buf + cksize - 4 ) { - nv = sgetU2( &bp ); - nv &= 0x03FF; - nverts += nv; - npols++; - for ( i = 0; i < nv; i++ ) - j = sgetVX( &bp ); - } - - if ( !lwAllocPolygons( plist, npols, nverts )) - goto Fail; - - /* fill in the new polygons */ - - bp = buf; - pp = plist->pol + plist->offset; - pv = plist->pol[ 0 ].v + plist->voffset; - - for ( i = 0; i < npols; i++ ) { - nv = sgetU2( &bp ); - flags = nv & 0xFC00; - nv &= 0x03FF; - - pp->nverts = nv; - pp->flags = flags; - pp->type = type; - if ( !pp->v ) pp->v = pv; - for ( j = 0; j < nv; j++ ) - pp->v[ j ].index = sgetVX( &bp ) + ptoffset; - - pp++; - pv += nv; - } - - free( buf ); - return 1; - -Fail: - if ( buf ) free( buf ); - lwFreePolygons( plist ); - return 0; -} - - -/* -====================================================================== -lwGetPolyNormals() - -Calculate the polygon normals. By convention, LW's polygon normals -are found as the cross product of the first and last edges. It's -undefined for one- and two-point polygons. -====================================================================== */ - -void lwGetPolyNormals( lwPointList *point, lwPolygonList *polygon ) -{ - int i, j; - float p1[ 3 ], p2[ 3 ], pn[ 3 ], v1[ 3 ], v2[ 3 ]; - - for ( i = 0; i < polygon->count; i++ ) { - if ( polygon->pol[ i ].nverts < 3 ) continue; - for ( j = 0; j < 3; j++ ) { - p1[ j ] = point->pt[ polygon->pol[ i ].v[ 0 ].index ].pos[ j ]; - p2[ j ] = point->pt[ polygon->pol[ i ].v[ 1 ].index ].pos[ j ]; - pn[ j ] = point->pt[ polygon->pol[ i ].v[ - polygon->pol[ i ].nverts - 1 ].index ].pos[ j ]; - } - - for ( j = 0; j < 3; j++ ) { - v1[ j ] = p2[ j ] - p1[ j ]; - v2[ j ] = pn[ j ] - p1[ j ]; - } - - cross( v1, v2, polygon->pol[ i ].norm ); - normalize( polygon->pol[ i ].norm ); - } -} - - -/* -====================================================================== -lwGetPointPolygons() - -For each point, fill in the indexes of the polygons that share the -point. Returns 0 if any of the memory allocations fail, otherwise -returns 1. -====================================================================== */ - -int lwGetPointPolygons( lwPointList *point, lwPolygonList *polygon ) -{ - int i, j, k; - - /* count the number of polygons per point */ - - for ( i = 0; i < polygon->count; i++ ) - for ( j = 0; j < polygon->pol[ i ].nverts; j++ ) - ++point->pt[ polygon->pol[ i ].v[ j ].index ].npols; - - /* alloc per-point polygon arrays */ - - for ( i = 0; i < point->count; i++ ) { - if ( point->pt[ i ].npols == 0 ) continue; - point->pt[ i ].pol = calloc( point->pt[ i ].npols, sizeof( int )); - if ( !point->pt[ i ].pol ) return 0; - point->pt[ i ].npols = 0; - } - - /* fill in polygon array for each point */ - - for ( i = 0; i < polygon->count; i++ ) { - for ( j = 0; j < polygon->pol[ i ].nverts; j++ ) { - k = polygon->pol[ i ].v[ j ].index; - point->pt[ k ].pol[ point->pt[ k ].npols ] = i; - ++point->pt[ k ].npols; - } - } - - return 1; -} - - -/* -====================================================================== -lwResolvePolySurfaces() - -Convert tag indexes into actual lwSurface pointers. If any polygons -point to tags for which no corresponding surface can be found, a -default surface is created. -====================================================================== */ - -int lwResolvePolySurfaces( lwPolygonList *polygon, lwTagList *tlist, - lwSurface **surf, int *nsurfs ) -{ - lwSurface **s, *st; - int i, index; - - if ( tlist->count == 0 ) return 1; - - s = calloc( tlist->count, sizeof( lwSurface * )); - if ( !s ) return 0; - - for ( i = 0; i < tlist->count; i++ ) { - st = *surf; - while ( st ) { - if ( !strcmp( st->name, tlist->tag[ i ] )) { - s[ i ] = st; - break; - } - st = st->next; - } - } - - for ( i = 0; i < polygon->count; i++ ) { - index = ( int ) polygon->pol[ i ].surf; - if ( index < 0 || index > tlist->count ) return 0; - if ( !s[ index ] ) { - s[ index ] = lwDefaultSurface(); - if ( !s[ index ] ) return 0; - s[ index ]->name = malloc( strlen( tlist->tag[ index ] ) + 1 ); - if ( !s[ index ]->name ) return 0; - strcpy( s[ index ]->name, tlist->tag[ index ] ); - lwListAdd( surf, s[ index ] ); - *nsurfs = *nsurfs + 1; - } - polygon->pol[ i ].surf = s[ index ]; - } - - free( s ); - return 1; -} - - -/* -====================================================================== -lwGetVertNormals() - -Calculate the vertex normals. For each polygon vertex, sum the -normals of the polygons that share the point. If the normals of the -current and adjacent polygons form an angle greater than the max -smoothing angle for the current polygon's surface, the normal of the -adjacent polygon is excluded from the sum. It's also excluded if the -polygons aren't in the same smoothing group. - -Assumes that lwGetPointPolygons(), lwGetPolyNormals() and -lwResolvePolySurfaces() have already been called. -====================================================================== */ - -void lwGetVertNormals( lwPointList *point, lwPolygonList *polygon ) -{ - int j, k, n, g, h, p; - float a; - - for ( j = 0; j < polygon->count; j++ ) { - for ( n = 0; n < polygon->pol[ j ].nverts; n++ ) { - for ( k = 0; k < 3; k++ ) - polygon->pol[ j ].v[ n ].norm[ k ] = polygon->pol[ j ].norm[ k ]; - - if ( polygon->pol[ j ].surf->smooth <= 0 ) continue; - - p = polygon->pol[ j ].v[ n ].index; - - for ( g = 0; g < point->pt[ p ].npols; g++ ) { - h = point->pt[ p ].pol[ g ]; - if ( h == j ) continue; - - if ( polygon->pol[ j ].smoothgrp != polygon->pol[ h ].smoothgrp ) - continue; - a = vecangle( polygon->pol[ j ].norm, polygon->pol[ h ].norm ); - if ( a > polygon->pol[ j ].surf->smooth ) continue; - - for ( k = 0; k < 3; k++ ) - polygon->pol[ j ].v[ n ].norm[ k ] += polygon->pol[ h ].norm[ k ]; - } - - normalize( polygon->pol[ j ].v[ n ].norm ); - } - } -} - - -/* -====================================================================== -lwFreeTags() - -Free memory used by an lwTagList. -====================================================================== */ - -void lwFreeTags( lwTagList *tlist ) -{ - int i; - - if ( tlist ) { - if ( tlist->tag ) { - for ( i = 0; i < tlist->count; i++ ) - if ( tlist->tag[ i ] ) free( tlist->tag[ i ] ); - free( tlist->tag ); - } - memset( tlist, 0, sizeof( lwTagList )); - } -} - - -/* -====================================================================== -lwGetTags() - -Read tag strings from a TAGS chunk in an LWO2 file. The tags are -added to the lwTagList array. -====================================================================== */ - -int lwGetTags( FILE *fp, int cksize, lwTagList *tlist ) -{ - char *buf, *bp; - int i, len, ntags; - - if ( cksize == 0 ) return 1; - - /* read the whole chunk */ - - set_flen( 0 ); - buf = getbytes( fp, cksize ); - if ( !buf ) return 0; - - /* count the strings */ - - ntags = 0; - bp = buf; - while ( bp < buf + cksize ) { - len = strlen( bp ) + 1; - len += len & 1; - bp += len; - ++ntags; - } - - /* expand the string array to hold the new tags */ - - tlist->offset = tlist->count; - tlist->count += ntags; - tlist->tag = realloc( tlist->tag, tlist->count * sizeof( char * )); - if ( !tlist->tag ) goto Fail; - memset( &tlist->tag[ tlist->offset ], 0, ntags * sizeof( char * )); - - /* copy the new tags to the tag array */ - - bp = buf; - for ( i = 0; i < ntags; i++ ) - tlist->tag[ i + tlist->offset ] = sgetS0( &bp ); - - free( buf ); - return 1; - -Fail: - if ( buf ) free( buf ); - return 0; -} - - -/* -====================================================================== -lwGetPolygonTags() - -Read polygon tags from a PTAG chunk in an LWO2 file. -====================================================================== */ - -int lwGetPolygonTags( FILE *fp, int cksize, lwTagList *tlist, - lwPolygonList *plist ) -{ - unsigned int type; - int rlen = 0, i, j; - - set_flen( 0 ); - type = getU4( fp ); - rlen = get_flen(); - if ( rlen < 0 ) return 0; - - if ( type != ID_SURF && type != ID_PART && type != ID_SMGP ) { - fseek( fp, cksize - 4, SEEK_CUR ); - return 1; - } - - while ( rlen < cksize ) { - i = getVX( fp ) + plist->offset; - j = getVX( fp ) + tlist->offset; - rlen = get_flen(); - if ( rlen < 0 || rlen > cksize ) return 0; - - switch ( type ) { - case ID_SURF: plist->pol[ i ].surf = ( lwSurface * ) j; break; - case ID_PART: plist->pol[ i ].part = j; break; - case ID_SMGP: plist->pol[ i ].smoothgrp = j; break; - } - } - - return 1; -} diff --git a/cs/engine/plugins/lw/Export/LWO/surface.c b/cs/engine/plugins/lw/Export/LWO/surface.c deleted file mode 100644 index 56ecbd78b..000000000 --- a/cs/engine/plugins/lw/Export/LWO/surface.c +++ /dev/null @@ -1,1006 +0,0 @@ -/* -====================================================================== -surface.c - -Surface functions for an LWO2 reader. - -Ernie Wright 17 Sep 00 -====================================================================== */ - -#include -#include -#include -#include "lwo2.h" - - -/* -====================================================================== -lwFreePlugin() - -Free the memory used by an lwPlugin. -====================================================================== */ - -void lwFreePlugin( lwPlugin *p ) -{ - if ( p ) { - if ( p->ord ) free( p->ord ); - if ( p->name ) free( p->name ); - if ( p->data ) free( p->data ); - free( p ); - } -} - - -/* -====================================================================== -lwFreeTexture() - -Free the memory used by an lwTexture. -====================================================================== */ - -void lwFreeTexture( lwTexture *t ) -{ - if ( t ) { - if ( t->ord ) free( t->ord ); - switch ( t->type ) { - case ID_IMAP: - if ( t->param.imap.vmap_name ) free( t->param.imap.vmap_name ); - break; - case ID_PROC: - if ( t->param.proc.name ) free( t->param.proc.name ); - if ( t->param.proc.data ) free( t->param.proc.data ); - break; - case ID_GRAD: - if ( t->param.grad.key ) free( t->param.grad.key ); - if ( t->param.grad.ikey ) free( t->param.grad.ikey ); - break; - } - free( t ); - } -} - - -/* -====================================================================== -lwFreeSurface() - -Free the memory used by an lwSurface. -====================================================================== */ - -void lwFreeSurface( lwSurface *surf ) -{ - if ( surf ) { - if ( surf->name ) free( surf->name ); - if ( surf->srcname ) free( surf->srcname ); - - lwListFree( surf->shader, lwFreePlugin ); - - lwListFree( surf->color.tex, lwFreeTexture ); - lwListFree( surf->luminosity.tex, lwFreeTexture ); - lwListFree( surf->diffuse.tex, lwFreeTexture ); - lwListFree( surf->specularity.tex, lwFreeTexture ); - lwListFree( surf->glossiness.tex, lwFreeTexture ); - lwListFree( surf->reflection.val.tex, lwFreeTexture ); - lwListFree( surf->transparency.val.tex, lwFreeTexture ); - lwListFree( surf->eta.tex, lwFreeTexture ); - lwListFree( surf->translucency.tex, lwFreeTexture ); - lwListFree( surf->bump.tex, lwFreeTexture ); - - free( surf ); - } -} - - -/* -====================================================================== -lwGetTHeader() - -Read a texture map header from a SURF.BLOK in an LWO2 file. This is -the first subchunk in a BLOK, and its contents are common to all three -texture types. -====================================================================== */ - -int lwGetTHeader( FILE *fp, int hsz, lwTexture *tex ) -{ - unsigned int id; - unsigned short sz; - int pos, rlen; - - - /* remember where we started */ - - set_flen( 0 ); - pos = ftell( fp ); - - /* ordinal string */ - - tex->ord = getS0( fp ); - - /* first subchunk header */ - - id = getU4( fp ); - sz = getU2( fp ); - if ( 0 > get_flen() ) return 0; - - /* process subchunks as they're encountered */ - - while ( 1 ) { - sz += sz & 1; - set_flen( 0 ); - - switch ( id ) { - case ID_CHAN: - tex->chan = getU4( fp ); - break; - - case ID_OPAC: - tex->opac_type = getU2( fp ); - tex->opacity.val = getF4( fp ); - tex->opacity.eindex = getVX( fp ); - break; - - case ID_ENAB: - tex->enabled = getU2( fp ); - break; - - case ID_NEGA: - tex->negative = getU2( fp ); - break; - - case ID_AXIS: - tex->axis = getU2( fp ); - break; - - default: - break; - } - - /* error while reading current subchunk? */ - - rlen = get_flen(); - if ( rlen < 0 || rlen > sz ) return 0; - - /* skip unread parts of the current subchunk */ - - if ( rlen < sz ) - fseek( fp, sz - rlen, SEEK_CUR ); - - /* end of the texture header subchunk? */ - - if ( hsz <= ftell( fp ) - pos ) - break; - - /* get the next subchunk header */ - - set_flen( 0 ); - id = getU4( fp ); - sz = getU2( fp ); - if ( 6 != get_flen() ) return 0; - } - - set_flen( ftell( fp ) - pos ); - return 1; -} - - -/* -====================================================================== -lwGetTMap() - -Read a texture map from a SURF.BLOK in an LWO2 file. The TMAP -defines the mapping from texture to world or object coordinates. -====================================================================== */ - -int lwGetTMap( FILE *fp, int tmapsz, lwTMap *tmap ) -{ - unsigned int id; - unsigned short sz; - int rlen, pos, i; - - pos = ftell( fp ); - id = getU4( fp ); - sz = getU2( fp ); - if ( 0 > get_flen() ) return 0; - - while ( 1 ) { - sz += sz & 1; - set_flen( 0 ); - - switch ( id ) { - case ID_SIZE: - for ( i = 0; i < 3; i++ ) - tmap->size.val[ i ] = getF4( fp ); - tmap->size.eindex = getVX( fp ); - break; - - case ID_CNTR: - for ( i = 0; i < 3; i++ ) - tmap->center.val[ i ] = getF4( fp ); - tmap->center.eindex = getVX( fp ); - break; - - case ID_ROTA: - for ( i = 0; i < 3; i++ ) - tmap->rotate.val[ i ] = getF4( fp ); - tmap->rotate.eindex = getVX( fp ); - break; - - case ID_FALL: - tmap->fall_type = getU2( fp ); - for ( i = 0; i < 3; i++ ) - tmap->falloff.val[ i ] = getF4( fp ); - tmap->falloff.eindex = getVX( fp ); - break; - - case ID_OREF: - tmap->ref_object = getS0( fp ); - break; - - case ID_CSYS: - tmap->coord_sys = getU2( fp ); - break; - - default: - break; - } - - /* error while reading the current subchunk? */ - - rlen = get_flen(); - if ( rlen < 0 || rlen > sz ) return 0; - - /* skip unread parts of the current subchunk */ - - if ( rlen < sz ) - fseek( fp, sz - rlen, SEEK_CUR ); - - /* end of the TMAP subchunk? */ - - if ( tmapsz <= ftell( fp ) - pos ) - break; - - /* get the next subchunk header */ - - set_flen( 0 ); - id = getU4( fp ); - sz = getU2( fp ); - if ( 6 != get_flen() ) return 0; - } - - set_flen( ftell( fp ) - pos ); - return 1; -} - - -/* -====================================================================== -lwGetImageMap() - -Read an lwImageMap from a SURF.BLOK in an LWO2 file. -====================================================================== */ - -int lwGetImageMap( FILE *fp, int rsz, lwTexture *tex ) -{ - unsigned int id; - unsigned short sz; - int rlen, pos; - - pos = ftell( fp ); - id = getU4( fp ); - sz = getU2( fp ); - if ( 0 > get_flen() ) return 0; - - while ( 1 ) { - sz += sz & 1; - set_flen( 0 ); - - switch ( id ) { - case ID_TMAP: - if ( !lwGetTMap( fp, sz, &tex->tmap )) return 0; - break; - - case ID_PROJ: - tex->param.imap.projection = getU2( fp ); - break; - - case ID_VMAP: - tex->param.imap.vmap_name = getS0( fp ); - break; - - case ID_AXIS: - tex->param.imap.axis = getU2( fp ); - break; - - case ID_IMAG: - tex->param.imap.cindex = getVX( fp ); - break; - - case ID_WRAP: - tex->param.imap.wrapw_type = getU2( fp ); - tex->param.imap.wraph_type = getU2( fp ); - break; - - case ID_WRPW: - tex->param.imap.wrapw.val = getF4( fp ); - tex->param.imap.wrapw.eindex = getVX( fp ); - break; - - case ID_WRPH: - tex->param.imap.wraph.val = getF4( fp ); - tex->param.imap.wraph.eindex = getVX( fp ); - break; - - case ID_AAST: - tex->param.imap.aas_flags = getU2( fp ); - tex->param.imap.aa_strength = getF4( fp ); - break; - - case ID_PIXB: - tex->param.imap.pblend = getU2( fp ); - break; - - case ID_STCK: - tex->param.imap.stck.val = getF4( fp ); - tex->param.imap.stck.eindex = getVX( fp ); - break; - - case ID_TAMP: - tex->param.imap.amplitude.val = getF4( fp ); - tex->param.imap.amplitude.eindex = getVX( fp ); - break; - - default: - break; - } - - /* error while reading the current subchunk? */ - - rlen = get_flen(); - if ( rlen < 0 || rlen > sz ) return 0; - - /* skip unread parts of the current subchunk */ - - if ( rlen < sz ) - fseek( fp, sz - rlen, SEEK_CUR ); - - /* end of the image map? */ - - if ( rsz <= ftell( fp ) - pos ) - break; - - /* get the next subchunk header */ - - set_flen( 0 ); - id = getU4( fp ); - sz = getU2( fp ); - if ( 6 != get_flen() ) return 0; - } - - set_flen( ftell( fp ) - pos ); - return 1; -} - - -/* -====================================================================== -lwGetProcedural() - -Read an lwProcedural from a SURF.BLOK in an LWO2 file. -====================================================================== */ - -int lwGetProcedural( FILE *fp, int rsz, lwTexture *tex ) -{ - unsigned int id; - unsigned short sz; - int rlen, pos; - - pos = ftell( fp ); - id = getU4( fp ); - sz = getU2( fp ); - if ( 0 > get_flen() ) return 0; - - while ( 1 ) { - sz += sz & 1; - set_flen( 0 ); - - switch ( id ) { - case ID_TMAP: - if ( !lwGetTMap( fp, sz, &tex->tmap )) return 0; - break; - - case ID_AXIS: - tex->param.proc.axis = getU2( fp ); - break; - - case ID_VALU: - tex->param.proc.value[ 0 ] = getF4( fp ); - if ( sz >= 8 ) tex->param.proc.value[ 1 ] = getF4( fp ); - if ( sz >= 12 ) tex->param.proc.value[ 2 ] = getF4( fp ); - break; - - case ID_FUNC: - tex->param.proc.name = getS0( fp ); - rlen = get_flen(); - tex->param.proc.data = getbytes( fp, sz - rlen ); - break; - - default: - break; - } - - /* error while reading the current subchunk? */ - - rlen = get_flen(); - if ( rlen < 0 || rlen > sz ) return 0; - - /* skip unread parts of the current subchunk */ - - if ( rlen < sz ) - fseek( fp, sz - rlen, SEEK_CUR ); - - /* end of the procedural block? */ - - if ( rsz <= ftell( fp ) - pos ) - break; - - /* get the next subchunk header */ - - set_flen( 0 ); - id = getU4( fp ); - sz = getU2( fp ); - if ( 6 != get_flen() ) return 0; - } - - set_flen( ftell( fp ) - pos ); - return 1; -} - - -/* -====================================================================== -lwGetGradient() - -Read an lwGradient from a SURF.BLOK in an LWO2 file. -====================================================================== */ - -int lwGetGradient( FILE *fp, int rsz, lwTexture *tex ) -{ - unsigned int id; - unsigned short sz; - int rlen, pos, i, j, nkeys; - - pos = ftell( fp ); - id = getU4( fp ); - sz = getU2( fp ); - if ( 0 > get_flen() ) return 0; - - while ( 1 ) { - sz += sz & 1; - set_flen( 0 ); - - switch ( id ) { - case ID_TMAP: - if ( !lwGetTMap( fp, sz, &tex->tmap )) return 0; - break; - - case ID_PNAM: - tex->param.grad.paramname = getS0( fp ); - break; - - case ID_INAM: - tex->param.grad.itemname = getS0( fp ); - break; - - case ID_GRST: - tex->param.grad.start = getF4( fp ); - break; - - case ID_GREN: - tex->param.grad.end = getF4( fp ); - break; - - case ID_GRPT: - tex->param.grad.repeat = getU2( fp ); - break; - - case ID_FKEY: - nkeys = sz / sizeof( lwGradKey ); - tex->param.grad.key = calloc( nkeys, sizeof( lwGradKey )); - if ( !tex->param.grad.key ) return 0; - for ( i = 0; i < nkeys; i++ ) { - tex->param.grad.key[ i ].value = getF4( fp ); - for ( j = 0; j < 4; j++ ) - tex->param.grad.key[ i ].rgba[ j ] = getF4( fp ); - } - break; - - case ID_IKEY: - nkeys = sz / 2; - tex->param.grad.ikey = calloc( nkeys, sizeof( short )); - if ( !tex->param.grad.ikey ) return 0; - for ( i = 0; i < nkeys; i++ ) - tex->param.grad.ikey[ i ] = getU2( fp ); - break; - - default: - break; - } - - /* error while reading the current subchunk? */ - - rlen = get_flen(); - if ( rlen < 0 || rlen > sz ) return 0; - - /* skip unread parts of the current subchunk */ - - if ( rlen < sz ) - fseek( fp, sz - rlen, SEEK_CUR ); - - /* end of the gradient? */ - - if ( rsz <= ftell( fp ) - pos ) - break; - - /* get the next subchunk header */ - - set_flen( 0 ); - id = getU4( fp ); - sz = getU2( fp ); - if ( 6 != get_flen() ) return 0; - } - - set_flen( ftell( fp ) - pos ); - return 1; -} - - -/* -====================================================================== -lwGetTexture() - -Read an lwTexture from a SURF.BLOK in an LWO2 file. -====================================================================== */ - -lwTexture *lwGetTexture( FILE *fp, int bloksz, unsigned int type ) -{ - lwTexture *tex; - unsigned short sz; - int ok; - - tex = calloc( 1, sizeof( lwTexture )); - if ( !tex ) return NULL; - - tex->type = type; - tex->tmap.size.val[ 0 ] = - tex->tmap.size.val[ 1 ] = - tex->tmap.size.val[ 2 ] = 1.0f; - tex->opacity.val = 1.0f; - tex->enabled = 1; - - sz = getU2( fp ); - if ( !lwGetTHeader( fp, sz, tex )) { - free( tex ); - return NULL; - } - - sz = bloksz - sz - 6; - switch ( type ) { - case ID_IMAP: ok = lwGetImageMap( fp, sz, tex ); break; - case ID_PROC: ok = lwGetProcedural( fp, sz, tex ); break; - case ID_GRAD: ok = lwGetGradient( fp, sz, tex ); break; - default: - ok = !fseek( fp, sz, SEEK_CUR ); - } - - if ( !ok ) { - lwFreeTexture( tex ); - return NULL; - } - - set_flen( bloksz ); - return tex; -} - - -/* -====================================================================== -lwGetShader() - -Read a shader record from a SURF.BLOK in an LWO2 file. -====================================================================== */ - -lwPlugin *lwGetShader( FILE *fp, int bloksz ) -{ - lwPlugin *shdr; - unsigned int id; - unsigned short sz; - int hsz, rlen, pos; - - shdr = calloc( 1, sizeof( lwPlugin )); - if ( !shdr ) return NULL; - - pos = ftell( fp ); - set_flen( 0 ); - hsz = getU2( fp ); - shdr->ord = getS0( fp ); - id = getU4( fp ); - sz = getU2( fp ); - if ( 0 > get_flen() ) goto Fail; - - while ( hsz > 0 ) { - sz += sz & 1; - hsz -= sz; - if ( id == ID_ENAB ) { - shdr->flags = getU2( fp ); - break; - } - else { - fseek( fp, sz, SEEK_CUR ); - id = getU4( fp ); - sz = getU2( fp ); - } - } - - id = getU4( fp ); - sz = getU2( fp ); - if ( 0 > get_flen() ) goto Fail; - - while ( 1 ) { - sz += sz & 1; - set_flen( 0 ); - - switch ( id ) { - case ID_FUNC: - shdr->name = getS0( fp ); - rlen = get_flen(); - shdr->data = getbytes( fp, sz - rlen ); - break; - - default: - break; - } - - /* error while reading the current subchunk? */ - - rlen = get_flen(); - if ( rlen < 0 || rlen > sz ) goto Fail; - - /* skip unread parts of the current subchunk */ - - if ( rlen < sz ) - fseek( fp, sz - rlen, SEEK_CUR ); - - /* end of the shader block? */ - - if ( bloksz <= ftell( fp ) - pos ) - break; - - /* get the next subchunk header */ - - set_flen( 0 ); - id = getU4( fp ); - sz = getU2( fp ); - if ( 6 != get_flen() ) goto Fail; - } - - set_flen( ftell( fp ) - pos ); - return shdr; - -Fail: - lwFreePlugin( shdr ); - return NULL; -} - - -/* -====================================================================== -compare_textures() -compare_shaders() - -Callbacks for the lwListInsert() function, which is called to add -textures to surface channels and shaders to surfaces. -====================================================================== */ - -static int compare_textures( lwTexture *a, lwTexture *b ) -{ - return strcmp( a->ord, b->ord ); -} - - -static int compare_shaders( lwPlugin *a, lwPlugin *b ) -{ - return strcmp( a->ord, b->ord ); -} - - -/* -====================================================================== -add_texture() - -Finds the surface channel (lwTParam or lwCParam) to which a texture is -applied, then calls lwListInsert(). -====================================================================== */ - -static int add_texture( lwSurface *surf, lwTexture *tex ) -{ - lwTexture **list; - - switch ( tex->chan ) { - case ID_COLR: list = &surf->color.tex; break; - case ID_LUMI: list = &surf->luminosity.tex; break; - case ID_DIFF: list = &surf->diffuse.tex; break; - case ID_SPEC: list = &surf->specularity.tex; break; - case ID_GLOS: list = &surf->glossiness.tex; break; - case ID_REFL: list = &surf->reflection.val.tex; break; - case ID_TRAN: list = &surf->transparency.val.tex; break; - case ID_RIND: list = &surf->eta.tex; break; - case ID_TRNL: list = &surf->translucency.tex; break; - case ID_BUMP: list = &surf->bump.tex; break; - default: return 0; - } - - lwListInsert( list, tex, compare_textures ); - return 1; -} - - -/* -====================================================================== -lwDefaultSurface() - -Allocate and initialize a surface. -====================================================================== */ - -lwSurface *lwDefaultSurface( void ) -{ - lwSurface *surf; - - surf = calloc( 1, sizeof( lwSurface )); - if ( !surf ) return NULL; - - surf->color.rgb[ 0 ] = 0.78431f; - surf->color.rgb[ 1 ] = 0.78431f; - surf->color.rgb[ 2 ] = 0.78431f; - surf->diffuse.val = 1.0f; - surf->glossiness.val = 0.4f; - surf->bump.val = 1.0f; - surf->eta.val = 1.0f; - surf->sideflags = 1; - - return surf; -} - - -/* -====================================================================== -lwGetSurface() - -Read an lwSurface from an LWO2 file. -====================================================================== */ - -lwSurface *lwGetSurface( FILE *fp, int cksize ) -{ - lwSurface *surf; - lwTexture *tex; - lwPlugin *shdr; - unsigned int id, type; - unsigned short sz; - int pos, rlen; - - - /* allocate the Surface structure */ - - surf = calloc( 1, sizeof( lwSurface )); - if ( !surf ) goto Fail; - - /* non-zero defaults */ - - surf->color.rgb[ 0 ] = 0.78431f; - surf->color.rgb[ 1 ] = 0.78431f; - surf->color.rgb[ 2 ] = 0.78431f; - surf->diffuse.val = 1.0f; - surf->glossiness.val = 0.4f; - surf->bump.val = 1.0f; - surf->eta.val = 1.0f; - surf->sideflags = 1; - - /* remember where we started */ - - set_flen( 0 ); - pos = ftell( fp ); - - /* names */ - - surf->name = getS0( fp ); - surf->srcname = getS0( fp ); - - /* first subchunk header */ - - id = getU4( fp ); - sz = getU2( fp ); - if ( 0 > get_flen() ) goto Fail; - - /* process subchunks as they're encountered */ - - while ( 1 ) { - sz += sz & 1; - set_flen( 0 ); - - switch ( id ) { - case ID_COLR: - surf->color.rgb[ 0 ] = getF4( fp ); - surf->color.rgb[ 1 ] = getF4( fp ); - surf->color.rgb[ 2 ] = getF4( fp ); - surf->color.eindex = getVX( fp ); - break; - - case ID_LUMI: - surf->luminosity.val = getF4( fp ); - surf->luminosity.eindex = getVX( fp ); - break; - - case ID_DIFF: - surf->diffuse.val = getF4( fp ); - surf->diffuse.eindex = getVX( fp ); - break; - - case ID_SPEC: - surf->specularity.val = getF4( fp ); - surf->specularity.eindex = getVX( fp ); - break; - - case ID_GLOS: - surf->glossiness.val = getF4( fp ); - surf->glossiness.eindex = getVX( fp ); - break; - - case ID_REFL: - surf->reflection.val.val = getF4( fp ); - surf->reflection.val.eindex = getVX( fp ); - break; - - case ID_RFOP: - surf->reflection.options = getU2( fp ); - break; - - case ID_RIMG: - surf->reflection.cindex = getVX( fp ); - break; - - case ID_RSAN: - surf->reflection.seam_angle = getF4( fp ); - break; - - case ID_TRAN: - surf->transparency.val.val = getF4( fp ); - surf->transparency.val.eindex = getVX( fp ); - break; - - case ID_TROP: - surf->transparency.options = getU2( fp ); - break; - - case ID_TIMG: - surf->transparency.cindex = getVX( fp ); - break; - - case ID_RIND: - surf->eta.val = getF4( fp ); - surf->eta.eindex = getVX( fp ); - break; - - case ID_TRNL: - surf->translucency.val = getF4( fp ); - surf->translucency.eindex = getVX( fp ); - break; - - case ID_BUMP: - surf->bump.val = getF4( fp ); - surf->bump.eindex = getVX( fp ); - break; - - case ID_SMAN: - surf->smooth = getF4( fp ); - break; - - case ID_SIDE: - surf->sideflags = getU2( fp ); - break; - - case ID_CLRH: - surf->color_hilite.val = getF4( fp ); - surf->color_hilite.eindex = getVX( fp ); - break; - - case ID_CLRF: - surf->color_filter.val = getF4( fp ); - surf->color_filter.eindex = getVX( fp ); - break; - - case ID_ADTR: - surf->add_trans.val = getF4( fp ); - surf->add_trans.eindex = getVX( fp ); - break; - - case ID_SHRP: - surf->dif_sharp.val = getF4( fp ); - surf->dif_sharp.eindex = getVX( fp ); - break; - - case ID_GVAL: - surf->glow.val = getF4( fp ); - surf->glow.eindex = getVX( fp ); - break; - - case ID_LINE: - surf->line.enabled = 1; - if ( sz >= 2 ) surf->line.flags = getU2( fp ); - if ( sz >= 6 ) surf->line.size.val = getF4( fp ); - if ( sz >= 8 ) surf->line.size.eindex = getVX( fp ); - break; - - case ID_ALPH: - surf->alpha_mode = getU2( fp ); - surf->alpha = getF4( fp ); - break; - - case ID_AVAL: - surf->alpha = getF4( fp ); - break; - - case ID_BLOK: - type = getU4( fp ); - - switch ( type ) { - case ID_IMAP: - case ID_PROC: - case ID_GRAD: - tex = lwGetTexture( fp, sz - 4, type ); - if ( !tex ) goto Fail; - if ( !add_texture( surf, tex )) - lwFreeTexture( tex ); - set_flen( 4 + get_flen() ); - break; - case ID_SHDR: - shdr = lwGetShader( fp, sz - 4 ); - if ( !shdr ) goto Fail; - lwListInsert( &surf->shader, shdr, compare_shaders ); - ++surf->nshaders; - set_flen( 4 + get_flen() ); - break; - } - break; - - default: - break; - } - - /* error while reading current subchunk? */ - - rlen = get_flen(); - if ( rlen < 0 || rlen > sz ) goto Fail; - - /* skip unread parts of the current subchunk */ - - if ( rlen < sz ) - fseek( fp, sz - rlen, SEEK_CUR ); - - /* end of the SURF chunk? */ - - if ( cksize <= ftell( fp ) - pos ) - break; - - /* get the next subchunk header */ - - set_flen( 0 ); - id = getU4( fp ); - sz = getU2( fp ); - if ( 6 != get_flen() ) goto Fail; - } - - return surf; - -Fail: - if ( surf ) lwFreeSurface( surf ); - return NULL; -} diff --git a/cs/engine/plugins/lw/Export/LWO/vecmath.c b/cs/engine/plugins/lw/Export/LWO/vecmath.c deleted file mode 100644 index eaa1e8fc2..000000000 --- a/cs/engine/plugins/lw/Export/LWO/vecmath.c +++ /dev/null @@ -1,37 +0,0 @@ -/* -====================================================================== -vecmath.c - -Basic vector and matrix functions. - -Ernie Wright 17 Sep 00 -====================================================================== */ - -#include - - -float dot( float a[], float b[] ) -{ - return a[ 0 ] * b[ 0 ] + a[ 1 ] * b[ 1 ] + a[ 2 ] * b[ 2 ]; -} - - -void cross( float a[], float b[], float c[] ) -{ - c[ 0 ] = a[ 1 ] * b[ 2 ] - a[ 2 ] * b[ 1 ]; - c[ 1 ] = a[ 2 ] * b[ 0 ] - a[ 0 ] * b[ 2 ]; - c[ 2 ] = a[ 0 ] * b[ 1 ] - a[ 1 ] * b[ 0 ]; -} - - -void normalize( float v[] ) -{ - float r; - - r = ( float ) sqrt( dot( v, v )); - if ( r > 0 ) { - v[ 0 ] /= r; - v[ 1 ] /= r; - v[ 2 ] /= r; - } -} diff --git a/cs/engine/plugins/lw/Export/LWO/vmap.c b/cs/engine/plugins/lw/Export/LWO/vmap.c deleted file mode 100644 index 10583de99..000000000 --- a/cs/engine/plugins/lw/Export/LWO/vmap.c +++ /dev/null @@ -1,244 +0,0 @@ -/* -====================================================================== -vmap.c - -Vertex map functions for an LWO2 reader. - -Ernie Wright 17 Sep 00 -====================================================================== */ - -#include -#include -#include "lwo2.h" - - -/* -====================================================================== -lwFreeVMap() - -Free memory used by an lwVMap. -====================================================================== */ - -void lwFreeVMap( lwVMap *vmap ) -{ - if ( vmap ) { - if ( vmap->name ) free( vmap->name ); - if ( vmap->vindex ) free( vmap->vindex ); - if ( vmap->pindex ) free( vmap->pindex ); - if ( vmap->val ) { - if ( vmap->val[ 0 ] ) free( vmap->val[ 0 ] ); - free( vmap->val ); - } - free( vmap ); - } -} - - -/* -====================================================================== -lwGetVMap() - -Read an lwVMap from a VMAP or VMAD chunk in an LWO2. -====================================================================== */ - -lwVMap *lwGetVMap( FILE *fp, int cksize, int ptoffset, int poloffset, - int perpoly ) -{ - unsigned char *buf, *bp; - lwVMap *vmap; - float *f; - int i, j, npts, rlen; - - - /* read the whole chunk */ - - set_flen( 0 ); - buf = getbytes( fp, cksize ); - if ( !buf ) return NULL; - - vmap = calloc( 1, sizeof( lwVMap )); - if ( !vmap ) { - free( buf ); - return NULL; - } - - /* initialize the vmap */ - - vmap->perpoly = perpoly; - - bp = buf; - set_flen( 0 ); - vmap->type = sgetU4( &bp ); - vmap->dim = sgetU2( &bp ); - vmap->name = sgetS0( &bp ); - rlen = get_flen(); - - /* count the vmap records */ - - npts = 0; - while ( bp < buf + cksize ) { - i = sgetVX( &bp ); - if ( perpoly ) - i = sgetVX( &bp ); - bp += vmap->dim * sizeof( float ); - ++npts; - } - - /* allocate the vmap */ - - vmap->nverts = npts; - vmap->vindex = calloc( npts, sizeof( int )); - if ( !vmap->vindex ) goto Fail; - if ( perpoly ) { - vmap->pindex = calloc( npts, sizeof( int )); - if ( !vmap->pindex ) goto Fail; - } - - if ( vmap->dim > 0 ) { - vmap->val = calloc( npts, sizeof( float * )); - if ( !vmap->val ) goto Fail; - f = malloc( npts * vmap->dim * sizeof( float )); - if ( !f ) goto Fail; - for ( i = 0; i < npts; i++ ) - vmap->val[ i ] = f + i * vmap->dim; - } - - /* fill in the vmap values */ - - bp = buf + rlen; - for ( i = 0; i < npts; i++ ) { - vmap->vindex[ i ] = sgetVX( &bp ); - if ( perpoly ) - vmap->pindex[ i ] = sgetVX( &bp ); - for ( j = 0; j < vmap->dim; j++ ) - vmap->val[ i ][ j ] = sgetF4( &bp ); - } - - free( buf ); - return vmap; - -Fail: - if ( buf ) free( buf ); - lwFreeVMap( vmap ); - return NULL; -} - - -/* -====================================================================== -lwGetPointVMaps() - -Fill in the lwVMapPt structure for each point. -====================================================================== */ - -int lwGetPointVMaps( lwPointList *point, lwVMap *vmap ) -{ - lwVMap *vm; - int i, j, n; - - /* count the number of vmap values for each point */ - - vm = vmap; - while ( vm ) { - if ( !vm->perpoly ) - for ( i = 0; i < vm->nverts; i++ ) - ++point->pt[ vm->vindex[ i ]].nvmaps; - vm = vm->next; - } - - /* allocate vmap references for each mapped point */ - - for ( i = 0; i < point->count; i++ ) { - if ( point->pt[ i ].nvmaps ) { - point->pt[ i ].vm = calloc( point->pt[ i ].nvmaps, sizeof( lwVMapPt )); - if ( !point->pt[ i ].vm ) return 0; - point->pt[ i ].nvmaps = 0; - } - } - - /* fill in vmap references for each mapped point */ - - vm = vmap; - while ( vm ) { - if ( !vm->perpoly ) { - for ( i = 0; i < vm->nverts; i++ ) { - j = vm->vindex[ i ]; - n = point->pt[ j ].nvmaps; - point->pt[ j ].vm[ n ].vmap = vm; - point->pt[ j ].vm[ n ].index = i; - ++point->pt[ j ].nvmaps; - } - } - vm = vm->next; - } - - return 1; -} - - -/* -====================================================================== -lwGetPolyVMaps() - -Fill in the lwVMapPt structure for each polygon vertex. -====================================================================== */ - -int lwGetPolyVMaps( lwPolygonList *polygon, lwVMap *vmap ) -{ - lwVMap *vm; - lwPolVert *pv; - int i, j; - - /* count the number of vmap values for each polygon vertex */ - - vm = vmap; - while ( vm ) { - if ( vm->perpoly ) { - for ( i = 0; i < vm->nverts; i++ ) { - for ( j = 0; j < polygon->pol[ vm->pindex[ i ]].nverts; j++ ) { - pv = &polygon->pol[ vm->pindex[ i ]].v[ j ]; - if ( vm->vindex[ i ] == pv->index ) { - ++pv->nvmaps; - break; - } - } - } - } - vm = vm->next; - } - - /* allocate vmap references for each mapped vertex */ - - for ( i = 0; i < polygon->count; i++ ) { - for ( j = 0; j < polygon->pol[ i ].nverts; j++ ) { - pv = &polygon->pol[ i ].v[ j ]; - if ( pv->nvmaps ) { - pv->vm = calloc( pv->nvmaps, sizeof( lwVMapPt )); - if ( !pv->vm ) return 0; - pv->nvmaps = 0; - } - } - } - - /* fill in vmap references for each mapped point */ - - vm = vmap; - while ( vm ) { - if ( vm->perpoly ) { - for ( i = 0; i < vm->nverts; i++ ) { - for ( j = 0; j < polygon->pol[ vm->pindex[ i ]].nverts; j++ ) { - pv = &polygon->pol[ vm->pindex[ i ]].v[ j ]; - if ( vm->vindex[ i ] == pv->index ) { - pv->vm[ pv->nvmaps ].vmap = vm; - pv->vm[ pv->nvmaps ].index = i; - ++pv->nvmaps; - break; - } - } - } - } - vm = vm->next; - } - - return 1; -} diff --git a/cs/engine/plugins/lw/Export/LW_export_keys.cpp b/cs/engine/plugins/lw/Export/LW_export_keys.cpp deleted file mode 100644 index 9042010f6..000000000 --- a/cs/engine/plugins/lw/Export/LW_export_keys.cpp +++ /dev/null @@ -1,118 +0,0 @@ -#include "stdafx.h" -#include "../../../xrCore/FileSystem.h" -#include "../../../xrCore/FS.h" -#include -#include -#include "Envelope.h" -#include "Bone.h" -#include "Motion.h" -#include "scenscan\objectdb.h" -#include - -extern "C" LWItemInfo *g_iteminfo; -extern "C" LWChannelInfo *g_chinfo; -extern "C" LWEnvelopeFuncs *g_envf; -extern "C" LWSceneInfo *g_lwsi; -extern "C" LWInterfaceInfo *g_intinfo; -extern "C" LWMessageFuncs *g_msg; -extern "C" LWBoneInfo *g_boneinfo; -extern "C" LWObjectFuncs *g_objfunc; -extern "C" LWObjectInfo *g_objinfo; -extern "C" HostDisplayInfo *g_hdi; - -static CSMotion* m_Motion; - -static void RecurseBone(LWItemID parent){ - LWItemID bone = g_iteminfo->firstChild(parent); - while (bone!=LWITEM_NULL){ - if (g_iteminfo->type(bone)==LWI_BONE){ - m_Motion->ParseBoneMotion(bone); - RecurseBone(bone); - } - bone = g_iteminfo->nextChild(parent,bone); - } -} - -static bool ParseObjectMotion(LWItemID object, int& obj_cnt){ - LWItemID bone, parent; - bone = g_iteminfo->first( LWI_BONE, object ); - - if (!bone){ - g_msg->error("Can't find bone.",0); - return false; - } - - while (true){ - parent = g_iteminfo->parent(bone); - if (!parent){ - g_msg->error("Can't find root bone.",0); - return false; - } - if (g_iteminfo->type(parent)!=LWI_BONE) break; - else bone = parent; - } - - if (bone){ - if (obj_cnt>0){ - g_msg->error("Can't support multiple objects.",0); - return false; - } - m_Motion->ParseBoneMotion(bone); - RecurseBone (bone); - - obj_cnt++; - } - return true; -} - -void ReplaceSpaceAndLowerCase(shared_str& s) -{ - if (*s){ - char* _s = xr_strdup(*s); - char* lp = _s; - while(lp[0]){if (lp[0]==' ') lp[0]='_'; lp++;} - xr_strlwr (_s); - s = _s; - xr_free (_s); - } -} - -extern "C" { -//----------------------------------------------------------------------------------------- -void __cdecl SaveSkeletonMotion(GlobalFunc *global) -{ - Core._initialize("XRayPlugin",ELogCallback,FALSE); - FS._initialize (CLocatorAPI::flScanAppRoot,NULL,"xray_path.ltx"); - // get bone ID - LWItemID object; - bool bErr = true; - - string_path buf=""; - string64 name; - - EFS.GetSaveName ("$smotion$",buf); - - if (buf[0]){ - object = g_iteminfo->first( LWI_OBJECT, NULL ); - int obj_cnt = 0; - _splitpath( buf, 0, 0, name, 0 ); - m_Motion = new CSMotion(); - m_Motion->SetName(name); - while ( object ) { - if(g_intinfo->itemFlags(object)&LWITEMF_SELECTED){ - bErr = !ParseObjectMotion(object,obj_cnt); - break; - } - object = g_iteminfo->next( object ); - } - - if (!bErr){ - m_Motion->SetParam(g_intinfo->previewStart, g_intinfo->previewEnd, (float)g_lwsi->framesPerSecond); - m_Motion->SaveMotion(buf); - g_msg->info ("Export successful.",buf); - }else g_msg->error("Export failed.",0); - - xr_delete(m_Motion); - } -} -}; \ No newline at end of file diff --git a/cs/engine/plugins/lw/Export/LW_export_motion.cpp b/cs/engine/plugins/lw/Export/LW_export_motion.cpp deleted file mode 100644 index cd2abf7e5..000000000 --- a/cs/engine/plugins/lw/Export/LW_export_motion.cpp +++ /dev/null @@ -1,76 +0,0 @@ -#include "stdafx.h" -#include "../../../xrCore/FileSystem.h" -#include "../../../xrCore/FS.h" -#include -#include -#include "Envelope.h" -#include "Bone.h" -#include "Motion.h" -#include "scenscan\objectdb.h" -#include - -extern "C" LWItemInfo *g_iteminfo; -extern "C" LWChannelInfo *g_chinfo; -extern "C" LWEnvelopeFuncs *g_envf; -extern "C" LWSceneInfo *g_lwsi; -extern "C" LWInterfaceInfo *g_intinfo; -extern "C" LWMessageFuncs *g_msg; -extern "C" LWBoneInfo *g_boneinfo; -extern "C" LWObjectFuncs *g_objfunc; -extern "C" LWObjectInfo *g_objinfo; -extern "C" HostDisplayInfo *g_hdi; - -static COMotion* m_Motion; - -void SelectedCount(LWItemType type, int& sel_obj_count, LWItemID& last_sel_obj) -{ - LWItemID object; - object = g_iteminfo->first( type, NULL ); - while ( object ) { - if(g_intinfo->itemFlags(object)&LWITEMF_SELECTED){ - last_sel_obj = object; - sel_obj_count++; - } - object = g_iteminfo->next( object ); - } -} - -extern "C" { -//----------------------------------------------------------------------------------------- -void __cdecl SaveObjectMotion(GlobalFunc *global) -{ - Core._initialize("XRayPlugin",ELogCallback,FALSE); - FS._initialize (CLocatorAPI::flScanAppRoot,NULL,"xray_path.ltx"); - // get bone ID - bool bErr = false; - - string_path buf = ""; - - EFS.GetSaveName ("$omotion$",buf); - if (buf[0]){ - int sel_obj_cnt = 0; - LWItemID sel_object; - - SelectedCount (LWI_OBJECT,sel_obj_cnt,sel_object); - SelectedCount (LWI_CAMERA,sel_obj_cnt,sel_object); - SelectedCount (LWI_BONE, sel_obj_cnt,sel_object); - SelectedCount (LWI_LIGHT, sel_obj_cnt,sel_object); - - if (sel_obj_cnt==1){ - string_path name; - _splitpath (buf, 0, 0, name, 0); - m_Motion = new COMotion(); - m_Motion->SetName (name); - m_Motion->ParseObjectMotion (sel_object); - m_Motion->SetParam (g_intinfo->previewStart, g_intinfo->previewEnd, (float)g_lwsi->framesPerSecond); - m_Motion->SaveMotion (buf); - g_msg->info ("Export motion successful.",g_iteminfo->name(sel_object)); - xr_delete (m_Motion); - }else{ - g_msg->error ("Select one object and try again.",NULL); - } - }else{ - g_msg->error("Export failed. Empty name.",NULL); - } -} -}; \ No newline at end of file diff --git a/cs/engine/plugins/lw/Export/LW_export_object.cpp b/cs/engine/plugins/lw/Export/LW_export_object.cpp deleted file mode 100644 index f8b0e9d87..000000000 --- a/cs/engine/plugins/lw/Export/LW_export_object.cpp +++ /dev/null @@ -1,151 +0,0 @@ -#include "stdafx.h" -#include -#include -#include "../../../editors/ECore/Editor/editobject.h" -#include "../../../xrCore/FileSystem.h" -#include "../../../xrCore/FS.h" -#include "bone.h" -#include -#include - -extern "C" LWItemInfo *g_iteminfo; -extern "C" LWMessageFuncs *g_msg; -extern "C" LWInterfaceInfo *g_intinfo; -extern "C" HostDisplayInfo *g_hdi; -extern "C" LWObjectInfo *g_objinfo; - -static BoneVec* m_LWBones=0; - -static void AppendBone(LWItemID bone) -{ - m_LWBones->push_back(new CBone()); - CBone* B = m_LWBones->back(); - B->SetName(g_iteminfo->name(bone)); - B->ParseBone(bone); -} - -static void RecurseBone(LWItemID parent) -{ - LWItemID bone = g_iteminfo->firstChild(parent); - while (bone!=LWITEM_NULL){ - if (g_iteminfo->type(bone)==LWI_BONE){ - AppendBone(bone); - RecurseBone(bone); - } - bone = g_iteminfo->nextChild(parent,bone); - } -} - -static bool ParseObjectBones(LWItemID object, int& obj_cnt) -{ - LWItemID bone, parent; - bone = g_iteminfo->first( LWI_BONE, object ); - - if (!bone){ - g_msg->error("Can't find bone.",0); - return false; - } - - while (true){ - parent = g_iteminfo->parent(bone); - if (!parent){ - g_msg->error("Can't find root bone.",0); - return false; - } - if (g_iteminfo->type(parent)!=LWI_BONE) break; - else bone = parent; - } - - if (bone){ - if (obj_cnt>0){ - g_msg->error("Can't support multiple objects.",0); - return false; - } - AppendBone(bone); - RecurseBone (bone); - - obj_cnt++; - } - return true; -} - -extern "C" { - //----------------------------------------------------------------------------------------- - void __cdecl SaveObject(GlobalFunc *global) - { - Core._initialize("XRayPlugin",ELogCallback,FALSE); - FS._initialize (CLocatorAPI::flScanAppRoot,NULL,"xray_path.ltx"); - - // get bone ID - LWItemID object; - bool bErr = true; - - string_path buf = ""; - object = g_iteminfo->first( LWI_OBJECT, NULL ); - int obj_cnt = 0; - bool bObjSel = false; - - while (object){ - if(g_intinfo->itemFlags(object)&LWITEMF_SELECTED){ - bObjSel = true; - if (EFS.GetSaveName("$import$",buf,0,0)){ - bErr = false; - - char name[1024]; - _splitpath( buf, 0, 0, name, 0 ); - - CEditableObject* obj = new CEditableObject(name); - obj->SetVersionToCurrent(TRUE,TRUE); - - // parse bone if exist - bool bBoneExists=false; - if (g_iteminfo->first( LWI_BONE, object )){ - m_LWBones = &obj->Bones(); - bBoneExists = true; - if (!ParseObjectBones(object,obj_cnt)) bErr = true; - if (bErr){ - // default bone part - obj->BoneParts().push_back(SBonePart()); - SBonePart& BP = obj->BoneParts().back(); - BP.alias = "default"; - for (int b_i=0; b_i<(int)obj->Bones().size(); b_i++) - BP.bones.push_back(obj->Bones()[b_i]->Name()); - } - } - if (!bErr){ - LPCSTR lwo_nm=g_objinfo->filename(object); - {// append path - string_path path,dr,di; - _splitpath (lwo_nm,dr,di,0,0); - strconcat (sizeof(path),path,dr,di); - if (!FS.path_exist(path)) FS.append_path(path,path,0,FALSE); - } - if (FS.exist(lwo_nm)){ - if (!obj->Import_LWO(lwo_nm,false)) bErr = true; - else{ - obj->m_Flags.set(CEditableObject::eoDynamic,TRUE); - obj->Optimize (); - obj->SaveObject (buf); - } - }else - bErr = true; - } - // перенести выше или проверить не перетерает ли инфу о костях - - if (bErr) g_msg->error("Export failed.",0); - else g_msg->info ("Export successful.",buf); - bErr = false; - - xr_delete(obj); - m_LWBones = 0; - // freeObjectDB(odb); - break; - } - } - object = g_iteminfo->next( object ); - } - if (!bObjSel) g_msg->error("Select object at first.",0); - else if (bErr) g_msg->error("Export failed.",0); - } -//----------------------------------------------------------------------------------------- -}; \ No newline at end of file diff --git a/cs/engine/plugins/lw/Export/SceneObject.h b/cs/engine/plugins/lw/Export/SceneObject.h deleted file mode 100644 index 525b94ba4..000000000 --- a/cs/engine/plugins/lw/Export/SceneObject.h +++ /dev/null @@ -1,111 +0,0 @@ -//---------------------------------------------------- -#ifndef SceneObjectH -#define SceneObjectH - -#include "EditObject.h" -#include "customobject.h" -//---------------------------------------------------- - -class CSceneObject : public CCustomObject { - shared_str m_ReferenceName; - CEditableObject*m_pReference; - int m_Version; - void ReferenceChange (PropValue* sender); -public: - enum{ -// flDynamic = (1<<0), - flFORCE32 = u32(-1) - }; -private: - Fbox m_TBBox; - // options - Flags32 m_Flags; -public: - virtual void SetScale (const Fvector& scale) - { - if (m_pReference&&m_pReference->IsDynamic()){ - ELog.Msg(mtError,"Dynamic object %s - can't scale.", Name); - }else{ - FScale.set(scale); - UpdateTransform(); - } - } -protected: - typedef CCustomObject inherited; - int m_iBlinkTime; - CSurface* m_BlinkSurf; - void RenderBlink (); -public: - // constructor/destructor methods - CSceneObject (LPVOID data, LPCSTR name); - virtual ~CSceneObject (); - - virtual void Select (BOOL flag); - void Construct (LPVOID data); - - IC bool CheckVersion () {return m_pReference?(m_Version==m_pReference->Version()):false;} - // get object properties methods - IC bool RefCompare (CEditableObject *to){return m_pReference?!!(m_pReference==to):false; } - IC bool RefCompare (LPCSTR ref){return ref&&m_pReference?(strcmp(ref,m_pReference->GetName())==0):false; } - IC CEditableObject* GetReference () {return m_pReference; } - CEditableObject*SetReference (LPCSTR ref_name); - CEditableObject*UpdateReference (); - IC EditMeshVec* Meshes () {return m_pReference?&m_pReference->Meshes():0;} - virtual LPCSTR RefName () {return m_pReference?m_pReference->GetName():0;} - virtual bool CanAttach () {return true;} - - // statistics methods - IC bool IsDynamic () {return (m_pReference?m_pReference->IsDynamic():false); } - IC bool IsStatic () {return (m_pReference?m_pReference->IsStatic():false); } - IC bool IsMUStatic () {return (m_pReference?m_pReference->IsMUStatic():false); } - int GetFaceCount (); - int GetVertexCount (); - int GetSurfFaceCount (const char* surf_name); - - // render methods - virtual bool IsRender (); - virtual void Render (int priority, bool strictB2F); - void RenderSelection (u32 color=0x40E64646); - void RenderEdge (CEditableMesh* m=0, u32 color=0xFFC0C0C0); - void RenderBones (); - void RenderSingle (); - - // update methods - virtual void OnFrame (); - virtual void OnUpdateTransform (); - - // misc - void EvictObject (); - - // pick methods - bool BoxPick (const Fbox& box, SBoxPickInfoVec& pinf); - virtual bool RayPick (float& dist, const Fvector& S, const Fvector& D, SRayPickInfo* pinf=0); - virtual void RayQuery (SPickQuery& pinf); - virtual void BoxQuery (SPickQuery& pinf); - virtual bool FrustumPick (const CFrustum& frustum); - virtual bool SpherePick (const Fvector& center, float radius); - - // get orintation/bounding volume methods - virtual bool GetBox (Fbox& box); - virtual bool GetUTBox (Fbox& box); - void GetFullTransformToWorld (Fmatrix& m); - void GetFullTransformToLocal (Fmatrix& m); - - // editor integration - virtual void FillProp (LPCSTR pref, PropItemVec& values); - virtual bool GetSummaryInfo (SSceneSummary* inf); - - // load/save methods - virtual bool Load (IReader&); - virtual void Save (IWriter&); - - virtual void OnShowHint (AStringVec& dest); - - void Blink (CSurface* surf=0); - - virtual bool Validate (bool bMsg); -}; -//---------------------------------------------------- -#endif /*_INCDEF_EditObject_H_*/ - - diff --git a/cs/engine/plugins/lw/Export/bone_lw.cpp b/cs/engine/plugins/lw/Export/bone_lw.cpp deleted file mode 100644 index 79cfa5f03..000000000 --- a/cs/engine/plugins/lw/Export/bone_lw.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include "stdafx.h" -#include "..\..\Shared\bone.h" -#include "..\..\Shared\envelope.h" - -#ifdef _LW_EXPORT -extern "C" LWItemInfo *g_iteminfo; -extern "C" LWChannelInfo *g_chinfo; -extern "C" LWBoneInfo *g_boneinfo; -extern "C" LWEnvelopeFuncs *g_envf; - -void CBone::ParseBone(LWItemID bone){ - LWItemID P = g_iteminfo->parent(bone); - if (g_iteminfo->type(P)==LWI_BONE) SetParentName(g_iteminfo->name(P)); - - LWDVector vec; - g_boneinfo->restParam(bone,LWIP_POSITION,vec); - rest_offset.set((float)vec[0],(float)vec[1],(float)vec[2]); - g_boneinfo->restParam(bone,LWIP_ROTATION,vec); - rest_rotate.set((float)vec[1],(float)vec[0],(float)vec[2]); - - rest_length = (float)g_boneinfo->restLength(bone); - - SetWMap(g_boneinfo->weightMap(bone)); -} -#endif diff --git a/cs/engine/plugins/lw/Export/envtest.c b/cs/engine/plugins/lw/Export/envtest.c deleted file mode 100644 index 6c759e2f6..000000000 --- a/cs/engine/plugins/lw/Export/envtest.c +++ /dev/null @@ -1,110 +0,0 @@ -/* -====================================================================== -envtest.c - -A plug-in to test the envelope interpolation routine in interp.c. - -Ernie Wright 31 Aug 00 - -This is what I used to test evalEnvelope(). It reads the Position.X -envelope for the camera, then compares what evalEnvelope() returns to -what LWEnvelopeFuncs->evaluate() says. -====================================================================== */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* some globals */ - -LWChannelInfo *g_chinfo; -LWEnvelopeFuncs *g_envf; -LWItemInfo *g_iteminfo; -LWSceneInfo *g_lwsi; -LWInterfaceInfo *g_intinfo; -LWMessageFuncs *g_msg; -LWBoneInfo *g_boneinfo; -LWObjectFuncs *g_objfunc; -LWObjectInfo *g_objinfo; -LWSurfaceFuncs *g_surff; -HostDisplayInfo *g_hdi; - - -static int get_globals( GlobalFunc *global ) -{ - g_chinfo = global( LWCHANNELINFO_GLOBAL, GFUSE_TRANSIENT ); - g_envf = global( LWENVELOPEFUNCS_GLOBAL, GFUSE_TRANSIENT ); - g_iteminfo = global( LWITEMINFO_GLOBAL, GFUSE_TRANSIENT ); - g_lwsi = global( LWSCENEINFO_GLOBAL, GFUSE_TRANSIENT ); - g_intinfo = global( LWINTERFACEINFO_GLOBAL, GFUSE_TRANSIENT ); - g_msg = global( LWMESSAGEFUNCS_GLOBAL, GFUSE_TRANSIENT ); - g_boneinfo = global( LWBONEINFO_GLOBAL, GFUSE_TRANSIENT ); - g_objfunc = global( LWOBJECTFUNCS_GLOBAL, GFUSE_TRANSIENT ); - g_objinfo = global( LWOBJECTINFO_GLOBAL, GFUSE_TRANSIENT ); - g_surff = global( LWSURFACEFUNCS_GLOBAL, GFUSE_TRANSIENT ); - g_hdi = global( LWHOSTDISPLAYINFO_GLOBAL, GFUSE_TRANSIENT ); - - return ( g_chinfo && g_envf && g_iteminfo && g_lwsi && g_intinfo && g_msg && g_boneinfo && g_objfunc && g_objinfo && g_surff); -} - - -//====================================================================== -//KeyExport() -//The activation function. -//====================================================================== -void __cdecl SaveSkeletonMotion(GlobalFunc *global); -XCALL_( int )SkeletonMotionExport( long version, GlobalFunc *global, LWLayoutGeneric *local, void *serverData ){ - if (version!=LWLAYOUTGENERIC_VERSION) return AFUNC_BADVERSION; - if (!get_globals(global)) return AFUNC_BADGLOBAL; - - SaveSkeletonMotion(global); - - return AFUNC_OK; -} -//----------------------------------------------------------------------------------------- - -//====================================================================== -//KeyExport() -//The activation function. -//====================================================================== -void __cdecl SaveObject(GlobalFunc *global); -XCALL_( int )ObjectExport( long version, GlobalFunc *global, LWLayoutGeneric *local, void *serverData ){ - if (version!=LWLAYOUTGENERIC_VERSION) return AFUNC_BADVERSION; - if (!get_globals(global)) return AFUNC_BADGLOBAL; - - SaveObject(global); - - return AFUNC_OK; -} -//----------------------------------------------------------------------------------------- - -//====================================================================== -//KeyExport() -//The activation function. -//====================================================================== -void __cdecl SaveObjectMotion(GlobalFunc *global); -XCALL_( int )ObjectMotionExport( long version, GlobalFunc *global, LWLayoutGeneric *local, void *serverData ){ - if (version!=LWLAYOUTGENERIC_VERSION) return AFUNC_BADVERSION; - if (!get_globals(global)) return AFUNC_BADGLOBAL; - - SaveObjectMotion(global); - - return AFUNC_OK; -} - -ServerRecord ServerDesc[] = { - { LWLAYOUTGENERIC_CLASS, "XRay_Skeleton_Motion_Export", SkeletonMotionExport }, - { LWLAYOUTGENERIC_CLASS, "XRay_Object_Export", ObjectExport }, - { LWLAYOUTGENERIC_CLASS, "XRay_Object_Motion_Export", ObjectMotionExport }, - { NULL } -}; diff --git a/cs/engine/plugins/lw/Export/lwo2.h b/cs/engine/plugins/lw/Export/lwo2.h deleted file mode 100644 index 4f080487e..000000000 --- a/cs/engine/plugins/lw/Export/lwo2.h +++ /dev/null @@ -1,660 +0,0 @@ -/* -====================================================================== -lwo2.h - -Definitions and typedefs for LWO2 files. - -Ernie Wright 17 Sep 00 -====================================================================== */ - -#ifndef LWO2_H -#define LWO2_H - -/* chunk and subchunk IDs */ - -#ifndef LWID_ -#define LWID_(a,b,c,d) (((a)<<24)|((b)<<16)|((c)<<8)|(d)) -#endif - -#define ID_FORM LWID_('F','O','R','M') -#define ID_LWO2 LWID_('L','W','O','2') -#define ID_LWOB LWID_('L','W','O','B') - -/* top-level chunks */ -#define ID_LAYR LWID_('L','A','Y','R') -#define ID_TAGS LWID_('T','A','G','S') -#define ID_PNTS LWID_('P','N','T','S') -#define ID_BBOX LWID_('B','B','O','X') -#define ID_VMAP LWID_('V','M','A','P') -#define ID_VMAD LWID_('V','M','A','D') -#define ID_POLS LWID_('P','O','L','S') -#define ID_PTAG LWID_('P','T','A','G') -#define ID_ENVL LWID_('E','N','V','L') -#define ID_CLIP LWID_('C','L','I','P') -#define ID_SURF LWID_('S','U','R','F') -#define ID_DESC LWID_('D','E','S','C') -#define ID_TEXT LWID_('T','E','X','T') -#define ID_ICON LWID_('I','C','O','N') - -/* polygon types */ -#define ID_FACE LWID_('F','A','C','E') -#define ID_CURV LWID_('C','U','R','V') -#define ID_PTCH LWID_('P','T','C','H') -#define ID_MBAL LWID_('M','B','A','L') -#define ID_BONE LWID_('B','O','N','E') - -/* polygon tags */ -#define ID_SURF LWID_('S','U','R','F') -#define ID_PART LWID_('P','A','R','T') -#define ID_SMGP LWID_('S','M','G','P') - -/* envelopes */ -#define ID_PRE LWID_('P','R','E',' ') -#define ID_POST LWID_('P','O','S','T') -#define ID_KEY LWID_('K','E','Y',' ') -#define ID_SPAN LWID_('S','P','A','N') -#define ID_TCB LWID_('T','C','B',' ') -#define ID_HERM LWID_('H','E','R','M') -#define ID_BEZI LWID_('B','E','Z','I') -#define ID_BEZ2 LWID_('B','E','Z','2') -#define ID_LINE LWID_('L','I','N','E') -#define ID_STEP LWID_('S','T','E','P') - -/* clips */ -#define ID_STIL LWID_('S','T','I','L') -#define ID_ISEQ LWID_('I','S','E','Q') -#define ID_ANIM LWID_('A','N','I','M') -#define ID_XREF LWID_('X','R','E','F') -#define ID_STCC LWID_('S','T','C','C') -#define ID_TIME LWID_('T','I','M','E') -#define ID_CONT LWID_('C','O','N','T') -#define ID_BRIT LWID_('B','R','I','T') -#define ID_SATR LWID_('S','A','T','R') -#define ID_HUE LWID_('H','U','E',' ') -#define ID_GAMM LWID_('G','A','M','M') -#define ID_NEGA LWID_('N','E','G','A') -#define ID_IFLT LWID_('I','F','L','T') -#define ID_PFLT LWID_('P','F','L','T') - -/* surfaces */ -#define ID_COLR LWID_('C','O','L','R') -#define ID_LUMI LWID_('L','U','M','I') -#define ID_DIFF LWID_('D','I','F','F') -#define ID_SPEC LWID_('S','P','E','C') -#define ID_GLOS LWID_('G','L','O','S') -#define ID_REFL LWID_('R','E','F','L') -#define ID_RFOP LWID_('R','F','O','P') -#define ID_RIMG LWID_('R','I','M','G') -#define ID_RSAN LWID_('R','S','A','N') -#define ID_TRAN LWID_('T','R','A','N') -#define ID_TROP LWID_('T','R','O','P') -#define ID_TIMG LWID_('T','I','M','G') -#define ID_RIND LWID_('R','I','N','D') -#define ID_TRNL LWID_('T','R','N','L') -#define ID_BUMP LWID_('B','U','M','P') -#define ID_SMAN LWID_('S','M','A','N') -#define ID_SIDE LWID_('S','I','D','E') -#define ID_CLRH LWID_('C','L','R','H') -#define ID_CLRF LWID_('C','L','R','F') -#define ID_ADTR LWID_('A','D','T','R') -#define ID_SHRP LWID_('S','H','R','P') -#define ID_LINE LWID_('L','I','N','E') -#define ID_LSIZ LWID_('L','S','I','Z') -#define ID_ALPH LWID_('A','L','P','H') -#define ID_AVAL LWID_('A','V','A','L') -#define ID_GVAL LWID_('G','V','A','L') -#define ID_BLOK LWID_('B','L','O','K') - -/* texture layer */ -#define ID_TYPE LWID_('T','Y','P','E') -#define ID_CHAN LWID_('C','H','A','N') -#define ID_NAME LWID_('N','A','M','E') -#define ID_ENAB LWID_('E','N','A','B') -#define ID_OPAC LWID_('O','P','A','C') -#define ID_FLAG LWID_('F','L','A','G') -#define ID_PROJ LWID_('P','R','O','J') -#define ID_STCK LWID_('S','T','C','K') -#define ID_TAMP LWID_('T','A','M','P') - -/* texture coordinates */ -#define ID_TMAP LWID_('T','M','A','P') -#define ID_AXIS LWID_('A','X','I','S') -#define ID_CNTR LWID_('C','N','T','R') -#define ID_SIZE LWID_('S','I','Z','E') -#define ID_ROTA LWID_('R','O','T','A') -#define ID_OREF LWID_('O','R','E','F') -#define ID_FALL LWID_('F','A','L','L') -#define ID_CSYS LWID_('C','S','Y','S') - -/* image map */ -#define ID_IMAP LWID_('I','M','A','P') -#define ID_IMAG LWID_('I','M','A','G') -#define ID_WRAP LWID_('W','R','A','P') -#define ID_WRPW LWID_('W','R','P','W') -#define ID_WRPH LWID_('W','R','P','H') -#define ID_VMAP LWID_('V','M','A','P') -#define ID_AAST LWID_('A','A','S','T') -#define ID_PIXB LWID_('P','I','X','B') - -/* procedural */ -#define ID_PROC LWID_('P','R','O','C') -#define ID_COLR LWID_('C','O','L','R') -#define ID_VALU LWID_('V','A','L','U') -#define ID_FUNC LWID_('F','U','N','C') -#define ID_FTPS LWID_('F','T','P','S') -#define ID_ITPS LWID_('I','T','P','S') -#define ID_ETPS LWID_('E','T','P','S') - -/* gradient */ -#define ID_GRAD LWID_('G','R','A','D') -#define ID_GRST LWID_('G','R','S','T') -#define ID_GREN LWID_('G','R','E','N') -#define ID_PNAM LWID_('P','N','A','M') -#define ID_INAM LWID_('I','N','A','M') -#define ID_GRPT LWID_('G','R','P','T') -#define ID_FKEY LWID_('F','K','E','Y') -#define ID_IKEY LWID_('I','K','E','Y') - -/* shader */ -#define ID_SHDR LWID_('S','H','D','R') -#define ID_DATA LWID_('D','A','T','A') - -/* - * VMAPs are identifed by an extensible set of ID codes. Some common - * ones are included here. - */ -#define ID_PICK LWID_('P','I','C','K') -#define ID_WGHT LWID_('W','G','H','T') -#define ID_MNVW LWID_('M','N','V','W') -#define ID_TXUV LWID_('T','X','U','V') -#define ID_MORF LWID_('M','O','R','F') -#define ID_SPOT LWID_('S','P','O','T') -#define ID_RGB LWID_('R','G','B',' ') -#define ID_RGBA LWID_('R','G','B','A') - -/* generic linked list */ - -typedef struct st_lwNode { - struct st_lwNode *next, *prev; - void *data; -} lwNode; - - -/* plug-in reference */ - -typedef struct st_lwPlugin { - struct st_lwPlugin *next, *prev; - char *ord; - char *name; - int flags; - void *data; -} lwPlugin; - - -/* envelopes */ - -typedef struct st_lwKey { - struct st_lwKey *next, *prev; - float value; - float time; - unsigned int shape; /* ID_TCB, ID_BEZ2, etc. */ - float tension; - float continuity; - float bias; - float param[ 4 ]; -} lwKey; - -typedef struct st_lwEnvelope { - struct st_lwEnvelope *next, *prev; - int index; - int type; - char *name; - lwKey *key; /* linked list of keys */ - int nkeys; - int behavior[ 2 ]; /* pre and post (extrapolation) */ - lwPlugin *cfilter; /* linked list of channel filters */ - int ncfilters; -} lwEnvelope; - -#define BEH_RESET 0 -#define BEH_CONSTANT 1 -#define BEH_REPEAT 2 -#define BEH_OSCILLATE 3 -#define BEH_OFFSET 4 -#define BEH_LINEAR 5 - - -/* values that can be enveloped */ - -typedef struct st_lwEParam { - float val; - int eindex; -} lwEParam; - -typedef struct st_lwVParam { - float val[ 3 ]; - int eindex; -} lwVParam; - - -/* clips */ - -typedef struct st_lwClipStill { - char *name; -} lwClipStill; - -typedef struct st_lwClipSeq { - char *prefix; /* filename before sequence digits */ - char *suffix; /* after digits, e.g. extensions */ - int digits; - int flags; - int offset; - int start; - int end; -} lwClipSeq; - -typedef struct st_lwClipAnim { - char *name; - char *server; /* anim loader plug-in */ - void *data; -} lwClipAnim; - -typedef struct st_lwClipXRef { - char *string; - int index; - struct st_Clip *clip; -} lwClipXRef; - -typedef struct st_lwClipCycle { - char *name; - int lo; - int hi; -} lwClipCycle; - -typedef struct st_lwClip { - struct st_lwClip *next, *prev; - int index; - unsigned int type; /* ID_STIL, ID_ISEQ, etc. */ - union { - lwClipStill still; - lwClipSeq seq; - lwClipAnim anim; - lwClipXRef xref; - lwClipCycle cycle; - } source; - float start_time; - float duration; - float frame_rate; - lwEParam contrast; - lwEParam brightness; - lwEParam saturation; - lwEParam hue; - lwEParam gamma; - int negative; - lwPlugin *ifilter; /* linked list of image filters */ - int nifilters; - lwPlugin *pfilter; /* linked list of pixel filters */ - int npfilters; -} lwClip; - - -/* textures */ - -typedef struct st_lwTMap { - lwVParam size; - lwVParam center; - lwVParam rotate; - lwVParam falloff; - int fall_type; - char *ref_object; - int coord_sys; -} lwTMap; - -typedef struct st_lwImageMap { - int cindex; - int projection; - char *vmap_name; - int axis; - int wrapw_type; - int wraph_type; - lwEParam wrapw; - lwEParam wraph; - float aa_strength; - int aas_flags; - int pblend; - lwEParam stck; - lwEParam amplitude; -} lwImageMap; - -#define PROJ_PLANAR 0 -#define PROJ_CYLINDRICAL 1 -#define PROJ_SPHERICAL 2 -#define PROJ_CUBIC 3 -#define PROJ_FRONT 4 - -#define WRAP_NONE 0 -#define WRAP_EDGE 1 -#define WRAP_REPEAT 2 -#define WRAP_MIRROR 3 - -typedef struct st_lwProcedural { - int axis; - float value[ 3 ]; - char *name; - void *data; -} lwProcedural; - -typedef struct st_lwGradKey { - struct st_lwGradKey *next, *prev; - float value; - float rgba[ 4 ]; -} lwGradKey; - -typedef struct st_lwGradient { - char *paramname; - char *itemname; - float start; - float end; - int repeat; - lwGradKey *key; /* array of gradient keys */ - short *ikey; /* array of interpolation codes */ -} lwGradient; - -typedef struct st_lwTexture { - struct st_lwTexture *next, *prev; - char *ord; - unsigned int type; - unsigned int chan; - lwEParam opacity; - short opac_type; - short enabled; - short negative; - short axis; - union { - lwImageMap imap; - lwProcedural proc; - lwGradient grad; - } param; - lwTMap tmap; -} lwTexture; - - -/* values that can be textured */ - -typedef struct st_lwTParam { - float val; - int eindex; - lwTexture *tex; /* linked list of texture layers */ -} lwTParam; - -typedef struct st_lwCParam { - float rgb[ 3 ]; - int eindex; - lwTexture *tex; /* linked list of texture layers */ -} lwCParam; - - -/* surfaces */ -typedef struct st_lwGlow { - short enabled; - short type; - lwEParam intensity; - lwEParam size; -} Glow; - -typedef struct st_lwRMap { - lwTParam val; - int options; - int cindex; - float seam_angle; -} lwRMap; - -typedef struct st_lwLine { - short enabled; - unsigned short flags; - lwEParam size; -} lwLine; - -typedef struct st_lwSurface { - struct st_lwSurface *next, *prev; - char *name; - char *srcname; - lwCParam color; - lwTParam luminosity; - lwTParam diffuse; - lwTParam specularity; - lwTParam glossiness; - lwRMap reflection; - lwRMap transparency; - lwTParam eta; - lwTParam translucency; - lwTParam bump; - float smooth; - int sideflags; - float alpha; - int alpha_mode; - lwEParam color_hilite; - lwEParam color_filter; - lwEParam add_trans; - lwEParam dif_sharp; - lwEParam glow; - lwLine line; - lwPlugin *shader; /* linked list of shaders */ - int nshaders; -} lwSurface; - - -/* vertex maps */ -typedef struct st_lwVMap { - struct st_lwVMap *next, *prev; - char *name; - unsigned int type; - int dim; - int nverts; - int perpoly; - int *vindex; /* array of point indexes */ - int *pindex; /* array of polygon indexes */ - float **val; -} lwVMap; - -typedef struct st_lwVMapPt { - lwVMap *vmap; - int index; /* vindex or pindex element */ -} lwVMapPt; - - -/* points and polygons */ -typedef struct st_lwPoint { - float pos[ 3 ]; - int npols; /* number of polygons sharing the point */ - int *pol; /* array of polygon indexes */ - int nvmaps; - lwVMapPt *vm; /* array of vmap references */ -} lwPoint; - -typedef struct st_lwPolVert { - int index; /* index into the point array */ - float norm[ 3 ]; - int nvmaps; - lwVMapPt *vm; /* array of vmap references */ -} lwPolVert; - -typedef struct st_lwPolygon { - lwSurface *surf; - int part; /* part index */ - int smoothgrp; /* smoothing group */ - int flags; - unsigned int type; - float norm[ 3 ]; - int nverts; - lwPolVert *v; /* array of vertex records */ -} lwPolygon; - -typedef struct st_lwPointList { - int count; - int offset; /* only used during reading */ - lwPoint *pt; /* array of points */ -} lwPointList; - -typedef struct st_lwPolygonList { - int count; - int offset; /* only used during reading */ - int vcount; /* total number of vertices */ - int voffset; /* only used during reading */ - lwPolygon *pol; /* array of polygons */ -} lwPolygonList; - - -/* geometry layers */ - -typedef struct st_lwLayer { - struct st_lwLayer *next, *prev; - char *name; - int index; - int parent; - int flags; - float pivot[ 3 ]; - float bbox[ 6 ]; - lwPointList point; - lwPolygonList polygon; - int nvmaps; - lwVMap *vmap; /* linked list of vmaps */ -} lwLayer; - - -/* tag strings */ - -typedef struct st_lwTagList { - int count; - int offset; /* only used during reading */ - char **tag; /* array of strings */ -} lwTagList; - - -/* an object */ - -typedef struct st_lwObject { - lwLayer *layer; /* linked list of layers */ - lwEnvelope *env; /* linked list of envelopes */ - lwClip *clip; /* linked list of clips */ - lwSurface *surf; /* linked list of surfaces */ - lwTagList taglist; - int nlayers; - int nenvs; - int nclips; - int nsurfs; -} lwObject; - - -/* lwo2.c */ - -void lwFreeLayer( lwLayer *layer ); -void lwFreeObject( lwObject *object ); -lwObject *lwGetObject( char *filename, unsigned int *failID, int *failpos ); - -/* pntspols.c */ - -void lwFreePoints( lwPointList *point ); -void lwFreePolygons( lwPolygonList *plist ); -int lwGetPoints( FILE *fp, int cksize, lwPointList *point ); -void lwGetBoundingBox( lwPointList *point, float bbox[] ); -int lwAllocPolygons( lwPolygonList *plist, int npols, int nverts ); -int lwGetPolygons( FILE *fp, int cksize, lwPolygonList *plist, int ptoffset ); -void lwGetPolyNormals( lwPointList *point, lwPolygonList *polygon ); -int lwGetPointPolygons( lwPointList *point, lwPolygonList *polygon ); -int lwResolvePolySurfaces( lwPolygonList *polygon, lwTagList *tlist, - lwSurface **surf, int *nsurfs ); -void lwGetVertNormals( lwPointList *point, lwPolygonList *polygon ); -void lwFreeTags( lwTagList *tlist ); -int lwGetTags( FILE *fp, int cksize, lwTagList *tlist ); -int lwGetPolygonTags( FILE *fp, int cksize, lwTagList *tlist, - lwPolygonList *plist ); - -/* vmap.c */ - -void lwFreeVMap( lwVMap *vmap ); -lwVMap *lwGetVMap( FILE *fp, int cksize, int ptoffset, int poloffset, - int perpoly ); -int lwGetPointVMaps( lwPointList *point, lwVMap *vmap ); -int lwGetPolyVMaps( lwPolygonList *polygon, lwVMap *vmap ); - -/* clip.c */ - -void lwFreeClip( lwClip *clip ); -lwClip *lwGetClip( FILE *fp, int cksize ); -lwClip *lwFindClip( lwClip *list, int index ); - -/* envelope.c */ - -void lwFreeEnvelope( lwEnvelope *env ); -lwEnvelope *lwGetEnvelope( FILE *fp, int cksize ); -lwEnvelope *lwFindEnvelope( lwEnvelope *list, int index ); -float lwEvalEnvelope( lwEnvelope *env, float time ); - -/* surface.c */ - -void lwFreePlugin( lwPlugin *p ); -void lwFreeTexture( lwTexture *t ); -void lwFreeSurface( lwSurface *surf ); -int lwGetTHeader( FILE *fp, int hsz, lwTexture *tex ); -int lwGetTMap( FILE *fp, int tmapsz, lwTMap *tmap ); -int lwGetImageMap( FILE *fp, int rsz, lwTexture *tex ); -int lwGetProcedural( FILE *fp, int rsz, lwTexture *tex ); -int lwGetGradient( FILE *fp, int rsz, lwTexture *tex ); -lwTexture *lwGetTexture( FILE *fp, int bloksz, unsigned int type ); -lwPlugin *lwGetShader( FILE *fp, int bloksz ); -lwSurface *lwGetSurface( FILE *fp, int cksize ); -lwSurface *lwDefaultSurface( void ); - -/* lwob.c */ - -lwSurface *lwGetSurface5( FILE *fp, int cksize, lwObject *obj ); -int lwGetPolygons5( FILE *fp, int cksize, lwPolygonList *plist, int ptoffset ); -lwObject *lwGetObject5( char *filename, unsigned int *failID, int *failpos ); - -/* list.c */ - -void lwListFree( void *list, void ( *freeNode )( void * )); -void lwListAdd( void **list, void *node ); -void lwListInsert( void **vlist, void *vitem, - int ( *compare )( void *, void * )); - -/* vecmath.c */ - -float dot( float a[], float b[] ); -void cross( float a[], float b[], float c[] ); -void normalize( float v[] ); -#define vecangle( a, b ) ( float ) acos( dot( a, b )) - -/* lwio.c */ - -void set_flen( int i ); -int get_flen( void ); -void *getbytes( FILE *fp, int size ); -void skipbytes( FILE *fp, int n ); -int getI1( FILE *fp ); -short getI2( FILE *fp ); -int getI4( FILE *fp ); -unsigned char getU1( FILE *fp ); -unsigned short getU2( FILE *fp ); -unsigned int getU4( FILE *fp ); -int getVX( FILE *fp ); -float getF4( FILE *fp ); -char *getS0( FILE *fp ); -int sgetI1( unsigned char **bp ); -short sgetI2( unsigned char **bp ); -int sgetI4( unsigned char **bp ); -unsigned char sgetU1( unsigned char **bp ); -unsigned short sgetU2( unsigned char **bp ); -unsigned int sgetU4( unsigned char **bp ); -int sgetVX( unsigned char **bp ); -float sgetF4( unsigned char **bp ); -char *sgetS0( unsigned char **bp ); - -#ifdef _WIN32 - void revbytes( void *bp, int elsize, int elcount ); -#else - #define revbytes( b, s, c ) -#endif - -#endif diff --git a/cs/engine/plugins/lw/Export/motion_lw.cpp b/cs/engine/plugins/lw/Export/motion_lw.cpp deleted file mode 100644 index 4a60e04d8..000000000 --- a/cs/engine/plugins/lw/Export/motion_lw.cpp +++ /dev/null @@ -1,157 +0,0 @@ -#include "stdafx.h" -#include "motion.h" -#include "envelope.h" - -#ifdef _LW_EXPORT -extern "C" LWItemInfo *g_iteminfo; -extern "C" LWChannelInfo *g_chinfo; -extern "C" LWBoneInfo *g_boneinfo; -extern "C" LWEnvelopeFuncs *g_envf; - - -EChannelType GetChannelType(LWChannelID chan){ - const char* chname = g_chinfo->channelName(chan); - if (xr_strcmp(chname,"Position.X")==0) return ctPositionX; - if (xr_strcmp(chname,"Position.Y")==0) return ctPositionY; - if (xr_strcmp(chname,"Position.Z")==0) return ctPositionZ; - if (xr_strcmp(chname,"Rotation.H")==0) return ctRotationH; - if (xr_strcmp(chname,"Rotation.P")==0) return ctRotationP; - if (xr_strcmp(chname,"Rotation.B")==0) return ctRotationB; - return ctUnsupported; -} - -void CSMotion::ParseBoneMotion(LWItemID bone) -{ - LWChanGroupID group, group_goal, group_goal_parent; - LWChannelID chan, chan_goal, chan_goal_parent; - LWItemID goal, goal_parent; - - bone_mots.push_back(st_BoneMotion()); - st_BoneMotion& bm=bone_mots.back(); - - group = g_iteminfo->chanGroup(bone); - chan = g_chinfo->nextChannel( group, NULL ); - bm.SetName (g_iteminfo->name(bone)); - - goal = g_iteminfo->goal(bone); - LPCSTR goal_name= g_iteminfo->name(goal); - - goal_parent = g_iteminfo->parent(goal); - bool bParent = !(goal_parent==LWITEM_NULL); - bool bGoalOrient= !!(g_iteminfo->flags(bone)&LWITEMF_GOAL_ORIENT); - if (bGoalOrient){ - group_goal = g_iteminfo->chanGroup(goal); - chan_goal = g_chinfo->nextChannel( group_goal, NULL ); - // flag - bm.m_Flags.set(st_BoneMotion::flWorldOrient,TRUE); - } - - while (chan){ - EChannelType t = GetChannelType(chan); - if (t!=ctUnsupported){ - if (!bGoalOrient||(bGoalOrient&&((t==ctPositionX)||(t==ctPositionY)||(t==ctPositionZ)))){ - CEnvelope* env = CreateEnvelope(chan); - bm.envs[t]=env; - } - } - chan = g_chinfo->nextChannel(group, chan); - } - // goal orientation - if (bGoalOrient){ - while (chan_goal){ - EChannelType t = GetChannelType(chan_goal); - if (t!=ctUnsupported){ - if ((t==ctRotationH)||(t==ctRotationP)||(t==ctRotationB)){ - // parent (if exist) - if (bParent){ - group_goal_parent = g_iteminfo->chanGroup(goal_parent); - chan_goal_parent = g_chinfo->nextChannel(group_goal_parent, NULL ); - while (chan_goal_parent){ - if (t==GetChannelType(chan_goal_parent)) break; - chan_goal_parent = g_chinfo->nextChannel(group_goal_parent, chan_goal_parent); - } - } - - CEnvelope* env = CreateEnvelope(chan_goal,bParent?&chan_goal_parent:0); - bm.envs[t]=env; - } - } - chan_goal = g_chinfo->nextChannel(group_goal, chan_goal); - } - } -} - -void COMotion::ParseObjectMotion(LWItemID object){ - LWChanGroupID group; - LWChannelID chan; - - group = g_iteminfo->chanGroup(object); - chan = g_chinfo->nextChannel(group, NULL); - - while (chan){ - EChannelType t = GetChannelType(chan); - if (t!=ctUnsupported){ - CEnvelope* env = CreateEnvelope(chan); - envs[t]=env; - } - chan = g_chinfo->nextChannel(group, chan); - } -} - -//====================================================================== -//Use the Animation Envelopes global to get the keys of an LWEnvelope -//and create our own version. -//====================================================================== -CEnvelope* CCustomMotion::CreateEnvelope(LWChannelID chan, LWChannelID* chan_parent){ - LWChanGroupID group, group_parent; - LWEnvelopeID lwenv, lwenv_parent; - LWEnvKeyframeID lwkey, lwkey_parent; - CEnvelope *env; - st_Key *key, *tail = NULL; - double val; - - env = new CEnvelope(); - - group = g_chinfo->channelParent( chan ); - lwenv = g_chinfo->channelEnvelope( chan ); - lwkey = NULL; - - if (chan_parent){ - group_parent = g_chinfo->channelParent( *chan_parent ); - lwenv_parent = g_chinfo->channelEnvelope( *chan_parent ); - lwkey_parent = NULL; - } - - - g_envf->egGet( lwenv, group, LWENVTAG_PREBEHAVE, &env->behavior[0] ); - g_envf->egGet( lwenv, group, LWENVTAG_POSTBEHAVE, &env->behavior[1] ); - - float val_parent=0; - if (chan_parent){ - lwkey_parent = g_envf->nextKey( lwenv_parent, lwkey_parent ); - if (lwkey_parent){ - g_envf->keyGet( lwenv_parent, lwkey_parent, LWKEY_VALUE, &val ); - val_parent= ( float ) val; - } - } - - while ( lwkey = g_envf->nextKey( lwenv, lwkey )) { - key = new st_Key(); - - env->keys.push_back(key); - - g_envf->keyGet( lwenv, lwkey, LWKEY_SHAPE, &key->shape ); - g_envf->keyGet( lwenv, lwkey, LWKEY_VALUE, &val ); key->value = ( float ) val+val_parent; - g_envf->keyGet( lwenv, lwkey, LWKEY_TIME, &val ); key->time = ( float ) val; - g_envf->keyGet( lwenv, lwkey, LWKEY_TENSION, &val ); key->tension = ( float ) val; - g_envf->keyGet( lwenv, lwkey, LWKEY_CONTINUITY, &val ); key->continuity = ( float ) val; - g_envf->keyGet( lwenv, lwkey, LWKEY_BIAS, &val ); key->bias = ( float ) val; - g_envf->keyGet( lwenv, lwkey, LWKEY_PARAM_0, &val ); key->param[ 0 ] = ( float ) val; - g_envf->keyGet( lwenv, lwkey, LWKEY_PARAM_1, &val ); key->param[ 1 ] = ( float ) val; - g_envf->keyGet( lwenv, lwkey, LWKEY_PARAM_2, &val ); key->param[ 2 ] = ( float ) val; - g_envf->keyGet( lwenv, lwkey, LWKEY_PARAM_3, &val ); key->param[ 3 ] = ( float ) val; - } - - return env; -} -#endif diff --git a/cs/engine/plugins/lw/Export/resource.h b/cs/engine/plugins/lw/Export/resource.h deleted file mode 100644 index a02358ca9..000000000 --- a/cs/engine/plugins/lw/Export/resource.h +++ /dev/null @@ -1,27 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by resource.rc -// -#define IDDEBUG 3 -#define IDD_LOG 101 -#define IDI_ICON 103 -#define IDD_VERIFY 104 -#define IDI_XRAY 105 -#define IDC_LIST 1000 -#define IDC_FILE 1001 -#define IDC_LINE 1002 -#define IDC_DESC 1003 -#define IDSTOP 1004 -#define IDCONTINUE 1005 -#define IDC_STACK 1006 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 106 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1007 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/cs/engine/plugins/lw/Export/scenscan/objectdb.cpp b/cs/engine/plugins/lw/Export/scenscan/objectdb.cpp deleted file mode 100644 index 4a0a7d633..000000000 --- a/cs/engine/plugins/lw/Export/scenscan/objectdb.cpp +++ /dev/null @@ -1,478 +0,0 @@ -#include "stdafx.h" -/* -====================================================================== -objectdb.c - -Functions for creating an object database. -====================================================================== */ - -#include "objectdb.h" -#include "vecmat.h" - -#pragma warning (disable:4995) - -/* -====================================================================== -pntScan() - -Point scan callback. Insert the point ID into the point array in -ascending numerical order. This takes only linear time if point IDs -arrive in order. -====================================================================== */ - -static int pntScan( ObjectDB *odb, LWPntID id ) -{ - int j; - - j = odb->npoints; - - if ( j == 0 ) { - odb->pt[ 0 ].id = id; - ++odb->npoints; - return 0; - } - - while ( odb->pt[ j - 1 ].id > id ) { - odb->pt[ j ].id = odb->pt[ j - 1 ].id; - --j; - if ( j == 0 ) break; - } - - odb->pt[ j ].id = id; - ++odb->npoints; - - return 0; -} - - -/* -====================================================================== -polScan() - -Polygon scan callback. Just store the ID. -====================================================================== */ - -static int polScan( ObjectDB *odb, LWPolID id ) -{ - odb->pol[ odb->npolygons ].id = id; - ++odb->npolygons; - return 0; -} - - -/* -====================================================================== -findVert() - -Binary search the point array and return the array index for the given -point ID. -====================================================================== */ - -int findVert( ObjectDB *odb, LWPntID id ) -{ - int lt = 0, rt = odb->npoints - 1, x; - - while ( rt >= lt ) { - x = ( lt + rt ) / 2; - if ( id < odb->pt[ x ].id ) rt = x - 1; else lt = x + 1; - if ( id == odb->pt[ x ].id ) return x; - } - return -1; -} - - -/* -====================================================================== -getPolyNormals() - -Calculate the polygon normals. By convention, LW's polygon normals -are based on the first, second and last points in the vertex list. -The normal is the cross product of two vectors formed from these -points. It's undefined for one- and two-point polygons. -====================================================================== */ - -void getPolyNormals( ObjectDB *odb, int i ) -{ - int j, k; - LWFVector p1, p2, pn, v1, v2; - - for ( j = 0; j < odb->npolygons; j++ ) { - if ( odb->pol[ j ].nverts < 3 ) continue; - for ( k = 0; k < 3; k++ ) { - p1[ k ] = odb->pt[ odb->pol[ j ].v[ 0 ].index ].pos[ i ][ k ]; - p2[ k ] = odb->pt[ odb->pol[ j ].v[ 1 ].index ].pos[ i ][ k ]; - pn[ k ] = odb->pt[ odb->pol[ j ].v[ - odb->pol[ j ].nverts - 1 ].index ].pos[ i ][ k ]; - } - - for ( k = 0; k < 3; k++ ) { - v1[ k ] = p2[ k ] - p1[ k ]; - v2[ k ] = pn[ k ] - p1[ k ]; - } - - cross( v1, v2, odb->pol[ j ].norm[ i ] ); - normalize( odb->pol[ j ].norm[ i ] ); - } -} - - -/* -====================================================================== -getVertNormals() - -Calculate the vertex normals. For each polygon vertex, sum the -normals of the polygons that share the point. If the normals of the -current and adjacent polygons form an angle greater than the max -smoothing angle for the current polygon's surface, the normal of the -adjacent polygon is excluded from the sum. -====================================================================== */ - -void getVertNormals( ObjectDB *odb, int i ) -{ - int j, k, n, g, h, p; - float a; - - for ( j = 0; j < odb->npolygons; j++ ) { - for ( n = 0; n < odb->pol[ j ].nverts; n++ ) { - for ( k = 0; k < 3; k++ ) - odb->pol[ j ].v[ n ].norm[ i ][ k ] - = odb->pol[ j ].norm[ i ][ k ]; - - if ( odb->surf[ odb->pol[ j ].sindex ].sman <= 0 ) continue; - - p = odb->pol[ j ].v[ n ].index; - - for ( g = 0; g < odb->pt[ p ].npols; g++ ) { - h = odb->pt[ p ].pol[ g ]; - if ( h == j ) continue; - - a = vecangle( odb->pol[ j ].norm[ i ], odb->pol[ h ].norm[ i ] ); - if ( a > odb->surf[ odb->pol[ j ].sindex ].sman ) continue; - - for ( k = 0; k < 3; k++ ) - odb->pol[ j ].v[ n ].norm[ i ][ k ] - += odb->pol[ h ].norm[ i ][ k ]; - } - - normalize( odb->pol[ j ].v[ n ].norm[ i ] ); - } - } -} - - -/* -====================================================================== -freeObjectDB() - -Free an ObjectDB created by getObjectDB(). -====================================================================== */ - -void freeObjectDB( ObjectDB *odb ) -{ - int i; - - if ( odb ) { - freeObjectVMaps( odb ); - freeObjectSurfs( odb ); - freePointSearch( odb ); - - if ( odb->pt ) { - for ( i = 0; i < odb->npoints; i++ ) - if ( odb->pt[ i ].pol ) - free( odb->pt[ i ].pol ); - free( odb->pt ); - } - if ( odb->pol ) { - for ( i = 0; i < odb->npolygons; i++ ) - if ( odb->pol[ i ].v ) - free( odb->pol[ i ].v ); - free( odb->pol ); - } - free( odb ); - } -} - - -/* -====================================================================== -getObjectDB() - -Create an ObjectDB for an object. -====================================================================== */ - -ObjectDB *getObjectDB( LWItemID id, GlobalFunc *global ) -{ - LWObjectInfo *objinfo; - LWMeshInfo *mesh; - LWPntID ptid; - ObjectDB *odb; - const char *name; - int npts, npols, nverts, i, j, k, ok = 0; - - - /* get the object info global */ - - objinfo = (st_LWObjectInfo*)global( LWOBJECTINFO_GLOBAL, GFUSE_TRANSIENT ); - if ( !objinfo ) return NULL; - - /* get the mesh info for the object */ - - mesh = objinfo->meshInfo( id, 1 ); - if ( !mesh ) return NULL; - - /* alloc the object database */ - - odb = (st_ObjectDB*)calloc( 1, sizeof( ObjectDB )); - if ( !odb ) goto Finish; - - odb->id = id; - name = objinfo->filename( id ); - odb->filename = (char*)malloc( xr_strlen( name ) + 1 ); - if ( !odb->filename ) goto Finish; - strcpy( odb->filename, name ); - - /* alloc and init the points array */ - - npts = mesh->numPoints( mesh ); - odb->pt = (st_DBPoint*)calloc( npts, sizeof( DBPoint )); - if ( !odb->pt ) goto Finish; - - if ( mesh->scanPoints( mesh, (int (__cdecl *)(void *,struct st_GCoreVertex *))pntScan, odb )) - goto Finish; - - /* alloc and init the polygons array */ - - npols = mesh->numPolygons( mesh ); - odb->pol = (st_DBPolygon*)calloc( npols, sizeof( DBPolygon )); - if ( !odb->pol ) goto Finish; - - if ( mesh->scanPolys( mesh, (int (__cdecl *)(void *,struct st_GCorePolygon *))polScan, odb )) - goto Finish; - - /* get the vertices of each polygon */ - - for ( i = 0; i < npols; i++ ) { - nverts = mesh->polSize( mesh, odb->pol[ i ].id ); - odb->pol[ i ].v = (st_DBPolVert*)calloc( nverts, sizeof( DBPolVert )); - if ( !odb->pol[ i ].v ) goto Finish; - odb->pol[ i ].nverts = nverts; - for ( j = 0; j < nverts; j++ ) { - ptid = mesh->polVertex( mesh, odb->pol[ i ].id, j ); - odb->pol[ i ].v[ j ].index = findVert( odb, ptid ); - } - } - - /* count the number of polygons per point */ - - for ( i = 0; i < npols; i++ ) - for ( j = 0; j < odb->pol[ i ].nverts; j++ ) - ++odb->pt[ odb->pol[ i ].v[ j ].index ].npols; - - /* alloc per-point polygon arrays */ - - for ( i = 0; i < npts; i++ ) { - if ( odb->pt[ i ].npols == 0 ) continue; - odb->pt[ i ].pol = (int*)calloc( odb->pt[ i ].npols, sizeof( int )); - if ( !odb->pt[ i ].pol ) goto Finish; - odb->pt[ i ].npols = 0; - } - - /* fill in polygon array for each point */ - - for ( i = 0; i < npols; i++ ) { - for ( j = 0; j < odb->pol[ i ].nverts; j++ ) { - k = odb->pol[ i ].v[ j ].index; - odb->pt[ k ].pol[ odb->pt[ k ].npols ] = i; - ++odb->pt[ k ].npols; - } - } - - /* get the base position of each point */ - - for ( i = 0; i < npts; i++ ) - mesh->pntBasePos( mesh, odb->pt[ i ].id, odb->pt[ i ].pos[ 0 ] ); - - /* init the point search array */ - /* do this here if you need to search by base pos, or later if you - need to search by final pos */ - - // if ( !initPointSearch( odb, 0 )) - // goto Finish; - - /* calculate the base normal of each polygon */ - - getPolyNormals( odb, 0 ); - - /* get the vmaps */ - - if ( !getObjectVMaps( odb, mesh, global )) - goto Finish; - - /* get the surfaces */ - - if ( !getObjectSurfs( odb, mesh, global )) - goto Finish; - - /* calculate initial vertex normals */ - - getVertNormals( odb, 0 ); - - /* done */ - - ok = 1; - -Finish: - if ( mesh->destroy ) - mesh->destroy( mesh ); - - if ( !ok ) { - freeObjectDB( odb ); - return NULL; - } - - return odb; -} - - -/* -====================================================================== -printObjectDB() - -Print the information in an object database to a file. This is mostly -for debugging and to illustrate how to reference the items in the -database. The c argument is 0 for initial normals and point positions -and 1 for final. -====================================================================== */ - -int printObjectDB( ObjectDB *odb, FILE *fp, int c ) -{ - DBVMap *vmap; - char *tag; - int i, j, k, n; - - fprintf( fp, "%08.8x %s\n\n", odb->id, odb->filename ); - - fprintf( fp, "Points (%d)\n\n", odb->npoints ); - for ( i = 0; i < odb->npoints; i++ ) { - fprintf( fp, "%08.8x pos (%g, %g, %g) npols %d:", - odb->pt[ i ].id, - odb->pt[ i ].pos[ c ][ 0 ], - odb->pt[ i ].pos[ c ][ 1 ], - odb->pt[ i ].pos[ c ][ 2 ], - odb->pt[ i ].npols ); - for ( j = 0; j < odb->pt[ i ].npols; j++ ) - fprintf( fp, " %d", odb->pt[ i ].pol[ j ] ); - fprintf( fp, "\n" ); - - for ( j = 0; j < odb->pt[ i ].nvmaps; j++ ) { - vmap = odb->pt[ i ].vm[ j ].vmap; - switch ( vmap->type ) { - case LWVMAP_PICK: tag = "PICK"; break; - case LWVMAP_WGHT: tag = "WGHT"; break; - case LWVMAP_MNVW: tag = "MNVW"; break; - case LWVMAP_TXUV: tag = "TXUV"; break; - case LWVMAP_MORF: tag = "MORF"; break; - case LWVMAP_SPOT: tag = "SPOT"; break; - default: tag = "Unknown type"; break; - } - fprintf( fp, " %s %s:", tag, vmap->name ); - for ( k = 0; k < vmap->dim; k++ ) { - n = odb->pt[ i ].vm[ j ].index; - fprintf( fp, " %g", vmap->val[ k ][ n ] ); - } - fprintf( fp, "\n" ); - } - } - - /* test the point search */ - - if ( initPointSearch( odb, c )) - for ( i = 0; i < odb->npoints; i++ ) - if ( i != pointSearch( odb, odb->pt[ i ].pos[ c ] )) - fprintf( fp, "Point search failed for point %d.\n", i ); - - fprintf( fp, "\n\nPolygons (%d)\n\n", odb->npolygons ); - for ( i = 0; i < odb->npolygons; i++ ) { - fprintf( fp, "%08.8x surf %d norm (%g, %g, %g) nverts %d:\n", - odb->pol[ i ].id, - odb->pol[ i ].sindex, - odb->pol[ i ].norm[ c ][ 0 ], - odb->pol[ i ].norm[ c ][ 1 ], - odb->pol[ i ].norm[ c ][ 2 ], - odb->pol[ i ].nverts ); - for ( j = 0; j < odb->pol[ i ].nverts; j++ ) { - fprintf( fp, " vert %d vnorm (%g, %g, %g)\n", - odb->pol[ i ].v[ j ].index, - odb->pol[ i ].v[ j ].norm[ c ][ 0 ], - odb->pol[ i ].v[ j ].norm[ c ][ 1 ], - odb->pol[ i ].v[ j ].norm[ c ][ 2 ] ); - } - } - - fprintf( fp, "\n\nSurfaces (%d)\n", odb->nsurfaces ); - for ( i = 0; i < odb->nsurfaces; i++ ) { - fprintf( fp, "\n%08.8X \"%s\"\n", - odb->surf[ i ].id, - odb->surf[ i ].name ); - fprintf( fp, " " SURF_COLR " %g %g %g\n", - odb->surf[ i ].colr[ 0 ], - odb->surf[ i ].colr[ 1 ], - odb->surf[ i ].colr[ 2 ] ); - fprintf( fp, " " SURF_LUMI " %g\n", odb->surf[ i ].lumi ); - fprintf( fp, " " SURF_DIFF " %g\n", odb->surf[ i ].diff ); - fprintf( fp, " " SURF_SPEC " %g\n", odb->surf[ i ].spec ); - fprintf( fp, " " SURF_REFL " %g\n", odb->surf[ i ].refl ); - fprintf( fp, " " SURF_RFOP " 0x%X\n", odb->surf[ i ].rfop ); - fprintf( fp, " " SURF_TRAN " %g\n", odb->surf[ i ].tran ); - fprintf( fp, " " SURF_TROP " 0x%X\n", odb->surf[ i ].trop ); - fprintf( fp, " " SURF_TRNL " %g\n", odb->surf[ i ].trnl ); - fprintf( fp, " " SURF_RIND " %g\n", odb->surf[ i ].rind ); - fprintf( fp, " " SURF_BUMP " %g\n", odb->surf[ i ].bump ); - fprintf( fp, " " SURF_GLOS " %g\n", odb->surf[ i ].glos ); - fprintf( fp, " " SURF_SHRP " %g\n", odb->surf[ i ].shrp ); - fprintf( fp, " " SURF_SMAN " %g\n", odb->surf[ i ].sman ); - fprintf( fp, " " SURF_RSAN " %g\n", odb->surf[ i ].rsan ); - fprintf( fp, " " SURF_TSAN " %g\n", odb->surf[ i ].tsan ); - fprintf( fp, " " SURF_CLRF " %g\n", odb->surf[ i ].clrf ); - fprintf( fp, " " SURF_CLRH " %g\n", odb->surf[ i ].clrh ); - fprintf( fp, " " SURF_ADTR " %g\n", odb->surf[ i ].adtr ); - fprintf( fp, " " SURF_ALPH " 0x%X\n", odb->surf[ i ].alph ); - fprintf( fp, " " SURF_AVAL " %g\n", odb->surf[ i ].aval ); - fprintf( fp, " " SURF_GLOW " 0x%X\n", odb->surf[ i ].glow ); - fprintf( fp, " " SURF_GVAL " %g\n", odb->surf[ i ].gval ); - fprintf( fp, " " SURF_LINE " 0x%X\n", odb->surf[ i ].line ); - fprintf( fp, " " SURF_LSIZ " %g\n", odb->surf[ i ].lsiz ); - fprintf( fp, " " SURF_LCOL " %g %g %g\n", - odb->surf[ i ].lcol[ 0 ], - odb->surf[ i ].lcol[ 1 ], - odb->surf[ i ].lcol[ 2 ] ); - fprintf( fp, " " SURF_SIDE " 0x%X\n", odb->surf[ i ].side ); - fprintf( fp, " " SURF_RIMG " %08.8X\n", odb->surf[ i ].rimg ); - fprintf( fp, " " SURF_TIMG " %08.8X\n", odb->surf[ i ].timg ); - } - - fprintf( fp, "\n\nVertex Maps (%d)\n\n", odb->nvertmaps ); - for ( i = 0; i < odb->nvertmaps; i++ ) { - tag = ( char * ) &odb->vmap[ i ].type; - fprintf( fp, "%c%c%c%c \"%s\" dim %d nverts %d\n", -#ifdef _WIN32 - tag[ 3 ], tag[ 2 ], tag[ 1 ], tag[ 0 ], -#else - tag[ 0 ], tag[ 1 ], tag[ 2 ], tag[ 3 ], -#endif - odb->vmap[ i ].name, - odb->vmap[ i ].dim, - odb->vmap[ i ].nverts ); - for ( j = 0; j < odb->vmap[ i ].nverts; j++ ) { - fprintf( fp, " %d ", odb->vmap[ i ].vindex[ j ] ); - for ( k = 0; k < odb->vmap[ i ].dim; k++ ) - fprintf( fp, " %g", odb->vmap[ i ].val[ k ][ j ] ); - fprintf( fp, "\n" ); - } - } - - return 1; -} - - -#pragma warning (default:4995) \ No newline at end of file diff --git a/cs/engine/plugins/lw/Export/scenscan/objectdb.h b/cs/engine/plugins/lw/Export/scenscan/objectdb.h deleted file mode 100644 index 4b03c5305..000000000 --- a/cs/engine/plugins/lw/Export/scenscan/objectdb.h +++ /dev/null @@ -1,138 +0,0 @@ -/* -====================================================================== -objectdb.h - -Typedefs and function prototypes for an object database. -====================================================================== */ - -#ifndef OBJECTDB_H -#define OBJECTDB_H - -#include -#include -#include -#include - - -typedef struct st_DBVMapVal { - char *name; // name - LWID type; // type of data (e.g. UVs, weights) - int dim; // dimension (number of values per point) - int nverts; // number of vertices - int *vindex; // array of vertex indexes - int *vdpol; // -1 - point map 0..n-polymap(polygon number) - float **val; // 2D array of vmap values -} DBVMap; - -typedef struct st_DBVMapPt { - DBVMap *vmap; // where the values are stored - int index; // offset into the vmap value arrays -} DBVMapPt; - -typedef struct st_DBPoint { - LWPntID id; // Layout point ID - LWFVector pos[ 2 ]; // initial and final position - int npols; // number of polygons sharing the point - int *pol; // array of polygon indexes - int nvmaps; // number of vmap values - DBVMapPt *vm; // array of vmap values -} DBPoint; - -typedef struct st_DBPolVert { - int index; // index into the point array - LWFVector norm[ 2 ]; // initial and final normals - int nvmaps; - DBVMapPt *vm; // array of vmap references -} DBPolVert; - -typedef struct st_DBPolygon { - LWPolID id; // Layout polygon ID - int sindex; // surface index - LWFVector norm[ 2 ]; // initial and final normals - int nverts; // number of vertices - DBPolVert *v; // vertex array -} DBPolygon; - -typedef struct st_lwPlugin { - struct st_lwPlugin *next, *prev; - char *ord; - char *name; - int flags; - void *data; -} lwPlugin; - -typedef struct st_DBSurface { - LWSurfaceID id; // surface ID - char *name; // surface name - char textures[8][64]; // textures - int tex_cnt; - float colr[ 3 ]; // color - float lumi; // luminosity - float diff; // diffuse level - float spec; // specularity - float refl; // reflectivity - float tran; // transparency - float trnl; // translucency - float rind; // index of refraction - float bump; // bump - float glos; // glossiness - float shrp; // diffuse sharpness - float sman; // max smoothing angle (radians) - float rsan; // reflection seam angle - float tsan; // refraction seam angle - float clrf; // color filter - float clrh; // color highlight - float adtr; // additive transparency - float aval; // alpha value - float gval; // glow value - float lcol[ 3 ]; // line color - float lsiz; // line size - int alph; // alpha options - int rfop; // reflection options - int trop; // refraction options - int side; // sidedness - int glow; // glow - int line; // render outlines - LWImageID rimg; // reflection image - LWImageID timg; // refraction image - lwPlugin *shader; // linked list of shaders - int nshaders; -} DBSurface; - -typedef struct st_ObjectDB { - char *filename; // object filename - LWItemID id; // Layout item ID - int npoints; // number of points - int npolygons; // number of polygons - int nsurfaces; // number of surfaces - int nvertmaps; // number of vertex maps - DBPoint *pt; // point array - int *vsort; // point indexes sorted by point position - int vsortkey; // coordinate for position sort - DBPolygon *pol; // polygon array - DBSurface *surf; // surface array - DBVMap *vmap; // vmap array -} ObjectDB; - - -int findVert( ObjectDB *odb, LWPntID id ); - -void getPolyNormals( ObjectDB *odb, int i ); -void getVertNormals( ObjectDB *odb, int i ); - -void freeObjectDB( ObjectDB *odb ); -ObjectDB *getObjectDB( LWItemID id, GlobalFunc *global ); -int printObjectDB( ObjectDB *odb, FILE *fp, int c ); - -void freeObjectVMaps( ObjectDB *odb ); -int getObjectVMaps( ObjectDB *odb, LWMeshInfo *mesh, GlobalFunc *global ); - -void freeObjectSurfs( ObjectDB *odb ); -int getObjectSurfs( ObjectDB *odb, LWMeshInfo *mesh, GlobalFunc *global ); - -int initPointSearch( ObjectDB *odb, int ipos ); -void freePointSearch( ObjectDB *odb ); -int pointSearch( ObjectDB *odb, float pos[ 3 ] ); - - -#endif diff --git a/cs/engine/plugins/lw/Export/scenscan/ptsearch.cpp b/cs/engine/plugins/lw/Export/scenscan/ptsearch.cpp deleted file mode 100644 index 56c7e31c9..000000000 --- a/cs/engine/plugins/lw/Export/scenscan/ptsearch.cpp +++ /dev/null @@ -1,210 +0,0 @@ -#include "stdafx.h" -/* -====================================================================== -ptsearch.c - -Functions for searching an ObjectDB point array by coordinate value. - -This is useful when you need to be able to quickly find a point in the -object database by matching a position. An auxiliary array of point -indexes is created in initPointSearch() that sorts the point list by -one of the position coordinates. We can then binary search on that -coordinate to find the point. - -This is probably overkill for small objects, but the time required for -a simple linear search of the points grows as the square of the number -of points. -====================================================================== */ -#include "objectdb.h" - -#define KEY (odb->vsortkey % 3) -#define IPOS (odb->vsortkey / 3) -#define ARRAY( i ) odb->vsort[ i ] - -#undef ARRAYSIZE -#define ARRAYSIZE odb->npoints -#define COORD( p, c ) odb->pt[ odb->vsort[ p ]].pos[ ipos ][ c ] -#define SORTVAL( p ) COORD( p, key ) - -#pragma warning (disable:4995) - - - -/* -====================================================================== -vsortq() - -Quicksort the point array. This stops sorting when the partition size -falls below SUBARRAYSIZE, beyond which it's somewhat more efficient to -let a different kind of sort finish the job. -====================================================================== */ - -#define SUBARRAYSIZE 10 -#define PUSH( i ) stack[ ++tos ] = i -#define POP( i ) i = stack[ tos-- ] -#define STACKEMPTY tos < 0 -#define SWAP( i, j ) t = i; i = j; j = t - -static void vsortq( ObjectDB *odb ) -{ - static int stack[ 200 ]; - int i, j, lt, rt, tos = -1, t, key = KEY, ipos = IPOS; - float v; - - lt = 0; - rt = ARRAYSIZE - 1; - - for ( ;; ) { - while ( rt - lt > SUBARRAYSIZE ) { - v = SORTVAL( rt ); i = lt - 1; j = rt; - for ( ;; ) { - while ( SORTVAL( ++i ) < v ) ; - while ( j && SORTVAL( --j ) > v ) ; - if ( i > j ) break; - SWAP( ARRAY( i ), ARRAY( j )); - } - SWAP( ARRAY( i ), ARRAY( rt )); - if ( i - lt > rt - i ) - { PUSH( lt ); PUSH( i - 1 ); lt = i + 1; } - else - { PUSH( i + 1 ); PUSH( rt ); rt = i - 1; } - } - if ( STACKEMPTY ) break; - POP( rt ); - POP( lt ); - } -} - - -/* -====================================================================== -vsorti() - -Insertion sort the point array. Because the array was preconditioned -by a quicksort, it's almost sorted already, a best case for insertion. -====================================================================== */ - -static void vsorti( ObjectDB *odb ) -{ - int i, j, t, key = KEY, ipos = IPOS; - float v; - - for ( i = 1; i < ARRAYSIZE; i++ ) { - t = ARRAY( i ); - v = SORTVAL( i ); - j = i; - while ( j && SORTVAL( j - 1 ) > v ) { - ARRAY( j ) = ARRAY( j - 1 ); - --j; - } - ARRAY( j ) = t; - } -} - - -/* -====================================================================== -initPointSearch() - -Decides which of the three position coordinates to sort on, allocates -the auxiliary array of point indexes, and calls the sort routines. - -We find the mean and deviation of each of the three axes and choose to -sort on the coordinate with the largest deviation. This should reduce -the amount of hunting around required in the search due to duplicate -coordinate values. - -The second argument is 0 to sort on initial positions and 1 to sort on -final positions. -====================================================================== */ - -int initPointSearch( ObjectDB *odb, int ipos ) -{ - float m[ 3 ] = { 0.0f }, sd[ 3 ] = { 0.0f }; - int i, j; - - if ( odb->npoints <= 0 ) return 1; - - for ( i = 0; i < odb->npoints; i++ ) - for ( j = 0; j < 3; j++ ) - m[ j ] += odb->pt[ i ].pos[ ipos ][ j ]; - - for ( j = 0; j < 3; j++ ) - m[ j ] /= odb->npoints; - - for ( i = 0; i < odb->npoints; i++ ) - for ( j = 0; j < 3; j++ ) - sd[ j ] += odb->pt[ i ].pos[ ipos ][ j ] - m[ j ]; - - odb->vsortkey = sd[ 0 ] > sd[ 1 ] ? - ( sd[ 0 ] > sd[ 2 ] ? 0 : 2 ) : - ( sd[ 1 ] > sd[ 2 ] ? 1 : 2 ); - odb->vsortkey += 3 * ipos; - - odb->vsort = (int*)calloc( odb->npoints, sizeof( int )); - if ( !odb->vsort ) return 0; - - for ( i = 0; i < odb->npoints; i++ ) - odb->vsort[ i ] = i; - - vsortq( odb ); - vsorti( odb ); - - return 1; -} - - -/* -====================================================================== -freePointSearch() - -Free memory allocated by initPointSearch(). -====================================================================== */ - -void freePointSearch( ObjectDB *odb ) -{ - if ( odb ) { - if ( odb->vsort ) { - free( odb->vsort ); - odb->vsort = NULL; - } - } -} - - -/* -====================================================================== -pointSearch() - -Find the point with a given position. Binary search gets us in the -neighborhood. We then find the subarray of points with equal values -in the odb->vsortkey coordinate and linear search that subarray for a -complete match with pos[]. Returns the point index if a match is -found, otherwise returns -1. - -If more than one point has the position, this returns the first point -index in the vsort[] array. -====================================================================== */ - -int pointSearch( ObjectDB *odb, float pos[ 3 ] ) -{ - int lt = 0, rt = ARRAYSIZE - 1, x, key = KEY, ipos = IPOS; - - while ( rt >= lt ) { - x = ( lt + rt ) / 2; - if ( pos[ key ] < SORTVAL( x )) rt = x - 1; else lt = x + 1; - if ( pos[ key ] == SORTVAL( x )) { - lt = rt = x; - while ( lt > 0 && pos[ key ] == SORTVAL( lt - 1 )) --lt; - while ( rt < ARRAYSIZE - 1 && pos[ key ] == SORTVAL( rt + 1 )) ++rt; - for ( x = lt; x <= rt; x++ ) - if ( pos[ 0 ] == COORD( x, 0 ) && - pos[ 1 ] == COORD( x, 1 ) && - pos[ 2 ] == COORD( x, 2 )) return ARRAY( x ); - return -1; - } - } - return -1; -} - -#pragma warning (default:4995) \ No newline at end of file diff --git a/cs/engine/plugins/lw/Export/scenscan/scenscan.h b/cs/engine/plugins/lw/Export/scenscan/scenscan.h deleted file mode 100644 index ec17070ab..000000000 --- a/cs/engine/plugins/lw/Export/scenscan/scenscan.h +++ /dev/null @@ -1,24 +0,0 @@ -/* -====================================================================== -scenscan.h - -Typedefs and function prototypes for a scene database. -====================================================================== */ - -#include -#include - -typedef struct st_DBVMapRec { - char *name; - LWID type; - int dim; -} DBVMapRec; - -typedef struct st_VertMapDB { - int nvmaps; - DBVMapRec *vmap; -} VertMapDB; - - -void freeVertMapDB( VertMapDB *vmdb ); -VertMapDB *getVertMapDB( GlobalFunc *global ); diff --git a/cs/engine/plugins/lw/Export/scenscan/surface.cpp b/cs/engine/plugins/lw/Export/scenscan/surface.cpp deleted file mode 100644 index 70fb5a2d9..000000000 --- a/cs/engine/plugins/lw/Export/scenscan/surface.cpp +++ /dev/null @@ -1,224 +0,0 @@ -#include "stdafx.h" -/* -====================================================================== -surface.c - - Functions for examining surfaces. -====================================================================== */ -#include "scenscan.h" -#include "objectdb.h" -#include - -#pragma warning (disable:4995) - -extern "C" LWMessageFuncs *g_msg; -/* -====================================================================== -findSurf() - - Linear search the surface array and return the array index with the - matching surface name. -====================================================================== */ - -static int findSurf( ObjectDB *odb, const char *tag ) -{ - int i; - - for ( i = 0; i < odb->nsurfaces; i++ ) - if ( !strcmp( tag, odb->surf[ i ].name )) - return i; - - return -1; -} - - -/* -====================================================================== -freeObjectSurfs() - - Free memory allocated by getObjectSurfs(). -====================================================================== */ - -void freeObjectSurfs( ObjectDB *odb ) -{ - int i; - - if ( odb ) { - if ( odb->surf ) { - for ( i = 0; i < odb->nsurfaces; i++ ) - if ( odb->surf[ i ].name ) - free( odb->surf[ i ].name ); - free( odb->surf ); - odb->surf = 0; - odb->nsurfaces = 0; - } - } -} - - -/* -====================================================================== -getObjectSurfs() - - Allocate and fill in structures describing the surfaces applied to the - object. Updates the ObjectDB and returns 1 if successful. Backs out - of any changes to the ObjectDB and returns 0 if an error occurs. - - Currently this isn't very sophisticated. We just get the values. The - SDK also allows us to get the envelopes and textures for most of these - parameters (anything with an E or a T button in the Surface Editor), - so we could do much more here. Given a channel's LWTextureID, for - example, we could use the Texture Functions global to get each texture - layer's parameters, including the image maps. -====================================================================== */ - -int getObjectSurfs( ObjectDB *odb, LWMeshInfo *mesh, GlobalFunc *global ) -{ - LWSurfaceFuncs *surff; - LWSurfaceID *surfid; - LWTextureFuncs *txfunc; - LWImageList *imglist; - double *dval; - int i; - const char* tag; - - - imglist = (st_LWImageList*)global( LWIMAGELIST_GLOBAL, GFUSE_TRANSIENT ); - if ( !imglist ) return 0; - txfunc = (st_LWTextureFuncs*)global( LWTEXTUREFUNCS_GLOBAL, GFUSE_TRANSIENT ); /* get the surface ID array */ - if ( !txfunc ) return 0; - surff = (st_LWSurfaceFuncs*)global( LWSURFACEFUNCS_GLOBAL, GFUSE_TRANSIENT ); - if ( !surff ) return 0; - surfid = surff->byObject( odb->filename ); - if ( !surfid ) return 0; - - /* count the surface IDs and alloc the surface array */ - - for ( odb->nsurfaces = 0; ; odb->nsurfaces++ ) - if ( !surfid[ odb->nsurfaces ] ) break; - odb->surf = (st_DBSurface*)calloc( odb->nsurfaces, sizeof( DBSurface )); - if ( !odb->surf ) { - odb->nsurfaces = 0; - return 0; - } - - /* fill in the surface parameters */ - - for ( i = 0; i < odb->nsurfaces; i++ ) { - odb->surf[ i ].id = surfid[ i ]; - tag = surff->name( surfid[ i ] ); - odb->surf[ i ].name = (char*)malloc( xr_strlen( tag ) + 1 ); - if ( !odb->surf[ i ].name ) { - freeObjectSurfs( odb ); - return 0; - } - strcpy( odb->surf[ i ].name, tag ); - - LWTextureID tid = surff->getTex(surfid[i],SURF_COLR); - if (!tid){ - g_msg->error("Empty texture in surface:",odb->surf[ i ].name); - freeObjectSurfs( odb ); - return 0; - } - for (LWTLayerID tlid=txfunc->firstLayer(tid); tlid; tlid=txfunc->nextLayer(tid,tlid)){ - DWORD imid; - int res = txfunc->getParam(tlid,TXTAG_IMAGE,&imid); - tag = imglist->name((LWImageID)imid); - if (!tag){ - g_msg->error("Invalid texture name.",0); - return 0; - } - strcpy(odb->surf[i].textures[odb->surf[i].tex_cnt],tag); - odb->surf[i].tex_cnt++; - } - - - dval = surff->getFlt( surfid[ i ], SURF_COLR ); - odb->surf[ i ].colr[ 0 ] = ( float ) dval[ 0 ]; - odb->surf[ i ].colr[ 1 ] = ( float ) dval[ 1 ]; - odb->surf[ i ].colr[ 2 ] = ( float ) dval[ 2 ]; - - dval = surff->getFlt( surfid[ i ], SURF_LUMI ); - odb->surf[ i ].lumi = ( float ) *dval; - - dval = surff->getFlt( surfid[ i ], SURF_DIFF ); - odb->surf[ i ].diff = ( float ) *dval; - - dval = surff->getFlt( surfid[ i ], SURF_SPEC ); - odb->surf[ i ].spec = ( float ) *dval; - - dval = surff->getFlt( surfid[ i ], SURF_REFL ); - odb->surf[ i ].refl = ( float ) *dval; - - dval = surff->getFlt( surfid[ i ], SURF_TRAN ); - odb->surf[ i ].tran = ( float ) *dval; - - dval = surff->getFlt( surfid[ i ], SURF_TRNL ); - odb->surf[ i ].trnl = ( float ) *dval; - - dval = surff->getFlt( surfid[ i ], SURF_RIND ); - odb->surf[ i ].rind = ( float ) *dval; - - dval = surff->getFlt( surfid[ i ], SURF_BUMP ); - odb->surf[ i ].bump = ( float ) *dval; - - dval = surff->getFlt( surfid[ i ], SURF_GLOS ); - odb->surf[ i ].glos = ( float ) *dval; - - dval = surff->getFlt( surfid[ i ], SURF_SHRP ); - odb->surf[ i ].shrp = ( float ) *dval; - - dval = surff->getFlt( surfid[ i ], SURF_SMAN ); - odb->surf[ i ].sman = ( float ) *dval; - - dval = surff->getFlt( surfid[ i ], SURF_RSAN ); - odb->surf[ i ].rsan = ( float ) *dval; - - dval = surff->getFlt( surfid[ i ], SURF_TSAN ); - odb->surf[ i ].tsan = ( float ) *dval; - - dval = surff->getFlt( surfid[ i ], SURF_CLRF ); - odb->surf[ i ].clrf = ( float ) *dval; - - dval = surff->getFlt( surfid[ i ], SURF_CLRH ); - odb->surf[ i ].clrh = ( float ) *dval; - - dval = surff->getFlt( surfid[ i ], SURF_ADTR ); - odb->surf[ i ].adtr = ( float ) *dval; - - dval = surff->getFlt( surfid[ i ], SURF_AVAL ); - odb->surf[ i ].aval = ( float ) *dval; - - dval = surff->getFlt( surfid[ i ], SURF_GVAL ); - odb->surf[ i ].gval = ( float ) *dval; - - dval = surff->getFlt( surfid[ i ], SURF_LSIZ ); - odb->surf[ i ].lsiz = ( float ) *dval; - - dval = surff->getFlt( surfid[ i ], SURF_LCOL ); - odb->surf[ i ].lcol[ 0 ] = ( float ) dval[ 0 ]; - odb->surf[ i ].lcol[ 1 ] = ( float ) dval[ 1 ]; - odb->surf[ i ].lcol[ 2 ] = ( float ) dval[ 2 ]; - - odb->surf[ i ].alph = surff->getInt( surfid[ i ], SURF_ALPH ); - odb->surf[ i ].rfop = surff->getInt( surfid[ i ], SURF_RFOP ); - odb->surf[ i ].trop = surff->getInt( surfid[ i ], SURF_TROP ); - odb->surf[ i ].side = surff->getInt( surfid[ i ], SURF_SIDE ); - odb->surf[ i ].glow = surff->getInt( surfid[ i ], SURF_GLOW ); - odb->surf[ i ].line = surff->getInt( surfid[ i ], SURF_LINE ); - - odb->surf[ i ].rimg = surff->getImg( surfid[ i ], SURF_RIMG ); - odb->surf[ i ].timg = surff->getImg( surfid[ i ], SURF_TIMG ); - } - - /* find surface index for each polygon */ - - for ( i = 0; i < odb->npolygons; i++ ) { - tag = mesh->polTag( mesh, odb->pol[ i ].id, LWPTAG_SURF ); - odb->pol[ i ].sindex = findSurf( odb, tag ); - } - - return 1; -} - -#pragma warning (default:4995) diff --git a/cs/engine/plugins/lw/Export/scenscan/vecmat.cpp b/cs/engine/plugins/lw/Export/scenscan/vecmat.cpp deleted file mode 100644 index 431767001..000000000 --- a/cs/engine/plugins/lw/Export/scenscan/vecmat.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include "stdafx.h" -/* -====================================================================== -vecmat.c - -Basic vector and matrix functions. -====================================================================== */ -#include "vecmat.h" - -#pragma warning (disable:4995) - -float dot( LWFVector a, LWFVector b ) -{ - return a[ 0 ] * b[ 0 ] + a[ 1 ] * b[ 1 ] + a[ 2 ] * b[ 2 ]; -} - - -void cross( LWFVector a, LWFVector b, LWFVector c ) -{ - c[ 0 ] = a[ 1 ] * b[ 2 ] - a[ 2 ] * b[ 1 ]; - c[ 1 ] = a[ 2 ] * b[ 0 ] - a[ 0 ] * b[ 2 ]; - c[ 2 ] = a[ 0 ] * b[ 1 ] - a[ 1 ] * b[ 0 ]; -} - - -void normalize( LWFVector v ) -{ - float r; - - r = ( float ) sqrt( dot( v, v )); - if ( r > 0 ) { - v[ 0 ] /= r; - v[ 1 ] /= r; - v[ 2 ] /= r; - } -} - -#pragma warning (default:4995) diff --git a/cs/engine/plugins/lw/Export/scenscan/vecmat.h b/cs/engine/plugins/lw/Export/scenscan/vecmat.h deleted file mode 100644 index ab5a1840c..000000000 --- a/cs/engine/plugins/lw/Export/scenscan/vecmat.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef _VECMAT_H_ -#define _VECMAT_H_ - - -/*====================================================================== -vecmat.h - -Basic vector and matrix functions. -====================================================================== */ - -#include - -#define vecangle(a,b) (float)acos(dot(a,b)) /* a and b must be unit vectors */ - -float dot( LWFVector a, LWFVector b ); -void cross( LWFVector a, LWFVector b, LWFVector c ); -void normalize( LWFVector v ); - -#endif //_VECMAT_H_/* diff --git a/cs/engine/plugins/lw/Export/scenscan/vmap.cpp b/cs/engine/plugins/lw/Export/scenscan/vmap.cpp deleted file mode 100644 index a2c88417d..000000000 --- a/cs/engine/plugins/lw/Export/scenscan/vmap.cpp +++ /dev/null @@ -1,376 +0,0 @@ -#include "stdafx.h" -/* -====================================================================== -vmap.c - - Functions for examining vertex maps. -====================================================================== */ -#include "scenscan.h" -#include "objectdb.h" - -#pragma warning (disable:4995) - -/* -====================================================================== -freeVertMapDB() - - Frees the VertMapDB created by getVertMapDB(). -====================================================================== */ - -void freeVertMapDB( VertMapDB *vmdb ) -{ - int i; - - if ( vmdb ) { - for ( i = 0; i < vmdb->nvmaps; i++ ) - if ( vmdb->vmap[ i ].name ) - free( vmdb->vmap[ i ].name ); - if ( vmdb->vmap ) - free( vmdb->vmap ); - free( vmdb ); - } -} - - -/* -====================================================================== -getVertMapDB() - - Fills a structure describing the vertex maps in a scene. This is used - by getObjectVMaps(), but it can be useful for other purposes. -====================================================================== */ - -VertMapDB *getVertMapDB( GlobalFunc *global ) -{ - VertMapDB *vmdb; - LWObjectFuncs *objf; - const char *name; - int j, nvmaps; - - - objf = (st_LWObjectFuncs*)global( LWOBJECTFUNCS_GLOBAL, GFUSE_TRANSIENT ); - if ( !objf ) return NULL; - - /* count vmaps of all types */ - - nvmaps = objf->numVMaps( 0 ); - - if ( !nvmaps ) return NULL; - - /* allocate the VertMapDB */ - - vmdb = (st_VertMapDB*)calloc( 1, sizeof( VertMapDB )); - if ( !vmdb ) return NULL; - vmdb->nvmaps = nvmaps; - - /* allocate the vmap array */ - - vmdb->vmap = (st_DBVMapRec*)calloc( nvmaps, sizeof( DBVMapRec )); - if ( !vmdb->vmap ) { - free( vmdb ); - return NULL; - } - - /* fill in the vmap array */ - - for ( j = 0; j < nvmaps; j++ ) { - vmdb->vmap[ j ].type = objf->vmapType( j ); - vmdb->vmap[ j ].dim = objf->vmapDim( 0, j ); - name = objf->vmapName( 0, j ); - vmdb->vmap[ j ].name = (char*)malloc( xr_strlen( name ) + 1 ); - if ( !vmdb->vmap[ j ].name ) { - freeVertMapDB( vmdb ); - return NULL; - } - strcpy( vmdb->vmap[ j ].name, name ); - } - - return vmdb; -} - - -/* -====================================================================== -freeObjectVMaps() - - Free memory allocated by getObjectVMaps(). -====================================================================== */ - -void freeObjectVMaps( ObjectDB *odb ) -{ - int i, j; - - if ( odb ) { - if ( odb->vmap ) { - for ( i = 0; i < odb->nvertmaps; i++ ) { - if ( odb->vmap[ i ].name ) free( odb->vmap[ i ].name ); - if ( odb->vmap[i].vindex ) free( odb->vmap[ i ].vindex ); - if ( odb->vmap[i].vdpol ) free( odb->vmap[ i ].vdpol ); - if ( odb->vmap[ i ].val ) { - for ( j = 0; j < odb->vmap[ i ].dim; j++ ) - if ( odb->vmap[ i ].val[ j ] ) - free( odb->vmap[ i ].val[ j ] ); - free( odb->vmap[ i ].val ); - } - } - free( odb->vmap ); - odb->vmap = NULL; - odb->nvertmaps = 0; - } - // vmap - for ( i = 0; i < odb->npoints; i++ ) { - odb->pt[ i ].nvmaps = 0; - if ( odb->pt[ i ].vm ) { - free( odb->pt[ i ].vm ); - odb->pt[ i ].vm = NULL; - } - } - // vmad - for ( int p = 0; p < odb->npolygons; p++ ) { - st_DBPolygon& P = odb->pol[p]; - for ( j=0; jnvmaps, sizeof( int )); - if ( !npts ) goto Finish; - - /* count the object's vmaps and the number of points for each vmap */ - - for ( i = 0, nvmaps = 0; i < vmdb->nvmaps; i++ ) { - vmid = mesh->pntVLookup( mesh, vmdb->vmap[ i ].type, vmdb->vmap[ i ].name ); - - if ( vmid ) { - dim = mesh->pntVSelect( mesh, vmid ); - if ( dim > 0 ) { - val = (float*)calloc( dim, sizeof( float )); - if ( !val ) goto Finish; - }else - val = NULL; - - // vmap - for ( j = 0; j < odb->npoints; j++ ) { - ismapped = mesh->pntVGet( mesh, odb->pt[ j ].id, val ); - if ( ismapped ) ++npts[ i ]; - } - - //vmad - for ( j = 0; j < odb->npolygons; j++ ) { - st_DBPolygon& P = odb->pol[j]; - for ( k =0; kpntVPGet( mesh, odb->pt[P.v[k].index].id, P.id, val ); - if ( ismapped ) ++npts[ i ]; - } - } - - if ( npts[ i ] ) ++nvmaps; - free( val ); - } - } - - /* no vmaps for this object? */ - - if ( nvmaps == 0 ) { - ok = 1; - goto Finish; - } - - /* allocate the vmap array */ - - odb->nvertmaps = nvmaps; - odb->vmap = (st_DBVMapVal*)calloc( nvmaps, sizeof( DBVMap )); - if ( !odb->vmap ) goto Finish; - - for ( i = 0; i < nvmaps; i++ ) { - - /* initialize the vmap info */ - - odb->vmap[ i ].name = (char*)malloc( xr_strlen( vmdb->vmap[ i ].name ) + 1 ); - if ( !odb->vmap[ i ].name ) goto Finish; - strcpy( odb->vmap[ i ].name, vmdb->vmap[ i ].name ); - odb->vmap[ i ].type = vmdb->vmap[ i ].type; - odb->vmap[ i ].dim = vmdb->vmap[ i ].dim; - odb->vmap[ i ].nverts = npts[ i ]; - - /* allocate the point index array */ - odb->vmap[ i ].vindex = (int*)calloc( npts[ i ], sizeof( int )); - if ( !odb->vmap[ i ].vindex ) goto Finish; - - odb->vmap[ i ].vdpol = (int*)calloc( npts[ i ], sizeof(int)); - if ( !odb->vmap[ i ].vdpol ) goto Finish; - - /* allocate the value arrays */ - - if ( vmdb->vmap[ i ].dim > 0 ) { - odb->vmap[ i ].val = (float**)calloc( vmdb->vmap[ i ].dim, sizeof( float * )); - if ( !odb->vmap[ i ].val ) goto Finish; - for ( k = 0; k < vmdb->vmap[ i ].dim; k++ ) { - odb->vmap[ i ].val[ k ] = (float*)calloc( npts[ i ], sizeof( float )); - if ( !odb->vmap[ i ].val[ k ] ) goto Finish; - } - } - - /* fill in the point index and value arrays */ - - vmid = mesh->pntVLookup( mesh, vmdb->vmap[ i ].type, vmdb->vmap[ i ].name ); - if ( vmid ) { - dim = mesh->pntVSelect( mesh, vmid ); - if ( dim > 0 ) { - val = (float*)calloc( dim, sizeof( float )); - if ( !val ) goto Finish; - } - else - val = NULL; - - // vmap - for ( j = 0, n = 0; j < odb->npoints; j++ ) { - ismapped = mesh->pntVGet( mesh, odb->pt[ j ].id, val ); - if ( ismapped ) { - odb->vmap[ i ].vindex[ n ] = j; - odb->vmap[ i ].vdpol[ n ] = -1; - for ( k = 0; k < dim; k++ ) - odb->vmap[ i ].val[ k ][ n ] = val[ k ]; - ++n; - } - } - - // vmad - for ( p = 0; p < odb->npolygons; p++ ) { - st_DBPolygon& P = odb->pol[p]; - for ( j=0; jpntVPGet( mesh, odb->pt[P.v[j].index].id, P.id, val ); - if ( ismapped ){ - odb->vmap[ i ].vindex[ n ] = P.v[j].index; - odb->vmap[ i ].vdpol[ n ] = p; - for ( k = 0; k < dim; k++ ) - odb->vmap[ i ].val[ k ][ n ] = val[ k ]; - ++n; - } - } - } - - free( val ); - } - } - - /* count the number of vmap values for each point */ - - for ( i = 0; i < nvmaps; i++ ){ - for ( j = 0; j < odb->vmap[ i ].nverts; j++ ){ - int pt_idx = odb->vmap[i].vindex[j]; - int vd_pol = odb->vmap[i].vdpol[j]; - st_DBPoint& pt = odb->pt[pt_idx]; - if (vd_pol<=-1) ++pt.nvmaps; - else{ - st_DBPolygon& P = odb->pol[vd_pol]; - for (int pv_i=0; pv_inpoints; i++ ) { - odb->pt[ i ].vm = (st_DBVMapPt*)calloc( odb->pt[ i ].nvmaps, sizeof( DBVMapPt )); - if ( !odb->pt[ i ].vm ) goto Finish; - odb->pt[ i ].nvmaps = 0; - } - /* allocate vmap references for each mapped polypoint */ - for ( p = 0; p < odb->npolygons; p++ ) { - st_DBPolygon& P = odb->pol[p]; - for ( j=0; jvmap[ i ].nverts; j++ ) { - int pt_idx = odb->vmap[i].vindex[j]; - int vd_pol = odb->vmap[i].vdpol[j]; - - if (vd_pol<=-1){ - int vm_cnt = odb->pt[pt_idx].nvmaps; - odb->pt[pt_idx].vm[vm_cnt].vmap = &odb->vmap[ i ]; - odb->pt[pt_idx].vm[vm_cnt].index = j; - ++odb->pt[pt_idx].nvmaps; - }else{ - st_DBPolygon& P = odb->pol[vd_pol]; - for (int pv_i=0; pv_ivmap[i]; - pol_vert.vm[vm_cnt].index = j; - ++pol_vert.nvmaps; - break; - } - } - } - } - } - - // success - - ok = 1; - -Finish: - freeVertMapDB( vmdb ); - if ( npts ) free( npts ); - if ( !ok ) - freeObjectVMaps( odb ); - - return ok; -} - -#pragma warning (default:4995) diff --git a/cs/engine/plugins/lw/Export/stdafx.cpp b/cs/engine/plugins/lw/Export/stdafx.cpp deleted file mode 100644 index 6ffc703a8..000000000 --- a/cs/engine/plugins/lw/Export/stdafx.cpp +++ /dev/null @@ -1,5 +0,0 @@ -// stdafx.cpp : source file that includes just the standard includes -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - \ No newline at end of file diff --git a/cs/engine/plugins/lw/Export/stdafx.h b/cs/engine/plugins/lw/Export/stdafx.h deleted file mode 100644 index afd37bbef..000000000 --- a/cs/engine/plugins/lw/Export/stdafx.h +++ /dev/null @@ -1,49 +0,0 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently - -#ifndef StdafxH -#define StdafxH - -#pragma once - -#include "../../../xrCore/xrCore.h" - -#define ENGINE_API - -enum TMsgDlgType { mtWarning, mtError, mtInformation, mtConfirmation, mtCustom }; -enum TMsgDlgBtn { mbYes, mbNo, mbOK, mbCancel, mbAbort, mbRetry, mbIgnore, mbAll, mbNoToAll, mbYesToAll, mbHelp }; -typedef TMsgDlgBtn TMsgDlgButtons[mbHelp]; - - -#define ECORE_API - -#include "..\..\Shared\ELog.h" -#include -#include - -#include - -#define AnsiString std::string - -using AStringVec = xr_vector; -using AStringIt = AStringVec::iterator; - -#define THROW R_ASSERT(0) - -#ifdef _LW_SHADER - #define _EDITOR_FILE_NAME_ "lw_shader" -#else - #ifdef _LW_EXPORT - #define _EDITOR_FILE_NAME_ "lw_export" - #else - #ifdef _LW_IMPORT - #define _EDITOR_FILE_NAME_ "lw_import" - #endif - #endif -#endif - -#define GAMEMTL_NONE u32(-1) -#define _game_data_ "$game_data$" - -#endif // StdafxH diff --git a/cs/engine/plugins/lw/LW_Export70.vcxproj b/cs/engine/plugins/lw/LW_Export70.vcxproj deleted file mode 100644 index bea2e7274..000000000 --- a/cs/engine/plugins/lw/LW_Export70.vcxproj +++ /dev/null @@ -1,339 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - LW_Export_70 - {F573DE85-0866-4775-955F-6C3241D2AE70} - 8.1 - - - - DynamicLibrary - v140 - false - MultiByte - - - DynamicLibrary - v140 - false - MultiByte - - - - - - - - - - - - - - - - - false - .p - - - true - .p - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - Win32 - .\Release\envelope.tlb - - - OnlyExplicitInline - $(SolutionDir)sdk/3d_sdk/lw/ver-7.0/include;$(SolutionDir)engine;$(SolutionDir)engine\plugins\shared\;%(AdditionalIncludeDirectories) - NDEBUG;_X86_;_WIN32;WIN32;_WINDOWS;_USRDLL;_LW_PLUGIN;_LW_EXPORT;XRCORE_STATIC;%(PreprocessorDefinitions) - true - - MultiThreadedDLL - true - Fast - false - true - Use - stdafx.h - $(IntDir)$(ProjectName).pch - $(IntDir) - $(IntDir) - $(IntDir) - false - Level3 - true - - - NDEBUG;%(PreprocessorDefinitions) - 0x0419 - - - odbc32.lib;odbccp32.lib;lw_server.lib;lwo.lib;xrcorestatic.lib;%(AdditionalDependencies) - $(OutDir)$(TargetName)$(TargetExt) - true - $(SolutionDir)libraries\$(Configuration);$(DXSDK_DIR)Lib\x86;%(AdditionalLibraryDirectories) - Server\serv.def - - - - - - _DEBUG;%(PreprocessorDefinitions) - true - true - Win32 - .\Debug\envelope.tlb - - - Disabled - $(SolutionDir)sdk/3d_sdk/lw/ver-7.0/include;$(SolutionDir)engine;$(SolutionDir)engine\plugins\shared\;%(AdditionalIncludeDirectories) - DEBUG;_X86_;_WIN32;WIN32;_WINDOWS;_USRDLL;_LW_PLUGIN;_LW_EXPORT;XRCORE_STATIC;%(PreprocessorDefinitions) - true - Sync - EnableFastChecks - MultiThreadedDLL - Fast - false - true - Use - stdafx.h - $(IntDir)$(ProjectName).pch - false - - Level3 - true - EditAndContinue - Cdecl - - - _DEBUG;%(PreprocessorDefinitions) - 0x0419 - - - odbc32.lib;odbccp32.lib;lw_server.lib;xrcorestatic.lib;%(AdditionalDependencies) - $(OutDir)$(TargetName)$(TargetExt) - true - $(SolutionDir)libraries\$(Configuration);$(DXSDK_DIR)Lib\x86;%(AdditionalLibraryDirectories) - Server\serv.def - true - $(OutDir)xray_export.pdb - - - - - $(IntDir)%(Filename)1.obj - $(IntDir)%(Filename)1.xdc - - - $(IntDir)%(Filename)1.obj - $(IntDir)%(Filename)1.xdc - - - $(IntDir)%(Filename)1.obj - $(IntDir)%(Filename)1.xdc - - - $(IntDir)%(Filename)1.obj - $(IntDir)%(Filename)1.xdc - - - $(IntDir)%(Filename)1.obj - $(IntDir)%(Filename)1.xdc - - - $(IntDir)%(Filename)1.obj - $(IntDir)%(Filename)1.xdc - - - $(IntDir)%(Filename)1.obj - $(IntDir)%(Filename)1.xdc - - - $(IntDir)%(Filename)1.obj - $(IntDir)%(Filename)1.xdc - - - - - false - - - - - - - false - - - $(IntDir)%(Filename)1.obj - $(IntDir)%(Filename)1.xdc - - - - - false - - - - - - - false - - - - - - - false - - - - - - - false - - - - - - - false - - - - - - - false - - - - - - - false - - - - - - - $(IntDir)%(Filename)1.obj - false - $(IntDir)%(Filename)1.xdc - - - $(IntDir)%(Filename)1.obj - $(IntDir)%(Filename)1.xdc - - - - - false - - - - - - - $(IntDir)%(Filename)1.obj - false - $(IntDir)%(Filename)1.xdc - - - $(IntDir)%(Filename)1.obj - $(IntDir)%(Filename)1.xdc - - - - $(IntDir)%(Filename)1.obj - $(IntDir)%(Filename)1.xdc - - - - - - - - false - - - - - - - - - - - - - - Create - Create - - - - - $(IntDir)%(Filename)1.obj - false - $(IntDir)%(Filename)1.xdc - - - - - - - - - - - - - - - - - - - - - - - - {a6ebbbbb-5fef-4c20-8460-dfab11734ded} - false - - - {e8cf1ada-264a-4127-86c2-fd7057d3792c} - - - {f1066eac-ee25-4c7a-9023-5957a6f7ba27} - - - {6ba3121a-acbc-4685-9246-4549ca1efffd} - false - - - - - - \ No newline at end of file diff --git a/cs/engine/plugins/lw/LW_Export70.vcxproj.filters b/cs/engine/plugins/lw/LW_Export70.vcxproj.filters deleted file mode 100644 index 59ea07d18..000000000 --- a/cs/engine/plugins/lw/LW_Export70.vcxproj.filters +++ /dev/null @@ -1,123 +0,0 @@ -п»ї - - - - {637f1d3b-4bd6-456a-b56c-11202c193d19} - - - {8f06cf48-99fa-4211-b8f2-a276f40257ed} - - - {e828b844-474d-4989-a1fe-4704b208afd9} - - - {8d712ae8-3462-4deb-a492-07fdeba68d98} - - - {a4636918-8df5-42e2-9517-96f8b3be19f7} - - - {c74c4adc-37e4-4c3c-a79b-b6d456186c05} - - - {a0d3ba96-ba14-4d4e-a480-f483c8e8aac9} - - - {7aeb6cb0-e6e2-467c-9d34-14242071c74b} - - - - - Kernel - - - Shared Files\Server - - - Export - - - Export - - - Export - - - Export - - - Export - - - Export - - - Export\SceneScan - - - Export\SceneScan - - - Export\SceneScan - - - Export\SceneScan - - - Export\SceneScan - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Kernel - - - Export - - - Export - - - Export\SceneScan - - - Export\SceneScan - - - Export\SceneScan - - - - - - - - - - - - \ No newline at end of file diff --git a/cs/engine/plugins/lw/LW_Export75.vcxproj b/cs/engine/plugins/lw/LW_Export75.vcxproj deleted file mode 100644 index 0e521a2dd..000000000 --- a/cs/engine/plugins/lw/LW_Export75.vcxproj +++ /dev/null @@ -1,335 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - LW_Export_75 - {F573DE85-0866-4775-955F-6C3241D2AE75} - 8.1 - - - - DynamicLibrary - v140 - false - MultiByte - - - DynamicLibrary - v140 - false - MultiByte - - - - - - - - - - - - - - - - - false - .p - - - true - .p - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - Win32 - .\Release\envelope.tlb - - - OnlyExplicitInline - $(SolutionDir)sdk/3d_sdk/lw/ver-7.5/include;$(SolutionDir)engine;$(SolutionDir)engine\plugins\shared\;%(AdditionalIncludeDirectories) - NDEBUG;_X86_;_WIN32;WIN32;_WINDOWS;_USRDLL;_LW_PLUGIN;_LW_EXPORT;XRCORE_STATIC;%(PreprocessorDefinitions) - true - - MultiThreadedDLL - true - Fast - false - true - Use - stdafx.h - $(IntDir)$(ProjectName).pch - $(IntDir) - $(IntDir) - $(IntDir) - false - Level3 - true - - - NDEBUG;%(PreprocessorDefinitions) - 0x0419 - - - odbc32.lib;odbccp32.lib;lw_server.lib;lwo.lib;xrcorestatic.lib;%(AdditionalDependencies) - $(OutDir)$(TargetName)$(TargetExt) - true - $(SolutionDir)libraries\$(Configuration);$(DXSDK_DIR)Lib\x86;%(AdditionalLibraryDirectories) - Server\serv.def - - - - - - _DEBUG;%(PreprocessorDefinitions) - true - true - Win32 - .\Debug\envelope.tlb - - - Disabled - $(SolutionDir)sdk/3d_sdk/lw/ver-7.5/include;$(SolutionDir)engine;$(SolutionDir)engine\plugins\shared\;%(AdditionalIncludeDirectories) - DEBUG;_X86_;_WIN32;WIN32;_WINDOWS;_USRDLL;_LW_PLUGIN;_LW_EXPORT;XRCORE_STATIC;%(PreprocessorDefinitions) - true - Sync - EnableFastChecks - MultiThreadedDLL - Fast - false - true - Use - stdafx.h - $(IntDir)$(ProjectName).pch - false - - Level3 - true - EditAndContinue - Cdecl - - - _DEBUG;%(PreprocessorDefinitions) - 0x0419 - - - odbc32.lib;odbccp32.lib;lw_server.lib;xrcorestatic.lib;%(AdditionalDependencies) - $(OutDir)$(TargetName)$(TargetExt) - true - $(SolutionDir)libraries\$(Configuration);$(DXSDK_DIR)Lib\x86;%(AdditionalLibraryDirectories) - Server\serv.def - true - $(OutDir)xray_export.pdb - - - - - $(IntDir)%(Filename)1.obj - $(IntDir)%(Filename)1.xdc - - - $(IntDir)%(Filename)1.obj - $(IntDir)%(Filename)1.xdc - - - $(IntDir)%(Filename)1.obj - $(IntDir)%(Filename)1.xdc - - - $(IntDir)%(Filename)1.obj - $(IntDir)%(Filename)1.xdc - - - $(IntDir)%(Filename)1.obj - $(IntDir)%(Filename)1.xdc - - - $(IntDir)%(Filename)1.obj - $(IntDir)%(Filename)1.xdc - - - $(IntDir)%(Filename)1.obj - $(IntDir)%(Filename)1.xdc - - - $(IntDir)%(Filename)1.obj - $(IntDir)%(Filename)1.xdc - - - - - false - - - - - - - false - - - $(IntDir)%(Filename)1.obj - $(IntDir)%(Filename)1.xdc - - - - - false - - - - - - - false - - - - - - - false - - - - - - - false - - - - - - - false - - - - - - - false - - - - - - - false - - - - - - - $(IntDir)%(Filename)1.obj - false - $(IntDir)%(Filename)1.xdc - - - $(IntDir)%(Filename)1.obj - $(IntDir)%(Filename)1.xdc - - - - - false - - - - - - - $(IntDir)%(Filename)1.obj - false - $(IntDir)%(Filename)1.xdc - - - $(IntDir)%(Filename)1.obj - $(IntDir)%(Filename)1.xdc - - - - $(IntDir)%(Filename)1.obj - $(IntDir)%(Filename)1.xdc - - - - - - - - false - - - - - - - - - - - - - - Create - Create - - - - - $(IntDir)%(Filename)1.obj - false - $(IntDir)%(Filename)1.xdc - - - - - - - - - - - - - - - - - - - - - - - - {a6ebbbbb-5fef-4c20-8460-dfab11734ded} - false - - - {e8cf1ada-264a-4127-86c2-fd7057d3792c} - - - {f1066eac-ee25-4c7a-9023-5957a6f7ba27} - - - - - - \ No newline at end of file diff --git a/cs/engine/plugins/lw/LW_Export75.vcxproj.filters b/cs/engine/plugins/lw/LW_Export75.vcxproj.filters deleted file mode 100644 index 3d687a9f3..000000000 --- a/cs/engine/plugins/lw/LW_Export75.vcxproj.filters +++ /dev/null @@ -1,123 +0,0 @@ -п»ї - - - - {e2133679-7415-4d91-9efa-6c23187a87ed} - - - {b9635ca2-c9c5-45f9-8fce-c3915e2a2b07} - - - {24be9a28-c5cf-45d7-a0fb-3529b647e670} - - - {6cb6bbd2-d657-4991-adc4-b52b91051816} - - - {a9f262a0-1dbd-452a-8960-bc91ccca445c} - - - {3ceb019f-5b81-481a-a895-d0878d1ac5d1} - - - {91f5c4bd-ed7c-4e39-9c72-caf2608762b8} - - - {0620d8a9-016f-446d-a77c-9812116b1a03} - - - - - Kernel - - - Shared Files\Server - - - Export - - - Export - - - Export - - - Export - - - Export - - - Export - - - Export\SceneScan - - - Export\SceneScan - - - Export\SceneScan - - - Export\SceneScan - - - Export\SceneScan - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Kernel - - - Export - - - Export - - - Export\SceneScan - - - Export\SceneScan - - - Export\SceneScan - - - - - - - - - - - - \ No newline at end of file diff --git a/cs/engine/plugins/lw/LW_Export80.vcxproj b/cs/engine/plugins/lw/LW_Export80.vcxproj deleted file mode 100644 index 307e6e61e..000000000 --- a/cs/engine/plugins/lw/LW_Export80.vcxproj +++ /dev/null @@ -1,335 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - LW_Export_80 - {F573DE85-0866-4775-955F-6C3241D2AE80} - 8.1 - - - - DynamicLibrary - v140 - false - MultiByte - - - DynamicLibrary - v140 - false - MultiByte - - - - - - - - - - - - - - - - - false - .p - - - true - .p - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - Win32 - .\Release\envelope.tlb - - - OnlyExplicitInline - $(SolutionDir)sdk/3d_sdk/lw/ver-8.0/include;$(SolutionDir)engine;$(SolutionDir)sdk/3d_sdk/lw/ver-8.0/include/lwsdk; $(SolutionDir)engine\plugins\shared\;%(AdditionalIncludeDirectories) - NDEBUG;_X86_;_WIN32;WIN32;_WINDOWS;_USRDLL;_LW_PLUGIN;_LW_EXPORT;XRCORE_STATIC;%(PreprocessorDefinitions) - true - - MultiThreadedDLL - true - Fast - false - true - Use - stdafx.h - $(IntDir)$(ProjectName).pch - $(IntDir) - $(IntDir) - $(IntDir) - false - Level3 - true - - - NDEBUG;%(PreprocessorDefinitions) - 0x0419 - - - odbc32.lib;odbccp32.lib;lw_server.lib;lwo.lib;xrcorestatic.lib;%(AdditionalDependencies) - $(OutDir)$(TargetName)$(TargetExt) - true - $(SolutionDir)libraries\$(Configuration);$(DXSDK_DIR)Lib\x86;%(AdditionalLibraryDirectories) - Server\serv.def - - - - - - _DEBUG;%(PreprocessorDefinitions) - true - true - Win32 - .\Debug\envelope.tlb - - - Disabled - $(SolutionDir)sdk/3d_sdk/lw/ver-8.0/include;$(SolutionDir)engine;$(SolutionDir)sdk/3d_sdk/lw/ver-8.0/include/lwsdk; $(SolutionDir)engine\plugins\shared\;%(AdditionalIncludeDirectories) - DEBUG;_X86_;_WIN32;WIN32;_WINDOWS;_USRDLL;_LW_PLUGIN;_LW_EXPORT;XRCORE_STATIC;%(PreprocessorDefinitions) - true - Sync - EnableFastChecks - MultiThreadedDLL - Fast - false - true - Use - stdafx.h - $(IntDir)$(ProjectName).pch - false - - Level3 - true - EditAndContinue - Cdecl - - - _DEBUG;%(PreprocessorDefinitions) - 0x0419 - - - odbc32.lib;odbccp32.lib;lw_server.lib;xrcorestatic.lib;%(AdditionalDependencies) - $(OutDir)$(TargetName)$(TargetExt) - true - $(SolutionDir)libraries\$(Configuration);$(DXSDK_DIR)Lib\x86;%(AdditionalLibraryDirectories) - Server\serv.def - true - $(OutDir)xray_export.pdb - - - - - $(IntDir)%(Filename)1.obj - $(IntDir)%(Filename)1.xdc - - - $(IntDir)%(Filename)1.obj - $(IntDir)%(Filename)1.xdc - - - $(IntDir)%(Filename)1.obj - $(IntDir)%(Filename)1.xdc - - - $(IntDir)%(Filename)1.obj - $(IntDir)%(Filename)1.xdc - - - $(IntDir)%(Filename)1.obj - $(IntDir)%(Filename)1.xdc - - - $(IntDir)%(Filename)1.obj - $(IntDir)%(Filename)1.xdc - - - $(IntDir)%(Filename)1.obj - $(IntDir)%(Filename)1.xdc - - - $(IntDir)%(Filename)1.obj - $(IntDir)%(Filename)1.xdc - - - - - false - - - - - - - false - - - $(IntDir)%(Filename)1.obj - $(IntDir)%(Filename)1.xdc - - - - - false - - - - - - - false - - - - - - - false - - - - - - - false - - - - - - - false - - - - - - - false - - - - - - - false - - - - - - - $(IntDir)%(Filename)1.obj - false - $(IntDir)%(Filename)1.xdc - - - $(IntDir)%(Filename)1.obj - $(IntDir)%(Filename)1.xdc - - - - - false - - - - - - - $(IntDir)%(Filename)1.obj - false - $(IntDir)%(Filename)1.xdc - - - $(IntDir)%(Filename)1.obj - $(IntDir)%(Filename)1.xdc - - - - $(IntDir)%(Filename)1.obj - $(IntDir)%(Filename)1.xdc - - - - - - - - false - - - - - - - - - - - - - - Create - Create - - - - - $(IntDir)%(Filename).obj - false - $(IntDir)%(Filename).xdc - - - - - - - - - - - - - - - - - - - - - - - - {a6ebbbbb-5fef-4c20-8460-dfab11734ded} - false - - - {e8cf1ada-264a-4127-86c2-fd7057d3792c} - - - {f1066eac-ee25-4c7a-9023-5957a6f7ba27} - - - - - - \ No newline at end of file diff --git a/cs/engine/plugins/lw/LW_Export80.vcxproj.filters b/cs/engine/plugins/lw/LW_Export80.vcxproj.filters deleted file mode 100644 index 23f01edf7..000000000 --- a/cs/engine/plugins/lw/LW_Export80.vcxproj.filters +++ /dev/null @@ -1,123 +0,0 @@ -п»ї - - - - {a9b5b7e1-3ba5-4891-83bb-88354915eba0} - - - {9040a5ca-9ffe-4d39-965a-f302661dd045} - - - {2cf5946e-8ad4-4ac7-ab22-79277134547b} - - - {1a8977c5-bc6f-456c-bc96-9815757d462e} - - - {1bb14150-7b75-4028-9b09-2f0a1b909ad1} - - - {318993c0-b7e8-48bf-b06f-22d71f4d85b9} - - - {0d434888-1b64-4bf5-b173-55b24ecfe6f0} - - - {2f389cd2-23b3-4b39-ae92-6bb855d53f47} - - - - - Kernel - - - Shared Files\Server - - - Export - - - Export - - - Export - - - Export - - - Export - - - Export - - - Export\SceneScan - - - Export\SceneScan - - - Export\SceneScan - - - Export\SceneScan - - - Export\SceneScan - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Kernel - - - Export - - - Export - - - Export\SceneScan - - - Export\SceneScan - - - Export\SceneScan - - - - - - - - - - - - \ No newline at end of file diff --git a/cs/engine/plugins/lw/LW_Server.vcxproj b/cs/engine/plugins/lw/LW_Server.vcxproj deleted file mode 100644 index c37965dac..000000000 --- a/cs/engine/plugins/lw/LW_Server.vcxproj +++ /dev/null @@ -1,113 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {6BA3121A-ACBC-4685-9246-4549CA1EFFFD} - 8.1 - - - - StaticLibrary - v140 - false - MultiByte - - - StaticLibrary - v140 - false - MultiByte - - - - - - - - - - - - - - - - - - MaxSpeed - OnlyExplicitInline - $(SolutionDir)sdk/3d_sdk/lw/ver-7.0/include;$(SolutionDir)engine;%(AdditionalIncludeDirectories) - _X86_;_WIN32;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - true - - MultiThreadedDLL - true - Fast - false - - - Level3 - true - - - NDEBUG;%(PreprocessorDefinitions) - 0x0419 - - - $(OutDir)$(TargetName)$(TargetExt) - true - false - - - - - Disabled - $(SolutionDir)sdk/3d_sdk/lw/ver-7.0/include;$(SolutionDir)engine;%(AdditionalIncludeDirectories) - _X86_;_WIN32;WIN32;_LIB;%(PreprocessorDefinitions) - true - Sync - EnableFastChecks - MultiThreadedDLL - Fast - false - - - Level3 - true - EditAndContinue - - - _DEBUG;%(PreprocessorDefinitions) - 0x0419 - - - $(OutDir)$(TargetName)$(TargetExt) - true - - - - - - $(IntDir)%(Filename)1.obj - $(IntDir)%(Filename)1.xdc - $(IntDir)%(Filename)1.obj - $(IntDir)%(Filename)1.xdc - - - - - - - - - \ No newline at end of file diff --git a/cs/engine/plugins/lw/LW_Server.vcxproj.filters b/cs/engine/plugins/lw/LW_Server.vcxproj.filters deleted file mode 100644 index c51d9e28f..000000000 --- a/cs/engine/plugins/lw/LW_Server.vcxproj.filters +++ /dev/null @@ -1,30 +0,0 @@ -п»ї - - - - {9d9c3d41-cbaa-402a-a3ad-6f77a6f43a10} - cpp;c;cxx;rc;def;r;odl;idl;hpj;bat - - - {38eda6f1-43ac-4efc-9eb4-f51e67344a30} - h;hpp;hxx;hm;inl - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - \ No newline at end of file diff --git a/cs/engine/plugins/lw/LW_Shader70.vcxproj b/cs/engine/plugins/lw/LW_Shader70.vcxproj deleted file mode 100644 index c1a6d0b36..000000000 --- a/cs/engine/plugins/lw/LW_Shader70.vcxproj +++ /dev/null @@ -1,186 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - LW_Shader_70 - {39EE310B-4F1D-4716-A39F-4AB844DB3670} - 8.1 - - - - DynamicLibrary - v140 - false - MultiByte - - - DynamicLibrary - v140 - false - MultiByte - - - - - - - - - - - - - - - - - false - .p - - - true - .p - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - Win32 - .\Release\shader.tlb - - - OnlyExplicitInline - $(SolutionDir)sdk/3d_sdk/lw/ver-7.0/include;$(SolutionDir)engine;$(SolutionDir)engine\plugins\shared\;%(AdditionalIncludeDirectories) - NDEBUG;_X86_;_WIN32;WIN32;_WINDOWS;_USRDLL;_LW_PLUGIN;_LW_SHADER;XRCORE_STATIC;%(PreprocessorDefinitions) - true - - MultiThreadedDLL - true - Precise - true - Use - stdafx.h - $(IntDir)$(ProjectName).pch - - Level3 - true - Cdecl - - - NDEBUG;%(PreprocessorDefinitions) - 0x0419 - - - odbc32.lib;odbccp32.lib;lw_server.lib;xrcorestatic.lib;%(AdditionalDependencies) - $(OutDir)$(TargetName)$(TargetExt) - true - $(SolutionDir)libraries\$(Configuration);$(DXSDK_DIR)Lib\x86;%(AdditionalLibraryDirectories) - Server\serv.def - - - - - - _DEBUG;%(PreprocessorDefinitions) - true - true - Win32 - .\Debug\shader.tlb - - - Disabled - $(SolutionDir)sdk/3d_sdk/lw/ver-7.0/include;$(SolutionDir)engine;$(SolutionDir)engine\plugins\shared\;%(AdditionalIncludeDirectories) - DEBUG;_X86_;WIN32;_WINDOWS;_USRDLL;_EXPORT;_LW_SHADER;XRCORE_STATIC;%(PreprocessorDefinitions) - true - true - Sync - EnableFastChecks - true - MultiThreadedDLL - Fast - false - true - Use - stdafx.h - $(IntDir)$(ProjectName).pch - - Level3 - true - EditAndContinue - Cdecl - - - _DEBUG;%(PreprocessorDefinitions) - 0x0419 - - - odbc32.lib;odbccp32.lib;lw_server.lib;xrcorestatic.lib;%(AdditionalDependencies) - $(OutDir)$(TargetName)$(TargetExt) - true - $(SolutionDir)libraries\$(Configuration);$(DXSDK_DIR)Lib\x86;%(AdditionalLibraryDirectories) - Server\serv.def - true - $(OutDir)xray_shader.pdb - - - - - - - - - - - - - - - - - - - - - - - - - Create - Create - - - - - - - - - - - - - - {e8cf1ada-264a-4127-86c2-fd7057d3792c} - - - {f1066eac-ee25-4c7a-9023-5957a6f7ba27} - - - {6ba3121a-acbc-4685-9246-4549ca1efffd} - false - - - - - - \ No newline at end of file diff --git a/cs/engine/plugins/lw/LW_Shader70.vcxproj.filters b/cs/engine/plugins/lw/LW_Shader70.vcxproj.filters deleted file mode 100644 index 6e1acee48..000000000 --- a/cs/engine/plugins/lw/LW_Shader70.vcxproj.filters +++ /dev/null @@ -1,58 +0,0 @@ -п»ї - - - - {e2277bf9-d321-4fa1-ac22-b16c904ba99a} - - - {5cc37b34-6888-4ab8-a52f-86cb402a4cc5} - - - {3d71d969-1ca2-4e7e-8eb9-6a43af0df0e9} - - - {753f35b7-8623-4b72-a4dd-944a3a0a73e0} - - - {bc33a66e-76bf-4ab8-b0a1-486123737a98} - - - {843f5786-e9c7-4f1d-8d4e-01dc9b292d63} - - - {7a81769e-49fb-42f3-9818-a88759a22f39} - - - - - Kernel - - - Shared Files\Editor - - - Shared Files\Server - - - Shader - - - - - - - - Kernel - - - Shared Files\Editor - - - Shader - - - - - - - \ No newline at end of file diff --git a/cs/engine/plugins/lw/LW_Shader75.vcxproj b/cs/engine/plugins/lw/LW_Shader75.vcxproj deleted file mode 100644 index 02c3ca45f..000000000 --- a/cs/engine/plugins/lw/LW_Shader75.vcxproj +++ /dev/null @@ -1,185 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - LW_Shader_75 - {39EE310B-4F1D-4716-A39F-4AB844DB3675} - 8.1 - - - - DynamicLibrary - v140 - false - MultiByte - - - DynamicLibrary - v140 - false - MultiByte - - - - - - - - - - - - - - - - - false - .p - - - true - .p - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - Win32 - .\Release\shader.tlb - - - OnlyExplicitInline - $(SolutionDir)sdk/3d_sdk/lw/ver-7.5/include;$(SolutionDir)engine;$(SolutionDir)engine\plugins\shared\;%(AdditionalIncludeDirectories) - NDEBUG;_X86_;_WIN32;WIN32;_WINDOWS;_USRDLL;_LW_PLUGIN;_LW_SHADER;XRCORE_STATIC;%(PreprocessorDefinitions) - true - - MultiThreadedDLL - true - Precise - true - Use - stdafx.h - $(IntDir)$(ProjectName).pch - - Level3 - true - Cdecl - - - NDEBUG;%(PreprocessorDefinitions) - 0x0419 - - - odbc32.lib;odbccp32.lib;lw_server.lib;xrcorestatic.lib;%(AdditionalDependencies) - $(OutDir)$(TargetName)$(TargetExt) - true - $(SolutionDir)libraries\$(Configuration);$(DXSDK_DIR)Lib\x86;%(AdditionalLibraryDirectories) - Server\serv.def - - - - - - _DEBUG;%(PreprocessorDefinitions) - true - true - Win32 - .\Debug\shader.tlb - - - Disabled - $(SolutionDir)sdk/3d_sdk/lw/ver-7.5/include;$(SolutionDir)engine;$(SolutionDir)engine\plugins\shared\;%(AdditionalIncludeDirectories) - DEBUG;_X86_;WIN32;_WINDOWS;_USRDLL;_EXPORT;_LW_SHADER;XRCORE_STATIC;%(PreprocessorDefinitions) - true - true - Sync - EnableFastChecks - true - MultiThreadedDLL - Fast - false - true - Use - stdafx.h - $(IntDir)$(ProjectName).pch - - Level3 - true - EditAndContinue - Cdecl - - - _DEBUG;%(PreprocessorDefinitions) - 0x0419 - - - odbc32.lib;odbccp32.lib;lw_server.lib;xrcorestatic.lib;%(AdditionalDependencies) - $(OutDir)$(TargetName)$(TargetExt) - true - $(SolutionDir)libraries\$(Configuration);$(DXSDK_DIR)Lib\x86;%(AdditionalLibraryDirectories) - Server\serv.def - true - $(OutDir)xray_shader.pdb - - - - - - - - - - - - - - - - - - - - - - - - - Create - Create - - - - - - - - - - - - - - {e8cf1ada-264a-4127-86c2-fd7057d3792c} - - - {f1066eac-ee25-4c7a-9023-5957a6f7ba27} - - - {6ba3121a-acbc-4685-9246-4549ca1efffd} - - - - - - \ No newline at end of file diff --git a/cs/engine/plugins/lw/LW_Shader75.vcxproj.filters b/cs/engine/plugins/lw/LW_Shader75.vcxproj.filters deleted file mode 100644 index de527ba97..000000000 --- a/cs/engine/plugins/lw/LW_Shader75.vcxproj.filters +++ /dev/null @@ -1,58 +0,0 @@ -п»ї - - - - {551f8091-9918-44f6-87db-12a2ec55095d} - - - {469b5b15-4591-4a3f-a48a-5264ca1497bc} - - - {06890e0c-4699-4e55-a1c3-be1bf7034daf} - - - {33af426d-e0e5-4af4-9726-7b56e3629328} - - - {2e285fbd-270f-4c23-af30-0dfa69bd3161} - - - {e59f0d15-7200-44cd-af30-2f0d5502ab5f} - - - {bbab6068-8563-412d-a99c-238749fcecf0} - - - - - Kernel - - - Shared Files\Editor - - - Shared Files\Server - - - Shader - - - - - - - - Kernel - - - Shared Files\Editor - - - Shader - - - - - - - \ No newline at end of file diff --git a/cs/engine/plugins/lw/LW_Shader80.vcxproj b/cs/engine/plugins/lw/LW_Shader80.vcxproj deleted file mode 100644 index 5192f98bd..000000000 --- a/cs/engine/plugins/lw/LW_Shader80.vcxproj +++ /dev/null @@ -1,185 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - LW_Shader_80 - {39EE310B-4F1D-4716-A39F-4AB844DB3680} - 8.1 - - - - DynamicLibrary - v140 - false - MultiByte - - - DynamicLibrary - v140 - false - MultiByte - - - - - - - - - - - - - - - - - false - .p - - - true - .p - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - Win32 - .\Release\shader.tlb - - - OnlyExplicitInline - $(SolutionDir)sdk/3d_sdk/lw/ver-8.0/include;$(SolutionDir)engine;$(SolutionDir)sdk/3d_sdk/lw/ver-8.0/include/lwsdk; $(SolutionDir)engine\plugins\shared\;%(AdditionalIncludeDirectories) - NDEBUG;_X86_;_WIN32;WIN32;_WINDOWS;_USRDLL;_LW_PLUGIN;_LW_SHADER;XRCORE_STATIC;%(PreprocessorDefinitions) - true - - MultiThreadedDLL - true - Precise - true - Use - stdafx.h - $(IntDir)$(ProjectName).pch - - Level3 - true - Cdecl - - - NDEBUG;%(PreprocessorDefinitions) - 0x0419 - - - odbc32.lib;odbccp32.lib;lw_server.lib;xrcorestatic.lib;%(AdditionalDependencies) - $(OutDir)$(TargetName)$(TargetExt) - true - $(SolutionDir)libraries\$(Configuration);$(DXSDK_DIR)Lib\x86;%(AdditionalLibraryDirectories) - Server\serv.def - - - - - - _DEBUG;%(PreprocessorDefinitions) - true - true - Win32 - .\Debug\shader.tlb - - - Disabled - $(SolutionDir)sdk/3d_sdk/lw/ver-8.0/include;$(SolutionDir)engine;$(SolutionDir)sdk/3d_sdk/lw/ver-8.0/include/lwsdk; $(SolutionDir)engine\plugins\shared\;%(AdditionalIncludeDirectories) - DEBUG;_X86_;WIN32;_WINDOWS;_USRDLL;_EXPORT;_LW_SHADER;XRCORE_STATIC;%(PreprocessorDefinitions) - true - true - Sync - EnableFastChecks - true - MultiThreadedDLL - Fast - false - true - Use - stdafx.h - $(IntDir)$(ProjectName).pch - - Level3 - true - EditAndContinue - Cdecl - - - _DEBUG;%(PreprocessorDefinitions) - 0x0419 - - - odbc32.lib;odbccp32.lib;lw_server.lib;xrcorestatic.lib;%(AdditionalDependencies) - $(OutDir)$(TargetName)$(TargetExt) - true - $(SolutionDir)libraries\$(Configuration);$(DXSDK_DIR)Lib\x86;%(AdditionalLibraryDirectories) - Server\serv.def - true - $(OutDir)xray_shader.pdb - - - - - - - - - - - - - - - - - - - - - - - - - Create - Create - - - - - - - - - - - - - - {e8cf1ada-264a-4127-86c2-fd7057d3792c} - - - {f1066eac-ee25-4c7a-9023-5957a6f7ba27} - - - {6ba3121a-acbc-4685-9246-4549ca1efffd} - - - - - - \ No newline at end of file diff --git a/cs/engine/plugins/lw/LW_Shader80.vcxproj.filters b/cs/engine/plugins/lw/LW_Shader80.vcxproj.filters deleted file mode 100644 index ad8d73fc4..000000000 --- a/cs/engine/plugins/lw/LW_Shader80.vcxproj.filters +++ /dev/null @@ -1,58 +0,0 @@ -п»ї - - - - {4ca570d3-ec20-4551-9518-2707eaf55158} - - - {6829c694-fadb-420f-a02c-d394863611a3} - - - {32da4271-6f61-4b8d-8c08-f299231a2f58} - - - {2d960332-dc2d-4f2e-8da3-bf44ae8dd8cc} - - - {2238e866-e72e-4afc-88b4-f9a9be65bb7d} - - - {14cd2488-9742-4b09-a0d1-5e57964d912b} - - - {63b3f19a-c3c0-4c12-9401-19ff7cbaa9e3} - - - - - Kernel - - - Shared Files\Editor - - - Shared Files\Server - - - Shader - - - - - - - - Kernel - - - Shared Files\Editor - - - Shader - - - - - - - \ No newline at end of file diff --git a/cs/engine/plugins/lw/Server/.gitignore b/cs/engine/plugins/lw/Server/.gitignore deleted file mode 100644 index 9873d71b9..000000000 --- a/cs/engine/plugins/lw/Server/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# build results -Debug/ -Release/ diff --git a/cs/engine/plugins/lw/Server/serv.def b/cs/engine/plugins/lw/Server/serv.def deleted file mode 100644 index 1927f6f0c..000000000 --- a/cs/engine/plugins/lw/Server/serv.def +++ /dev/null @@ -1,3 +0,0 @@ -LIBRARY -EXPORTS - _mod_descrip diff --git a/cs/engine/plugins/lw/Server/servdesc.c b/cs/engine/plugins/lw/Server/servdesc.c deleted file mode 100644 index 36700e3a1..000000000 --- a/cs/engine/plugins/lw/Server/servdesc.c +++ /dev/null @@ -1,24 +0,0 @@ -/* - * LWSDK Library Source File - * Copyright 1995,1997 NewTek, Inc. - * - * Default 'ServerDesc' array is defined by assuming the existence of - * some other static globals for the class name, server name, user - * names and activation entry point for a single server. Multiple - * server modules will define their own 'ServerDesc' arrays. - */ -#include - - -extern char ServerClass[]; -extern char ServerName[]; -extern ServerUserName UserNames[]; -extern XCALL_(int) Activate (long, GlobalFunc *, void *, void *); - - - ServerRecord -ServerDesc[] = { - { ServerClass, ServerName, Activate, UserNames }, - { 0 } -}; - diff --git a/cs/engine/plugins/lw/Server/servmain.c b/cs/engine/plugins/lw/Server/servmain.c deleted file mode 100644 index a540ec180..000000000 --- a/cs/engine/plugins/lw/Server/servmain.c +++ /dev/null @@ -1,25 +0,0 @@ -/* - * LWSDK Startup File - * Copyright 1995,1997 NewTek, Inc. - */ -#include - - -extern void * Startup (void); -extern void Shutdown (void *serverData); -extern ServerRecord ServerDesc[]; - - - #ifdef __BORLANDC__ -ModuleDescriptor mod_descrip = - #else -ModuleDescriptor _mod_descrip = - #endif - { - MOD_SYSSYNC, - MOD_SYSVER, - MOD_MACHINE, - Startup, - Shutdown, - ServerDesc - }; diff --git a/cs/engine/plugins/lw/Server/shutdown.c b/cs/engine/plugins/lw/Server/shutdown.c deleted file mode 100644 index 567cf27da..000000000 --- a/cs/engine/plugins/lw/Server/shutdown.c +++ /dev/null @@ -1,14 +0,0 @@ -/* - * LWSDK Library Source File - * Copyright 1995,1997 NewTek, Inc. - * - * Default 'Shutdown' implementaion does nothing. - */ -#include - - - void -Shutdown ( - void *serverData) -{ -} diff --git a/cs/engine/plugins/lw/Server/startup.c b/cs/engine/plugins/lw/Server/startup.c deleted file mode 100644 index e1fb96218..000000000 --- a/cs/engine/plugins/lw/Server/startup.c +++ /dev/null @@ -1,14 +0,0 @@ -/* - * LWSDK Library Source File - * Copyright 1995,1997 NewTek, Inc. - * - * Default 'Startup' function returns any non-zero value for success. - */ -#include - - - void * -Startup (void) -{ - return (void *) 4; -} diff --git a/cs/engine/plugins/lw/Server/username.c b/cs/engine/plugins/lw/Server/username.c deleted file mode 100644 index f7fea9062..000000000 --- a/cs/engine/plugins/lw/Server/username.c +++ /dev/null @@ -1,15 +0,0 @@ -/* - * LWSDK Library Source File - * Copyright 1995,1997 NewTek, Inc. - * - * The default 'UserNames' array is empty, so the user name will be - * the same as the server name for a minimal server. - */ -#include - - - ServerUserName -UserNames[] = { - { 0 } -}; - diff --git a/cs/engine/plugins/lw/Shader/LW_Shader.cpp b/cs/engine/plugins/lw/Shader/LW_Shader.cpp deleted file mode 100644 index b8766ae69..000000000 --- a/cs/engine/plugins/lw/Shader/LW_Shader.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include "stdafx.h" -#include "LW_Shader.h" -#include "..\..\Shared\BlenderListLoader.h" - -extern "C" { EShaderList ENShaders; EShaderList LCShaders; EShaderList GameMtls;} - -extern "C" { - void __cdecl LoadShaders() - { - Core._initialize("XRayPlugin",0,FALSE); - FS._initialize (CLocatorAPI::flScanAppRoot,NULL,"xray_path.ltx"); - LPSTRVec lst; - ENShaders.count=LoadBlenderList(lst); - for (LPSTRIt b_it=lst.begin(); b_it!=lst.end(); b_it++) - strcpy(ENShaders.Names[b_it-lst.begin()],*b_it); - ClearList(lst); - - LCShaders.count=LoadShaderLCList(lst); - for (LPSTRIt c_it=lst.begin(); c_it!=lst.end(); c_it++) - strcpy(LCShaders.Names[c_it-lst.begin()],*c_it); - ClearList(lst); - - GameMtls.count=LoadGameMtlList(lst); - for (LPSTRIt g_it=lst.begin(); g_it!=lst.end(); g_it++) - strcpy(GameMtls.Names[g_it-lst.begin()],*g_it); - ClearList(lst); - } -}; \ No newline at end of file diff --git a/cs/engine/plugins/lw/Shader/LW_Shader.h b/cs/engine/plugins/lw/Shader/LW_Shader.h deleted file mode 100644 index db07bff74..000000000 --- a/cs/engine/plugins/lw/Shader/LW_Shader.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef _LW_SHADER_H_ -#define _LW_SHADER_H_ -#pragma once - -#include "..\lw_shared\LW_ShaderDef.h" - -typedef char sh_name[64]; - -typedef struct st_EShaderList{ - int count; - sh_name Names[1024]; -}EShaderList; - -#endif \ No newline at end of file diff --git a/cs/engine/plugins/lw/Shader/blotch.c b/cs/engine/plugins/lw/Shader/blotch.c deleted file mode 100644 index 949bcec5b..000000000 --- a/cs/engine/plugins/lw/Shader/blotch.c +++ /dev/null @@ -1,543 +0,0 @@ -/* -====================================================================== -blotch.c - -Stick a colored spot on a surface. - -Allen Hastings, Arnie Cachelin, Stuart Ferguson, Ernie Wright -6 April 00 - -** Note: The first release of LW 6.0 will crash on exit if this -plug-in's interface has been opened during that session. The crash -is related to xpanel destroy processing. It shouldn't cause loss of -data, and it should be resolved in later builds. -====================================================================== */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "LW_Shader.h" - -#pragma warning (disable:4996) - -#ifndef PI -#define PI 3.1415926535897932384 -#endif - -EShaderList ENShaders; -EShaderList LCShaders; -EShaderList GameMtls; - -char* ENList_GetName(int idx){ - return ((idx>=0)&&(idx=0)&&(idx=0)&&(idxen_name, "default"); - strcpy(inst->lc_name, "default"); - strcpy(inst->gm_name, "default"); - - ENList_Clear(); - LCList_Clear(); - LoadShaders(); - - return inst; -} - - -/* -====================================================================== -Destroy() - -Handler callback. Free resources allocated by Create(). -====================================================================== */ - -XCALL_( static void ) -Destroy( XRShader *inst ) -{ - free( inst ); -} - - -/* -====================================================================== -Copy() - -Handler callback. Copy instance data. -====================================================================== */ - -XCALL_( static LWError ) -Copy( XRShader *to, XRShader *from ) -{ - XCALL_INIT; - - *to = *from; - return NULL; -} - - -/* -====================================================================== -Load() - -Handler callback. Read instance data. Shader instance data is stored -in the SURF chunks of object files, but it isn't necessary to know -that to read and write the data. -====================================================================== */ - -XCALL_( static LWError ) -Load( XRShader *inst, const LWLoadState *ls ) -{ - ls->read(ls->readData,(char*)inst,sizeof(XRShader)); - if (ENList_GetIdx(inst->en_name)==-1) strcpy(inst->en_name,"default"); - if (LCList_GetIdx(inst->lc_name)==-1) strcpy(inst->lc_name,"default"); - if (GMList_GetIdx(inst->gm_name)==-1) strcpy(inst->gm_name,"default"); - inst->desc = 0; - - return NULL; -} - - -/* -====================================================================== -Save() - -Handler callback. Write instance data. The I/O functions in lwio.h -include one for reading and writing floats, but not doubles. We just -transfer our double-precision data to a float variable before calling -the LWSAVE_FP() macro. -====================================================================== */ - -XCALL_( static LWError ) -Save( XRShader *inst, const LWSaveState *ss ) -{ - ss->write(ss->writeData,(char*)inst,sizeof(XRShader)); - - return NULL; -} - - -/* -====================================================================== -DescLn() - -Handler callback. Write a one-line text description of the instance -data. Since the string must persist after this is called, it's part -of the instance. -====================================================================== */ - -XCALL_( static const char * ) -DescLn( XRShader *inst ) -{ - char s[1024]; - if (inst->desc) free(inst->desc); - sprintf( s, "ES:'%s', CS:'%s', GM:'%s'", inst->en_name, inst->lc_name, inst->gm_name ); - inst->desc = strdup(s); - return inst->desc; -} - - -/* -====================================================================== -Init() - -Handler callback, called at the start of rendering. We do a little -precalculation here. -====================================================================== */ - -XCALL_( static LWError ) -Init( XRShader *inst, int mode ) -{ - inst->desc = 0; - return NULL; -} - - -/* -====================================================================== -Cleanup() - -Handler callback, called at the end of rendering. We don't have -anything to do, but it's here in case we want to add something later. -====================================================================== */ - -XCALL_( static void ) -Cleanup( XRShader *inst ) -{ - if (inst->desc) free(inst->desc); - return; -} - - -/* -====================================================================== -NewTime() - -Handler callback, called at the start of each sampling pass. -====================================================================== */ - -XCALL_( static LWError ) -NewTime( XRShader *inst, LWFrame f, LWTime t ) -{ - return NULL; -} - - -/* -====================================================================== -Flags() - -Handler callback. Blotch alters the color of the surface, but nothing -else, so we return just the color bit. -====================================================================== */ - -XCALL_( static unsigned int ) -Flags( XRShader *inst ) -{ - return LWSHF_COLOR; -} - - -/* -====================================================================== -Evaluate() - -Handler callback. This is where the blotchiness actually happens. We -compute the distance from the spot to be shaded to the center of the -blotch and blend some of the blotch color with the color already -computed for that spot. -====================================================================== */ - -XCALL_( static void ) -Evaluate( XRShader *inst, LWShaderAccess *sa ) -{ -} - - -/* -====================================================================== -Handler() - -Handler activation function. Check the version and fill in the -callback fields of the handler structure. -====================================================================== */ - -XCALL_( static int ) -Handler( long version, GlobalFunc *global, LWShaderHandler *local, - void *serverData) -{ - if ( version != LWSHADER_VERSION ) return AFUNC_BADVERSION; - - local->inst->create = Create; - local->inst->destroy = Destroy; - local->inst->load = Load; - local->inst->save = Save; - local->inst->copy = Copy; - local->inst->descln = DescLn; - local->rend->init = Init; - local->rend->cleanup = Cleanup; - local->rend->newTime = NewTime; - local->evaluate = Evaluate; - local->flags = Flags; - - return AFUNC_OK; -} - - - -/* interface stuff ----- */ - -static LWXPanelFuncs *xpanf; -static LWColorActivateFunc *colorpick; -static LWInstUpdate *lwupdate; - -enum { ID_EN = 0x8001, - ID_LC = 0x8002, - ID_GM = 0x8003}; - -/* -====================================================================== -ui_get() - -Xpanels callback for LWXP_VIEW panels. Returns a pointer to the data -for a given control value. -====================================================================== */ -void *ui_get( XRShader *dat, unsigned long vid ) -{ - void *result = NULL; - - if ( dat ) - switch ( vid ) { - case ID_EN: - dat->en_idx = ENList_GetIdx(dat->en_name); - result = &dat->en_idx; - break; - case ID_LC: - dat->lc_idx = LCList_GetIdx(dat->lc_name); - result = &dat->lc_idx; - break; - case ID_GM: - dat->gm_idx = GMList_GetIdx(dat->gm_name); - result = &dat->gm_idx; - break; - } - - return result; -} - - -/* -====================================================================== -ui_set() - -Xpanels callback for LWXP_VIEW panels. Store a value in our instance -data. -====================================================================== */ - -LWXPRefreshCode ui_set( XRShader *dat, unsigned long vid, void *value ) -{ - switch ( vid ) { - case ID_EN: - dat->en_idx = *(( int * ) value ); - if(dat->en_idx>=0) strncpy(dat->en_name, ENList_GetName(dat->en_idx) ,sizeof( dat->en_name )); - break; - case ID_LC: - dat->lc_idx = *(( int * ) value ); - if(dat->lc_idx>=0) strncpy(dat->lc_name, LCList_GetName(dat->lc_idx) ,sizeof( dat->lc_name )); - break; - case ID_GM: - dat->gm_idx = *(( int * ) value ); - if(dat->gm_idx>=0) strncpy(dat->gm_name, GMList_GetName(dat->gm_idx) ,sizeof( dat->gm_name )); - break; - default: - return 0; - } - return 1; -} - - -/* -====================================================================== -ui_chgnotify() - -XPanel callback. XPanels calls this when an event occurs that affects -the value of one of your controls. We use the instance update global -to tell Layout that our instance data has changed. -====================================================================== */ - -void ui_chgnotify( LWXPanelID panel, unsigned long cid, unsigned long vid, - int event ) -{ - void *dat; - - if ( event == LWXPEVENT_VALUE ) - if ( dat = xpanf->getData( panel, 0 )) - lwupdate( LWSHADER_HCLASS, dat ); -} - - -/* -====================================================================== -get_panel() - -Create and initialize an LWXP_VIEW panel. Called by Interface(). -====================================================================== */ -#define STR_Type_EN "Engine" -#define STR_Type_LC "Compiler" -#define STR_Type_GM "Game Material" -static LWXPanelControl ctrl_list[] = { - { ID_EN, STR_Type_EN, "iPopChoice" }, - { ID_LC, STR_Type_LC, "iPopChoice" }, - { ID_GM, STR_Type_GM, "iPopChoice" }, - { 0 } -}; - -/* matching array of data descriptors */ - -static LWXPanelDataDesc data_descrip[] = { - { ID_EN, STR_Type_EN, "integer" }, - { ID_LC, STR_Type_LC, "integer" }, - { ID_GM, STR_Type_GM, "integer" }, - { 0 }, -}; -static LWXPanelID get_xpanel( GlobalFunc *global, XRShader *dat ) -{ - LWXPanelID panID = NULL; - - static LWXPanelHint hint[] = { - XpLABEL( 0, "Shaders" ), - XpCHGNOTIFY( ui_chgnotify ), - XpPOPFUNCS( ID_EN, popCnt_EN, popName_EN ), - XpPOPFUNCS( ID_LC, popCnt_LC, popName_LC ), - XpPOPFUNCS( ID_GM, popCnt_GM, popName_GM ), - XpEND - }; - - xpanf = global( LWXPANELFUNCS_GLOBAL, GFUSE_TRANSIENT ); - if ( xpanf ) { - panID = xpanf->create( LWXP_VIEW, ctrl_list ); - if ( panID ) { - xpanf->hint( panID, 0, hint ); - xpanf->describe( panID, data_descrip, ui_get, ui_set ); - xpanf->viewInst( panID, dat ); - xpanf->setData( panID, 0, dat ); - } - } - - return panID; -} - -/* -====================================================================== -Interface() - -The interface activation function. -====================================================================== */ - -XCALL_( int ) -Interface( long version, GlobalFunc *global, LWInterface *local, - void *serverData ) -{ - if ( version != LWINTERFACE_VERSION ) return AFUNC_BADVERSION; - - colorpick = global( LWCOLORACTIVATEFUNC_GLOBAL, GFUSE_TRANSIENT ); - lwupdate = global( LWINSTUPDATE_GLOBAL, GFUSE_TRANSIENT ); - xpanf = global( LWXPANELFUNCS_GLOBAL, GFUSE_TRANSIENT ); - if ( !colorpick || !lwupdate || !xpanf ) return AFUNC_BADGLOBAL; - - local->panel = get_xpanel( global, local->inst ); -// local->panel = get_panel( local->inst ); - local->options = NULL; - local->command = NULL; - - return local->panel ? AFUNC_OK : AFUNC_BADGLOBAL; -} - -ServerRecord ServerDesc[] = { - { LWSHADER_HCLASS, SH_PLUGIN_NAME, Handler }, - { LWSHADER_ICLASS, SH_PLUGIN_NAME, Interface }, - { NULL } -}; - -#pragma warning (default:4996) diff --git a/cs/engine/plugins/lw/Shader/resource.h b/cs/engine/plugins/lw/Shader/resource.h deleted file mode 100644 index a02358ca9..000000000 --- a/cs/engine/plugins/lw/Shader/resource.h +++ /dev/null @@ -1,27 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by resource.rc -// -#define IDDEBUG 3 -#define IDD_LOG 101 -#define IDI_ICON 103 -#define IDD_VERIFY 104 -#define IDI_XRAY 105 -#define IDC_LIST 1000 -#define IDC_FILE 1001 -#define IDC_LINE 1002 -#define IDC_DESC 1003 -#define IDSTOP 1004 -#define IDCONTINUE 1005 -#define IDC_STACK 1006 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 106 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1007 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/cs/engine/plugins/lw/Shader/stdafx.cpp b/cs/engine/plugins/lw/Shader/stdafx.cpp deleted file mode 100644 index 6ffc703a8..000000000 --- a/cs/engine/plugins/lw/Shader/stdafx.cpp +++ /dev/null @@ -1,5 +0,0 @@ -// stdafx.cpp : source file that includes just the standard includes -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - \ No newline at end of file diff --git a/cs/engine/plugins/lw/Shader/stdafx.h b/cs/engine/plugins/lw/Shader/stdafx.h deleted file mode 100644 index afd37bbef..000000000 --- a/cs/engine/plugins/lw/Shader/stdafx.h +++ /dev/null @@ -1,49 +0,0 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently - -#ifndef StdafxH -#define StdafxH - -#pragma once - -#include "../../../xrCore/xrCore.h" - -#define ENGINE_API - -enum TMsgDlgType { mtWarning, mtError, mtInformation, mtConfirmation, mtCustom }; -enum TMsgDlgBtn { mbYes, mbNo, mbOK, mbCancel, mbAbort, mbRetry, mbIgnore, mbAll, mbNoToAll, mbYesToAll, mbHelp }; -typedef TMsgDlgBtn TMsgDlgButtons[mbHelp]; - - -#define ECORE_API - -#include "..\..\Shared\ELog.h" -#include -#include - -#include - -#define AnsiString std::string - -using AStringVec = xr_vector; -using AStringIt = AStringVec::iterator; - -#define THROW R_ASSERT(0) - -#ifdef _LW_SHADER - #define _EDITOR_FILE_NAME_ "lw_shader" -#else - #ifdef _LW_EXPORT - #define _EDITOR_FILE_NAME_ "lw_export" - #else - #ifdef _LW_IMPORT - #define _EDITOR_FILE_NAME_ "lw_import" - #endif - #endif -#endif - -#define GAMEMTL_NONE u32(-1) -#define _game_data_ "$game_data$" - -#endif // StdafxH diff --git a/cs/engine/plugins/lw/lw_shared/LW_ShaderDef.h b/cs/engine/plugins/lw/lw_shared/LW_ShaderDef.h deleted file mode 100644 index ee0ce7586..000000000 --- a/cs/engine/plugins/lw/lw_shared/LW_ShaderDef.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef _LW_SHADERDEF_H_ -#define _LW_SHADERDEF_H_ -#pragma once - -/* our instance data */ -#pragma pack(push,1) -typedef struct st_XRShader{ - char en_name[64]; - int en_idx; - char lc_name[64]; - int lc_idx; - char gm_name[64]; - int gm_idx; - char* desc; -} XRShader; -#pragma pack(pop) - -#define SH_PLUGIN_NAME "!XRayShader" - -#endif diff --git a/cs/engine/plugins/shared/BlenderListLoader.cpp b/cs/engine/plugins/shared/BlenderListLoader.cpp deleted file mode 100644 index c1156de21..000000000 --- a/cs/engine/plugins/shared/BlenderListLoader.cpp +++ /dev/null @@ -1,73 +0,0 @@ -#include "stdafx.h" -#pragma hdrstop - -#include "BlenderListLoader.h" -#include "Shader_XRLC.h" -#include "GameMtlLib.h" - -IC bool str_pred(LPCSTR x, LPCSTR y) -{ - return xr_strcmp(x,y)<0; -} - -void ClearList(LPSTRVec& lst) -{ - for (LPSTRIt it=lst.begin(); it!=lst.end(); it++) - xr_free (*it); -} - -int LoadBlenderList(LPSTRVec& lst) -{ - ClearList (lst); - - // Load blenders - string_path sh; - FS.update_path (sh,"$game_data$","shaders.xr"); - IReader* R = FS.r_open(sh); - - IReader* fs = R->open_chunk(3); R_ASSERT(fs); - - xr_string buf; - lst.resize (fs->r_u32()); - for (LPSTRIt it=lst.begin(); it!=lst.end(); it++){ - fs->r_stringZ (buf); - *it=xr_strdup (buf.c_str()); - } - fs->close(); - std::sort (lst.begin(), lst.end(), str_pred); - return lst.size(); -} - -int LoadShaderLCList(LPSTRVec& lst) -{ - Shader_xrLC_LIB LIB; - - ClearList (lst); - - string_path fn; - FS.update_path (fn,"$game_data$","shaders_xrlc.xr"); - LIB.Load (fn); - - lst.resize (LIB.Library().size()); - LPSTRIt s_it = lst.begin(); - for (Shader_xrLCIt l_it=LIB.Library().begin(); l_it!=LIB.Library().end(); l_it++,s_it++) - *s_it = xr_strdup(l_it->Name); - LIB.Unload (); - std::sort (lst.begin(), lst.end(), str_pred); - return lst.size (); -} - -int LoadGameMtlList(LPSTRVec& lst) -{ - ClearList (lst); - - GMLib.Load (); - - lst.resize (GMLib.CountMaterial()); - LPSTRIt s_it = lst.begin(); - for (GameMtlIt gm_it=GMLib.FirstMaterial(); gm_it!=GMLib.LastMaterial(); gm_it++,s_it++) - *s_it = xr_strdup(*(*gm_it)->m_Name); - GMLib.Unload (); - std::sort (lst.begin(), lst.end(), str_pred); - return lst.size (); -} diff --git a/cs/engine/plugins/shared/BlenderListLoader.h b/cs/engine/plugins/shared/BlenderListLoader.h deleted file mode 100644 index a4f7a4f4c..000000000 --- a/cs/engine/plugins/shared/BlenderListLoader.h +++ /dev/null @@ -1,13 +0,0 @@ -//---------------------------------------------------- -// file: FileSystem.h -//---------------------------------------------------- - -#ifndef _INCDEF_BlenderList_H_ -#define _INCDEF_BlenderList_H_ - -int LoadBlenderList(LPSTRVec& lst); -int LoadShaderLCList(LPSTRVec& lst); -int LoadGameMtlList(LPSTRVec& lst); -void ClearList(LPSTRVec& lst); - -#endif \ No newline at end of file diff --git a/cs/engine/plugins/shared/BoneDef.h b/cs/engine/plugins/shared/BoneDef.h deleted file mode 100644 index 5757c1678..000000000 --- a/cs/engine/plugins/shared/BoneDef.h +++ /dev/null @@ -1,37 +0,0 @@ -#pragma once - -#include "..\..\Shared\helper.h" - -// refs -class CExporter; - -class CBoneDef -{ -public: - CBoneDef* parent; - string name; - INode* pBone; - - Fmatrix matInit; - Fmatrix matOffset; -public: - CBoneDef(INode* pNode); - IC BOOL isEqual(INode* pNode){ return pBone==pNode; } - LPCSTR GetParentName(); - BOOL SetInitTM(IPhysiqueExport* pExport, const Matrix3& matMesh); - void CalculateLocalMatrix(TimeValue tick, Fmatrix& mat) - { - Fmatrix m; - Helper::ConvertMatrix(pBone->GetNodeTM(tick),m); - if (parent){ - Fmatrix i_m; - Helper::ConvertMatrix(parent->pBone->GetNodeTM(tick),i_m); - i_m.invert(); - mat.mul(i_m,m); - }else{ - mat.set(m); - } - } -}; -using BoneDefVec = xr_vector; -using BoneDefIt = BoneDefVec::iterator; \ No newline at end of file diff --git a/cs/engine/plugins/shared/ELog.cpp b/cs/engine/plugins/shared/ELog.cpp deleted file mode 100644 index 731106379..000000000 --- a/cs/engine/plugins/shared/ELog.cpp +++ /dev/null @@ -1,179 +0,0 @@ -//---------------------------------------------------- -// file: NetDeviceELog.cpp -//---------------------------------------------------- - -#include "stdafx.h" -#pragma hdrstop - -#include "ELog.h" -#ifdef _EDITOR - #include "LogForm.h" - #include "ui_main.h" - void __stdcall ELogCallback(LPCSTR txt) - { - if (0==txt[0]) return; - bool bDlg = ('#'==txt[0])||((0!=txt[1])&&('#'==txt[1])); - TMsgDlgType mt = ('!'==txt[0])||((0!=txt[1])&&('!'==txt[1]))?mtError:mtInformation; - if (('!'==txt[0])||('#'==txt[0])) txt++; - if (('!'==txt[0])||('#'==txt[0])) txt++; - if (bDlg) TfrmLog::AddDlgMessage (mt,txt); - else TfrmLog::AddMessage (mt,txt); - } -#endif -#ifdef _LW_EXPORT - #include - extern "C" LWMessageFuncs *g_msg; - void ELogCallback(LPCSTR txt) - { - if (0==txt[0]) return; - bool bDlg = ('#'==txt[0])||((0!=txt[1])&&('#'==txt[1])); - if (bDlg){ - int mt = ('!'==txt[0])||((0!=txt[1])&&('!'==txt[1]))?1:0; - if (('!'==txt[0])||('#'==txt[0])) txt++; - if (('!'==txt[0])||('#'==txt[0])) txt++; - if (mt==1) g_msg->error(txt,0); - else g_msg->info(txt,0); - } - } -#endif -#ifdef _MAX_EXPORT - #include "..\Max\Export\NetDeviceLog.h" - void ELogCallback(LPCSTR txt) - { - if (0!=txt[0]){ - if (txt[0]=='!')EConsole.print(mtError,txt+1); - else EConsole.print(mtInformation,txt); - } - } -#endif -#ifdef _MAYA_PLUGIN - void ELogCallback(LPCSTR txt) - { - if (0!=txt[0]){ - if (txt[0]=='!')std::cerr << "XR-Error: " << txt+1 << "\n"; - else std::cerr << "XR-Info: " << txt << "\n"; - } -//. MStringArray res; -// MGlobal::executeCommand("confirmDialog -title \"Error\" -message \"Mesh have non-triangulated polygon.\" -button \"Ok\" -defaultButton \"Ok\"",res); - } -#endif - -//---------------------------------------------------- -CLog ELog; -//---------------------------------------------------- - -int CLog::DlgMsg (TMsgDlgType mt, TMsgDlgButtons btn, LPCSTR _Format, ...) -{ - in_use = true; - char buf[4096]; - va_list l; - va_start( l, _Format ); - vsprintf( buf, _Format, l ); - - int res=0; -#ifdef _EDITOR - ExecCommand(COMMAND_RENDER_FOCUS); - - res=MessageDlg(buf, mt, btn, 0); - if (mtConfirmation==mt){ - switch (res){ - case mrYes: strcat(buf," - Yes."); break; - case mrNo: strcat(buf," - No."); break; - case mrCancel: strcat(buf," - Cancel."); break; - default: strcat(buf," - Something."); - } - } -#endif -#ifdef _LW_EXPORT - switch(mt){ - case mtError: g_msg->error(buf,0); break; - case mtInformation: g_msg->info(buf,0); break; - default: g_msg->info(buf,0); break; - } -#endif -#ifdef _MAX_PLUGIN - switch(mt){ - case mtError: MessageBox(0,buf,"Error", MB_OK|MB_ICONERROR); break; - case mtInformation: MessageBox(0,buf,"Information", MB_OK|MB_ICONINFORMATION); break; - default: MessageBox(0,buf,"Information", MB_OK|MB_ICONINFORMATION); break; - } -#endif - - Msg(mt, buf); - - in_use = false; - - return res; -} - - -int CLog::DlgMsg (TMsgDlgType mt, LPCSTR _Format, ...) -{ - in_use = true; - char buf[4096]; - va_list l; - va_start( l, _Format ); - vsprintf( buf, _Format, l ); - - int res=0; -#ifdef _EDITOR - ExecCommand(COMMAND_RENDER_FOCUS); - - if (mtConfirmation==mt) res=MessageDlg(buf, mt, TMsgDlgButtons() << mbYes << mbNo << mbCancel, 0); - else res=MessageDlg(buf, mt, TMsgDlgButtons() << mbOK, 0); - - if (mtConfirmation==mt){ - switch (res){ - case mrYes: strcat(buf," - Yes."); break; - case mrNo: strcat(buf," - No."); break; - case mrCancel: strcat(buf," - Cancel."); break; - default: strcat(buf," - Something."); - } - } -#endif -#ifdef _LW_EXPORT - switch(mt){ - case mtError: g_msg->error(buf,0); break; - case mtInformation: g_msg->info(buf,0); break; - default: g_msg->info(buf,0); break; - } -#endif -#ifdef _MAX_PLUGIN - switch(mt){ - case mtError: MessageBox(0,buf,"Error", MB_OK|MB_ICONERROR); break; - case mtInformation: MessageBox(0,buf,"Information", MB_OK|MB_ICONINFORMATION); break; - default: MessageBox(0,buf,"Information", MB_OK|MB_ICONINFORMATION); break; - } -#endif - - Msg(mt,buf); - - in_use = false; - - return res; -} - -void CLog::Msg(TMsgDlgType mt, LPCSTR _Format, ...) -{ - char buf[4096]; - va_list l; - va_start( l, _Format ); - vsprintf( buf, _Format, l ); - -#ifdef _EDITOR - TfrmLog::AddMessage(mt,AnsiString(buf)); -#endif -#ifdef _MAX_EXPORT - EConsole.print(mt,buf); -#endif -#ifdef _LW_EXPORT - switch (mt){ - case mtError: g_msg->error(buf,0); break; - } -#endif - - ::LogExecCB = FALSE; - ::Msg (buf); - ::LogExecCB = TRUE; -} -//---------------------------------------------------- diff --git a/cs/engine/plugins/shared/ELog.h b/cs/engine/plugins/shared/ELog.h deleted file mode 100644 index 1b4f1aa7c..000000000 --- a/cs/engine/plugins/shared/ELog.h +++ /dev/null @@ -1,23 +0,0 @@ -//---------------------------------------------------- -// file: Log.h -//---------------------------------------------------- - -#ifndef ELogH -#define ELogH - -class ECORE_API CLog{ -public: - bool in_use; -public: - CLog (){in_use=false;} - void Msg (TMsgDlgType mt, LPCSTR _Format, ...); - int DlgMsg (TMsgDlgType mt, LPCSTR _Format, ...); - int DlgMsg (TMsgDlgType mt, TMsgDlgButtons btn, LPCSTR _Format, ...); -}; - -void ECORE_API ELogCallback(LPCSTR txt); - -extern ECORE_API CLog ELog; - -#endif /*_INCDEF_NETDEVICELOG_H_*/ - diff --git a/cs/engine/plugins/shared/Envelope.cpp b/cs/engine/plugins/shared/Envelope.cpp deleted file mode 100644 index ad23a1912..000000000 --- a/cs/engine/plugins/shared/Envelope.cpp +++ /dev/null @@ -1,229 +0,0 @@ -#include "stdafx.h" -#pragma hdrstop - -#include "envelope.h" - -CEnvelope::~CEnvelope() -{ - for (KeyIt k_it=keys.begin(); k_it!=keys.end(); k_it++) - xr_delete(*k_it); -} -CEnvelope::CEnvelope(CEnvelope* source) -{ - *this = *source; - for (u32 i=0; ikeys.size(); i++) - keys[i] = new st_Key(*source->keys[i]); -} - -void CEnvelope::FindNearestKey(float t, KeyIt& min_k, KeyIt& max_k, float eps) -{ - for (KeyIt k_it=keys.begin(); k_it!=keys.end(); k_it++){ - if (fsimilar((*k_it)->time,t,eps)){ - max_k = k_it+1; - min_k = (k_it==keys.begin())?k_it:k_it-1; - return; - } - if ((*k_it)->time>t){ - max_k = k_it; - min_k = (k_it==keys.begin())?k_it:k_it-1; - return; - } - } - min_k=keys.empty()?keys.end():keys.end()-1; - max_k=keys.end(); -} - -KeyIt CEnvelope::FindKey(float t, float eps) -{ - for (KeyIt k_it=keys.begin(); k_it!=keys.end(); k_it++){ - if (fsimilar((*k_it)->time,t,eps)) return k_it; - if ((*k_it)->time>t) return keys.end(); - } - return keys.end(); -} - -void CEnvelope::InsertKey(float t, float val) -{ - KeyIt k_it; - for (k_it=keys.begin(); k_it!=keys.end(); k_it++){ - if (fsimilar((*k_it)->time,t,EPS_L)){ - (*k_it)->value= val; - return; - } - // insert before - if ((*k_it)->time>t) break; - } - // create _new key - st_Key* K = new st_Key(); - K->time = t; - K->value = val; - K->shape = SHAPE_TCB; - behavior[0] = BEH_CONSTANT; - behavior[1] = BEH_CONSTANT; - keys.insert (k_it,K); -} - -void CEnvelope::DeleteKey(float t) -{ - for (KeyIt k_it=keys.begin(); k_it!=keys.end(); k_it++){ - if (fsimilar((*k_it)->time,t,EPS_L)){ - xr_delete(*k_it); - keys.erase(k_it); - return; - } - } -} - -BOOL CEnvelope::ScaleKeys(float from_time, float to_time, float scale_factor, float eps) -{ - KeyIt min_k = FindKey(from_time,eps); - if (min_k==keys.end()){ - KeyIt k0; - FindNearestKey(from_time, k0, min_k, eps); - } - KeyIt max_k = FindKey(to_time,eps); - if (max_k==keys.end()){ - KeyIt k1; - FindNearestKey(to_time, max_k, k1, eps); - } - if (min_k!=keys.end()&&min_k!=max_k){ - if (max_k!=keys.end()) max_k++; - float t0 = (*min_k)->time; - float offset = 0; - KeyIt it; - for (it=min_k+1; it!=max_k; it++){ - float new_time = offset+t0+((*it)->time-t0)*scale_factor; - offset += ((new_time-(*(it-1))->time)-((*it)->time-t0)); - t0 = (*it)->time; - (*it)->time = new_time; - } - for (; it!=keys.end(); it++){ - float new_time = offset+(*it)->time; - offset += ((new_time-(*(it-1))->time)-((*it)->time-t0)); - (*it)->time = new_time; - } - return TRUE; - } - return FALSE; -} - -float CEnvelope::GetLength(float* mn, float* mx) -{ - if (!keys.empty()){ - if (mn) *mn = keys.front()->time; - if (mx) *mx = keys.back()->time; - return keys.back()->time-keys.front()->time; - } - if (mn) *mn = 0.f; - if (mx) *mx = 0.f; - return 0.f; -} - -void CEnvelope::RotateKeys(float angle) -{ - for (u32 i=0; ivalue += angle; -} - - -extern float evalEnvelope( CEnvelope *env, float time ); -float CEnvelope::Evaluate(float time){ - return evalEnvelope(this, time); -} - -void CEnvelope::Save(IWriter& F) -{ - F.w_u8 ((u8)behavior[0]); - F.w_u8 ((u8)behavior[1]); - F.w_u16 ((u16)keys.size()); - for (KeyIt k_it=keys.begin(); k_it!=keys.end(); k_it++) - (*k_it)->Save(F); -} - -void CEnvelope::Load_1(IReader& F) -{ - F.r (behavior,sizeof(int)*2); - int y = F.r_u32(); - keys.resize (y); - for (u32 i=0; iLoad_1(F); - } -} - -void CEnvelope::Load_2(IReader& F) -{ - behavior[0] = F.r_u8(); - behavior[1] = F.r_u8(); - keys.resize (F.r_u16()); - for (u32 i=0; iLoad_2(F); - } -} - -void CEnvelope::SaveA(IWriter&){ -} - -void CEnvelope::LoadA(IReader& F){ - string512 buf; - float f[9]; - F.r_string(buf,sizeof(buf)); - if (strstr(buf,"{ Envelope")){ - F.r_string(buf,sizeof(buf)); - int nkeys=atoi(buf); - keys.resize(nkeys); - for (u32 i=0; i - F.r_string(buf,sizeof(buf)); - int cnt = sscanf(buf,"Behaviors %d %d", behavior[0], behavior[1] ); - R_ASSERT(cnt==2); - } -} - -void CEnvelope::Optimize() -{ - KeyIt it = keys.begin(); - st_Key K = **it; it++; - bool equal = true; - for (;it!=keys.end();it++){ - if (!(*it)->equal(K)){ - equal = false; - break; - } - } - if (equal&&(keys.size()>2)){ - KeyVec new_keys; - new_keys.push_back(new st_Key(*keys.front())); - new_keys.push_back(new st_Key(*keys.back())); - for (KeyIt k_it=keys.begin(); k_it!=keys.end(); k_it++) - xr_delete(*k_it); - keys.clear_and_free (); - keys = new_keys; - } -} - - diff --git a/cs/engine/plugins/shared/Face.h b/cs/engine/plugins/shared/Face.h deleted file mode 100644 index 04c24a0a7..000000000 --- a/cs/engine/plugins/shared/Face.h +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -#include "vert.h" - -struct st_FACE { - int v[3]; - u32 m_id; - u32 sm_group; -public: - void _VSet(int id, int idx){v[id]=idx;} -}; - -using ExpFaceVec = xr_vector; -using ExpFaceIt = ExpFaceVec::iterator; - diff --git a/cs/engine/plugins/shared/GameMaterial.cpp b/cs/engine/plugins/shared/GameMaterial.cpp deleted file mode 100644 index 58c143d4e..000000000 --- a/cs/engine/plugins/shared/GameMaterial.cpp +++ /dev/null @@ -1,4747 +0,0 @@ -#include "stdafx.h" -#pragma hdrstop - -#include "GameMaterial.h" -#include "BlenderListLoader.h" - -#include "macrorec.h" - -class XRayMtlClassDesc:public ClassDesc2 { -public: - int IsPublic () { return 1; } - void * Create (BOOL loading) { return new XRayMtl(loading); } - const TCHAR * ClassName () { return GetString(IDS_CLASS_NAME); } - SClass_ID SuperClassID () { return MATERIAL_CLASS_ID; } - Class_ID ClassID () { return XRAYMTL_CLASS_ID; } - const TCHAR* Category () { return GetString(IDS_CATEGORY); } - // JBW: new descriptor data accessors added. Note that the - // internal name is hardwired since it must not be localized. - const TCHAR* InternalName () { return _T("S.T.A.L.K.E.R.Mtl"); } // returns fixed parsable name (scripter-visible name) - HINSTANCE HInstance () { return hInstance; } // returns owning module handle -}; - -static XRayMtlClassDesc stdmtl2CD; -ClassDesc2* GetXRayMtlDesc() { return &stdmtl2CD; } - -ShaderParamDlg* XRayMtl::pShaderDlg; -IAutoMParamDlg* XRayMtl::xrayDlg; -IAutoMParamDlg* XRayMtl::masterDlg; -IAutoMParamDlg* XRayMtl::texmapDlg; -IAutoMParamDlg* XRayMtl::extendedDlg; -IAutoMParamDlg* XRayMtl::samplingDlg; -HWND XRayMtl::curHwmEdit; -IMtlParams* XRayMtl::curImp; -Tab XRayMtl::shaderList; -Tab XRayMtl::samplerList; -LPSTRVec XRayMtl::EShaders; -LPSTRVec XRayMtl::CShaders; -LPSTRVec XRayMtl::GameMtls; - -///////////////////////////////////////////////////////////////////////// -// utility function -IC float Min( float a, float b ) { return (a < b) ? a : b; } -IC float Min( float a, float b, float c ) { return (a < b) ? Min(a,c) : Min(b,c); } -IC float Min( Color& c ){ return Min( c.r, c.g, c.b ); } -IC float Max( float a, float b ) { return (a < b) ? b : a; } -IC float Max( float a, float b, float c ) { return (a < b) ? Max( b, c ) : Max(a,c); } -IC float Max( Color& c ){ return Max( c.r, c.g, c.b ); } - -IC float LBound( float x, float min = 0.0f ){ return x < min ? min : x; } -IC Color LBound( Color& c, float min = 0.0f ) -{ return Color( LBound(c.r, min), LBound(c.g, min), LBound(c.b, min) ); } -IC float UBound( float x, float max = 1.0f ){ return x > max ? max : x; } -IC Color UBound( Color& c, float max = 1.0f ) -{ return Color( UBound(c.r,max), UBound(c.g,max), UBound(c.b,max) ); } - -IC float Bound( float x, float min = 0.0f, float max = 1.0f ){ return x < min? min:( x > max? max : x); } -IC Color Bound( Color& c, float min = 0.0f, float max = 1.0f ){ - return Color( Bound(c.r,min,max), Bound(c.r,min,max), Bound(c.r,min,max) ); -} -IC void BoundInPlace( AColor& c , float min = 0.0f, float max = 1.0f ){ - if( c.r > max ) c.r = max; else if( c.r < min ) c.r = min; - if( c.g > max ) c.g = max; else if( c.g < min ) c.g = min; - if( c.b > max ) c.b = max; else if( c.b < min ) c.b = min; - if( c.a > max ) c.a = max; else if( c.a < min ) c.a = min; -} -///////////////////////////////////////////////////////////////////////// - -///////////////////////////////////////////////////////////////////////// -// Material Texture Channels -// -#define MTL_NTEXMAPS 4 - - -// channels ids needed by shader -#define _BUMP 0 -#define _REFLECT 1 -#define _REFRACT 2 -#define _DISPLACE 3 - -// channel names -static int mtlChannelNameIDS[] = { - IDS_DS_BU, IDS_DS_RL, IDS_DS_RR, IDS_DS_DP, -}; - -// what channel corresponds to the stdMat ID's -static int mtlStdIDToChannel[N_ID_CHANNELS] = { -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3 }; - -// internal non-local parsable channel map names -static TCHAR* mtlChannelInternalNames[STD2_NMAX_TEXMAPS] = { - _T("bumpMap"), _T("reflectionMap"), _T("refractionMap"), _T("displacementMap"), - _T(""), _T(""), _T(""), _T(""), - - _T(""), _T(""), _T(""), _T(""), - _T(""), _T(""), _T(""), _T(""), - - _T(""), _T(""), _T(""), _T(""), - _T(""), _T(""), _T(""), _T(""), -}; - -// sized for nmax textures -static int mtlChannelType[STD2_NMAX_TEXMAPS] = { - BUMP_CHANNEL, REFL_CHANNEL, REFR_CHANNEL, DISP_CHANNEL, - UNSUPPORTED_CHANNEL, UNSUPPORTED_CHANNEL, UNSUPPORTED_CHANNEL, UNSUPPORTED_CHANNEL, - - UNSUPPORTED_CHANNEL, UNSUPPORTED_CHANNEL, UNSUPPORTED_CHANNEL, UNSUPPORTED_CHANNEL, - UNSUPPORTED_CHANNEL, UNSUPPORTED_CHANNEL, UNSUPPORTED_CHANNEL, UNSUPPORTED_CHANNEL, - UNSUPPORTED_CHANNEL, UNSUPPORTED_CHANNEL, UNSUPPORTED_CHANNEL, UNSUPPORTED_CHANNEL, - UNSUPPORTED_CHANNEL, UNSUPPORTED_CHANNEL, UNSUPPORTED_CHANNEL, UNSUPPORTED_CHANNEL, -}; - - -static IReshading::ReshadeRequirements chooseReshade[3][3] = { - { IReshading::RR_None, - IReshading::RR_NeedPreshade, - IReshading::RR_NeedReshade }, // RR_None - { IReshading::RR_NeedPreshade, - IReshading::RR_NeedPreshade, - IReshading::RR_NeedPreshade }, // RR_NeedPreshade - { IReshading::RR_NeedReshade, - IReshading::RR_NeedPreshade, - IReshading::RR_NeedReshade }, // RR_NeedReshade -}; - -#define NO_UPDATE -2 - -// parameter setter callback, reflect any ParamBlock-mediated param setting in instance data members. -// Since standard2 keeps many parameters as instance data members, these setter callbacks -// are implemented to reduce changes to existing code - -class ShaderPBAccessor : public PBAccessor -{ -public: - void Set(PB2Value& v, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t) // set from v - { - XRayMtl* m = (XRayMtl*)owner; - switch (id) - { - // use item data to unscramble sorted lists - case std2_shader_type: { - ClassDesc* pCD = XRayMtl::GetShaderCD(v.i); - if (pCD && m->GetShaderIndx() != NO_UPDATE ) - { - m->SwitchShader(pCD); - m->shaderId = v.i; - } - } break; - case std2_shader_by_name: { - for (int i = 0; i < XRayMtl::NumShaders(); i++) - { - ClassDesc* pCD = XRayMtl::GetShaderCD(i); - if (_tcsicmp(pCD->ClassName(), v.s) == 0) - { - m->pb_shader->SetValue(std2_shader_type, 0, i); - break; - } - } - } break; - case std2_wire: - m->SetFlag(NEWSTDMTL_WIRE, v.i); break; - case std2_two_sided: - m->SetFlag(NEWSTDMTL_2SIDE, v.i); break; - case std2_face_map: - m->SetFlag(NEWSTDMTL_FACEMAP, v.i); break; - case std2_faceted: - m->SetFlag(NEWSTDMTL_FACETED, v.i); break; - } - } - - void Get(PB2Value& v, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t, Interval& valid) // get into v - { - XRayMtl* m = (XRayMtl*)owner; - switch (id) - { - case std2_shader_by_name: { - ClassDesc* pCD = XRayMtl::GetShaderCD(m->shaderId); - if (pCD) - v.s = (TCHAR*)pCD->ClassName(); - } break; - } - } -}; -static ShaderPBAccessor shaderPBAccessor; - -// shader rollout dialog proc -class ShaderDlgProc : public ParamMap2UserDlgProc -{ -public: - BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) - { - switch (msg) - { - case WM_INITDIALOG: - // load the shader dropdown - HWND hwndShader = GetDlgItem(hWnd, IDC_SHADER); - SendMessage(hwndShader, CB_RESETCONTENT, 0L, 0L); - for (int i = 0; i < XRayMtl::NumShaders(); i++) { - ClassDesc* pClassD = XRayMtl::GetShaderCD(i); - int n = SendMessage(hwndShader, CB_ADDSTRING, 0L, (LPARAM)(pClassD->ClassName()) ); - SendMessage(hwndShader, CB_SETITEMDATA, n, (LPARAM)pClassD ); - } - return TRUE; - } - return FALSE; - } - void DeleteThis() { } -}; - - -static ShaderDlgProc shaderDlgProc; - -// shader parameters -static ParamBlockDesc2 std2_shader_blk ( std2_shader, _T("newShaderParameters"), 0, &stdmtl2CD, P_AUTO_CONSTRUCT + P_AUTO_UI, SHADER_PB_REF, - //rollout - IDD_DMTL_SHADER4, IDS_KE_SHADER, 0, 0, &shaderDlgProc, - // params - std2_shader_type, _T("shaderType"), TYPE_INT, 0, IDS_JW_SHADERTYPE, - p_default, 3, - p_ui, TYPE_INTLISTBOX, IDC_SHADER, 0, - p_accessor, &shaderPBAccessor, - end, - std2_wire, _T("wire"), TYPE_BOOL, 0, IDS_DS_WIREFRAME, - p_default, FALSE, - p_ui, TYPE_SINGLECHEKBOX, IDC_WIRE, - p_accessor, &shaderPBAccessor, - end, - std2_two_sided, _T("twoSided"), TYPE_BOOL, 0, IDS_JW_TWOSIDED, - p_default, FALSE, - p_ui, TYPE_SINGLECHEKBOX, IDC_2SIDE, - p_accessor, &shaderPBAccessor, - end, - std2_face_map, _T("faceMap"), TYPE_BOOL, 0, IDS_JW_FACEMAP, - p_default, FALSE, - p_ui, TYPE_SINGLECHEKBOX, IDC_FACE_MAP, - p_accessor, &shaderPBAccessor, - end, - std2_faceted, _T("faceted"), TYPE_BOOL, 0, IDS_KE_FACETED, - p_default, FALSE, - p_ui, TYPE_SINGLECHEKBOX, IDC_FACETED, - p_accessor, &shaderPBAccessor, - end, - std2_shader_by_name, _T("shaderByName"), TYPE_STRING, 0, IDS_JW_SHADERBYNAME, - p_accessor, &shaderPBAccessor, - end, - end - ); - -//////////////////////// -// Extended Rollout -class ExtendedPBAccessor : public PBAccessor -{ -public: - void Set(PB2Value& v, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t) // set from v - { - XRayMtl* m = (XRayMtl*)owner; - IParamMap2* map = m->pb_extended ? m->pb_extended->GetMap() : NULL; - - switch (id) - { - case std2_opacity_type: - m->SetFlag(NEWSTDMTL_ADD_TRANSP, v.i == 2); - m->SetFlag(NEWSTDMTL_FILT_TRANSP, v.i == 0); - if (map != NULL) - { - map->Show(std2_filter_color, v.i == 0); - map->Show(std2_ep_filter_map, v.i == 0); - m->UpdateTexmaps(); - m->UpdateLockADTex(FALSE); - } - break; - case std2_opacity: - m->opacity = v.f; - if (m->pShader->GetParamDlg()) - m->pShader->GetParamDlg()->UpdateOpacity(); - break; - case std2_filter_color: - m->filter = *v.p; break; - case std2_falloff_type: - m->SetFlag(NEWSTDMTL_FALLOFF_OUT, v.i == 1); break; - case std2_falloff_amnt: - m->opfall = v.f; break; - case std2_ior: - m->ioRefract = v.f; break; - - case std2_wire_size: - m->wireSize = v.f; break; - case std2_wire_units: - m->SetFlag(NEWSTDMTL_WIRE_UNITS, v.i == 1); break; - - case std2_apply_refl_dimming: - m->dimReflect = v.i; break; - case std2_dim_lvl: - m->dimIntens = v.f; break; - case std2_refl_lvl: - m->dimMult = v.f; break; - } - } -}; - -static ExtendedPBAccessor extendedPBAccessor; - -// extra rollout dialog proc -class ExtraDlgProc : public ParamMap2UserDlgProc -{ -public: - BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) - { - switch (msg) - { - case WM_INITDIALOG:{ - XRayMtl* m = (XRayMtl*)map->GetParamBlock()->GetOwner(); - m->UpdateExtraParams( m->GetShader()->SupportStdParams() ); - return TRUE; - } - } - return FALSE; - } - void DeleteThis() { } -}; - -static ExtraDlgProc extraDlgProc; - -// extended parameters -static ParamBlockDesc2 std2_extended_blk ( std2_extended, _T("extendedParameters"), 0, &stdmtl2CD, P_AUTO_CONSTRUCT + P_AUTO_UI, EXTENDED_PB_REF, - //rollout - IDD_DMTL_EXTRA6, IDS_DS_EXTRA, 0, APPENDROLL_CLOSED, &extraDlgProc, - // params - std2_opacity_type, _T("opacityType"), TYPE_INT, 0, IDS_JW_OPACITYTYPE, - p_default, 0, - p_range, 0, 2, - p_ui, TYPE_RADIO, 3, IDC_TR_SUB2, IDC_TR_SUB, IDC_TR_ADD, - p_accessor, &extendedPBAccessor, - end, - std2_opacity, _T("opacity"), TYPE_PCNT_FRAC, P_ANIMATABLE, IDS_DS_OPACITY, - p_default, 0.0, - p_range, 0.0, 100.0, // UI us in the shader rollout - p_accessor, &extendedPBAccessor, - end, - std2_filter_color, _T("filterColor"), TYPE_RGBA, P_ANIMATABLE, IDS_DS_FILTER, - p_default, Color(0, 0, 0), - p_ui, TYPE_COLORSWATCH, IDC_FILTER_CS, - p_accessor, &extendedPBAccessor, - end, - std2_ep_filter_map, _T("filterMap"), TYPE_TEXMAP, P_SUBTEX + P_NO_AUTO_LABELS, IDS_JW_FILTERMAP, - p_subtexno, ID_FI, - p_ui, TYPE_TEXMAPBUTTON, IDC_MAPON_FI, - p_accessor, &extendedPBAccessor, - end, - std2_falloff_type, _T("opacityFallOffType"), TYPE_INT, 0, IDS_JW_FALLOFFTYPE, - p_default, 0, - p_range, 0, 1, - p_ui, TYPE_RADIO, 2, IDC_TF_IN, IDC_TF_OUT, - p_accessor, &extendedPBAccessor, - end, - std2_falloff_amnt, _T("opacityFallOff"), TYPE_PCNT_FRAC, P_ANIMATABLE, IDS_DS_FALLOFF, - p_default, 0.0, - p_range, 0.0, 100.0, - p_ui, TYPE_SPINNER, EDITTYPE_INT, IDC_TF_EDIT, IDC_TF_SPIN, 0.1, - p_accessor, &extendedPBAccessor, - end, - std2_ior, _T("ior"), TYPE_FLOAT, P_ANIMATABLE, IDS_DS_IOR, - p_default, 1.5, - p_range, 0.0, 10.0, - p_ui, TYPE_SPINNER, EDITTYPE_FLOAT, IDC_IOR_EDIT, IDC_IOR_SPIN, 0.01, - p_accessor, &extendedPBAccessor, - end, - std2_wire_size, _T("wireSize"), TYPE_FLOAT, P_ANIMATABLE, IDS_DS_WIRESZ, - p_default, 1.0, - p_range, 0.0, 100.0, - p_ui, TYPE_SPINNER, EDITTYPE_FLOAT, IDC_WIRE_EDIT, IDC_WIRE_SPIN, 1.0, - p_accessor, &extendedPBAccessor, - end, - std2_wire_units, _T("wireUnits"), TYPE_INT, 0, IDS_JW_WIREUNITS, - p_default, 0, - p_range, 0, 1, - p_ui, TYPE_RADIO, 2, IDC_PIXELS, IDC_UNITS, - p_accessor, &extendedPBAccessor, - end, - std2_apply_refl_dimming, _T("applyReflectionDimming"), TYPE_BOOL, 0, IDS_JW_APPLYREFDIM, - p_default, FALSE, - p_ui, TYPE_SINGLECHEKBOX, IDC_DIM_REFL, - p_accessor, &extendedPBAccessor, - end, - std2_dim_lvl, _T("dimLevel"), TYPE_FLOAT, P_ANIMATABLE, IDS_DS_DIMLEV, - p_default, 0.0, - p_range, 0.0, 1.0, - p_ui, TYPE_SPINNER, EDITTYPE_FLOAT, IDC_DIM_AMT, IDC_DIM_AMTSPIN, 0.01, - p_accessor, &extendedPBAccessor, - end, - std2_refl_lvl, _T("reflectionLevel"), TYPE_FLOAT, P_ANIMATABLE, IDS_DS_DIMMULT, - p_default, 1.0, - p_range, 0.1, 10.0, - p_ui, TYPE_SPINNER, EDITTYPE_FLOAT, IDC_DIM_MULT, IDC_DIM_MULTSPIN, 0.01, - p_accessor, &extendedPBAccessor, - end, - end - ); - -/////////////////////////////////////////////////////////////////////////////////// -// Sampling Rollout -// -class SamplingPBAccessor : public PBAccessor -{ -public: - void Set(PB2Value& v, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t) // set from v - { - XRayMtl* m = (XRayMtl*)owner; - macroRecorder->Disable(); - switch (id) - { - case std2_ssampler: { - ClassDesc* pCD = XRayMtl::GetSamplerCD(v.i); - if (pCD && m->GetSamplerIndx() != NO_UPDATE ) - { - m->SwitchSampler(pCD); - // m->samplerId = v.i; - } - } break; - case std2_ssampler_by_name: { - for (int i = 0; i < XRayMtl::NumSamplers(); i++) - { - ClassDesc* pCD = XRayMtl::GetSamplerCD(i); - if (_tcsicmp(pCD->ClassName(), v.s) == 0) - { - m->pb_sampling->SetValue(std2_ssampler, 0, i); - break; - } - } - } break; - case std2_ssampler_qual: - m->GetPixelSampler()->SetQuality( v.f ); break; - case std2_ssampler_enable: - m->GetPixelSampler()->SetEnable( v.i ); - m->SetFlag(NEWSTDMTL_SSAMP_ON, v.i); break; - - case std2_ssampler_adapt_threshold: - m->GetPixelSampler()->SetAdaptiveThreshold( v.f ); break; - case std2_ssampler_adapt_on:{ - m->GetPixelSampler()->SetAdaptiveOn( v.i ); - IParamMap2* map = m->pb_sampling ? m->pb_sampling->GetMap() : NULL; - if ( map ) { - map->Enable(std2_ssampler_adapt_threshold, v.i ); - } - } break; - case std2_ssampler_subsample_tex_on: - m->GetPixelSampler()->SetTextureSuperSampleOn( v.i ); break; - case std2_ssampler_advanced: { - IParamMap2* map = m->pb_sampling ? m->pb_sampling->GetMap() : NULL; - HWND hwnd = ( map ) ? map->GetHWnd() : NULL; - m->GetPixelSampler()->ExecuteParamDialog( hwnd, m ); - } break; - case std2_ssampler_param0: - m->GetPixelSampler()->SetOptionalParam( 0, v.f ); break; - case std2_ssampler_param1: - m->GetPixelSampler()->SetOptionalParam( 1, v.f ); break; - - } - macroRecorder->Enable(); - } - void Get(PB2Value& v, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t, Interval& valid) // get into v - { - XRayMtl* m = (XRayMtl*)owner; - switch (id) - { - case std2_ssampler_by_name: { - ClassDesc* pCD = XRayMtl::GetSamplerCD(m->samplerId); - if (pCD) - v.s = (TCHAR*)pCD->ClassName(); - } break; - } - } -}; - - -static SamplingPBAccessor samplingPBAccessor; - -// sampling rollout dialog proc - -class SamplingDlgProc : public ParamMap2UserDlgProc -{ -public: - BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) - { - switch (msg) - { - case WM_INITDIALOG: - // load the sampler dropdown - HWND hwndSamplerCombo = GetDlgItem(hWnd, IDC_PIX_SAMPLER); - SendMessage(hwndSamplerCombo, CB_RESETCONTENT, 0L, 0L); - for (int i = 0; i < XRayMtl::NumSamplers(); i++) { - ClassDesc* pClassD = XRayMtl::GetSamplerCD(i); - int n = SendMessage(hwndSamplerCombo, CB_ADDSTRING, 0L, (LPARAM)(pClassD->ClassName()) ); - SendMessage(hwndSamplerCombo, CB_SETITEMDATA, n, (LPARAM)pClassD ); - } - XRayMtl* m = (XRayMtl*)map->GetParamBlock()->GetOwner(); - // Class_ID sampId = m->GetPixelSampler()->ClassID(); - - // JohnW: Are these still necessary? removed setindx 3/23/99 ke - macroRecorder->Disable(); - // m->SetSamplerIndx( m->FindSampler( sampId ) ); - m->UpdateSamplingParams(); - macroRecorder->Enable(); - return TRUE; - } - return FALSE; - } - void DeleteThis() { } -}; - -static SamplingDlgProc samplingDlgProc; - -// supersampling parameters -static ParamBlockDesc2 std2_sampling_blk ( std2_sampling, _T("samplingParameters"), 0, &stdmtl2CD, P_AUTO_CONSTRUCT + P_AUTO_UI, SAMPLING_PB_REF, - //rollout - IDD_DMTL_SAMPLING3, IDS_KE_SAMPLING, 0, APPENDROLL_CLOSED, &samplingDlgProc, - // params - std2_ssampler, _T("sampler"), TYPE_INT, 0, IDS_JW_PIXELSAMPLER, - p_default, 0, - p_ui, TYPE_INTLISTBOX, IDC_PIX_SAMPLER, 0, - p_accessor, &samplingPBAccessor, - end, - std2_ssampler_qual, _T("samplerQuality"), TYPE_FLOAT, P_ANIMATABLE, IDS_JW_SAMPLERQUAL, - p_default, 0.5, - p_range, 0.0, 1.0, - p_ui, TYPE_SPINNER, EDITTYPE_FLOAT, IDC_SAMPLEQUALITY_EDIT, IDC_SAMPLEQUALITY_SPIN, 0.01, - p_accessor, &samplingPBAccessor, - end, - std2_ssampler_enable, _T("samplerEnable"), TYPE_BOOL, P_ANIMATABLE, IDS_JW_SAMPLERENABLE, - p_default, FALSE, - p_ui, TYPE_SINGLECHEKBOX, IDC_SUPER_SAMP, - p_accessor, &samplingPBAccessor, - end, - std2_ssampler_adapt_threshold, _T("samplerAdaptThreshold"), TYPE_FLOAT, 0, IDS_KE_SAMPLERADAPTTHRESH, - p_default, 0.1, - p_range, 0.0, 1.0, - p_ui, TYPE_SPINNER, EDITTYPE_FLOAT, IDC_THRESHOLD_EDIT, IDC_THRESHOLD_SPIN, 0.001, - p_accessor, &samplingPBAccessor, - end, - std2_ssampler_adapt_on, _T("samplerAdaptOn"), TYPE_BOOL, 0, IDS_KE_SAMPLERADAPTON, - p_default, TRUE, - p_ui, TYPE_SINGLECHEKBOX, IDC_ADAPT_ON, - p_accessor, &samplingPBAccessor, - end, - std2_ssampler_subsample_tex_on, _T("subSampleTextureOn"), TYPE_BOOL, 0, IDS_KE_SUBSAMPLE_TEX_ON, - p_default, TRUE, - p_ui, TYPE_SINGLECHEKBOX, IDC_SAMPLE_TEX, - p_accessor, &samplingPBAccessor, - end, - std2_ssampler_advanced, _T("samplerAdvancedOptions"), TYPE_BOOL, 0, IDS_KE_SAMPLERADVANCED, - p_default, TRUE, - p_ui, TYPE_SINGLECHEKBOX, IDC_ADVANCED_BUTTON, - p_accessor, &samplingPBAccessor, - end, - std2_ssampler_by_name, _T("samplerByName"), TYPE_STRING, 0, IDS_JW_SAMPLERBYNAME, - p_accessor, &samplingPBAccessor, - end, - std2_ssampler_param0, _T("UserParam0"), TYPE_FLOAT, 0, IDS_KE_SAMPLER_PARAM0, - p_default, 0.0, - p_range, 0.0, 1.0, - p_ui, TYPE_SPINNER, EDITTYPE_FLOAT, IDC_PARAM0_EDIT, IDC_PARAM0_SPIN, 0.01, - p_accessor, &samplingPBAccessor, - end, - std2_ssampler_param1, _T("UserParam1"), TYPE_FLOAT, 0, IDS_KE_SAMPLER_PARAM1, - p_default, 0.0, - p_range, 0.0, 1.0, - p_ui, TYPE_SPINNER, EDITTYPE_FLOAT, IDC_PARAM1_EDIT, IDC_PARAM1_SPIN, 0.01, - p_accessor, &samplingPBAccessor, - end, - end - ); - -class XRayPBAccessor : public PBAccessor -{ -public: - void Set(PB2Value& v, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t) // set from v - { - XRayMtl* m = (XRayMtl*)owner; - switch (id) - { - case std2_eshader_type: - m->eshaderId = (m->GetEShader(v.i))?v.i:-1; - break; - case std2_cshader_type: - m->cshaderId = (m->GetCShader(v.i))?v.i:-1; - break; - case std2_gamemtl_type: - m->gamemtlId = (m->GetGameMtl(v.i))?v.i:-1; - break; - case std2_eshader_by_name: { - int idx = m->FindEShader(v.s); - if (idx>=0) m->pb_xray->SetValue(std2_eshader_type, 0, idx); - }break; - case std2_cshader_by_name: { - int idx = m->FindCShader(v.s); - if (idx>=0) m->pb_xray->SetValue(std2_cshader_type, 0, idx); - }break; - case std2_gamemtl_by_name: { - int idx = m->FindGameMtl(v.s); - if (idx>=0) m->pb_xray->SetValue(std2_gamemtl_type, 0, idx); - }break; - } - } - - void Get(PB2Value& v, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t, Interval& valid) // get into v - { - XRayMtl* m = (XRayMtl*)owner; - switch (id) - { - case std2_eshader_by_name:{ - v.s = m->GetEShader(m->eshaderId); - }break; - case std2_cshader_by_name:{ - v.s = m->GetCShader(m->cshaderId); - }break; - case std2_gamemtl_by_name:{ - v.s = m->GetGameMtl(m->gamemtlId); - }break; - } - } -}; - -static XRayPBAccessor xrayPBAccessor; - -// shader rollout dialog proc -class XRayDlgProc : public ParamMap2UserDlgProc -{ -public: - BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) - { - switch (msg) - { - case WM_INITDIALOG:{ - XRayMtl* m = (XRayMtl*)map->GetParamBlock()->GetOwner(); - // load the shader dropdown - { - HWND hwndEShader = GetDlgItem(hWnd, IDC_ESHADER); - SendMessage(hwndEShader, CB_RESETCONTENT, 0L, 0L); - for (DWORD i = 0; i < XRayMtl::EShaders.size(); i++) - { - int n = SendMessage(hwndEShader, CB_ADDSTRING, 0L, (LPARAM)m->GetEShader(i)); - SendMessage(hwndEShader, CB_SETITEMDATA, n, (LPARAM)i); - } - } - { - HWND hwndEShader = GetDlgItem(hWnd, IDC_CSHADER); - SendMessage(hwndEShader, CB_RESETCONTENT, 0L, 0L); - for (DWORD i = 0; i < XRayMtl::CShaders.size(); i++) - { - int n = SendMessage(hwndEShader, CB_ADDSTRING, 0L, (LPARAM)m->GetCShader(i)); - SendMessage(hwndEShader, CB_SETITEMDATA, n, (LPARAM)i); - } - } - { - HWND hwndEShader = GetDlgItem(hWnd, IDC_GAMEMTL); - SendMessage(hwndEShader, CB_RESETCONTENT, 0L, 0L); - for (DWORD i = 0; i < XRayMtl::GameMtls.size(); i++) - { - int n = SendMessage(hwndEShader, CB_ADDSTRING, 0L, (LPARAM)m->GetGameMtl(i)); - SendMessage(hwndEShader, CB_SETITEMDATA, n, (LPARAM)i); - } - } - }return TRUE; - } - return FALSE; - } - void DeleteThis() { } -}; - - -static XRayDlgProc xrayDlgProc; - -// shader parameters -static ParamBlockDesc2 std2_xray_blk ( std2_xray, _T("Parameters"), 0, &stdmtl2CD, P_AUTO_CONSTRUCT + P_AUTO_UI, XRAY_PB_REF, - //rollout - IDD_DMTL_XRAY, IDS_KE_XRAY, 0, APPENDROLL_CLOSED, &xrayDlgProc, - // params - std2_eshader_type, _T("EShaderType"), TYPE_INT, 0, IDS_JW_ESHADERTYPE, - p_default, 0, - p_ui, TYPE_INTLISTBOX, IDC_ESHADER, 0, - p_accessor, &xrayPBAccessor, - end, - std2_cshader_type, _T("CShaderType"), TYPE_INT, 0, IDS_JW_CSHADERTYPE, - p_default, 0, - p_ui, TYPE_INTLISTBOX, IDC_CSHADER, 0, - p_accessor, &xrayPBAccessor, - end, - std2_gamemtl_type, _T("GameMtlType"), TYPE_INT, 0, IDS_JW_GAMEMTLTYPE, - p_default, 0, - p_ui, TYPE_INTLISTBOX, IDC_GAMEMTL, 0, - p_accessor, &xrayPBAccessor, - end, - std2_eshader_by_name, _T("EShaderByName"),TYPE_STRING, 0, IDS_JW_ESHADERBYNAME, - p_accessor, &xrayPBAccessor, - end, - std2_cshader_by_name, _T("CShaderByName"),TYPE_STRING, 0, IDS_JW_CSHADERBYNAME, - p_accessor, &xrayPBAccessor, - end, - std2_gamemtl_by_name, _T("GameMtlByName"),TYPE_STRING, 0, IDS_JW_GAMEMTLBYNAME, - p_accessor, &xrayPBAccessor, - end, - end - ); - -//////////////////////////////////////////end, sampling -static HIMAGELIST hLockButtons = NULL; - -// mjm - begin - 5.10.99 -class ResourceDelete -{ -public: - ResourceDelete() {} - ~ResourceDelete() { if (hLockButtons) ImageList_Destroy(hLockButtons); } -}; - -static ResourceDelete theResourceDelete; -// mjm - end - -static void SetupPadLockButton(HWND hWnd, int id, BOOL check) -{ - ICustButton *iBut; - iBut = GetICustButton(GetDlgItem(hWnd, id)); - iBut->SetImage(hLockButtons, 2, 2, 2, 2, 16, 15); - iBut->SetType(CBT_CHECK); - ReleaseICustButton(iBut); -} - -static void LoadXRayMtlResources() -{ - static BOOL loaded=FALSE; - if (loaded) return; - loaded = TRUE; - HBITMAP hBitmap, hMask; - hLockButtons = ImageList_Create(16, 15, TRUE, 2, 0); - hBitmap = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_DMTL_BUTTONS)); - hMask = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_DMTL_MASKBUTTONS)); - ImageList_Add(hLockButtons, hBitmap, hMask); - DeleteObject(hBitmap); - DeleteObject(hMask); -} - -class StdMapsDlgProc : public ParamMap2UserDlgProc -{ -public: - BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) - { - XRayMtl* m = (XRayMtl*)map->GetParamBlock()->GetOwner(); - switch (msg) - { - case WM_INITDIALOG: - // conditionally set map amount spinner ranges and padlock button images - LoadXRayMtlResources(); - int bumpChan = m->stdIDToChannel[ ID_BU ]; - int dispChan = m->stdIDToChannel[ ID_DP ]; - int slevChan = m->stdIDToChannel[ ID_SS ]; - - for (int i = 0; i < STD2_NMAX_TEXMAPS; i++) - { - if (i == bumpChan || i == dispChan || i == slevChan) - map->SetRange(std2_map_amnts, -999, 999, i); - else - map->SetRange(std2_map_amnts, 0, 100, i); - } - - SetupPadLockButton(hWnd, IDC_LOCK_TEX01, TRUE); - macroRecorder->Disable(); - { - KillRefmsg kill( m->killRefmsg ); - m->UpdateLockADTex(TRUE); - } - macroRecorder->Enable(); - return TRUE; - } - return FALSE; - } - - void DeleteThis() { } -}; - -static StdMapsDlgProc stdMapsDlgProc; - -static BOOL IsMultipleInstanced(XRayMtl *m, Texmap *t) { - int cnt=0; - for (int i = 0; i < STD2_NMAX_TEXMAPS; i++) { - if (m->maps->txmap[i].map == t) - cnt++; - } - return (cnt>1)?TRUE:FALSE; -} - -#define BUMP_DEF_AMT .30f - -class MapsPBAccessor : public PBAccessor -{ -public: - // the texture maps are stored, as before, in the Texmaps structure, so the parameters in the - // pb_map block act as 'views' onto this structure. Any setting of map info (say from the scripter) - // is reflected here in the Texmaps structure, and any getting of map info is extracted here from - // this structure. - - // I hope to be able to host the texmap stuff entirely in the paramblock when I get assignable subanim - // numbers supported in PB2's (so that the map, map enable and map amount Tab<>s are number in interleaved row order) - void Set(PB2Value& v, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t) // set from v - { - XRayMtl* m = (XRayMtl*)owner; - switch (id) - { - case std2_map_enables: - m->maps->txmap[tabIndex].mapOn = v.i; - m->UpdateMapButtons(); - m->UpdateExtendedMapButtons(); - break; - - case std2_maps: - { - Texmap* tex = (Texmap*)v.r; - m->maps->ReplaceReference(2*tabIndex+1, tex); - if (tex != NULL) { - macroRecorder->Disable(); - m->EnableMap(tabIndex, TRUE); - macroRecorder->Enable(); - if (m->maps->txmap[tabIndex].amtCtrl == NULL) { - m->maps->ReplaceReference(2*tabIndex, NewDefaultFloatController()); - m->maps->txmap[tabIndex].amtCtrl->SetValue(TimeValue(0), &m->maps->txmap[tabIndex].amount); - } - } else { - if (m->maps->txmap[tabIndex].amtCtrl != NULL) - m->maps->DeleteReference(2*tabIndex); - macroRecorder->Disable(); - m->SetTexmapAmt(tabIndex, ((tabIndex == m->stdIDToChannel[ID_BU]) ? BUMP_DEF_AMT : 1.0f), TimeValue(0)); - m->EnableMap(tabIndex, FALSE); - macroRecorder->Enable(); - } - if (tex && (tabIndex == m->stdIDToChannel[ID_RL]|| tabIndex == m->stdIDToChannel[ID_RR]) ){ - if (!IsMultipleInstanced(m,tex)) { //DS 4/26/99: keep settings for instanced map - UVGen* uvg0 = tex->GetTheUVGen(); - if (uvg0 && uvg0->IsStdUVGen()) { - StdUVGen *uvg = (StdUVGen*)uvg0; - uvg->InitSlotType(MAPSLOT_ENVIRON); - uvg->SetCoordMapping(UVMAP_SPHERE_ENV); - } - } - } - m->UpdateMapButtons(); - m->UpdateExtendedMapButtons(); - - break; - } - - case std2_map_amnts: - { - // Kill the refmessage from the map, since it will - // be fixed later by the ref message for std2_map_amnts. - KillRefmsg kill(m->killRefmsg); - if (m->maps->txmap[tabIndex].amtCtrl) - m->maps->txmap[tabIndex].amtCtrl->SetValue(t, &v.f); - m->maps->txmap[tabIndex].amount = v.f; - if (tabIndex == m->stdIDToChannel[ID_BU]) - m->mInRQ = chooseReshade[m->mInRQ][IReshading::RR_NeedPreshade]; - } - break; - - case std2_mp_ad_texlock: - m->SetFlag(NEWSTDMTL_LOCK_ADTEX, v.i); - m->UpdateLockADTex(TRUE); - // removed to avoid multiple viewport redraws on change shader - // m->UpdateMtlDisplay(); - break; - } - } - - void Get(PB2Value& v, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t, Interval& valid) // set from v - { - XRayMtl* m = (XRayMtl*)owner; - switch (id) - { - case std2_map_enables: - v.i = m->maps->txmap[tabIndex].mapOn; break; - case std2_maps: - v.r = m->maps->txmap[tabIndex].map; break; - case std2_map_amnts: - if (m->maps->txmap[tabIndex].amtCtrl) - m->maps->txmap[tabIndex].amtCtrl->GetValue(t, &v.f, valid); - else - v.f = m->maps->txmap[tabIndex].amount; - break; - } - } - - // this allows 'virtual' parameters to refelect key state if in spinners and the underlying - // source parameter is animatable (map amount in this case) - BOOL KeyFrameAtTime(ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t) - { - if (id == std2_map_amnts) - return ((XRayMtl*)owner)->AmtKeyAtTime(tabIndex, t); - else - return FALSE; - } - -}; -static MapsPBAccessor mapsPBAccessor; - - -// std_maps parameters -static ParamBlockDesc2 std_maps_blk ( std_maps, _T("maps"), 0, &stdmtl2CD, P_AUTO_CONSTRUCT + P_AUTO_UI, MAPS_PB_REF, - //rollout - IDD_DMTL_TEXMAP4, IDS_DS_TEXMAP, 0, APPENDROLL_CLOSED, &stdMapsDlgProc, - // params - std2_map_enables, _T("mapEnables"), TYPE_BOOL_TAB, STD2_NMAX_TEXMAPS, 0, IDS_JW_MAPENABLES, - p_default, FALSE, - p_ui, TYPE_SINGLECHEKBOX, IDC_USEMAP_0, IDC_USEMAP_1, IDC_USEMAP_2, IDC_USEMAP_3, - IDC_USEMAP_4, IDC_USEMAP_5, IDC_USEMAP_6, IDC_USEMAP_7, - IDC_USEMAP_8, IDC_USEMAP_9, IDC_USEMAP_10, IDC_USEMAP_11, - IDC_USEMAP_12, IDC_USEMAP_13, IDC_USEMAP_14, IDC_USEMAP_15, - IDC_USEMAP_16, IDC_USEMAP_17, IDC_USEMAP_18, IDC_USEMAP_19, - IDC_USEMAP_20, IDC_USEMAP_21, IDC_USEMAP_22, IDC_USEMAP_23, - p_accessor, &mapsPBAccessor, - end, - std2_maps, _T("maps"), TYPE_TEXMAP_TAB, STD2_NMAX_TEXMAPS, P_NO_REF, IDS_JW_MAPS, - p_ui, TYPE_TEXMAPBUTTON, IDC_MAP_0, IDC_MAP_1, IDC_MAP_2, IDC_MAP_3, - IDC_MAP_4, IDC_MAP_5, IDC_MAP_6, IDC_MAP_7, - IDC_MAP_8, IDC_MAP_9, IDC_MAP_10, IDC_MAP_11, - IDC_MAP_12, IDC_MAP_13, IDC_MAP_14, IDC_MAP_15, - IDC_MAP_16, IDC_MAP_17, IDC_MAP_18, IDC_MAP_19, - IDC_MAP_20, IDC_MAP_21, IDC_MAP_22, IDC_MAP_23, - p_accessor, &mapsPBAccessor, - end, - std2_map_amnts, _T("mapAmounts"), TYPE_PCNT_FRAC_TAB, STD2_NMAX_TEXMAPS, 0, IDS_JW_MAPAMOUNTS, - p_default, 1.0, // default is given in internal units JBW 10.8.99 - p_range, 0.0, 100.0, - p_ui, TYPE_SPINNER, EDITTYPE_INT, IDC_AMTEDIT_0, IDC_AMTSPIN_0, IDC_AMTEDIT_1, IDC_AMTSPIN_1, - IDC_AMTEDIT_2, IDC_AMTSPIN_2, IDC_AMTEDIT_3, IDC_AMTSPIN_3, - IDC_AMTEDIT_4, IDC_AMTSPIN_4, IDC_AMTEDIT_5, IDC_AMTSPIN_5, - IDC_AMTEDIT_6, IDC_AMTSPIN_6, IDC_AMTEDIT_7, IDC_AMTSPIN_7, - IDC_AMTEDIT_8, IDC_AMTSPIN_8, IDC_AMTEDIT_9, IDC_AMTSPIN_9, - IDC_AMTEDIT_10, IDC_AMTSPIN_10, IDC_AMTEDIT_11, IDC_AMTSPIN_11, - IDC_AMTEDIT_12, IDC_AMTSPIN_12, IDC_AMTEDIT_13, IDC_AMTSPIN_13, - IDC_AMTEDIT_14, IDC_AMTSPIN_14, IDC_AMTEDIT_15, IDC_AMTSPIN_15, - IDC_AMTEDIT_16, IDC_AMTSPIN_16, IDC_AMTEDIT_17, IDC_AMTSPIN_17, - IDC_AMTEDIT_18, IDC_AMTSPIN_18, IDC_AMTEDIT_19, IDC_AMTSPIN_19, - IDC_AMTEDIT_20, IDC_AMTSPIN_20, IDC_AMTEDIT_21, IDC_AMTSPIN_21, - IDC_AMTEDIT_22, IDC_AMTSPIN_22, IDC_AMTEDIT_23, IDC_AMTSPIN_23, - 1.0, - p_accessor, &mapsPBAccessor, - end, - std2_mp_ad_texlock, _T("adTextureLock"), TYPE_BOOL, 0, IDS_JW_ADTEXLOCK, - p_default, TRUE, - p_ui, TYPE_CHECKBUTTON, IDC_LOCK_TEX01, - p_accessor, &mapsPBAccessor, - end, - end - ); - -#ifndef DESIGN_VER -// std2_dynamics parameters -static ParamBlockDesc2 std2_dynamics_blk ( std2_dynamics, _T("dynamicsParameters"), 0, &stdmtl2CD, P_AUTO_CONSTRUCT + P_AUTO_UI, DYNAMICS_PB_REF, - //rollout - IDD_DMTL_DYNAM, IDS_DS_DYNAMICS, 0, APPENDROLL_CLOSED, NULL, - // params - std2_bounce, _T("bounce"), TYPE_FLOAT, P_ANIMATABLE, IDS_DS_BOUNCE, - p_default, 1.0, - p_range, 0.0, 1.0, - p_ui, TYPE_SPINNER, EDITTYPE_FLOAT, IDC_BOUNCE_EDIT, IDC_BOUNCE_SPIN, 0.01, - end, - std2_static_friction, _T("staticFriction"), TYPE_FLOAT, P_ANIMATABLE, IDS_DS_STATFRIC, - p_default, 0.0, - p_range, 0.0, 1.0, - p_ui, TYPE_SPINNER, EDITTYPE_FLOAT, IDC_STATFRIC_EDIT, IDC_STATFRIC_SPIN, 0.01, - end, - std2_sliding_friction, _T("slidingFriction"), TYPE_FLOAT, P_ANIMATABLE, IDS_DS_SLIDFRIC, - p_default, 0.0, - p_range, 0.0, 1.0, - p_ui, TYPE_SPINNER, EDITTYPE_FLOAT, IDC_SLIDFRIC_EDIT, IDC_SLIDFRIC_SPIN, 0.01, - end, - end - ); -#endif - -// Old Parameter block indices, kept around for old-version loading -#define PB_AMBIENT_O 0 -#define PB_DIFFUSE_O 1 -#define PB_SPECULAR_O 2 -#define PB_SHININESS_O 3 -#define PB_SHIN_STR_O 4 -#define PB_SELFI_O 5 -#define PB_OPAC_O 6 -#define PB_OPFALL_O 7 -#define PB_FILTER_O 8 -#define PB_WIRESZ_O 9 -#define PB_IOR_O 10 -#define PB_BOUNCE_O 11 -#define PB_STATFRIC_O 12 -#define PB_SLIDFRIC_O 13 -#define PB_DIMLEV_O 14 -#define PB_DIMMULT_O 15 -#define PB_SOFTEN_O 16 -#define PB_SELFILLUM_CLR_O 17 - -// Ver. 10 Parameter block indices -#define PB_OPAC 0 -#define PB_OPFALL 1 -#define PB_FILTER 2 -#define PB_WIRESZ 3 -#define PB_IOR 4 -#define PB_BOUNCE 5 -#define PB_STATFRIC 6 -#define PB_SLIDFRIC 7 -#define PB_DIMLEV 8 -#define PB_DIMMULT 9 - -#define CURRENT_NEWSTDMTL_VERSION 12 -#define FINAL_PARAMBLOCK_v1_VERSION 10 - -#define NPARAMS 10 -#define XRAYMTL_PBVERSION 1 -#define NEWSTDMTL_PBVERSION 9 - -// conversion descriptors for old ParamBlocks to ParamBlock2s -// here we have two version descriptors, one for parameters going into -// new pb_extended pblock, the other for params going into the -// new pb_dynamics block. The -1 ID's below indicate no copy, -// so we use to update calls to distribute old params from one block -// into two new blocks - -static ParamBlockDescID extVer10[] = { - { TYPE_FLOAT, NULL, TRUE, std2_opacity }, // opacity - { TYPE_FLOAT, NULL, TRUE, std2_falloff_amnt }, // opfalloff - { TYPE_RGBA, NULL, TRUE, std2_filter_color }, // filter - { TYPE_FLOAT, NULL, TRUE, std2_wire_size }, // wireSize - { TYPE_FLOAT, NULL, TRUE, std2_ior }, // index of refraction - { TYPE_FLOAT, NULL, TRUE, -1 }, // bounce - { TYPE_FLOAT, NULL, TRUE, -1 }, // static friction - { TYPE_FLOAT, NULL, TRUE, -1 }, // sliding friction - { TYPE_FLOAT, NULL, TRUE, std2_dim_lvl }, // reflect dim level - { TYPE_FLOAT, NULL, TRUE, std2_refl_lvl }, // reflect dim multiplier -}; - -static ParamBlockDescID dynVer10[] = { - { TYPE_FLOAT, NULL, TRUE, -1 }, // opacity - { TYPE_FLOAT, NULL, TRUE, -1 }, // opfalloff - { TYPE_RGBA, NULL, TRUE, -1 }, // filter - { TYPE_FLOAT, NULL, TRUE, -1 }, // wireSize - { TYPE_FLOAT, NULL, TRUE, -1 }, // index of refraction - { TYPE_FLOAT, NULL, TRUE, std2_bounce }, // bounce - { TYPE_FLOAT, NULL, TRUE, std2_static_friction }, // static friction - { TYPE_FLOAT, NULL, TRUE, std2_sliding_friction }, // sliding friction - { TYPE_FLOAT, NULL, TRUE, -1 }, // reflect dim level - { TYPE_FLOAT, NULL, TRUE, -1 }, // reflect dim multiplier -}; - -// v10 Param Block Descriptor -static ParamBlockDescID stdmtl2PB[ NPARAMS ] = { - { TYPE_FLOAT, NULL, TRUE, 7 }, // opacity - { TYPE_FLOAT, NULL, TRUE, 8 }, // opfalloff - { TYPE_RGBA, NULL, TRUE, 9 }, // filter - { TYPE_FLOAT, NULL, TRUE, 10 }, // wireSize - { TYPE_FLOAT, NULL, TRUE, 11 }, // index of refraction - { TYPE_FLOAT, NULL, TRUE, 12 }, // bounce - { TYPE_FLOAT, NULL, TRUE, 13 }, // static friction - { TYPE_FLOAT, NULL, TRUE, 14 }, // sliding friction - { TYPE_FLOAT, NULL, TRUE, 15 }, // reflect dim level - { TYPE_FLOAT, NULL, TRUE, 16 }, // reflect dim multiplier -}; - -#define NPARAMS_O 17 - -//Old (2.5 and before) Param Block Descriptor -static ParamBlockDescID stdmtlPB[ NPARAMS_O ] = { - { TYPE_RGBA, NULL, TRUE, 1 }, // ambient - { TYPE_RGBA, NULL, TRUE, 2 }, // diffuse - { TYPE_RGBA, NULL, TRUE, 3 }, // specular - { TYPE_FLOAT, NULL, TRUE, 4 }, // shininess - { TYPE_FLOAT, NULL, TRUE, 5 }, // shini_strength - { TYPE_FLOAT, NULL, TRUE, 6 }, // self-illum - { TYPE_FLOAT, NULL, TRUE, 7 }, // opacity - { TYPE_FLOAT, NULL, TRUE, 8 }, // opfalloff - { TYPE_RGBA, NULL, TRUE, 9 }, // filter - { TYPE_FLOAT, NULL, TRUE, 10 }, // wireSize - { TYPE_FLOAT, NULL, TRUE, 11 }, // index of refraction - { TYPE_FLOAT, NULL, TRUE, 12 }, // bounce - { TYPE_FLOAT, NULL, TRUE, 13 }, // static friction - { TYPE_FLOAT, NULL, TRUE, 14 }, // sliding friction - { TYPE_FLOAT, NULL, TRUE, 15 }, // reflect dim level - { TYPE_FLOAT, NULL, TRUE, 16 }, // reflect dim multiplier - { TYPE_FLOAT, NULL, TRUE, 17 } // soften -}; - -// Descriptor for mapping old (2.5 and before) shader parameters into new stdShader PB2's -// Shader::ConvertParamBlock() uses this to extract old mtl shader params into new Shader -static ParamBlockDescID stdmtlPB2[ NPARAMS_O ] = { - { TYPE_RGBA, NULL, TRUE, shdr_ambient }, // ambient - { TYPE_RGBA, NULL, TRUE, shdr_diffuse }, // diffuse - { TYPE_RGBA, NULL, TRUE, shdr_specular }, // specular - { TYPE_FLOAT, NULL, TRUE, shdr_glossiness }, // shininess - { TYPE_FLOAT, NULL, TRUE, shdr_spec_lvl }, // shini_strength - { TYPE_FLOAT, NULL, TRUE, shdr_self_illum_amnt }, // self-illum - { TYPE_FLOAT, NULL, TRUE, -1 }, // opacity - { TYPE_FLOAT, NULL, TRUE, -1 }, // opfalloff - { TYPE_RGBA, NULL, TRUE, -1 }, // filter - { TYPE_FLOAT, NULL, TRUE, -1 }, // wireSize - { TYPE_FLOAT, NULL, TRUE, -1 }, // index of refraction - { TYPE_FLOAT, NULL, TRUE, -1 }, // bounce - { TYPE_FLOAT, NULL, TRUE, -1 }, // static friction - { TYPE_FLOAT, NULL, TRUE, -1 }, // sliding friction - { TYPE_FLOAT, NULL, TRUE, -1 }, // reflect dim level - { TYPE_FLOAT, NULL, TRUE, -1 }, // reflect dim multiplier - { TYPE_FLOAT, NULL, TRUE, shdr_soften } // soften -}; -#define NUMOLDVER 1 -static ParamVersionDesc oldXRayMtlVersions[ NUMOLDVER ] = { - ParamVersionDesc(stdmtl2PB, NPARAMS, 0), -}; - -#define NEWSTDMTL_NUMOLDVER 9 - -static ParamVersionDesc oldNewStdMtlVersions[ NEWSTDMTL_NUMOLDVER+1 ] = { - ParamVersionDesc(stdmtlPB, 8, 0), - ParamVersionDesc(stdmtlPB, 9, 1), - ParamVersionDesc(stdmtlPB, 9, 2), - ParamVersionDesc(stdmtlPB, 10, 3), - ParamVersionDesc(stdmtlPB, 11, 4), - ParamVersionDesc(stdmtlPB, 14, 5), - ParamVersionDesc(stdmtlPB, 15, 6), - ParamVersionDesc(stdmtlPB, 15, 7), - ParamVersionDesc(stdmtlPB, 16, 8), - ParamVersionDesc(stdmtlPB, 17, 9) -}; - -static ParamVersionDesc curVersion(stdmtl2PB, NPARAMS, XRAYMTL_PBVERSION); -static ParamVersionDesc stdMtlVersion(stdmtlPB, NPARAMS_O, NEWSTDMTL_PBVERSION); - -#define IDT_MYTIMER 1010 -#define DRAGTHRESH 6 -#define DITHER_WHEN_INACTIVE // avoids palette conflict probs - -//----------------------------------------------------------------------------- -// XRayMtl -//----------------------------------------------------------------------------- -/* -TCHAR* XRayMtl::get_string(int i) -{ - return strings[i]; -} - -int XRayMtl::n_strings() -{ - return strings.Count(); -} -*/ -void* XRayMtl::GetInterface(ULONG id) -{ - if( id == IID_IReshading ) - return (IReshading*)( this ); - // else if ( id == IID_IValidityToken ) - // return (IValidityToken*)( this ); - else - return Mtl::GetInterface(id); -} - - -void XRayMtl::Reset() -{ - ReplaceReference( TEXMAPS_REF, new Texmaps((MtlBase*)this)); - ivalid.SetEmpty(); - - SetShaderIndx( FindShader( Class_ID(DEFAULT_SHADER_CLASS_ID,0) )); - // back in 4.28, as it broke reset....fixed in shader.reset so only allocs pb if not there - pShader->Reset(); // mjm - 4.22.99 - fix mem leak (pblock already created through SetShaderIndx() above. - - SetSamplerIndx( FindSampler( Class_ID(DEFAULT_SAMPLER_CLASS_ID,0) ) ); - - // HEY!! this should all be done automatically in ParamBlock init... - macroRecorder->Disable(); // don't want to see this parameter reset in macrorecorder - // ensure all map-related parameters are set up - UpdateMapButtons(); // calls updatetexmaps - UpdateExtendedMapButtons(); - - pb_shader->SetValue(std2_wire, 0, FALSE ); - pb_shader->SetValue(std2_two_sided, 0, FALSE ); - pb_shader->SetValue(std2_faceted, 0, FALSE ); - pb_shader->SetValue(std2_face_map, 0, FALSE ); - - SetDimIntens( 0.0f, 0 ); - SetDimMult( 3.0f, 0 ); - - pb_extended->SetValue(std2_opacity_type, 0, 0 ); - pb_extended->SetValue(std2_falloff_type, 0, 0 ); - pb_extended->SetValue(std2_wire_units, 0, 0 ); - pb_extended->SetValue(std2_apply_refl_dimming, 0, FALSE ); - SetOpacity(1.0f, 0); - SetFilter(Color(.5f, .5f, .5f), 0); - SetIOR(1.5f, 0); - - // sampling - SetSamplingQuality( 0.5f ); - SetSamplingOn( FALSE ); - pb_sampling->SetValue(std2_ssampler_subsample_tex_on, 0, TRUE ); - pb_sampling->SetValue(std2_ssampler_adapt_threshold, 0, .1f ); - pb_sampling->SetValue(std2_ssampler_adapt_on, 0, TRUE ); - - SetOpacFalloff(0.0f, 0); - SetWireSize(1.0f, 0); - int bumpChan = stdIDToChannel[ ID_BU ]; - SetTexmapAmt(bumpChan, BUMP_DEF_AMT, 0); - SetDynamicsProperty(0, 0, DYN_BOUNCE, 1.0f); - SetDynamicsProperty(0, 0, DYN_STATIC_FRICTION, 0.0f); - SetDynamicsProperty(0, 0, DYN_SLIDING_FRICTION, 0.0f); - - SetEShaderIndx(FindEShader("default")); - SetCShaderIndx(FindCShader("default")); - SetGameMtlIndx(FindGameMtl("default")); - - macroRecorder->Enable(); -} - -XRayMtl::XRayMtl(BOOL loading) : mReshadeRQ(RR_None), mInRQ(RR_None) // mjm - 06.02.00 -{ - texHandle[0] = texHandle[1] = NULL; - texHandleValid.SetEmpty(); - - pixelSampler = NULL; - samplerId = -1; - - filterOverrideOn = FALSE; - filterSz = 1.0f; - ioRefract = 1.5f; - - old_pblock = NULL; - pb_xray = pb_shader = pb_extended = pb_sampling = pb_maps = pb_dynamics = NULL; - maps = NULL; - filter = Color(0.0f, 0.0f, 0.0f); - pShader = NULL; - shaderId = -1; - flags = NEWSTDMTL_FILT_TRANSP | NEWSTDMTL_ROLLUP1_OPEN; - - dimReflect = FALSE; - dimIntens = 0.0f; - dimMult = 2.0f; - wireSize = opacity = 1.0f; - opfall = 0.0f; - for ( int i = 0; i < 12; ++i ) - stdIDToChannel[i] = -1; - - for ( i = 0; i < STD2_NMAX_TEXMAPS; ++i ) - channelTypes[i] = UNSUPPORTED_CHANNEL; - - ivalid.SetEmpty(); - -/* - if(strings.Count() == 0) - { - char path[MAX_PATH]; - sprintf(path, "%s/%s", GetCOREInterface()->GetDir(APP_PLUGCFG_DIR), "strings.txt"); - FILE* fstr = fopen(path, "r"); - if(fstr != NULL) - { - while(!feof(fstr)) - { - TCHAR str[100]; - - _fgetts(str, 100, fstr); - TCHAR* res_str = _tcsdup(str); - strings.Append(1, &res_str); - } - fclose(fstr); - } - } -*/ - if (!loading){ - // ask the ClassDesc to make the P_AUTO_CONSTRUCT paramblocks - stdmtl2CD.MakeAutoParamBlocks(this); - Reset(); - } -} - -RefTargetHandle XRayMtl::Clone(RemapDir &remap) { - //DebugPrint(" Cloning NEWSTDMTL %d \n", ++numNewStdMtls); - macroRecorder->Disable(); - XRayMtl *mnew = new XRayMtl(TRUE); - *((MtlBase*)mnew) = *((MtlBase*)this); // copy superclass stuff - mnew->ReplaceReference(TEXMAPS_REF, remap.CloneRef(maps)); - mnew->ReplaceReference(SHADER_REF, remap.CloneRef(pShader)); - mnew->ReplaceReference(XRAY_PB_REF, remap.CloneRef(pb_xray)); - mnew->ReplaceReference(SHADER_PB_REF, remap.CloneRef(pb_shader)); - mnew->ReplaceReference(EXTENDED_PB_REF, remap.CloneRef(pb_extended)); - mnew->ReplaceReference(SAMPLING_PB_REF, remap.CloneRef(pb_sampling)); - mnew->ReplaceReference(MAPS_PB_REF, remap.CloneRef(pb_maps)); -#ifndef DESIGN_VER - mnew->ReplaceReference(DYNAMICS_PB_REF, remap.CloneRef(pb_dynamics)); -#endif - mnew->ReplaceReference(SAMPLER_REF, remap.CloneRef(pixelSampler)); - - mnew->ivalid.SetEmpty(); - mnew->flags = flags; - - mnew->filterOverrideOn = filterOverrideOn; - mnew->filterSz = filterSz; - - mnew->ioRefract = ioRefract; - mnew->opacity = opacity; - mnew->filter = filter; - mnew->opfall = opfall; - - mnew->wireSize = wireSize; - mnew->dimReflect = dimReflect; - - mnew->samplerId = samplerId; - mnew->shaderId = shaderId; - - mnew->eshaderId = eshaderId; - mnew->cshaderId = cshaderId; - mnew->gamemtlId = gamemtlId; - - for ( int i = 0; i < 12; ++i ) - mnew->stdIDToChannel[i] = stdIDToChannel[i]; - - for ( i = 0; i < STD2_NMAX_TEXMAPS; ++i ) - mnew->channelTypes[i] = channelTypes[i]; - macroRecorder->Enable(); - BaseClone(this, mnew, remap); - return (RefTargetHandle)mnew; -} - -ParamDlg* XRayMtl::CreateParamDlg(HWND hwMtlEdit, IMtlParams *imp) -{ - KillRefmsg kill( killRefmsg ); - - Interval v; - macroRecorder->Disable(); - Update(imp->GetTime(), v); - // save the creation context for possible later shader switching requiring a new CreateParamDialog - curHwmEdit = hwMtlEdit; - curImp = imp; - // create the rollouts, first the main shader dialog as master - // note, we can't use PB2 AUTO_UI here, since the shader's dialog is to be installed in the - // middle of the rollouts - masterDlg = stdmtl2CD.CreateParamDlg(std2_shader, hwMtlEdit, imp, this); - // then have the selected shader make its own - pShaderDlg = pShader->CreateParamDialog(NULL, hwMtlEdit, imp, this, - ((flags & NEWSTDMTL_ROLLUP1_OPEN) ? 0 : APPENDROLL_CLOSED)); - masterDlg->AddDlg(pShaderDlg); - // now make the rest (they are added to the master automatically) - - if( pShader->SupportStdParams() & STD_EXTRA_DLG ) - extendedDlg = stdmtl2CD.CreateParamDlg(std2_extended, hwMtlEdit, imp, this); - else - extendedDlg = NULL; - - samplingDlg = stdmtl2CD.CreateParamDlg(std2_sampling, hwMtlEdit, imp, this); - texmapDlg = stdmtl2CD.CreateParamDlg(std_maps, hwMtlEdit, imp, this); - xrayDlg = stdmtl2CD.CreateParamDlg(std2_xray, hwMtlEdit, imp, this); - UpdateTexmaps(); - if( pb_dynamics ) // not in the VIZ version - stdmtl2CD.CreateParamDlg(std2_dynamics, hwMtlEdit, imp, this); - // restore any saved rollout state - stdmtl2CD.RestoreRolloutState(); - UpdateMapButtons(); - UpdateExtendedMapButtons(); - - macroRecorder->Enable(); - return masterDlg; -} - -BOOL XRayMtl::SetDlgThing(ParamDlg* dlg) -{ - KillRefmsg kill( killRefmsg ); - - // set the appropriate 'thing' sub-object for each secondary dialog - if (dlg == pShaderDlg) - { - // handle material switching in the shader dialog, incoming material is 'this' - assert (SuperClassID() == MATERIAL_CLASS_ID); - assert (ClassID() == XRAYMTL_CLASS_ID); - XRayMtl* oldMtl = (XRayMtl*)pShaderDlg->GetThing(); - ULONG oldParams, newParams; - Class_ID newClassId, oldClassId; - - if (oldMtl) { - Shader* oldShader = oldMtl->GetShader(); - oldParams = oldShader->SupportStdParams(); - oldClassId = oldShader->ClassID(); - } else oldParams = 0;; - - newParams = pShader->SupportStdParams(); - newClassId = pShader->ClassID(); - - if ( shaderId < 0 ) { - //it's the standin shader - int i = -1; - // DbgAssert(0); - // SetShaderIndx( FindShader( pShader->ClassID() ), FALSE ); - } - - // see if we need to change Shader basic params rollup - if ( (oldClassId == newClassId) || - ((newParams & STD_BASIC2_DLG) && (oldParams & STD_BASIC2_DLG)) ){ - assert( pShaderDlg ); - // update in case of partial stdParam support - pShaderDlg->SetThings(this, pShader); - pShader->SetParamDlg( pShaderDlg ); - pShaderDlg->ReloadDialog(); - UpdateMapButtons(); - } else { - // different shader in this Std2Mtl, toss out the old rollup - HWND oldPanel = pShaderDlg->GetHWnd(); - masterDlg->DeleteDlg(pShaderDlg); - pShaderDlg->DeleteThis(); - - // make a new one - pShaderDlg = pShader->CreateParamDialog(oldPanel, curHwmEdit, curImp, this, - (flags & NEWSTDMTL_ROLLUP1_OPEN ? 0 : APPENDROLL_CLOSED)); - pShader->SetParamDlg(pShaderDlg); - pShaderDlg->LoadDialog(TRUE); - masterDlg->AddDlg(pShaderDlg); - - UpdateMapButtons(); // calls update texmaps - } - } - else if (dlg == texmapDlg) - { - texmapDlg->SetThing(this); - UpdateTexmaps(); - UpdateLockADTex(TRUE); - } - else if (dlg == extendedDlg) - { - extendedDlg->SetThing(this); - UpdateExtraParams( pShader->SupportStdParams() ); - UpdateExtendedMapButtons(); - std2_extended_blk.SetSubTexNo(std2_ep_filter_map, stdIDToChannel[ID_FI]); - } - else if (dlg == samplingDlg) - { - samplingDlg->SetThing(this); - if ( samplerId < 0 ) { - DbgAssert(0); - // SetSamplerIndx( FindSampler( pixelSampler->ClassID() ) ); - } - UpdateSamplingParams(); - } - else if ( pb_dynamics == NULL ) - { - //maybe do something here for viz case of no pb_dynamics - int i = 9; - }else if ( pb_xray == NULL ) - { - //maybe do something here for viz case of no pb_dynamics - int i = 9; - } - else - return FALSE; - return TRUE; -} - -// compare function for sorting Shader Tab<> -static int __cdecl classDescListCompare(const void *elem1, const void *elem2) -{ - ClassDesc* s1 = *(ClassDesc**)elem1; - ClassDesc* s2 = *(ClassDesc**)elem2; - TSTR sn1 = s1->ClassName(); // need to snap name string, since both use GetString() - TSTR sn2 = s2->ClassName(); - return _tcscmp(sn1.data(), sn2.data()); -} - -void XRayMtl::LoadShaderList() -{ - // loads static shader list with name-sorted Shader ClassDesc*'s - shaderList.ZeroCount(); - SubClassList* scList = GetCOREInterface()->GetDllDir().ClassDir().GetClassList(SHADER_CLASS_ID); - for (long i = 0, j = 0; i < scList->Count(ACC_ALL); ++i) { - if ( (*scList)[ i ].IsPublic() ) { - ClassDesc* pClassD = (*scList)[ i ].CD(); - shaderList.Append(1, &pClassD); - } - } - shaderList.Sort(&classDescListCompare); -} - -int XRayMtl::NumShaders() -{ - if (shaderList.Count() == 0) - LoadShaderList(); - return shaderList.Count(); -} - -ClassDesc* XRayMtl::GetShaderCD(int i) -{ - if (shaderList.Count() == 0) - LoadShaderList(); - return (i >= 0 && i < shaderList.Count()) ? shaderList[i] : NULL; -} - -void XRayMtl::LoadSamplerList() -{ - // loads static sampler list with name-sorted Sampler ClassDesc*'s - samplerList.ZeroCount(); - SubClassList* scList = GetCOREInterface()->GetDllDir().ClassDir().GetClassList(SAMPLER_CLASS_ID); - for (long i = 0, j = 0; i < scList->Count(ACC_ALL); ++i) { - if ( (*scList)[ i ].IsPublic() ) { - ClassDesc* pClassD = (*scList)[ i ].CD(); - samplerList.Append(1, &pClassD); - } - } - samplerList.Sort(&classDescListCompare); -} - -int XRayMtl::NumSamplers() -{ - if (samplerList.Count() == 0) - LoadSamplerList(); - return samplerList.Count(); -} - -ClassDesc* XRayMtl::GetSamplerCD(int i) -{ - if (samplerList.Count() == 0) - LoadSamplerList(); - return (i >= 0 && i < samplerList.Count()) ? samplerList[i] : NULL; -} - - -//------------------------------------------------------------------- -// DS: This class is handy for implementing UNDO - 10/31/00 -#if MAX_VERSION_MAJOR<=5 - #define SRM_CLASS_ID 0xB8073421 - class SingleRefMaker: public ReferenceMaker { - public: - RefTargetHandle rtarget; - SingleRefMaker() { rtarget = NULL; } - ~SingleRefMaker() { - DeleteAllRefsFromMe(); - } - void SetRef(RefTargetHandle rt) { - theHold.Suspend(); - ReplaceReference(0,rt); - theHold.Resume(); - } - RefTargetHandle GetRef() { return rtarget; } - // ReferenceMaker - RefResult NotifyRefChanged( Interval changeInt,RefTargetHandle hTarget, - PartID& partID, RefMessage message ) { - if (message==REFMSG_TARGET_DELETED) { - if (hTarget==rtarget) - rtarget = NULL; - } - return REF_SUCCEED; - } - void DeleteThis() { xr_delete((SingleRefMaker*)this); } - - SClass_ID SuperClassID() { return SRM_CLASS_ID; } - // From ref - int NumRefs() { return 1; } - RefTargetHandle GetReference(int i) { return rtarget; } - void SetReference(int i, RefTargetHandle rtarg) { rtarget = rtarg; } - BOOL CanTransferReference(int i) {return FALSE;} - }; -#endif - -//------------------------------------------------------------------- -// This handles Undo/Redo of SwitchShader - -class SwitchShaderRestore: public RestoreObj { -public: - XRayMtl *mtl; - SingleRefMaker oldShader; - SingleRefMaker newShader; - SwitchShaderRestore() { mtl = NULL; } - SwitchShaderRestore( XRayMtl * m, Shader *olds, Shader *news) { - mtl = m; - oldShader.SetRef(olds); - newShader.SetRef(news); - } - void Restore(int isUndo) { - mtl->SwitchShader((Shader *)oldShader.GetRef()); - } - void Redo() { - mtl->SwitchShader((Shader *)newShader.GetRef()); - } - TSTR Description() { return(TSTR(_T("SwitchShaderRestore"))); } -}; - - -//-------------------------------------------------------------------------- - - -void XRayMtl::SwitchShader(Shader* newShader, BOOL loadDlg ) -{ - // switch to a different shader - SuspendAnimate(); - Class_ID oldShaderId = pShader? pShader->ClassID(): Class_ID(0,0); - Class_ID newShaderId = newShader->ClassID(); - Class_ID constShaderId( CONSTClassID, 0 ); - if ( newShaderId != oldShaderId ) - { - if ( pb_extended ) { - int n = pb_extended->IDtoIndex( std2_opacity ); - pb_extended->RemoveController( n, 0); - } - - theHold.Suspend(); //----------------------------------------------------- - - if (newShaderId == constShaderId ) { // constant - SetFlag( NEWSTDMTL_FACETED, TRUE ); - pb_shader->SetValue(std2_faceted, 0, TRUE ); - } else if ( oldShaderId == constShaderId ) { - SetFlag( NEWSTDMTL_FACETED, FALSE ); - pb_shader->SetValue(std2_faceted, 0, FALSE ); - } - - Shader * oldShader = GetShader(); - ULONG oldParams = oldShader ? oldShader->SupportStdParams() : 0; - ShaderParamDlg* oldShaderDlg = oldShader ? oldShader->GetParamDlg() : loadDlg? pShaderDlg:NULL; - - ULONG newParams = newShader->SupportStdParams(); - - // copy any params in common - if ( oldShader && newShader ){ - ShuffleShaderParams( newShader, oldShader ); - ShuffleTexMaps( newShader, oldShader ); - } - - theHold.Resume(); //----------------------------------------------------- - - if (theHold.Holding()) - theHold.Put(new SwitchShaderRestore(this,oldShader,newShader)); // this will make a ref to oldShader - - theHold.Suspend(); //----------------------------------------------------- - - // moved from below, or it crashes on reset - if( oldShader) oldShader->SetParamDlg(NULL); // DS 3/9/99 ( undo may bring oldShader back, have to clear invalid pointer) - if( oldShaderDlg ) oldShaderDlg->SetThings( this, NULL ); - - // NB: this deletes the oldShader ( unless it being ref'd by SwitchShaderRestore) - SetShader( newShader ); - - - UpdateTexmaps(); - std2_extended_blk.SetSubTexNo(std2_ep_filter_map, stdIDToChannel[ID_FI]); - - // update UI if open - if (oldShaderDlg != NULL ) - { - // enable or disable extra params - UpdateExtraParams( newParams ); - - // now update or replace the basic rollup - if ((newParams & STD_BASIC2_DLG) && (oldParams & STD_BASIC2_DLG)) { - // update in case of partial stdParam support - oldShaderDlg->SetThings( this, newShader ); - newShader->SetParamDlg( oldShaderDlg ); - oldShaderDlg->LoadDialog(TRUE); - pShaderDlg = oldShaderDlg; - - } else { - - HWND oldPanel = oldShaderDlg->GetHWnd(); - masterDlg->DeleteDlg(oldShaderDlg); - oldShaderDlg->DeleteThis(); - - // including oldPanel replaces it... - pShaderDlg = newShader->CreateParamDialog(oldPanel, - curHwmEdit, curImp, this, - ((flags & NEWSTDMTL_ROLLUP1_OPEN) ? 0 : APPENDROLL_CLOSED)); - newShader->SetParamDlg(pShaderDlg,0); - pShaderDlg->LoadDialog(TRUE); - masterDlg->AddDlg(pShaderDlg); - - } - newShader->SetParamDlg(pShaderDlg,0); - SyncADTexLock( newShader->GetLockADTex() ); - UpdateMapButtons(); - UpdateExtendedMapButtons(); - - UpdateMtlDisplay(); - - }// end, oldShaderDlg not NULL - - theHold.Resume(); //-------------------------------------------------- - - } - ResumeAnimate(); -} - -// this is exposed at stdmat2 level -BOOL XRayMtl::SwitchShader(Class_ID shaderId) -{ - ClassDesc* pCD; - int n = FindShader( shaderId, &pCD ); - if ( pCD ){ - //SS 1/26/2000: fix suggested by Kells - //SwitchShader(pCD); - SetShaderIndx(n); // sets pb2 & set calls switchshader w/ a real shader - return TRUE; - } - return FALSE; -} - - -void XRayMtl::SwitchShader(ClassDesc* pNewCD) -{ - // create the new shader object - Shader * newShader = (Shader*)(pNewCD->Create(0)); - newShader->Reset(); // creates pblock - - SwitchShader( newShader ); -} - - -// these provide R 2.5 id access to the old shaders. -void XRayMtl::SetShading(int s) -{ - long cid; - pb_shader->SetValue(std2_faceted,0,FALSE); - switch( s ) { -case 0: cid = PHONGClassID; - pb_shader->SetValue(std2_faceted,0,TRUE); - break; -case 1: cid = PHONGClassID; break; -case 2: cid = METALClassID; break; -case 3: cid = BLINNClassID; break; - } - long indx = FindShader( Class_ID(cid, 0) ); - - // this sets the new shader via pb2 accessor - SetShaderIndx( indx ); -} - -// all faceted shaders approximated by constant, all new shaders by blinn. -int XRayMtl::GetShading() { - if (IsFaceted()) return 0; - Class_ID id = pShader->ClassID(); - if ( id == Class_ID(PHONGClassID,0) ) return 1; - else if ( id == Class_ID(METALClassID,0) ) return 2; - return 3; -} - - -//------------------------------------------------------------------- -// This handles Undo/Redo of SwitchSampler - -class SwitchSamplerRestore: public RestoreObj, public ReferenceMaker { -public: - XRayMtl *mtl; - Sampler *saveSampler; - SwitchSamplerRestore() { saveSampler = NULL; mtl = NULL; } - SwitchSamplerRestore( XRayMtl * m, Sampler *s) { - mtl = m; - saveSampler = NULL; - theHold.Suspend(); - ReplaceReference(0,s); - theHold.Resume(); - } - ~SwitchSamplerRestore() { DeleteAllRefsFromMe(); } - void Switch() { - Sampler *samp = mtl->pixelSampler; - - samp->SetAFlag(A_LOCK_TARGET); // keeps sh from getting auto-deleted - mtl->SwitchSampler(saveSampler); - samp->ClearAFlag(A_LOCK_TARGET); - - ReplaceReference(0,samp); - } - void Restore(int isUndo) { Switch(); } - void Redo() { Switch(); } - TSTR Description() { return(TSTR(_T("SwitchSamplerRestore"))); } - - // ReferenceMaker - RefResult NotifyRefChanged( Interval changeInt,RefTargetHandle hTarget, - PartID& partID, RefMessage message ) { - if (message==REFMSG_TARGET_DELETED) { - if (hTarget==saveSampler) - saveSampler = NULL; - } - return REF_SUCCEED; - } - void DeleteThis() { SwitchSamplerRestore* ptr=this; xr_delete(ptr); } - - // From ref - int NumRefs() { return 1; } - RefTargetHandle GetReference(int i) { return saveSampler; } - void SetReference(int i, RefTargetHandle rtarg) { saveSampler = (Sampler*)rtarg; } - BOOL CanTransferReference(int i) {return FALSE;} -}; - - -//-------------------------------------------------------------------------- - -// copy of classid of the default sampler -static Class_ID defaultSamplerID( DEFAULT_SAMPLER_CLASS_ID , 0); - - - -void XRayMtl::SwitchSampler( Sampler* newSampler ) -{ - theHold.Suspend(); //----------------------------------------------------- - - DbgAssert( newSampler ); - Class_ID oldSamplerId = pixelSampler? pixelSampler->ClassID(): Class_ID(0,0); - Class_ID newSamplerId = newSampler->ClassID(); - - if ( oldSamplerId != newSamplerId ) { - - theHold.Resume(); //----------------------------------------------------- - if (theHold.Holding()) - theHold.Put(new SwitchSamplerRestore(this, pixelSampler)); // this will make a ref to oldShader - theHold.Suspend(); //----------------------------------------------------- - - SetPixelSampler( newSampler ); - } - - if ( pb_sampling ) - UpdateSamplingParams(); - - theHold.Resume(); //----------------------------------------------------- -} - - -void XRayMtl::SwitchSampler(ClassDesc* pNewCD) -{ - // if ( ! pNewCD ) { - // get default - // ClassDesc* pCD; - // int indx = FindSampler( defaultSamplerID, &pCD ); - // pNewCD = pCD; - // DbgAssert( pNewCD); - // } - DbgAssert( pNewCD); - Sampler * newSampler = (Sampler*)(pNewCD->Create(0)); - SwitchSampler( newSampler ); -} - -// this is exposed at stdmat2 level -BOOL XRayMtl::SwitchSampler(Class_ID samplerId){ - // ClassDesc* pCD; - // int n = FindSampler( samplerId, &pCD ); - int n = FindSampler( samplerId ); - // if ( pCD ){ - if ( n >= 0 ){ - // SwitchSampler( (Sampler*)(pCD->Create(0)) ); - SetSamplerIndx( n ); - return TRUE; - } - return FALSE; -} - - - -void XRayMtl::SetPixelSampler( Sampler * sampler ) -{ - BOOL on = pixelSampler? pixelSampler->GetEnable() : FALSE; - BOOL superTex = pixelSampler? pixelSampler->GetTextureSuperSampleOn() : TRUE; - float quality = pixelSampler? pixelSampler->GetQuality() : 0.5f; - ReplaceReference( SAMPLER_REF, sampler ); - NotifyDependents(FOREVER, 0, REFMSG_SUBANIM_STRUCTURE_CHANGED); - if(pixelSampler) { - pixelSampler->SetEnable( on ); - pixelSampler->SetTextureSuperSampleOn( superTex ); - pixelSampler->SetQuality( quality ); - } -} - -static TCHAR dots[] = _T(". . . . . . . . . . . . . . . . . . . . . . . ."); - -void XRayMtl::UpdateTexmaps() -{ - // if the UI is up for the maps paramblock, adjust button text and enables - // according to current shader's capabilities - // UI controls are updated indirectly via calls on the ParamMap2. - // further, a Param Alias table is set up for all the pmap Tab<> params for scripter access - IParamMap2* pmap = pb_maps->GetMap(); - Shader* pShader = GetShader(); - long nShaderMapChannels = pShader->nTexChannelsSupported(); - long nMtlMapChannels = MTL_NTEXMAPS; - pb_maps->ClearParamAliases(); - int slevChan = pShader->StdIDToChannel( ID_SS ); - - for ( long i = 0; i < STD2_NMAX_TEXMAPS; ++i ) - { - if ( i < nShaderMapChannels ) - { - BOOL isSupported = ! (pShader->ChannelType( i ) & UNSUPPORTED_CHANNEL); - if (pmap != NULL) - { - TSTR chanName = maps->txmap[i].name = pShader->GetTexChannelName(i); - // append dots - int n = chanName.length(); - chanName.append( _T(" " ) ); - chanName.append( &dots[ n+1 ] ); - pmap->SetText(std2_map_enables, chanName, i); - pmap->Enable(std2_map_enables, isSupported, i); - pmap->Enable(std2_map_amnts, isSupported, i); - pmap->Enable(std2_maps, isSupported, i); - - if ( i == slevChan || pShader->ChannelType( i ) == SLEV_CHANNEL ) - pmap->SetRange(std2_map_amnts, -999, 999, i); - else - pmap->SetRange(std2_map_amnts, 0, 100, i); - - } - // set up the Tab<> param aliases - TSTR chanIntName = pShader->GetTexChannelInternalName(i); - if (chanIntName.Length() > 0) - { - channelTypes[ i ] = pShader->ChannelType( i ); - pb_maps->DefineParamAlias(chanIntName, std2_maps, i); - pb_maps->DefineParamAlias(chanIntName + _T("Enable"), std2_map_enables, i); // JBW 5/24/99, made non-localizable (as names s/b internal) - pb_maps->DefineParamAlias(chanIntName + _T("Amount"), std2_map_amnts, i); - } - } - else - { // beyond the end of supported shader channels - if (pmap != NULL) - { - // add the mtls texture channels - if ( nMtlMapChannels > 0 ) { - TSTR chanName = maps->txmap[i].name = GetString( mtlChannelNameIDS[ i - nShaderMapChannels ] ); - // append dots - int n = chanName.length(); - chanName.append( _T(" " ) ); - chanName.append( &dots[ n+1 ] ); - pmap->SetText(std2_map_enables, chanName, i); - pmap->Enable(std2_map_enables, TRUE, i); - pmap->Enable(std2_map_amnts, TRUE, i); - pmap->Enable(std2_maps, TRUE, i); - // range, first channel is bumps, last is displacement - if ( nMtlMapChannels == MTL_NTEXMAPS || nMtlMapChannels == 1 ) - pmap->SetRange(std2_map_amnts, -999, 999, i); - else - pmap->SetRange(std2_map_amnts, 0, 100, i); - - --nMtlMapChannels; - - } else { - // channel is not used for this mtl/shader - pmap->SetText(std2_map_enables, dots, i); - macroRecorder->Disable(); - SetTexmapAmt(i, 0.0f, 0); - macroRecorder->Enable(); - pmap->Enable(std2_map_enables, FALSE, i); - pmap->Enable(std2_map_amnts, FALSE, i); - pmap->Enable(std2_maps, FALSE, i); - } - } - TSTR chanIntName = mtlChannelInternalNames[ i - nShaderMapChannels ] ; - if (chanIntName.Length() > 0) - { - channelTypes[ i ] = mtlChannelType[ i - nShaderMapChannels ]; - pb_maps->DefineParamAlias(chanIntName, std2_maps, i); - pb_maps->DefineParamAlias(chanIntName + GetString(IDS_JW_ENABLE), std2_map_enables, i); - pb_maps->DefineParamAlias(chanIntName + GetString(IDS_JW_AMOUNT), std2_map_amnts, i); - } - - } - } - - // last do the Channel Ids from stdMat - for ( i = 0; i < N_ID_CHANNELS; ++i ){ - int chan = pShader->StdIDToChannel(i); - if ( chan >= 0 ) { - stdIDToChannel[i] = chan; - } else if (mtlStdIDToChannel[ i ] >= 0){ - stdIDToChannel[i] = mtlStdIDToChannel[ i ] + pShader->nTexChannelsSupported(); - } else - stdIDToChannel[i] = -1; - } - - // disable for old metal - ULONG stdParms = pShader->SupportStdParams(); - if ( (stdParms & STD_BASIC2_DLG) && (stdParms & STD_PARAM_METAL) ){ - //metal std shader, turn off stuff - int n = stdIDToChannel[ ID_SP ]; - if ( pmap ) { - pmap->Enable(std2_map_amnts, FALSE, n ); - pmap->Enable(std2_maps, FALSE, n); - pmap->Enable(std2_map_enables, FALSE, n); - } - } - // disable filter on additive/subtractive - if ( (stdParms & STD_EXTRA_DLG) && TRANSP_FILTER != GetTransparencyType() ){ - //metal std shader, turn off stuff - int n = stdIDToChannel[ ID_FI ]; - if ( pmap ) { - pmap->Enable(std2_map_amnts, FALSE, n ); - pmap->Enable(std2_maps, FALSE, n); - pmap->Enable(std2_map_enables, FALSE, n); - } - } - -} - -static TCHAR* mapStates[] = { _T(" "), _T("m"), _T("M") }; - -void XRayMtl::UpdateMapButtons() -{ - UpdateTexmaps(); - if (IsShaderInUI()){ - pShader->GetParamDlg()->UpdateMapButtons(); - UpdateLockADTex(TRUE); - } - // UpdateExtendedMapButtons(); -} - -void XRayMtl::UpdateExtendedMapButtons() -{ - IParamMap2* pmap = pb_extended->GetMap(); - if (pmap != NULL){ - int filtChan = stdIDToChannel[ID_FI]; - int state = GetMapState( filtChan ); - pmap->SetText(std2_ep_filter_map, mapStates[ state ]); - - TSTR nm = GetMapName( filtChan ); - pmap->SetTooltip(std2_ep_filter_map, TRUE, nm); - } -} - -void XRayMtl::UpdateSamplingParams() -{ - IParamMap2* map = pb_sampling->GetMap(); - if ( map ) { - HWND hwnd = map->GetHWnd(); - BOOL qualityOn = pixelSampler->SupportsQualityLevels()>0 ? TRUE:FALSE ; - map->Show(std2_ssampler_qual, qualityOn ); - HWND hwQual = GetDlgItem( hwnd, IDC_QUALITY_TEXT ); - ShowWindow( hwQual, qualityOn ); - - ULONG samplerParms = pixelSampler->SupportsStdParams(); - map->Show(std2_ssampler_adapt_on, samplerParms & ADAPTIVE_CHECK_BOX ); - map->Enable(std2_ssampler_adapt_threshold, pixelSampler->IsAdaptiveOn() ); - map->Show(std2_ssampler_adapt_threshold, samplerParms & ADAPTIVE_THRESHOLD ); - - map->Show(std2_ssampler_subsample_tex_on, samplerParms & SUPER_SAMPLE_TEX_CHECK_BOX ); - HWND hwThresh = GetDlgItem( hwnd, IDC_ADAPT_STATIC ); - ShowWindow( hwThresh, samplerParms & ADAPTIVE_THRESHOLD?TRUE:FALSE ); - map->Show(std2_ssampler_advanced, samplerParms & ADVANCED_DLG_BUTTON ); - SetDlgItemText( hwnd, IDC_COMMENT_TEXT, pixelSampler->GetDefaultComment() ); - - map->Show(std2_ssampler_param0, samplerParms & OPTIONAL_PARAM_0 ); - if( samplerParms & OPTIONAL_PARAM_0 ) - SetDlgItemText( hwnd, IDC_PARAM0_TEXT, pixelSampler->GetOptionalParamName(0) ); - ShowWindow( GetDlgItem( hwnd, IDC_PARAM0_TEXT ), samplerParms & OPTIONAL_PARAM_0 ); - - map->Show(std2_ssampler_param1, samplerParms & OPTIONAL_PARAM_1 ); - if( samplerParms & OPTIONAL_PARAM_1 ) - SetDlgItemText( hwnd, IDC_PARAM1_TEXT, pixelSampler->GetOptionalParamName(1) ); - ShowWindow( GetDlgItem( hwnd, IDC_PARAM1_TEXT ), samplerParms & OPTIONAL_PARAM_1 ); - } -} - -// enable & disable extra params possibly overridden by the shader -void XRayMtl::UpdateExtraParams( ULONG stdParams ) -{ - // update shader dlg map buttons - IParamMap2* pmap = pb_extended->GetMap(); - if (pmap != NULL) - { - HWND hRollup = pmap->GetHWnd(); - BOOL opacOn = ( stdParams & STD_EXTRA_OPACITY ) ? TRUE : FALSE; - pmap->Show( std2_opacity_type, opacOn ); - pmap->Show( std2_falloff_type, opacOn ); - pmap->Show( std2_falloff_amnt, opacOn ); - ShowWindow( GetDlgItem(hRollup, IDC_OPAC_TEXT1), opacOn ); - ShowWindow( GetDlgItem(hRollup, IDC_OPAC_TEXT2), opacOn ); - ShowWindow( GetDlgItem(hRollup, IDC_OPAC_TEXT3), opacOn ); - ShowWindow( GetDlgItem(hRollup, IDC_FILTER_OVERLAY), !opacOn ); - - BOOL reflOn = ( stdParams & STD_EXTRA_REFLECTION) ? TRUE : FALSE; - pmap->Show( std2_apply_refl_dimming, reflOn ); - pmap->Show( std2_dim_lvl, reflOn ); - pmap->Show( std2_refl_lvl, reflOn ); - ShowWindow( GetDlgItem(hRollup, IDC_REFL_TEXT1), reflOn ); - ShowWindow( GetDlgItem(hRollup, IDC_REFL_TEXT2), reflOn ); - ShowWindow( GetDlgItem(hRollup, IDC_REFL_BOX), reflOn ); - // EnableWindow( GetDlgItem(hRollup, IDC_REFL_BOX), reflOn ); - - BOOL refrOn = ( stdParams & STD_EXTRA_REFRACTION ) ? TRUE : FALSE; - pmap->Show( std2_ior, refrOn ); - ShowWindow( GetDlgItem(hRollup, IDC_REFR_TEXT1), refrOn ); - - // BOOL filterOn = (refrOn || opacOn) && GetTransparencyType() == TRANSP_FILTER; - BOOL filterOn = (refrOn && !opacOn) || (opacOn && GetTransparencyType() == TRANSP_FILTER); - pmap->Show( std2_filter_color, filterOn ); - pmap->Show( std2_ep_filter_map, filterOn ); - EnableWindow( GetDlgItem(hRollup, IDC_OPAC_BOX), (refrOn || opacOn) ); - } -} - -int XRayMtl::GetMapState( int nMap ) -{ - Texmap *t = (*maps)[nMap].map; - if ( t == NULL ) return 0; - return (*maps)[nMap].mapOn ? 2 :1; -} - - -TSTR XRayMtl::GetMapName( int nMap ) -{ - Texmap *t = (*maps)[nMap].map; - if ( t == NULL ) - return TSTR( GetString( IDS_KE_NONE ) ); - return t->GetFullName(); -} - - -void XRayMtl::SyncADTexLock( BOOL lockOn ) -{ - pb_maps->SetValue(std2_mp_ad_texlock, 0, lockOn ); - UpdateLockADTex(FALSE); - // SetFlag( NEWSTDMTL_LOCK_ADTEX, lockOn ); - // force an update - // if (masterDlg) - // masterDlg->ReloadDialog(); -} - -void XRayMtl::UpdateLockADTex( BOOL passOn ) -{ - IParamMap2* pmap = pb_maps->GetMap(); - int lock = GetFlag(NEWSTDMTL_LOCK_ADTEX)!=0; - if ( pShader->SupportStdParams() & STD_PARAM_LOCKADTEX ) { - if ( passOn ){ - pShader->SetLockADTex( lock ); - if (pmap != NULL && pShader->GetParamDlg()) - pShader->GetParamDlg()->LoadDialog(TRUE); - } - if (pmap != NULL) - { - pmap->Show(std2_mp_ad_texlock, TRUE); - pmap->Enable(std2_maps, !lock, 0); - } - } else { - // no std params, so no amb/diff lock - if (pmap != NULL) - { - pmap->Show(std2_mp_ad_texlock, FALSE); - pmap->Enable(std2_maps, TRUE, 0); - } - } - -} - -void XRayMtl::UpdateMtlDisplay() -{ - IParamMap2* map = pb_maps->GetMap(); - if (map != NULL) - { - // removed to avoid multiple viewport redraws on change shader - // map->RedrawViews(GetCOREInterface()->GetTime()); - map->Invalidate(); - } -} - -#define LIMIT0_1(x) if (x<0.0f) x = 0.0f; else if (x>1.0f) x = 1.0f; -#define LIMIT1(x) if (x > 1.0f) x = 1.0f; -#define LIMITMINMAX(x, min, max) if (xmax) x = max; - -static Color LimitColor(Color c) { - LIMIT0_1(c.r); - LIMIT0_1(c.g); - LIMIT0_1(c.b); - return c; -} - -void XRayMtl::Update(TimeValue t, Interval &valid) { - Point3 p; - if (!ivalid.InInterval(t)) { - ivalid.SetInfinite(); - - pb_extended->GetValue(std2_filter_color, t, p, ivalid ); - filter = LimitColor(Color(p.x, p.y, p.z)); - pb_extended->GetValue(std2_ior, t, ioRefract, ivalid ); - pb_extended->GetValue(std2_opacity, t, opacity, ivalid ); - LIMIT0_1(opacity); - - if (IsShaderInUI()) - pShader->GetParamDlg()->UpdateOpacity(); - - pb_extended->GetValue(std2_falloff_amnt, t, opfall, ivalid ); - LIMIT0_1(opfall); - - pb_extended->GetValue(std2_wire_size, t, wireSize, ivalid ); - pb_extended->GetValue(std2_dim_lvl, t, dimIntens, ivalid ); - LIMIT0_1(dimIntens); - pb_extended->GetValue(std2_refl_lvl, t, dimMult, ivalid ); - - SetFlag(NEWSTDMTL_WIRE, pb_shader->GetInt(std2_wire, t)); - SetFlag(NEWSTDMTL_2SIDE, pb_shader->GetInt(std2_two_sided, t)); - SetFlag(NEWSTDMTL_FACEMAP, pb_shader->GetInt(std2_face_map, t)); - SetFlag(NEWSTDMTL_FACETED, pb_shader->GetInt(std2_faceted, t)); - - SetFlag(NEWSTDMTL_ADD_TRANSP, pb_extended->GetInt(std2_opacity_type, t) == 2); - SetFlag(NEWSTDMTL_FILT_TRANSP, pb_extended->GetInt(std2_opacity_type, t) == 0); - SetFlag(NEWSTDMTL_FALLOFF_OUT, pb_extended->GetInt(std2_falloff_type, t) == 1); - SetFlag(NEWSTDMTL_WIRE_UNITS, pb_extended->GetInt(std2_wire_units, t) == 1); - SetFlag(NEWSTDMTL_LOCK_ADTEX, pb_maps->GetInt(std2_mp_ad_texlock, t) == 1); - dimReflect = pb_extended->GetInt(std2_apply_refl_dimming, t); - - if (pShader) - pShader->Update( t, ivalid ); - - for (int i = 0; i < STD2_NMAX_TEXMAPS; i++) - if (MAPACTIVE(i)) - maps->txmap[i].Update(t, ivalid); - - } - valid &= ivalid; -} - -BOOL XRayMtl::AmtKeyAtTime(int i, TimeValue t) { - if (maps->txmap[i].amtCtrl) - return maps->txmap[i].amtCtrl->IsKeyAtTime(t,0); - else - return FALSE; -} - -typedef struct { - float amount; - Control *amtCtrl; - Texmap *map; - BOOL mapOn; - TSTR name; -} saveChan; - -void XRayMtl::ShuffleTexMaps( Shader* newShader, Shader* oldShader ) -{ - saveChan oldMaps[STD2_NMAX_TEXMAPS]; - - for( long i = 0; i < STD2_NMAX_TEXMAPS; ++i ){ - oldMaps[i].amtCtrl = maps->txmap[i].amtCtrl; maps->txmap[i].amtCtrl = NULL; - oldMaps[i].amount = maps->txmap[i].amount; maps->txmap[i].amount = 1.0f; - oldMaps[i].map = maps->txmap[i].map; maps->txmap[i].map = NULL; - oldMaps[i].mapOn = maps->txmap[i].mapOn; maps->txmap[i].mapOn = FALSE; - oldMaps[i].name = maps->txmap[i].name; maps->txmap[i].name = _T(""); - } - int nOldShadeMaps = oldShader->nTexChannelsSupported(); - int nNewShadeMaps = newShader->nTexChannelsSupported(); - - // for each new shader map - for( int oldChan, newChan = 0; newChan < nNewShadeMaps; ++newChan ){ - - TSTR newName = newShader->GetTexChannelInternalName(newChan); - - // look for match in each old map - for ( oldChan = 0; oldChan < nOldShadeMaps; ++oldChan ) { - if ( newName == oldShader->GetTexChannelInternalName(oldChan) ) - break; - } - - if( oldChan < nOldShadeMaps ) { // found it - maps->txmap[newChan].amtCtrl = oldMaps[oldChan].amtCtrl; - maps->txmap[newChan].amount = oldMaps[oldChan].amount; - maps->txmap[newChan].map = oldMaps[oldChan].map; - maps->txmap[newChan].mapOn = oldMaps[oldChan].mapOn; - maps->txmap[newChan].name = oldMaps[oldChan].name; - } - - }// end, for each new map - - // now do the mtl maps - for ( int n = 0; n < MTL_NTEXMAPS; ++n ){ - newChan = n + nNewShadeMaps; - oldChan = n + nOldShadeMaps; - maps->txmap[newChan].amtCtrl = oldMaps[oldChan].amtCtrl; - maps->txmap[newChan].amount = oldMaps[oldChan].amount; - maps->txmap[newChan].map = oldMaps[oldChan].map; - maps->txmap[newChan].mapOn = oldMaps[oldChan].mapOn; - maps->txmap[newChan].name = oldMaps[oldChan].name; - } -} - -void XRayMtl::ShuffleShaderParams( Shader* newShader, Shader* oldShader ) -{ - ClassDesc2 *oldCD2 = NULL, *newCD2 = NULL; - - ClassDesc * newCD; - FindShader( newShader->ClassID(), &newCD ); - - ClassDesc * oldCD; - FindShader( oldShader->ClassID(), &oldCD ); - - // check if we have a ParamBlock2-based shaders - if (oldCD != NULL && oldCD->InternalName() != NULL) - oldCD2 = (ClassDesc2*)oldCD; - if (newCD != NULL && newCD->InternalName() != NULL) - newCD2 = (ClassDesc2*)newCD; - - // loop over destination shaders PB2-based parameters - if (oldCD2 != NULL && newCD2 != NULL){ - // loop over each block in the new shader - for (int i = 0; i < newCD2->NumParamBlockDescs(); i++){ - // get block descriptor and source paramblock - ParamBlockDesc2* newPBdesc = newCD2->GetParamBlockDesc(i); - IParamBlock2* newPB2 = newShader->GetParamBlockByID(newPBdesc->ID); - // loop over each new param and copy from old if there's a match - for (int j = 0; j < newPBdesc->count; j++){ - ParamDef& paramDef = newPBdesc->paramdefs[j]; - - // Now search the old shaders blocks - for (int i = 0; i < oldCD2->NumParamBlockDescs(); i++){ - ParamBlockDesc2* oldPBdesc = oldCD2->GetParamBlockDesc(i); - int j = oldPBdesc->NameToIndex(paramDef.int_name); - if (j >= 0){ - // found an internal name match, get the dest pblock and param def - ParamDef& srcParamDef = oldPBdesc->paramdefs[j]; - // copy only if types match - if (srcParamDef.type == paramDef.type){ - IParamBlock2* oldPB2 = oldShader->GetParamBlockByID(oldPBdesc->ID); - newPB2->Assign(paramDef.ID, oldPB2, srcParamDef.ID); - goto nextParam; // found it, outta here... - } - - } - } -nextParam: ; - }// end, dest param loop - }// end, desk block loop - Interval v; - v.SetInfinite(); - newShader->Update(0, v); - - // end, pb2 copying - } else { - - // StdParam based copy - newShader->CopyStdParams( oldShader ); - } -} - -float XRayMtl::GetXParency(int mtlNum, BOOL backFace) { - int opacChan = stdIDToChannel[ ID_OP ]; - - // When the mtl has "Show Map in Viewport" turned on, and has an opacity map, - // the opacity map over-rides the opacity. DS 6/16/00 - // (Actually, when the hardward doesn't support enough texture channels to do - // the opacity map, the overide is only true for NON-decal maps). - // - if (((*maps)[opacChan].map&&MAPACTIVE(opacChan)&&Active())) { - return 0.0f; - } - - // The following statement looks dubious -- what is it trying to do? -- DS 6/16/00 - if(opacity>0.9f && opfall>0.0f) - return 0.1f; - else - return 1.0f-opacity; -} - -ULONG XRayMtl::Requirements(int subMtlNum) { - ULONG req; - - assert( pShader ); - req = pShader->GetRequirements(subMtlNum); - - int opacChan = stdIDToChannel[ ID_OP ]; - int bumpChan = stdIDToChannel[ ID_BU ]; - int dispChan = stdIDToChannel[ ID_DP ]; - - if (opacity!=1.0f||MAPACTIVE(opacChan)||opfall>0.0f) { - req |= MTLREQ_TRANSP; - } - - if (opacity!=1.0f|| ((*maps)[opacChan].map&&MAPACTIVE(opacChan)&&Active())) - req |= MTLREQ_TRANSP_IN_VP; - - for (int i=0; iRequirements(subMtlNum); - } - if (MAPACTIVE(bumpChan)) { - ULONG bmpreq = (*maps)[bumpChan].map->Requirements(subMtlNum); - if (bmpreq&MTLREQ_UV) - req |= MTLREQ_BUMPUV; - if (bmpreq&MTLREQ_UV2) - req |= MTLREQ_BUMPUV2; - } - if (flags&NEWSTDMTL_WIRE) req|= MTLREQ_WIRE; - if (flags&NEWSTDMTL_2SIDE) req|= MTLREQ_2SIDE; - // if (pixelSampler && pixelSampler->GetEnable() ) - if ( flags&NEWSTDMTL_SSAMP_ON ) - req|= MTLREQ_SUPERSAMPLE; - if (flags&NEWSTDMTL_WIRE_UNITS) req|= MTLREQ_WIRE_ABS; - if (flags&NEWSTDMTL_FACEMAP) req |= MTLREQ_FACEMAP; - if (flags&NEWSTDMTL_ADD_TRANSP) req |= MTLREQ_ADDITIVE_TRANSP; - if (flags&NEWSTDMTL_FACETED) req |= MTLREQ_FACETED; - if (MAPACTIVE(dispChan)) req |= MTLREQ_DISPLACEMAP; - return req; -} - -int XRayMtl::MapSlotType(int i) -{ - if (i==stdIDToChannel[ID_DP]) return MAPSLOT_DISPLACEMENT; // DS 4/12/99 - return (i==stdIDToChannel[ID_RL] || i==stdIDToChannel[ID_RR])? -MAPSLOT_ENVIRON : MAPSLOT_TEXTURE; -} - -void XRayMtl::MappingsRequired(int subMtlNum, BitArray & mapreq, BitArray &bumpreq) { - int bumpChan = stdIDToChannel[ ID_BU ]; - for (int i=0; iMappingsRequired(subMtlNum,bumpreq,bumpreq); - else - (*maps)[i].map->MappingsRequired(subMtlNum,mapreq,bumpreq); - } - } -} - -Interval XRayMtl::Validity(TimeValue t) { - Interval v; - Update(t, v); - return ivalid; -} - -void XRayMtl::NotifyChanged() { - NotifyDependents(FOREVER, PART_ALL, REFMSG_CHANGE); -} - -void XRayMtl::SetFlag(ULONG f, ULONG val) { - if (val) flags|=f; - else flags &= ~f; -} - -void XRayMtl::SetTransparencyType(int type) { - switch (type) { -case TRANSP_SUBTRACTIVE: - SetFlag(NEWSTDMTL_ADD_TRANSP, 0); - SetFlag(NEWSTDMTL_FILT_TRANSP, 0); - pb_extended->SetValue(std2_opacity_type, 0, 1); - break; -case TRANSP_ADDITIVE: - SetFlag(NEWSTDMTL_ADD_TRANSP, 1); - SetFlag(NEWSTDMTL_FILT_TRANSP, 0); - pb_extended->SetValue(std2_opacity_type, 0, 2); - break; -case TRANSP_FILTER: - SetFlag(NEWSTDMTL_ADD_TRANSP, 0); - SetFlag(NEWSTDMTL_FILT_TRANSP, 1); - pb_extended->SetValue(std2_opacity_type, 0, 0); - break; - } -} - -void XRayMtl::DeleteThis() -{ - xr_delete((XRayMtl*)this); -} - - -TSTR XRayMtl::SubAnimName(int i) { - switch(i){ -case TEXMAPS_SUB: return TSTR(GetString( IDS_DS_TEXMAPS )); -case SHADER_SUB: return TSTR(GetString( IDS_KE_SHADER )); -case EXTRA_PB_SUB: return TSTR(GetString( IDS_DS_EXTRA )); -case SAMPLING_PB_SUB: return TSTR(GetString( IDS_KE_SAMPLING )); -case DYNAMICS_PB_SUB: return TSTR(GetString( IDS_DS_DYNAMICS )); - } - return TSTR(""); -} - -Animatable* XRayMtl::SubAnim(int i) { - switch(i) { -case TEXMAPS_SUB: return maps; -case SHADER_SUB: return pShader; -case EXTRA_PB_SUB: return pb_extended; -case SAMPLING_PB_SUB: return pb_sampling; -case DYNAMICS_PB_SUB: return pb_dynamics; -default: DbgAssert(0); return NULL; - } -} - -int XRayMtl::SubNumToRefNum(int subNum) -{ - switch (subNum) - { - case TEXMAPS_SUB: return TEXMAPS_REF; - case SHADER_SUB: return SHADER_REF; - case EXTRA_PB_SUB: return EXTENDED_PB_REF; - case SAMPLING_PB_SUB: return SAMPLING_PB_REF; - case DYNAMICS_PB_SUB: return DYNAMICS_PB_REF; - default: DbgAssert(0); return 0; - } -} - -IParamBlock2* -XRayMtl::GetParamBlock(int i) -{ - switch (i) - { - case 0: return pb_shader; - case 1: return pb_extended; - case 2: return pb_sampling; - case 3: return pb_maps; - case 4: return pb_dynamics; - case 5: return pb_xray; - } - return NULL; -} - -IParamBlock2* -XRayMtl::GetParamBlockByID(BlockID id) -{ - // return id'd ParamBlock - switch (id) - { - case std2_shader: return pb_shader; - case std2_extended: return pb_extended; - case std2_sampling: return pb_sampling; - case std_maps: return pb_maps; - case std2_dynamics: return pb_dynamics; - case std2_xray: return pb_xray; - } - return NULL; -} - -RefTargetHandle XRayMtl::GetReference(int i) { - switch(i) { -case OLD_PBLOCK_REF: return old_pblock; // old pblock, replaced by the 6 new pb2's -case TEXMAPS_REF: return maps; -case SHADER_REF: return pShader; -case SHADER_PB_REF: return pb_shader; -case EXTENDED_PB_REF: return pb_extended; -case SAMPLING_PB_REF: return pb_sampling; -case MAPS_PB_REF: return pb_maps; -#ifndef DESIGN_VER -case DYNAMICS_PB_REF: return pb_dynamics; -#else -case DYNAMICS_PB_REF: return NULL; -#endif -case XRAY_PB_REF: return pb_xray; -case SAMPLER_REF: return pixelSampler; -default: assert(0); return NULL; - } -} - -void XRayMtl::SetReference(int i, RefTargetHandle rtarg) { - switch(i) { -case OLD_PBLOCK_REF: old_pblock = (IParamBlock*)rtarg; return; -case TEXMAPS_REF: { - maps = (Texmaps*)rtarg; - if (maps != NULL) - maps->client = this; - return; - } -case SHADER_REF: - if (IsShaderInUI()){ - pShader->GetParamDlg()->SetThings(this, NULL); - pShader->SetParamDlg(NULL); - } - pShader = (Shader*)rtarg; - - return; -case SHADER_PB_REF: pb_shader = (IParamBlock2*)rtarg; return; -case EXTENDED_PB_REF: pb_extended = (IParamBlock2*)rtarg; return; -case SAMPLING_PB_REF: pb_sampling = (IParamBlock2*)rtarg; return; -case MAPS_PB_REF: pb_maps = (IParamBlock2*)rtarg; return; -case DYNAMICS_PB_REF: pb_dynamics = (IParamBlock2*)rtarg; return; -case XRAY_PB_REF: pb_xray = (IParamBlock2*)rtarg; return; -case SAMPLER_REF: pixelSampler = (Sampler*)rtarg; return; -default: assert(0); - } -} - -void XRayMtl::SetSubTexmap(int i, Texmap *m) -{ - assert(i < STD2_NMAX_TEXMAPS); - pb_maps->SetValue(std2_maps, TimeValue(0), m, i); -} - -// mjm - begin - 06.02.00 -void XRayMtl::UpdateReshadeRequirements(RefTargetHandle hTarget, PartID partID) -{ - if (!killRefmsg.DistributeRefmsg()) - { - mReshadeRQ = RR_None; - } - else if (hTarget == maps) - { - mReshadeRQ = RR_NeedPreshade; - } - else if (hTarget == pShader) - { - mReshadeRQ = RR_NeedReshade; - } - else if (hTarget == pb_xray) - { - mReshadeRQ = RR_None; - } - else if (hTarget == pb_shader) - { - mReshadeRQ = RR_NeedReshade; - } - else if (hTarget == pb_extended) - { - mReshadeRQ = RR_NeedReshade; - } - else if (hTarget == pb_sampling) - { - mReshadeRQ = RR_None; - } - else if (hTarget == pb_maps) - { - if ( pb_maps->LastNotifyParamID() == std2_map_amnts) - mReshadeRQ = RR_NeedReshade; - else - mReshadeRQ = RR_NeedPreshade; - } - else if (hTarget == pb_dynamics) - { - mReshadeRQ = RR_None; - } - else if (hTarget == pixelSampler) - { - mReshadeRQ = RR_None; - } - - mReshadeRQ = chooseReshade[mReshadeRQ][mInRQ]; - mInRQ = RR_None; -} -// mjm - end - -// invaldate for the viewport -RefResult XRayMtl::NotifyRefChanged( Interval changeInt, RefTargetHandle hTarget, - PartID& partID, RefMessage message ) -{ - switch (message) { -case REFMSG_WANT_SHOWPARAMLEVEL: - { - BOOL *pb = (BOOL *)(partID); - *pb = TRUE; - return REF_STOP; - } -case REFMSG_CHANGE: - UpdateReshadeRequirements(hTarget, partID); // mjm - 06.02.00 - - ivalid.SetEmpty(); - // ask ClassDesc if any paramblock change caused the notify - // if not and changing ref was one of the pblocks, inval all PB2 UI - // else inval indicated param UI - IParamBlock2* cpb; - ParamID changing_param = stdmtl2CD.LastNotifyParamID(this, cpb); - if (hTarget != pShader) // && hTarget != maps) - { - if (changing_param != -1) - { - // DS 10/13/00: I needed to add code to check of the dialog for this map was actualy active because - // on during the creation of new materials, messages were getting routed to the current - // medit material, causing problems for undo of sub-object mtl assignment. - // DS 10/24/31: Removed the test because it isn't quite right, and was causing some problems ( #264662) - // and no longer seems necessary. (we need a better test for whether a mtl is in medit or not) - //if (cpb->GetMap()&&cpb->GetMap()->DlgActive())) - cpb->GetDesc()->InvalidateUI(changing_param); - if (changing_param == std2_opacity && - cpb == pb_extended && pShader && - pShader->GetParamDlg()) - pShader->GetParamDlg()->UpdateOpacity(); - } - else - { - stdmtl2CD.InvalidateUI(); - if (hTarget == pb_extended && pShader && - pShader->GetParamDlg()) - pShader->GetParamDlg()->UpdateOpacity(); - if (texHandle[0]||texHandle[1]) { - if (curImp) - curImp->MtlChanged(); - } - } - DiscardTexHandles(); // DS 5/22/00 - } - break; - } - - return REF_SUCCEED; -} - -Class_ID XRayMtl::ClassID() { return XRAYMTL_CLASS_ID; } - -TSTR XRayMtl::GetSubTexmapSlotName(int i) { - if ( pShader ){ - long nShaderChan = pShader->nTexChannelsSupported(); - if ( i < nShaderChan ) - return pShader->GetTexChannelName( i ); - else - return GetString( mtlChannelNameIDS[i - nShaderChan] ); - } else return TSTR(""); -} - - -void XRayMtl::EnableMap(int i, BOOL onoff) { - pb_maps->SetValue(std2_map_enables, TimeValue(0), onoff, i); -} - -void XRayMtl::SetFilter(Color c, TimeValue t) { - filter = c; - pb_extended->SetValue( std2_filter_color, t, Point3(c.r, c.g, c.b)); - int opacChan = stdIDToChannel[ ID_OP ]; - if (opacity!=1.0f||opfall!=0.0f||MAPACTIVE(opacChan)) - NotifyChanged(); -} - -void XRayMtl::SetIOR(float v, TimeValue t) { - ioRefract = v; - pb_extended->SetValue(std2_ior, t, v); -} - -void XRayMtl::SetOpacity(float v, TimeValue t) { - opacity = v; - pb_extended->SetValue(std2_opacity, t, v); -} - -void XRayMtl::SetOpacFalloff(float v, TimeValue t) { - opfall = v; - pb_extended->SetValue(std2_falloff_amnt, t, v); - int opacChan = stdIDToChannel[ ID_OP ]; - if (opacity!=1.0f||opfall!=0.0f||MAPACTIVE(opacChan)) - NotifyChanged(); -} - -void XRayMtl::SetWireSize(float v, TimeValue t) { - wireSize = v; - pb_extended->SetValue(std2_wire_size, t, v); - if (flags&NEWSTDMTL_WIRE) - NotifyChanged(); -} - -void XRayMtl::SetDimIntens(float v, TimeValue t) { - dimIntens = v; - pb_extended->SetValue(std2_dim_lvl, t, v); -} - -void XRayMtl::SetDimMult(float v, TimeValue t) { - dimMult = v; - pb_extended->SetValue(std2_refl_lvl, t, v); -} - -void XRayMtl::SetTexmapAmt(int imap, float amt, TimeValue t) { - pb_maps->SetValue(std2_map_amnts, t, amt, imap); -} - -///////////////////////////////////////////////////////////////////// -// shaders -void XRayMtl::SetShaderIndx( long indx, BOOL update ) -{ - if( !update ) shaderId = NO_UPDATE; - pb_shader->SetValue(std2_shader_type, 0, indx<0 ? 0 : indx ); - shaderId = indx; -} - -void XRayMtl::SetSamplerIndx( long indx, BOOL update ) -{ - if( !update ) samplerId = NO_UPDATE; - pb_sampling->SetValue(std2_ssampler, 0, indx<0 ? 0 : indx ); - samplerId = indx; -} - - -static Class_ID ClassID0(0, 0); -static Class_ID ClassID1(1, 0); - -void XRayMtl::SetShader( Shader* pNewShader ) -{ - // if ( (pShader?pShader->ClassID():ClassID0) != (pNewShader?pNewShader->ClassID():ClassID1) ){ - ReplaceReference( SHADER_REF, pNewShader ); - NotifyChanged(); - NotifyDependents(FOREVER, 0, REFMSG_SUBANIM_STRUCTURE_CHANGED); - // } -} - -// the shader Gets & Sets -BOOL XRayMtl::IsSelfIllumColorOn() -{ if (pShader->SupportStdParams() & STD_PARAM_SELFILLUM_CLR){ - return pShader->IsSelfIllumClrOn(); -} -return FALSE; -} - -void XRayMtl::SetSelfIllumColorOn( BOOL on ) -{ if (pShader->SupportStdParams() & STD_PARAM_SELFILLUM_CLR){ - pShader->SetSelfIllumClrOn( on ); -} -} - -void XRayMtl::SetAmbient(Color c, TimeValue t) -{ if (pShader->SupportStdParams() & STD_PARAM_AMBIENT_CLR){ - pShader->SetAmbientClr( c, t ); -} -} - -void XRayMtl::SetDiffuse(Color c, TimeValue t) -{ if (pShader->SupportStdParams() & STD_PARAM_DIFFUSE_CLR){ - pShader->SetDiffuseClr( c, t ); -} -} - -void XRayMtl::SetSpecular(Color c, TimeValue t) -{ if (pShader->SupportStdParams() & STD_PARAM_SPECULAR_CLR){ - pShader->SetSpecularClr( c, t ); -} -} - -void XRayMtl::SetShininess(float v, TimeValue t) -{ if (pShader->SupportStdParams() & STD_PARAM_GLOSSINESS ){ - pShader->SetGlossiness( v, t ); -} -} - -void XRayMtl::SetShinStr(float v, TimeValue t) -{ if (pShader->SupportStdParams() & STD_PARAM_SPECULAR_LEV ){ - pShader->SetSpecularLevel( v, t ); -} -} - -void XRayMtl::SetSelfIllum(float v, TimeValue t) -{ if (pShader->SupportStdParams() & STD_PARAM_SELFILLUM ){ - pShader->SetSelfIllum( v, t ); -} -} - - -void XRayMtl::SetSelfIllumColor(Color c, TimeValue t) -{ if (pShader->SupportStdParams() & STD_PARAM_SELFILLUM_CLR){ - pShader->SetSelfIllumClr( c, t ); -} -} - -static Color blackClr( 0.0, 0.0, 0.0 ); - -Color XRayMtl::GetAmbient(int mtlNum, BOOL backFace) -{ - return pShader->GetAmbientClr( mtlNum, backFace ); -} - -Color XRayMtl::GetDiffuse(int mtlNum, BOOL backFace) -{ - return pShader->GetDiffuseClr( mtlNum, backFace ); -} - -Color XRayMtl::GetSpecular(int mtlNum, BOOL backFace) -{ - return pShader->GetSpecularClr( mtlNum, backFace ); -} - -Color XRayMtl::GetSelfIllumColor(int mtlNum, BOOL backFace) -{ - return pShader->GetSelfIllumClr( mtlNum, backFace ); -} - - -float XRayMtl::GetShininess(int mtlNum, BOOL backFace) -{ - float g = pShader->GetGlossiness( mtlNum, backFace ); - return Bound( g, 0.01f, 1.0f ); -} - -float XRayMtl::GetShinStr(int mtlNum, BOOL backFace) -{ - return pShader->GetSpecularLevel( mtlNum, backFace ); -} - -float XRayMtl::GetSelfIllum(int mtlNum, BOOL backFace) -{ - return pShader->GetSelfIllum( mtlNum, backFace ); -} - -float XRayMtl::GetShininess(TimeValue t) -{ - return pShader->GetGlossiness( t ); -} - -float XRayMtl::GetShinStr(TimeValue t) -{ - return pShader->GetSpecularLevel( t ); -} - -float XRayMtl::GetSelfIllum(TimeValue t) -{ - return pShader->GetSelfIllum(t); -} - - -BOOL XRayMtl::GetSelfIllumColorOn(int mtlNum, BOOL backFace) -{ - return pShader->IsSelfIllumClrOn(); -} - -Color XRayMtl::GetAmbient(TimeValue t) -{ - return pShader->GetAmbientClr( t ); -} -Color XRayMtl::GetDiffuse(TimeValue t) -{ - return pShader->GetDiffuseClr(t); -} -Color XRayMtl::GetSpecular(TimeValue t) -{ - return pShader->GetSpecularClr( t ); -} -Color XRayMtl::GetSelfIllumColor(TimeValue t) -{ - return pShader->GetSelfIllumClr(t ); -} - -float XRayMtl::GetSoftenLevel( TimeValue t) -{ - return pShader->GetSoftenLevel(t); -} - -Color XRayMtl::GetFilter() { return filter; } -float XRayMtl::GetTexmapAmt(int imap) { return maps->txmap[imap].amount; } -float XRayMtl::GetTexmapAmt(int imap, TimeValue t) { return maps->txmap[imap].GetAmount(t); } - -Color XRayMtl::GetFilter(TimeValue t) { return pb_extended->GetColor(std2_filter_color, t); } -float XRayMtl::GetOpacity( TimeValue t) { return pb_extended->GetFloat(std2_opacity, t); } -float XRayMtl::GetOpacFalloff(TimeValue t){ return pb_extended->GetFloat(std2_falloff_amnt, t);} -float XRayMtl::GetWireSize(TimeValue t) { return pb_extended->GetFloat(std2_wire_size, t);} -float XRayMtl::GetIOR( TimeValue t) { return pb_extended->GetFloat(std2_ior, t);} -float XRayMtl::GetDimIntens( TimeValue t) { return pb_extended->GetFloat(std2_dim_lvl, t); } -float XRayMtl::GetDimMult( TimeValue t) { return pb_extended->GetFloat(std2_refl_lvl, t); } -BOOL XRayMtl::MapEnabled(int i) { return maps->txmap[i].mapOn;} - - -float XRayMtl::GetDynamicsProperty(TimeValue t, int mtlNum, int propID) { - float val; - Interval ivalid; - switch(propID) { -case DYN_BOUNCE: - pb_dynamics->GetValue(std2_bounce, t, val, ivalid); - return val; -case DYN_STATIC_FRICTION: - pb_dynamics->GetValue(std2_static_friction, t, val, ivalid); - return val; -case DYN_SLIDING_FRICTION: - pb_dynamics->GetValue(std2_sliding_friction, t, val, ivalid); - return val; -default: - assert(0); - return 0.0f; - } -} - -void XRayMtl::SetDynamicsProperty(TimeValue t, int mtlNum, int propID, float value){ -#ifndef DESIGN_VER - switch(propID) { -case DYN_BOUNCE: - pb_dynamics->SetValue( std2_bounce, t, value); - break; -case DYN_STATIC_FRICTION: - pb_dynamics->SetValue( std2_static_friction, t, value); - break; -case DYN_SLIDING_FRICTION: - pb_dynamics->SetValue( std2_sliding_friction, t, value); - break; -default: - assert(0); - break; - } -#endif -} - -// returns the index of the shader in the list -int XRayMtl::FindShader( Class_ID& findId, ClassDesc** ppCD ) -{ - for (int i = 0; i < XRayMtl::NumShaders(); i++) { - ClassDesc* pCD = XRayMtl::GetShaderCD(i); - if ( findId == pCD->ClassID() ){ - if (ppCD) *ppCD = pCD; - return i; - } - } - if (ppCD) *ppCD = NULL; // not found - return -1; -} - -int XRayMtl::FindSampler( Class_ID findId, ClassDesc** ppCD ) -{ - for (int i = 0; i < XRayMtl::NumSamplers(); i++) { - ClassDesc* pCD = XRayMtl::GetSamplerCD(i); - if ( findId == pCD->ClassID() ){ - if (ppCD) *ppCD = pCD; - return i; - } - } - if (ppCD) *ppCD = NULL; // not found - return -1; -} - -/*** -ClassDesc* XRayMtl::SamplerIndxToCD( int indx ) -{ -IParamMap2* map = pb_sampling ? pb_sampling->GetMap() : NULL; -if ( indx < 0 ) indx = 0; -if ( map ) { -HWND hwnd = map->GetHWnd(); -HWND hwndSampler = GetDlgItem(hwnd, IDC_PIX_SAMPLER); -ClassDesc* pCD = (ClassDesc*)SendMessage( hwndSampler, CB_GETITEMDATA, indx, 0 ); -return pCD; -} -// last resort -SubClassList * scList = GetCOREInterface()->GetDllDir().ClassDir().GetClassList(SAMPLER_CLASS_ID); -return (*scList)[ 1 ].CD(); -} -***/ - - - -///////////////////////////////////////////////////////////////////////// -// Filing -// -#define MTL_HDR_CHUNK 0x4000 -#define NEWSTDMTL_FLAGS_CHUNK 0x5000 -#define NEWSTDMTL_SHADING_CHUNK 0x5004 -#define NEWSTDMTL_TEX_ONOFF_CHUNK 0x5002 -#define NEWSTDMTL_TEX_AMT0 0x5100 -#define NEWSTDMTL_TEX_AMT1 0x5101 -#define NEWSTDMTL_TEX_AMT2 0x5102 -#define NEWSTDMTL_TEX_AMT3 0x5103 -#define NEWSTDMTL_TEX_AMT4 0x5104 -#define NEWSTDMTL_TEX_AMT5 0x5105 -#define NEWSTDMTL_TEX_AMT6 0x5106 -#define NEWSTDMTL_TEX_AMT7 0x5107 -#define NEWSTDMTL_TEX_AMT8 0x5108 -#define NEWSTDMTL_TEX_AMT9 0x5109 -#define NEWSTDMTL_TEX_AMTA 0x510A - -//xray part -#define NEWSTDMTL_XRAY_ESHADER_CHUNK 0x5200 -#define NEWSTDMTL_XRAY_CSHADER_CHUNK 0x5201 -#define NEWSTDMTL_XRAY_GAMEMTL_CHUNK 0x5202 - -//#define NEWSTDMTL_BUMP1_CHUNK 0x5200 -#define NEWSTDMTL_VERS_CHUNK 0x5300 -#define NEWSTDMTL_DIM_REFLECT 0x5400 - -#define NEWSTDMTL_SELFILLUM_CLR_ON 0x5500 -#define NEWSTDMTL_SAMPLING_ON 0x5510 -#define NEWSTDMTL_SAMPLING_QUALITY 0x5511 - -// IO -IOResult XRayMtl::Save(ISave *isave) -{ - ULONG nb; - IOResult res; - isave->BeginChunk(MTL_HDR_CHUNK); - res = MtlBase::Save(isave); - if (res!=IO_OK) return res; - isave->EndChunk(); - - isave->BeginChunk(NEWSTDMTL_VERS_CHUNK); - int version = CURRENT_NEWSTDMTL_VERSION; - isave->Write(&version, sizeof(version), &nb); - isave->EndChunk(); - - // xray params - isave->BeginChunk(NEWSTDMTL_XRAY_ESHADER_CHUNK); - isave->WriteCString(GetEShader(eshaderId)); - isave->EndChunk(); - - isave->BeginChunk(NEWSTDMTL_XRAY_CSHADER_CHUNK); - isave->WriteCString(GetCShader(cshaderId)); - isave->EndChunk(); - - isave->BeginChunk(NEWSTDMTL_XRAY_GAMEMTL_CHUNK); - isave->WriteCString(GetGameMtl(gamemtlId)); - isave->EndChunk(); - - return IO_OK; -} - - -static INode* FindNodeRef(ReferenceTarget *rt) { - DependentIterator di(rt); - ReferenceMaker *rm; - INode *nd = NULL; - while (rm=di.Next()) { - if (rm->SuperClassID()==BASENODE_CLASS_ID) return (INode *)rm; - nd = FindNodeRef((ReferenceTarget *)rm); - if (nd) return nd; - } - return NULL; -} - - - -static float GetNodeScaling(Mtl *m) { - INode *n = FindNodeRef(m); - if (n==NULL) - return 1.0f; - Interval v; - Matrix3 tm = n->GetNodeTM(0, &v); - float f = float( _abs(Length(tm.GetRow(0))) +_abs(Length(tm.GetRow(1))) + _abs(Length(tm.GetRow(2))) )/3.0f; - return f; -} - - -//----------------------------------------------------------------------- -// DS - 4/7/97: Changed Opacity, Self-illumination, SHininess, Shininess strengh -// so that the map amount blends between the corresponding slider -// setting and the map value. This code fixes up old files so they -// will render the same way. This does not correctly handle animated values -// for the amount or parameter sliders. -// -// KE - 8/4/98 modified for converting old stdmtls to stdmtl2's -// JBW - 11/19/98 updated to convert old stdmtls and v.10 stdmtl2's to ParamBlock2-based XRayMtl's -//----------------------------------------------------------------------- - -void XRayMtl::OldVerFix(int loadVer) -{ - ULONG stdParams; - - macroRecorder->Disable(); - - // ask the ClassDesc to make the P_AUTO_CONSTRUCT paramblock2s - stdmtl2CD.MakeAutoParamBlocks(this); - - if (loadVer < 10) { - // create a shader, note: always a stdshader as it's an old version - if ( shaderId < 0 || shaderId > 3 ) shaderId = 1; // v1 files - long cid; - switch( shaderId ) { -case 0: cid = PHONGClassID; - pb_shader->SetValue(std2_faceted,0,TRUE); - break; -case 1: cid = PHONGClassID; break; -case 2: cid = METALClassID; break; -case 3: cid = BLINNClassID; break; - } - long indx = FindShader( Class_ID(cid, 0) ); - - if ( indx < 0 ) return; - - // this sets the new shader via pb2 accessor - SetShaderIndx( indx ); - - pShader->SetSelfIllumClrOn( FALSE ); - stdParams = pShader->SupportStdParams(); - - // convert param blocks - IParamBlock* oldPB = old_pblock; - IParamBlock* newParamBlk = UpdateParameterBlock(stdmtlPB, NPARAMS_O, oldPB, - stdmtl2PB, NPARAMS, NEWSTDMTL_PBVERSION); - - // if shader is PB2-based, give it the PB2 remapping descriptor - if (pShader->NumParamBlocks() > 0) - pShader->ConvertParamBlk(stdmtlPB2, NPARAMS_O, oldPB); - else - pShader->ConvertParamBlk(stdmtlPB, NPARAMS_O, oldPB); - - ReplaceReference( OLD_PBLOCK_REF, newParamBlk ); - UpdateTexmaps(); - std2_extended_blk.SetSubTexNo(std2_ep_filter_map, stdIDToChannel[ID_FI]); - - SetSamplerIndx( FindSampler( Class_ID(DEFAULT_SAMPLER_CLASS_ID,0) ) ); - if (flags & NEWSTDMTL_SSAMP_ON) { - pb_sampling->SetValue( std2_ssampler_enable,0, TRUE ); - } - - // gloss & strength are swapped from old versions - TexmapSlot tmSlot = maps->txmap[ID_SH]; - maps->txmap[ID_SH] = maps->txmap[ID_SS]; - maps->txmap[ID_SS] = tmSlot; - - - } - - // now set values that were previously stored outside the PB, prior to update - pb_shader->SetValue(std2_wire, 0, GetFlag(NEWSTDMTL_WIRE)!=0); - pb_shader->SetValue(std2_two_sided, 0, GetFlag(NEWSTDMTL_2SIDE)!=0); - pb_shader->SetValue(std2_face_map, 0, GetFlag(NEWSTDMTL_FACEMAP)!=0); - pb_shader->SetValue(std2_faceted, 0, GetFlag(NEWSTDMTL_FACETED)!=0); - - pb_extended->SetValue(std2_opacity_type, 0, (GetFlag(NEWSTDMTL_ADD_TRANSP) ? 2 : GetFlag(NEWSTDMTL_FILT_TRANSP) ? 0 : 1)); - pb_extended->SetValue(std2_falloff_type, 0, GetFlag(NEWSTDMTL_FALLOFF_OUT) ? 1 : 0); - pb_extended->SetValue(std2_wire_units, 0, GetFlag(NEWSTDMTL_WIRE_UNITS) ? 1 : 0); - pb_extended->SetValue(std2_apply_refl_dimming, 0, dimReflect); - - pShader->SetLockAD( GetFlag(NEWSTDMTL_LOCK_AD)?TRUE:FALSE ); - pShader->SetLockDS( GetFlag(NEWSTDMTL_LOCK_DS)?TRUE:FALSE ); - pShader->SetLockADTex( GetFlag(NEWSTDMTL_LOCK_ADTEX)!=0 ); - pb_maps->SetValue(std2_mp_ad_texlock, 0, GetFlag(NEWSTDMTL_LOCK_ADTEX)!=0 ); - - if (loadVer < 8) { - Interval v; - Update(0, v); - // In old versions, the ID's & the channel numbers correspond - if (MAPACTIVE(ID_OP)) { - if (maps->txmap[ID_OP].amount != 1.0f) - SetOpacity(0.0f, 0); - } - - if ( stdParams & STD_PARAM_SELFILLUM ) - if (MAPACTIVE(ID_SI)) { - if (maps->txmap[ID_SI].amount != 1.0f) - pShader->SetSelfIllum(0.0f, 0); - } - - if ( stdParams & STD_PARAM_SPECULAR_LEV ) - if (MAPACTIVE(ID_SS)) { - float amt = maps->txmap[ID_SS].amount; - SetTexmapAmt(ID_SS, amt * pShader->GetSpecularLevel(0, 0), 0); - pShader->SetSpecularLevel(0.0f, 0); - } - - if ( stdParams & STD_PARAM_GLOSSINESS ) - if (MAPACTIVE(ID_SH)) { - float amt = maps->txmap[ID_SH].amount; - SetTexmapAmt(ID_SH, amt* pShader->GetGlossiness(0, 0), 0); - pShader->SetGlossiness(0.0f, 0); - } - - } - if (loadVer < 9) { - if ( stdParams & STD_PARAM_SOFTEN_LEV ) - if (flags&NEWSTDMTL_SOFTEN) - pShader->SetSoftenLevel(.6f, 0); - else - pShader->SetSoftenLevel(0.0f, 0); - } - - // at this point we have a v10 Stdmtl2, convert to PB2-based - // distribute old pblock values to new pb2 blocks - UpdateParameterBlock2(extVer10, NPARAMS, old_pblock, &std2_extended_blk, pb_extended); -#ifndef DESIGN_VER - UpdateParameterBlock2(dynVer10, NPARAMS, old_pblock, &std2_dynamics_blk, pb_dynamics); -#endif - - // mask off rollup flags - flags &= ~NEWSTDMTL_ROLLUP_FLAGS; - flags |= NEWSTDMTL_ROLLUP1_OPEN; - // pb_shader->SetRolloutOpen( flags & NEWSTDMTL_ROLLUP1_OPEN ); - - macroRecorder->Enable(); - - // delete old pblock - ReplaceReference(OLD_PBLOCK_REF, NULL); - -} - - -// versin update post-load call back -class NewStdMtl2UpdateCB: public PostLoadCallback { -public: - // create shader & new pblock - XRayMtl *m; - int loadVersion; - - NewStdMtl2UpdateCB( XRayMtl *s, int loadVers ){ m = s; loadVersion = loadVers; } - void proc(ILoad *iload) { - m->OldVerFix( loadVersion ); - xr_delete((NewStdMtl2UpdateCB*)this); - } -}; - -void XRayMtl::BumpFix( ) { - // Fix up bump map amount on old files if the node is scaled. DS 4/16/99 - int bumpChannel = stdIDToChannel[ID_BU]; - if ((*maps)[ bumpChannel].IsActive()) { - float s = GetNodeScaling(this); - if (s!=1.0f) { - float am = GetTexmapAmt(bumpChannel); - SetTexmapAmt(bumpChannel, s*am, 0); - } - } -} - - -// Bumpp map amount fix post-load call back -class NewStdMtl2BumpFixCB: public PostLoadCallback { -public: - // create shader & new pblock - XRayMtl *m; - - NewStdMtl2BumpFixCB( XRayMtl *s ){ m = s; } - int Priority() { return 7; } // run at lower priority after normal PLCB's are all finished - void proc(ILoad *iload) { - m->BumpFix( ); - xr_delete((NewStdMtl2BumpFixCB*)this); - } -}; - -// post-load finalize callback -class NewStdMtl2CB: public PostLoadCallback { -public: - XRayMtl *m; - - NewStdMtl2CB(XRayMtl *s){ m = s; } - void proc(ILoad *iload) - { - // ensure all map-related parameters are set up - m->UpdateTexmaps(); - - // make sure the right indx is selected for shaders & samplers - m->SetShaderIndx( m->FindShader( m->pShader->ClassID() ), FALSE ); - if( m->pixelSampler == NULL ) // for some alpha files! - m->SetSamplerIndx( m->FindSampler( Class_ID(DEFAULT_SAMPLER_CLASS_ID,0) ) ); - - m->SetSamplerIndx( m->FindSampler( m->pixelSampler->ClassID() ), FALSE ); - m->SetFlag(NEWSTDMTL_SSAMP_ON, m->pixelSampler->GetEnable() ); - -#ifndef DESIGN_VER - if( m->pb_dynamics == NULL ) - //create the parameter block - CreateParameterBlock2(&std2_dynamics_blk, m); -#endif - if( m->pb_xray == NULL ) - //create the parameter block - CreateParameterBlock2(&std2_xray_blk, m); - - m->SetEShaderIndx( m->eshaderId ); - m->SetCShaderIndx( m->cshaderId ); - m->SetGameMtlIndx( m->gamemtlId ); - - - // DS - 2/11/99 This Update should not be here: it causes all - // submaps to be loaded when loading, which makes loading matlibs very slow. - // Interval i; - // i.SetInfinite(); - // m->Update(0, i); - - xr_delete((NewStdMtl2CB*)this); - } -}; - -IOResult XRayMtl::Load(ILoad *iload) { - ULONG nb; - int id; - int version = 0; - dimReflect = FALSE; - - // fix old ver - gamemtlId = -1; - - IOResult res; - while (IO_OK==(res=iload->OpenChunk())) { - switch(id = iload->CurChunkID()) { -case MTL_HDR_CHUNK: - res = MtlBase::Load(iload); - ivalid.SetEmpty(); - break; -case NEWSTDMTL_FLAGS_CHUNK: - res = iload->Read(&flags, sizeof(flags), &nb); - break; -case NEWSTDMTL_SHADING_CHUNK: - res = iload->Read(&shaderId, sizeof(shaderId), &nb); - break; -case NEWSTDMTL_XRAY_ESHADER_CHUNK:{ - LPSTR es_name; - res = iload->ReadCStringChunk(&es_name); - if (res==IO_OK) eshaderId = XRayMtl::FindEShader(es_name); - }break; -case NEWSTDMTL_XRAY_CSHADER_CHUNK:{ - LPSTR cs_name; - res = iload->ReadCStringChunk(&cs_name); - if (res==IO_OK) cshaderId = XRayMtl::FindCShader(cs_name); - }break; -case NEWSTDMTL_XRAY_GAMEMTL_CHUNK:{ - LPSTR gm_name; - res = iload->ReadCStringChunk(&gm_name); - if (res==IO_OK) gamemtlId = XRayMtl::FindGameMtl(gm_name); - }break; -case NEWSTDMTL_VERS_CHUNK: - res = iload->Read(&version, sizeof(version), &nb); - break; -case NEWSTDMTL_TEX_ONOFF_CHUNK: - { - ULONG f; - res = iload->Read(&f, sizeof(f), &nb); - for (int i=0; itxmap[i].mapOn = (f&(1<CloseChunk(); - if (res!=IO_OK) - return res; - } - - // register version updaters - if (version <= FINAL_PARAMBLOCK_v1_VERSION) { - iload->RegisterPostLoadCallback(new ParamBlockPLCB((ParamVersionDesc*)oldNewStdMtlVersions, NEWSTDMTL_NUMOLDVER, &stdMtlVersion, this, 0)); - iload->RegisterPostLoadCallback(new NewStdMtl2UpdateCB(this, version)); - if (version<12) - iload->RegisterPostLoadCallback(new NewStdMtl2BumpFixCB(this)); - iload->SetObsolete(); - } - - if (TextureDisplayEnabled()) { - IncrActive(); - } - - if (gamemtlId==-1) gamemtlId = XRayMtl::FindGameMtl("default"); - - // register plcb to finalize setup - iload->RegisterPostLoadCallback(new NewStdMtl2CB(this)); - - return IO_OK; -} - - -#define TRANSP_SUB 0 -#define TRANSP_ADD 1 -#define TRANSP_FILTER 2 - - -// Composite c_over on top of c. Assume c_over has pre-multiplied alpha. -IC void AlphaCompCol(Color& c, RGBA c_over) { - float ia = 1.0f - _abs(c_over.a); - ia = LBound( ia ); - c.r = c.r * ia + c_over.r; - c.g = c.g * ia + c_over.g; - c.b = c.b * ia + c_over.b; -} - -////////////////////////////////////////////////////////////////////////////// -// -// transpColor utility, same as in shaders/shaderUtil -// -Color XRayMtl::TranspColor( float opac, Color filt, Color diff ) -{ - // Compute the color of the transparent filter color - if (flags & NEWSTDMTL_ADD_TRANSP) { - float f = 1.0f - opac; - return Color(f, f, f); - - } else if ( flags & NEWSTDMTL_FILT_TRANSP ){ - // Transparent Filter color mapping - if (opac>0.5f) { - // darken as opac goes ( 0.5--> 1.0) - // so that max component reaches 0.0f when opac reaches 1.0 - // find max component of filt - float m = Max(filt); - float d = 2.0f*(opac-.5f)*m; - Color fc = filt-d; - fc = LBound( fc ); - return fc; - } else { - // lighten as opac goes ( 0.5--> 0.0) - // so that min component reaches 1.0f when opac reaches 1.0 - // find min component of filt - float m = Min(filt); - float d = (1.0f-2.0f*opac)*(1.0f-m); - Color fc = filt+d; - fc = UBound( fc ); - return fc; - } - - } else { - // original 3DS transparency, subtractive using diff color - Color f = (1.0f-diff); - return (1.0f-opac)*f; - } -} - - -#define DOMAP(n) ((n>=0) && sc.doMaps&&(*maps)[ n ].IsActive()) - -#ifdef _DEBUG -static long xStop = -1; -static long yStop = -1; -#endif - -// begin - ke/mjm - 03.16.00 - merge reshading code -//BOOL XRayMtl::SupportsReShading(ShadeContext& sc) { return TRUE; } - -void XRayMtl::PreShade(ShadeContext& sc, IReshadeFragment* pFrag ) -{ - RGBA mval; - Point3 N, N0, P; - -#ifdef _DEBUG - IPoint2 sPt = sc.ScreenCoord(); - if( sPt.x == xStop && sPt.y == yStop ) - long junk = -1; -#endif - - BOOL bumped = FALSE; - N = sc.Normal(); - - int ambChan = stdIDToChannel[ ID_AM ]; - int diffChan = stdIDToChannel[ ID_DI ]; - int trChan = stdIDToChannel[ ID_OP ]; - int filtChan = stdIDToChannel[ ID_FI ]; - ULONG trType = (flags & NEWSTDMTL_FILT_TRANSP) ? TRANSP_FILTER : - (flags & NEWSTDMTL_ADD_TRANSP) ? TRANSP_ADD : TRANSP_SUB; - - - // Do texture mapping - sc.SetIOR(ioRefract); - - // Bump mapping: Do this FIRST so other maps can use the perturbed normal - int bumpChannel = stdIDToChannel[ID_BU]; - if (DOMAP(bumpChannel)) { - Point3 dn = (*maps)[bumpChannel].EvalNormalPerturb(sc); - bumped = TRUE; - N = Normalize( N + (sc.backFace?-dn:dn)); - // NB: shadeContext has perturbed normal - sc.SetNormal(N); - pFrag->AddUnitVecChannel( N ); - } - - // All normal color & scalar maps are handled here - long t0 = pShader->ChannelType(0); - RGBA c; - for ( long i = 0; i < STD2_NMAX_TEXMAPS; ++i ) { - if ( sc.doMaps && (*maps)[ i ].IsActive()) { - long t = pShader->ChannelType(i); - // composite the channel - if ( (t & SKIP_CHANNELS)==0 ){ - if ( t & MONO_CHANNEL ) { - // note: r always holds channel data for mono channels - float m = (*maps)[i].map->EvalMono(sc); - pFrag->AddFloatChannel( m ); - } else { - if ( i != ambChan || (flags & NEWSTDMTL_LOCK_ADTEX)==0 ) { - c = (*maps)[i].map->EvalColor(sc); - if ((*maps)[i].map->IsHighDynamicRange()) { - LogLUV32Pixel lc; - - lc = c; - pFrag->AddIntChannel(lc.value); - pFrag->AddFloatChannel(c.a); - } - else { - BoundInPlace( c ); - pFrag->AddColorChannel(c); - } - } - } - } - } - } - - // Evaluate reflection map. - int reflChan = stdIDToChannel[ ID_RL ]; - if (DOMAP(reflChan)) { - AColor rcol; - Texmap *reflmap = (*maps)[reflChan].map; - if (reflmap->HandleOwnViewPerturb()) { - sc.TossCache(reflmap); - rcol = reflmap->EvalColor(sc); - } else - rcol = sc.EvalEnvironMap(reflmap, sc.ReflectVector()); - - if ((*maps)[reflChan].map->IsHighDynamicRange()) { - LogLUV32Pixel lc; - - lc = rcol; - pFrag->AddIntChannel(lc.value); - pFrag->AddFloatChannel(rcol.a); - } - else { - pFrag->AddColorChannel(rcol); - } - } - - // do refraction map - int refrChan = stdIDToChannel[ ID_RR ]; - if (DOMAP(refrChan)) { - // Evaluate refraction map, as yet unfiltered by filter color. - Texmap *refrmap = (*maps)[refrChan].map; - AColor rcol; - if (refrmap->HandleOwnViewPerturb()) - rcol = refrmap->EvalColor( sc ); - else - rcol = sc.EvalEnvironMap( refrmap, sc.RefractVector(ioRefract) ); - - if ((*maps)[refrChan].map->IsHighDynamicRange()) { - LogLUV32Pixel lc; - - lc = rcol; - pFrag->AddIntChannel(lc.value); - } - else { - pFrag->AddColorChannel(rcol); - } - } - - // see if the shader wants to save anything - IReshading* pReshading; - if((pReshading = (IReshading*)pShader->GetInterface(IID_IReshading)) != NULL ){ - pReshading->PreShade( sc, pFrag ); - } - if( bumped ) - sc.SetNormal( sc.OrigNormal() ); -} - -void XRayMtl::PostShade(ShadeContext& sc, IReshadeFragment* pFrag, int& nextTexIndex, IllumParams*) -{ - IllumParams ip(0, NULL); - Color lightCol, rescol, diffIllum0; - float opac; - RGBA mval; - Point3 P; - BOOL bumped = FALSE; - -#ifdef _DEBUG - IPoint2 sPt = sc.ScreenCoord(); - if( sPt.x == xStop && sPt.y == yStop ) - long junk = -1; -#endif - - pShader->Update( sc.CurTime(), FOREVER ); // mjm - 12.17.99 - pShader->GetIllumParams( sc, ip ); - ip.ClearOutputs(); - ip.pShader = pShader; - ip.pMtl = this; - - opac = opacity; - - int ambChan = stdIDToChannel[ ID_AM ]; - int diffChan = stdIDToChannel[ ID_DI ]; - int trChan = stdIDToChannel[ ID_OP ]; - int filtChan = stdIDToChannel[ ID_FI ]; - int reflChan = stdIDToChannel[ ID_RL ]; - int refrChan = stdIDToChannel[ ID_RR ]; - - if ( filtChan >= 0 )ip.channels[filtChan] = filter; - if ( trChan >= 0 ) ip.channels[trChan].r = opac; - ULONG trType = (flags & NEWSTDMTL_FILT_TRANSP) ? TRANSP_FILTER : - (flags & NEWSTDMTL_ADD_TRANSP) ? TRANSP_ADD : TRANSP_SUB; - - P = sc.P(); // position - - ip.stdParams = pShader->SupportStdParams(); - - // Do texture mapping - ip.hasComponents = 0; - ip.stdIDToChannel = stdIDToChannel; - // sc.SetIOR(ioRefract); - - // All normal color & scalar maps are handled here - if (pFrag->NChannels() > 0) { - - // bump mapping - if( DOMAP( stdIDToChannel[ ID_BU ] ) ) { - bumped = TRUE; - // NB: shadeContext has perturbed normal - sc.SetNormal( pFrag->GetUnitVecChannel( nextTexIndex++ ) ); - } - - RGBA c; - for ( long i = 0; i < STD2_NMAX_TEXMAPS; ++i ) { - if ( sc.doMaps && (*maps)[ i ].IsActive()) { - long t = pShader->ChannelType(i); - // composite the channel - if ( (t & SKIP_CHANNELS)==0 ){ - if ( t & MONO_CHANNEL ) { - // note: r always holds channel data for mono channels - ip.channels[ i ].r = (*maps)[i].LerpMono( ip.channels[ i ].r, pFrag->GetFloatChannel(nextTexIndex++)); // mjm - 1.17.00 - } else { - if ( i != ambChan || (flags & NEWSTDMTL_LOCK_ADTEX)==0 ) { - if ((*maps)[ i ].map->IsHighDynamicRange()) { - LogLUV32Pixel lc; - lc.value = pFrag->GetIntChannel(nextTexIndex++); - lc.GetRGB(c); - c.a = pFrag->GetFloatChannel(nextTexIndex++); - } - else { - c = pFrag->GetColorChannel(nextTexIndex++); - } - c *= (*maps)[i].amount; // mjm - 1.17.00 - AlphaCompCol( ip.channels[ i ], c); - } - } - // lock adtex, really channels 0 & 1 - if ( i == diffChan && (flags & NEWSTDMTL_LOCK_ADTEX) && ambChan >= 0 ) { - AlphaCompCol( ip.channels[ ambChan ], c ); - } - }// end, don't skip - } // end, is active - }// end, for each possible map - - // Evaluate reflection map. - if ( (*maps)[ reflChan ].map ) - ip.hasComponents |= HAS_REFLECT_MAP; - - if (DOMAP(reflChan) ) { - ip.hasComponents |= HAS_REFLECT; - AColor rcol; // mjm - 1.17.00 - if ((*maps)[ reflChan ].map->IsHighDynamicRange()) { - LogLUV32Pixel lc; - lc.value = pFrag->GetIntChannel(nextTexIndex++); - lc.GetRGB(rcol); - rcol.a = pFrag->GetFloatChannel(nextTexIndex++); - } - else { - rcol = pFrag->GetColorChannel( nextTexIndex++ ); // mjm - 1.17.00 - } - Color rc(rcol.r, rcol.g, rcol.b); - ip.channels[reflChan] = rc; - ip.reflectAmt = rcol.a * (*maps)[reflChan].amount; - } - - // do refraction map - if ( (*maps)[ refrChan ].map ) - ip.hasComponents |= HAS_REFRACT_MAP; - - if (DOMAP(refrChan) ) { - // Evaluate refraction map, as yet unfiltered by filter color. - ip.refractAmt = (*maps)[refrChan].amount; - AColor rcol; // mjm - 1.17.00 - if ((*maps)[ refrChan ].map->IsHighDynamicRange()) { - LogLUV32Pixel lc; - lc.value = pFrag->GetIntChannel(nextTexIndex++); - lc.GetRGB(rcol); - } - else { - rcol = pFrag->GetColorChannel( nextTexIndex++ ); // mjm - 1.17.00 - } - Color rc( rcol.r, rcol.g, rcol.b ); - ip.channels[refrChan] = rc; - ip.hasComponents |= HAS_REFRACT; - } - } // end, at least one map - - // get falloff opacity for possible use by shader or compositor - opac = ip.channels[trChan].r; // get (perhaps) textured opacity - - ip.finalOpac = GetEffOpacity( sc, opac ); - if( ip.finalOpac < 1.0f ) - ip.hasComponents |= HAS_OPACITY; - - // init the global ambient - ip.ambIllumOut = sc.ambientLight; - - // mapping done, illuminate... - IReshading* pReshading; - if((pReshading = (IReshading*)pShader->GetInterface(IID_IReshading)) != NULL ){ - pReshading->PostShade( sc, pFrag, nextTexIndex, &ip ); - } - - // return color in sc, not the frag itself - sc.out.c = ip.finalC; - sc.out.t = ip.finalT; - - if( bumped ) - sc.SetNormal( sc.OrigNormal() ); -} - -// too late for sdk, eco in progress -IllumParams* CloneIp( IllumParams& ip ) -{ - IllumParams* pClone = new IllumParams( ip.nUserIllumOut, ip.userIllumNames ); - pClone->finalC = ip.finalC; - pClone->finalT = ip.finalT; - pClone->finalOpac = ip.finalOpac; - pClone->finalAttenuation = ip.finalAttenuation; - pClone->ambIllumOut = ip.ambIllumOut; - pClone->diffIllumOut = ip.diffIllumOut; - pClone->transIllumOut = ip.transIllumOut; - pClone->selfIllumOut = ip.selfIllumOut; - pClone->specIllumOut = ip.specIllumOut; - pClone->reflIllumOut = ip.reflIllumOut; - pClone->transIllumOut = ip.transIllumOut; - pClone->diffIllumIntens = ip.diffIllumIntens; - for( int i=0; i < ip.nUserIllumOut; ++i ) - pClone->userIllumOut[i] = ip.userIllumOut[i]; - - pClone->stdParams = ip.stdParams; - pClone->hasComponents = ip.hasComponents; - pClone->pShader = ip.pShader; - pClone->pMtl = ip.pMtl; - pClone->stdIDToChannel = ip.stdIDToChannel; - pClone->refractAmt = ip.refractAmt; - pClone->reflectAmt = ip.reflectAmt; - - for( i=0; i < STD2_NMAX_TEXMAPS; ++i ) - pClone->channels[ i ] = ip.channels[ i ]; - - return pClone; -} - - -// if this function changes, please also check SupportsReShading, PreShade, PostShade -// end - ke/mjm - 03.16.00 - merge reshading code -// [attilas|24.5.2000] if this function changes, please also check EvalColorStdChannel -void XRayMtl::Shade(ShadeContext& sc) -{ - IllumParams ip( pShader->nUserIllumOut(), pShader->UserIllumNameArray() ); - Color lightCol, rescol, diffIllum0; - float opac; - RGBA mval; - Point3 N0, P; - -#ifdef _DEBUG - IPoint2 sPt = sc.ScreenCoord(); - if( sPt.x == xStop && sPt.y == yStop ) - long junk = -1; -#endif - - BOOL bumped = FALSE; - if (gbufID) sc.SetGBufferID(gbufID); - // ip.mtlFlags = flags; - - pShader->GetIllumParams( sc, ip ); - ip.ClearOutputs(); - ip.pShader = pShader; - ip.pMtl = this; - - // N0 = ip.N = sc.Normal(); - N0 = sc.Normal(); - opac = opacity; - - int ambChan = stdIDToChannel[ ID_AM ]; - int diffChan = stdIDToChannel[ ID_DI ]; - int trChan = stdIDToChannel[ ID_OP ]; - int filtChan = stdIDToChannel[ ID_FI ]; - if ( filtChan >= 0 )ip.channels[filtChan] = filter; - if ( trChan >= 0 ) ip.channels[trChan].r = opac; - ULONG trType = (flags & NEWSTDMTL_FILT_TRANSP) ? TRANSP_FILTER : - (flags & NEWSTDMTL_ADD_TRANSP) ? TRANSP_ADD : TRANSP_SUB; - - if (sc.mode==SCMODE_SHADOW) { - // Opacity mapping; - if (DOMAP(trChan)) - opac = (*maps)[trChan].LerpEvalMono(sc, opac); - - // "Shadow mode": This just computes the transparency, which is all - // you need for shadowing. - if (opac!=1.0f || opfall!=0.0f) { - - if (opfall != 0.0f) { - opac = GetEffOpacity(sc, opac); - } - - // Transparency may use diffuse color mapping, check for orig 3ds transp - if ((flags & (NEWSTDMTL_ADD_TRANSP|NEWSTDMTL_FILT_TRANSP))==0) { - if (DOMAP(diffChan)) { - mval = (*maps)[diffChan].Eval(sc); - AlphaCompCol(ip.channels[diffChan], mval); - } - } - // Transparency may also use filter color mapping - if ( flags & NEWSTDMTL_FILT_TRANSP ){ - if (DOMAP(filtChan)) { - mval = (*maps)[filtChan].Eval(sc); - AlphaCompCol(ip.channels[filtChan], mval); - } - } - // Compute the transpareny color - sc.out.t = TranspColor( opac, ip.channels[filtChan], ip.channels[diffChan]); - } else - sc.out.t.Black(); - return; - } // end, shadow mode - - // any shader can be faceted...& bumpmapped as well - if ( flags & NEWSTDMTL_FACETED ){ - Point3 N = sc.GNormal(); - bumped = TRUE; - sc.SetNormal(N); - } - - P = sc.P(); // position - - ip.stdParams = pShader->SupportStdParams(); - - // Do texture mapping - ip.hasComponents = 0; - ip.stdIDToChannel = stdIDToChannel; - sc.SetIOR(ioRefract); - - // Bump mapping: Do this FIRST so other maps can use the perturbed normal - int bumpChannel = stdIDToChannel[ID_BU]; - if (DOMAP(bumpChannel)) { - ip.hasComponents |= HAS_BUMPS; - Point3 dn = (*maps)[bumpChannel].EvalNormalPerturb(sc); - Point3 N = Normalize( sc.Normal() + (sc.backFace?-dn:dn) ); - sc.SetNormal(N); - bumped = TRUE; - } - - // All normal color & scalar maps are handled here - long t0 = pShader->ChannelType(0); - RGBA c; - for ( long i = 0; i < STD2_NMAX_TEXMAPS; ++i ) { - if ( sc.doMaps && (*maps)[ i ].IsActive()) { - long t = pShader->ChannelType(i); - // composite the channel - if ( (t & SKIP_CHANNELS)==0 ){ - if ( t & MONO_CHANNEL ) { - // note: x always holds channel data for mono channels - ip.channels[ i ].r = (*maps)[i].LerpEvalMono(sc, ip.channels[ i ].r ); - } else { - if ( i != ambChan || (flags & NEWSTDMTL_LOCK_ADTEX)==0 ) { - c = (*maps)[i].Eval(sc); - AlphaCompCol( ip.channels[ i ], c); - } - } - // lock adtex, really channels 0 & 1 - if ( i == diffChan && ambChan >= 0 && (flags & NEWSTDMTL_LOCK_ADTEX) ) { - if ( t0 & MONO_CHANNEL ) { - ip.channels[ ambChan ].r = (*maps)[diffChan].LerpEvalMono(sc, ip.channels[diffChan].r ); - } else { - AlphaCompCol( ip.channels[ ambChan ], c ); - } - - } - } - } - } - - // Evaluate reflection map. - int reflChan = stdIDToChannel[ ID_RL ]; - if ( (*maps)[ reflChan ].map ) - ip.hasComponents |= HAS_REFLECT_MAP; - - if (DOMAP(reflChan)) { - ip.hasComponents |= HAS_REFLECT; - AColor rcol; - Texmap *reflmap = (*maps)[reflChan].map; - if (reflmap->HandleOwnViewPerturb()) { - sc.TossCache(reflmap); - rcol = reflmap->EvalColor(sc); - } else - rcol = sc.EvalEnvironMap(reflmap, sc.ReflectVector()); - Color rc(rcol.r, rcol.g, rcol.b); - ip.channels[reflChan] = rc; - ip.reflectAmt = rcol.a * (*maps)[reflChan].amount; - } - - // do refraction map - int refrChan = stdIDToChannel[ ID_RR ]; - if ( (*maps)[ reflChan ].map ) - ip.hasComponents |= HAS_REFRACT_MAP; - - if (DOMAP(refrChan)) { - // Evaluate refraction map, as yet unfiltered by filter color. - ip.refractAmt = (*maps)[refrChan].amount; - Texmap *refrmap = (*maps)[refrChan].map; - AColor rcol; - if (refrmap->HandleOwnViewPerturb()) - rcol = refrmap->EvalColor( sc ); - else - rcol = sc.EvalEnvironMap( refrmap, sc.RefractVector(ioRefract) ); - - Color rc( rcol.r, rcol.g, rcol.b ); - ip.channels[refrChan] = rc; - ip.hasComponents |= HAS_REFRACT; - } - - // get falloff opacity for possible use by shader or compositor - opac = ip.channels[trChan].r; // get (perhaps) textured opacity - - ip.finalOpac = GetEffOpacity(sc, opac); - if(ip.finalOpac < 1.0f) - ip.hasComponents |= HAS_OPACITY; - - // init the global ambient - ip.ambIllumOut = sc.ambientLight; - - // mapping done, illuminate... - pShader->Illum(sc, ip); - - // return color in sc, not the frag itself - sc.out.c = ip.finalC; - sc.out.t = ip.finalT; - - // Render Elements - // note: shadow must be on for any shadows to work. no ele's will get shadows - // with shadows off - int nEles = sc.NRenderElements(); - if( nEles != 0 ){ - IllumParams* pIp2 = CloneIp( ip ); // too late for sdk, eco in progress - if( sc.shadow ){ - // get unshadowed ip - sc.shadow = FALSE; - pIp2->ClearOutputs(); - pShader->Illum(sc, *pIp2); - sc.shadow = TRUE; - } - for( int i=0; i < nEles; ++i ){ - IRenderElement* pEle = sc.GetRenderElement(i); - if( pEle->IsEnabled() ){ - MaxRenderElement* pMaxEle = (MaxRenderElement*)pEle->GetInterface( MaxRenderElement::IID ); - if( pEle->ShadowsApplied() ) - pMaxEle->PostIllum( sc, ip ); - else - pMaxEle->PostIllum( sc, *pIp2 ); - } - } - xr_delete(pIp2); - } - - if (bumped) sc.SetNormal(N0); // restore normal -} - - -float XRayMtl::EvalDisplacement(ShadeContext& sc) { - int dispChan = stdIDToChannel[ ID_DP ]; - if (DOMAP(dispChan)) - return (*maps)[dispChan].EvalMono(sc); - else return 0.0f; -} - - -Interval XRayMtl::DisplacementValidity(TimeValue t) { - int dispChan = stdIDToChannel[ ID_DP ]; - if (MAPACTIVE(dispChan)) { - Interval iv; - iv.SetInfinite(); - maps->txmap[dispChan].Update(t, iv); - return iv; - } - else - return FOREVER; -} - -void XRayMtl::DiscardTexHandles() { - for (int i=0; i<2; i++) { - if (texHandle[i]) { - texHandle[i]->DeleteThis(); - texHandle[i] = NULL; - } - } - texHandleValid.SetEmpty(); -} - -// begin - dds- 04.27.00 - multiple map display support -void XRayMtl::ActivateTexDisplay(BOOL onoff) { - if (!onoff) { - DiscardTexHandles(); - } -} - -struct TextOps { - UBYTE colorOp; - UBYTE colorAlphaSource; - UBYTE colorScale; - UBYTE alphaOp; - UBYTE alphaAlphaSource; - UBYTE alphaScale; -}; - -// TBD: these values have to be corrected. -#define TXOP_MODULATE 0 -#define TXOP_ALPHABLEND 1 -#define TXOP_OPACITY 2 -static TextOps txops[] = { - { GW_TEX_MODULATE, GW_TEX_TEXTURE, GW_TEX_SCALE_1X, GW_TEX_LEAVE, GW_TEX_TEXTURE, GW_TEX_SCALE_1X }, - { GW_TEX_ALPHA_BLEND, GW_TEX_TEXTURE, GW_TEX_SCALE_1X, GW_TEX_LEAVE, GW_TEX_TEXTURE, GW_TEX_SCALE_1X }, - { GW_TEX_LEAVE, GW_TEX_TEXTURE, GW_TEX_SCALE_1X, GW_TEX_REPLACE, GW_TEX_TEXTURE, GW_TEX_SCALE_1X }, -}; - -void XRayMtl::SetTexOps(Material *mtl, int i, int type) { - TextureInfo *ti = &mtl->texture[i]; - ti->colorOp = txops[type].colorOp; - ti->colorAlphaSource = txops[type].colorAlphaSource; - ti->colorScale = txops[type].colorScale; - ti->alphaOp = txops[type].alphaOp; - ti->alphaAlphaSource = txops[type].alphaAlphaSource; - ti->alphaScale = txops[type].alphaScale; - texOpsType[i] = type; -} - -#define BMIDATA(x) ((UBYTE *)((BYTE *)(x) + sizeof(BITMAPINFOHEADER))) - -static void StuffAlpha(BITMAPINFO *bi, float amt, float opac, Color fill) { - int w = bi->bmiHeader.biWidth; - int h = bi->bmiHeader.biHeight; - int npix = w*h; - UBYTE *a = BMIDATA(bi); - Color24 col; - col.r = (int)(fill.r*255.0f); - col.g = (int)(fill.g*255.0f); - col.b = (int)(fill.b*255.0f); - if (amt<1.0f) { - int ia = int(amt*255.0f); - int ic = int( (1.0f-amt)*opac*255.0f); - for (int j=0; j>8) + ic; - a[0] = col.b; - a[1] = col.g; - a[2] = col.r; - a += 4; - } - } - else { - for (int j=0; jbmiHeader.biWidth; - int h = bi->bmiHeader.biHeight; - int npix = w*h; - UBYTE *a = BMIDATA(bia); - UBYTE *b = BMIDATA(bi); - if (amt<1.0f) { - int ia = int(amt*255.0f); - int ic = int( (1.0f-amt)*opac*255.0f); - for (int j=0; j>8) + ic; - a += 4; - b += 4; - } - } - else { - for (int j=0; jtexture.SetCount(numTexHandlesUsed); - for (int i=0; itexture[i].textHandle = texHandle[i]->GetHandle(); - Texmap *tx = (*maps)[useSubForTex[i]].map; - cb.GetGfxTexInfoFromTexmap(t, mtl->texture[i], tx ); - SetTexOps(mtl,i,texOpsType[i]); - } - } - return; - } - - Texmap *tx[2]; - int diffChan = stdIDToChannel[ ID_DI ]; - int opacChan = stdIDToChannel[ ID_OP ]; - tx[0] = (*maps)[diffChan].IsActive()?(*maps)[diffChan].map:NULL; - tx[1] = (*maps)[opacChan].IsActive()?(*maps)[opacChan].map:NULL; - - int nsupport = cb.NumberTexturesSupported(); - - BITMAPINFO *bmi[NTEXHANDLES]; - - int nmaps=0; - for (int i=0; itexture.SetCount(nmaps); - if (nmaps==0) - return; - for (i=0; itexture[i].textHandle = NULL; - texHandleValid.SetInfinite(); - Interval valid; - BOOL needDecal = FALSE; - int ntx = 0; - int op; - - int forceW = 0; - int forceH = 0; - if (tx[0]) { - cb.GetGfxTexInfoFromTexmap(t, mtl->texture[0], tx[0]); - TextureInfo &ti = mtl->texture[0]; - if (ti.tiling[0]==GW_TEX_NO_TILING||ti.tiling[1]==GW_TEX_NO_TILING) - needDecal = TRUE; - op = needDecal?TXOP_ALPHABLEND:TXOP_MODULATE; - bmi[0] = tx[0]->GetVPDisplayDIB(t,cb,valid,FALSE); - if (bmi[0]) { - texHandleValid &= valid; - useSubForTex[0] = diffChan; - ntx = 1; - forceW = bmi[0]->bmiHeader.biWidth; - forceH = bmi[0]->bmiHeader.biHeight; - } - } - if (tx[1]) { - cb.GetGfxTexInfoFromTexmap(t, mtl->texture[ntx], tx[1]); - if (nsupport>ntx) { - bmi[1] = tx[1]->GetVPDisplayDIB(t,cb,valid,TRUE); - if (bmi[1]) { - texHandleValid &= valid; - StuffAlpha(bmi[1], (*maps)[opacChan].amount, GetOpacity(t),ntx?whiteCol:pShader->GetDiffuseClr(t)); - texHandle[ntx] = cb.MakeHandle(bmi[1]); - bmi[1] = NULL; - mtl->texture[ntx].textHandle = texHandle[ntx]->GetHandle(); - SetTexOps(mtl,ntx,TXOP_OPACITY); - useSubForTex[ntx] = opacChan; - ntx++; - } - } - else { - if (!needDecal) { - TextureInfo ti; - // if (SameUV(mtl->texture[0],mtl->texture[1])) { - // Not really correct to combine channels for different UV's but what the heck. - bmi[1] = tx[1]->GetVPDisplayDIB(t,cb,valid,TRUE, forceW, forceH); - if (bmi[1]) { - texHandleValid &= valid; - StuffAlphaInto(bmi[1], bmi[0], (*maps)[opacChan].amount, GetOpacity(t)); - op = TXOP_OPACITY; - xr_free(bmi[1]); - bmi[1] = NULL; - } - // } - } - } - } - if (bmi[0]) { - texHandle[0] = cb.MakeHandle(bmi[0]); - bmi[0] = NULL; - mtl->texture[0].textHandle = texHandle[0]->GetHandle(); - SetTexOps(mtl,0,op); - } - mtl->texture.SetCount(ntx); - numTexHandlesUsed = ntx; -} - -// end - dds- 04.27.00 - multiple map display support - -//ЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇ -// Returns true if the evaluated color\value (output) is constant over all -// possible inputs. This means all points of a face and all faces the -// material is assigned to. -// If it cannot determine the correct answer, it returns false -// -bool XRayMtl::IsOutputConst -( - ShadeContext& sc, // describes context of evaluation - int stdID // must be ID_AM, ect - ) -{ - int channelID = StdIDToChannel( stdID ); - DbgAssert( 0 <= channelID && channelID < NumSubTexmaps() ); - if ( channelID < 0 || channelID >= NumSubTexmaps() ) - return false; - - if ( SubTexmapOn( channelID ) ) - { - Texmap* texMap = GetSubTexmap( channelID ); - DbgAssert( texMap != NULL ); - if ( texMap != NULL && texMap->IsOutputMeaningful( sc ) ) - // TODO: The texmap can be meaningful but constant - return false; - } - return true; -} - -//ЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇ -// Evaluates the material on a single texmap channel. -// For a mono channel, the value is copied in all 3 components of the -// output color. -// -bool XRayMtl::EvalColorStdChannel -( - ShadeContext& sc, // describes context of evaluation - int stdID, // must be ID_AM, ect - Color& outClr // output var - ) -{ - switch ( stdID ) - { - case ID_BU: // Bump (value 8) - { - return EvalBump( sc, outClr ); - } - break; - - case ID_RL: // Reflection (value 9) - { - return EvalReflection( sc, outClr ); - } - break; - - case ID_RR: // Refraction (value 10) - { - return EvalRefraction( sc, outClr ); - } - break; - - case ID_DP: // Displacement (value 11) - { - float outVal; - bool bRes = EvalDisplacement( sc, outVal ); - if ( bRes ) - { - outClr.r = outClr.g = outClr.b = outVal; - } - return bRes; - } - break; - - // For everything else, there's a smart method - case ID_AM: // Ambient (value 0) - case ID_DI: // Diffuse (value 1) - case ID_SP: // Specular (value 2) - case ID_SH: // Shininess (value 3). In R3 and later this is called Glossiness. - case ID_SS: // Shininess strength (value 4). In R3 and later this is called Specular Level. - case ID_SI: // Self-illumination (value 5) - case ID_OP: // Opacity (value 6) - case ID_FI: // Filter color (value 7) - { - int id = StdIDToChannel( stdID ); - if ( id < 0 || id >= NumSubTexmaps() ) - return false; - return EvalChannel( sc, id, outClr ); - } - break; - - default: - // Should never happen - //DbgAssert( false ); - return false; - break; - } - return true; -} - -//ЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇ -// Evaluates the material on a single texmap channel. -// -bool XRayMtl::EvalMonoStdChannel -( - ShadeContext& sc, // describes context of evaluation - int stdID, // must be ID_AM, ect - float& outVal // output var - ) -{ - switch ( stdID ) - { - case ID_BU: // Bump (value 8) - { - Color outClr; - bool bRes = EvalBump( sc, outClr ); - if ( bRes ) - outVal = Intens( outClr ); - return bRes; - } - break; - - case ID_RL: // Reflection (value 9) - { - return EvalReflection( sc, outVal ); - } - break; - - case ID_RR: // Refraction (value 10) - { - return EvalRefraction( sc, outVal ); - } - break; - - case ID_DP: // Displacement (value 11) - { - return EvalDisplacement( sc, outVal ); - } - break; - - // For everything else, there's a smart method - case ID_AM: // Ambient (value 0) - case ID_DI: // Diffuse (value 1) - case ID_SP: // Specular (value 2) - case ID_SH: // Shininess (value 3). In R3 and later this is called Glossiness. - case ID_SS: // Shininess strength (value 4). In R3 and later this is called Specular Level. - case ID_SI: // Self-illumination (value 5) - case ID_OP: // Opacity (value 6) - case ID_FI: // Filter color (value 7) - { - int id = StdIDToChannel( stdID ); - if ( id < 0 || id >= NumSubTexmaps() ) - return false; - Color outClr; - bool bRes = EvalChannel( sc, id, outClr ); - if ( bRes ) - outVal = Intens( outClr ); - return bRes; - } - break; - - default: - // Should never happen - //DbgAssert( false ); - return false; - break; - } - return true; -} - -//ЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇ -// channelID is supposed to be mapped from std subtexmap ID to subtexmap id -// -bool XRayMtl::EvalChannel(ShadeContext& sc, int channelID, Color& outClr) -{ - // For exmple, the Strauss shader doesn't support the ID_AM channel - DbgAssert( 0 <= channelID && channelID < NumSubTexmaps() ); - - // Check if the mtl has or not a shader - Shader* pShad = GetShader(); - DbgAssert( pShader != NULL ); - if ( pShad == NULL ) - { - // Filter color and opacity values are managed by the stdmtl2? - if ( channelID == StdIDToChannel(ID_FI) ) - { - outClr = filter; - return true; - } - else if ( channelID == StdIDToChannel(ID_FI) ) - { - outClr.r = outClr.g = outClr.b = opacity; - return true; - } - return false; - } - - // Get raw color\value from the shader - IllumParams ip(0, NULL); - Memory.mem_fill(static_cast(&ip), 0, sizeof(IllumParams) ); - // ip.mtlFlags = flags; - pShad->GetIllumParams( sc, ip ); - - // Filter color and opacity values are managed by the stdmtl2? - if ( channelID == StdIDToChannel(ID_FI) ) - ip.channels[channelID] = filter; - else if ( channelID == StdIDToChannel(ID_OP) ) - { - ip.channels[channelID].r = opacity; - ip.channels[channelID].g = opacity; - ip.channels[channelID].b = opacity; - } - long channelType = pShad->ChannelType( channelID ); - - // Evaluate the texture map - if ( sc.doMaps ) - { - if ( channelID == StdIDToChannel( ID_AM ) && - (flags & NEWSTDMTL_LOCK_ADTEX) == NEWSTDMTL_LOCK_ADTEX ) - { - // Treat exceptional situations first - // - // Evaluat the ambient channel using the diffuse texmap - // if AD texmap lock is on - - long diffChanID = StdIDToChannel( ID_DI ); - long diffChanType = pShad->ChannelType( ID_DI ); - if ( diffChanID >= 0 && - SubTexmapOn( diffChanID ) && - ( diffChanType & SKIP_CHANNELS ) == 0 ) - { - Texmap* texMap = GetSubTexmap( diffChanID ); - if ( texMap != NULL && texMap->IsOutputMeaningful( sc ) ) - { - // Evaluate the diffuse channel first - AColor diffColor; - if ( (diffChanType & MONO_CHANNEL ) == MONO_CHANNEL ) - { - diffColor.r = (*maps)[diffChanID].LerpEvalMono( sc, ip.channels[diffChanID].r ); - diffColor.g = diffColor.b = diffColor.r; - diffColor.a = 0.0f; - } - else //if ( (diffChanType & CLR_CHANNEL ) == CLR_CHANNEL ) - { - diffColor = (*maps)[diffChanID].Eval( sc ); - AlphaCompCol( ip.channels[diffChanID], diffColor ); - } - - // Now evaluate the ambient channel - if ( (channelType & MONO_CHANNEL ) == MONO_CHANNEL ) - { - ip.channels[channelID].r = (*maps)[diffChanID].LerpEvalMono( sc, ip.channels[diffChanID].r ); - ip.channels[channelID].g = ip.channels[channelID].b = ip.channels[channelID].r; - } - else //if ( (channelType & CLR_CHANNEL ) == CLR_CHANNEL ) - AlphaCompCol( ip.channels[channelID], diffColor ); - } - } - } - else - { - // Normal course of channel evaluation - - if ( SubTexmapOn( channelID ) && - ( channelType & SKIP_CHANNELS ) == 0 ) - { - Texmap* texMap = GetSubTexmap( channelID ); - if ( texMap != NULL && texMap->IsOutputMeaningful( sc ) ) - { - if ( (channelType & MONO_CHANNEL ) == MONO_CHANNEL ) - { - ip.channels[channelID].r = (*maps)[channelID].LerpEvalMono( sc, ip.channels[channelID].r ); - ip.channels[channelID].g = ip.channels[channelID].b = ip.channels[channelID].r; - } - else //if ( (channelType & CLR_CHANNEL ) == CLR_CHANNEL ) - { - AColor c = (*maps)[channelID].Eval( sc ); - AlphaCompCol( ip.channels[channelID], c ); - } - } - } - } - } - - // Return a potentialy texture mapped value - outClr = ip.channels[channelID]; - - return true; -} - -//ЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇ -// Evaluates the bump map. Returns false if the result is not meaningful -// -bool XRayMtl::EvalBump( ShadeContext& sc, Color& outClr ) -{ - int id = StdIDToChannel( ID_BU ); - if ( !ShouldEvalSubTexmap( sc, id ) ) - { - outClr.Black(); - return false; - } - - Point3 dn = (*maps)[id].EvalNormalPerturb(sc); - outClr = Normalize( ( sc.backFace ? -dn : dn ) ); - - return true; -} - -//ЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇ -// Evaluates reflection map as a color. Returns false if the result is not -// meaningful -// -bool XRayMtl::EvalReflection( ShadeContext& sc, Color& outClr ) -{ - int id = StdIDToChannel( ID_RL ); - if ( !ShouldEvalSubTexmap( sc, id ) ) - { - return false; - } - - AColor rcol; - Texmap* reflmap = (*maps)[id].map; - DbgAssert( reflmap != NULL ); - if ( reflmap->HandleOwnViewPerturb() ) - { - sc.TossCache( reflmap ); - rcol = reflmap->EvalColor( sc ); - } - else - rcol = sc.EvalEnvironMap( reflmap, sc.ReflectVector() ); - - outClr.r = rcol.r; - outClr.g = rcol.g; - outClr.b = rcol.b; - - return true; -} - -//ЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇ -// Evaluates reflection map as (mono) value. Returns false if the result -// is not meaningful -// -bool XRayMtl::EvalReflection( ShadeContext& sc, float& outVal ) -{ - int id = StdIDToChannel( ID_RL ); - if ( !ShouldEvalSubTexmap( sc, id ) ) - return false; - - Texmap* reflmap = (*maps)[id].map; - DbgAssert( reflmap != NULL ); - if ( reflmap->HandleOwnViewPerturb() ) - { - sc.TossCache( reflmap ); - outVal = reflmap->EvalMono( sc ); - } - else - { - AColor rcol; - rcol = sc.EvalEnvironMap( reflmap, sc.ReflectVector() ); - outVal = Intens( rcol ); - } - - return true; -} - -//ЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇ -// Evaluates refraction map as a color. Returns false if the result is not -// meaningful -// -bool XRayMtl::EvalRefraction( ShadeContext& sc, Color& outClr ) -{ - int id = StdIDToChannel( ID_RR ); - if ( !ShouldEvalSubTexmap( sc, id ) ) - return false; - - AColor rcol; - Texmap* refrmap = (*maps)[id].map; - DbgAssert( refrmap != NULL ); - if ( refrmap->HandleOwnViewPerturb() ) - { - rcol = refrmap->EvalColor( sc ); - } - else - rcol = sc.EvalEnvironMap( refrmap, sc.RefractVector( ioRefract ) ); - - outClr.r = rcol.r; - outClr.g = rcol.g; - outClr.b = rcol.b; - - return true; -} - -//ЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇ -// Evaluates reflection map as (mono) value. Returns false if the result -// is not meaningful -// -bool XRayMtl::EvalRefraction( ShadeContext& sc, float& outVal ) -{ - int id = StdIDToChannel( ID_RR ); - if ( !ShouldEvalSubTexmap( sc, id ) ) - return false; - - Texmap* refrmap = (*maps)[id].map; - DbgAssert( refrmap != NULL ); - if ( refrmap->HandleOwnViewPerturb() ) - { - outVal = refrmap->EvalMono( sc ); - } - else - { - AColor rcol; - rcol = sc.EvalEnvironMap( refrmap, sc.RefractVector( ioRefract ) ); - outVal = Intens( rcol ); - } - - return true; -} - -//ЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇ -// Evaluates Displacement map as a color. Returns false if the result is not -// meaningful -// -bool XRayMtl::EvalDisplacement( ShadeContext& sc, float& outVal ) -{ - int id = StdIDToChannel( ID_DP ); - if ( !ShouldEvalSubTexmap( sc, id ) ) - return false; - - outVal = (*maps)[id].EvalMono(sc); - return true; -} - -//ЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇЇ -// Helper method -// -bool XRayMtl::ShouldEvalSubTexmap( ShadeContext& sc, int id ) -{ - if ( id >= 0 && id < NumSubTexmaps() && - sc.doMaps && SubTexmapOn( id ) ) - { - Texmap* texMap = GetSubTexmap( id ); - if ( texMap != NULL && texMap->IsOutputMeaningful( sc ) ) - return true; - } - - return false; -} - -// XRay Part -void XRayMtl::LoadXRayShaderList() -{ - XRayMtl::EShaders.clear (); - XRayMtl::CShaders.clear (); - XRayMtl::GameMtls.clear (); - int e_res = LoadBlenderList (XRayMtl::EShaders); - int c_res = LoadShaderLCList(XRayMtl::CShaders); - int g_res = LoadGameMtlList (XRayMtl::GameMtls); - if ((e_res==-1)||(c_res==-1)||(g_res==-1)) - { - Log("Can't load shader files!\nGame material will work incorrectly."); - THROW; - } -} - -void XRayMtl::UnloadXRayShaderList() -{ - ClearList(XRayMtl::EShaders); - ClearList(XRayMtl::CShaders); - ClearList(XRayMtl::GameMtls); -} - -void XRayMtl::SetEShaderIndx( long indx ) -{ - pb_xray->SetValue(std2_eshader_type, 0, indx<0 ? 0 : indx ); - eshaderId = indx; -} -void XRayMtl::SetCShaderIndx( long indx ) -{ - pb_xray->SetValue(std2_cshader_type, 0, indx<0 ? 0 : indx ); - cshaderId = indx; -} -void XRayMtl::SetGameMtlIndx( long indx ) -{ - pb_xray->SetValue(std2_gamemtl_type, 0, indx<0 ? 0 : indx ); - gamemtlId = indx; -} -TCHAR* XRayMtl::GetEShader (DWORD i) -{ - return (i shaderList; - static Tab samplerList; - static LPSTRVec EShaders; - static LPSTRVec CShaders; - static LPSTRVec GameMtls; - - IParamBlock *old_pblock; // ref 0, for old version loading - Texmaps* maps; // ref 1 - Interval ivalid; - ReshadeRequirements mReshadeRQ; // mjm - 06.02.00 - ReshadeRequirements mInRQ; // ca - 12/7/00 - ULONG flags; - int shaderId; - Shader *pShader; // ref 2 - // new PB2 paramblocks, one per rollout - IParamBlock2 *pb_xray; // - IParamBlock2 *pb_shader; // ref 3, 4, ... - IParamBlock2 *pb_extended; - IParamBlock2 *pb_sampling; - IParamBlock2 *pb_maps; - IParamBlock2 *pb_dynamics; - - // xray - int eshaderId; - int cshaderId; - int gamemtlId; - - Color filter; - float opacity; - float opfall; - float wireSize; - float ioRefract; - float dimIntens; - float dimMult; - BOOL dimReflect; - - // sampling - int samplerId; - Sampler* pixelSampler; // ref 8 - - // composite of shader/mtl channel types - int channelTypes[ STD2_NMAX_TEXMAPS ]; - int stdIDToChannel[ N_ID_CHANNELS ]; - - // experiment: override filter - BOOL filterOverrideOn; - float filterSz; - - // Kill REFMSG_CHANGE messages. This counter is used to - // prevent these messages when things really aren't changing. - // Use the class KillRefmsg - RefmsgKillCounter killRefmsg; - - void SetFlag(ULONG f, ULONG val); - void EnableMap(int i, BOOL onoff); - BOOL IsMapEnabled(int i) { return (*maps)[i].mapOn; } - BOOL KeyAtTime(int id,TimeValue t) { return (id == OPACITY_PARAM) ? pb_extended->KeyFrameAtTime(std2_opacity, t) : FALSE; } - BOOL AmtKeyAtTime(int i, TimeValue t); - int GetMapState( int indx ); //returns 0 = no map, 1 = disable, 2 = mapon - TSTR GetMapName( int indx ); - void SyncADTexLock( BOOL lockOn ); - - // from StdMat - // these set Approximate colors into the plug in shader - BOOL IsSelfIllumColorOn(); - void SetSelfIllumColorOn( BOOL on ); - void SetSelfIllumColor(Color c, TimeValue t); - void SetAmbient(Color c, TimeValue t); - void SetDiffuse(Color c, TimeValue t); - void SetSpecular(Color c, TimeValue t); - void SetShininess(float v, TimeValue t); - void SetShinStr(float v, TimeValue t); - void SetSelfIllum(float v, TimeValue t); - void SetSoften(BOOL onoff) { SetFlag(NEWSTDMTL_SOFTEN,onoff); } - - void SetTexmapAmt(int imap, float amt, TimeValue t); - void LockAmbDiffTex(BOOL onoff) { SetFlag(NEWSTDMTL_LOCK_ADTEX,onoff); } - - void SetWire(BOOL onoff){ pb_shader->SetValue(std2_wire,0, (onoff!=0) ); }//SetFlag(NEWSTDMTL_WIRE,onoff); } - void SetWireSize(float s, TimeValue t); - void SetWireUnits(BOOL onoff) { pb_extended->SetValue(std2_wire_units,0, (onoff!=0) ); } //SetFlag(NEWSTDMTL_WIRE_UNITS,onoff); } - - void SetFaceMap(BOOL onoff) { pb_shader->SetValue(std2_face_map,0, (onoff!=0) ); } //SetFlag(NEWSTDMTL_FACEMAP,onoff); } - void SetTwoSided(BOOL onoff) { pb_shader->SetValue(std2_two_sided,0, (onoff!=0) ); } //SetFlag(NEWSTDMTL_2SIDE,onoff); } - void SetFalloffOut(BOOL outOn) { pb_extended->SetValue(std2_falloff_type,0, (outOn!=0) ); } //SetFlag(NEWSTDMTL_FALLOFF_OUT,onoff); } - void SetTransparencyType(int type); - - void SetFilter(Color c, TimeValue t); - void SetOpacity(float v, TimeValue t); - void SetOpacFalloff(float v, TimeValue t); - void SetIOR(float v, TimeValue t); - void SetDimIntens(float v, TimeValue t); - void SetDimMult(float v, TimeValue t); - - int GetFlag(ULONG f) { return (flags&f)?1:0; } - - // >>>Shaders - - // these 3 internal only - void SetShaderIndx( long shaderId, BOOL update=TRUE ); - long GetShaderIndx(){ return shaderId; } - void SetShader( Shader* pNewShader ); - void ShuffleTexMaps( Shader* newShader, Shader* oldShader ); - void ShuffleShaderParams( Shader* newShader, Shader* oldShader ); - - Shader* GetShader(){ return pShader; } - void SwitchShader(Shader* pNewShader, BOOL loadDlg = FALSE); - void SwitchShader(ClassDesc* pNewCD); - BOOL SwitchShader(Class_ID shaderId); - int FindShader( Class_ID& findId, ClassDesc** ppCD=NULL ); - BOOL IsShaderInUI() { return pb_shader && pb_shader->GetMap() && pShader && pShader->GetParamDlg(); } - - static void XRayMtl::LoadShaderList(); - static int XRayMtl::NumShaders(); - static ClassDesc* XRayMtl::GetShaderCD(int i); - static void XRayMtl::LoadSamplerList(); - static int XRayMtl::NumSamplers(); - static ClassDesc* XRayMtl::GetSamplerCD(int i); - - void SetEShaderIndx(long shaderId); - void SetCShaderIndx(long shaderId); - void SetGameMtlIndx(long shaderId); - long GetEShaderIndx(){ return eshaderId; } - long GetCShaderIndx(){ return cshaderId; } - long GetGameMtlIndx(){ return gamemtlId; } - LPCSTR GetEShaderName(){ return GetEShader(eshaderId); } - LPCSTR GetCShaderName(){ return GetCShader(cshaderId); } - LPCSTR GetGameMtlName(){ return GetGameMtl(gamemtlId); } - - static void XRayMtl::LoadXRayShaderList (); - static void XRayMtl::UnloadXRayShaderList (); - virtual TCHAR* GetEShader (DWORD i); - virtual TCHAR* GetCShader (DWORD i); - virtual TCHAR* GetGameMtl (DWORD i); - virtual int FindEShader (LPCSTR name); - virtual int FindCShader (LPCSTR name); - virtual int FindGameMtl (LPCSTR name); - - BOOL IsFaceted(){ return GetFlag(NEWSTDMTL_FACETED); } - void SetFaceted( BOOL on ){ pb_shader->SetValue(std2_faceted,0, (on!=0) ); } - - // These utilitys provide R2.5 shaders, ONLY used for Translators - // Does not & will not work for plug-in shaders - void SetShading(int s); - int GetShading(); - - // from Mtl - Color GetAmbient(int mtlNum=0, BOOL backFace=FALSE); - Color GetDiffuse(int mtlNum=0, BOOL backFace=FALSE); - Color GetSpecular(int mtlNum=0, BOOL backFace=FALSE); - float GetShininess(int mtlNum=0, BOOL backFace=FALSE); - float GetShinStr(int mtlNum=0, BOOL backFace=FALSE) ; - float GetXParency(int mtlNum=0, BOOL backFace=FALSE); - float WireSize(int mtlNum=0, BOOL backFace=FALSE) { return wireSize; } - - // >>>> Self Illumination - float GetSelfIllum(int mtlNum, BOOL backFace) ; - BOOL GetSelfIllumColorOn(int mtlNum, BOOL backFace); - Color GetSelfIllumColor(int mtlNum, BOOL backFace); - - // >>>> sampling - void SetSamplingOn( BOOL on ) - { - pb_sampling->SetValue(std2_ssampler_enable, 0, on!=0 ); - } - BOOL GetSamplingOn() - { Interval iv; - BOOL on; - pb_sampling->GetValue(std2_ssampler_enable, 0, on, iv ); - return on; - } - void SetSamplingQuality( float quality ) - { - pb_sampling->SetValue(std2_ssampler_qual, 0, quality ); - } - float GetSamplingQuality() - { Interval iv; - float q; - pb_sampling->GetValue(std2_ssampler_qual, 0, q, iv ); - return q; - } - - void SwitchSampler(ClassDesc* pNewCD); - void SwitchSampler(Sampler* pNewSampler); - BOOL SwitchSampler(Class_ID samplerId); - int FindSampler( Class_ID findId, ClassDesc** pNewCD=NULL ); - Sampler * GetPixelSampler(int mtlNum=0, BOOL backFace=FALSE){ return pixelSampler; } - - // these 2 internal only - void SetSamplerIndx( long indx, BOOL update=TRUE ); - long GetSamplerIndx(){ return samplerId; } - void SetPixelSampler( Sampler * sampler ); - - // Dynamics properties - float GetDynamicsProperty(TimeValue t, int mtlNum, int propID); - void SetDynamicsProperty(TimeValue t, int mtlNum, int propID, float value); - - // from StdMat - BOOL GetSoften() { return GetFlag(NEWSTDMTL_SOFTEN); } - BOOL GetFaceMap() { return GetFlag(NEWSTDMTL_FACEMAP); } - BOOL GetTwoSided() { return GetFlag(NEWSTDMTL_2SIDE); } - BOOL GetWire() { return GetFlag(NEWSTDMTL_WIRE); } - BOOL GetWireUnits() { return GetFlag(NEWSTDMTL_WIRE_UNITS); } - BOOL GetFalloffOut() { return GetFlag(NEWSTDMTL_FALLOFF_OUT); } // 1: out, 0: in - BOOL GetAmbDiffTexLock(){ return GetFlag(NEWSTDMTL_LOCK_ADTEX); } - int GetTransparencyType() { - return (flags&NEWSTDMTL_FILT_TRANSP)?TRANSP_FILTER: - flags&NEWSTDMTL_ADD_TRANSP ? TRANSP_ADDITIVE: TRANSP_SUBTRACTIVE; - } - Color GetFilter(TimeValue t); - - // these are stubs till i figure out scripting - Color GetAmbient(TimeValue t); - Color GetDiffuse(TimeValue t); - Color GetSpecular(TimeValue t); - float GetShininess( TimeValue t); - float GetShinStr(TimeValue t); - float GetSelfIllum(TimeValue t); - BOOL GetSelfIllumColorOn(); - Color GetSelfIllumColor(TimeValue t); - - float GetOpacity( TimeValue t); - float GetOpacFalloff(TimeValue t); - float GetWireSize(TimeValue t); - float GetIOR( TimeValue t); - float GetDimIntens( TimeValue t); - float GetDimMult( TimeValue t); - float GetSoftenLevel( TimeValue t); - BOOL MapEnabled(int i); - float GetTexmapAmt(int imap, TimeValue t); - - // internal - float GetOpacity() { return opacity; } - float GetOpacFalloff() { return opfall; } - float GetTexmapAmt(int imap); - Color GetFilter(); - float GetIOR() { return ioRefract; } - - XRayMtl(BOOL loading = FALSE); - ~XRayMtl() { - DiscardTexHandles(); - } - BOOL ParamWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); - ParamDlg* CreateParamDlg(HWND hwMtlEdit, IMtlParams *imp); - BOOL SetDlgThing(ParamDlg* dlg); - void UpdateTexmaps(); - void UpdateMapButtons(); - void UpdateExtendedMapButtons(); - void UpdateMtlDisplay(); - void UpdateLockADTex( BOOL passOn ); - void UpdateExtraParams( ULONG stdParams ); - void UpdateSamplingParams(); - - - Color TranspColor(ShadeContext& sc, float opac, Color& diff); - void Shade(ShadeContext& sc); - float EvalDisplacement(ShadeContext& sc); - Interval DisplacementValidity(TimeValue t); - void Update(TimeValue t, Interval& validr); - void Reset(); - void OldVerFix(int loadVer); - void BumpFix(); - Interval Validity(TimeValue t); - void NotifyChanged(); - - // Requirements - ULONG Requirements(int subMtlNum); - void MappingsRequired(int subMtlNum, BitArray & mapreq, BitArray &bumpreq); - - // Methods to access texture maps of material - int NumSubTexmaps() { return STD2_NMAX_TEXMAPS; } - Texmap* GetSubTexmap(int i) { return (*maps)[i].map; } - int MapSlotType(int i); - void SetSubTexmap(int i, Texmap *m); - TSTR GetSubTexmapSlotName(int i); - int SubTexmapOn(int i) { return MAPACTIVE(i); } - long StdIDToChannel( long id ){ return stdIDToChannel[id]; } - - Class_ID ClassID(); - SClass_ID SuperClassID() { return MATERIAL_CLASS_ID; } - void GetClassName(TSTR& s) { s = GetString(IDS_CLASS_NAME); } - - void DeleteThis(); - - int NumSubs() { return NUM_SUB_ANIMS; } - Animatable* SubAnim(int i); - TSTR SubAnimName(int i); - int SubNumToRefNum(int subNum); - - // JBW: add direct ParamBlock access - int NumParamBlocks() { return 5; } - IParamBlock2* GetParamBlock(int i); - IParamBlock2* GetParamBlockByID(BlockID id); - - // From ref - int NumRefs() { return NUM_REFS; } - RefTargetHandle GetReference(int i); - void SetReference(int i, RefTargetHandle rtarg); - - RefTargetHandle Clone(RemapDir &remap = NoRemap()); - RefResult NotifyRefChanged( Interval changeInt, RefTargetHandle hTarget, - PartID& partID, RefMessage message ); - - // IO - IOResult Save(ISave *isave); - IOResult Load(ILoad *iload); - - // begin - ke/mjm - 03.16.00 - merge reshading code - BOOL SupportsRenderElements(){ return TRUE; } - // BOOL SupportsReShading(ShadeContext& sc); - void UpdateReshadeRequirements(RefTargetHandle hTarget, PartID partID); // mjm - 06.02.00 - ReshadeRequirements GetReshadeRequirements() { return mReshadeRQ; } // mjm - 06.02.00 - void PreShade(ShadeContext& sc, IReshadeFragment* pFrag); - void PostShade(ShadeContext& sc, IReshadeFragment* pFrag, int& nextTexIndex, IllumParams* ip); - // end - ke/mjm - 03.16.00 - merge reshading code - - // begin - dds- 04.27.00 - multiple map display support -#define NTEXHANDLES 2 - TexHandle *texHandle[NTEXHANDLES]; - short useSubForTex[NTEXHANDLES]; - short texOpsType[NTEXHANDLES]; - int numTexHandlesUsed; - Interval texHandleValid; - void SetTexOps(Material *mtl, int i, int type); - void DiscardTexHandles(); - BOOL SupportTexDisplay() { return TRUE; } - BOOL SupportsMultiMapsInViewport() { return TRUE; } - void ActivateTexDisplay(BOOL onoff); - void SetupGfxMultiMaps(TimeValue t, Material *mtl, MtlMakerCallback &cb); - // end - dds- 04.27.00 - multiple map display support - - // --- Material evaluation - from Mtl --- - bool IsOutputConst( ShadeContext& sc, int stdID ); - bool EvalColorStdChannel( ShadeContext& sc, int stdID, Color& outClr ); - bool EvalMonoStdChannel( ShadeContext& sc, int stdID, float& outVal ); - - void* GetInterface(ULONG id); - - float GetReflectionDim(float diffIllumIntensity ){ - if (dimReflect) - return ((1.0f-dimIntens)*diffIllumIntensity*dimMult + dimIntens); - else - return 1.0f; - } - Color TranspColor( float opac, Color filt, Color diff ); - - float GetEffOpacity(ShadeContext& sc, float opac){ - if ( opac != 1.0f || opfall != 0.0f) { - if (opfall != 0.0f) { - Point3 N = (flags & NEWSTDMTL_FACETED) ? sc.GNormal() : sc.Normal(); - float d = _abs( DotProd( N, sc.V() ) ); - if (flags & NEWSTDMTL_FALLOFF_OUT) d = 1.0f-d; - return opac * (1.0f - opfall * d); - } else return opac; - } else return 1.0f; - } - -private: - // --- Material evaluation --- - bool EvalChannel( ShadeContext& sc, int channelID, Color& outClr); - bool EvalBump( ShadeContext& sc, Color& outClr ); - bool EvalReflection( ShadeContext& sc, Color& outClr ); - bool EvalReflection( ShadeContext& sc, float& outVal ); - bool EvalRefraction( ShadeContext& sc, Color& outClr ); - bool EvalRefraction( ShadeContext& sc, float& outVal ); - bool EvalDisplacement( ShadeContext& sc, float& outVal ); - bool ShouldEvalSubTexmap( ShadeContext& sc, int id ); - -}; - -Mtl* CreateXRayMtl(); - -#endif // __GAME_MATERIAL__H diff --git a/cs/engine/plugins/shared/GameMaterial.rc b/cs/engine/plugins/shared/GameMaterial.rc deleted file mode 100644 index cdb31d06a..000000000 --- a/cs/engine/plugins/shared/GameMaterial.rc +++ /dev/null @@ -1,608 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "XRayMtlRes.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_PANEL DIALOGEX 0, 0, 216, 80 -STYLE DS_SETFONT | WS_CHILD -FONT 8, "MS Sans Serif", 0, 0, 0x0 -BEGIN - RTEXT " Color :",IDC_STATIC,22,26,26,10 - CONTROL "User1",IDC_COLOR_NEW,"ColorSwatch",0x0,51,18,50,26 - CONTROL "M",IDC_MAPON_CLR,"CustButton",0x0,106,27,10,10 - CONTROL "",IDC_HIGHLIGHT,"Static",SS_BLACKFRAME,135,25,67,47 - LTEXT " Opacity :",IDC_STATIC,19,60,31,8 - CONTROL "",IDC_TR_EDIT,"CustEdit",WS_TABSTOP,52,60,22,10 - CONTROL "0,255,0",IDC_TR_SPIN,"SpinnerControl",WS_TABSTOP,74,60, - 11,10 - CONTROL "M",IDC_MAPON_TR,"CustButton",0x0,91,60,10,10 - RTEXT "Brightness :",IDC_STATIC,12,48,37,8 - CONTROL "",IDC_BR_EDIT,"CustEdit",WS_TABSTOP,52,48,22,10 - CONTROL "0,255,0",IDC_BR_SPIN,"SpinnerControl",WS_TABSTOP,74,48, - 11,10 - CONTROL "M",IDC_MAPON_BR,"CustButton",0x0,91,48,10,10 - GROUPBOX "Shading Settings",IDC_STATIC,4,4,119,72 - CTEXT "Specular Curve",IDC_STATIC,135,11,67,12,SS_CENTERIMAGE | - SS_SUNKEN -END - -IDD_DMTL_SHADER4 DIALOGEX 0, 0, 216, 28 -STYLE DS_SETFONT | WS_CHILD -FONT 8, "MS Sans Serif", 0, 0, 0x0 -BEGIN - COMBOBOX IDC_SHADER,8,3,85,75,CBS_DROPDOWNLIST | WS_VSCROLL | - WS_TABSTOP - CONTROL "Wire",IDC_WIRE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, - 109,2,27,10 - CONTROL "2-Sided",IDC_2SIDE,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,162,2,36,10 - CONTROL "Face Map",IDC_FACE_MAP,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,110,14,44,10 - CONTROL "Faceted",IDC_FACETED,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,162,14,44,10 -END - -IDD_DMTL_DYNAM DIALOG 0, 0, 216, 49 -STYLE DS_SETFONT | WS_CHILD | WS_VISIBLE -FONT 8, "MS Sans Serif" -BEGIN - CONTROL "",IDC_BOUNCE_EDIT,"CustEdit",WS_TABSTOP,108,6,35,10 - LTEXT "Bounce Coefficient:",IDC_STATIC,44,7,63,9 - CONTROL "0,255,0",IDC_BOUNCE_SPIN,"SpinnerControl",0x0,144,6,11, - 10 - CONTROL "",IDC_STATFRIC_EDIT,"CustEdit",WS_TABSTOP,108,20,35,10 - LTEXT "Static Friction:",IDC_STATIC,58,21,49,9 - CONTROL "0,255,0",IDC_STATFRIC_SPIN,"SpinnerControl",0x0,144,20, - 11,10 - CONTROL "",IDC_SLIDFRIC_EDIT,"CustEdit",WS_TABSTOP,108,33,35,10 - LTEXT "Sliding Friction:",IDC_STATIC,56,33,50,9 - CONTROL "0,255,0",IDC_SLIDFRIC_SPIN,"SpinnerControl",0x0,144,33, - 11,10 -END - -IDD_DMTL_TEXMAP4 DIALOG 0, 0, 216, 309 -STYLE DS_SETFONT | WS_CHILD -FONT 8, "MS Sans Serif" -BEGIN - LTEXT "Amount",IDC_STATIC,76,4,24,8 - LTEXT "Map Type",IDC_STATIC,152,4,16,8 - CONTROL "",IDC_USEMAP_0,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 16,68,10 - CONTROL "",IDC_AMTEDIT_0,"CustEdit",WS_TABSTOP,72,16,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_0,"SpinnerControl",0x0,92,16,11,10 - CONTROL "",IDC_MAP_0,"CustButton",WS_TABSTOP,104,16,100,10 - CONTROL "User1",IDC_LOCK_TEX01,"CustButton",0x0,206,22,10,10 - CONTROL "",IDC_USEMAP_1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 28,68,10 - CONTROL "",IDC_AMTEDIT_1,"CustEdit",WS_TABSTOP,72,28,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_1,"SpinnerControl",0x0,92,28,11,10 - CONTROL "",IDC_MAP_1,"CustButton",WS_TABSTOP,104,28,100,10 - CONTROL "",IDC_USEMAP_2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 40,68,10 - CONTROL "",IDC_AMTEDIT_2,"CustEdit",WS_TABSTOP,72,40,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_2,"SpinnerControl",0x0,92,40,11,10 - CONTROL "",IDC_MAP_2,"CustButton",WS_TABSTOP,104,40,100,10 - CONTROL "",IDC_USEMAP_3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 52,68,10 - CONTROL "",IDC_AMTEDIT_3,"CustEdit",WS_TABSTOP,72,52,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_3,"SpinnerControl",0x0,92,52,11,10 - CONTROL "",IDC_MAP_3,"CustButton",WS_TABSTOP,104,52,100,10 - CONTROL "",IDC_USEMAP_4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 64,68,10 - CONTROL "",IDC_AMTEDIT_4,"CustEdit",WS_TABSTOP,72,64,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_4,"SpinnerControl",0x0,92,64,11,10 - CONTROL "",IDC_MAP_4,"CustButton",WS_TABSTOP,104,64,100,10 - CONTROL "",IDC_USEMAP_5,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 76,68,10 - CONTROL "",IDC_AMTEDIT_5,"CustEdit",WS_TABSTOP,72,76,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_5,"SpinnerControl",0x0,92,76,11,10 - CONTROL "",IDC_MAP_5,"CustButton",WS_TABSTOP,104,76,100,10 - CONTROL "",IDC_USEMAP_6,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 88,68,10 - CONTROL "",IDC_AMTEDIT_6,"CustEdit",WS_TABSTOP,72,88,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_6,"SpinnerControl",0x0,92,88,11,10 - CONTROL "",IDC_MAP_6,"CustButton",WS_TABSTOP,104,88,100,10 - CONTROL "",IDC_USEMAP_7,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 100,68,10 - CONTROL "",IDC_AMTEDIT_7,"CustEdit",WS_TABSTOP,72,100,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_7,"SpinnerControl",0x0,92,100,11, - 10 - CONTROL "",IDC_MAP_7,"CustButton",WS_TABSTOP,104,100,100,10 - CONTROL "",IDC_USEMAP_8,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 112,68,10 - CONTROL "",IDC_AMTEDIT_8,"CustEdit",WS_TABSTOP,72,112,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_8,"SpinnerControl",0x0,92,112,11, - 10 - CONTROL "",IDC_MAP_8,"CustButton",WS_TABSTOP,104,112,100,10 - CONTROL "",IDC_USEMAP_9,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 124,68,10 - CONTROL "",IDC_AMTEDIT_9,"CustEdit",WS_TABSTOP,72,124,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_9,"SpinnerControl",0x0,92,124,11, - 10 - CONTROL "",IDC_MAP_9,"CustButton",WS_TABSTOP,104,124,100,10 - CONTROL "",IDC_USEMAP_10,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 136,68,10 - CONTROL "",IDC_AMTEDIT_10,"CustEdit",WS_TABSTOP,72,136,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_10,"SpinnerControl",0x0,92,136,11, - 10 - CONTROL "",IDC_MAP_10,"CustButton",WS_TABSTOP,104,136,100,10 - CONTROL "",IDC_USEMAP_11,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 148,68,10 - CONTROL "",IDC_AMTEDIT_11,"CustEdit",WS_TABSTOP,72,148,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_11,"SpinnerControl",0x0,92,148,11, - 10 - CONTROL "",IDC_MAP_11,"CustButton",WS_TABSTOP,104,148,100,10 - CONTROL "",IDC_USEMAP_12,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 160,68,10 - CONTROL "",IDC_AMTEDIT_12,"CustEdit",WS_TABSTOP,72,160,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_12,"SpinnerControl",0x0,92,160,11, - 10 - CONTROL "",IDC_MAP_12,"CustButton",WS_TABSTOP,104,160,100,10 - CONTROL "",IDC_USEMAP_13,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 172,68,10 - CONTROL "",IDC_AMTEDIT_13,"CustEdit",WS_TABSTOP,72,172,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_13,"SpinnerControl",0x0,92,172,11, - 10 - CONTROL "",IDC_MAP_13,"CustButton",WS_TABSTOP,104,172,100,10 - CONTROL "",IDC_USEMAP_14,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 184,68,10 - CONTROL "",IDC_AMTEDIT_14,"CustEdit",WS_TABSTOP,72,184,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_14,"SpinnerControl",0x0,92,184,11, - 10 - CONTROL "",IDC_MAP_14,"CustButton",WS_TABSTOP,104,184,100,10 - CONTROL "",IDC_USEMAP_15,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 196,68,10 - CONTROL "",IDC_AMTEDIT_15,"CustEdit",WS_TABSTOP,72,196,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_15,"SpinnerControl",0x0,92,196,11, - 10 - CONTROL "",IDC_MAP_15,"CustButton",WS_TABSTOP,104,196,100,10 - CONTROL "",IDC_USEMAP_16,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 208,68,10 - CONTROL "",IDC_AMTEDIT_16,"CustEdit",WS_TABSTOP,72,208,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_16,"SpinnerControl",0x0,92,208,11, - 10 - CONTROL "",IDC_MAP_16,"CustButton",WS_TABSTOP,104,208,100,10 - CONTROL "",IDC_USEMAP_17,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 220,68,10 - CONTROL "",IDC_AMTEDIT_17,"CustEdit",WS_TABSTOP,72,220,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_17,"SpinnerControl",0x0,92,220,11, - 10 - CONTROL "",IDC_MAP_17,"CustButton",WS_TABSTOP,104,220,100,10 - CONTROL "",IDC_USEMAP_18,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 232,68,10 - CONTROL "",IDC_AMTEDIT_18,"CustEdit",WS_TABSTOP,72,232,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_18,"SpinnerControl",0x0,92,232,11, - 10 - CONTROL "",IDC_MAP_18,"CustButton",WS_TABSTOP,104,232,100,10 - CONTROL "",IDC_USEMAP_19,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 244,68,10 - CONTROL "",IDC_AMTEDIT_19,"CustEdit",WS_TABSTOP,72,244,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_19,"SpinnerControl",0x0,92,244,11, - 10 - CONTROL "",IDC_MAP_19,"CustButton",WS_TABSTOP,104,244,100,10 - CONTROL "",IDC_USEMAP_20,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 256,68,10 - CONTROL "",IDC_AMTEDIT_20,"CustEdit",WS_TABSTOP,72,256,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_20,"SpinnerControl",0x0,92,256,11, - 10 - CONTROL "",IDC_MAP_20,"CustButton",WS_TABSTOP,104,256,100,10 - CONTROL "",IDC_USEMAP_21,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 268,68,10 - CONTROL "",IDC_AMTEDIT_21,"CustEdit",WS_TABSTOP,72,268,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_21,"SpinnerControl",0x0,92,268,11, - 10 - CONTROL "",IDC_MAP_21,"CustButton",WS_TABSTOP,104,268,100,10 - CONTROL "",IDC_USEMAP_22,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 280,68,10 - CONTROL "",IDC_AMTEDIT_22,"CustEdit",WS_TABSTOP,72,280,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_22,"SpinnerControl",0x0,92,280,11, - 10 - CONTROL "",IDC_MAP_22,"CustButton",WS_TABSTOP,104,280,100,10 - CONTROL "",IDC_USEMAP_23,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, - 292,68,10 - CONTROL "",IDC_AMTEDIT_23,"CustEdit",WS_TABSTOP,72,292,20,10 - CONTROL "0,255,0",IDC_AMTSPIN_23,"SpinnerControl",0x0,92,292,11, - 10 - CONTROL "",IDC_MAP_23,"CustButton",WS_TABSTOP,104,292,100,10 -END - -IDD_DMTL_SAMPLING3 DIALOG 0, 0, 216, 59 -STYLE DS_SETFONT | WS_CHILD -FONT 8, "MS Sans Serif" -BEGIN - CONTROL "Enable Sampler",IDC_SUPER_SAMP,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,3,5,64,10 - COMBOBOX IDC_PIX_SAMPLER,75,3,80,84,CBS_DROPDOWNLIST | WS_VSCROLL | - WS_TABSTOP - RTEXT "Quality:",IDC_QUALITY_TEXT,155,4,27,9,NOT WS_GROUP - CONTROL "",IDC_SAMPLEQUALITY_EDIT,"CustEdit",WS_TABSTOP,183,3,19, - 10 - CONTROL "0,255,0",IDC_SAMPLEQUALITY_SPIN,"SpinnerControl", - WS_TABSTOP,202,3,11,10 - CONTROL "Supersamp. Tex.",IDC_SAMPLE_TEX,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,3,18,71,10 - GROUPBOX "",IDC_COMMENT_BOX,75,16,80,41 - LTEXT "No Comment",IDC_COMMENT_TEXT,77,21,76,34 - RTEXT "Param0",IDC_PARAM0_TEXT,155,17,27,9,NOT WS_GROUP - CONTROL "",IDC_PARAM0_EDIT,"CustEdit",WS_TABSTOP,183,16,19,10 - CONTROL "0,255,0",IDC_PARAM0_SPIN,"SpinnerControl",WS_TABSTOP, - 202,16,11,10 - CONTROL "Adaptive",IDC_ADAPT_ON,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,3,32,56,10 - RTEXT "Param1",IDC_PARAM1_TEXT,155,30,27,9,NOT WS_GROUP - CONTROL "",IDC_PARAM1_EDIT,"CustEdit",WS_TABSTOP,183,30,19,10 - CONTROL "0,255,0",IDC_PARAM1_SPIN,"SpinnerControl",WS_TABSTOP, - 201,30,11,10 - RTEXT "Threshold:",IDC_ADAPT_STATIC,2,46,34,8,NOT WS_GROUP - CONTROL "",IDC_THRESHOLD_EDIT,"CustEdit",WS_TABSTOP,38,45,25,10 - CONTROL "0,255,0",IDC_THRESHOLD_SPIN,"SpinnerControl",WS_TABSTOP, - 63,45,11,10 - PUSHBUTTON "Advanced...",IDC_ADVANCED_BUTTON,166,43,46,12 -END - -IDD_DMTL_EXTRA6 DIALOGEX 0, 0, 216, 101 -STYLE DS_SETFONT | WS_CHILD -FONT 8, "MS Sans Serif", 0, 0, 0x1 -BEGIN - GROUPBOX "Advanced Transparency",IDC_OPAC_BOX,4,1,147,71 - LTEXT "Falloff:",IDC_OPAC_TEXT1,9,11,22,8 - LTEXT "Type:",IDC_OPAC_TEXT3,56,11,18,8 - CONTROL "In",IDC_TF_IN,"Button",BS_AUTORADIOBUTTON | WS_GROUP | - WS_TABSTOP,26,21,20,8 - CONTROL "Out",IDC_TF_OUT,"Button",BS_AUTORADIOBUTTON | - WS_TABSTOP,26,32,24,10 - RTEXT "Refraction Filter: ",IDC_FILTER_OVERLAY,44,19,59,11 - CONTROL "Filter:",IDC_TR_SUB2,"Button",BS_AUTORADIOBUTTON | - WS_GROUP | WS_TABSTOP,72,20,29,8 - CONTROL "Subtractive",IDC_TR_SUB,"Button",BS_AUTORADIOBUTTON | - WS_TABSTOP,72,33,52,8 - CONTROL "Additive",IDC_TR_ADD,"Button",BS_AUTORADIOBUTTON | - WS_TABSTOP,72,45,37,8 - CONTROL "User1",IDC_FILTER_CS,"ColorSwatch",WS_TABSTOP,105,17,27, - 14 - CONTROL "M",IDC_MAPON_FI,"CustButton",WS_TABSTOP,136,20,10,10 - GROUPBOX "Wire",IDC_STATIC,153,1,59,71 - LTEXT "Size:",IDC_STATIC,156,21,16,9,0,WS_EX_RIGHT - CONTROL "",IDC_WIRE_EDIT,"CustEdit",WS_TABSTOP,174,20,22,10 - CONTROL "0,255,0",IDC_WIRE_SPIN,"SpinnerControl",0x0,196,20,11, - 10 - LTEXT "In:",IDC_STATIC,160,45,8,8 - CONTROL "Pixels",IDC_PIXELS,"Button",BS_AUTORADIOBUTTON | - WS_GROUP | WS_TABSTOP,172,41,32,8 - CONTROL "Units",IDC_UNITS,"Button",BS_AUTORADIOBUTTON | - WS_TABSTOP,172,52,28,8 - LTEXT "Index of Refraction:",IDC_REFR_TEXT1,11,57,91,9,0, - WS_EX_RIGHT - CONTROL "",IDC_IOR_EDIT,"CustEdit",WS_TABSTOP,105,57,19,10 - CONTROL "0,255,0",IDC_IOR_SPIN,"SpinnerControl",0x0,124,57,11,10 - GROUPBOX "Reflection Dimming",IDC_REFL_BOX,4,72,209,27 - CONTROL "Apply",IDC_DIM_REFL,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,11,83,36,10 - LTEXT "Dim Level:",IDC_REFL_TEXT1,52,84,33,8,0,WS_EX_RIGHT - CONTROL "",IDC_DIM_AMT,"CustEdit",WS_TABSTOP,87,83,24,10 - CONTROL "0,255,0",IDC_DIM_AMTSPIN,"SpinnerControl",0x0,112,83,11, - 10 - LTEXT "Refl. Level:",IDC_REFL_TEXT2,132,84,38,8 - CONTROL "",IDC_DIM_MULT,"CustEdit",WS_TABSTOP,173,83,24,10 - CONTROL "0,255,0",IDC_DIM_MULTSPIN,"SpinnerControl",0x0,198,83, - 11,10 - LTEXT "Amt:",IDC_OPAC_TEXT2,12,44,16,8 - CONTROL "",IDC_TF_EDIT,"CustEdit",WS_TABSTOP,28,44,20,10 - CONTROL "0,255,0",IDC_TF_SPIN,"SpinnerControl",0x0,48,44,11,10 -END - -IDD_DMTL_XRAY DIALOGEX 0, 0, 216, 50 -STYLE DS_SETFONT | WS_CHILD -FONT 8, "MS Sans Serif", 0, 0, 0x0 -BEGIN - LTEXT "Engine Shader",IDC_STATIC,8,7,52,8 - COMBOBOX IDC_ESHADER,63,4,143,75,CBS_DROPDOWNLIST | WS_VSCROLL | - WS_TABSTOP - COMBOBOX IDC_CSHADER,63,19,143,75,CBS_DROPDOWNLIST | WS_VSCROLL | - WS_TABSTOP - LTEXT "Compiler Shader",IDC_STATIC,8,22,52,8 - COMBOBOX IDC_GAMEMTL,63,34,143,75,CBS_DROPDOWNLIST | WS_VSCROLL | - WS_TABSTOP - LTEXT "Game Material",IDC_STATIC,8,37,46,8 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_PANEL, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 101 - TOPMARGIN, 7 - END - - IDD_DMTL_SHADER4, DIALOG - BEGIN - VERTGUIDE, 8 - VERTGUIDE, 206 - END - - IDD_DMTL_EXTRA6, DIALOG - BEGIN - TOPMARGIN, 1 - END - - IDD_DMTL_XRAY, DIALOG - BEGIN - VERTGUIDE, 8 - VERTGUIDE, 206 - BOTTOMMARGIN, 46 - END -END -#endif // APSTUDIO_INVOKED - - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "XRayMtlRes.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,0,0,0 - PRODUCTVERSION 3,0,0,0 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x40004L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "Comments", "TECH: " - VALUE "FileDescription", "Demo Material for testing" - VALUE "FileVersion", "4.0.0.0" - VALUE "InternalName", "DemoMtl" - VALUE "LegalTrademarks", "3D Studio MAX, Biped, Character Studio, Heidi, Kinetix and Physique are registered trademarks and 3ds max, combustion, Discreet, DWG Unplugged, DXF, FLI and FLC are trademarks of Autodesk, Inc." - VALUE "OriginalFilename", "DemoMtl.dlb" - VALUE "ProductName", "3ds max" - VALUE "ProductVersion", "4.0.0.0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - - -///////////////////////////////////////////////////////////////////////////// -// -// Bitmap -// - -IDB_DMTL_MASKBUTTONS BITMAP "dmtlmsk.bmp" -IDB_DMTL_BUTTONS BITMAP "dmtlbut.bmp" - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE -BEGIN - IDS_LIBDESCRIPTION "Demo Shader for testing" - IDS_CATEGORY "XRay Game Material" - IDS_CLASS_NAME "XRayMtl" - IDS_PARAMS "Parameters" - IDS_SPIN "Spin" - IDS_COMMENT "Appwizard generated Plugin" - IDS_MN_DIFFUSE "Diffuse" - IDS_MN_BRIGHTNESS "Brightness" - IDS_MN_OPACITY "Opacity" - IDS_MN_NONE "None" - IDS_COLOR "Diffuse Color" - IDS_PARAMCHG "Parameter Change" - IDS_MN_DIFFUSE_I "Diffuse" - IDS_MN_BRIGHTNESS_I "Brightness" - IDS_MN_OPACITY_I "Opacity" -END - -STRINGTABLE -BEGIN - IDS_DS_DP "Displacement" - IDS_KE_STANDARD2 "Standard" - IDS_KE_SHADER "Shader Basic Parameters" -END - -STRINGTABLE -BEGIN - IDS_DS_WIREFRAME "Wire" - IDS_DS_SHIN_STR "Specular Level" - IDS_DS_OPACITY "Opacity" - IDS_JW_SHADERTYPE "Shader Type" - IDS_DS_EXTRA "Extended Parameters" - IDS_DS_TEXMAP "Maps" -END - -STRINGTABLE -BEGIN - IDS_JW_TWOSIDED "Two-sided" - IDS_JW_FACEMAP "Face Map" - IDS_JW_OPACITYTYPE "Opacity Type" - IDS_JW_FILTERMAP "Filter Map" - IDS_JW_FALLOFFTYPE "Falloff Type" - IDS_JW_WIREUNITS "Wire Units" - IDS_JW_APPLYREFDIM "Apply Reflection Dimming" - IDS_JW_PIXELSAMPLER "Pixel Sampler" - IDS_JW_SAMPLERQUAL "Sampler Quality" - IDS_JW_SAMPLERENABLE "Sampler Enable" -END - -STRINGTABLE -BEGIN - IDS_JW_MAPAMOUNTS "Map Amounts" - IDS_JW_ENABLE "Enable" - IDS_JW_AMOUNT "Amount" - IDS_JW_SHADERBYNAME "Shader Name" - IDS_JW_SAMPLERBYNAME "Sampler Name" -END - -STRINGTABLE -BEGIN - IDS_KE_FACETED "Faceted" - IDS_JW_ESHADERTYPE "EShader Type" - IDS_JW_CSHADERTYPE "CShader Type" - IDS_KE_SAMPLERADAPTTHRESH "Adaptive Threshold" - IDS_KE_SAMPLERADAPTON "Adaptive On" - IDS_KE_SAMPLERADVANCED "Advanced Options..." - IDS_JW_ESHADERBYNAME "EShader Name" - IDS_JW_CSHADERBYNAME "CShader Name" -END - -STRINGTABLE -BEGIN - IDS_KE_STANDARD2_CDESC "Standard" -END - -STRINGTABLE -BEGIN - IDS_DS_DYNAMICS "Dynamics Properties" - IDS_DS_BOUNCE "Bounce Coefficient" - IDS_DS_STATFRIC "Static Friction" - IDS_DS_SLIDFRIC "Sliding Friction" -END - -STRINGTABLE -BEGIN - IDS_JW_MAPENABLES "Map Enables" - IDS_DS_BU "Bump" - IDS_DS_RL "Reflection" - IDS_DS_RR "Refraction" - IDS_DS_TEXMAPS "Maps" - IDS_DS_FILTER "Filter Color" -END - -STRINGTABLE -BEGIN - IDS_DS_DIMLEV "Dim Level" - IDS_DS_DIMMULT "Reflection Level" -END - -STRINGTABLE -BEGIN - IDS_DS_FALLOFF "Falloff" -END - -STRINGTABLE -BEGIN - IDS_DS_WIRESZ "Wire Size" - IDS_DS_IOR "Index of Refraction" - IDS_JW_MAPS "Maps" -END - -STRINGTABLE -BEGIN - IDS_JW_ADTEXLOCK "Ambient-Diffuse Texture Lock" -END - -STRINGTABLE -BEGIN - IDS_KE_SAMPLING "SuperSampling" - IDS_KE_XRAY "X-Ray Params" - IDS_KE_NONE "None" -END - -STRINGTABLE -BEGIN - IDS_KE_SAMPLER_PARAM0 "Optional Param0" - IDS_KE_SAMPLER_PARAM1 "Optional Param1" -END - -STRINGTABLE -BEGIN - IDS_KE_SUBSAMPLE_TEX_ON "SubSample Textures" -END - -STRINGTABLE -BEGIN - IDS_DS_CLASSTEXMAPS "Texmaps" -END - -STRINGTABLE -BEGIN - IDS_DS_AMOUNT "Amount" - IDS_JW_GAMEMTLTYPE "Game Mtl Type" - IDS_JW_GAMEMTLBYNAME "Game Mtl Name" -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/cs/engine/plugins/shared/GameMtlLib.cpp b/cs/engine/plugins/shared/GameMtlLib.cpp deleted file mode 100644 index 5ffa225dc..000000000 --- a/cs/engine/plugins/shared/GameMtlLib.cpp +++ /dev/null @@ -1,153 +0,0 @@ -//--------------------------------------------------------------------------- -#include "stdafx.h" -#pragma hdrstop - -#include "GameMtlLib.h" - -CGameMtlLibrary GMLib; - -void SGameMtl::Load(IReader& fs) -{ - R_ASSERT(fs.find_chunk(GAMEMTL_CHUNK_MAIN)); - ID = fs.r_u32(); - fs.r_stringZ (m_Name); - - if (fs.find_chunk(GAMEMTL_CHUNK_DESC)){ - fs.r_stringZ (m_Desc); - } - - R_ASSERT(fs.find_chunk(GAMEMTL_CHUNK_FLAGS)); - Flags.assign (fs.r_u32()); - - R_ASSERT(fs.find_chunk(GAMEMTL_CHUNK_PHYSICS)); - fPHFriction = fs.r_float(); - fPHDamping = fs.r_float(); - fPHSpring = fs.r_float(); - fPHBounceStartVelocity = fs.r_float(); - fPHBouncing = fs.r_float(); - - R_ASSERT(fs.find_chunk(GAMEMTL_CHUNK_FACTORS)); - fShootFactor = fs.r_float(); - fBounceDamageFactor = fs.r_float(); - fVisTransparencyFactor = fs.r_float(); - fSndOcclusionFactor = fs.r_float(); - - if(fs.find_chunk(GAMEMTL_CHUNK_FLOTATION)) - fFlotationFactor = fs.r_float(); - - if(fs.find_chunk(GAMEMTL_CHUNK_INJURIOUS)) - fInjuriousSpeed = fs.r_float(); -} - -void CGameMtlLibrary::Load() -{ - string_path name; - if (!FS.exist(name, _game_data_,GAMEMTL_FILENAME)){ - Log ("! Can't find game material file: ",name); - return; - } - - R_ASSERT (material_pairs.empty()); - R_ASSERT (materials.empty()); - - destructor F(FS.r_open(name)); - IReader& fs = F(); - - R_ASSERT(fs.find_chunk(GAMEMTLS_CHUNK_VERSION)); - u16 version = fs.r_u16(); - if (GAMEMTL_CURRENT_VERSION!=version){ - Log ("CGameMtlLibrary: invalid version. Library can't load."); - return; - } - - R_ASSERT(fs.find_chunk(GAMEMTLS_CHUNK_AUTOINC)); - material_index = fs.r_u32(); - material_pair_index = fs.r_u32(); - - materials.clear (); - material_pairs.clear(); - - IReader* OBJ = fs.open_chunk(GAMEMTLS_CHUNK_MTLS); - if (OBJ) { - u32 count; - for (IReader* O = OBJ->open_chunk_iterator(count); O; O = OBJ->open_chunk_iterator(count,O)) { - SGameMtl* M = new SGameMtl(); - M->Load (*O); - materials.push_back(M); - } - OBJ->close (); - } - - OBJ = fs.open_chunk(GAMEMTLS_CHUNK_MTLS_PAIR); - if (OBJ){ - u32 count; - for (IReader* O = OBJ->open_chunk_iterator(count); O; O = OBJ->open_chunk_iterator(count,O)) { - SGameMtlPair* M = new SGameMtlPair(this); - M->Load (*O); - material_pairs.push_back(M); - } - OBJ->close (); - } - -#ifndef _EDITOR - material_count = (u32)materials.size(); - material_pairs_rt.resize(material_count*material_count,0); - for (GameMtlPairIt p_it=material_pairs.begin(); material_pairs.end() != p_it; ++p_it){ - SGameMtlPair* S = *p_it; - int idx0 = GetMaterialIdx(S->mtl0)*material_count+GetMaterialIdx(S->mtl1); - int idx1 = GetMaterialIdx(S->mtl1)*material_count+GetMaterialIdx(S->mtl0); - material_pairs_rt[idx0]=S; - material_pairs_rt[idx1]=S; - } -#endif - -/* - for (GameMtlPairIt p_it=material_pairs.begin(); material_pairs.end() != p_it; ++p_it){ - SGameMtlPair* S = *p_it; - for (int k=0; kStepSounds.size(); k++){ - Msg("%40s - 0x%x", S->StepSounds[k].handle->file_name(), S->StepSounds[k].g_type); - } - } -*/ -} - -#ifdef GM_NON_GAME -SGameMtlPair::~SGameMtlPair () -{ -} -void SGameMtlPair::Load(IReader& fs) -{ - shared_str buf; - - R_ASSERT(fs.find_chunk(GAMEMTLPAIR_CHUNK_PAIR)); - mtl0 = fs.r_u32(); - mtl1 = fs.r_u32(); - ID = fs.r_u32(); - ID_parent = fs.r_u32(); - u32 own_mask = fs.r_u32(); - if (GAMEMTL_NONE_ID==ID_parent) OwnProps.one (); - else OwnProps.assign (own_mask); - - R_ASSERT(fs.find_chunk(GAMEMTLPAIR_CHUNK_BREAKING)); - fs.r_stringZ (buf); BreakingSounds = buf.size()?*buf:""; - - R_ASSERT(fs.find_chunk(GAMEMTLPAIR_CHUNK_STEP)); - fs.r_stringZ (buf); StepSounds = buf.size()?*buf:""; - - R_ASSERT(fs.find_chunk(GAMEMTLPAIR_CHUNK_COLLIDE)); - fs.r_stringZ (buf); CollideSounds = buf.size()?*buf:""; - fs.r_stringZ (buf); CollideParticles= buf.size()?*buf:""; - fs.r_stringZ (buf); CollideMarks = buf.size()?*buf:""; -} -#endif - -#ifdef DEBUG -LPCSTR SGameMtlPair::dbg_Name() -{ - static string256 nm; - SGameMtl* M0 = GMLib.GetMaterialByID(GetMtl0()); - SGameMtl* M1 = GMLib.GetMaterialByID(GetMtl1()); - sprintf(nm,"Pair: %s - %s",*M0->m_Name,*M1->m_Name); - return nm; -} -#endif diff --git a/cs/engine/plugins/shared/GameMtlLib.h b/cs/engine/plugins/shared/GameMtlLib.h deleted file mode 100644 index a064a1a30..000000000 --- a/cs/engine/plugins/shared/GameMtlLib.h +++ /dev/null @@ -1,341 +0,0 @@ -//--------------------------------------------------------------------------- -#ifndef GameMtlLibH -#define GameMtlLibH -//--------------------------------------------------------------------------- -#pragma once - -#define GAMEMTL_CURRENT_VERSION 0x0001 -//---------------------------------------------------- - -#define GAMEMTLS_CHUNK_VERSION 0x1000 -#define GAMEMTLS_CHUNK_AUTOINC 0x1001 -#define GAMEMTLS_CHUNK_MTLS 0x1002 -#define GAMEMTLS_CHUNK_MTLS_PAIR 0x1003 -//---------------------------------------------------- -#define GAMEMTL_CHUNK_MAIN 0x1000 -#define GAMEMTL_CHUNK_FLAGS 0x1001 -#define GAMEMTL_CHUNK_PHYSICS 0x1002 -#define GAMEMTL_CHUNK_FACTORS 0x1003 -#define GAMEMTL_CHUNK_FLOTATION 0x1004 -#define GAMEMTL_CHUNK_DESC 0x1005 -#define GAMEMTL_CHUNK_INJURIOUS 0x1006 -//---------------------------------------------------- -#define GAMEMTLPAIR_CHUNK_PAIR 0x1000 -//#define GAMEMTLPAIR_CHUNK_FLOTATION 0x1001 - obsolete -#define GAMEMTLPAIR_CHUNK_BREAKING 0x1002 -#define GAMEMTLPAIR_CHUNK_STEP 0x1003 -//#define GAMEMTLPAIR_CHUNK_COLLIDE 0x1004 - obsolete / rename HIT -#define GAMEMTLPAIR_CHUNK_COLLIDE 0x1005 -//---------------------------------------------------- - -#define GAMEMTL_SUBITEM_COUNT 4 - -#define GAMEMTL_NONE_ID u32(-1) -#define GAMEMTL_NONE_IDX u16(-1) -#define GAMEMTL_FILENAME "gamemtl.xr" - -#ifdef _EDITOR -#define GM_NON_GAME -#endif -#ifdef _MAX_PLUGIN -#define GM_NON_GAME -#endif -#ifdef _LW_SHADER -#define GM_NON_GAME -#endif -#ifdef _MAYA_PLUGIN -#define GM_NON_GAME -#endif - -#ifdef _EDITOR -#include "ElTree.hpp" -#endif - -#ifdef GM_NON_GAME - #define SoundVec shared_str - #define PSVec shared_str - #define ShaderVec shared_str -#else - using SoundVec = xr_vector; - using SoundIt = SoundVec::iterator; - using PSVec = xr_vector; - using PSIt = PSVec::iterator; - using ShaderVec = xr_vector; - using ShaderIt = ShaderVec::iterator; -#endif - -struct ECORE_API SGameMtl -{ - friend class CGameMtlLibrary; -protected: - int ID; // auto number -public: - enum{ - flBreakable = (1ul<<0ul), -// flShootable = (1ul<<1ul), - flBounceable = (1ul<<2ul), - flSkidmark = (1ul<<3ul), - flBloodmark = (1ul<<4ul), - flClimable = (1ul<<5ul), -// flWalkOn = (1ul<<6ul), // obsolette - flPassable = (1ul<<7ul), - flDynamic = (1ul<<8ul), - flLiquid = (1ul<<9ul), - flSuppressShadows = (1ul<<10ul), - flSuppressWallmarks = (1ul<<11ul), - flActorObstacle = (1ul<<12ul), - - flInjurious = (1ul<<28ul),// flInjurious = fInjuriousSpeed > 0.f - flShootable = (1ul<<29ul), - flTransparent = (1ul<<30ul), - flSlowDown = (1ul<<31ul) // flSlowDown = (fFlotationFactor<1.f) - }; -public: - shared_str m_Name; - shared_str m_Desc; - - Flags32 Flags; - // physics part - float fPHFriction; // ? - float fPHDamping; // ? - float fPHSpring; // ? - float fPHBounceStartVelocity; // ? - float fPHBouncing; // ? - // shoot&bounce&visibility&flotation - float fFlotationFactor; // 0.f - 1.f (1.f-полностью проходимый) - float fShootFactor; // 0.f - 1.f (1.f-полностью простреливаемый) - float fBounceDamageFactor; // 0.f - 100.f - float fInjuriousSpeed; // 0.f - ... (0.f-не отбирает здоровье (скорость уменьшения здоровья)) - float fVisTransparencyFactor; // 0.f - 1.f (1.f-полностью прозрачный) - float fSndOcclusionFactor; // 0.f - 1.f (1.f-полностью слышен) -public: - SGameMtl () - { - ID = -1; - m_Name = "unknown"; - Flags.zero (); - // factors - fFlotationFactor = 1.f; - fShootFactor = 0.f; - fBounceDamageFactor = 1.f; - fInjuriousSpeed = 0.f; - fVisTransparencyFactor = 0.f; - fSndOcclusionFactor = 0.f; - // physics - fPHFriction = 1.f; - fPHDamping = 1.f; - fPHSpring = 1.f; - fPHBounceStartVelocity = 0.f; - fPHBouncing = 0.1f; - } - void Load (IReader& fs); - void Save (IWriter& fs); - IC int GetID (){return ID;} -#ifdef _EDITOR - void FillProp (PropItemVec& values, ListItem* owner); -#endif -}; -using GameMtlVec = xr_vector; -using GameMtlIt = GameMtlVec::iterator; - -struct ECORE_API SGameMtlPair{ - friend class CGameMtlLibrary; - CGameMtlLibrary* m_Owner; -private: - int mtl0; - int mtl1; -protected: - int ID; // auto number - int ID_parent; -public: - enum{ -// flFlotation = (1<<0), - flBreakingSounds= (1<<1), - flStepSounds = (1<<2), -// flCollideSounds = (1<<3), - flCollideSounds = (1<<4), - flCollideParticles = (1<<5), - flCollideMarks = (1<<6) - }; - Flags32 OwnProps; -// properties - SoundVec BreakingSounds; - SoundVec StepSounds; - SoundVec CollideSounds; - PSVec CollideParticles; - ShaderVec CollideMarks; -#ifdef _EDITOR - PropValue* propBreakingSounds; - PropValue* propStepSounds; - PropValue* propCollideSounds; - PropValue* propCollideParticles; - PropValue* propCollideMarks; - void __stdcall OnFlagChange (PropValue* sender); - void __stdcall OnParentClick (ButtonValue* sender, bool& bModif, bool& bSafe); - void __stdcall OnCommandClick (ButtonValue* sender, bool& bModif, bool& bSafe); - void __stdcall FillChooseMtl (ChooseItemVec& items, void* param); -#endif -public: - SGameMtlPair (CGameMtlLibrary* owner) - { - mtl0 = -1; - mtl1 = -1; - ID = -1; - ID_parent = -1; - m_Owner = owner; - OwnProps.one (); - } - ~SGameMtlPair (); - IC int GetMtl0 (){return mtl0;} - IC int GetMtl1 (){return mtl1;} - IC int GetID (){return ID;} - IC void SetPair (int m0, int m1){mtl0=m0; mtl1=m1;} - IC bool IsPair (int m0, int m1){return !!(((mtl0==m0)&&(mtl1==m1))||((mtl0==m1)&&(mtl1==m0)));} - void Save (IWriter& fs); - void Load (IReader& fs); - IC int GetParent (){return ID_parent;} - BOOL SetParent (int parent); -#ifdef _EDITOR - void FillProp (PropItemVec& values); - void TransferFromParent(SGameMtlPair* parent); -#endif -#ifdef DEBUG - LPCSTR dbg_Name (); -#endif -}; - -using GameMtlPairVec = xr_vector; -using GameMtlPairIt = GameMtlPairVec::iterator; - -class ECORE_API CGameMtlLibrary{ - int material_index; - int material_pair_index; - - GameMtlVec materials; - GameMtlPairVec material_pairs; - -#ifndef _EDITOR - // game part - u32 material_count; - GameMtlPairVec material_pairs_rt; -#endif -public: - CGameMtlLibrary () - { - material_index = 0; - material_pair_index = 0; -#ifndef _EDITOR - material_count = 0; -#endif - } - ~CGameMtlLibrary () - { - /* - R_ASSERT (0==material_pairs_rt.size()); - R_ASSERT (0==material_pairs.size()); - R_ASSERT (0==materials.size()); - */ - } - IC void Unload () - { -#ifndef _EDITOR - material_count = 0; - material_pairs_rt.clear(); -#endif - for (GameMtlIt m_it=materials.begin(); materials.end() != m_it; ++m_it) - xr_delete (*m_it); - materials.clear(); - for (GameMtlPairIt p_it=material_pairs.begin(); material_pairs.end() != p_it; ++p_it) - xr_delete (*p_it); - material_pairs.clear(); - } - // material routine - IC GameMtlIt GetMaterialIt (LPCSTR name) - { - for (GameMtlIt it=materials.begin(); materials.end() != it; ++it) - if (0==strcmpi(*(*it)->m_Name,name)) return it; - return materials.end(); - } - IC GameMtlIt GetMaterialIt (shared_str& name) - { - for (GameMtlIt it=materials.begin(); materials.end() != it; ++it) - if (name.equal((*it)->m_Name)) return it; - return materials.end(); - } - IC GameMtlIt GetMaterialItByID(int id) - { - for (GameMtlIt it=materials.begin(); materials.end() != it; ++it) - if ((*it)->ID==id) return it; - return materials.end(); - } - IC u32 GetMaterialID (LPCSTR name) - { - GameMtlIt it = GetMaterialIt (name); - return (it==materials.end())?GAMEMTL_NONE_ID:(*it)->ID; - } -#ifdef _EDITOR - // editor - SGameMtl* AppendMaterial (SGameMtl* parent); - void RemoveMaterial (LPCSTR name); - IC SGameMtl* GetMaterialByID (int ID) - { - GameMtlIt it=GetMaterialItByID(ID); - return materials.end() != it?*it:0; - } - IC SGameMtl* GetMaterial (LPCSTR name) - { - GameMtlIt it=GetMaterialIt(name); - return materials.end() != it?*it:0; - } -#else - // game - IC u16 GetMaterialIdx (int ID) {GameMtlIt it=GetMaterialItByID(ID);VERIFY(materials.end() != it); return (u16)(it-materials.begin());} - IC u16 GetMaterialIdx (LPCSTR name) {GameMtlIt it=GetMaterialIt(name);VERIFY(materials.end() != it); return (u16)(it-materials.begin());} - IC SGameMtl* GetMaterialByIdx(u16 idx) {VERIFY(idx_a_vector_.empty(),_mtl_pair_->dbg_Name());\ - _res_.clone(GET_RANDOM(_mtl_pair_##->_a_vector_));\ - } - -extern ECORE_API CGameMtlLibrary GMLib; -#endif - diff --git a/cs/engine/plugins/shared/Helper.cpp b/cs/engine/plugins/shared/Helper.cpp deleted file mode 100644 index 717f9dbe8..000000000 --- a/cs/engine/plugins/shared/Helper.cpp +++ /dev/null @@ -1,136 +0,0 @@ -//----------------------------------------------------------------------------// -// Helper.cpp // -// Copyright (C) 2001 Bruno 'Beosil' Heidelberger // -//----------------------------------------------------------------------------// -// This program is free software; you can redistribute it and/or modify it // -// under the terms of the GNU General Public License as published by the Free // -// Software Foundation; either version 2 of the License, or (at your option) // -// any later version. // -//----------------------------------------------------------------------------// - -//----------------------------------------------------------------------------// -// Includes // -//----------------------------------------------------------------------------// - -#include "StdAfx.h" -#include "Helper.h" - -//----------------------------------------------------------------------------// -// Constructors // -//----------------------------------------------------------------------------// - -Helper::Helper() -{ -} - -//----------------------------------------------------------------------------// -// Destructor // -//----------------------------------------------------------------------------// - -Helper::~Helper() -{ -} - -//----------------------------------------------------------------------------// -// Get the transformation matrix of a bone node // -//----------------------------------------------------------------------------// -Matrix3 Helper::GetBoneTM(INode *pNode, TimeValue t) -{ - // get node transformation - Matrix3 tm; - tm = pNode->GetNodeTM(t); - - // make transformation uniform - tm.NoScale(); - - return tm; -} - -//----------------------------------------------------------------------------// -// Check if the given node is a biped bone // -//----------------------------------------------------------------------------// -BOOL Helper::IsBipedBone(INode *pNode) -{ - // check for invalid and root nodes - if((pNode == 0) || pNode->IsRootNode()) return false; - - // check for biped nodes - Control *pControl; - pControl = pNode->GetTMController(); - if((pControl->ClassID() == BIPSLAVE_CONTROL_CLASS_ID) || (pControl->ClassID() == BIPBODY_CONTROL_CLASS_ID)) return true; - - return false; -} - -//----------------------------------------------------------------------------// -// Check if the given node is a bone // -//----------------------------------------------------------------------------// -BOOL Helper::IsBone (INode *pNode, BOOL bAllowDummy) -{ - // check for invalid nodes - if(pNode == 0) return false; - - // check for root node - if(pNode->IsRootNode()) return false; - - // check for bone node - ObjectState os; - os = pNode->EvalWorldState(0); - if(os.obj->ClassID() == Class_ID(BONE_CLASS_ID, 0)) return true; - if(os.obj->ClassID() == BONE_OBJ_CLASSID) return true; - if(os.obj->ClassID() == Class_ID(DUMMY_CLASS_ID, 0)) - return bAllowDummy; - - // check for biped node - Control *pControl; - pControl = pNode->GetTMController(); - if((pControl->ClassID() == BIPSLAVE_CONTROL_CLASS_ID) || (pControl->ClassID() == BIPBODY_CONTROL_CLASS_ID)) return true; - return false; -} - -//----------------------------------------------------------------------------// -// Check if the given node is a mesh // -//----------------------------------------------------------------------------// -BOOL Helper::IsMesh(INode *pNode) -{ - // check for invalid and root nodes - if((pNode == 0) || pNode->IsRootNode()) return false; - - // check for mesh - ObjectState os; - os = pNode->EvalWorldState(0); - if(os.obj->SuperClassID() == GEOMOBJECT_CLASS_ID) return true; - - return false; -} - -//----------------------------------------------------------------------------// -// Set/Unset biped uniform scale // -//----------------------------------------------------------------------------// - -void Helper::SetBipedUniform(INode *pNode, BOOL bUniform, BOOL bFigure) -{ - if(IsBipedBone(pNode)){ - // get the TM controller of the node - Control *pControl; - pControl = pNode->GetTMController(); - - // get the biped export interface - IBipedExport *pBipedExport; - pBipedExport = (IBipedExport *)pControl->GetInterface(I_BIPINTERFACE); - - // remove/add uniform scale - pBipedExport->RemoveNonUniformScale (bUniform); - if (bFigure) pBipedExport->BeginFigureMode (0); - else pBipedExport->EndFigureMode (0); - - // notify all dependents - Control *pMasterControl; - pMasterControl = (Control *)pControl->GetInterface(I_MASTER); - pMasterControl->NotifyDependents(FOREVER, PART_TM, REFMSG_CHANGE); - pControl->ReleaseInterface(I_MASTER, pMasterControl); - - // release the biped export interface - pControl->ReleaseInterface(I_BIPINTERFACE, pBipedExport); - } -} diff --git a/cs/engine/plugins/shared/Helper.h b/cs/engine/plugins/shared/Helper.h deleted file mode 100644 index c88edee1e..000000000 --- a/cs/engine/plugins/shared/Helper.h +++ /dev/null @@ -1,87 +0,0 @@ -//----------------------------------------------------------------------------// -// Helper.h // -// Copyright (C) 2001 Bruno 'Beosil' Heidelberger // -//----------------------------------------------------------------------------// -// This program is free software; you can redistribute it and/or modify it // -// under the terms of the GNU General Public License as published by the Free // -// Software Foundation; either version 2 of the License, or (at your option) // -// any later version. // -//----------------------------------------------------------------------------// - -#ifndef HELPER_H -#define HELPER_H - -//----------------------------------------------------------------------------// -// Defines // -//----------------------------------------------------------------------------// - -// this is the class for all biped controllers except the root and the footsteps -#define BIPSLAVE_CONTROL_CLASS_ID Class_ID(0x9154,0) -// this is the class for the center of mass, biped root controller ("Bip01") -#define BIPBODY_CONTROL_CLASS_ID Class_ID(0x9156,0) - -//----------------------------------------------------------------------------// -// Class declaration // -//----------------------------------------------------------------------------// - -class Helper -{ -// constructors/destructor -protected: - Helper (); - virtual ~Helper (); - -// member functions -public: - static Matrix3 GetBoneTM (INode *pNode, TimeValue t); - static BOOL IsBipedBone (INode *pNode); - static BOOL IsBone (INode *pNode, BOOL bAllowDummy); - static BOOL IsMesh (INode *pNode); - static void SetBipedUniform (INode *pNode, BOOL bUniform, BOOL bFigure); - static IC string ConvertSpace (string input) - { - string result = ""; - for (DWORD i=0; i; -using Shader_xrLCIt = Shader_xrLCVec::iterator; -class Shader_xrLC_LIB -{ - Shader_xrLCVec library; -public: - void Load (LPCSTR name) - { - IReader* fs = FS.r_open(name); - if(NULL==fs){ - string256 inf; - extern HWND logWindow; - sprintf (inf,"Build failed!\nCan't load shaders library: '%s'",name); -// clMsg (inf); -// MessageBox (logWindow,inf,"Error!",MB_OK|MB_ICONERROR); - FATAL (inf); - return; - }; - - int count = fs->length()/sizeof(Shader_xrLC); - R_ASSERT (int(fs->length()) == int(count*sizeof(Shader_xrLC))); - library.resize (count); - fs->r (&*library.begin(),fs->length()); - FS.r_close (fs); - } - bool Save (LPCSTR name) - { - IWriter* F = FS.w_open(name); - if (F){ - F->w (&*library.begin(),(u32)library.size()*sizeof(Shader_xrLC)); - FS.w_close (F); - return true; - }else{ - return false; - } - } - void Unload () - { - library.clear (); - } - u32 GetID (LPCSTR name) - { - for (Shader_xrLCIt it=library.begin(); it!=library.end(); it++) - if (0==stricmp(name,it->Name)) return u32(it-library.begin()); - return u32(-1); - } - Shader_xrLC* Get (LPCSTR name) - { - for (Shader_xrLCIt it=library.begin(); it!=library.end(); it++) - if (0==stricmp(name,it->Name)) return &(*it); - return NULL; - } - Shader_xrLC* Get (int id) - { - return &library[id]; - } - Shader_xrLC* Append (Shader_xrLC* parent=0) - { - library.push_back(parent?Shader_xrLC(*parent):Shader_xrLC()); - return &library.back(); - } - void Remove (LPCSTR name) - { - for (Shader_xrLCIt it=library.begin(); it!=library.end(); it++) - if (0==stricmp(name,it->Name)){ - library.erase(it); - break; - } - } - void Remove (int id) - { - library.erase(library.begin()+id); - } - Shader_xrLCVec& Library (){return library;} -}; -#endif diff --git a/cs/engine/plugins/shared/TexMaps.cpp b/cs/engine/plugins/shared/TexMaps.cpp deleted file mode 100644 index 391780032..000000000 --- a/cs/engine/plugins/shared/TexMaps.cpp +++ /dev/null @@ -1,273 +0,0 @@ -//----------------------------------------------------------------------------- -// Texmaps -//----------------------------------------------------------------------------- -#include "stdafx.h" -#pragma hdrstop - -#include "texmaps.h" -#include "XRayMtlRes.h" - -extern TCHAR *GetString(int id); - -#define MAX_TEXTURE_CHANNELS 32 - -#define TEXMAPS_CLASS_ID 0x001200 - -static Class_ID TexmapsClassID(TEXMAPS_CLASS_ID, 0); - -class OldTexmapsClassDesc:public ClassDesc { - public: - int IsPublic() { return 0; } - void * Create(BOOL loading) { return new Texmaps((MtlBase*)NULL); } - const TCHAR * ClassName() { return GetString(IDS_DS_CLASSTEXMAPS); } - SClass_ID SuperClassID() { return REF_MAKER_CLASS_ID; } - Class_ID ClassID() { return TexmapsClassID; } - const TCHAR* Category() { return _T(""); } - }; - - -class TexmapsClassDesc:public ClassDesc { - public: - int IsPublic() { return 0; } - void * Create(BOOL loading) { return new Texmaps((MtlBase*)NULL); } - const TCHAR * ClassName() { return GetString(IDS_DS_CLASSTEXMAPS); } - SClass_ID SuperClassID() { return TEXMAP_CONTAINER_CLASS_ID; } - Class_ID ClassID() { return TexmapsClassID; } - const TCHAR* Category() { return _T(""); } - }; - -TexmapSlot::TexmapSlot() { - amount = 1.0f; - map = NULL; - mapOn = FALSE; - amtCtrl=NULL; - } - -void TexmapSlot::Update(TimeValue t,Interval& ivalid) { - if (IsActive()) - map->Update(t,ivalid); - if (amtCtrl) { - amtCtrl->GetValue(t,&amount,ivalid); - } - } - -float TexmapSlot::GetAmount(TimeValue t) { - Interval v; - float f; - if (amtCtrl) { - amtCtrl->GetValue(t,&f,v); - return f; - } - else return amount; - } - -Texmaps::Texmaps() { - loadingOld = FALSE; - client = NULL; - } - - -Texmaps::Texmaps(MtlBase *mb) { - loadingOld = FALSE; - client = mb; - } - -SvGraphNodeReference Texmaps::SvTraverseAnimGraph(IGraphObjectManager *gom, Animatable *owner, int id, DWORD flags) - { - int i, nUsedSlots; - - if (!gom->TestFilter(SV_FILTER_MAPS)) - return SvGraphNodeReference(); - - nUsedSlots = 0; - for (i = 0; i < STD2_NMAX_TEXMAPS; i++) - if (txmap[i].map) - nUsedSlots++; - - if (nUsedSlots) - return SvStdTraverseAnimGraph(gom, owner, id, flags); - else - return SvGraphNodeReference(); - } - -static TexmapsClassDesc texmapsCD; -ClassDesc* GetTexmapsDesc() { return &texmapsCD; } - -static OldTexmapsClassDesc oldtexmapsCD; -ClassDesc* GetOldTexmapsDesc() { return &oldtexmapsCD; } - -Class_ID Texmaps::ClassID() { return TexmapsClassID; } - -int Texmaps::NumSubs() { return STD2_NMAX_TEXMAPS*2; } - -int Texmaps::NumRefs() { return STD2_NMAX_TEXMAPS*2; } - -Animatable* Texmaps::SubAnim(int i) { - if (i&1) - return txmap[i/2].map; - else - return txmap[i/2].amtCtrl; - } - -TSTR Texmaps::SubAnimName(int i) { - if (i&1) - return client->GetSubTexmapTVName(i/2); - else { - TSTR nm; -// nm = GetString(texNameID[i/2]); -// nm = textureChannelNames[ i/2 ]; - nm = txmap[ i/2 ].name; - nm += TSTR(" "); - nm += TSTR(GetString(IDS_DS_AMOUNT)); - return nm; - } - } - -RefTargetHandle Texmaps::GetReference(int i) { - if (i&1) - return txmap[i/2].map; - else - return txmap[i/2].amtCtrl; - } - -void Texmaps::SetReference(int i, RefTargetHandle rtarg) { - if (loadingOld) - txmap[i].map = (Texmap*)rtarg; - else { - if (i&1) - txmap[i/2].map = (Texmap*)rtarg; - else - txmap[i/2].amtCtrl = (Control*)rtarg; - } - } - -void Texmaps::DeleteThis() { xr_delete((Texmaps*)this);} - -RefResult Texmaps::NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget, - PartID& partID, RefMessage message ) { - switch (message) { - case REFMSG_GET_PARAM_DIM: { - GetParamDim *gpd = (GetParamDim*)partID; - gpd->dim = defaultDim; - break; - } - case REFMSG_GET_PARAM_NAME: { - GetParamName *gpn = (GetParamName*)partID; - return REF_STOP; - } - } - return(REF_SUCCEED); - } - -void Texmaps::RescaleWorldUnits(float f) { - if (TestAFlag(A_WORK1)) - return; - SetAFlag(A_WORK1); - // This code will be replaced in particular implementations - for (int i=0; iRescaleWorldUnits(f); - } - } - - } - -RefTargetHandle Texmaps::Clone(RemapDir &remap) { - Texmaps *tm = new Texmaps((MtlBase*)NULL); - for (int i = 0; itxmap[i].amount = txmap[i].amount; - tm->txmap[i].mapOn = txmap[i].mapOn; - tm->txmap[i].map = NULL; - if (txmap[i].amtCtrl) - tm->ReplaceReference(2*i,remap.CloneRef(txmap[i].amtCtrl)); - if (txmap[i].map) - tm->ReplaceReference(2*i+1,remap.CloneRef(txmap[i].map)); - } - BaseClone(this, tm, remap); - return tm; - } - -#define TEX_OLD_ONOFF_CHUNK 0x5002 -#define TEX_ONOFF_CHUNK 0x5003 -#define TEX_AMT0 0x5100 -#define TEX_AMT1 0x5101 -#define TEX_AMT2 0x5102 -#define TEX_AMT3 0x5103 -#define TEX_AMT4 0x5104 -#define TEX_AMT5 0x5105 -#define TEX_AMT6 0x5106 -#define TEX_AMT7 0x5107 -#define TEX_AMT8 0x5108 -#define TEX_AMT9 0x5109 -#define TEX_AMTA 0x510A -#define TEX_AMTB 0x510B -#define TEX_AMTC 0x510C -#define TEX_AMTD 0x510D -#define TEX_AMTE 0x510E -#define TEX_AMTF 0x510F - -IOResult Texmaps::Save(ISave *isave) { - isave->BeginChunk(TEX_ONOFF_CHUNK); - ULONG nb,f=0; - for ( int i=0; iWrite(&f,sizeof(f),&nb); - isave->EndChunk(); - - for ( i=0; iBeginChunk(TEX_AMT0+i); - isave->Write(&txmap[i].amount,sizeof(float),&nb); - isave->EndChunk(); - } - } - return IO_OK; - } - -class TexmapsPostLoad : public PostLoadCallback { - public: - Texmaps *tm; - TexmapsPostLoad(Texmaps *b) {tm=b;} - void proc(ILoad *iload) { tm->loadingOld = FALSE; xr_delete((TexmapsPostLoad*)this); } - }; - - -IOResult Texmaps::Load(ILoad *iload) { - ULONG nb; - int id; - IOResult res; - while (IO_OK==(res=iload->OpenChunk())) { - switch(id = iload->CurChunkID()) { - case TEX_OLD_ONOFF_CHUNK: - iload->SetObsolete(); - iload->RegisterPostLoadCallback(new TexmapsPostLoad(this)); - loadingOld = TRUE; - case TEX_ONOFF_CHUNK: - { - ULONG f; - res = iload->Read(&f,sizeof(f), &nb); - for (int i=0; iRead(&txmap[id-TEX_AMT0].amount,sizeof(float), &nb); - break; - } - iload->CloseChunk(); - if (res!=IO_OK) - return res; - } - return IO_OK; - - } diff --git a/cs/engine/plugins/shared/TexMaps.h b/cs/engine/plugins/shared/TexMaps.h deleted file mode 100644 index d703fff71..000000000 --- a/cs/engine/plugins/shared/TexMaps.h +++ /dev/null @@ -1,109 +0,0 @@ -//----------------------------------------------------------------------------- -// Texmaps -//----------------------------------------------------------------------------- - -#define MAPACTIVE(i) ((*maps)[i].IsActive()) -#define MAX_TEXTURE_CHANNELS 32 - - -class TexmapSlot { - public: - float amount; - Control *amtCtrl; // ref to controller - Texmap *map; // ref to map - BOOL mapOn; - TSTR name; - - TexmapSlot(); - RGBA Eval(ShadeContext& sc) { - return amount * map->EvalColor(sc); - } - float EvalMono(ShadeContext& sc) { - return amount * map->EvalMono(sc); - } - float LerpEvalMono(ShadeContext& sc, float v) { - if( amount<0.0f ){ - float b = 1.0f + amount; - if ( b < 0.0f ) b = 0.0f; - return -amount * (1.0f - map->EvalMono(sc)) + b*v; - } else { - float b = 1.0f - amount; - if ( b < 0.0f ) b = 0.0f; - return amount * map->EvalMono(sc) + b*v; - } -// float b = 1.0f - (amount<0.0f ? -amount : amount); -// if ( b < 0.0f ) b = 0.0f; -// return amount * map->EvalMono(sc) + b*v; - } - -// begin - ke/mjm - 03.16.00 - merge reshading code - float LerpMono( float origVal, float texVal ) // for reShading, no eval - { - if( amount<0.0f ) - { - float b = 1.0f + amount; - if ( b < 0.0f ) b = 0.0f; - return -amount * texVal + b * (1.0f - origVal); - } else { - float b = 1.0f - amount; - if ( b < 0.0f ) b = 0.0f; - return amount * texVal + b * origVal; - } - } -// end - ke/mjm - 03.16.00 - merge reshading code - - Point3 EvalNormalPerturb(ShadeContext &sc) { - return amount * map->EvalNormalPerturb(sc); - } - BOOL IsActive() { return (map&&mapOn&&(amtCtrl||amount!=0.0f)); } - void Update(TimeValue t, Interval &ivalid); - float GetAmount(TimeValue t); -}; - - -class Texmaps: public TexmapContainer { - public: - MtlBase *client; - TexmapSlot txmap[32]; - BOOL loadingOld; - - Texmaps(); - Texmaps(MtlBase *mb); - void SetClientPtr(MtlBase *mb) { client = mb; } - TexmapSlot& operator[](int i) { return txmap[i]; } - - Class_ID ClassID(); - - void DeleteThis(); - RefTargetHandle Clone(RemapDir &remap = NoRemap()); - RefResult NotifyRefChanged( Interval changeInt, RefTargetHandle hTarget, - PartID& partID, RefMessage message ); - - void RescaleWorldUnits(float f); - - BOOL AssignController(Animatable *control,int subAnim) { - ReplaceReference(SubNumToRefNum(subAnim),(ReferenceTarget *)control); - return TRUE; - } - - int NumSubs(); - Animatable* SubAnim(int i); - TSTR SubAnimName(int i); - int SubNumToRefNum(int subNum) {return subNum; } - BOOL InvisibleProperty() { return TRUE; } // maps are made visible in scripter by pb_maps paramblock in the material so don't expose them as a subanim - -// int NumRefs() { return STD2_NMAX_TEXMAPS*2; } - int NumRefs(); - RefTargetHandle GetReference(int i); - void SetReference(int i, RefTargetHandle rtarg); - - // IO - IOResult Save(ISave *isave); - IOResult Load(ILoad *iload); - - void SetName( long i, TSTR& nm ){txmap[i].name = nm; } - TSTR& GetName( long i ){return txmap[i].name; } - SvGraphNodeReference SvTraverseAnimGraph(IGraphObjectManager *gom, Animatable *owner, int id, DWORD flags); - }; - - diff --git a/cs/engine/plugins/shared/Vert.h b/cs/engine/plugins/shared/Vert.h deleted file mode 100644 index 7c383ff12..000000000 --- a/cs/engine/plugins/shared/Vert.h +++ /dev/null @@ -1,66 +0,0 @@ -#pragma once - -const u32 BONE_NONE = 0xffffffff; - -struct SVertexData{ - u32 bone; - float weight; - SVertexData (u32 b, float w):bone(b),weight(w){;} -}; -using VDVec = xr_vector; -using VDIt = VDVec::iterator; - -class CVertexDef -{ -public: - Fvector P; - VDVec data; -public: - CVertexDef () {ZeroMemory(this,sizeof(this));} - void SetPosition (Point3 &p) {P.set(p.x,p.z,p.y);} - void Append (u32 bone, float weight) - { - data.push_back(SVertexData(bone,weight)); - } -}; -using VertexDefVec = xr_vector; -using VertexDefIt = VertexDefVec::iterator; - -struct st_VERT { - Fvector P; -// u32 sm_group; - Fvector2 uv; - VDVec data; -public: - st_VERT() - { - P.set (0,0,0); - uv.set (0.f,0.f); - } - void Set (const CVertexDef& D) - { - R_ASSERT (data.empty()); - data = D.data; - } - - void SetUV(float _u, float _v) - { - uv.x = _u; uv.y = _v; - } - BOOL similar(const st_VERT& V) const - { - if (data.size()!=V.data.size()) return FALSE; - if (!uv.similar (V.uv)) return FALSE; - if (!P.similar (V.P)) return FALSE; -// if ((0==sm_group)||(0==(sm_group&V.sm_group))) return FALSE; - for (u32 k=0; k; -using ExpVertIt = ExpVertVec::iterator; - diff --git a/cs/engine/plugins/shared/XRayMtlRes.h b/cs/engine/plugins/shared/XRayMtlRes.h deleted file mode 100644 index 5b5cb043e..000000000 --- a/cs/engine/plugins/shared/XRayMtlRes.h +++ /dev/null @@ -1,276 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by GameMaterial.rc -// -#define IDS_LIBDESCRIPTION 1 -#define IDS_CATEGORY 2 -#define IDS_CLASS_NAME 3 -#define IDS_PARAMS 4 -#define IDS_SPIN 5 -#define IDS_COMMENT 6 -#define IDS_MN_DIFFUSE 7 -#define IDS_MN_BRIGHTNESS 8 -#define IDS_MN_OPACITY 9 -#define IDS_MN_NONE 10 -#define IDS_COLOR 11 -#define IDS_PARAMCHG 12 -#define IDS_MN_DIFFUSE_I 13 -#define IDS_MN_BRIGHTNESS_I 14 -#define IDS_MN_OPACITY_I 15 -#define IDD_PANEL 101 -#define IDD_DMTL_EXTRA6 116 -#define IDB_DMTL_BUTTONS 122 -#define IDB_DMTL_MASKBUTTONS 123 -#define IDD_DMTL_SHADER4 125 -#define IDD_DMTL_TEXMAP4 145 -#define IDD_SHADER_SKEL1 148 -#define IDD_DMTL_SAMPLING3 151 -#define IDC_TF_EDIT 218 -#define IDC_IOR_EDIT 219 -#define IDC_TR_EDIT 220 -#define IDC_DIM_AMT 220 -#define IDC_WIRE_EDIT 221 -#define IDC_DIM_MULT 222 -#define IDC_TF_SPIN 328 -#define IDC_IOR_SPIN 329 -#define IDC_TR_SPIN 330 -#define IDC_DIM_AMTSPIN 330 -#define IDC_DIM_MULTSPIN 331 -#define IDC_WIRE_SPIN 332 -#define IDC_CLOSEBUTTON 1000 -#define IDC_DOSTUFF 1000 -#define IDC_TR_SUB2 1001 -#define IDC_TR_SUB 1002 -#define IDC_TR_ADD 1003 -#define IDC_CSHADER1 1003 -#define IDC_MAPON_TR 1038 -#define IDC_PIXELS 1043 -#define IDC_UNITS 1044 -#define IDC_WIRE 1048 -#define IDD_DMTL_DYNAM 1057 -#define IDD_DMTL_XRAY 1058 -#define IDC_FACE_MAP 1059 -#define IDC_FACETED 1060 -#define IDC_HIGHLIGHT 1062 -#define IDC_2SIDE 1067 -#define IDC_SUPER_SAMP 1068 -#define IDC_ADAPT_ON 1069 -#define IDC_SAMPLE_TEX 1070 -#define IDC_MAPON_FI 1107 -#define IDC_BOUNCE_EDIT 1193 -#define IDC_BOUNCE_SPIN 1194 -#define IDC_STATFRIC_EDIT 1195 -#define IDC_STATFRIC_SPIN 1196 -#define IDC_SLIDFRIC_EDIT 1197 -#define IDC_SLIDFRIC_SPIN 1198 -#define IDC_DIM_REFL 1252 -#define IDC_TF_IN 1300 -#define IDC_TF_OUT 1301 -#define IDC_COLOR_NEW 1456 -#define IDC_EDIT 1490 -#define IDC_SPIN 1496 -#define IDC_SHADER 1728 -#define IDC_ESHADER 1729 -#define IDC_SAMPLEQUALITY_SPIN 1729 -#define IDC_SHADER2 1729 -#define IDC_CSHADER 1730 -#define IDC_SAMPLEQUALITY_EDIT 1730 -#define IDC_PIX_SAMPLER 1731 -#define IDC_GAMEMTL 1731 -#define IDC_THRESHOLD_EDIT 1732 -#define IDC_THRESHOLD_SPIN 1733 -#define IDC_PARAM0_EDIT 1734 -#define IDC_PARAM0_SPIN 1735 -#define IDC_PARAM1_EDIT 1736 -#define IDC_FILTER_CS 1736 -#define IDC_USEMAP_0 1737 -#define IDC_PARAM1_SPIN 1737 -#define IDC_AMTEDIT_0 1738 -#define IDC_AMTSPIN_0 1739 -#define IDC_MAP_0 1740 -#define IDC_USEMAP_1 1741 -#define IDC_AMTEDIT_1 1742 -#define IDC_AMTSPIN_1 1743 -#define IDC_MAP_1 1744 -#define IDC_USEMAP_2 1745 -#define IDC_AMTEDIT_2 1746 -#define IDC_AMTSPIN_2 1747 -#define IDC_MAP_2 1748 -#define IDC_USEMAP_3 1749 -#define IDC_AMTEDIT_3 1750 -#define IDC_AMTSPIN_3 1751 -#define IDC_MAP_3 1752 -#define IDC_USEMAP_4 1753 -#define IDC_AMTEDIT_4 1754 -#define IDC_AMTSPIN_4 1755 -#define IDC_MAP_4 1756 -#define IDC_USEMAP_5 1757 -#define IDC_AMTEDIT_5 1758 -#define IDC_AMTSPIN_5 1759 -#define IDC_MAP_5 1760 -#define IDC_USEMAP_6 1761 -#define IDC_AMTEDIT_6 1762 -#define IDC_AMTSPIN_6 1763 -#define IDC_MAP_6 1764 -#define IDC_USEMAP_7 1765 -#define IDC_AMTEDIT_7 1766 -#define IDC_AMTSPIN_7 1767 -#define IDC_MAP_7 1768 -#define IDC_USEMAP_8 1769 -#define IDC_AMTEDIT_8 1770 -#define IDC_AMTSPIN_8 1771 -#define IDC_MAP_8 1772 -#define IDC_USEMAP_9 1773 -#define IDC_AMTEDIT_9 1774 -#define IDC_AMTSPIN_9 1775 -#define IDC_MAP_9 1776 -#define IDC_USEMAP_10 1777 -#define IDC_AMTEDIT_10 1778 -#define IDC_AMTSPIN_10 1779 -#define IDC_MAP_10 1780 -#define IDC_USEMAP_11 1781 -#define IDC_AMTEDIT_11 1782 -#define IDC_AMTSPIN_11 1783 -#define IDC_MAP_11 1784 -#define IDC_LOCK_TEX01 1785 -#define IDC_USEMAP_12 1786 -#define IDC_AMTEDIT_12 1787 -#define IDC_USEMAP_13 1788 -#define IDC_AMTEDIT_13 1789 -#define IDC_USEMAP_14 1790 -#define IDC_AMTEDIT_14 1791 -#define IDC_AMTSPIN_12 1792 -#define IDC_AMTSPIN_13 1793 -#define IDC_AMTSPIN_14 1794 -#define IDC_MAP_12 1795 -#define IDC_MAP_13 1796 -#define IDC_MAP_14 1797 -#define IDC_USEMAP_15 1798 -#define IDC_AMTEDIT_15 1799 -#define IDC_AMTSPIN_15 1800 -#define IDC_MAP_15 1801 -#define IDC_USEMAP_16 1802 -#define IDC_AMTEDIT_16 1803 -#define IDC_AMTSPIN_16 1804 -#define IDC_MAP_16 1805 -#define IDC_USEMAP_17 1806 -#define IDC_BR_EDIT 1807 -#define IDC_AMTEDIT_17 1807 -#define IDC_BR_SPIN 1808 -#define IDC_AMTSPIN_17 1808 -#define IDC_MAPON_BR 1809 -#define IDC_MAP_17 1809 -#define IDC_USEMAP_18 1810 -#define IDC_AMTEDIT_18 1811 -#define IDC_AMTSPIN_18 1812 -#define IDC_MAP_18 1813 -#define IDC_MAPON_CLR 1814 -#define IDC_USEMAP_19 1814 -#define IDC_AMTEDIT_19 1815 -#define IDC_AMTSPIN_19 1816 -#define IDC_MAP_19 1817 -#define IDC_USEMAP_20 1818 -#define IDC_AMTEDIT_20 1819 -#define IDC_AMTSPIN_20 1820 -#define IDC_MAP_20 1821 -#define IDC_USEMAP_21 1822 -#define IDC_AMTEDIT_21 1823 -#define IDC_AMTSPIN_21 1824 -#define IDC_MAP_21 1825 -#define IDC_USEMAP_22 1826 -#define IDC_AMTEDIT_22 1827 -#define IDC_AMTSPIN_22 1828 -#define IDC_MAP_22 1829 -#define IDC_USEMAP_23 1830 -#define IDC_AMTEDIT_23 1831 -#define IDC_AMTSPIN_23 1832 -#define IDC_MAP_23 1833 -#define IDC_ADAPT_STATIC 1861 -#define IDC_ADVANCED_BUTTON 1862 -#define IDC_OPAC_TEXT1 1865 -#define IDC_OPAC_TEXT2 1866 -#define IDC_REFR_TEXT1 1867 -#define IDC_OPAC_TEXT3 1868 -#define IDC_REFL_TEXT1 1869 -#define IDC_REFL_TEXT2 1870 -#define IDC_REFL_BOX 1871 -#define IDC_OPAC_BOX 1872 -#define IDC_FILTER_OVERLAY 1873 -#define IDC_COMMENT_BOX 1874 -#define IDC_QUALITY_TEXT 1875 -#define IDC_COMMENT_TEXT 1876 -#define IDC_PARAM0_TEXT 1877 -#define IDC_PARAM1_TEXT 1878 -#define IDS_DS_WIREFRAME 10049 -#define IDS_DS_SHIN_STR 10052 -#define IDS_DS_OPACITY 10053 -#define IDS_JW_SHADERTYPE 10057 -#define IDS_DS_EXTRA 10059 -#define IDS_DS_TEXMAP 10060 -#define IDS_JW_MAPENABLES 10064 -#define IDS_DS_BU 10067 -#define IDS_DS_RL 10068 -#define IDS_DS_RR 10069 -#define IDS_DS_TEXMAPS 10070 -#define IDS_DS_FILTER 10071 -#define IDS_DS_WIRESZ 10114 -#define IDS_DS_IOR 10115 -#define IDS_JW_MAPS 10127 -#define IDS_JW_MAPAMOUNTS 10128 -#define IDS_JW_ENABLE 10133 -#define IDS_JW_AMOUNT 10134 -#define IDS_JW_SHADERBYNAME 10139 -#define IDS_JW_SAMPLERBYNAME 10140 -#define IDS_DS_AMOUNT 11442 -#define IDS_JW_GAMEMTLTYPE 11443 -#define IDS_JW_GAMEMTLBYNAME 11444 -#define IDS_DS_CLASSTEXMAPS 11471 -#define IDS_DS_DYNAMICS 11484 -#define IDS_DS_BOUNCE 11485 -#define IDS_DS_STATFRIC 11486 -#define IDS_DS_SLIDFRIC 11487 -#define IDS_DS_FALLOFF 11495 -#define IDS_DS_DIMLEV 11514 -#define IDS_DS_DIMMULT 11515 -#define IDS_DS_DP 11530 -#define IDS_KE_STANDARD2 11534 -#define IDS_KE_SHADER 11535 -#define IDS_KE_SAMPLING 11536 -#define IDS_KE_XRAY 11537 -#define IDS_KE_NONE 11547 -#define IDS_JW_TWOSIDED 11585 -#define IDS_JW_FACEMAP 11586 -#define IDS_JW_OPACITYTYPE 11587 -#define IDS_JW_FILTERMAP 11588 -#define IDS_JW_FALLOFFTYPE 11589 -#define IDS_JW_WIREUNITS 11590 -#define IDS_JW_APPLYREFDIM 11591 -#define IDS_JW_PIXELSAMPLER 11592 -#define IDS_JW_SAMPLERQUAL 11593 -#define IDS_JW_SAMPLERENABLE 11594 -#define IDS_KE_STANDARD2_CDESC 11600 -#define IDS_JW_ADTEXLOCK 11620 -#define IDS_KE_FACETED 11672 -#define IDS_STRING_1 11673 -#define IDS_JW_ESHADERTYPE 11673 -#define IDS_STRING_2 11674 -#define IDS_JW_CSHADERTYPE 11674 -#define IDS_KE_SAMPLERADAPTTHRESH 11675 -#define IDS_KE_SAMPLERADAPTON 11676 -#define IDS_KE_SAMPLERADVANCED 11677 -#define IDS_JW_ESHADERBYNAME 11678 -#define IDS_JW_CSHADERBYNAME 11679 -#define IDS_KE_SUBSAMPLE_TEX_ON 11683 -#define IDS_KE_SAMPLER_PARAM0 11696 -#define IDS_KE_SAMPLER_PARAM1 11697 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 102 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1004 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/cs/engine/plugins/shared/bone.cpp b/cs/engine/plugins/shared/bone.cpp deleted file mode 100644 index fb734a25b..000000000 --- a/cs/engine/plugins/shared/bone.cpp +++ /dev/null @@ -1,189 +0,0 @@ -#include "stdafx.h" -#pragma hdrstop - -#include "bone.h" -#include "envelope.h" - -#define BONE_VERSION 0x0002 -//------------------------------------------------------------------------------ -#define BONE_CHUNK_VERSION 0x0001 -#define BONE_CHUNK_DEF 0x0002 -#define BONE_CHUNK_BIND_POSE 0x0003 -#define BONE_CHUNK_MATERIAL 0x0004 -#define BONE_CHUNK_SHAPE 0x0005 -#define BONE_CHUNK_IK_JOINT 0x0006 -#define BONE_CHUNK_MASS 0x0007 -#define BONE_CHUNK_FLAGS 0x0008 -#define BONE_CHUNK_IK_JOINT_BREAK 0x0009 -#define BONE_CHUNK_IK_JOINT_FRICTION 0x0010 - -CBone::CBone() -{ - flags.zero (); - rest_length = 0; - SelfID = -1; - parent = 0; - - ResetData (); -} - -CBone::~CBone() -{ -} - -void CBone::ResetData() -{ - IK_data.Reset (); - game_mtl = "default_object"; - shape.Reset (); - - mass = 10.f;; - center_of_mass.set(0.f,0.f,0.f); -} - -void CBone::Save(IWriter& F) -{ -#ifdef _LW_EXPORT - extern void ReplaceSpaceAndLowerCase(shared_str& s); - ReplaceSpaceAndLowerCase(name); - ReplaceSpaceAndLowerCase(parent_name); -#endif - F.open_chunk (BONE_CHUNK_VERSION); - F.w_u16 (BONE_VERSION); - F.close_chunk (); - - F.open_chunk (BONE_CHUNK_DEF); - F.w_stringZ (name); - F.w_stringZ (parent_name); - F.w_stringZ (wmap); - F.close_chunk (); - - F.open_chunk (BONE_CHUNK_BIND_POSE); - F.w_fvector3 (rest_offset); - F.w_fvector3 (rest_rotate); - F.w_float (rest_length); - F.close_chunk (); - - SaveData (F); -} - -void CBone::Load_0(IReader& F) -{ - F.r_stringZ (name); xr_strlwr(name); - F.r_stringZ (parent_name); xr_strlwr(parent_name); - F.r_stringZ (wmap); - F.r_fvector3 (rest_offset); - F.r_fvector3 (rest_rotate); - rest_length = F.r_float(); - std::swap (rest_rotate.x,rest_rotate.y); - Reset (); -} - -void CBone::Load_1(IReader& F) -{ - R_ASSERT(F.find_chunk(BONE_CHUNK_VERSION)); - u16 ver = F.r_u16(); - - if ((ver!=0x0001)&&(ver!=BONE_VERSION)) - return; - - R_ASSERT(F.find_chunk(BONE_CHUNK_DEF)); - F.r_stringZ (name); xr_strlwr(name); - F.r_stringZ (parent_name); xr_strlwr(parent_name); - F.r_stringZ (wmap); - - R_ASSERT(F.find_chunk(BONE_CHUNK_BIND_POSE)); - F.r_fvector3 (rest_offset); - F.r_fvector3 (rest_rotate); - rest_length = F.r_float(); - - if (ver==0x0001) - std::swap (rest_rotate.x,rest_rotate.y); - - LoadData (F); -} - -void CBone::SaveData(IWriter& F) -{ - F.open_chunk (BONE_CHUNK_DEF); - F.w_stringZ (name); - F.close_chunk (); - - F.open_chunk (BONE_CHUNK_MATERIAL); - F.w_stringZ (game_mtl); - F.close_chunk (); - - F.open_chunk (BONE_CHUNK_SHAPE); - F.w (&shape,sizeof(SBoneShape)); - F.close_chunk (); - - F.open_chunk (BONE_CHUNK_FLAGS); - F.w_u32 (IK_data.ik_flags.get()); - F.close_chunk (); - - F.open_chunk (BONE_CHUNK_IK_JOINT); - F.w_u32 (IK_data.type); - F.w (IK_data.limits,sizeof(SJointLimit)*3); - F.w_float (IK_data.spring_factor); - F.w_float (IK_data.damping_factor); - F.close_chunk (); - - F.open_chunk (BONE_CHUNK_IK_JOINT_BREAK); - F.w_float (IK_data.break_force); - F.w_float (IK_data.break_torque); - F.close_chunk (); - - F.open_chunk (BONE_CHUNK_IK_JOINT_FRICTION); - F.w_float (IK_data.friction); - F.close_chunk (); - - F.open_chunk (BONE_CHUNK_MASS); - F.w_float (mass); - F.w_fvector3 (center_of_mass); - F.close_chunk (); -} - -void CBone::LoadData(IReader& F) -{ - R_ASSERT(F.find_chunk(BONE_CHUNK_DEF)); - F.r_stringZ (name); xr_strlwr(name); - - R_ASSERT(F.find_chunk(BONE_CHUNK_MATERIAL)); - F.r_stringZ (game_mtl); - - R_ASSERT(F.find_chunk(BONE_CHUNK_SHAPE)); - F.r (&shape,sizeof(SBoneShape)); - - if (F.find_chunk(BONE_CHUNK_FLAGS)) - IK_data.ik_flags.assign(F.r_u32()); - - R_ASSERT(F.find_chunk(BONE_CHUNK_IK_JOINT)); - IK_data.type = (EJointType)F.r_u32(); - F.r (IK_data.limits,sizeof(SJointLimit)*3); - IK_data.spring_factor = F.r_float(); - IK_data.damping_factor = F.r_float(); - - if (F.find_chunk(BONE_CHUNK_IK_JOINT_BREAK)){ - IK_data.break_force = F.r_float(); - IK_data.break_torque= F.r_float(); - } - - if (F.find_chunk(BONE_CHUNK_IK_JOINT_FRICTION)){ - IK_data.friction = F.r_float(); - } - - if (F.find_chunk(BONE_CHUNK_MASS)){ - mass = F.r_float(); - F.r_fvector3(center_of_mass); - } -} - -void CBone::CopyData(CBone* bone) -{ - game_mtl = bone->game_mtl; - shape = bone->shape; - IK_data = bone->IK_data; - mass = bone->mass; - center_of_mass = bone->center_of_mass; -} - diff --git a/cs/engine/plugins/shared/bone.h b/cs/engine/plugins/shared/bone.h deleted file mode 100644 index c55185964..000000000 --- a/cs/engine/plugins/shared/bone.h +++ /dev/null @@ -1,258 +0,0 @@ -//---------------------------------------------------- -#ifndef BoneH -#define BoneH - -#ifdef _LW_EXPORT -#include -#include -#endif - -// refs -class CBone; - -const u16 BI_NONE = u16(-1); - -#define OGF_IKDATA_VERSION 0x0001 - -#pragma pack( push,1 ) -enum EJointType -{ - jtRigid, - jtCloth, - jtJoint, - jtWheel, - jtNone, - jtSlider, - jtForceU32 = u32(-1) -}; - -struct ECORE_API SJointLimit -{ - Fvector2 limit; - float spring_factor; - float damping_factor; - SJointLimit (){Reset();} - void Reset() - { - limit.set (0.f,0.f); - spring_factor = 1.f; - damping_factor = 1.f; - } -}; - -struct ECORE_API SBoneShape -{ - enum EShapeType - { - stNone, - stBox, - stSphere, - stCylinder, - stForceU32 = u16(-1) - }; - - enum EShapeFlags{ - sfNoPickable = (1<<0), // use only in RayPick - sfRemoveAfterBreak = (1<<1), - sfNoPhysics = (1<<2), - }; - - u16 type; // 2 - Flags16 flags; // 2 - Fobb box; // 15*4 - Fsphere sphere; // 4*4 - Fcylinder cylinder; // 8*4 - SBoneShape (){Reset();} - void Reset() - { - flags.zero (); - type = stNone; - box.invalidate(); - sphere.P.set(0.f,0.f,0.f); sphere.R = 0.f; - cylinder.invalidate(); - } - bool Valid(){ - switch (type){ - case stBox: return !fis_zero(box.m_halfsize.x)&&!fis_zero(box.m_halfsize.x)&&!fis_zero(box.m_halfsize.x); - case stSphere: return !fis_zero(sphere.R); - case stCylinder:return !fis_zero(cylinder.m_height)&&!fis_zero(cylinder.m_radius)&&!fis_zero(cylinder.m_direction.square_magnitude()); - }; - return true; - } -}; - -struct ECORE_API SJointIKData -{ - // IK - EJointType type; - SJointLimit limits [3];// by [axis XYZ on joint] and[Z-wheel,X-steer on wheel] - float spring_factor; - float damping_factor; - enum{ - flBreakable = (1<<0), - }; - Flags32 ik_flags; - float break_force; // [0..+INF] - float break_torque; // [0..+INF] - - float friction; - - SJointIKData (){ Reset();} - void Reset () - { - limits[0].Reset (); - limits[1].Reset (); - limits[2].Reset (); - type = jtRigid; - spring_factor = 1.f; - damping_factor = 1.f; - ik_flags.zero (); - break_force = 0.f; - break_torque = 0.f; - } - void clamp_by_limits(Fvector& dest_xyz); - void Export(IWriter& F) - { - F.w_u32 (type); - for (int k=0; k<3; k++){ - // Kostya Slipchenko say: - // направление вращения в ОДЕ отличается от направления вращение в X-Ray - // поэтому меняем знак у лимитов - F.w_float (_min(-limits[k].limit.x,-limits[k].limit.y)); // min (swap special for ODE) - F.w_float (_max(-limits[k].limit.x,-limits[k].limit.y)); // max (swap special for ODE) - F.w_float (limits[k].spring_factor); - F.w_float (limits[k].damping_factor); - } - F.w_float (spring_factor); - F.w_float (damping_factor); - - F.w_u32 (ik_flags.get()); - F.w_float (break_force); - F.w_float (break_torque); - - F.w_float (friction); - } - bool Import(IReader& F, u16 vers) - { - type = (EJointType)F.r_u32(); - F.r (limits,sizeof(SJointLimit)*3); - spring_factor = F.r_float(); - damping_factor = F.r_float(); - ik_flags.flags = F.r_u32(); - break_force = F.r_float(); - break_torque = F.r_float(); - if (vers>0){ - friction = F.r_float(); - } - return true; - } -}; -#pragma pack( pop ) - -// refs -class CBone; -using BoneVec = xr_vector; -using BoneIt = BoneVec::iterator; - -class ECORE_API CBone -{ - shared_str name; - shared_str parent_name; - shared_str wmap; - Fvector rest_offset; - Fvector rest_rotate; // XYZ format (Game format) - float rest_length; - - Fvector mot_offset; - Fvector mot_rotate; // XYZ format (Game format) - float mot_length; - - Fmatrix mot_transform; - - Fmatrix rest_transform; - Fmatrix rest_i_transform; - - Fmatrix last_transform; - - Fmatrix render_transform; -public: - int SelfID; - CBone* parent; - BoneVec children; -public: - // editor part - Flags8 flags; - enum{ - flSelected = (1<<0), - }; - SJointIKData IK_data; - shared_str game_mtl; - SBoneShape shape; - - float mass; - Fvector center_of_mass; -public: - CBone (); - virtual ~CBone (); - - void SetName (const char* p){name = p; xr_strlwr(name); } - void SetParentName (const char* p){parent_name = p; xr_strlwr(parent_name);} - void SetWMap (const char* p){wmap = p;} - void SetRestParams (float length, const Fvector& offset, const Fvector& rotate){rest_offset.set(offset);rest_rotate.set(rotate);rest_length=length;}; - - shared_str Name (){return name;} - shared_str ParentName (){return parent_name;} - shared_str WMap (){return wmap;} - IC CBone* Parent (){return parent;} - IC BOOL IsRoot (){return (parent==0);} - - // transformation - const Fvector& _Offset (){return mot_offset;} - const Fvector& _Rotate (){return mot_rotate;} - float _Length (){return mot_length;} - IC Fmatrix& _RTransform (){return rest_transform;} - IC Fmatrix& _RITransform (){return rest_i_transform;} - IC Fmatrix& _MTransform (){return mot_transform;} - IC Fmatrix& _LTransform (){return last_transform;} - IC Fmatrix& _RenderTransform(){return render_transform;} - IC Fvector& _RestOffset (){return rest_offset;} - IC Fvector& _RestRotate (){return rest_rotate;} - - void _Update (const Fvector& T, const Fvector& R){mot_offset.set(T); mot_rotate.set(R); mot_length=rest_length;} - void Reset (){mot_offset.set(rest_offset); mot_rotate.set(rest_rotate); mot_length=rest_length;} - - // IO - void Save (IWriter& F); - void Load_0 (IReader& F); - void Load_1 (IReader& F); - -#ifdef _LW_EXPORT - void ParseBone (LWItemID bone); -#endif - - void SaveData (IWriter& F); - void LoadData (IReader& F); - void ResetData (); - void CopyData (CBone* bone); - -#ifdef _EDITOR - void ShapeScale (const Fvector& amount); - void ShapeRotate (const Fvector& amount); - void ShapeMove (const Fvector& amount); - void BindRotate (const Fvector& amount); - void BindMove (const Fvector& amount); - void BoneMove (const Fvector& amount); - void BoneRotate (const Fvector& axis, float angle); - - bool Pick (float& dist, const Fvector& S, const Fvector& D, const Fmatrix& parent); - - void Select (BOOL flag) { flags.set(flSelected,flag); } - bool Selected (){return flags.is(flSelected);} - - void ClampByLimits (); - - bool ExportOGF (IWriter& F); -#endif -}; - -#endif diff --git a/cs/engine/plugins/shared/envelope.h b/cs/engine/plugins/shared/envelope.h deleted file mode 100644 index 4e3d30fc6..000000000 --- a/cs/engine/plugins/shared/envelope.h +++ /dev/null @@ -1,141 +0,0 @@ -#ifndef EnvelopeH -#define EnvelopeH - -// refs -class IWriter; -class IReader; - -/* -====================================================================== -envelope.h - - Definitions for local copies of LightWave envelopes. - - Ernie Wright 31 Aug 00 - - The LightWave plug-in SDK provides its own representation of LightWave - envelopes that plug-ins can use. These definitions are for standalone - programs that, for example, read scene or object files and must store - the envelopes. -====================================================================== */ - -#define SHAPE_TCB 0 -#define SHAPE_HERM 1 -#define SHAPE_BEZI 2 -#define SHAPE_LINE 3 -#define SHAPE_STEP 4 -#define SHAPE_BEZ2 5 - -#define BEH_RESET 0 -#define BEH_CONSTANT 1 -#define BEH_REPEAT 2 -#define BEH_OSCILLATE 3 -#define BEH_OFFSET 4 -#define BEH_LINEAR 5 - - -#pragma pack( push,1 ) -struct st_Key{ - enum{ - ktStepped = 1<<0, - }; - float value; - float time; - u8 shape; - float tension; - float continuity; - float bias; - float param[ 4 ]; - st_Key (){ZeroMemory(this,sizeof(st_Key));} - IC bool equal (const st_Key& tgt) - { - if (!fsimilar(value,tgt.value)) return false; - if (!fsimilar(shape,tgt.shape)) return false; - if (!fsimilar(tension,tgt.tension)) return false; - if (!fsimilar(continuity,tgt.continuity)) return false; - if (!fsimilar(bias,tgt.bias)) return false; - if (!fsimilar(param[0],tgt.param[0])) return false; - if (!fsimilar(param[1],tgt.param[1])) return false; - if (!fsimilar(param[2],tgt.param[2])) return false; - if (!fsimilar(param[3],tgt.param[3])) return false; - return true; - } - IC void Save (IWriter& F) - { - F.w_float (value); - F.w_float (time); - F.w_u8 (shape); - if (shape!=4){ // ! Stepped - F.w_float_q16(tension,-32.f,32.f); - F.w_float_q16(continuity,-32.f,32.f); - F.w_float_q16(bias,-32.f,32.f); - F.w_float_q16(param[0],-32.f,32.f); - F.w_float_q16(param[1],-32.f,32.f); - F.w_float_q16(param[2],-32.f,32.f); - F.w_float_q16(param[3],-32.f,32.f); - } - } - IC void Load_1 (IReader& F) - { - value = F.r_float(); - time = F.r_float(); - shape = u8((u8)F.r_u32()&0xff); - tension = F.r_float(); - continuity = F.r_float(); - bias = F.r_float(); - F.r (¶m,sizeof(float)*4); - } - IC void Load_2 (IReader& F) - { - value = F.r_float(); - time = F.r_float(); - shape = F.r_u8(); - if (shape!=4){ // ! Stepped - tension = F.r_float_q16(-32.f,32.f); - continuity = F.r_float_q16(-32.f,32.f); - bias = F.r_float_q16(-32.f,32.f); - param[0] = F.r_float_q16(-32.f,32.f); - param[1] = F.r_float_q16(-32.f,32.f); - param[2] = F.r_float_q16(-32.f,32.f); - param[3] = F.r_float_q16(-32.f,32.f); - } - } -}; -#pragma pack( pop ) - -using KeyVec = xr_vector; -using KeyIt = KeyVec::iterator; - -// refs -class CExporter; - -class ENGINE_API CEnvelope { -public: - KeyVec keys; - int behavior[2]; -public: - CEnvelope (){behavior[0]=1;behavior[1]=1;} - CEnvelope (CEnvelope* source); - virtual ~CEnvelope (); - - float Evaluate (float t); - - void Save (IWriter& F); - void Load_1 (IReader& F); - void Load_2 (IReader& F); - void SaveA (IWriter& F); - void LoadA (IReader& F); - - void RotateKeys (float angle); - - KeyIt FindKey (float t, float eps); - void FindNearestKey(float t, KeyIt& min, KeyIt& max, float eps); - void InsertKey (float t, float val); - void DeleteKey (float t); - BOOL ScaleKeys (float from_time, float to_time, float scale_factor, float eps); - float GetLength (float* mn, float* mx); - - void Optimize (); -}; - -#endif //_ENVELOPE_H_ diff --git a/cs/engine/plugins/shared/interp.cpp b/cs/engine/plugins/shared/interp.cpp deleted file mode 100644 index 4af1ee0a6..000000000 --- a/cs/engine/plugins/shared/interp.cpp +++ /dev/null @@ -1,346 +0,0 @@ -//====================================================================== -//interp.c -// -//Interpolation (and extrapolation) of LightWave envelopes. -// -//Ernie Wright 16 Nov 00 -// -//The LightWave plug-in SDK provides functions for evaluating envelopes -//and channels at arbitrary times, which is what plug-ins should use. -//This code shows how to evaluate envelopes in standalone programs. -//====================================================================== - -#include "stdafx.h" -#pragma hdrstop - -#include "envelope.h" - -//====================================================================== -//range() -// -//Given the value v of a periodic function, returns the equivalent value -//v2 in the principal interval [lo, hi]. If i isn't NULL, it receives -//the number of wavelengths between v and v2. -// -// v2 = v - i * (hi - lo) -// -//For example, range( 3 pi, 0, 2 pi, i ) returns pi, with i = 1. -//====================================================================== -static float range( float v, float lo, float hi, int *i ){ - float v2, r = hi - lo; - if ( r == 0.0 ){ - if ( i ) *i = 0; - return lo; - } - v2 = lo + v - r * ( float ) floor(( float ) v / r ); - if ( i ) *i = -( int )(( v2 - v ) / r + ( v2 > v ? 0.5 : -0.5 )); - return v2; -} - - -//====================================================================== -//hermite() -// -//Calculate the Hermite coefficients. -//====================================================================== -static void hermite( float t, float *h1, float *h2, float *h3, float *h4 ){ - float t2, t3; - - t2 = t * t; - t3 = t * t2; - - *h2 = 3.0f * t2 - t3 - t3; - *h1 = 1.0f - *h2; - *h4 = t3 - t2; - *h3 = *h4 - t2 + t; -} - - -//====================================================================== -//bezier() -// -//Interpolate the value of a 1D Bezier curve. -//====================================================================== -static float bezier( float x0, float x1, float x2, float x3, float t ){ - float a, b, c, t2, t3; - - t2 = t * t; - t3 = t2 * t; - - c = 3.0f * ( x1 - x0 ); - b = 3.0f * ( x2 - x1 ) - c; - a = x3 - x0 - c - b; - - return a * t3 + b * t2 + c * t + x0; -} - - -//====================================================================== -//bez2_time() -// -//Find the t for which bezier() returns the input time. The handle -//endpoints of a BEZ2 curve represent the control points, and these have -//(time, value) coordinates, so time is used as both a coordinate and a -//parameter for this curve type. -//====================================================================== -static float bez2_time( float x0, float x1, float x2, float x3, float time, float *t0, float *t1 ){ - float v, t; - - t = *t0 + ( *t1 - *t0 ) * 0.5f; - v = bezier( x0, x1, x2, x3, t ); - if ( _abs( time - v ) > .0001f ) { - if ( v > time ) - *t1 = t; - else - *t0 = t; - return bez2_time( x0, x1, x2, x3, time, t0, t1 ); - } - else - return t; -} - - -//====================================================================== -//bez2() -// -//Interpolate the value of a BEZ2 curve. -//====================================================================== -static float bez2( st_Key *key0, st_Key *key1, float time ){ - float x, y, t, t0 = 0.0f, t1 = 1.0f; - - if ( key0->shape == SHAPE_BEZ2 ) - x = key0->time + key0->param[ 2 ]; - else - x = key0->time + ( key1->time - key0->time ) / 3.0f; - - t = bez2_time( key0->time, x, key1->time + key1->param[ 0 ], key1->time, - time, &t0, &t1 ); - - if ( key0->shape == SHAPE_BEZ2 ) - y = key0->value + key0->param[ 3 ]; - else - y = key0->value + key0->param[ 1 ] / 3.0f; - - return bezier( key0->value, y, key1->param[ 1 ] + key1->value, key1->value, t ); -} - - -//====================================================================== -//outgoing() -// -//Return the outgoing tangent to the curve at key0. The value returned -//for the BEZ2 case is used when extrapolating a linear pre behavior and -//when interpolating a non-BEZ2 span. -//====================================================================== -static float outgoing( st_Key *key0p, st_Key *key0, st_Key *key1 ){ - float a, b, d, t, out; - - switch ( key0->shape ){ - case SHAPE_TCB: - a = ( 1.0f - key0->tension ) * ( 1.0f + key0->continuity ) * ( 1.0f + key0->bias ); - b = ( 1.0f - key0->tension ) * ( 1.0f - key0->continuity ) * ( 1.0f - key0->bias ); - d = key1->value - key0->value; - - if ( key0p ) { - t = ( key1->time - key0->time ) / ( key1->time - key0p->time ); - out = t * ( a * ( key0->value - key0p->value ) + b * d ); - }else - out = b * d; - break; - - case SHAPE_LINE: - d = key1->value - key0->value; - if ( key0p ) { - t = ( key1->time - key0->time ) / ( key1->time - key0p->time ); - out = t * ( key0->value - key0p->value + d ); - } - else - out = d; - break; - - case SHAPE_BEZI: - case SHAPE_HERM: - out = key0->param[ 1 ]; - if ( key0p ) - out *= ( key1->time - key0->time ) / ( key1->time - key0p->time ); - break; - - case SHAPE_BEZ2: - out = key0->param[ 3 ] * ( key1->time - key0->time ); - if ( _abs( key0->param[ 2 ] ) > 1e-5f ) - out /= key0->param[ 2 ]; - else - out *= 1e5f; - break; - - case SHAPE_STEP: - default: - out = 0.0f; - break; - } - - return out; -} - -//====================================================================== -//incoming() -// -//Return the incoming tangent to the curve at key1. The value returned -//for the BEZ2 case is used when extrapolating a linear post behavior. -//====================================================================== -static float incoming( st_Key *key0, st_Key *key1, st_Key *key1n ){ - float a, b, d, t, in; - - switch ( key1->shape ){ - case SHAPE_LINE: - d = key1->value - key0->value; - if ( key1n ) { - t = ( key1->time - key0->time ) / ( key1n->time - key0->time ); - in = t * ( key1n->value - key1->value + d ); - } - else - in = d; - break; - - case SHAPE_TCB: - a = ( 1.0f - key1->tension ) * ( 1.0f - key1->continuity ) * ( 1.0f + key1->bias ); - b = ( 1.0f - key1->tension ) * ( 1.0f + key1->continuity ) * ( 1.0f - key1->bias ); - d = key1->value - key0->value; - - if ( key1n ) { - t = ( key1->time - key0->time ) / ( key1n->time - key0->time ); - in = t * ( b * ( key1n->value - key1->value ) + a * d ); - } - else - in = a * d; - break; - - case SHAPE_BEZI: - case SHAPE_HERM: - in = key1->param[ 0 ]; - if ( key1n ) - in *= ( key1->time - key0->time ) / ( key1n->time - key0->time ); - break; - - case SHAPE_BEZ2: - in = key1->param[ 1 ] * ( key1->time - key0->time ); - if ( _abs( key1->param[ 0 ] ) > 1e-5f ) - in /= key1->param[ 0 ]; - else - in *= 1e5f; - break; - - case SHAPE_STEP: - default: - in = 0.0f; - break; - } - - return in; -} - - - -//====================================================================== -//evalEnvelope() -// -//Given a _list_ of keys and a time, returns the interpolated value of the -//envelope at that time. -//====================================================================== -float evalEnvelope( CEnvelope *env, float time ){ - st_Key *key0, *key1, *skey, *ekey, *skey_n, *ekey_p, *key0_p=0, *key1_n=0; - float t, h1, h2, h3, h4, in, out, offset = 0.0f; - int noff; - - - // if there's no key, the value is 0 - if ( env->keys.empty() ) return 0.0f; - - // if there's only one key, the value is constant - if ( env->keys.size() == 1 ) - return env->keys[0]->value; - - // find the first and last keys - int sz = env->keys.size(); - skey = env->keys[0]; - ekey = env->keys[sz-1]; - skey_n=env->keys[1]; - ekey_p=env->keys[sz-2]; - - // use pre-behavior if time is before first key time - if ( time < skey->time ){ - switch ( env->behavior[ 0 ] ){ - case BEH_RESET: return 0.0f; - case BEH_CONSTANT: return skey->value; - case BEH_REPEAT: - time = range( time, skey->time, ekey->time, NULL ); - break; - case BEH_OSCILLATE: - time = range( time, skey->time, ekey->time, &noff ); - if ( noff % 2 ) - time = ekey->time - skey->time - time; - break; - case BEH_OFFSET: - time = range( time, skey->time, ekey->time, &noff ); - offset = noff * ( ekey->value - skey->value ); - break; - case BEH_LINEAR: - out = outgoing( 0, skey, skey_n ) / ( skey_n->time - skey->time ); - return out * ( time - skey->time ) + skey->value; - } - } - // use post-behavior if time is after last key time - else if ( time > ekey->time ) { - switch ( env->behavior[ 1 ] ){ - case BEH_RESET: return 0.0f; - case BEH_CONSTANT: return ekey->value; - case BEH_REPEAT: - time = range( time, skey->time, ekey->time, NULL ); - break; - case BEH_OSCILLATE: - time = range( time, skey->time, ekey->time, &noff ); - if ( noff % 2 ) - time = ekey->time - skey->time - time; - break; - case BEH_OFFSET: - time = range( time, skey->time, ekey->time, &noff ); - offset = noff * ( ekey->value - skey->value ); - break; - case BEH_LINEAR: - in = incoming( ekey_p, ekey, 0 ) / ( ekey->time - ekey_p->time ); - return in * ( time - ekey->time ) + ekey->value; - } - } - // get the endpoints of the interval being evaluated - int k=0; - while (time>env->keys[k+1]->time) k++; - VERIFY((k+1)keys[k+1]; - key0 = env->keys[k]; - if (k>0) key0_p = env->keys[k-1]; - if ((k+2)keys[k+2]; - - // check for singularities first - if ( time == key0->time ) return key0->value + offset; - else if ( time == key1->time ) return key1->value + offset; - - // get interval length, time in [0, 1] - t = ( time - key0->time ) / ( key1->time - key0->time ); - - // interpolate - switch ( key1->shape ){ - case SHAPE_TCB: - case SHAPE_BEZI: - case SHAPE_HERM: - out = outgoing( key0_p, key0, key1 ); - in = incoming( key0, key1, key1_n ); - hermite( t, &h1, &h2, &h3, &h4 ); - return h1 * key0->value + h2 * key1->value + h3 * out + h4 * in + offset; - case SHAPE_BEZ2: return bez2( key0, key1, time ) + offset; - case SHAPE_LINE: return key0->value + t * ( key1->value - key0->value ) + offset; - case SHAPE_STEP: return key0->value + offset; - default: - return offset; - } -} diff --git a/cs/engine/plugins/shared/motion.cpp b/cs/engine/plugins/shared/motion.cpp deleted file mode 100644 index 5e01d2b26..000000000 --- a/cs/engine/plugins/shared/motion.cpp +++ /dev/null @@ -1,588 +0,0 @@ -#include "stdafx.h" -#pragma hdrstop - -#include "motion.h" -#include "envelope.h" - -#define EOBJ_OMOTION 0x1100 -#define EOBJ_SMOTION 0x1200 -#define EOBJ_OMOTION_VERSION 0x0005 -#define EOBJ_SMOTION_VERSION 0x0007 - -#ifdef _LW_EXPORT - extern void ReplaceSpaceAndLowerCase(shared_str& s); -#endif - - -//------------------------------------------------------------------------------------------ -// CCustomMotion -//------------------------------------------------------------------------------------------ -CCustomMotion::CCustomMotion() -{ - iFrameStart =0; - iFrameEnd =0; - fFPS =30.f; -} - -CCustomMotion::CCustomMotion(CCustomMotion* source){ - *this = *source; -} - -CCustomMotion::~CCustomMotion() -{ -} - -void CCustomMotion::Save(IWriter& F) -{ -#ifdef _LW_EXPORT - ReplaceSpaceAndLowerCase(name); -#endif - F.w_stringZ (name); - F.w_u32 (iFrameStart); - F.w_u32 (iFrameEnd); - F.w_float (fFPS); -} - -bool CCustomMotion::Load(IReader& F) -{ - F.r_stringZ (name); - iFrameStart = F.r_u32(); - iFrameEnd = F.r_u32(); - fFPS = F.r_float(); - return true; -} - -//------------------------------------------------------------------------------------------ -// Object Motion -//------------------------------------------------------------------------------------------ -COMotion::COMotion():CCustomMotion() -{ - mtype =mtObject; - for (int ch=0; chenvs[ch]); -} - -COMotion::~COMotion() -{ - Clear (); -} - -void COMotion::Clear() -{ - for (int ch=0; chEvaluate(t); - T.y = envs[ctPositionY]->Evaluate(t); - T.z = envs[ctPositionZ]->Evaluate(t); - - R.y = envs[ctRotationH]->Evaluate(t); - R.x = envs[ctRotationP]->Evaluate(t); - R.z = envs[ctRotationB]->Evaluate(t); -} - -void COMotion::SaveMotion(const char* buf){ - CMemoryWriter F; - F.open_chunk (EOBJ_OMOTION); - Save (F); - F.close_chunk (); - if (!F.save_to(buf)) - Log ("! Can't save object motion:",buf); -} - -bool COMotion::LoadMotion(const char* buf) -{ - destructor F(FS.r_open(buf)); - R_ASSERT(F().find_chunk(EOBJ_OMOTION)); - return Load (F()); -} - -void COMotion::Save(IWriter& F) -{ - CCustomMotion::Save(F); - F.w_u16 (EOBJ_OMOTION_VERSION); - for (int ch=0; chSave(F); -} - -bool COMotion::Load(IReader& F) -{ - CCustomMotion::Load(F); - u16 vers = F.r_u16(); - if (vers==0x0003){ - Clear (); - for (int ch=0; chLoad_1(F); - } - }else if (vers==0x0004){ - Clear (); - envs[ctPositionX] = new CEnvelope(); envs[ctPositionX]->Load_2(F); - envs[ctPositionY] = new CEnvelope(); envs[ctPositionY]->Load_2(F); - envs[ctPositionZ] = new CEnvelope(); envs[ctPositionZ]->Load_2(F); - envs[ctRotationP] = new CEnvelope(); envs[ctRotationP]->Load_2(F); - envs[ctRotationH] = new CEnvelope(); envs[ctRotationH]->Load_2(F); - envs[ctRotationB] = new CEnvelope(); envs[ctRotationB]->Load_2(F); - }else{ - if (vers!=EOBJ_OMOTION_VERSION) return false; - Clear (); - for (int ch=0; chLoad_2(F); - } - } - return true; -} - -#if defined _EDITOR || defined _MAYA_EXPORT -void COMotion::CreateKey(float t, const Fvector& P, const Fvector& R) -{ - envs[ctPositionX]->InsertKey(t,P.x); - envs[ctPositionY]->InsertKey(t,P.y); - envs[ctPositionZ]->InsertKey(t,P.z); - envs[ctRotationH]->InsertKey(t,R.y); - envs[ctRotationP]->InsertKey(t,R.x); - envs[ctRotationB]->InsertKey(t,R.z); -} -void COMotion::DeleteKey(float t) -{ - envs[ctPositionX]->DeleteKey(t); - envs[ctPositionY]->DeleteKey(t); - envs[ctPositionZ]->DeleteKey(t); - envs[ctRotationH]->DeleteKey(t); - envs[ctRotationP]->DeleteKey(t); - envs[ctRotationB]->DeleteKey(t); -} -int COMotion::KeyCount() -{ - return envs[ctPositionX]->keys.size(); -} -void COMotion::FindNearestKey(float t, float& mn, float& mx, float eps) -{ - KeyIt min_k; - KeyIt max_k; - envs[ctPositionX]->FindNearestKey(t, min_k, max_k, eps); - mn = (min_k!=envs[ctPositionX]->keys.end())?(*min_k)->time:t; - mx = (max_k!=envs[ctPositionX]->keys.end())?(*max_k)->time:t; -} -float COMotion::GetLength(float* mn, float* mx) -{ - float ln,len=0.f; - for (int ch=0; chGetLength(mn,mx))>len) len=ln; - return len; -} -BOOL COMotion::ScaleKeys(float from_time, float to_time, float scale_factor) -{ - BOOL bRes=TRUE; - for (int ch=0; chScaleKeys(from_time, to_time, scale_factor, 1.f/fFPS))) break; - return bRes; -} -BOOL COMotion::NormalizeKeys(float from_time, float to_time, float speed) -{ - if (to_timekeys.front()->time; - FloatVec tms; - tms.push_back (t0); - for (KeyIt it=E->keys.begin()+1; it!=E->keys.end(); it++){ - if ((*it)->time>from_time){ - if ((*it)->timetime; tm+=EPS_L){ - _Evaluate (tm, T, R); - dist += PT.distance_to(T); - PT.set (T); - } - new_tm += dist / speed; - t0 = (*it)->time; - tms.push_back (new_tm); - }else{ - float dt = (*it)->time-t0; - t0 = (*it)->time; - new_tm +=dt; - tms.push_back (new_tm); - } - } - } - for (int ch=0; chkeys.size()); - for (KeyIt k_it=E->keys.begin(); k_it!=E->keys.end(); k_it++,f_it++) - (*k_it)->time = *f_it; - } - -/* - CEnvelope* E = Envelope(); - for (KeyIt it=E->keys.begin(); it!=E->keys.end(); it++){ - if (((*it)->time>from_time)&&((*it)->timebone_mots[i]; - for (int ch=0; chenvs[ch] = new CEnvelope(src->envs[ch]); - } -} - -CSMotion::~CSMotion(){ - Clear(); -} - -void CSMotion::Clear() -{ - for(BoneMotionIt bm_it=bone_mots.begin(); bm_it!=bone_mots.end(); bm_it++) - { - for (int ch=0; chenvs[ch]); - } - bone_mots.clear(); -} - -st_BoneMotion* CSMotion::FindBoneMotion(shared_str name) -{ - for(BoneMotionIt bm_it=bone_mots.begin(); bm_it!=bone_mots.end(); bm_it++) - if (bm_it->name.equal(name)) return &*bm_it; - return 0; -} - -void CSMotion::add_empty_motion (shared_str const &bone_id) -{ - VERIFY (!FindBoneMotion(bone_id)); - - st_BoneMotion motion; - - motion.SetName (bone_id.c_str()); - // flRKeyAbsent = (1<<1), - motion.m_Flags.assign ( 1 << 1); - - for (int ch=0; chiFrameStart; - iFrameEnd = source->iFrameEnd; - fFPS = source->fFPS; - st_BoneMotion* src; - st_BoneMotion* dest; - bone_mots.resize(source->bone_mots.size()); - for(u32 i=0; ibone_mots[i]; - for (int ch=0; chenvs[ch] = new CEnvelope(src->envs[ch]); - } -} - -void CSMotion::_Evaluate(int bone_idx, float t, Fvector& T, Fvector& R) -{ - VERIFY(bone_idx<(int)bone_mots.size()); - CEnvelope** envs = bone_mots[bone_idx].envs; - T.x = envs[ctPositionX]->Evaluate(t); - T.y = envs[ctPositionY]->Evaluate(t); - T.z = envs[ctPositionZ]->Evaluate(t); - - R.y = envs[ctRotationH]->Evaluate(t); - R.x = envs[ctRotationP]->Evaluate(t); - R.z = envs[ctRotationB]->Evaluate(t); -} - -void CSMotion::WorldRotate(int boneId, float h, float p, float b) -{ - R_ASSERT((boneId>=0)&&(boneId<(int)bone_mots.size())); - st_BoneMotion& BM = bone_mots[boneId]; - - BM.envs[ctRotationH]->RotateKeys(h); - BM.envs[ctRotationP]->RotateKeys(p); - BM.envs[ctRotationB]->RotateKeys(b); -} - -void CSMotion::SaveMotion(const char* buf){ - CMemoryWriter F; - F.open_chunk (EOBJ_SMOTION); - Save (F); - F.close_chunk (); - if (!F.save_to(buf)) - Log ("! Can't save skeleton motion:",buf); -} - -bool CSMotion::LoadMotion(const char* buf) -{ - destructor F(FS.r_open(buf)); - R_ASSERT (F().find_chunk(EOBJ_SMOTION)); - return Load (F()); -} - -void CSMotion::Save(IWriter& F) -{ - CCustomMotion::Save(F); - F.w_u16 (EOBJ_SMOTION_VERSION); - F.w_s8 (m_Flags.get()); - F.w_u16 (m_BoneOrPart); - F.w_float (fSpeed); - F.w_float (fAccrue); - F.w_float (fFalloff); - F.w_float (fPower); - F.w_u16 ((u16)bone_mots.size()); - for(BoneMotionIt bm_it=bone_mots.begin(); bm_it!=bone_mots.end(); bm_it++){ - xr_strlwr (bm_it->name); - F.w_stringZ (bm_it->name); - F.w_u8 (bm_it->m_Flags.get()); - for (int ch=0; chenvs[ch]->Save(F); - } -#if 0 - u32 sz = marks.size(); - F.w_u32 (sz); - for(u32 i=0; iSetName (itoa(int(bm_it-bone_mots.begin()),temp_buf,10)); - bm_it->m_Flags.assign((u8)F.r_u32()); - for (int ch=0; chenvs[ch] = new CEnvelope(); - bm_it->envs[ch]->Load_1(F); - } - } - }else{ - if (vers==0x0005){ - m_Flags.assign ((u8)F.r_u32()); - m_BoneOrPart= u16(F.r_u32()&0xffff); - fSpeed = F.r_float(); - fAccrue = F.r_float(); - fFalloff = F.r_float(); - fPower = F.r_float(); - bone_mots.resize(F.r_u32()); - string64 buf; - for(BoneMotionIt bm_it=bone_mots.begin(); bm_it!=bone_mots.end(); bm_it++){ - F.r_stringZ (buf,sizeof(buf)); - bm_it->SetName (buf); - bm_it->m_Flags.assign((u8)F.r_u32()); - for (int ch=0; chenvs[ch] = new CEnvelope(); - bm_it->envs[ch]->Load_1(F); - } - } - }else{ - if (vers>=0x0006) - { - m_Flags.assign (F.r_u8()); - m_BoneOrPart= F.r_u16(); - fSpeed = F.r_float(); - fAccrue = F.r_float(); - fFalloff = F.r_float(); - fPower = F.r_float(); - bone_mots.resize(F.r_u16()); - string64 buf; - for(BoneMotionIt bm_it=bone_mots.begin(); bm_it!=bone_mots.end(); bm_it++){ - F.r_stringZ (buf,sizeof(buf)); - bm_it->SetName (buf); - bm_it->m_Flags.assign(F.r_u8()); - for (int ch=0; chenvs[ch] = new CEnvelope(); - bm_it->envs[ch]->Load_2(F); - } - } - } - } - } -/* - if(vers>=0x0007) - { - u32 sz = F.r_u32(); - if(sz>0) - { - marks.resize (sz); - for(u32 i=0; iname); - return true; -} - -void CSMotion::Optimize() -{ - for(BoneMotionIt bm_it=bone_mots.begin(); bm_it!=bone_mots.end(); bm_it++){ - for (int ch=0; chenvs[ch]->Optimize(); - } -} - -void CSMotion::SortBonesBySkeleton(BoneVec& bones) -{ - BoneMotionVec new_bone_mots; - for (BoneIt b_it=bones.begin(); b_it!=bones.end(); b_it++){ - st_BoneMotion* BM = FindBoneMotion((*b_it)->Name()); R_ASSERT(BM); - new_bone_mots.push_back(*BM); - } - bone_mots.clear (); - bone_mots = new_bone_mots; -} -#endif - -void SAnimParams::Set(float start_frame, float end_frame, float fps) -{ - min_t=start_frame/fps; - max_t=end_frame/fps; -} - -void SAnimParams::Set(CCustomMotion* M) -{ - Set((float)M->FrameStart(),(float)M->FrameEnd(),M->FPS()); - t_current = min_t; - tmp = t_current; -// bPlay=true; -} -void SAnimParams::Update(float dt, float speed, bool loop) -{ - if (!bPlay) return; - bWrapped = false; - - t_current +=speed*dt; - tmp = t_current; - - if (t_current>max_t) - { - bWrapped= true; - if (loop) - { - float len = max_t-min_t; - float k = float(iFloor((t_current-min_t)/len)); - t_current = t_current-k*len; - }else - t_current = max_t; - - tmp = t_current; - } -} - -//------------------------------------------------------------------------------ -// Clip -//------------------------------------------------------------------------------ -#define EOBJ_CLIP_VERSION 2 -#define EOBJ_CLIP_VERSION_CHUNK 0x9000 -#define EOBJ_CLIP_DATA_CHUNK 0x9001 - -void CClip::Save(IWriter& F) -{ - F.open_chunk (EOBJ_CLIP_VERSION_CHUNK); - F.w_u16 (EOBJ_CLIP_VERSION); - F.close_chunk (); - - F.open_chunk (EOBJ_CLIP_DATA_CHUNK); - F.w_stringZ (name); - for (int k=0; k<4; k++){ - F.w_stringZ (cycles[k].name); - F.w_u16 (cycles[k].slot); - } - F.w_stringZ (fx.name); - F.w_u16 (fx.slot); - F.w_float (fx_power); - F.w_float (length); - F.close_chunk (); -} -//------------------------------------------------------------------------------ - -bool CClip::Load(IReader& F) -{ - R_ASSERT (F.find_chunk(EOBJ_CLIP_VERSION_CHUNK)); - u16 ver = F.r_u16(); - if (ver!=EOBJ_CLIP_VERSION) return false; - R_ASSERT(F.find_chunk(EOBJ_CLIP_DATA_CHUNK)); - F.r_stringZ (name); - for (int k=0; k<4; k++){ - F.r_stringZ (cycles[k].name); - cycles[k].slot = F.r_u16(); - } - F.r_stringZ (fx.name); - fx.slot = F.r_u16(); - fx_power = F.r_float(); - length = F.r_float(); - return true; -} -//------------------------------------------------------------------------------ - -bool CClip::Equal(CClip* c) -{ - if (!name.equal(c->name)) return false; - if (!cycles[0].equal(c->cycles[0])) return false; - if (!cycles[1].equal(c->cycles[1])) return false; - if (!cycles[2].equal(c->cycles[2])) return false; - if (!cycles[3].equal(c->cycles[3])) return false; - if (!fx.equal(c->fx)) return false; - if (length!=c->length) return false; - return true; -} -//------------------------------------------------------------------------------ - diff --git a/cs/engine/plugins/shared/motion.h b/cs/engine/plugins/shared/motion.h deleted file mode 100644 index c6fbde77d..000000000 --- a/cs/engine/plugins/shared/motion.h +++ /dev/null @@ -1,217 +0,0 @@ -//---------------------------------------------------- -#ifndef MotionH -#define MotionH - -#ifdef _LW_EXPORT -#include -#include -#endif - -#include "bone.h" - -// refs -class CEnvelope; -class IWriter; -class IReader; -class motion_marks; - -enum EChannelType{ - ctUnsupported = -1, - ctPositionX=0, - ctPositionY, - ctPositionZ, - ctRotationH, - ctRotationP, - ctRotationB, - ctMaxChannel -}; - -struct st_BoneMotion -{ - enum { - flWorldOrient = 1<<0, - }; - shared_str name; - CEnvelope* envs [ctMaxChannel]; - Flags8 m_Flags; - st_BoneMotion() {name=0; m_Flags.zero(); ZeroMemory(envs,sizeof(CEnvelope*)*ctMaxChannel);} - void SetName(LPCSTR nm) { name=nm; } -}; -// vector по костям -using BoneMotionVec = xr_vector; -using BoneMotionIt = BoneMotionVec::iterator; - -//-------------------------------------------------------------------------- -class ENGINE_API CCustomMotion -{ -protected: - enum EMotionType - { - mtObject = 0, - mtSkeleton, - ForceDWORD = u32(-1) - }; - EMotionType mtype; - int iFrameStart, iFrameEnd; - float fFPS; -public: - shared_str name; -public: - CCustomMotion (); - CCustomMotion (CCustomMotion* src); - virtual ~CCustomMotion (); - - void SetName (const char* n) {string256 tmp; tmp[0]=0; if(n){strcpy_s(tmp,n); strlwr(tmp);} name=tmp;} - LPCSTR Name () {return name.c_str();} - int FrameStart () {return iFrameStart;} - int FrameEnd () {return iFrameEnd;} - float FPS () {return fFPS;} - int Length () {return iFrameEnd-iFrameStart;} - - void SetParam (int s, int e, float fps){iFrameStart=s; iFrameEnd=e; fFPS=fps;} - - virtual void Save (IWriter& F); - virtual bool Load (IReader& F); - - virtual void SaveMotion (const char* buf)=0; - virtual bool LoadMotion (const char* buf)=0; - -#ifdef _LW_EXPORT - CEnvelope* CreateEnvelope (LWChannelID chan, LWChannelID* chan_parent=0); -#endif -}; - -//-------------------------------------------------------------------------- -class ENGINE_API COMotion: public CCustomMotion -{ - CEnvelope* envs [ctMaxChannel]; -public: - COMotion (); - COMotion (COMotion* src); - virtual ~COMotion (); - - void Clear (); - - void _Evaluate (float t, Fvector& T, Fvector& R); - virtual void Save (IWriter& F); - virtual bool Load (IReader& F); - - virtual void SaveMotion (const char* buf); - virtual bool LoadMotion (const char* buf); - -#ifdef _LW_EXPORT - void ParseObjectMotion(LWItemID object); -#endif -#if defined _EDITOR || defined _MAYA_EXPORT - void FindNearestKey (float t, float& min_k, float& max_k, float eps=EPS_L); - void CreateKey (float t, const Fvector& P, const Fvector& R); - void DeleteKey (float t); - void NormalizeKeys (); - int KeyCount (); - CEnvelope* Envelope (EChannelType et=ctPositionX){return envs[et];} - BOOL ScaleKeys (float from_time, float to_time, float scale_factor); - BOOL NormalizeKeys (float from_time, float to_time, float speed); - float GetLength (float* mn=0, float* mx=0); -#endif -}; - -//-------------------------------------------------------------------------- - -enum ESMFlags{ - esmFX = 1<<0, - esmStopAtEnd = 1<<1, - esmNoMix = 1<<2, - esmSyncPart = 1<<3, - esmUseFootSteps = 1<<4, - esmRootMover = 1<<5, - esmIdle = 1<<6, - esmUseWeaponBone = 1<<7, -}; - -#if defined(_EDITOR) || defined(_MAX_EXPORT) || defined(_MAYA_EXPORT) || defined(_LW_EXPORT) -// #include "SkeletonMotions.h" - -class ENGINE_API CSMotion: public CCustomMotion{ - BoneMotionVec bone_mots; -public: - u16 m_BoneOrPart; - float fSpeed; - float fAccrue; - float fFalloff; - float fPower; - Flags8 m_Flags; - -// xr_vector marks; - - void Clear (); -public: - CSMotion (); - CSMotion (CSMotion* src); - virtual ~CSMotion (); - - void _Evaluate (int bone_idx, float t, Fvector& T, Fvector& R); - - void CopyMotion (CSMotion* src); - - st_BoneMotion* FindBoneMotion (shared_str name); - BoneMotionVec& BoneMotions () {return bone_mots;} - Flags8 GetMotionFlags (int bone_idx) {return bone_mots[bone_idx].m_Flags;} - void add_empty_motion(shared_str const &bone_id); - - virtual void Save (IWriter& F); - virtual bool Load (IReader& F); - - virtual void SaveMotion (const char* buf); - virtual bool LoadMotion (const char* buf); - - void SortBonesBySkeleton(BoneVec& bones); - void WorldRotate (int boneId, float h, float p, float b); - - void Optimize (); - #ifdef _LW_EXPORT - void ParseBoneMotion (LWItemID bone); - #endif -}; -#endif - -struct ECORE_API SAnimParams { - float t_current; - float tmp; - float min_t; - float max_t; - BOOL bPlay; - BOOL bWrapped; -public: - SAnimParams(){bWrapped=false;bPlay=false;t_current=0.f;min_t=0.f;max_t=0.f;tmp=0.f;} - void Set (CCustomMotion* M); - void Set (float start_frame, float end_frame, float fps); - float Frame () { return t_current;} - void Update (float dt, float speed, bool loop); - void Play (){bPlay=true; t_current=min_t; tmp=min_t;} - void Stop (){bPlay=false; t_current=min_t; tmp=min_t;} - void Pause (bool val){bPlay=!val;} -}; - -class ENGINE_API CClip{ -public: - struct AnimItem{ - shared_str name; - u16 slot; - AnimItem ():slot(u16(-1)){} - void set (shared_str nm, u16 s){name=nm;slot=s;} - void clear (){set("",u16(-1));} - bool valid (){return !!(name.size()&&(slot!=u16(-1)));} - bool equal (const AnimItem& d) const {return name.equal(d.name)&&(slot==d.slot);} - }; - shared_str name; - AnimItem cycles[4]; - AnimItem fx; - - float fx_power; - float length; -public: - virtual void Save (IWriter& F); - virtual bool Load (IReader& F); - bool Equal (CClip* c); -}; -#endif diff --git a/cs/engine/plugins/shared/pick_definition.cpp b/cs/engine/plugins/shared/pick_definition.cpp deleted file mode 100644 index c3ef44afe..000000000 --- a/cs/engine/plugins/shared/pick_definition.cpp +++ /dev/null @@ -1,170 +0,0 @@ -//---------------------------------------------------- -// file: SceneClassList.h -//---------------------------------------------------- - -#ifndef SceneClassListH -#define SceneClassListH -//---------------------------------------------------- - -class CEditableObject; -class CEditableMesh; -class CCustomObject; - -#ifdef _EDITOR - class SPickQuery{ - Flags32 m_Flags; - public: - Fvector m_Start; - Fvector m_Direction; - float m_Dist; - Fbox m_BB; - public: - class SResult{ - public: - Fvector verts[3]; - float u,v; - float range; - CEditableObject*e_obj; - CEditableMesh* e_mesh; - u32 tag; - bool operator < (const SResult& F)const{return rangeverts[0]); - parent.transform_tiny(verts[1],r->verts[1]); - parent.transform_tiny(verts[2],r->verts[2]); - u = r->u; - v = r->v; - range = r->range; - tag = r->dummy; - e_obj = obj; - e_mesh = mesh; - } - SResult (CDB::RESULT* r, CEditableObject* obj, CEditableMesh* mesh) - { - verts[0] = r->verts[0]; - verts[1] = r->verts[1]; - verts[2] = r->verts[2]; - u = r->u; - v = r->v; - range = r->range; - tag = r->dummy; - e_obj = obj; - e_mesh = mesh; - } - }; - DEFINE_VECTOR(SResult,ResultVec,ResultIt); - protected: - ResultVec results; - public: - IC void prepare_rq (const Fvector& start, const Fvector& dir, float dist, u32 flags) - { - m_Start.set (start); - m_Direction.set (dir); - m_Dist = dist; - m_Flags.assign (flags); - results.clear (); - } - IC void prepare_bq (const Fbox& bbox, u32 flags) - { - m_BB.set (bbox); - m_Flags.assign (flags); - results.clear (); - } - IC void append_mtx (const Fmatrix& parent, CDB::RESULT* R, CEditableObject* obj, CEditableMesh* mesh) - { - SResult D (parent, R, obj, mesh); - if (m_Flags.is(CDB::OPT_ONLYNEAREST)&&!results.empty()){ - SResult& S = results.back(); - if (D.rangeget_tris()+inf.id)->dummy;} - }; - DEFINE_VECTOR(CDB::RESULT,BPInfVec,BPInfIt); - struct SBoxPickInfo{ - BPInfVec inf; - CCustomObject* s_obj; - CEditableObject* e_obj; - CEditableMesh* e_mesh; - SBoxPickInfo (){Reset();} - IC void Reset (){ZeroMemory(this,sizeof(SBoxPickInfo));} - IC void AddRESULT (CDB::MODEL* M, CDB::RESULT* R){inf.push_back(*R); inf.back().id=(M->get_tris()+inf.back().id)->dummy;} - }; - DEFINE_VECTOR(SBoxPickInfo,SBoxPickInfoVec,SBoxPickInfoIt); -#endif - -//---------------------------------------------------- -enum EObjClass{ - OBJCLASS_DUMMY = -1, - OBJCLASS_GROUP = 0, - OBJCLASS_GLOW = 1, - OBJCLASS_SCENEOBJECT= 2, - OBJCLASS_LIGHT = 3, - OBJCLASS_SHAPE = 4, - OBJCLASS_SOUND_SRC = 5, - OBJCLASS_SPAWNPOINT = 6, - OBJCLASS_WAY = 7, - OBJCLASS_SECTOR = 8, - OBJCLASS_PORTAL = 9, - OBJCLASS_SOUND_ENV = 10, - OBJCLASS_PS = 11, - OBJCLASS_DO = 12, - OBJCLASS_AIMAP = 13, - OBJCLASS_WM = 14, - OBJCLASS_COUNT, - OBJCLASS_force_dword = -1 -}; -//---------------------------------------------------- -#endif /*_INCDEF_SceneClassList_H_*/ - - diff --git a/cs/engine/xrCore/xrCoreStatic.vcxproj b/cs/engine/xrCore/xrCoreStatic.vcxproj deleted file mode 100644 index 815f20fa9..000000000 --- a/cs/engine/xrCore/xrCoreStatic.vcxproj +++ /dev/null @@ -1,399 +0,0 @@ - - - - - Debug - Win32 - - - Mixed - Win32 - - - Release - Win32 - - - - {F1066EAC-EE25-4C7A-9023-5957A6F7BA27} - xrCoreStatic - Win32Proj - 8.1 - - - - StaticLibrary - v140 - MultiByte - - - StaticLibrary - v140 - MultiByte - true - - - StaticLibrary - v140 - MultiByte - - - - - - - - - - - - - - - - - - - - - - $(ProjectName) - - - - - - - - Disabled - false - Neither - true - $(SolutionDir)sdk\include;$(SolutionDir)engine;$(SolutionDir)3rd party\bugtrap\source;$(DXSDK_DIR)Include;%(AdditionalIncludeDirectories) - DEBUG;XRCORE_STATIC;WIN32;_WINDOWS;_USRDLL;XRCORE_EXPORTS;%(PreprocessorDefinitions) - true - true - Sync - EnableFastChecks - true - MultiThreadedDLL - true - Fast - false - true - Use - $(IntDir)$(ProjectName).pch - - $(IntDir) - $(IntDir) - $(IntDir) - - Level4 - true - ProgramDatabase - - - $(OutDir)$(TargetName)$(TargetExt) - MachineX86 - $(DXSDK_DIR)Lib\x86; - - - - - Full - AnySuitable - true - Speed - true - true - $(SolutionDir)sdk\include;$(SolutionDir)engine;$(SolutionDir)3rd party\bugtrap\source;$(DXSDK_DIR)Include;%(AdditionalIncludeDirectories) - XRCORE_STATIC;WIN32;NDEBUG;_WINDOWS;_USRDLL;XRCORE_EXPORTS;%(PreprocessorDefinitions) - true - true - - MultiThreadedDLL - false - StreamingSIMDExtensions - Fast - false - true - Use - $(IntDir)$(ProjectName).pch - $(IntDir) - $(IntDir) - $(IntDir) - - Level4 - ProgramDatabase - - - MachineX86 - $(DXSDK_DIR)Lib\x86; - $(OutDir)$(TargetName)$(TargetExt) - - - - - Full - AnySuitable - true - Speed - false - true - $(SolutionDir)sdk\include;$(SolutionDir)engine;$(SolutionDir)3rd party\bugtrap\source;$(DXSDK_DIR)Include;%(AdditionalIncludeDirectories) - XRCORE_STATIC;MIXED;WIN32;NDEBUG;_WINDOWS;_USRDLL;XRCORE_EXPORTS;%(PreprocessorDefinitions) - true - true - Sync - MultiThreadedDLL - true - false - Fast - false - true - Use - $(IntDir)$(ProjectName).pch - - $(IntDir) - $(IntDir) - $(IntDir) - - Level4 - ProgramDatabase - - - $(OutDir)$(TargetName)$(TargetExt) - MachineX86 - $(DXSDK_DIR)Lib\x86; - - - - - - - - - - - - - - - - - - true - true - true - - - - - true - true - true - - - - - - - TurnOffAllWarnings - - - TurnOffAllWarnings - - - TurnOffAllWarnings - - - - - - - - - - - - - true - Create - true - Create - false - true - Create - - - - - - - - - - - Create - Create - Create - - - - - - - - AssemblyAndSourceCode - - - - - - - - true - true - true - - - - - - - - true - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {e8cf1ada-264a-4127-86c2-fd7057d3792c} - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/cs/engine/xrCore/xrCoreStatic.vcxproj.filters b/cs/engine/xrCore/xrCoreStatic.vcxproj.filters deleted file mode 100644 index 1d0b15b36..000000000 --- a/cs/engine/xrCore/xrCoreStatic.vcxproj.filters +++ /dev/null @@ -1,582 +0,0 @@ -п»ї - - - - {2241db99-d828-469e-a0b1-3aaa164be029} - - - {358524dd-d639-4d48-a661-9e1493760873} - - - {5e9ae589-f488-4311-8099-0ab2c8c0b995} - - - {5ddbe16b-6a63-4774-a6f5-386cd841a13f} - - - {963018b3-4965-411a-accc-ffda1f125361} - - - {e9aa814d-39a0-40c9-8c1f-2f8b77702438} - - - {c5df6327-7419-4b98-9b09-09276af42210} - - - {85156b9c-dec9-43e8-ab64-bdadbc79f7b9} - - - {350a0239-feb8-4d15-baef-45ca757ce2a6} - - - {2b6832a5-4980-4a1d-8eca-bc6fe29d9272} - - - {51b13487-719f-48da-8278-e8ece79a9fef} - - - {de5085b6-617e-4f73-a59e-fca52e7d093e} - - - {e56be444-2d84-4cdd-b71f-d57dd1ed1620} - - - {bcf4b4f4-46df-473d-a9c0-48f1163c6960} - - - {a6a6ed8c-0663-4f99-8d17-98e51164c23c} - - - {4fc3e0ee-0199-4513-8055-5518656f344c} - - - {d081d810-605f-4975-82ab-3f6d8728b1d1} - - - {e8d6bcd9-53ca-472d-8fc9-82cf4c7cffd7} - - - {992647f9-f3c8-4a3d-851f-673ef2ae13a0} - - - {7fd89d1c-7fba-492e-b95a-a4ffcafe8ffc} - - - {997464ed-86df-4fab-a7bc-ecffe6335bb5} - - - {d0884b9c-a88a-4b72-9d3c-70dd25e6e6a2} - - - {233f8e02-fced-46ff-9bbd-9decca2dd7e5} - - - {e22a4104-3b11-4593-81b2-ffb752b29eba} - - - {633e15ee-d6ca-490b-acb8-18e9ec2cbb75} - - - {d8dac3e9-3fce-4b17-b68b-0acb142552c1} - - - {bf80905c-5340-4d12-b0a1-9cd02751bfdf} - - - {be20e9e7-49e7-4c89-a240-2949aa331156} - - - - - Kernel - - - Kernel - - - Kernel - - - Math - - - Math - - - Math - - - Math\Extensions - - - Math\Extensions - - - Math\Extensions - - - FS - - - FS - - - FS - - - FS - - - FS - - - FS - - - FS - - - FS - - - FS\stream_reader - - - FS\file_stream_reader - - - Memory manager - - - Memory manager - - - Memory manager - - - Memory manager - - - Memory manager - - - Memory manager - - - Memory manager - - - Memory manager - - - Memory manager - - - Memory manager - - - Memory manager - - - Debug core - - - shared memory/string library - - - shared memory/string library - - - shared memory/string library - - - shared memory/string library - - - memory_monitor - - - Compression\ppmd - - - Compression\ppmd\core - - - Compression\lzo - - - Compression\lzo - - - Compression\lzo - - - Compression\lzo - - - Compression\lzo - - - Compression\lzo - - - Compression\lz - - - Compression\rt - - - Compression\rt - - - string_concatenations - - - Kernel - - - OS - - - Kernel\CPUID - - - Threading - - - XML\TinyXML - - - XML\TinyXML - - - XML\TinyXML - - - XML\TinyXML - - - XML - - - Debug core - - - Debug core - - - Debug core - - - - - Kernel - - - Kernel - - - Kernel - - - Kernel - - - Kernel - - - Math - - - Math - - - Math - - - Math - - - Math - - - Math - - - Math - - - Math - - - Math - - - Math - - - Math - - - Math - - - Math - - - Math - - - Math - - - Math - - - Math - - - Math - - - Math - - - Math - - - Math - - - Math - - - Math\STLext - - - Math\STLext - - - Math\STLext - - - Math\STLext - - - Math\Extensions - - - Math\Extensions - - - Math\Extensions - - - Math\Extensions - - - Math\Extensions - - - Math\Extensions - - - FS - - - FS - - - FS - - - FS - - - FS - - - FS - - - FS\stream_reader - - - FS\stream_reader - - - FS\file_stream_reader - - - Memory manager - - - Memory manager - - - Memory manager - - - Memory manager - - - Memory manager - - - Memory manager - - - Memory manager - - - Debug core - - - Debug core - - - Debug core\BugTrap - - - Debug core\BugTrap - - - shared memory/string library - - - shared memory/string library - - - shared memory/string library - - - shared memory/string library - - - intrusive_ptr - - - intrusive_ptr - - - memory_monitor - - - Compression\ppmd - - - Compression\ppmd\common - - - Compression\ppmd\common - - - Compression\ppmd\core - - - Compression\ppmd\core\allocator - - - Compression\ppmd\stream - - - Compression\ppmd\stream - - - Compression\lzo - - - Compression\lzo - - - Compression\lzo - - - Compression\lzo - - - Compression\lzo - - - Compression\lzo - - - Compression\lzo - - - Compression\lzo - - - Compression\lzo - - - Compression\lz - - - Compression\rt - - - string_concatenations - - - string_concatenations - - - Kernel - - - OS - - - Kernel\CPUID - - - Threading - - - XML\TinyXML - - - XML\TinyXML - - - XML - - - Debug core - - - Debug core - - - Debug core - - - Debug core - - - - - Kernel - - - - - FS - - - FS - - - - - Debug core - - - Debug core - - - Debug core - - - \ No newline at end of file