diff --git a/Core/Tools/CMakeLists.txt b/Core/Tools/CMakeLists.txt
index cb47b91e401..381643f5731 100644
--- a/Core/Tools/CMakeLists.txt
+++ b/Core/Tools/CMakeLists.txt
@@ -8,4 +8,5 @@ endif()
# Build less useful tool/test binaries.
if(RTS_BUILD_CORE_EXTRAS)
add_subdirectory(Compress)
+ add_subdirectory(WW3D)
endif()
diff --git a/Generals/Code/Tools/WW3D/CMakeLists.txt b/Core/Tools/WW3D/CMakeLists.txt
similarity index 100%
rename from Generals/Code/Tools/WW3D/CMakeLists.txt
rename to Core/Tools/WW3D/CMakeLists.txt
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/AlphaModifier.cpp b/Core/Tools/WW3D/max2w3d/AlphaModifier.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/AlphaModifier.cpp
rename to Core/Tools/WW3D/max2w3d/AlphaModifier.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/AlphaModifier.h b/Core/Tools/WW3D/max2w3d/AlphaModifier.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/AlphaModifier.h
rename to Core/Tools/WW3D/max2w3d/AlphaModifier.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/AppData.cpp b/Core/Tools/WW3D/max2w3d/AppData.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/AppData.cpp
rename to Core/Tools/WW3D/max2w3d/AppData.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/CMakeLists.txt b/Core/Tools/WW3D/max2w3d/CMakeLists.txt
similarity index 88%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/CMakeLists.txt
rename to Core/Tools/WW3D/max2w3d/CMakeLists.txt
index 65242ec2fed..433365eb591 100644
--- a/GeneralsMD/Code/Tools/WW3D/max2w3d/CMakeLists.txt
+++ b/Core/Tools/WW3D/max2w3d/CMakeLists.txt
@@ -146,19 +146,19 @@ set(MAX2W3D_SRC
"w3dutil.h"
)
-add_library(z_max2w3d SHARED)
-set_target_properties(z_max2w3d PROPERTIES OUTPUT_NAME max2w3d SUFFIX ".dle")
+add_library(core_max2w3d SHARED)
+set_target_properties(core_max2w3d PROPERTIES OUTPUT_NAME max2w3d SUFFIX ".dle")
-target_include_directories(z_max2w3d PRIVATE
+target_include_directories(core_max2w3d PRIVATE
"../pluglib"
)
-target_sources(z_max2w3d PRIVATE ${MAX2W3D_SRC})
+target_sources(core_max2w3d PRIVATE ${MAX2W3D_SRC})
# TODO: What does W3D_MAX4 do? Needs cmake option?
-target_compile_definitions(z_max2w3d PRIVATE W3D_MAX4)
+target_compile_definitions(core_max2w3d PRIVATE W3D_MAX4)
-target_link_libraries(z_max2w3d PRIVATE
+target_link_libraries(core_max2w3d PRIVATE
Comctl32
# This is only linked to have its basetsd.h used instead of the vs6's basetsd.h
# The headers typedef INT_PTR to different types, but maxsdk expects it
@@ -166,11 +166,11 @@ target_link_libraries(z_max2w3d PRIVATE
d3d8lib
maxsdk
winmm
- z_pluglib
+ core_pluglib
)
-set_target_properties(z_max2w3d PROPERTIES LINK_FLAGS "/DEF:max2w3d.def")
+set_target_properties(core_max2w3d PROPERTIES LINK_FLAGS "/DEF:max2w3d.def")
if(WIN32 OR "${CMAKE_SYSTEM}" MATCHES "Windows")
- target_sources(z_max2w3d PRIVATE max2w3d.rc)
+ target_sources(core_max2w3d PRIVATE max2w3d.rc)
endif()
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/ExportAll.cpp b/Core/Tools/WW3D/max2w3d/ExportAll.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/ExportAll.cpp
rename to Core/Tools/WW3D/max2w3d/ExportAll.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/ExportAllDlg.cpp b/Core/Tools/WW3D/max2w3d/ExportAllDlg.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/ExportAllDlg.cpp
rename to Core/Tools/WW3D/max2w3d/ExportAllDlg.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/ExportAllDlg.h b/Core/Tools/WW3D/max2w3d/ExportAllDlg.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/ExportAllDlg.h
rename to Core/Tools/WW3D/max2w3d/ExportAllDlg.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/FormClass.cpp b/Core/Tools/WW3D/max2w3d/FormClass.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/FormClass.cpp
rename to Core/Tools/WW3D/max2w3d/FormClass.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/FormClass.h b/Core/Tools/WW3D/max2w3d/FormClass.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/FormClass.h
rename to Core/Tools/WW3D/max2w3d/FormClass.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/GameMtl.cpp b/Core/Tools/WW3D/max2w3d/GameMtl.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/GameMtl.cpp
rename to Core/Tools/WW3D/max2w3d/GameMtl.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/GameMtlDlg.cpp b/Core/Tools/WW3D/max2w3d/GameMtlDlg.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/GameMtlDlg.cpp
rename to Core/Tools/WW3D/max2w3d/GameMtlDlg.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/GameMtlDlg.h b/Core/Tools/WW3D/max2w3d/GameMtlDlg.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/GameMtlDlg.h
rename to Core/Tools/WW3D/max2w3d/GameMtlDlg.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/GameMtlForm.cpp b/Core/Tools/WW3D/max2w3d/GameMtlForm.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/GameMtlForm.cpp
rename to Core/Tools/WW3D/max2w3d/GameMtlForm.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/GameMtlForm.h b/Core/Tools/WW3D/max2w3d/GameMtlForm.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/GameMtlForm.h
rename to Core/Tools/WW3D/max2w3d/GameMtlForm.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/GameMtlPassDlg.cpp b/Core/Tools/WW3D/max2w3d/GameMtlPassDlg.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/GameMtlPassDlg.cpp
rename to Core/Tools/WW3D/max2w3d/GameMtlPassDlg.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/GameMtlPassDlg.h b/Core/Tools/WW3D/max2w3d/GameMtlPassDlg.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/GameMtlPassDlg.h
rename to Core/Tools/WW3D/max2w3d/GameMtlPassDlg.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/GameMtlShaderDlg.cpp b/Core/Tools/WW3D/max2w3d/GameMtlShaderDlg.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/GameMtlShaderDlg.cpp
rename to Core/Tools/WW3D/max2w3d/GameMtlShaderDlg.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/GameMtlShaderDlg.h b/Core/Tools/WW3D/max2w3d/GameMtlShaderDlg.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/GameMtlShaderDlg.h
rename to Core/Tools/WW3D/max2w3d/GameMtlShaderDlg.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/GameMtlTextureDlg.cpp b/Core/Tools/WW3D/max2w3d/GameMtlTextureDlg.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/GameMtlTextureDlg.cpp
rename to Core/Tools/WW3D/max2w3d/GameMtlTextureDlg.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/GameMtlTextureDlg.h b/Core/Tools/WW3D/max2w3d/GameMtlTextureDlg.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/GameMtlTextureDlg.h
rename to Core/Tools/WW3D/max2w3d/GameMtlTextureDlg.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/GameMtlVertexMaterialDlg.cpp b/Core/Tools/WW3D/max2w3d/GameMtlVertexMaterialDlg.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/GameMtlVertexMaterialDlg.cpp
rename to Core/Tools/WW3D/max2w3d/GameMtlVertexMaterialDlg.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/GameMtlVertexMaterialDlg.h b/Core/Tools/WW3D/max2w3d/GameMtlVertexMaterialDlg.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/GameMtlVertexMaterialDlg.h
rename to Core/Tools/WW3D/max2w3d/GameMtlVertexMaterialDlg.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/InputDlg.cpp b/Core/Tools/WW3D/max2w3d/InputDlg.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/InputDlg.cpp
rename to Core/Tools/WW3D/max2w3d/InputDlg.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/InputDlg.h b/Core/Tools/WW3D/max2w3d/InputDlg.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/InputDlg.h
rename to Core/Tools/WW3D/max2w3d/InputDlg.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/LightGlareSave.cpp b/Core/Tools/WW3D/max2w3d/LightGlareSave.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/LightGlareSave.cpp
rename to Core/Tools/WW3D/max2w3d/LightGlareSave.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/LightGlareSave.h b/Core/Tools/WW3D/max2w3d/LightGlareSave.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/LightGlareSave.h
rename to Core/Tools/WW3D/max2w3d/LightGlareSave.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/MeshDeform.cpp b/Core/Tools/WW3D/max2w3d/MeshDeform.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/MeshDeform.cpp
rename to Core/Tools/WW3D/max2w3d/MeshDeform.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/MeshDeform.h b/Core/Tools/WW3D/max2w3d/MeshDeform.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/MeshDeform.h
rename to Core/Tools/WW3D/max2w3d/MeshDeform.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/MeshDeformData.cpp b/Core/Tools/WW3D/max2w3d/MeshDeformData.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/MeshDeformData.cpp
rename to Core/Tools/WW3D/max2w3d/MeshDeformData.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/MeshDeformData.h b/Core/Tools/WW3D/max2w3d/MeshDeformData.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/MeshDeformData.h
rename to Core/Tools/WW3D/max2w3d/MeshDeformData.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/MeshDeformDefs.h b/Core/Tools/WW3D/max2w3d/MeshDeformDefs.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/MeshDeformDefs.h
rename to Core/Tools/WW3D/max2w3d/MeshDeformDefs.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/MeshDeformPanel.cpp b/Core/Tools/WW3D/max2w3d/MeshDeformPanel.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/MeshDeformPanel.cpp
rename to Core/Tools/WW3D/max2w3d/MeshDeformPanel.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/MeshDeformPanel.h b/Core/Tools/WW3D/max2w3d/MeshDeformPanel.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/MeshDeformPanel.h
rename to Core/Tools/WW3D/max2w3d/MeshDeformPanel.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/MeshDeformSave.cpp b/Core/Tools/WW3D/max2w3d/MeshDeformSave.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/MeshDeformSave.cpp
rename to Core/Tools/WW3D/max2w3d/MeshDeformSave.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/MeshDeformSave.h b/Core/Tools/WW3D/max2w3d/MeshDeformSave.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/MeshDeformSave.h
rename to Core/Tools/WW3D/max2w3d/MeshDeformSave.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/MeshDeformSaveDefs.h b/Core/Tools/WW3D/max2w3d/MeshDeformSaveDefs.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/MeshDeformSaveDefs.h
rename to Core/Tools/WW3D/max2w3d/MeshDeformSaveDefs.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/MeshDeformSaveSet.cpp b/Core/Tools/WW3D/max2w3d/MeshDeformSaveSet.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/MeshDeformSaveSet.cpp
rename to Core/Tools/WW3D/max2w3d/MeshDeformSaveSet.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/MeshDeformSaveSet.h b/Core/Tools/WW3D/max2w3d/MeshDeformSaveSet.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/MeshDeformSaveSet.h
rename to Core/Tools/WW3D/max2w3d/MeshDeformSaveSet.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/MeshDeformSet.cpp b/Core/Tools/WW3D/max2w3d/MeshDeformSet.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/MeshDeformSet.cpp
rename to Core/Tools/WW3D/max2w3d/MeshDeformSet.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/MeshDeformSet.h b/Core/Tools/WW3D/max2w3d/MeshDeformSet.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/MeshDeformSet.h
rename to Core/Tools/WW3D/max2w3d/MeshDeformSet.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/MeshDeformUndo.cpp b/Core/Tools/WW3D/max2w3d/MeshDeformUndo.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/MeshDeformUndo.cpp
rename to Core/Tools/WW3D/max2w3d/MeshDeformUndo.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/MeshDeformUndo.h b/Core/Tools/WW3D/max2w3d/MeshDeformUndo.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/MeshDeformUndo.h
rename to Core/Tools/WW3D/max2w3d/MeshDeformUndo.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/PCToPS2Material.cpp b/Core/Tools/WW3D/max2w3d/PCToPS2Material.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/PCToPS2Material.cpp
rename to Core/Tools/WW3D/max2w3d/PCToPS2Material.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/PS2GameMtl.cpp b/Core/Tools/WW3D/max2w3d/PS2GameMtl.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/PS2GameMtl.cpp
rename to Core/Tools/WW3D/max2w3d/PS2GameMtl.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/PS2GameMtlShaderDlg.cpp b/Core/Tools/WW3D/max2w3d/PS2GameMtlShaderDlg.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/PS2GameMtlShaderDlg.cpp
rename to Core/Tools/WW3D/max2w3d/PS2GameMtlShaderDlg.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/PS2GameMtlShaderDlg.h b/Core/Tools/WW3D/max2w3d/PS2GameMtlShaderDlg.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/PS2GameMtlShaderDlg.h
rename to Core/Tools/WW3D/max2w3d/PS2GameMtlShaderDlg.h
diff --git a/Generals/Code/Tools/WW3D/max2w3d/Res/DISK12.ICO b/Core/Tools/WW3D/max2w3d/Res/DISK12.ICO
similarity index 100%
rename from Generals/Code/Tools/WW3D/max2w3d/Res/DISK12.ICO
rename to Core/Tools/WW3D/max2w3d/Res/DISK12.ICO
diff --git a/Generals/Code/Tools/WW3D/max2w3d/Res/one.bmp b/Core/Tools/WW3D/max2w3d/Res/one.bmp
similarity index 100%
rename from Generals/Code/Tools/WW3D/max2w3d/Res/one.bmp
rename to Core/Tools/WW3D/max2w3d/Res/one.bmp
diff --git a/Generals/Code/Tools/WW3D/max2w3d/Res/orig.ico b/Core/Tools/WW3D/max2w3d/Res/orig.ico
similarity index 100%
rename from Generals/Code/Tools/WW3D/max2w3d/Res/orig.ico
rename to Core/Tools/WW3D/max2w3d/Res/orig.ico
diff --git a/Generals/Code/Tools/WW3D/max2w3d/Res/orig1.ico b/Core/Tools/WW3D/max2w3d/Res/orig1.ico
similarity index 100%
rename from Generals/Code/Tools/WW3D/max2w3d/Res/orig1.ico
rename to Core/Tools/WW3D/max2w3d/Res/orig1.ico
diff --git a/Generals/Code/Tools/WW3D/max2w3d/Res/two.bmp b/Core/Tools/WW3D/max2w3d/Res/two.bmp
similarity index 100%
rename from Generals/Code/Tools/WW3D/max2w3d/Res/two.bmp
rename to Core/Tools/WW3D/max2w3d/Res/two.bmp
diff --git a/Generals/Code/Tools/WW3D/max2w3d/Res/ww3d.bmp b/Core/Tools/WW3D/max2w3d/Res/ww3d.bmp
similarity index 100%
rename from Generals/Code/Tools/WW3D/max2w3d/Res/ww3d.bmp
rename to Core/Tools/WW3D/max2w3d/Res/ww3d.bmp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/SceneSetup.cpp b/Core/Tools/WW3D/max2w3d/SceneSetup.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/SceneSetup.cpp
rename to Core/Tools/WW3D/max2w3d/SceneSetup.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/SceneSetupDlg.cpp b/Core/Tools/WW3D/max2w3d/SceneSetupDlg.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/SceneSetupDlg.cpp
rename to Core/Tools/WW3D/max2w3d/SceneSetupDlg.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/SceneSetupDlg.h b/Core/Tools/WW3D/max2w3d/SceneSetupDlg.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/SceneSetupDlg.h
rename to Core/Tools/WW3D/max2w3d/SceneSetupDlg.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/SkinCopy.cpp b/Core/Tools/WW3D/max2w3d/SkinCopy.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/SkinCopy.cpp
rename to Core/Tools/WW3D/max2w3d/SkinCopy.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/SnapPoints.cpp b/Core/Tools/WW3D/max2w3d/SnapPoints.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/SnapPoints.cpp
rename to Core/Tools/WW3D/max2w3d/SnapPoints.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/SnapPoints.h b/Core/Tools/WW3D/max2w3d/SnapPoints.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/SnapPoints.h
rename to Core/Tools/WW3D/max2w3d/SnapPoints.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/TARGA.CPP b/Core/Tools/WW3D/max2w3d/TARGA.CPP
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/TARGA.CPP
rename to Core/Tools/WW3D/max2w3d/TARGA.CPP
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/TARGA.H b/Core/Tools/WW3D/max2w3d/TARGA.H
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/TARGA.H
rename to Core/Tools/WW3D/max2w3d/TARGA.H
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/Utility.cpp b/Core/Tools/WW3D/max2w3d/Utility.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/Utility.cpp
rename to Core/Tools/WW3D/max2w3d/Utility.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/aabtreebuilder.cpp b/Core/Tools/WW3D/max2w3d/aabtreebuilder.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/aabtreebuilder.cpp
rename to Core/Tools/WW3D/max2w3d/aabtreebuilder.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/aabtreebuilder.h b/Core/Tools/WW3D/max2w3d/aabtreebuilder.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/aabtreebuilder.h
rename to Core/Tools/WW3D/max2w3d/aabtreebuilder.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/animationcompressionsettings.cpp b/Core/Tools/WW3D/max2w3d/animationcompressionsettings.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/animationcompressionsettings.cpp
rename to Core/Tools/WW3D/max2w3d/animationcompressionsettings.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/animationcompressionsettings.h b/Core/Tools/WW3D/max2w3d/animationcompressionsettings.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/animationcompressionsettings.h
rename to Core/Tools/WW3D/max2w3d/animationcompressionsettings.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/bchannel.cpp b/Core/Tools/WW3D/max2w3d/bchannel.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/bchannel.cpp
rename to Core/Tools/WW3D/max2w3d/bchannel.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/bchannel.h b/Core/Tools/WW3D/max2w3d/bchannel.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/bchannel.h
rename to Core/Tools/WW3D/max2w3d/bchannel.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/boneicon.cpp b/Core/Tools/WW3D/max2w3d/boneicon.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/boneicon.cpp
rename to Core/Tools/WW3D/max2w3d/boneicon.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/boneicon.h b/Core/Tools/WW3D/max2w3d/boneicon.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/boneicon.h
rename to Core/Tools/WW3D/max2w3d/boneicon.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/bpick.cpp b/Core/Tools/WW3D/max2w3d/bpick.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/bpick.cpp
rename to Core/Tools/WW3D/max2w3d/bpick.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/bpick.h b/Core/Tools/WW3D/max2w3d/bpick.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/bpick.h
rename to Core/Tools/WW3D/max2w3d/bpick.h
diff --git a/Generals/Code/Tools/WW3D/max2w3d/changes.txt b/Core/Tools/WW3D/max2w3d/changes.txt
similarity index 100%
rename from Generals/Code/Tools/WW3D/max2w3d/changes.txt
rename to Core/Tools/WW3D/max2w3d/changes.txt
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/colboxsave.cpp b/Core/Tools/WW3D/max2w3d/colboxsave.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/colboxsave.cpp
rename to Core/Tools/WW3D/max2w3d/colboxsave.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/colboxsave.h b/Core/Tools/WW3D/max2w3d/colboxsave.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/colboxsave.h
rename to Core/Tools/WW3D/max2w3d/colboxsave.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/dazzlesave.cpp b/Core/Tools/WW3D/max2w3d/dazzlesave.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/dazzlesave.cpp
rename to Core/Tools/WW3D/max2w3d/dazzlesave.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/dazzlesave.h b/Core/Tools/WW3D/max2w3d/dazzlesave.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/dazzlesave.h
rename to Core/Tools/WW3D/max2w3d/dazzlesave.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/dllmain.cpp b/Core/Tools/WW3D/max2w3d/dllmain.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/dllmain.cpp
rename to Core/Tools/WW3D/max2w3d/dllmain.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/dllmain.h b/Core/Tools/WW3D/max2w3d/dllmain.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/dllmain.h
rename to Core/Tools/WW3D/max2w3d/dllmain.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/exportlog.cpp b/Core/Tools/WW3D/max2w3d/exportlog.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/exportlog.cpp
rename to Core/Tools/WW3D/max2w3d/exportlog.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/exportlog.h b/Core/Tools/WW3D/max2w3d/exportlog.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/exportlog.h
rename to Core/Tools/WW3D/max2w3d/exportlog.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/floaterdialog.cpp b/Core/Tools/WW3D/max2w3d/floaterdialog.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/floaterdialog.cpp
rename to Core/Tools/WW3D/max2w3d/floaterdialog.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/floaterdialog.h b/Core/Tools/WW3D/max2w3d/floaterdialog.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/floaterdialog.h
rename to Core/Tools/WW3D/max2w3d/floaterdialog.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/gamemaps.cpp b/Core/Tools/WW3D/max2w3d/gamemaps.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/gamemaps.cpp
rename to Core/Tools/WW3D/max2w3d/gamemaps.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/gamemaps.h b/Core/Tools/WW3D/max2w3d/gamemaps.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/gamemaps.h
rename to Core/Tools/WW3D/max2w3d/gamemaps.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/gamemtl.h b/Core/Tools/WW3D/max2w3d/gamemtl.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/gamemtl.h
rename to Core/Tools/WW3D/max2w3d/gamemtl.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/genlodextensiondialog.cpp b/Core/Tools/WW3D/max2w3d/genlodextensiondialog.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/genlodextensiondialog.cpp
rename to Core/Tools/WW3D/max2w3d/genlodextensiondialog.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/genlodextensiondialog.h b/Core/Tools/WW3D/max2w3d/genlodextensiondialog.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/genlodextensiondialog.h
rename to Core/Tools/WW3D/max2w3d/genlodextensiondialog.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/genmtlnamesdialog.cpp b/Core/Tools/WW3D/max2w3d/genmtlnamesdialog.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/genmtlnamesdialog.cpp
rename to Core/Tools/WW3D/max2w3d/genmtlnamesdialog.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/genmtlnamesdialog.h b/Core/Tools/WW3D/max2w3d/genmtlnamesdialog.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/genmtlnamesdialog.h
rename to Core/Tools/WW3D/max2w3d/genmtlnamesdialog.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/gennamesdialog.cpp b/Core/Tools/WW3D/max2w3d/gennamesdialog.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/gennamesdialog.cpp
rename to Core/Tools/WW3D/max2w3d/gennamesdialog.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/gennamesdialog.h b/Core/Tools/WW3D/max2w3d/gennamesdialog.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/gennamesdialog.h
rename to Core/Tools/WW3D/max2w3d/gennamesdialog.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/geometryexportcontext.h b/Core/Tools/WW3D/max2w3d/geometryexportcontext.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/geometryexportcontext.h
rename to Core/Tools/WW3D/max2w3d/geometryexportcontext.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/geometryexporttask.cpp b/Core/Tools/WW3D/max2w3d/geometryexporttask.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/geometryexporttask.cpp
rename to Core/Tools/WW3D/max2w3d/geometryexporttask.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/geometryexporttask.h b/Core/Tools/WW3D/max2w3d/geometryexporttask.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/geometryexporttask.h
rename to Core/Tools/WW3D/max2w3d/geometryexporttask.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/gmtldlg.cpp b/Core/Tools/WW3D/max2w3d/gmtldlg.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/gmtldlg.cpp
rename to Core/Tools/WW3D/max2w3d/gmtldlg.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/gridsnapmodifier.cpp b/Core/Tools/WW3D/max2w3d/gridsnapmodifier.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/gridsnapmodifier.cpp
rename to Core/Tools/WW3D/max2w3d/gridsnapmodifier.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/gridsnapmodifier.h b/Core/Tools/WW3D/max2w3d/gridsnapmodifier.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/gridsnapmodifier.h
rename to Core/Tools/WW3D/max2w3d/gridsnapmodifier.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/hiersave.cpp b/Core/Tools/WW3D/max2w3d/hiersave.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/hiersave.cpp
rename to Core/Tools/WW3D/max2w3d/hiersave.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/hiersave.h b/Core/Tools/WW3D/max2w3d/hiersave.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/hiersave.h
rename to Core/Tools/WW3D/max2w3d/hiersave.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/hlodsave.cpp b/Core/Tools/WW3D/max2w3d/hlodsave.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/hlodsave.cpp
rename to Core/Tools/WW3D/max2w3d/hlodsave.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/hlodsave.h b/Core/Tools/WW3D/max2w3d/hlodsave.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/hlodsave.h
rename to Core/Tools/WW3D/max2w3d/hlodsave.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/logdlg.cpp b/Core/Tools/WW3D/max2w3d/logdlg.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/logdlg.cpp
rename to Core/Tools/WW3D/max2w3d/logdlg.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/logdlg.h b/Core/Tools/WW3D/max2w3d/logdlg.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/logdlg.h
rename to Core/Tools/WW3D/max2w3d/logdlg.h
diff --git a/Generals/Code/Tools/WW3D/max2w3d/max2w3d.def b/Core/Tools/WW3D/max2w3d/max2w3d.def
similarity index 100%
rename from Generals/Code/Tools/WW3D/max2w3d/max2w3d.def
rename to Core/Tools/WW3D/max2w3d/max2w3d.def
diff --git a/Generals/Code/Tools/WW3D/max2w3d/max2w3d.rc b/Core/Tools/WW3D/max2w3d/max2w3d.rc
similarity index 100%
rename from Generals/Code/Tools/WW3D/max2w3d/max2w3d.rc
rename to Core/Tools/WW3D/max2w3d/max2w3d.rc
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/maxworldinfo.cpp b/Core/Tools/WW3D/max2w3d/maxworldinfo.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/maxworldinfo.cpp
rename to Core/Tools/WW3D/max2w3d/maxworldinfo.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/maxworldinfo.h b/Core/Tools/WW3D/max2w3d/maxworldinfo.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/maxworldinfo.h
rename to Core/Tools/WW3D/max2w3d/maxworldinfo.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/meshbuild.cpp b/Core/Tools/WW3D/max2w3d/meshbuild.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/meshbuild.cpp
rename to Core/Tools/WW3D/max2w3d/meshbuild.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/meshbuild.h b/Core/Tools/WW3D/max2w3d/meshbuild.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/meshbuild.h
rename to Core/Tools/WW3D/max2w3d/meshbuild.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/meshcon.cpp b/Core/Tools/WW3D/max2w3d/meshcon.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/meshcon.cpp
rename to Core/Tools/WW3D/max2w3d/meshcon.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/meshcon.h b/Core/Tools/WW3D/max2w3d/meshcon.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/meshcon.h
rename to Core/Tools/WW3D/max2w3d/meshcon.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/meshsave.cpp b/Core/Tools/WW3D/max2w3d/meshsave.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/meshsave.cpp
rename to Core/Tools/WW3D/max2w3d/meshsave.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/meshsave.h b/Core/Tools/WW3D/max2w3d/meshsave.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/meshsave.h
rename to Core/Tools/WW3D/max2w3d/meshsave.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/motion.cpp b/Core/Tools/WW3D/max2w3d/motion.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/motion.cpp
rename to Core/Tools/WW3D/max2w3d/motion.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/motion.h b/Core/Tools/WW3D/max2w3d/motion.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/motion.h
rename to Core/Tools/WW3D/max2w3d/motion.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/namedsel.cpp b/Core/Tools/WW3D/max2w3d/namedsel.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/namedsel.cpp
rename to Core/Tools/WW3D/max2w3d/namedsel.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/namedsel.h b/Core/Tools/WW3D/max2w3d/namedsel.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/namedsel.h
rename to Core/Tools/WW3D/max2w3d/namedsel.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/nullsave.cpp b/Core/Tools/WW3D/max2w3d/nullsave.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/nullsave.cpp
rename to Core/Tools/WW3D/max2w3d/nullsave.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/nullsave.h b/Core/Tools/WW3D/max2w3d/nullsave.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/nullsave.h
rename to Core/Tools/WW3D/max2w3d/nullsave.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/presetexportoptionsdialog.cpp b/Core/Tools/WW3D/max2w3d/presetexportoptionsdialog.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/presetexportoptionsdialog.cpp
rename to Core/Tools/WW3D/max2w3d/presetexportoptionsdialog.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/presetexportoptionsdialog.h b/Core/Tools/WW3D/max2w3d/presetexportoptionsdialog.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/presetexportoptionsdialog.h
rename to Core/Tools/WW3D/max2w3d/presetexportoptionsdialog.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/rcmenu.cpp b/Core/Tools/WW3D/max2w3d/rcmenu.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/rcmenu.cpp
rename to Core/Tools/WW3D/max2w3d/rcmenu.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/rcmenu.h b/Core/Tools/WW3D/max2w3d/rcmenu.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/rcmenu.h
rename to Core/Tools/WW3D/max2w3d/rcmenu.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/resource.h b/Core/Tools/WW3D/max2w3d/resource.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/resource.h
rename to Core/Tools/WW3D/max2w3d/resource.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/simpdib.cpp b/Core/Tools/WW3D/max2w3d/simpdib.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/simpdib.cpp
rename to Core/Tools/WW3D/max2w3d/simpdib.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/simpdib.h b/Core/Tools/WW3D/max2w3d/simpdib.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/simpdib.h
rename to Core/Tools/WW3D/max2w3d/simpdib.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/skin.cpp b/Core/Tools/WW3D/max2w3d/skin.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/skin.cpp
rename to Core/Tools/WW3D/max2w3d/skin.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/skin.h b/Core/Tools/WW3D/max2w3d/skin.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/skin.h
rename to Core/Tools/WW3D/max2w3d/skin.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/skindata.cpp b/Core/Tools/WW3D/max2w3d/skindata.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/skindata.cpp
rename to Core/Tools/WW3D/max2w3d/skindata.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/skindata.h b/Core/Tools/WW3D/max2w3d/skindata.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/skindata.h
rename to Core/Tools/WW3D/max2w3d/skindata.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/util.cpp b/Core/Tools/WW3D/max2w3d/util.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/util.cpp
rename to Core/Tools/WW3D/max2w3d/util.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/util.h b/Core/Tools/WW3D/max2w3d/util.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/util.h
rename to Core/Tools/WW3D/max2w3d/util.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/vchannel.cpp b/Core/Tools/WW3D/max2w3d/vchannel.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/vchannel.cpp
rename to Core/Tools/WW3D/max2w3d/vchannel.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/vchannel.h b/Core/Tools/WW3D/max2w3d/vchannel.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/vchannel.h
rename to Core/Tools/WW3D/max2w3d/vchannel.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/vxl.cpp b/Core/Tools/WW3D/max2w3d/vxl.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/vxl.cpp
rename to Core/Tools/WW3D/max2w3d/vxl.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/vxl.h b/Core/Tools/WW3D/max2w3d/vxl.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/vxl.h
rename to Core/Tools/WW3D/max2w3d/vxl.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/vxldbg.cpp b/Core/Tools/WW3D/max2w3d/vxldbg.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/vxldbg.cpp
rename to Core/Tools/WW3D/max2w3d/vxldbg.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/vxldbg.h b/Core/Tools/WW3D/max2w3d/vxldbg.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/vxldbg.h
rename to Core/Tools/WW3D/max2w3d/vxldbg.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/vxllayer.cpp b/Core/Tools/WW3D/max2w3d/vxllayer.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/vxllayer.cpp
rename to Core/Tools/WW3D/max2w3d/vxllayer.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/vxllayer.h b/Core/Tools/WW3D/max2w3d/vxllayer.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/vxllayer.h
rename to Core/Tools/WW3D/max2w3d/vxllayer.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/w3d_file.h b/Core/Tools/WW3D/max2w3d/w3d_file.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/w3d_file.h
rename to Core/Tools/WW3D/max2w3d/w3d_file.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/w3d_obsolete.h b/Core/Tools/WW3D/max2w3d/w3d_obsolete.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/w3d_obsolete.h
rename to Core/Tools/WW3D/max2w3d/w3d_obsolete.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/w3dappdata.cpp b/Core/Tools/WW3D/max2w3d/w3dappdata.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/w3dappdata.cpp
rename to Core/Tools/WW3D/max2w3d/w3dappdata.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/w3dappdata.h b/Core/Tools/WW3D/max2w3d/w3dappdata.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/w3dappdata.h
rename to Core/Tools/WW3D/max2w3d/w3dappdata.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/w3ddesc.cpp b/Core/Tools/WW3D/max2w3d/w3ddesc.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/w3ddesc.cpp
rename to Core/Tools/WW3D/max2w3d/w3ddesc.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/w3ddesc.h b/Core/Tools/WW3D/max2w3d/w3ddesc.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/w3ddesc.h
rename to Core/Tools/WW3D/max2w3d/w3ddesc.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/w3ddlg.cpp b/Core/Tools/WW3D/max2w3d/w3ddlg.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/w3ddlg.cpp
rename to Core/Tools/WW3D/max2w3d/w3ddlg.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/w3ddlg.h b/Core/Tools/WW3D/max2w3d/w3ddlg.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/w3ddlg.h
rename to Core/Tools/WW3D/max2w3d/w3ddlg.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/w3dexp.cpp b/Core/Tools/WW3D/max2w3d/w3dexp.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/w3dexp.cpp
rename to Core/Tools/WW3D/max2w3d/w3dexp.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/w3dexp.h b/Core/Tools/WW3D/max2w3d/w3dexp.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/w3dexp.h
rename to Core/Tools/WW3D/max2w3d/w3dexp.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/w3dmtl.cpp b/Core/Tools/WW3D/max2w3d/w3dmtl.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/w3dmtl.cpp
rename to Core/Tools/WW3D/max2w3d/w3dmtl.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/w3dmtl.h b/Core/Tools/WW3D/max2w3d/w3dmtl.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/w3dmtl.h
rename to Core/Tools/WW3D/max2w3d/w3dmtl.h
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/w3dutil.cpp b/Core/Tools/WW3D/max2w3d/w3dutil.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/w3dutil.cpp
rename to Core/Tools/WW3D/max2w3d/w3dutil.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/max2w3d/w3dutil.h b/Core/Tools/WW3D/max2w3d/w3dutil.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/max2w3d/w3dutil.h
rename to Core/Tools/WW3D/max2w3d/w3dutil.h
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/BITTYPE.H b/Core/Tools/WW3D/pluglib/BITTYPE.H
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/BITTYPE.H
rename to Core/Tools/WW3D/pluglib/BITTYPE.H
diff --git a/Generals/Code/Tools/WW3D/pluglib/CMakeLists.txt b/Core/Tools/WW3D/pluglib/CMakeLists.txt
similarity index 80%
rename from Generals/Code/Tools/WW3D/pluglib/CMakeLists.txt
rename to Core/Tools/WW3D/pluglib/CMakeLists.txt
index 11d7770c53d..9b286ad6598 100644
--- a/Generals/Code/Tools/WW3D/pluglib/CMakeLists.txt
+++ b/Core/Tools/WW3D/pluglib/CMakeLists.txt
@@ -53,9 +53,9 @@ set(PLUGLIB_SRC
"WWmatrix3.h"
)
-add_library(g_pluglib STATIC)
-set_target_properties(g_pluglib PROPERTIES OUTPUT_NAME pluglib)
+add_library(core_pluglib STATIC)
+set_target_properties(core_pluglib PROPERTIES OUTPUT_NAME pluglib)
-target_sources(g_pluglib PRIVATE ${PLUGLIB_SRC})
+target_sources(core_pluglib PRIVATE ${PLUGLIB_SRC})
-target_link_libraries(g_pluglib PRIVATE maxsdk)
+target_link_libraries(core_pluglib PRIVATE maxsdk)
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/EULER.CPP b/Core/Tools/WW3D/pluglib/EULER.CPP
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/EULER.CPP
rename to Core/Tools/WW3D/pluglib/EULER.CPP
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/EULER.H b/Core/Tools/WW3D/pluglib/EULER.H
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/EULER.H
rename to Core/Tools/WW3D/pluglib/EULER.H
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/PROGRESS.H b/Core/Tools/WW3D/pluglib/PROGRESS.H
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/PROGRESS.H
rename to Core/Tools/WW3D/pluglib/PROGRESS.H
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/Vector.CPP b/Core/Tools/WW3D/pluglib/Vector.CPP
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/Vector.CPP
rename to Core/Tools/WW3D/pluglib/Vector.CPP
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/Vector.H b/Core/Tools/WW3D/pluglib/Vector.H
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/Vector.H
rename to Core/Tools/WW3D/pluglib/Vector.H
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/WWmatrix3.cpp b/Core/Tools/WW3D/pluglib/WWmatrix3.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/WWmatrix3.cpp
rename to Core/Tools/WW3D/pluglib/WWmatrix3.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/WWmatrix3.h b/Core/Tools/WW3D/pluglib/WWmatrix3.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/WWmatrix3.h
rename to Core/Tools/WW3D/pluglib/WWmatrix3.h
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/aaplane.h b/Core/Tools/WW3D/pluglib/aaplane.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/aaplane.h
rename to Core/Tools/WW3D/pluglib/aaplane.h
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/always.h b/Core/Tools/WW3D/pluglib/always.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/always.h
rename to Core/Tools/WW3D/pluglib/always.h
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/bool.h b/Core/Tools/WW3D/pluglib/bool.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/bool.h
rename to Core/Tools/WW3D/pluglib/bool.h
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/borlandc.h b/Core/Tools/WW3D/pluglib/borlandc.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/borlandc.h
rename to Core/Tools/WW3D/pluglib/borlandc.h
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/chunkio.cpp b/Core/Tools/WW3D/pluglib/chunkio.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/chunkio.cpp
rename to Core/Tools/WW3D/pluglib/chunkio.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/chunkio.h b/Core/Tools/WW3D/pluglib/chunkio.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/chunkio.h
rename to Core/Tools/WW3D/pluglib/chunkio.h
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/errclass.h b/Core/Tools/WW3D/pluglib/errclass.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/errclass.h
rename to Core/Tools/WW3D/pluglib/errclass.h
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/hashcalc.h b/Core/Tools/WW3D/pluglib/hashcalc.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/hashcalc.h
rename to Core/Tools/WW3D/pluglib/hashcalc.h
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/hsv.cpp b/Core/Tools/WW3D/pluglib/hsv.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/hsv.cpp
rename to Core/Tools/WW3D/pluglib/hsv.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/hsv.h b/Core/Tools/WW3D/pluglib/hsv.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/hsv.h
rename to Core/Tools/WW3D/pluglib/hsv.h
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/iostruct.h b/Core/Tools/WW3D/pluglib/iostruct.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/iostruct.h
rename to Core/Tools/WW3D/pluglib/iostruct.h
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/jshell.cpp b/Core/Tools/WW3D/pluglib/jshell.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/jshell.cpp
rename to Core/Tools/WW3D/pluglib/jshell.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/matrix3d.cpp b/Core/Tools/WW3D/pluglib/matrix3d.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/matrix3d.cpp
rename to Core/Tools/WW3D/pluglib/matrix3d.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/matrix3d.h b/Core/Tools/WW3D/pluglib/matrix3d.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/matrix3d.h
rename to Core/Tools/WW3D/pluglib/matrix3d.h
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/matrix4.cpp b/Core/Tools/WW3D/pluglib/matrix4.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/matrix4.cpp
rename to Core/Tools/WW3D/pluglib/matrix4.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/matrix4.h b/Core/Tools/WW3D/pluglib/matrix4.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/matrix4.h
rename to Core/Tools/WW3D/pluglib/matrix4.h
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/nodefilt.cpp b/Core/Tools/WW3D/pluglib/nodefilt.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/nodefilt.cpp
rename to Core/Tools/WW3D/pluglib/nodefilt.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/nodefilt.h b/Core/Tools/WW3D/pluglib/nodefilt.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/nodefilt.h
rename to Core/Tools/WW3D/pluglib/nodefilt.h
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/nodelist.cpp b/Core/Tools/WW3D/pluglib/nodelist.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/nodelist.cpp
rename to Core/Tools/WW3D/pluglib/nodelist.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/nodelist.h b/Core/Tools/WW3D/pluglib/nodelist.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/nodelist.h
rename to Core/Tools/WW3D/pluglib/nodelist.h
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/noinit.h b/Core/Tools/WW3D/pluglib/noinit.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/noinit.h
rename to Core/Tools/WW3D/pluglib/noinit.h
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/palette.cpp b/Core/Tools/WW3D/pluglib/palette.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/palette.cpp
rename to Core/Tools/WW3D/pluglib/palette.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/palette.h b/Core/Tools/WW3D/pluglib/palette.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/palette.h
rename to Core/Tools/WW3D/pluglib/palette.h
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/plane.h b/Core/Tools/WW3D/pluglib/plane.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/plane.h
rename to Core/Tools/WW3D/pluglib/plane.h
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/rawfile.cpp b/Core/Tools/WW3D/pluglib/rawfile.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/rawfile.cpp
rename to Core/Tools/WW3D/pluglib/rawfile.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/rawfile.h b/Core/Tools/WW3D/pluglib/rawfile.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/rawfile.h
rename to Core/Tools/WW3D/pluglib/rawfile.h
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/realcrc.cpp b/Core/Tools/WW3D/pluglib/realcrc.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/realcrc.cpp
rename to Core/Tools/WW3D/pluglib/realcrc.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/realcrc.h b/Core/Tools/WW3D/pluglib/realcrc.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/realcrc.h
rename to Core/Tools/WW3D/pluglib/realcrc.h
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/rgb.cpp b/Core/Tools/WW3D/pluglib/rgb.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/rgb.cpp
rename to Core/Tools/WW3D/pluglib/rgb.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/rgb.h b/Core/Tools/WW3D/pluglib/rgb.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/rgb.h
rename to Core/Tools/WW3D/pluglib/rgb.h
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/uarray.h b/Core/Tools/WW3D/pluglib/uarray.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/uarray.h
rename to Core/Tools/WW3D/pluglib/uarray.h
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/vector2.h b/Core/Tools/WW3D/pluglib/vector2.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/vector2.h
rename to Core/Tools/WW3D/pluglib/vector2.h
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/vector3.h b/Core/Tools/WW3D/pluglib/vector3.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/vector3.h
rename to Core/Tools/WW3D/pluglib/vector3.h
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/vector3i.h b/Core/Tools/WW3D/pluglib/vector3i.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/vector3i.h
rename to Core/Tools/WW3D/pluglib/vector3i.h
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/vector4.h b/Core/Tools/WW3D/pluglib/vector4.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/vector4.h
rename to Core/Tools/WW3D/pluglib/vector4.h
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/visualc.h b/Core/Tools/WW3D/pluglib/visualc.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/visualc.h
rename to Core/Tools/WW3D/pluglib/visualc.h
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/w3d_file.h b/Core/Tools/WW3D/pluglib/w3d_file.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/w3d_file.h
rename to Core/Tools/WW3D/pluglib/w3d_file.h
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/w3dquat.cpp b/Core/Tools/WW3D/pluglib/w3dquat.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/w3dquat.cpp
rename to Core/Tools/WW3D/pluglib/w3dquat.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/w3dquat.h b/Core/Tools/WW3D/pluglib/w3dquat.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/w3dquat.h
rename to Core/Tools/WW3D/pluglib/w3dquat.h
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/watcom.h b/Core/Tools/WW3D/pluglib/watcom.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/watcom.h
rename to Core/Tools/WW3D/pluglib/watcom.h
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/win.h b/Core/Tools/WW3D/pluglib/win.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/win.h
rename to Core/Tools/WW3D/pluglib/win.h
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/wwfile.h b/Core/Tools/WW3D/pluglib/wwfile.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/wwfile.h
rename to Core/Tools/WW3D/pluglib/wwfile.h
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/wwmath.cpp b/Core/Tools/WW3D/pluglib/wwmath.cpp
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/wwmath.cpp
rename to Core/Tools/WW3D/pluglib/wwmath.cpp
diff --git a/GeneralsMD/Code/Tools/WW3D/pluglib/wwmath.h b/Core/Tools/WW3D/pluglib/wwmath.h
similarity index 100%
rename from GeneralsMD/Code/Tools/WW3D/pluglib/wwmath.h
rename to Core/Tools/WW3D/pluglib/wwmath.h
diff --git a/Generals/Code/Tools/CMakeLists.txt b/Generals/Code/Tools/CMakeLists.txt
index 77983a2ec42..fa1a95c2248 100644
--- a/Generals/Code/Tools/CMakeLists.txt
+++ b/Generals/Code/Tools/CMakeLists.txt
@@ -24,5 +24,4 @@ if(RTS_BUILD_GENERALS_EXTRAS)
add_subdirectory(timingTest)
add_subdirectory(versionUpdate)
add_subdirectory(wolSetup)
- add_subdirectory(WW3D)
endif()
diff --git a/Generals/Code/Tools/WW3D/max2w3d/AlphaModifier.cpp b/Generals/Code/Tools/WW3D/max2w3d/AlphaModifier.cpp
deleted file mode 100644
index e37c720efaa..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/AlphaModifier.cpp
+++ /dev/null
@@ -1,477 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project name : Buccaneer Bay *
- * *
- * File name : AlphaModifier.cpp *
- * *
- * Programmer : Mike Lytle *
- * *
- * Start date : 11/1/1999 *
- * *
- * Last update : 11/1/1999 *
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#include "AlphaModifier.h"
-
-enum Alpha_Messages
-{
- AM_NOTHING,
- AM_UPDATE_DATA,
- AM_INITIALIZE,
- AM_BOX_CHECKED,
-};
-
-enum Dialog_Controls
-{
- DL_EDIT_VALUE,
- DL_FIND_CHECK_BOX,
-};
-
-void AlphaModifierClass::ModifyObject(TimeValue t, ModContext &mc, ObjectState *os, INode *node)
-{
- if (!os->obj->IsSubClassOf(triObjectClassID))
- {
- return;
- }
-
-
- // Get a mesh from input object
- TriObject *object = (TriObject*)os->obj;
-
- Mesh *mesh = &object->mesh;
-
- assert(mesh);
-
- int numVert = mesh->getNumVerts();
- int i = 0;
- float *vdata = NULL;
-
- // Get parameters from pblock
- float sparam = 0.0f;
- Interval valid = LocalValidity(t);
- int pass = 1;
-
- pblock->GetValue(DL_EDIT_VALUE, t, sparam, valid);
-
- // If needed a control could be put into the dialog box to specify which
- // pass to apply the alpha values to. At this time, it was decided to
- // not implement this because of the complexity to the artist and the
- // performance issues in game.
- //pblock->GetValue(DL_EDIT_PASS, t, pass, valid);
-
-
- // Start from 0.
- pass -= 1;
- assert(pass >= 0);
-
- // Use a channel for each pass.
- vdata = mesh->vertexFloat(ALPHA_VERTEX_CHANNEL + pass);
-
- if (!vdata)
- {
- // Turn on the channel for vertex alpha support.
- mesh->setVDataSupport(ALPHA_VERTEX_CHANNEL + pass);
- vdata = mesh->vertexFloat(ALPHA_VERTEX_CHANNEL + pass);
-
- assert(vdata);
-
- for (i = 0; i < numVert; i++)
- {
- if (mesh->VertSel()[i])
- {
- vdata[i] = 0.0f;
- }
- }
-
- }
-
- // Tracks the state of the FIND check box.
- int box_checked = 0;
-
-
- if (Message == AM_UPDATE_DATA)
- {
- // The user has updated the dialog box, so update the data.
- assert(vdata);
-
- pblock->GetValue(DL_FIND_CHECK_BOX, t, box_checked, valid);
- if (!box_checked)
- {
- for (i = 0; i < numVert; i++)
- {
- if (SelectedVertices[i])
- {
- vdata[i] = sparam;
- }
- }
- }
- }
-
- if (Message == AM_BOX_CHECKED)
- {
- pblock->GetValue(DL_FIND_CHECK_BOX, t, box_checked, valid);
- }
-
-
- // The user is trying to find vertices with certain values.
- if (box_checked)
- {
- assert(vdata);
- // Find the vertices that have the user entered value.
- for (i = 0; i < numVert; i++)
- {
- if (vdata[i] == sparam)
- {
- mesh->VertSel().Set(i);
- SelectedVertices.Set(i);
- }
- else
- {
- mesh->VertSel().Clear(i);
- SelectedVertices.Clear(i);
- }
-
- }
-
- }
-
- if (Message == AM_INITIALIZE)
- {
- assert(vdata);
-
- SelectedVertices = mesh->VertSel();
-
- for (i = 0; i < numVert; i++)
- {
- if (SelectedVertices[i])
- {
- // Set the value in the dialog box to the value of the
- // first selected vertex.
- pblock->SetValue(DL_EDIT_VALUE, t, vdata[i]);
- break;
- }
- }
-
- }
-
-
- // Always select the vertices that have been saved by the modifier.
- // This must be done because the mesh changes each time ModfiyObject is called.
- for (i = 0; i < numVert; i++)
- {
- if (SelectedVertices[i])
- {
- mesh->VertSel().Set(i);
- }
- else
- {
- mesh->VertSel().Clear(i);
- }
-
- }
-
- // Display the vertices.
- mesh->SetDispFlag(DISP_SELVERTS | DISP_VERTTICKS);
- mesh->selLevel = MESH_VERTEX;
- object->UpdateValidity(SELECT_CHAN_NUM, object->ChannelValidity (t, SELECT_CHAN_NUM));
-
- // Clear messages.
- Message = AM_NOTHING;
-}
-
-
-
-
-/*===========================================================================*\
- | NotifyInputChanged is called each time the input object is changed in some way
- | We can find out how it was changed by checking partID and message
-\*===========================================================================*/
-
-void AlphaModifierClass::NotifyInputChanged(Interval changeInt, PartID partID, RefMessage message, ModContext *mc)
-{
- if( (partID&PART_TOPO) || (partID&PART_GEOM) || (partID&PART_SELECT) )
- {
- NotifyDependents(FOREVER, PART_OBJ, REFMSG_CHANGE);
- }
-}
-
-
-/*===========================================================================*\
- | Class Descriptor OSM
-\*===========================================================================*/
-
-class AlphaClassDesc : public ClassDesc2 {
- public:
- int IsPublic() { return TRUE; }
- void * Create( BOOL loading ) { return new AlphaModifierClass; }
- const TCHAR * ClassName() { return Get_String(IDS_ALPHA_MODIFIER_CLASS); }
- SClass_ID SuperClassID() { return OSM_CLASS_ID; }
- Class_ID ClassID() { return ALPHA_MODIFIER_CLASSID; }
- const TCHAR* Category() { return _T(""); }
-
- HINSTANCE HInstance() { return AppInstance; }
-
- // Hardwired name, used by MAX Script as unique identifier
- const TCHAR* InternalName() { return _T("AlphaMod"); }
-};
-
-static AlphaClassDesc AlphaCD;
-ClassDesc* Get_Alpha_Desc() {return &AlphaCD;}
-
-/*===========================================================================*\
- | Paramblock2 Descriptor
-\*===========================================================================*/
-static ParamBlockDesc2 alpha_param_blk
-(
- //rollout
- 0, _T("AlphaModifierParams"), 0, &AlphaCD, P_AUTO_CONSTRUCT + P_AUTO_UI, 0,
- IDD_ALPHA_MODIFIER, IDS_PARAMETERS, 0, 0, NULL,
-
- // params
-
- DL_EDIT_VALUE, _T("Custom Data Value"), TYPE_FLOAT, P_ANIMATABLE, IDS_ALPHA_MODIFIER_CLASS,
- p_default, 0.0f,
- p_range, 0.0f, 100.0f,
- p_ui, TYPE_SPINNER, EDITTYPE_FLOAT, IDC_ALPHA_EDIT, IDC_ALPHA_SPIN, 1.0f,
- end,
-
- DL_FIND_CHECK_BOX, _T("1 Custom Data Value"), TYPE_BOOL, 0, IDS_ALPHA_MODIFIER_CLASS,
- p_default, FALSE,
- p_ui, TYPE_SINGLECHEKBOX, IDC_ALPHA_CHECKBOX,
- p_enabled, TRUE,
- end,
-
-/*
- DL_EDIT_PASS, _T("2 Custom Data Value"), TYPE_INT, P_ANIMATABLE, IDS_ALPHA_MODIFIER_CLASS,
- p_default, 1,
- p_range, 1, 4,
- p_ui, TYPE_SPINNER, EDITTYPE_INT, IDC_ALPHA_EDIT2, IDC_ALPHA_SPIN2, 1.0,
- end,
-*/
-
- end
-);
-
-
-/*===========================================================================*\
- | Basic implementation of a dialog handler
-\*===========================================================================*/
-
-BOOL AlphaModDlgProc::DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- int id = LOWORD(wParam);
- int code = HIWORD(wParam);
-
- switch (msg)
- {
- case WM_INITDIALOG:
- AlphaModifier->Message = AM_INITIALIZE;
- break;
- case WM_DESTROY:
- break;
- case WM_COMMAND:
- switch (code)
- {
- case EN_UPDATE:
- break;
- case EN_SETFOCUS:
- break;
- case EN_KILLFOCUS:
- break;
- case EN_CHANGE:
- break;
- }
- if (id == IDC_ALPHA_EDIT)
- {
- AlphaModifier->Message = AM_UPDATE_DATA;
- }
- if (id == IDC_ALPHA_CHECKBOX)
- {
- AlphaModifier->Message = AM_BOX_CHECKED;
- }
- break;
-
- case WM_NOTIFY:
- if (id == IDC_ALPHA_EDIT)
- {
- AlphaModifier->Message = AM_UPDATE_DATA;
- }
- break;
-
- default:
- break;
-
-
- }
- return FALSE;
-}
-
-
-/*===========================================================================*\
- | Constructor
- | Ask the ClassDesc2 to make the AUTO_CONSTRUCT paramblocks and wire them in
-\*===========================================================================*/
-
-AlphaModifierClass::AlphaModifierClass()
-{
- AlphaCD.MakeAutoParamBlocks(this);
- assert(pblock);
- Message = 0;
-}
-
-
-/*===========================================================================*\
- | Invalidate our UI (or the recently changed parameter)
-\*===========================================================================*/
-
-void AlphaModifierClass::InvalidateUI()
-{
- alpha_param_blk.InvalidateUI(pblock->LastNotifyParamID());
-}
-
-
-
-/*===========================================================================*\
- | Open and Close dialog UIs
- | We ask the ClassDesc2 to handle Beginning and Ending EditParams for us
-\*===========================================================================*/
-
-void AlphaModifierClass::BeginEditParams( IObjParam *ip, ULONG flags,Animatable *prev )
-{
-
- AlphaCD.BeginEditParams(ip, this, flags, prev);
-
- alpha_param_blk.SetUserDlgProc(new AlphaModDlgProc(this));
-}
-
-void AlphaModifierClass::EndEditParams( IObjParam *ip, ULONG flags,Animatable *next )
-{
- AlphaCD.EndEditParams(ip, this, flags, next);
-}
-
-
-
-/*===========================================================================*\
- | Standard clone
-\*===========================================================================*/
-
-
-RefTargetHandle AlphaModifierClass::Clone(RemapDir& remap)
-{
- AlphaModifierClass* newmod = new AlphaModifierClass();
- newmod->ReplaceReference(0,pblock->Clone(remap));
- return(newmod);
-}
-
-
-
-
-/*===========================================================================*\
- | Subanim & References support
-\*===========================================================================*/
-
-Animatable* AlphaModifierClass::SubAnim(int i)
-{
- switch (i)
- {
- case 0: return pblock;
- default: return NULL;
- }
-}
-
-TSTR AlphaModifierClass::SubAnimName(int i)
-{
- switch (i)
- {
- case 0: return Get_String(IDS_PARAMETERS);
- default: return _T("");
- }
-}
-
-RefTargetHandle AlphaModifierClass::GetReference(int i)
-{
- switch (i)
- {
- case 0: return pblock;
- default:
- assert(TRUE);
- return NULL;
- }
-}
-
-void AlphaModifierClass::SetReference(int i, RefTargetHandle rtarg)
-{
- switch (i)
- {
- case 0: pblock = (IParamBlock2*)rtarg; break;
- default:
- assert(TRUE);
- break;
- }
-}
-
-RefResult AlphaModifierClass::NotifyRefChanged
-(
- Interval changeInt,
- RefTargetHandle hTarget,
- PartID& partID,
- RefMessage message
-)
-{
- switch (message)
- {
- case REFMSG_CHANGE:
- {
- alpha_param_blk.InvalidateUI();
- }
- break;
- }
- return REF_SUCCEED;
-}
-
-
-
-
-/*===========================================================================*\
- | The validity of our parameters
- | Start at FOREVER, and intersect with the validity of each item
-\*===========================================================================*/
-
-Interval AlphaModifierClass::GetValidity(TimeValue t)
-{
- float f;
- Interval valid = FOREVER;
- pblock->GetValue(DL_EDIT_VALUE, t, f, valid);
- return valid;
-}
-
-Interval AlphaModifierClass::LocalValidity(TimeValue t)
-{
- return GetValidity(t);
-}
-
-
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/AlphaModifier.h b/Generals/Code/Tools/WW3D/max2w3d/AlphaModifier.h
deleted file mode 100644
index 732f5f539e5..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/AlphaModifier.h
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project name : Buccaneer Bay *
- * *
- * File name : AlphaModifier.h *
- * *
- * Programmer : Mike Lytle *
- * *
- * Start date : 11/1/1999 *
- * *
- * Last update : 11/1/1999 *
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#ifndef ALPHA_MODIFIER_H
-#define ALPHA_MODIFIER_H
-
-
-#include
-#include "iparamm2.h"
-#include "istdplug.h"
-#include "meshadj.h"
-#include "modstack.h"
-#include "macrorec.h"
-#include "resource.h"
-#include "dllmain.h"
-
-
-#define ALPHA_MODIFIER_CLASSID Class_ID(0x518970b3, 0x37d73373)
-
-
-extern ClassDesc* Get_Alpha_Desc();
-
-#define ALPHA_VERTEX_CHANNEL 10
-
-class AlphaModifierClass : public Modifier
-{
- public:
-
- // Global parameter block
- IParamBlock2 *pblock;
-
-
- //Constructor/Destructor
- AlphaModifierClass();
- ~AlphaModifierClass() {}
- void DeleteThis() { delete this;}
-
-
- // Plugin identification
- void GetClassName(TSTR& s) { s= TSTR(Get_String(IDS_ALPHA_MODIFIER_CLASS));}
- virtual Class_ID ClassID() { return ALPHA_MODIFIER_CLASSID;}
- TCHAR *GetObjectName() { return Get_String(IDS_ALPHA_MODIFIER_CLASS);}
-
-
- // Defines the behavior for this modifier
- // This is currently setup to be basic geometry
- // modification of deformable objects
- ChannelMask ChannelsUsed() {return PART_GEOM|PART_TOPO|PART_SELECT|PART_SUBSEL_TYPE;}
- ChannelMask ChannelsChanged() {return PART_GEOM|PART_TOPO|PART_SELECT|PART_SUBSEL_TYPE;}
- Class_ID InputType() { return triObjectClassID;}
- BOOL ChangeTopology() {return FALSE;}
-
-
- // Calculate the local validity from the parameters
- Interval LocalValidity(TimeValue t);
- Interval GetValidity(TimeValue t);
-
-
- // Object modification and notification of change
- void ModifyObject(TimeValue t, ModContext &mc, ObjectState *os, INode *node);
- void NotifyInputChanged(Interval changeInt, PartID partID, RefMessage message, ModContext *mc);
-
-
- // Reference support
- int NumRefs() { return 1;}
- 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);
-
- // SubAnim support
- int NumSubs() { return 0;}
- Animatable* SubAnim(int i);
- TSTR SubAnimName(int i);
-
- // Direct paramblock access
- int NumParamBlocks() {return 1;}
- IParamBlock2* GetParamBlock(int i) { return pblock;}
- IParamBlock2* GetParamBlockByID(BlockID id) {return (pblock->ID() == id) ? pblock : NULL;}
- int GetParamBlockIndex(int id) {return id;}
-
- // Does not use createmouse callbacks
- CreateMouseCallBack* GetCreateMouseCallBack() {return NULL;}
-
- // Load and unload our UI
- void BeginEditParams(IObjParam *ip, ULONG flags,Animatable *prev);
- void EndEditParams(IObjParam *ip, ULONG flags,Animatable *next);
- void InvalidateUI();
-
- // Message saved from window messages.
- int Message;
-
- // Selected vertices.
- BitArray SelectedVertices;
-};
-
-
-/*===========================================================================*\
- | Dialog Processor
-\*===========================================================================*/
-
-class AlphaModDlgProc : public ParamMap2UserDlgProc
-{
- public:
- AlphaModifierClass *AlphaModifier;
-
- AlphaModDlgProc() {}
- AlphaModDlgProc(AlphaModifierClass *alpha_m) {AlphaModifier = alpha_m;}
-
- BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
- void DeleteThis() {}
-
- void SetThing(ReferenceTarget *m) {AlphaModifier = (AlphaModifierClass*)m;}
-};
-
-
-#endif //ALPHA_MODIFIER_H
-
-
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/AppData.cpp b/Generals/Code/Tools/WW3D/max2w3d/AppData.cpp
deleted file mode 100644
index 2a57dd814ce..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/AppData.cpp
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : G *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/AppData.cpp $*
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 9/26/00 4:24p $*
- * *
- * $Revision:: 4 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-/*
-** AppData.cpp - Implementation of some Westwood
-** extensions to the MAXScript language.
-*/
-
-#include // Main MAXScript header
-#include // MAX* Wrapper objects
-#include // MAX String class
-#include // def_* functions to create static function headers
-
-#include "w3dutil.h" // W3DAppData*Struct accessor functions!
-#include "w3ddesc.h"
-
-
-/*
-** Let MAXScript know we're implementing new built-in functions.
-*/
-def_visible_primitive(copy_app_data, "wwCopyAppData");
-def_visible_primitive(set_origin_app_data, "wwSetOriginAppData");
-def_visible_primitive(get_hierarchy_file, "wwGetHierarchyFile");
-
-
-/*
-**
-** MAXScript Function:
-** wwCopyAppData - Usage: wwCopyAppData to_node from_node
-**
-** Copies all AppData associated with from_node to to_node.
-** This is needed for W3D flags such as Export Geometry
-** and Export Transform to get passed on to their
-** instances/copies/references.
-*/
-Value * copy_app_data_cf (Value **arg_list, int count)
-{
- // Verify the number and type of the arguments.
- check_arg_count("wwCopyAppData", 2, count);
- type_check(arg_list[0], MAXNode, "Target INode");
- type_check(arg_list[1], MAXNode, "Source INode");
-
- // Get the INode pointers that were passed in.
- INode *dest_node = arg_list[0]->to_node();
- INode *src_node = arg_list[1]->to_node();
-
- /*
- ** Copy W3DAppData0Struct
- */
- W3DAppData0Struct *app_data_0 = GetW3DAppData0(src_node);
- if (app_data_0 != NULL) {
-
- // App Data 0 is now obsolete, not fatal if we don't find one
- W3DAppData0Struct *copy_data_0 = new W3DAppData0Struct;
- if (copy_data_0 == NULL)
- throw RuntimeError("Out of memory.");
-
- // Copy the app data and give it to the target node.
- *copy_data_0 = *app_data_0;
- dest_node->AddAppDataChunk(W3DUtilityClassID, UTILITY_CLASS_ID, W3D_APPDATA_0,
- sizeof(W3DAppData0Struct), copy_data_0);
- }
-
- /*
- ** Copy W3DAppData1Struct
- */
- W3DAppData1Struct *app_data_1 = GetW3DAppData1(src_node);
- if (app_data_1 == NULL)
- throw RuntimeError("Unable to retrieve W3DAppData1Struct from object: ", arg_list[1]);
-
- W3DAppData1Struct *copy_data_1 = new W3DAppData1Struct;
- if (copy_data_1 == NULL)
- throw RuntimeError("Out of memory.");
-
- // Copy the app data and give it to the target node.
- *copy_data_1 = *app_data_1;
- dest_node->AddAppDataChunk(W3DUtilityClassID, UTILITY_CLASS_ID, W3D_APPDATA_1,
- sizeof(W3DAppData1Struct), copy_data_1);
-
-
- /*
- ** Copy W3DAppData2Struct
- */
- W3DAppData2Struct *app_data_2 = GetW3DAppData2(src_node);
- if (app_data_2 == NULL)
- throw RuntimeError("Unable to retrieve W3DAppData1Struct from object: ", arg_list[1]);
-
- W3DAppData2Struct *copy_data_2 = new W3DAppData2Struct;
- if (copy_data_2 == NULL)
- throw RuntimeError("Out of memory.");
-
- // Copy the app data and give it to the target node.
- *copy_data_2 = *app_data_2;
- dest_node->AddAppDataChunk(W3DUtilityClassID, UTILITY_CLASS_ID, W3D_APPDATA_2,
- sizeof(W3DAppData2Struct), copy_data_2);
-
- /*
- ** Copy W3DDazzleAppDataStruct if one is present.
- */
- W3DDazzleAppDataStruct *dazzle_app_data = GetW3DDazzleAppData(src_node);
- if (dazzle_app_data != NULL) {
-
- W3DDazzleAppDataStruct *copy_dazzle_data = new W3DDazzleAppDataStruct;
- if (copy_dazzle_data == NULL)
- throw RuntimeError("Out of memory.");
-
-
- // Copy the app data and give it to the target node.
- *copy_dazzle_data = *dazzle_app_data;
- dest_node->AddAppDataChunk(W3DUtilityClassID, UTILITY_CLASS_ID, W3D_DAZZLE_APPDATA,
- sizeof(W3DDazzleAppDataStruct), copy_dazzle_data);
- }
-
- return &ok;
-}
-
-
-
-/*
-**
-** MAXScript Function:
-** wwSetOriginAppData - Usage: wwSetOriginAppData origin_node
-**
-** Sets the AppData associated with the given node to values
-** appropriate to an origin. (ie. turn off Export Geometry and
-** Export Transform)
-*/
-Value * set_origin_app_data_cf (Value **arg_list, int count)
-{
- // Check the arguments that were passed to this function.
- check_arg_count("wwSetOriginAppData", 1, count);
- type_check(arg_list[0], MAXNode, "Origin INode");
-
- // Get the INode that we were given.
- INode *origin = arg_list[0]->to_node();
-
- // Get the node's W3DAppData2Struct, and modify it accordingly.
- W3DAppData2Struct *data = GetW3DAppData2(origin);
- if (data == NULL)
- throw RuntimeError("Unable to retrieve W3DAppData0Struct from object: ", arg_list[0]);
-
- // Turn off Export Geometry and Export Hierarchy.
- data->Enable_Export_Geometry(false);
- data->Enable_Export_Transform(false);
-
- return &ok;
-}
-
-/*
-**
-** MAXScript Function:
-** wwGetHierarchyFile - Usage: wwGetHierarchyFile()
-**
-** Returns the relative pathname of the file that will be loaded
-** during W3D export to get the hierarchy tree. If no such file
-** will be loaded, the return value is the MAXScript undefined.
-**
-*/
-Value * get_hierarchy_file_cf (Value **arg_list, int count)
-{
- // Check that we weren't passed any arguments.
- check_arg_count("wwGetHierarchyFile", 0, count);
-
- // Retrieve the export options from the scene.
- W3dExportOptionsStruct *options = NULL;
- AppDataChunk * appdata = MAXScript_interface->GetScenePointer()->GetAppDataChunk(W3D_EXPORTER_CLASS_ID,SCENE_EXPORT_CLASS_ID,0);
- if (appdata)
- options = (W3dExportOptionsStruct*)(appdata->data);
-
- // If we didn't get any options, return undefined.
- if (!options)
- return &undefined;
-
- // Return the relative path to the htree file if it's available.
- // Otherwise, return the absolute path.
- one_typed_value_local(String* htree_file);
- if (options->RelativeHierarchyFilename[0] != 0)
- vl.htree_file = new String(options->RelativeHierarchyFilename);
- else if (options->HierarchyFilename[0] != 0)
- vl.htree_file = new String(options->HierarchyFilename);
- else
- {
- // Neither filename is available, return undefined.
- pop_value_locals();
- return &undefined;
- }
- return_value(vl.htree_file);
-}
-
-
-
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/CMakeLists.txt b/Generals/Code/Tools/WW3D/max2w3d/CMakeLists.txt
deleted file mode 100644
index e8b27aa5e9a..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/CMakeLists.txt
+++ /dev/null
@@ -1,176 +0,0 @@
-set(MAX2W3D_SRC
- "aabtreebuilder.cpp"
- "aabtreebuilder.h"
- "AlphaModifier.cpp"
- "AlphaModifier.h"
- "animationcompressionsettings.cpp"
- "animationcompressionsettings.h"
- "AppData.cpp"
- "bchannel.cpp"
- "bchannel.h"
- "boneicon.cpp"
- "boneicon.h"
- "bpick.cpp"
- "bpick.h"
- "colboxsave.cpp"
- "colboxsave.h"
- "dazzlesave.cpp"
- "dazzlesave.h"
- "dllmain.cpp"
- "dllmain.h"
- "ExportAll.cpp"
- "ExportAllDlg.cpp"
- "ExportAllDlg.h"
- "exportlog.cpp"
- "exportlog.h"
- "floaterdialog.cpp"
- "floaterdialog.h"
- "FormClass.cpp"
- "FormClass.h"
- "gamemaps.cpp"
- "gamemaps.h"
- "GameMtl.cpp"
- "gamemtl.h"
- "GameMtlDlg.cpp"
- "GameMtlDlg.h"
- "GameMtlForm.cpp"
- "GameMtlForm.h"
- "GameMtlPassDlg.cpp"
- "GameMtlPassDlg.h"
- "GameMtlShaderDlg.cpp"
- "GameMtlShaderDlg.h"
- "GameMtlTextureDlg.cpp"
- "GameMtlTextureDlg.h"
- "GameMtlVertexMaterialDlg.cpp"
- "GameMtlVertexMaterialDlg.h"
- "genlodextensiondialog.cpp"
- "genlodextensiondialog.h"
- "genmtlnamesdialog.cpp"
- "genmtlnamesdialog.h"
- "gennamesdialog.cpp"
- "gennamesdialog.h"
- "geometryexportcontext.h"
- "geometryexporttask.cpp"
- "geometryexporttask.h"
- #"gmtldlg.cpp"
- "gridsnapmodifier.cpp"
- "gridsnapmodifier.h"
- "hiersave.cpp"
- "hiersave.h"
- "hlodsave.cpp"
- "hlodsave.h"
- "InputDlg.cpp"
- "InputDlg.h"
- #"LightGlareSave.cpp"
- #"LightGlareSave.h"
- "logdlg.cpp"
- "logdlg.h"
- "max2w3d.def"
- "maxworldinfo.cpp"
- "maxworldinfo.h"
- "meshbuild.cpp"
- "meshbuild.h"
- "meshcon.cpp"
- "meshcon.h"
- "MeshDeform.cpp"
- "MeshDeform.h"
- "MeshDeformData.cpp"
- "MeshDeformData.h"
- "MeshDeformDefs.h"
- "MeshDeformPanel.cpp"
- "MeshDeformPanel.h"
- "MeshDeformSave.cpp"
- "MeshDeformSave.h"
- "MeshDeformSaveDefs.h"
- "MeshDeformSaveSet.cpp"
- "MeshDeformSaveSet.h"
- "MeshDeformSet.cpp"
- "MeshDeformSet.h"
- "MeshDeformUndo.cpp"
- "MeshDeformUndo.h"
- "meshsave.cpp"
- "meshsave.h"
- "motion.cpp"
- "motion.h"
- "namedsel.cpp"
- "namedsel.h"
- "nullsave.cpp"
- "nullsave.h"
- "PCToPS2Material.cpp"
- "presetexportoptionsdialog.cpp"
- "presetexportoptionsdialog.h"
- "PS2GameMtl.cpp"
- "PS2GameMtlShaderDlg.cpp"
- "PS2GameMtlShaderDlg.h"
- "rcmenu.cpp"
- "rcmenu.h"
- "resource.h"
- "SceneSetup.cpp"
- "SceneSetupDlg.cpp"
- "SceneSetupDlg.h"
- "simpdib.cpp"
- "simpdib.h"
- "skin.cpp"
- "skin.h"
- "SkinCopy.cpp"
- "skindata.cpp"
- "skindata.h"
- "SnapPoints.cpp"
- "SnapPoints.h"
- "TARGA.CPP"
- "TARGA.H"
- "util.cpp"
- "util.h"
- "Utility.cpp"
- "vchannel.cpp"
- "vchannel.h"
- "vxl.cpp"
- "vxl.h"
- "vxldbg.cpp"
- "vxldbg.h"
- "vxllayer.cpp"
- "vxllayer.h"
- "w3d_file.h"
- "w3d_obsolete.h"
- "w3dappdata.cpp"
- "w3dappdata.h"
- "w3ddesc.cpp"
- "w3ddesc.h"
- "w3ddlg.cpp"
- "w3ddlg.h"
- "w3dexp.cpp"
- "w3dexp.h"
- "w3dmtl.cpp"
- "w3dmtl.h"
- "w3dutil.cpp"
- "w3dutil.h"
-)
-
-add_library(g_max2w3d SHARED)
-set_target_properties(g_max2w3d PROPERTIES OUTPUT_NAME max2w3d SUFFIX ".dle")
-
-target_include_directories(g_max2w3d PRIVATE
- "../pluglib"
-)
-
-target_sources(g_max2w3d PRIVATE ${MAX2W3D_SRC})
-
-# TODO: What does W3D_MAX4 do? Needs cmake option?
-target_compile_definitions(g_max2w3d PRIVATE W3D_MAX4)
-
-target_link_libraries(g_max2w3d PRIVATE
- Comctl32
- # This is only linked to have its basetsd.h used instead of the vs6's basetsd.h
- # The headers typedef INT_PTR to different types, but maxsdk expects it
- # typedef'ed to int, otherwise throws linker errors.
- d3d8lib
- g_pluglib
- maxsdk
- winmm
-)
-
-set_target_properties(g_max2w3d PROPERTIES LINK_FLAGS "/DEF:max2w3d.def")
-
-if(WIN32 OR "${CMAKE_SYSTEM}" MATCHES "Windows")
- target_sources(g_max2w3d PRIVATE max2w3d.rc)
-endif()
diff --git a/Generals/Code/Tools/WW3D/max2w3d/ExportAll.cpp b/Generals/Code/Tools/WW3D/max2w3d/ExportAll.cpp
deleted file mode 100644
index be0c0a35135..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/ExportAll.cpp
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : G *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/ExportAll.cpp $*
- * *
- * $Author:: Andre_a $*
- * *
- * $Modtime:: 10/15/99 2:08p $*
- * *
- * $Revision:: 2 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * wwExportTreeSettings -- Returns the directory to export, and recursive flag. *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-/*
-** ExportAll.cpp - Implements wwExportTreeSettings, which presents the user with a dialog
-** to allow them to choose which directory they want to export, and whether they want to
-** export all subdirectories as well. These settings are then passed back so that a script
-** can go through the directory (and maybe the subdirectories) and export all .max files
-** it finds.
-*/
-
-
-#include "ExportAllDlg.h"
-
-#undef STRICT
-#include
-#include
-#include
-#include
-
-
-/*
-** Let MAXScript know we're implementing new built-in functions.
-*/
-def_visible_primitive(export_tree_settings, "wwExportTreeSettings");
-
-
-/***********************************************************************************************
- * export_tree_settings_cf - Returns the directory to export, and recursive flag. *
- * *
- * wwExportTreeSettings - Usage: wwExportTreeSettings #(, ) *
- * *
- * INPUT: A MaxScript array containing two values: *
- * initial_path (string) - the initial export directory *
- * recursive (bool) - the initial recursive setting *
- * *
- * OUTPUT: An array of the same format containing the values the user chose. *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/4/1999 AJA : Created. *
- *=============================================================================================*/
-Value * export_tree_settings_cf (Value **arg_list, int count)
-{
- // We want an array as an argument
- check_arg_count("wwExportAll", 1, count);
- type_check(arg_list[0], Array, "Parameter array");
-
- // Grab the two values out of the array.
- // First value is a string whose value is the initial value for the directory.
- // Second value is a bool, true for a recursive export.
- ExportAllDlg dlg(MAXScript_interface);
- Array *args = (Array*)(arg_list[0]);
- char *temp = (args->get(1))->to_string();
- int len = strlen(temp);
- if (len < MAX_PATH)
- strcpy(dlg.m_Directory, temp);
- else
- {
- strncpy(dlg.m_Directory, temp, MAX_PATH-1);
- dlg.m_Directory[MAX_PATH-1] = 0;
- }
- dlg.m_Recursive = (args->get(2))->to_bool();
-
- // Show the dialog to let the user change the settings.
- if (dlg.DoModal() == IDCANCEL)
- return &undefined;
-
- // Create the array we will return to MaxScript.
- one_typed_value_local(Array *result);
- vl.result = new Array(2);
- vl.result->append(new String(dlg.m_Directory));
- if (dlg.m_Recursive)
- vl.result->append(&true_value);
- else
- vl.result->append(&false_value);
-
- // Return the new values.
- return_value(vl.result);
-}
\ No newline at end of file
diff --git a/Generals/Code/Tools/WW3D/max2w3d/ExportAllDlg.cpp b/Generals/Code/Tools/WW3D/max2w3d/ExportAllDlg.cpp
deleted file mode 100644
index 5c6d3dbcd42..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/ExportAllDlg.cpp
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : G *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/ExportAllDlg.cpp $*
- * *
- * $Author:: Andre_a $*
- * *
- * $Modtime:: 10/15/99 4:25p $*
- * *
- * $Revision:: 2 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-
-// ExportAllDlg.cpp : implementation file
-//
-
-#include "ExportAllDlg.h"
-#include
-#include
-#include // SHBrowseForFolder
-
-
-static BOOL CALLBACK _thunk_dialog_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
-
-
-/////////////////////////////////////////////////////////////////////////////
-// ExportAllDlg dialog
-
-
-ExportAllDlg::ExportAllDlg (Interface *max_interface)
-{
- m_Directory[0] = '\0';
- m_Recursive = TRUE;
- m_hWnd = NULL;
- assert(max_interface != NULL);
- m_MaxInterface = max_interface;
-}
-
-
-/////////////////////////////////////////////////////////////////////////////
-// ExportAllDlg Methods
-
-int ExportAllDlg::DoModal (void)
-{
- // Put up the dialog box.
- BOOL result = DialogBoxParam(AppInstance, MAKEINTRESOURCE(IDD_EXPORT_ALL),
- m_MaxInterface->GetMAXHWnd(), (DLGPROC)_thunk_dialog_proc,
- (LPARAM)this);
-
- // Return IDOK if the user accepted the new settings.
- return (result == 1) ? IDOK : IDCANCEL;
-}
-
-/////////////////////////////////////////////////////////////////////////////
-// ExportAllDlg DialogProc
-
-BOOL CALLBACK _thunk_dialog_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
- static ExportAllDlg *dialog = NULL;
-
- if (uMsg == WM_INITDIALOG)
- {
- dialog = (ExportAllDlg*)lParam;
- dialog->m_hWnd = hWnd;
- }
-
- if (dialog)
- return dialog->DialogProc(hWnd, uMsg, wParam, lParam);
- else
- return 0;
-}
-
-BOOL CALLBACK ExportAllDlg::DialogProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
- int code = HIWORD(wParam);
-
- switch (uMsg)
- {
-
- /*******************************************************************
- * WM_INITDIALOG
- *
- * Initialize all of the custom controls for the dialog box
- *
- *******************************************************************/
- case WM_INITDIALOG:
-
- OnInitDialog();
- return TRUE;
-
-
- /*******************************************************************
- * WM_COMMAND
- *
- *
- *******************************************************************/
- case WM_COMMAND:
-
- switch (LOWORD(wParam))
- {
- case IDOK:
-
- if (OnOK() == FALSE)
- return TRUE;
-
- SetCursor(LoadCursor(NULL, IDC_WAIT));
- EndDialog(m_hWnd, 1);
- break;
-
- case IDCANCEL:
- EndDialog(m_hWnd, 0);
- break;
-
- case IDC_BROWSE:
- OnBrowse();
- return FALSE;
-
- }
- return TRUE;
-
- }
-
- return FALSE;
-}
-
-/////////////////////////////////////////////////////////////////////////////
-// ExportAllDlg message handlers
-
-void ExportAllDlg::OnInitDialog (void)
-{
- CenterWindow(m_hWnd, m_MaxInterface->GetMAXHWnd());
- SetCursor(LoadCursor(NULL, IDC_ARROW));
-
- // Set the check box state.
- CheckDlgButton(m_hWnd, IDC_RECURSIVE, m_Recursive);
-
- // Set the default directory.
- HWND edit = GetDlgItem(m_hWnd, IDC_DIRECTORY);
- assert(edit != NULL);
- SetWindowText(edit, m_Directory);
-}
-
-void ExportAllDlg::OnBrowse()
-{
- char folder_name[MAX_PATH];
- BROWSEINFO bi;
- ZeroMemory(&bi, sizeof(bi));
- bi.hwndOwner = m_hWnd;
- bi.pszDisplayName = folder_name;
- bi.lpszTitle = "Select a folder for export...";
- bi.ulFlags = BIF_RETURNONLYFSDIRS;
-
- // Browse for a folder.
- LPITEMIDLIST il = SHBrowseForFolder(&bi);
- if (il)
- {
- // Get the path of the folder.
- if (SHGetPathFromIDList(il, folder_name))
- {
- HWND edit = GetDlgItem(m_hWnd, IDC_DIRECTORY);
- assert(edit != NULL);
- SetWindowText(edit, folder_name);
- }
- else
- MessageBox(m_hWnd, "Error getting pathname with SHGetPathFromIDList()",
- "Error", MB_OK | MB_ICONSTOP);
- }
-}
-
-BOOL ExportAllDlg::OnOK (void)
-{
- // Get the directory chosen by the user. If none is entered,
- // freak on the user.
- char dir[_MAX_PATH];
- HWND edit = GetDlgItem(m_hWnd, IDC_DIRECTORY);
- assert(edit != NULL);
- if (GetWindowText(edit, dir, sizeof(dir)) == 0)
- {
- // The edit box is empty, that's not a valid choice.
- MessageBox(m_hWnd, "You must choose a directory to export",
- "Invalid Directory", MB_OK);
- SetFocus(edit);
- return FALSE;
- }
-
- // TODO: Validate the directory as one that actually exists.
-
- // Store the values from the dialog in our class members.
- strcpy(m_Directory, dir);
- m_Recursive = (IsDlgButtonChecked(m_hWnd, IDC_RECURSIVE) == BST_CHECKED) ? TRUE : FALSE;
-
- return TRUE;
-}
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/ExportAllDlg.h b/Generals/Code/Tools/WW3D/max2w3d/ExportAllDlg.h
deleted file mode 100644
index c4fc8e1c352..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/ExportAllDlg.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : G *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/ExportAllDlg.h $*
- * *
- * $Author:: Andre_a $*
- * *
- * $Modtime:: 10/15/99 4:25p $*
- * *
- * $Revision:: 2 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#ifndef EXPORTALLDLG_H
-#define EXPORTALLDLG_H
-
-#include "dllmain.h"
-#include "resource.h"
-
-
-class Interface;
-
-/////////////////////////////////////////////////////////////////////////////
-// ExportAllDlg dialog
-
-class ExportAllDlg
-{
-public:
-
- // Construction
- ExportAllDlg (Interface *max_interface);
-
- // Methods
- int DoModal (void);
-
- // DialogProc
- BOOL CALLBACK DialogProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
-
- // Dialog data associated with GUI components.
- char m_Directory[_MAX_PATH]; // edit box
- BOOL m_Recursive; // check box
-
- // Dialog data
- enum { IDD = IDD_EXPORT_ALL };
- HWND m_hWnd;
- Interface *m_MaxInterface;
-
-protected:
-
- // Message Handlers
- void OnInitDialog (void);
- void OnBrowse (void);
- BOOL OnOK (void); // TRUE if ok to close dialog
-};
-
-
-#endif
diff --git a/Generals/Code/Tools/WW3D/max2w3d/FormClass.cpp b/Generals/Code/Tools/WW3D/max2w3d/FormClass.cpp
deleted file mode 100644
index ad1eec293c7..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/FormClass.cpp
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : FormClass *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/FormClass.cpp $*
- * *
- * Author:: Greg Hjelstrom *
- * *
- * $Modtime:: 11/09/98 3:02a $*
- * *
- * $Revision:: 2 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * FormClass::Create_Form -- Loads the dialog template and initializes *
- * FormClass::fnFormProc -- windows proc which thunks into the virtual Dialog_Proc *
- * FormClass::ExecuteDlgInit -- Initializes controls in the dialog template *
- * FormClass::ExecuteDlgInit -- Initializes the controls in the dialog template *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#include "FormClass.h"
-#include "dllmain.h"
-
-// hard-coded resource id which VC special cases for MFC... >:-)
-#define RT_DLGINIT MAKEINTRESOURCE(240)
-
-
-/***********************************************************************************************
- * FormClass::Create_Form -- Loads the dialog template and initializes *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/6/98 GTH : Created. *
- *=============================================================================================*/
-HWND
-FormClass::Create_Form
-(
- HWND parent_wnd,
- UINT template_id
-)
-{
- // call PreCreateWindow to get prefered extended style
- CREATESTRUCT cs = { 0 };
- cs.style = WS_CHILD;
-
- m_hWnd = ::CreateDialogParam( AppInstance,
- MAKEINTRESOURCE (template_id),
- parent_wnd,
- fnFormProc,
- (LPARAM)this);
-
- assert(m_hWnd);
-
- // Remove the caption from the dialog (if there was any)
- ::SetWindowLong (m_hWnd,
- GWL_STYLE,
- ::GetWindowLong (m_hWnd, GWL_STYLE) & (~WS_CAPTION));
-
- ::GetWindowRect (m_hWnd, &m_FormRect);
-
- ExecuteDlgInit(MAKEINTRESOURCE(template_id));
-
- return m_hWnd;
-}
-
-
-/***********************************************************************************************
- * FormClass::fnFormProc -- windows proc which thunks into the virtual Dialog_Proc *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/6/98 GTH : Created. *
- *=============================================================================================*/
-BOOL WINAPI
-FormClass::fnFormProc
-(
- HWND dlg_wnd,
- UINT message,
- WPARAM wparam,
- LPARAM lparam
-)
-{
- FormClass *pform = (FormClass *)::GetProp (dlg_wnd, "FORMCLASS");
-
- if (message == WM_INITDIALOG) {
- pform = (FormClass *)lparam;
- ::SetProp (dlg_wnd, "FORMCLASS", (HANDLE)pform);
- } else if (message == WM_DESTROY) {
- ::RemoveProp (dlg_wnd, "FORMCLASS");
- }
-
- BOOL retval = FALSE;
- if (pform) {
- retval = pform->Dialog_Proc (dlg_wnd, message, wparam, lparam);
- }
-
- return retval;
-}
-
-
-/***********************************************************************************************
- * FormClass::ExecuteDlgInit -- Initializes controls in the dialog template *
- * *
- * This code was lifted straight out of MFC. It does some "interesting" things like putting *
- * strings into combo boxes which are typed in the resource editor. *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/6/98 GTH : Created. *
- *=============================================================================================*/
-BOOL FormClass::ExecuteDlgInit(LPCTSTR lpszResourceName)
-{
- // find resource handle
- LPVOID lpResource = NULL;
- HGLOBAL hResource = NULL;
- if (lpszResourceName != NULL)
- {
- HINSTANCE hInst = AppInstance;
- HRSRC hDlgInit = ::FindResource(hInst, lpszResourceName, RT_DLGINIT);
- if (hDlgInit != NULL)
- {
- // load it
- hResource = LoadResource(hInst, hDlgInit);
- if (hResource == NULL)
- return FALSE;
- // lock it
- lpResource = LockResource(hResource);
- assert(lpResource != NULL);
- }
- }
-
- // execute it
- BOOL bResult = ExecuteDlgInit(lpResource);
-
- // cleanup
- if (lpResource != NULL && hResource != NULL)
- {
- UnlockResource(hResource);
- FreeResource(hResource);
- }
- return bResult;
-}
-
-
-/***********************************************************************************************
- * FormClass::ExecuteDlgInit -- Initializes the controls in the dialog template *
- * *
- * As the above ExecuteDlgInit function, this was lifted from MFC... *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/6/98 GTH : Created. *
- *=============================================================================================*/
-BOOL FormClass::ExecuteDlgInit(LPVOID lpResource)
-{
- BOOL bSuccess = TRUE;
- if (lpResource != NULL)
- {
- UNALIGNED WORD* lpnRes = (WORD*)lpResource;
- while (bSuccess && *lpnRes != 0)
- {
- WORD nIDC = *lpnRes++;
- WORD nMsg = *lpnRes++;
- DWORD dwLen = *((UNALIGNED DWORD*&)lpnRes)++;
-
- // In Win32 the WM_ messages have changed. They have
- // to be translated from the 32-bit values to 16-bit
- // values here.
- #define WIN16_LB_ADDSTRING 0x0401
- #define WIN16_CB_ADDSTRING 0x0403
-
- if (nMsg == WIN16_LB_ADDSTRING)
- nMsg = LB_ADDSTRING;
- else if (nMsg == WIN16_CB_ADDSTRING)
- nMsg = CB_ADDSTRING;
-
- // check for invalid/unknown message types
- assert(nMsg == LB_ADDSTRING || nMsg == CB_ADDSTRING);
-
- if (nMsg == LB_ADDSTRING || nMsg == CB_ADDSTRING)
- {
- // List/Combobox returns -1 for error
- if (::SendDlgItemMessageA(m_hWnd, nIDC, nMsg, 0, (LONG)lpnRes) == -1)
- bSuccess = FALSE;
- }
-
- // skip past data
- lpnRes = (WORD*)((LPBYTE)lpnRes + (UINT)dwLen);
- }
- }
-
- return bSuccess;
-}
diff --git a/Generals/Code/Tools/WW3D/max2w3d/FormClass.h b/Generals/Code/Tools/WW3D/max2w3d/FormClass.h
deleted file mode 100644
index 77de5b10f41..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/FormClass.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : max2w3d *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/FormClass.h $*
- * *
- * Author:: Greg Hjelstrom *
- * *
- * $Modtime:: 11/13/98 9:34a $*
- * *
- * $Revision:: 3 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#if defined(_MSC_VER)
-#pragma once
-#endif
-
-#ifndef __FORMCLASS_H
-#define __FORMCLASS_H
-
-#include
-
-
-class FormClass : public ParamDlg
-{
- public:
- FormClass (void)
- : m_hWnd (NULL) {}
- ~FormClass (void) {}
-
- HWND Create_Form (HWND parent_wnd, UINT template_id);
- void Show (bool show_flag = true) { ::ShowWindow (m_hWnd, show_flag ? SW_SHOW : SW_HIDE); }
- virtual BOOL Dialog_Proc (HWND dlg_wnd, UINT message, WPARAM wparam, LPARAM lparam) = 0;
- HWND Get_Hwnd(void) { return m_hWnd; }
- virtual void Invalidate(void) { InvalidateRect(m_hWnd,NULL,0); }
-
- protected:
-
- BOOL ExecuteDlgInit(LPVOID lpResource);
- BOOL ExecuteDlgInit(LPCTSTR lpszResourceName);
-
- static BOOL WINAPI fnFormProc (HWND dlg_wnd, UINT message, WPARAM wparam, LPARAM lparam);
-
- HWND m_hWnd;
- RECT m_FormRect;
-};
-
-#endif //__FORMCLASS_H
diff --git a/Generals/Code/Tools/WW3D/max2w3d/GameMtl.cpp b/Generals/Code/Tools/WW3D/max2w3d/GameMtl.cpp
deleted file mode 100644
index 4463cc7b0b5..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/GameMtl.cpp
+++ /dev/null
@@ -1,3301 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/* $Header: /Commando/Code/Tools/max2w3d/GameMtl.cpp 52 8/10/01 2:18p Ian_l $ */
-/***********************************************************************************************
- *** Confidential - Westwood Studios ***
- ***********************************************************************************************
- * *
- * Project Name : Commando / G 3D engine *
- * *
- * File Name : GAMEMTL.CPP *
- * *
- * Programmer : Greg Hjelstrom *
- * *
- * Start Date : 06/26/97 *
- * *
- * Last Update : 10/26/1999997 [GH] *
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * GameMtl::GameMtl -- constructor *
- * GameMtl::~GameMtl -- destructor *
- * GameMtl::ClassID -- returns the max ClassID of the material plugin *
- * GameMtl::SuperClassID -- returns the super class ID *
- * GameMtl::GetClassName -- returns the name of this plugin clas *
- * GameMtl::NumSubs -- returns the number of sub animations *
- * GameMtl::SubAnimName -- returns the name of the i'th sub animation *
- * GameMtl::SubAnim -- returns the i'th sub-anim *
- * GameMtl::Clone -- clones this material *
- * GameMtl::NotifyRefChanged -- NotifyRefChanged handler *
- * GameMtl::SetReference -- set the i'th reference *
- * GameMtl::GetReference -- returnst the i'th reference *
- * GameMtl::NumSubTexmaps -- returns the number of texture maps in this material *
- * GameMtl::SetSubTexmap -- set the i'th texture map *
- * GameMtl::GetSubTexmap -- returns the i'th texture map *
- * GameMtl::CreateParamDlg -- creates the material editor dialog box *
- * GameMtl::Notify_Changed -- someone has changed this material *
- * GameMtl::Reset -- reset this material to default settings *
- * GameMtl::Update -- time has changed *
- * GameMtl::Validity -- return the validity of the material at time t *
- * GameMtl::Requirements -- what requirements does this material have? *
- * GameMtl::Load -- loading from a MAX file *
- * GameMtl::Save -- Saving into a MAX file *
- * GameMtl::Shade -- evaluate the material for the renderer. *
- * GameMtl::ps2_shade -- Emulate the PS2 shader. *
- * GameMtl::Compute_PC_Shader_From_PS2_Shader -- Determine if a PC shader can be created. *
- * GameMtl::Compute_PS2_Shader_From_PC_Shader -- Change a W3D material to a PS2 W3D material.*
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#include "gamemtl.h"
-#include
-#include
-#include
-#include "GameMtlDlg.h"
-#include "dllmain.h"
-#include "resource.h"
-#include "util.h"
-#include "meshsave.h"
-#include "gamemaps.h"
-
-
-/*****************************************************************
-*
-* GameMtl Class Descriptor
-*
-*****************************************************************/
-Class_ID GameMaterialClassID(GAMEMTL_ID_PARTA, GAMEMTL_ID_PARTB);
-
-class GameMaterialClassDesc:public ClassDesc {
-
-public:
- int IsPublic() { return 1; }
- void * Create(BOOL loading) { return new GameMtl(loading); }
- const TCHAR * ClassName() { return Get_String(IDS_GAMEMTL); }
- SClass_ID SuperClassID() { return MATERIAL_CLASS_ID; }
- Class_ID ClassID() { return GameMaterialClassID; }
- const TCHAR* Category() { return _T(""); }
-};
-
-static GameMaterialClassDesc _GameMaterialCD;
-
-ClassDesc * Get_Game_Material_Desc() { return &_GameMaterialCD; }
-
-
-/******************************************************************************
-*
-* PostLoadCallback for GameMtl
-*
-******************************************************************************/
-class GameMtlPostLoad : public PostLoadCallback
-{
-public:
- GameMtl *m;
-
- GameMtlPostLoad(GameMtl *b) { m=b; IsOld = false;}
- void proc(ILoad *iload);
-
- /*
- ** Data from the previous version of GameMtl
- */
- bool IsOld;
- ULONG Attributes;
- Color Diffuse;
- Color Specular;
- Color AmbientCoeff;
- Color DiffuseCoeff;
- Color SpecularCoeff;
- Color EmissiveCoeff;
- float FogCoeff;
- int DCTFrames;
- int DITFrames;
- int SCTFrames;
- int SITFrames;
- float DCTFrameRate;
- float DITFrameRate;
- float SCTFrameRate;
- float SITFrameRate;
- int DCTMappingType;
- int DITMappingType;
- int SCTMappingType;
- int SITMappingType;
- float Opacity;
- float Translucency;
- float Shininess;
-};
-
-
-
-/******************************************************************************
-*
-* GameMtl
-*
-* Notes:
-* Prior to Nov, 1998 I was storing everything about the material in custom
-* chunks. As part of the upgrade to surrender 1.4x, I'm going to use
-* a parameter block for each pass (combination of shader and vertex material)
-*
-******************************************************************************/
-#define MTL_HDR_CHUNK 0x4000
-
-/*
-** Custom Chunk IDs
-*/
-#define GAMEMTL_FLAGS_CHUNK 0x0000
-#define GAMEMTL_GAMEFLAGS_CHUNK 0x0001 // OBSOLETE!
-#define GAMEMTL_COLORS_CHUNK 0x0002 // OBSOLETE!
-
-#define GAMEMTL_TEXTURE_FRAMES_CHUNK 0x0003
-#define GAMEMTL_ENVMAP_FRAMES_CHUNK 0x0004
-#define GAMEMTL_DCT_FRAMES_CHUNK GAMEMTL_TEXTURE_FRAMES_CHUNK
-#define GAMEMTL_DIT_FRAMES_CHUNK GAMEMTL_ENVMAP_FRAMES_CHUNK
-#define GAMEMTL_SCT_FRAMES_CHUNK 0x0005
-#define GAMEMTL_SIT_FRAMES_CHUNK 0x0006
-
-#define GAMEMTL_DCT_FRAME_RATE_CHUNK 0x0010
-#define GAMEMTL_DIT_FRAME_RATE_CHUNK 0x0011
-#define GAMEMTL_SCT_FRAME_RATE_CHUNK 0x0012
-#define GAMEMTL_SIT_FRAME_RATE_CHUNK 0x0013
-
-#define GAMEMTL_DCT_MAPPING_CHUNK 0x0020
-#define GAMEMTL_DIT_MAPPING_CHUNK 0x0021
-#define GAMEMTL_SCT_MAPPING_CHUNK 0x0022
-#define GAMEMTL_SIT_MAPPING_CHUNK 0x0023
-
-#define GAMEMTL_ATTRIBUTES_CHUNK 0x0030
-#define GAMEMTL_DIFFUSE_COLOR_CHUNK 0x0031
-#define GAMEMTL_SPECULAR_COLOR_CHUNK 0x0032
-
-#define GAMEMTL_AMBIENT_COEFF_CHUNK 0x0040
-#define GAMEMTL_DIFFUSE_COEFF_CHUNK 0x0041
-#define GAMEMTL_SPECULAR_COEFF_CHUNK 0x0042
-#define GAMEMTL_EMISSIVE_COEFF_CHUNK 0x0043
-
-#define GAMEMTL_OPACITY_CHUNK 0x0050
-#define GAMEMTL_TRANSLUCENCY_CHUNK 0x0051
-#define GAMEMTL_SHININESS_CHUNK 0x0052
-#define GAMEMTL_FOG_CHUNK 0x0053
-
-#define GAMEMTL_PASS0_CUR_PAGE 0x0060
-#define GAMEMTL_PASS1_CUR_PAGE 0x0061
-#define GAMEMTL_PASS2_CUR_PAGE 0x0062
-#define GAMEMTL_PASS3_CUR_PAGE 0x0064
-
-#define GAMEMTL_PASS0_STAGE0_MAPPER_ARGS 0x0070
-#define GAMEMTL_PASS1_STAGE0_MAPPER_ARGS 0x0071
-#define GAMEMTL_PASS2_STAGE0_MAPPER_ARGS 0x0072
-#define GAMEMTL_PASS3_STAGE0_MAPPER_ARGS 0x0073
-
-#define GAMEMTL_SURFACE_TYPE_CHUNK 0x0080
-
-#define GAMEMTL_SORT_LEVEL_CHUNK 0x0090
-
-#define GAMEMTL_PASS0_STAGE1_MAPPER_ARGS 0x0100
-#define GAMEMTL_PASS1_STAGE1_MAPPER_ARGS 0x0101
-#define GAMEMTL_PASS2_STAGE1_MAPPER_ARGS 0x0102
-#define GAMEMTL_PASS3_STAGE1_MAPPER_ARGS 0x0103
-
-
-/*
-** Main Parameter Block Definition
-*/
-static ParamBlockDescID MainParameterBlockDesc[] =
-{
- { TYPE_INT, NULL, FALSE, 0 }, // Pass Count
-};
-
-
-/*
-** ID numbers for parameter block entries. As of version 4 of the
-** parameter block definitions, these enums should be used directly
-** in the pblock defs to avoid accidental ID mismatches.
-**
-** Note: You should DO NOTHING TO CHANGE THE VALUES OF THE ENUM
-** (except adding at the end of course). Following these constraints
-** will preserve backwards compatibility with all pblock versions.
-**
-** Since this enum is now just a series of ID numbers, we must
-** manually keep the PASS_PARAMBLOCK_LENGTH up to date. Believe it
-** or not, but this is less error-prone than the previous way of
-** doing things.
-**
-** (gth) Aug 6, 2000
-** IMPORTANT -PLEASE READ-
-** The following enums are basically the index into the array of
-** ParamBlockDescID's that we are using. It is critical that this
-** enumeration does not skip indexes and that the value for each
-** symbol in this list matches the position in the param block
-** for that variable. This enumeration is does not define the
-** id for the new variable, only its position in the array.
-**
-** When you add a new variable to the parameter block, you should
-** find an id for it higher than any existing id (look through the
-** rest of the entries in the parameter block). That id will not
-** usually be able to be the same as its array index due to the
-** evolution of this structure. The id I'm referring to is the
-** number in the 4th element of each of the ParamBlockDescIDs.
-**
-** If you remove an entry from our array of ParamBlockDescIDs you
-** will need to update all of the PB_xxx enumeration below so that
-** they match their position in the array again.
-*/
-
-enum
-{
- PB_AMBIENT = 0,
- PB_DIFFUSE = 1,
- PB_SPECULAR = 2,
- PB_EMISSIVE = 3,
- PB_SHININESS = 4,
- PB_OPACITY = 5,
- PB_TRANSLUCENCY = 6,
- PB_COPY_SPECULAR_TO_DIFFUSE = 7,
- PB_STAGE0_MAPPING_TYPE = 8,
- PB_PSX_TRANSLUCENCY = 9,
- PB_PSX_LIGHTING = 10,
-
- PB_DEPTH_COMPARE = 11,
- PB_DEPTH_MASK = 12,
- PB_COLOR_MASK = 13, // obsolete (ignored)
- PB_DEST_BLEND = 14,
- PB_FOG_FUNC = 15, // obsolete (ignored)
- PB_PRI_GRADIENT = 16,
- PB_SEC_GRADIENT = 17,
- PB_SRC_BLEND = 18,
- PB_DETAIL_COLOR_FUNC = 19,
- PB_DETAIL_ALPHA_FUNC = 20,
-
- PB_STAGE0_TEXTURE_ENABLE = 21,
- PB_STAGE0_TEXTURE_PUBLISH = 22,
- PB_STAGE0_TEXTURE_RESIZE = 23, // obsolete (ignored)
- PB_STAGE0_TEXTURE_NO_MIPMAP = 24, // obsolete (ignored)
- PB_STAGE0_TEXTURE_CLAMP_U = 25,
- PB_STAGE0_TEXTURE_CLAMP_V = 26,
- PB_STAGE0_TEXTURE_HINT = 27,
- PB_STAGE0_TEXTURE_DISPLAY = 28,
- PB_STAGE0_TEXTURE_FRAME_RATE = 29,
- PB_STAGE0_TEXTURE_FRAME_COUNT = 30,
- PB_STAGE0_TEXTURE_ANIM_TYPE = 31,
-
- PB_STAGE1_TEXTURE_ENABLE = 32,
- PB_STAGE1_TEXTURE_PUBLISH = 33,
- PB_STAGE1_TEXTURE_RESIZE = 34, // obsolete (ignored)
- PB_STAGE1_TEXTURE_NO_MIPMAP = 35, // obsolete (ignored)
- PB_STAGE1_TEXTURE_CLAMP_U = 36,
- PB_STAGE1_TEXTURE_CLAMP_V = 37,
- PB_STAGE1_TEXTURE_HINT = 38,
- PB_STAGE1_TEXTURE_DISPLAY = 39,
- PB_STAGE1_TEXTURE_FRAME_RATE = 40,
- PB_STAGE1_TEXTURE_FRAME_COUNT = 41,
- PB_STAGE1_TEXTURE_ANIM_TYPE = 42,
-
- PB_STAGE0_TEXTURE_ALPHA_BITMAP = 43,
- PB_STAGE1_TEXTURE_ALPHA_BITMAP = 44,
-
- PB_ALPHA_TEST = 45,
-
- PB_SHADER_PRESET = 46, // obsolete (ignored)
-
- // For the Playstation 2.
- PB_PS2_SHADER_PARAM_A = 47,
- PB_PS2_SHADER_PARAM_B = 48,
- PB_PS2_SHADER_PARAM_C = 49,
- PB_PS2_SHADER_PARAM_D = 50,
-
- // UV Channel selection
- PB_STAGE0_MAP_CHANNEL = 51,
- PB_STAGE1_MAP_CHANNEL = 52,
-
- PB_STAGE1_MAPPING_TYPE = 53, // (gth) this can't be 55, it is used as an array index // = 55, // yes, 55
-
- // textures can now disable LOD
- PB_STAGE0_TEXTURE_NO_LOD = 54,
- PB_STAGE1_TEXTURE_NO_LOD = 55,
-};
-
-
-/*
-** Per-Pass Parameter Block Definition
-*/
-
-// Version 0 (old version)
-static ParamBlockDescID PassParameterBlockDescVer0[] =
-{
- { TYPE_POINT3, NULL, TRUE, 0 }, // Ambient
- { TYPE_POINT3, NULL, TRUE, 1 }, // Diffuse
- { TYPE_POINT3, NULL, TRUE, 2 }, // Specular
- { TYPE_POINT3, NULL, TRUE, 3 }, // Emissive
- { TYPE_FLOAT, NULL, TRUE, 4 }, // Shininess
- { TYPE_FLOAT, NULL, TRUE, 5 }, // Opacity
- { TYPE_FLOAT, NULL, TRUE, 6 }, // Translucency
- { TYPE_INT, NULL, FALSE, 7 }, // Mapping Type
- { TYPE_INT, NULL, FALSE, 8 }, // PSX Translucency Type
- { TYPE_BOOL, NULL, FALSE, 9 }, // PSX Lighting Flag
-
- { TYPE_INT, NULL, FALSE, 10}, // Depth Compare
- { TYPE_INT, NULL, FALSE, 11}, // Depth Mask
- { TYPE_INT, NULL, FALSE, 12}, // Color Mask
- { TYPE_INT, NULL, FALSE, 13}, // Dest Blend
- { TYPE_INT, NULL, FALSE, 14}, // FogFunc
- { TYPE_INT, NULL, FALSE, 15}, // PriGradient
- { TYPE_INT, NULL, FALSE, 16}, // SecGradient
- { TYPE_INT, NULL, FALSE, 17}, // SrcBlend
- { TYPE_INT, NULL, FALSE, 18}, // DetailColorFunc
- { TYPE_INT, NULL, FALSE, 19}, // DetailAlphaFunc
- { TYPE_INT, NULL, FALSE, 20}, // DitherMask
- { TYPE_INT, NULL, FALSE, 21}, // Shade Model
-
- { TYPE_BOOL, NULL, FALSE, 22}, // Stage0 Texture Enable
- { TYPE_BOOL, NULL, FALSE, 23}, // Stage0 Texture Publish
- { TYPE_BOOL, NULL, FALSE, 24}, // Stage0 Texture Display (in viewport...)
- { TYPE_FLOAT, NULL, FALSE, 25}, // Stage0 Frame Rate
- { TYPE_INT, NULL, FALSE, 26}, // Stage0 Frame Count
- { TYPE_INT, NULL, FALSE, 27}, // Stage0 Animation Type
-
- { TYPE_BOOL, NULL, FALSE, 28}, // Stage1 Texture Enable
- { TYPE_BOOL, NULL, FALSE, 29}, // Stage1 Texture Publish
- { TYPE_BOOL, NULL, FALSE, 30}, // Stage1 Texture Display (in viewport...)
- { TYPE_FLOAT, NULL, FALSE, 31}, // Stage1 Frame Rate
- { TYPE_INT, NULL, FALSE, 32}, // Stage1 Frame Count
- { TYPE_INT, NULL, FALSE, 33}, // Stage1 Animation Type
-
-};
-
-// Version 1
-static ParamBlockDescID PassParameterBlockDescVer1[] =
-{
- { TYPE_POINT3, NULL, TRUE, 0 }, // Ambient
- { TYPE_POINT3, NULL, TRUE, 1 }, // Diffuse
- { TYPE_POINT3, NULL, TRUE, 2 }, // Specular
- { TYPE_POINT3, NULL, TRUE, 3 }, // Emissive
- { TYPE_FLOAT, NULL, TRUE, 4 }, // Shininess
- { TYPE_FLOAT, NULL, TRUE, 5 }, // Opacity
- { TYPE_FLOAT, NULL, TRUE, 6 }, // Translucency
- { TYPE_BOOL, NULL, FALSE, 34}, // Copy specular to diffuse (new to version 1)
- { TYPE_INT, NULL, FALSE, 7 }, // Mapping Type
- { TYPE_INT, NULL, FALSE, 8 }, // PSX Translucency Type
- { TYPE_BOOL, NULL, FALSE, 9 }, // PSX Lighting Flag
-
- { TYPE_INT, NULL, FALSE, 10}, // Depth Compare
- { TYPE_INT, NULL, FALSE, 11}, // Depth Mask
- { TYPE_INT, NULL, FALSE, 12}, // Color Mask (now obsolete and ignored)
- { TYPE_INT, NULL, FALSE, 13}, // Dest Blend
- { TYPE_INT, NULL, FALSE, 14}, // FogFunc (now obsolete and ignored)
- { TYPE_INT, NULL, FALSE, 15}, // PriGradient
- { TYPE_INT, NULL, FALSE, 16}, // SecGradient
- { TYPE_INT, NULL, FALSE, 17}, // SrcBlend
- { TYPE_INT, NULL, FALSE, 18}, // DetailColorFunc
- { TYPE_INT, NULL, FALSE, 19}, // DetailAlphaFunc
-
- { TYPE_BOOL, NULL, FALSE, 22}, // Stage0 Texture Enable
- { TYPE_BOOL, NULL, FALSE, 23}, // Stage0 Texture Publish
- { TYPE_BOOL, NULL, FALSE, 35}, // Stage0 Texture Resize (new to version 1)
- { TYPE_BOOL, NULL, FALSE, 36}, // Stage0 Texture No Mipmap (new to version 1)
- { TYPE_BOOL, NULL, FALSE, 37}, // Stage0 Texture Clamp U (new to version 1)
- { TYPE_BOOL, NULL, FALSE, 38}, // Stage0 Texture Clamp V (new to version 1)
- { TYPE_INT, NULL, FALSE, 39}, // Stage0 Texture Hint (new to version 1)
- { TYPE_BOOL, NULL, FALSE, 24}, // Stage0 Texture Display (in viewport...)
- { TYPE_FLOAT, NULL, FALSE, 25}, // Stage0 Frame Rate
- { TYPE_INT, NULL, FALSE, 26}, // Stage0 Frame Count
- { TYPE_INT, NULL, FALSE, 27}, // Stage0 Animation Type
-
- { TYPE_BOOL, NULL, FALSE, 28}, // Stage1 Texture Enable
- { TYPE_BOOL, NULL, FALSE, 29}, // Stage1 Texture Publish
- { TYPE_BOOL, NULL, FALSE, 40}, // Stage1 Texture Resize (new to version 1)
- { TYPE_BOOL, NULL, FALSE, 41}, // Stage1 Texture No Mipmap (new to version 1)
- { TYPE_BOOL, NULL, FALSE, 42}, // Stage1 Texture Clamp U (new to version 1)
- { TYPE_BOOL, NULL, FALSE, 43}, // Stage1 Texture Clamp V (new to version 1)
- { TYPE_INT, NULL, FALSE, 44}, // Stage1 Texture Hint (new to version 1)
- { TYPE_BOOL, NULL, FALSE, 30}, // Stage1 Texture Display (in viewport...)
- { TYPE_FLOAT, NULL, FALSE, 31}, // Stage1 Frame Rate
- { TYPE_INT, NULL, FALSE, 32}, // Stage1 Frame Count
- { TYPE_INT, NULL, FALSE, 33}, // Stage1 Animation Type
-
- { TYPE_BOOL, NULL, FALSE, 45}, // Stage0 Texture Alpha Bitmap (new to version 1)
- { TYPE_BOOL, NULL, FALSE, 46}, // Stage1 Texture Alpha Bitmap (new to version 1)
-
- { TYPE_BOOL, NULL, FALSE, 47}, // Alpha Test (new to version 1)
- { TYPE_INT, NULL, FALSE, 48}, // Shader preset (new to version 1) (now obsolete and ignored)
-};
-
-// Version 2 (old version)
-static ParamBlockDescID PassParameterBlockDescVer2[] =
-{
- { TYPE_POINT3, NULL, TRUE, 0 }, // Ambient
- { TYPE_POINT3, NULL, TRUE, 1 }, // Diffuse
- { TYPE_POINT3, NULL, TRUE, 2 }, // Specular
- { TYPE_POINT3, NULL, TRUE, 3 }, // Emissive
- { TYPE_FLOAT, NULL, TRUE, 4 }, // Shininess
- { TYPE_FLOAT, NULL, TRUE, 5 }, // Opacity
- { TYPE_FLOAT, NULL, TRUE, 6 }, // Translucency
- { TYPE_BOOL, NULL, FALSE, 34}, // Copy specular to diffuse (new to version 1)
- { TYPE_INT, NULL, FALSE, 7 }, // Mapping Type
- { TYPE_INT, NULL, FALSE, 8 }, // PSX Translucency Type
- { TYPE_BOOL, NULL, FALSE, 9 }, // PSX Lighting Flag
-
- { TYPE_INT, NULL, FALSE, 10}, // Depth Compare
- { TYPE_INT, NULL, FALSE, 11}, // Depth Mask
- { TYPE_INT, NULL, FALSE, 12}, // Color Mask (now obsolete and ignored)
- { TYPE_INT, NULL, FALSE, 13}, // Dest Blend
- { TYPE_INT, NULL, FALSE, 14}, // FogFunc (now obsolete and ignored)
- { TYPE_INT, NULL, FALSE, 15}, // PriGradient
- { TYPE_INT, NULL, FALSE, 16}, // SecGradient
- { TYPE_INT, NULL, FALSE, 17}, // SrcBlend
- { TYPE_INT, NULL, FALSE, 18}, // DetailColorFunc
- { TYPE_INT, NULL, FALSE, 19}, // DetailAlphaFunc
-
- { TYPE_BOOL, NULL, FALSE, 22}, // Stage0 Texture Enable
- { TYPE_BOOL, NULL, FALSE, 23}, // Stage0 Texture Publish
- { TYPE_BOOL, NULL, FALSE, 35}, // Stage0 Texture Resize (new to version 1)
- { TYPE_BOOL, NULL, FALSE, 36}, // Stage0 Texture No Mipmap (new to version 1)
- { TYPE_BOOL, NULL, FALSE, 37}, // Stage0 Texture Clamp U (new to version 1)
- { TYPE_BOOL, NULL, FALSE, 38}, // Stage0 Texture Clamp V (new to version 1)
- { TYPE_INT, NULL, FALSE, 39}, // Stage0 Texture Hint (new to version 1)
- { TYPE_BOOL, NULL, FALSE, 24}, // Stage0 Texture Display (in viewport...)
- { TYPE_FLOAT, NULL, FALSE, 25}, // Stage0 Frame Rate
- { TYPE_INT, NULL, FALSE, 26}, // Stage0 Frame Count
- { TYPE_INT, NULL, FALSE, 27}, // Stage0 Animation Type
-
- { TYPE_BOOL, NULL, FALSE, 28}, // Stage1 Texture Enable
- { TYPE_BOOL, NULL, FALSE, 29}, // Stage1 Texture Publish
- { TYPE_BOOL, NULL, FALSE, 40}, // Stage1 Texture Resize (new to version 1)
- { TYPE_BOOL, NULL, FALSE, 41}, // Stage1 Texture No Mipmap (new to version 1)
- { TYPE_BOOL, NULL, FALSE, 42}, // Stage1 Texture Clamp U (new to version 1)
- { TYPE_BOOL, NULL, FALSE, 43}, // Stage1 Texture Clamp V (new to version 1)
- { TYPE_INT, NULL, FALSE, 44}, // Stage1 Texture Hint (new to version 1)
- { TYPE_BOOL, NULL, FALSE, 30}, // Stage1 Texture Display (in viewport...)
- { TYPE_FLOAT, NULL, FALSE, 31}, // Stage1 Frame Rate
- { TYPE_INT, NULL, FALSE, 32}, // Stage1 Frame Count
- { TYPE_INT, NULL, FALSE, 33}, // Stage1 Animation Type
-
- { TYPE_BOOL, NULL, FALSE, 45}, // Stage0 Texture Alpha Bitmap (new to version 1)
- { TYPE_BOOL, NULL, FALSE, 46}, // Stage1 Texture Alpha Bitmap (new to version 1)
-
- { TYPE_BOOL, NULL, FALSE, 47}, // Alpha Test (new to version 1)
- { TYPE_INT, NULL, FALSE, 48}, // Shader preset (new to version 1) (now obsolete and ignored)
- { TYPE_INT, NULL, FALSE, 49}, // PS2 Shader Param A
- { TYPE_INT, NULL, FALSE, 50}, // PS2 Shader Param B
- { TYPE_INT, NULL, FALSE, 51}, // PS2 Shader Param C
- { TYPE_INT, NULL, FALSE, 52}, // PS2 Shader Param D
-};
-
-// Version 3 (old version)
-static ParamBlockDescID PassParameterBlockDescVer3[] =
-{
- { TYPE_POINT3, NULL, TRUE, 0 }, // Ambient
- { TYPE_POINT3, NULL, TRUE, 1 }, // Diffuse
- { TYPE_POINT3, NULL, TRUE, 2 }, // Specular
- { TYPE_POINT3, NULL, TRUE, 3 }, // Emissive
- { TYPE_FLOAT, NULL, TRUE, 4 }, // Shininess
- { TYPE_FLOAT, NULL, TRUE, 5 }, // Opacity
- { TYPE_FLOAT, NULL, TRUE, 6 }, // Translucency
- { TYPE_BOOL, NULL, FALSE, 34}, // Copy specular to diffuse (new to version 1)
- { TYPE_INT, NULL, FALSE, 7 }, // Mapping Type
- { TYPE_INT, NULL, FALSE, 8 }, // PSX Translucency Type
- { TYPE_BOOL, NULL, FALSE, 9 }, // PSX Lighting Flag
-
- { TYPE_INT, NULL, FALSE, 10}, // Depth Compare
- { TYPE_INT, NULL, FALSE, 11}, // Depth Mask
- { TYPE_INT, NULL, FALSE, 12}, // Color Mask (now obsolete and ignored)
- { TYPE_INT, NULL, FALSE, 13}, // Dest Blend
- { TYPE_INT, NULL, FALSE, 14}, // FogFunc (now obsolete and ignored)
- { TYPE_INT, NULL, FALSE, 15}, // PriGradient
- { TYPE_INT, NULL, FALSE, 16}, // SecGradient
- { TYPE_INT, NULL, FALSE, 17}, // SrcBlend
- { TYPE_INT, NULL, FALSE, 18}, // DetailColorFunc
- { TYPE_INT, NULL, FALSE, 19}, // DetailAlphaFunc
-
- { TYPE_BOOL, NULL, FALSE, 22}, // Stage0 Texture Enable
- { TYPE_BOOL, NULL, FALSE, 23}, // Stage0 Texture Publish
- { TYPE_BOOL, NULL, FALSE, 35}, // Stage0 Texture Resize (new to version 1)
- { TYPE_BOOL, NULL, FALSE, 36}, // Stage0 Texture No Mipmap (new to version 1)
- { TYPE_BOOL, NULL, FALSE, 37}, // Stage0 Texture Clamp U (new to version 1)
- { TYPE_BOOL, NULL, FALSE, 38}, // Stage0 Texture Clamp V (new to version 1)
- { TYPE_INT, NULL, FALSE, 39}, // Stage0 Texture Hint (new to version 1)
- { TYPE_BOOL, NULL, FALSE, 24}, // Stage0 Texture Display (in viewport...)
- { TYPE_FLOAT, NULL, FALSE, 25}, // Stage0 Frame Rate
- { TYPE_INT, NULL, FALSE, 26}, // Stage0 Frame Count
- { TYPE_INT, NULL, FALSE, 27}, // Stage0 Animation Type
-
- { TYPE_BOOL, NULL, FALSE, 28}, // Stage1 Texture Enable
- { TYPE_BOOL, NULL, FALSE, 29}, // Stage1 Texture Publish
- { TYPE_BOOL, NULL, FALSE, 40}, // Stage1 Texture Resize (new to version 1)
- { TYPE_BOOL, NULL, FALSE, 41}, // Stage1 Texture No Mipmap (new to version 1)
- { TYPE_BOOL, NULL, FALSE, 42}, // Stage1 Texture Clamp U (new to version 1)
- { TYPE_BOOL, NULL, FALSE, 43}, // Stage1 Texture Clamp V (new to version 1)
- { TYPE_INT, NULL, FALSE, 44}, // Stage1 Texture Hint (new to version 1)
- { TYPE_BOOL, NULL, FALSE, 30}, // Stage1 Texture Display (in viewport...)
- { TYPE_FLOAT, NULL, FALSE, 31}, // Stage1 Frame Rate
- { TYPE_INT, NULL, FALSE, 32}, // Stage1 Frame Count
- { TYPE_INT, NULL, FALSE, 33}, // Stage1 Animation Type
-
- { TYPE_BOOL, NULL, FALSE, 45}, // Stage0 Texture Alpha Bitmap (new to version 1)
- { TYPE_BOOL, NULL, FALSE, 46}, // Stage1 Texture Alpha Bitmap (new to version 1)
-
- { TYPE_BOOL, NULL, FALSE, 47}, // Alpha Test (new to version 1)
- { TYPE_INT, NULL, FALSE, 48}, // Shader preset (new to version 1) (now obsolete and ignored)
- { TYPE_INT, NULL, FALSE, 49}, // PS2 Shader Param A
- { TYPE_INT, NULL, FALSE, 50}, // PS2 Shader Param B
- { TYPE_INT, NULL, FALSE, 51}, // PS2 Shader Param C
- { TYPE_INT, NULL, FALSE, 52}, // PS2 Shader Param D
-
- { TYPE_INT, NULL, FALSE, 53}, // Stage0 UV Channel
- { TYPE_INT, NULL, FALSE, 54}, // Stage1 UV Channel
-};
-
-
-// Version 4 (old version)
-static ParamBlockDescID PassParameterBlockDescVer4[] =
-{
- { TYPE_POINT3, NULL, TRUE, 0 }, // Ambient
- { TYPE_POINT3, NULL, TRUE, 1 }, // Diffuse
- { TYPE_POINT3, NULL, TRUE, 2 }, // Specular
- { TYPE_POINT3, NULL, TRUE, 3 }, // Emissive
- { TYPE_FLOAT, NULL, TRUE, 4 }, // Shininess
- { TYPE_FLOAT, NULL, TRUE, 5 }, // Opacity
- { TYPE_FLOAT, NULL, TRUE, 6 }, // Translucency
- { TYPE_BOOL, NULL, FALSE, 34}, // Copy specular to diffuse (new to version 1)
- { TYPE_INT, NULL, FALSE, 7 }, // Stage0 Mapping Type
- { TYPE_INT, NULL, FALSE, 8 }, // PSX Translucency Type
- { TYPE_BOOL, NULL, FALSE, 9 }, // PSX Lighting Flag
-
- { TYPE_INT, NULL, FALSE, 10}, // Depth Compare
- { TYPE_INT, NULL, FALSE, 11}, // Depth Mask
- { TYPE_INT, NULL, FALSE, 12}, // Color Mask (now obsolete and ignored)
- { TYPE_INT, NULL, FALSE, 13}, // Dest Blend
- { TYPE_INT, NULL, FALSE, 14}, // FogFunc (now obsolete and ignored)
- { TYPE_INT, NULL, FALSE, 15}, // PriGradient
- { TYPE_INT, NULL, FALSE, 16}, // SecGradient
- { TYPE_INT, NULL, FALSE, 17}, // SrcBlend
- { TYPE_INT, NULL, FALSE, 18}, // DetailColorFunc
- { TYPE_INT, NULL, FALSE, 19}, // DetailAlphaFunc
-
- { TYPE_BOOL, NULL, FALSE, 22}, // Stage0 Texture Enable
- { TYPE_BOOL, NULL, FALSE, 23}, // Stage0 Texture Publish
- { TYPE_BOOL, NULL, FALSE, 35}, // Stage0 Texture Resize (new to version 1)
- { TYPE_BOOL, NULL, FALSE, 36}, // Stage0 Texture No Mipmap (new to version 1)
- { TYPE_BOOL, NULL, FALSE, 37}, // Stage0 Texture Clamp U (new to version 1)
- { TYPE_BOOL, NULL, FALSE, 38}, // Stage0 Texture Clamp V (new to version 1)
- { TYPE_INT, NULL, FALSE, 39}, // Stage0 Texture Hint (new to version 1)
- { TYPE_BOOL, NULL, FALSE, 24}, // Stage0 Texture Display (in viewport...)
- { TYPE_FLOAT, NULL, FALSE, 25}, // Stage0 Frame Rate
- { TYPE_INT, NULL, FALSE, 26}, // Stage0 Frame Count
- { TYPE_INT, NULL, FALSE, 27}, // Stage0 Animation Type
-
- { TYPE_BOOL, NULL, FALSE, 28}, // Stage1 Texture Enable
- { TYPE_BOOL, NULL, FALSE, 29}, // Stage1 Texture Publish
- { TYPE_BOOL, NULL, FALSE, 40}, // Stage1 Texture Resize (new to version 1)
- { TYPE_BOOL, NULL, FALSE, 41}, // Stage1 Texture No Mipmap (new to version 1)
- { TYPE_BOOL, NULL, FALSE, 42}, // Stage1 Texture Clamp U (new to version 1)
- { TYPE_BOOL, NULL, FALSE, 43}, // Stage1 Texture Clamp V (new to version 1)
- { TYPE_INT, NULL, FALSE, 44}, // Stage1 Texture Hint (new to version 1)
- { TYPE_BOOL, NULL, FALSE, 30}, // Stage1 Texture Display (in viewport...)
- { TYPE_FLOAT, NULL, FALSE, 31}, // Stage1 Frame Rate
- { TYPE_INT, NULL, FALSE, 32}, // Stage1 Frame Count
- { TYPE_INT, NULL, FALSE, 33}, // Stage1 Animation Type
-
- { TYPE_BOOL, NULL, FALSE, 45}, // Stage0 Texture Alpha Bitmap (new to version 1)
- { TYPE_BOOL, NULL, FALSE, 46}, // Stage1 Texture Alpha Bitmap (new to version 1)
-
- { TYPE_BOOL, NULL, FALSE, 47}, // Alpha Test (new to version 1)
- { TYPE_INT, NULL, FALSE, 48}, // Shader preset (new to version 1) (now obsolete and ignored)
- { TYPE_INT, NULL, FALSE, 49}, // PS2 Shader Param A
- { TYPE_INT, NULL, FALSE, 50}, // PS2 Shader Param B
- { TYPE_INT, NULL, FALSE, 51}, // PS2 Shader Param C
- { TYPE_INT, NULL, FALSE, 52}, // PS2 Shader Param D
-
- { TYPE_INT, NULL, FALSE, 53}, // Stage0 UV Channel
- { TYPE_INT, NULL, FALSE, 54}, // Stage1 UV Channel
-
- { TYPE_INT, NULL, FALSE, 9998}, // foo
- { TYPE_INT, NULL, FALSE, 9999}, // bar
-
- { TYPE_INT, NULL, FALSE, 55}, // Stage1 Mapping Type (new to version 4)
-};
-
-
-// Version 5 (current version)
-static ParamBlockDescID PassParameterBlockDescVer5[] =
-{
- { TYPE_POINT3, NULL, TRUE, 0 }, // Ambient
- { TYPE_POINT3, NULL, TRUE, 1 }, // Diffuse
- { TYPE_POINT3, NULL, TRUE, 2 }, // Specular
- { TYPE_POINT3, NULL, TRUE, 3 }, // Emissive
- { TYPE_FLOAT, NULL, TRUE, 4 }, // Shininess
- { TYPE_FLOAT, NULL, TRUE, 5 }, // Opacity
- { TYPE_FLOAT, NULL, TRUE, 6 }, // Translucency
- { TYPE_BOOL, NULL, FALSE, 34}, // Copy specular to diffuse (new to version 1)
- { TYPE_INT, NULL, FALSE, 7 }, // Stage0 Mapping Type
- { TYPE_INT, NULL, FALSE, 8 }, // PSX Translucency Type
- { TYPE_BOOL, NULL, FALSE, 9 }, // PSX Lighting Flag
-
- { TYPE_INT, NULL, FALSE, 10}, // Depth Compare
- { TYPE_INT, NULL, FALSE, 11}, // Depth Mask
- { TYPE_INT, NULL, FALSE, 12}, // Color Mask (now obsolete and ignored)
- { TYPE_INT, NULL, FALSE, 13}, // Dest Blend
- { TYPE_INT, NULL, FALSE, 14}, // FogFunc (now obsolete and ignored)
- { TYPE_INT, NULL, FALSE, 15}, // PriGradient
- { TYPE_INT, NULL, FALSE, 16}, // SecGradient
- { TYPE_INT, NULL, FALSE, 17}, // SrcBlend
- { TYPE_INT, NULL, FALSE, 18}, // DetailColorFunc
- { TYPE_INT, NULL, FALSE, 19}, // DetailAlphaFunc
-
- { TYPE_BOOL, NULL, FALSE, 22}, // Stage0 Texture Enable
- { TYPE_BOOL, NULL, FALSE, 23}, // Stage0 Texture Publish
- { TYPE_BOOL, NULL, FALSE, 35}, // Stage0 Texture Resize (new to version 1) OBSOLETE!
- { TYPE_BOOL, NULL, FALSE, 36}, // Stage0 Texture No Mipmap (new to version 1) OBSOLETE!
- { TYPE_BOOL, NULL, FALSE, 37}, // Stage0 Texture Clamp U (new to version 1)
- { TYPE_BOOL, NULL, FALSE, 38}, // Stage0 Texture Clamp V (new to version 1)
- { TYPE_INT, NULL, FALSE, 39}, // Stage0 Texture Hint (new to version 1)
- { TYPE_BOOL, NULL, FALSE, 24}, // Stage0 Texture Display (in viewport...)
- { TYPE_FLOAT, NULL, FALSE, 25}, // Stage0 Frame Rate
- { TYPE_INT, NULL, FALSE, 26}, // Stage0 Frame Count
- { TYPE_INT, NULL, FALSE, 27}, // Stage0 Animation Type
-
- { TYPE_BOOL, NULL, FALSE, 28}, // Stage1 Texture Enable
- { TYPE_BOOL, NULL, FALSE, 29}, // Stage1 Texture Publish
- { TYPE_BOOL, NULL, FALSE, 40}, // Stage1 Texture Resize (new to version 1) OBSOLETE!
- { TYPE_BOOL, NULL, FALSE, 41}, // Stage1 Texture No Mipmap (new to version 1) OBSOLETE!
- { TYPE_BOOL, NULL, FALSE, 42}, // Stage1 Texture Clamp U (new to version 1)
- { TYPE_BOOL, NULL, FALSE, 43}, // Stage1 Texture Clamp V (new to version 1)
- { TYPE_INT, NULL, FALSE, 44}, // Stage1 Texture Hint (new to version 1)
- { TYPE_BOOL, NULL, FALSE, 30}, // Stage1 Texture Display (in viewport...)
- { TYPE_FLOAT, NULL, FALSE, 31}, // Stage1 Frame Rate
- { TYPE_INT, NULL, FALSE, 32}, // Stage1 Frame Count
- { TYPE_INT, NULL, FALSE, 33}, // Stage1 Animation Type
-
- { TYPE_BOOL, NULL, FALSE, 45}, // Stage0 Texture Alpha Bitmap (new to version 1)
- { TYPE_BOOL, NULL, FALSE, 46}, // Stage1 Texture Alpha Bitmap (new to version 1)
-
- { TYPE_BOOL, NULL, FALSE, 47}, // Alpha Test (new to version 1)
- { TYPE_INT, NULL, FALSE, 48}, // Shader preset (new to version 1) (now obsolete and ignored)
- { TYPE_INT, NULL, FALSE, 49}, // PS2 Shader Param A
- { TYPE_INT, NULL, FALSE, 50}, // PS2 Shader Param B
- { TYPE_INT, NULL, FALSE, 51}, // PS2 Shader Param C
- { TYPE_INT, NULL, FALSE, 52}, // PS2 Shader Param D
-
- { TYPE_INT, NULL, FALSE, 53}, // Stage0 UV Channel
- { TYPE_INT, NULL, FALSE, 54}, // Stage1 UV Channel
-
- { TYPE_INT, NULL, FALSE, 55 }, // Stage1 Mapping Type (new to version 4)
-
- { TYPE_BOOL, NULL, FALSE, 56 }, // Stage0 no texture reduction (new to version 5)
- { TYPE_BOOL, NULL, FALSE, 57 }, // Stage0 no texture reduction (new to version 5)
-};
-
-// Array of old pass parameter block versions (for backwards compatibility)
-const int NUM_OLDVERSIONS = 5;
-static ParamVersionDesc PassParameterBlockVersions[] = {
- ParamVersionDesc(PassParameterBlockDescVer0, 34, 0),
- ParamVersionDesc(PassParameterBlockDescVer1, 47, 1),
- ParamVersionDesc(PassParameterBlockDescVer2, 51, 2),
- ParamVersionDesc(PassParameterBlockDescVer3, 53, 3),
- ParamVersionDesc(PassParameterBlockDescVer4, 56, 4)
-};
-
-
-// Current pass parameter block version
-const int CURRENT_VERSION = 5;
-static ParamVersionDesc CurrentPassParameterBlockVersion(
- PassParameterBlockDescVer5,
- sizeof(PassParameterBlockDescVer5) / sizeof(ParamBlockDescID),
- CURRENT_VERSION);
-
-
-const int DISPLACEMENT_INDEX = (W3dMaterialClass::MAX_PASSES * W3dMaterialClass::MAX_STAGES);
-
-Color scale(const Color& a, const Color& b)
-{
- return Color(a.r * b.r, a.g * b.g, a.b * b.b);
-}
-
-/***********************************************************************************************
- * GameMtl::GameMtl -- constructor *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/23/98 GTH : Created. *
- *=============================================================================================*/
-GameMtl::GameMtl(BOOL loading)
-{
- MaterialDialog = NULL;
- SurfaceType = SURFACE_TYPE_DEFAULT;
- SortLevel = SORT_LEVEL_NONE;
-
- Ivalid.SetEmpty();
- RollScroll = 0;
- Flags = 0;
- Flags |= GAMEMTL_PASSCOUNT_ROLLUP_OPEN;
- Set_Flag(GAMEMTL_CONVERTED_TO_NOLOD,true);
-
- DisplacementMap = NULL;
- DisplacementAmt = 0.0F;
-
- Maps = NULL;
- MainParameterBlock = NULL;
- for (int pass=0; passReplaceReference(REF_MAIN,remap.CloneRef(MainParameterBlock));
-
- // Clone the displacment map's settings
- mnew->ReplaceReference (REF_TEXTURE + DISPLACEMENT_INDEX, DisplacementMap);
- mnew->DisplacementAmt = DisplacementAmt;
-
- // Maintain the shader type.
- mnew->Set_Shader_Type(ShaderType);
-
- // replace each pass's parameter block and the textures
- for (int pass=0; pass < W3dMaterialClass::MAX_PASSES; pass++) {
-
- IParamBlock * pblock = NULL;
- if (PassParameterBlock[pass]) {
- pblock = (IParamBlock *)remap.CloneRef(PassParameterBlock[pass]);
- }
- mnew->ReplaceReference(pass_ref_index(pass), pblock);
- mnew->PassParameterBlock[pass] = pblock;
-
- for (int stage=0; stage < W3dMaterialClass::MAX_STAGES; stage++) {
- if (Texture[pass][stage]) {
- mnew->ReplaceReference(texture_ref_index(pass,stage),Texture[pass][stage]->Clone());
- } else {
- mnew->ReplaceReference(texture_ref_index(pass,stage),NULL);
- }
-
- // Copy mapper arg strings and lengths
- if (MapperArgLen[pass][stage] > 0) {
- char *temp = new char[MapperArgLen[pass][stage] + 1];
- assert(strlen(MapperArg[pass][stage]) <= MapperArgLen[pass][stage]);
- strcpy(temp, MapperArg[pass][stage]);
- mnew->MapperArg[pass][stage] = temp;
- mnew->MapperArgLen[pass][stage] = MapperArgLen[pass][stage];
- }
- }
-
- }
-
- mnew->Ivalid = Ivalid;
- return mnew;
-}
-
-
-/***********************************************************************************************
- * GameMtl::NotifyRefChanged -- NotifyRefChanged handler *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/23/98 GTH : Created. *
- *=============================================================================================*/
-RefResult GameMtl::NotifyRefChanged
-(
- Interval changeInt,
- RefTargetHandle hTarget,
- PartID & partID,
- RefMessage message
-)
-{
- switch (message) {
- case REFMSG_CHANGE:
- {
- Ivalid.SetEmpty(); // if any refs changed, clear the validity
- if (MaterialDialog && (MaterialDialog->TheMtl == this)) {
- MaterialDialog->Invalidate(); // if the dialog is up, refresh it
- }
- break;
- }
- case REFMSG_GET_PARAM_DIM:
- {
- GetParamDim *gpd = (GetParamDim*)partID;
- gpd->dim = defaultDim;
- return REF_STOP;
- }
-
- case REFMSG_GET_PARAM_NAME:
- {
- GetParamName *gpn = (GetParamName*)partID;
- bool pass_parameter = false;
- for(int pass = 0; pass < Get_Pass_Count(); pass++) {
- if(hTarget == (RefTargetHandle)PassParameterBlock[pass]) pass_parameter = true;
- }
-
- if (pass_parameter) {
- switch (gpn->index)
- {
- case PB_AMBIENT: gpn->name = _T("Ambient"); break;
- case PB_DIFFUSE: gpn->name = _T("Diffuse"); break;
- case PB_SPECULAR: gpn->name = _T("Specular"); break;
- case PB_EMISSIVE: gpn->name = _T("Emissive"); break;
- case PB_SHININESS: gpn->name = _T("Shininess"); break;
- case PB_OPACITY: gpn->name = _T("Opacity"); break;
- case PB_TRANSLUCENCY: gpn->name = _T("Translucency"); break;
- default: gpn->name = _T(""); break;
- }
- }
- return REF_STOP;
- }
- }
- return(REF_SUCCEED);
-}
-
-
-/***********************************************************************************************
- * GameMtl::SetReference -- set the i'th reference *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/23/98 GTH : Created. *
- *=============================================================================================*/
-void GameMtl::SetReference(int i, RefTargetHandle rtarg)
-{
- assert(i < REF_COUNT);
-
- if (i == REF_MAPS) {
- Maps = (GameMapsClass *)rtarg;
- return;
- }
-
- if (i == REF_MAIN) {
- MainParameterBlock = (IParamBlock*)rtarg;
- return;
- }
-
- if ((i >= REF_PASS_PARAMETERS) && (i < REF_PASS_PARAMETERS + W3dMaterialClass::MAX_PASSES)) {
- PassParameterBlock[i - REF_PASS_PARAMETERS] = (IParamBlock*)rtarg;
- return;
- }
-
- if ((i >= REF_TEXTURE) && (i < REF_TEXTURE + 9)) {
- if (i == REF_TEXTURE + DISPLACEMENT_INDEX) {
- DisplacementMap = (Texmap *)rtarg;
- } else {
- int offset = i - REF_TEXTURE;
- int pass = offset / 2;
- int stage = offset % 2;
- Texture[pass][stage] = (Texmap *)rtarg;
- }
- return;
- }
-}
-
-
-/***********************************************************************************************
- * GameMtl::GetReference -- returnst the i'th reference *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/23/98 GTH : Created. *
- *=============================================================================================*/
-RefTargetHandle GameMtl::GetReference(int i)
-{
- if (i == REF_MAPS) {
- return Maps;
- }
- if (i == REF_MAIN) {
- return MainParameterBlock;
- }
- if ((i >= REF_PASS_PARAMETERS) && (i < REF_PASS_PARAMETERS + W3dMaterialClass::MAX_PASSES)) {
- return PassParameterBlock[i - REF_PASS_PARAMETERS];
- }
- if ((i >= REF_TEXTURE) && (i < REF_TEXTURE + 9)) {
- if (i == REF_TEXTURE + DISPLACEMENT_INDEX) {
- return DisplacementMap;
- } else {
- int offset = i - REF_TEXTURE;
- int pass = offset / 2;
- int stage = offset % 2;
- return Texture[pass][stage];
- }
- }
-
- return NULL;
-}
-
-
-/***********************************************************************************************
- * GameMtl::NumSubTexmaps -- returns the number of texture maps in this material *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/23/98 GTH : Created. *
- *=============================================================================================*/
-int GameMtl::NumSubTexmaps(void)
-{
- return (W3dMaterialClass::MAX_PASSES * W3dMaterialClass::MAX_STAGES) + 1;
-}
-
-
-/***********************************************************************************************
- * GameMtl::Get_Displacement_Map_Index -- returns the Sub-texmap index for the displacement map.
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 7/01/99 PDS : Created. *
- *=============================================================================================*/
-int GameMtl::Get_Displacement_Map_Index(void) const
-{
- return DISPLACEMENT_INDEX;
-}
-
-
-/***********************************************************************************************
- * GameMtl::SetSubTexmap -- set the i'th texture map *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/23/98 GTH : Created. *
- *=============================================================================================*/
-void GameMtl::SetSubTexmap(int i, Texmap * m)
-{
- ReplaceReference(REF_TEXTURE + i, m);
-
- int pass,stage;
- texmap_index_to_pass_stage(i,&pass,&stage);
- if (Texture[pass][stage] != NULL) {
- UVGen * uvgen = Texture[pass][stage]->GetTheUVGen();
- if (uvgen != NULL) {
- uvgen->SetMapChannel(Get_Map_Channel(pass,stage));
- }
- }
-
- NotifyDependents(FOREVER, PART_ALL, REFMSG_CHANGE);
-}
-
-
-/***********************************************************************************************
- * GameMtl::GetSubTexmap -- returns the i'th texture map *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/23/98 GTH : Created. *
- *=============================================================================================*/
-Texmap * GameMtl::GetSubTexmap(int i)
-{
- if (i == DISPLACEMENT_INDEX) {
- return DisplacementMap;
- }
-
- int pass;
- int stage;
- texmap_index_to_pass_stage(i,&pass,&stage);
- return Texture[pass][stage];
-}
-
-
-/***********************************************************************************************
- * GameMtl::CreateParamDlg -- creates the material editor dialog box *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/23/98 GTH : Created. *
- *=============================================================================================*/
-ParamDlg * GameMtl::CreateParamDlg(HWND hwnd_mtl_edit, IMtlParams *imp)
-{
- GameMtlDlg *dlg = new GameMtlDlg(hwnd_mtl_edit, imp, this);
- SetParamDlg(dlg);
- return dlg;
-}
-
-
-/***********************************************************************************************
- * GameMtl::Notify_Changed -- someone has changed this material *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/23/98 GTH : Created. *
- *=============================================================================================*/
-void GameMtl::Notify_Changed(void)
-{
- NotifyDependents(FOREVER, PART_ALL, REFMSG_CHANGE);
- if (MaterialDialog != NULL) {
- MaterialDialog->Update_Display();
- }
-}
-
-
-/***********************************************************************************************
- * GameMtl::Reset -- reset this material to default settings *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/23/98 GTH : Created. *
- *=============================================================================================*/
-void GameMtl::Reset()
-{
- DebugPrint("GameMtl::Reset()\n");
-
- ReplaceReference(REF_MAIN,CreateParameterBlock(MainParameterBlockDesc,1,CURRENT_VERSION));
-
- for (int pass = 0; pass < W3dMaterialClass::MAX_PASSES; pass++) {
-
- // Install a parameter block for each pass
- IParamBlock * pblock = CreateParameterBlock( PassParameterBlockDescVer5,
- sizeof(PassParameterBlockDescVer5)/sizeof(ParamBlockDescID),
- CURRENT_VERSION);
-
- ReplaceReference(pass_ref_index(pass), pblock);
-
- for (int stage = 0;stage < W3dMaterialClass::MAX_STAGES; stage++) {
- ReplaceReference(texture_ref_index(pass,stage), NULL);
-
- Set_Texture_Enable(pass,stage,false);
- Set_Texture_Publish(pass,stage,false);
- Set_Texture_Resize(pass,stage,false);
- Set_Texture_No_Mipmap(pass,stage,false);
- Set_Texture_Clamp_U(pass,stage,false);
- Set_Texture_Clamp_V(pass,stage,false);
- Set_Texture_No_LOD(pass,stage,false);
- Set_Texture_Alpha_Bitmap(pass,stage,false);
- Set_Texture_Hint(pass,stage,W3DTEXTURE_HINT_BASE);
- Set_Texture_Display(pass,stage,false);
- Set_Texture_Frame_Rate(pass,stage,15.0f);
- Set_Texture_Frame_Count(pass,stage,1);
- Set_Texture_Anim_Type(pass,stage,W3DTEXTURE_ANIM_LOOP);
- Set_Map_Channel(pass,stage,1);
-
- if (MapperArg[pass][stage]) {
- delete [] (MapperArg[pass][stage]);
- MapperArg[pass][stage] = NULL;
- MapperArgLen[pass][stage] = 0;
- }
- }
-
- Set_Sort_Level(SORT_LEVEL_NONE);
-
- Set_Ambient(pass,0,(pass == 0 ? Color(1.0,1.0,1.0) : Color(0,0,0)));
- Set_Diffuse(pass,0,(pass == 0 ? Color(1.0,1.0,1.0) : Color(0,0,0)));
- Set_Specular(pass,0,Color(0,0,0));
- Set_Emissive(pass,0,Color(0,0,0));
- Set_Shininess(pass,0,0.0f);
- Set_Opacity(pass,0,1.0f);
- Set_Translucency(pass,0,0.0f);
- Set_Copy_Specular_To_Diffuse(pass,false);
- Set_Mapping_Type(pass,0,W3DMAPPING_UV);
- Set_Mapping_Type(pass,1,W3DMAPPING_UV);
- Set_PSX_Translucency(pass,GAMEMTL_PSX_TRANS_NONE);
- Set_PSX_Lighting(pass,true);
-
- Set_Depth_Compare(pass,W3DSHADER_DEPTHCOMPARE_DEFAULT);
- Set_Depth_Mask(pass,W3DSHADER_DEPTHMASK_DEFAULT);
- Set_Alpha_Test(pass,W3DSHADER_ALPHATEST_DEFAULT);
- Set_Dest_Blend(pass,W3DSHADER_DESTBLENDFUNC_DEFAULT);
- Set_Pri_Gradient(pass,W3DSHADER_PRIGRADIENT_DEFAULT);
- Set_Sec_Gradient(pass,W3DSHADER_SECGRADIENT_DEFAULT);
- Set_Src_Blend(pass,W3DSHADER_SRCBLENDFUNC_DEFAULT);
- Set_Detail_Color_Func(pass,W3DSHADER_DETAILCOLORFUNC_DEFAULT);
- Set_Detail_Alpha_Func(pass,W3DSHADER_DETAILCOLORFUNC_DEFAULT);
-
- // Playstation 2 default for opaque.
- Set_PS2_Shader_Param_A(pass, PSS_SRC);
- Set_PS2_Shader_Param_B(pass, PSS_ZERO);
- Set_PS2_Shader_Param_C(pass, PSS_ONE);
- Set_PS2_Shader_Param_D(pass, PSS_ZERO);
- }
-
- Ivalid.SetEmpty();
- Set_Pass_Count(1); // set default value for the main param block
-}
-
-
-/***********************************************************************************************
- * GameMtl::Update -- time has changed *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/23/98 GTH : Created. *
- *=============================================================================================*/
-void GameMtl::Update(TimeValue t, Interval &ivalid)
-{
- // This function is called by the system prior to rendering
- // Its purpose is to let you pre-calculate anything you can to
- // speed up the subsequent 'Shade' calls.
- Ivalid = FOREVER;
- ivalid &= Ivalid;
-}
-
-
-/***********************************************************************************************
- * GameMtl::Validity -- return the validity of the material at time t *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/23/98 GTH : Created. *
- *=============================================================================================*/
-Interval GameMtl::Validity(TimeValue t)
-{
- return FOREVER;
-}
-
-
-/***********************************************************************************************
- * GameMtl::Requirements -- what requirements does this material have? *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/23/98 GTH : Created. *
- *=============================================================================================*/
-ULONG GameMtl::Requirements(int subMtlNum)
-{
- ULONG req = 0;
-
- for (int pass = 0; pass < W3dMaterialClass::MAX_PASSES; pass++) {
- for (int stage = 0; stage < W3dMaterialClass::MAX_STAGES; stage++) {
- if (Texture[pass][stage]) {
- req |= Texture[pass][stage]->Requirements(subMtlNum);
- }
- }
- }
-
- req |= MTLREQ_BGCOL;
- req |= MTLREQ_NOATMOS;
-
- #ifdef WANT_DISPLACEMENT_MAPS
- req |= MTLREQ_DISPLACEMAP;
- #endif //WANT_DISPLACEMENT_MAPS
-
- return req;
-}
-
-
-/***********************************************************************************************
- * GameMtl::Load -- loading from a MAX file *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/23/98 GTH : Created. *
- *=============================================================================================*/
-IOResult GameMtl::Load(ILoad *iload)
-{
- ULONG nb;
- int id;
- int passindex = 0;
- int len = 0;
- unsigned char tmp8;
- unsigned short tmp16;
- char * tmpstring = NULL;
- float tmpfloat;
- IOResult res;
-
- GameMtlPostLoad * lc = new GameMtlPostLoad(this);
- iload->RegisterPostLoadCallback(lc);
-
- // Register automatic translation callbacks for the pass parameter blocks
- for (int i = 0; i < W3dMaterialClass::MAX_PASSES; i++) {
- iload->RegisterPostLoadCallback(
- new ParamBlockPLCB(PassParameterBlockVersions, NUM_OLDVERSIONS,
- &CurrentPassParameterBlockVersion, this, REF_PASS_PARAMETERS + i)
- );
- }
-
- while (IO_OK==(res=iload->OpenChunk())) {
-
- switch (id = iload->CurChunkID()) {
-
- case MTL_HDR_CHUNK:
- res = MtlBase::Load(iload);
- Ivalid.SetEmpty();
- break;
-
- case GAMEMTL_FLAGS_CHUNK:
- res = iload->Read(&Flags,sizeof(Flags), &nb);
- break;
-
- case GAMEMTL_SURFACE_TYPE_CHUNK:
- res = iload->Read(&SurfaceType,sizeof(SurfaceType),&nb);
- break;
-
- case GAMEMTL_SORT_LEVEL_CHUNK:
- res = iload->Read(&SortLevel,sizeof(SortLevel),&nb);
- break;
-
- case GAMEMTL_PASS0_CUR_PAGE:
- case GAMEMTL_PASS1_CUR_PAGE:
- case GAMEMTL_PASS2_CUR_PAGE:
- case GAMEMTL_PASS3_CUR_PAGE:
- res = iload->Read(&tmp8,sizeof(tmp8),&nb);
- CurPage[id - GAMEMTL_PASS0_CUR_PAGE] = tmp8;
- break;
-
- case GAMEMTL_PASS0_STAGE0_MAPPER_ARGS:
- case GAMEMTL_PASS1_STAGE0_MAPPER_ARGS:
- case GAMEMTL_PASS2_STAGE0_MAPPER_ARGS:
- case GAMEMTL_PASS3_STAGE0_MAPPER_ARGS:
- len = iload->CurChunkLength();
- passindex = id - GAMEMTL_PASS0_STAGE0_MAPPER_ARGS;
- tmpstring = Get_Mapping_Arg_Buffer(passindex, 0, len);
- res = iload->Read(tmpstring, len, &nb);
- break;
-
- case GAMEMTL_PASS0_STAGE1_MAPPER_ARGS:
- case GAMEMTL_PASS1_STAGE1_MAPPER_ARGS:
- case GAMEMTL_PASS2_STAGE1_MAPPER_ARGS:
- case GAMEMTL_PASS3_STAGE1_MAPPER_ARGS:
- len = iload->CurChunkLength();
- passindex = id - GAMEMTL_PASS0_STAGE1_MAPPER_ARGS;
- tmpstring = Get_Mapping_Arg_Buffer(passindex, 1, len);
- res = iload->Read(tmpstring, len, &nb);
- break;
-
- /*
- ** All chunks below here are for the obsolete material plugin...
- */
- case GAMEMTL_GAMEFLAGS_CHUNK:
- break;
-
- case GAMEMTL_ATTRIBUTES_CHUNK:
- res = iload->Read(&lc->Attributes,sizeof(lc->Attributes),&nb);
- lc->IsOld = true;
- break;
-
- case GAMEMTL_COLORS_CHUNK:
- res = iload->Read(&lc->Diffuse,sizeof(lc->Diffuse),&nb);
- lc->IsOld = true;
- break;
-
- case GAMEMTL_DCT_FRAMES_CHUNK:
- res = iload->Read(&tmp16,sizeof(unsigned short),&nb);
- lc->DCTFrames = tmp16;
- lc->IsOld = true;
- break;
-
- case GAMEMTL_DCT_FRAME_RATE_CHUNK:
- res = iload->Read(&tmpfloat,sizeof(float),&nb);
- lc->DCTFrameRate = tmpfloat;
- lc->IsOld = true;
- break;
-
- case GAMEMTL_DIT_FRAMES_CHUNK:
- res = iload->Read(&tmp16,sizeof(unsigned short),&nb);
- lc->DITFrames = tmp16;
- lc->IsOld = true;
- break;
-
- case GAMEMTL_DIT_FRAME_RATE_CHUNK:
- res = iload->Read(&tmpfloat,sizeof(float),&nb);
- lc->DITFrameRate = tmpfloat;
- lc->IsOld = true;
- break;
-
- case GAMEMTL_SCT_FRAMES_CHUNK:
- res = iload->Read(&tmp16,sizeof(unsigned short),&nb);
- lc->SCTFrames = tmp16;
- lc->IsOld = true;
- break;
-
- case GAMEMTL_SCT_FRAME_RATE_CHUNK:
- res = iload->Read(&tmpfloat,sizeof(float),&nb);
- lc->SCTFrameRate = tmpfloat;
- lc->IsOld = true;
- break;
-
- case GAMEMTL_SIT_FRAMES_CHUNK:
- res = iload->Read(&tmp16,sizeof(unsigned short),&nb);
- lc->SITFrames = tmp16;
- lc->IsOld = true;
- break;
-
- case GAMEMTL_SIT_FRAME_RATE_CHUNK:
- res = iload->Read(&tmpfloat,sizeof(float),&nb);
- lc->SITFrameRate = tmpfloat;
- lc->IsOld = true;
- break;
-
- case GAMEMTL_DCT_MAPPING_CHUNK:
- res = iload->Read(&tmp8,sizeof(unsigned char),&nb);
- lc->DCTMappingType = tmp8;
- lc->IsOld = true;
- break;
-
- case GAMEMTL_DIT_MAPPING_CHUNK:
- res = iload->Read(&tmp8,sizeof(unsigned char),&nb);
- lc->DITMappingType = tmp8;
- lc->IsOld = true;
- break;
-
- case GAMEMTL_SCT_MAPPING_CHUNK:
- res = iload->Read(&tmp8,sizeof(unsigned char),&nb);
- lc->SCTMappingType = tmp8;
- lc->IsOld = true;
- break;
-
- case GAMEMTL_SIT_MAPPING_CHUNK:
- res = iload->Read(&tmp8,sizeof(unsigned char),&nb);
- lc->SITMappingType = tmp8;
- lc->IsOld = true;
- break;
-
- case GAMEMTL_DIFFUSE_COLOR_CHUNK:
- res = iload->Read(&lc->Diffuse,sizeof(lc->Diffuse),&nb);
- lc->IsOld = true;
- break;
-
- case GAMEMTL_SPECULAR_COLOR_CHUNK:
- res = iload->Read(&lc->Specular,sizeof(lc->Specular),&nb);
- lc->IsOld = true;
- break;
-
- case GAMEMTL_AMBIENT_COEFF_CHUNK:
- res = iload->Read(&lc->AmbientCoeff,sizeof(lc->AmbientCoeff),&nb);
- lc->IsOld = true;
- break;
-
- case GAMEMTL_DIFFUSE_COEFF_CHUNK:
- res = iload->Read(&lc->DiffuseCoeff,sizeof(lc->DiffuseCoeff),&nb);
- lc->IsOld = true;
- break;
-
- case GAMEMTL_SPECULAR_COEFF_CHUNK:
- res = iload->Read(&lc->SpecularCoeff,sizeof(lc->SpecularCoeff),&nb);
- lc->IsOld = true;
- break;
-
- case GAMEMTL_EMISSIVE_COEFF_CHUNK:
- res = iload->Read(&lc->EmissiveCoeff,sizeof(lc->EmissiveCoeff),&nb);
- lc->IsOld = true;
- break;
-
- case GAMEMTL_OPACITY_CHUNK:
- res = iload->Read(&lc->Opacity,sizeof(lc->Opacity),&nb);
- lc->IsOld = true;
- break;
-
- case GAMEMTL_TRANSLUCENCY_CHUNK:
- res = iload->Read(&lc->Translucency,sizeof(lc->Translucency),&nb);
- lc->IsOld = true;
- break;
-
- case GAMEMTL_SHININESS_CHUNK:
- res = iload->Read(&lc->Shininess,sizeof(lc->Shininess),&nb);
- lc->IsOld = true;
- break;
-
- case GAMEMTL_FOG_CHUNK:
- res = iload->Read(&lc->FogCoeff,sizeof(lc->FogCoeff),&nb);
- lc->IsOld = true;
- break;
-
- default:
- break;
- }
-
- iload->CloseChunk();
- if (res!=IO_OK) {
- return res;
- }
- }
-
- return IO_OK;
-}
-
-
-/***********************************************************************************************
- * GameMtl::Save -- Saving into a MAX file *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/23/98 GTH : Created. *
- *=============================================================================================*/
-IOResult GameMtl::Save(ISave *isave)
-{
- IOResult res;
- ULONG nb;
-
- /*
- ** Save the base class stuff
- */
- isave->BeginChunk(MTL_HDR_CHUNK);
- res = MtlBase::Save(isave);
- if (res!=IO_OK)
- return res;
- isave->EndChunk();
-
- /*
- ** Save the flags
- */
- isave->BeginChunk(GAMEMTL_FLAGS_CHUNK);
- isave->Write(&Flags,sizeof(Flags),&nb);
- isave->EndChunk();
-
- /*
- ** Save the "cur-pages"
- */
- uint8 tmp8;
- int pass;
- for (pass=0; pass < W3dMaterialClass::MAX_PASSES; pass++) {
- isave->BeginChunk(GAMEMTL_PASS0_CUR_PAGE + pass);
- tmp8 = CurPage[pass];
- isave->Write(&tmp8,sizeof(tmp8),&nb);
- isave->EndChunk();
- }
-
- /*
- ** Save any Mapper Args
- */
- for (pass=0; pass < W3dMaterialClass::MAX_PASSES; pass++) {
- char *buffer = Get_Mapping_Arg_Buffer(pass, 0);
- if (buffer) {
- isave->BeginChunk(GAMEMTL_PASS0_STAGE0_MAPPER_ARGS + pass);
- isave->Write(buffer, strlen(buffer) + 1, &nb);
- isave->EndChunk();
- }
- buffer = Get_Mapping_Arg_Buffer(pass, 1);
- if (buffer) {
- isave->BeginChunk(GAMEMTL_PASS0_STAGE1_MAPPER_ARGS + pass);
- isave->Write(buffer, strlen(buffer) + 1, &nb);
- isave->EndChunk();
- }
- }
-
- /*
- ** Save the surface type
- */
- isave->BeginChunk(GAMEMTL_SURFACE_TYPE_CHUNK);
- isave->Write(&SurfaceType,sizeof(SurfaceType),&nb);
- isave->EndChunk();
-
- /*
- ** Save the sort level
- */
- isave->BeginChunk(GAMEMTL_SORT_LEVEL_CHUNK);
- isave->Write(&SortLevel,sizeof(SortLevel),&nb);
- isave->EndChunk();
-
- return IO_OK;
-}
-
-
-/***********************************************************************************************
- * GameMtl::Shade -- evaluate the material for the renderer. *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * This function could use a little work. It doesn't always produce correct results. *
- * *
- * HISTORY: *
- * 11/23/98 GTH : Created. *
- *=============================================================================================*/
-void GameMtl::Shade(ShadeContext& sc)
-{
- if (ShaderType == STE_PS2_SHADER) {
- ps2_shade(sc);
- return;
- }
-
- if (gbufID) sc.SetGBufferID(gbufID);
-
- /*
- ** Shadowing, return black
- */
- if (sc.mode==SCMODE_SHADOW) {
- sc.out.t = Color(0,0,0);
- return;
- }
-
- /*
- ** Render each pass, initialize dest with the current background
- */
- Color back_c;
- Color back_t;
-
- Color dest;
- Color src;
- float alpha;
-
- sc.GetBGColor(back_c,back_t, FALSE);
- dest = back_c;
-
- for (int pass=0; pass < Get_Pass_Count(); pass++) {
-
- /*
- ** Computing the Primary and Secondary Gradients
- */
- Color ambient = sc.ambientLight;
- Color diffuse(0,0,0);
- Color specular(0,0,0);
-
- for(int light_index = 0; light_index < sc.nLights; light_index++) {
-
- Color light_color;
- Point3 light_dir;
- float dot_nl;
- float diffuse_coef;
-
- LightDesc * light = sc.Light(light_index);
- if(light->Illuminate(sc, sc.Normal(), light_color, light_dir, dot_nl, diffuse_coef)) {
-
- //ambient += light_color;
- if (dot_nl > 0.0f) diffuse += dot_nl * light_color;
-
- float c = DotProd(light_dir, sc.ReflectVector());
- if(c > 0.f) {
- specular += (float)pow(c, Get_Shininess(pass, sc.CurTime())) * light_color;
- }
- }
- }
-
- ambient = ambient * Get_Ambient(pass,sc.CurTime());
- diffuse = diffuse * Get_Diffuse(pass,sc.CurTime());
- specular = specular * Get_Specular(pass,sc.CurTime());
-
- Color pri_gradient = ambient + diffuse + Get_Emissive(pass,sc.CurTime());
- if (pri_gradient.r > 1.0f) pri_gradient.r = 1.0f;
- if (pri_gradient.g > 1.0f) pri_gradient.g = 1.0f;
- if (pri_gradient.b > 1.0f) pri_gradient.b = 1.0f;
-
- Color sec_gradient = specular * Get_Specular(pass,sc.CurTime());
-
- /*
- ** Sampling the Texture(s)
- */
- AColor texel(1,1,1,1);
- if (Get_Texture_Enable(pass,0) && Texture[pass][0]) {
-// if (Get_Mapping_Type(pass) == GAMEMTL_MAPPING_UV) {
- texel = Texture[pass][0]->EvalColor(sc);
-// }
- }
-
- if (Get_Texture_Enable(pass,1) && Texture[pass][1]) {
- AColor detail_texel = Texture[pass][1]->EvalColor(sc);
- switch (Get_Detail_Color_Func(pass))
- {
- case W3DSHADER_DETAILCOLORFUNC_DISABLE:
- break;
- case W3DSHADER_DETAILCOLORFUNC_DETAIL:
- texel = detail_texel;
- break;
- case W3DSHADER_DETAILCOLORFUNC_SCALE:
- texel.r = detail_texel.r * texel.r;
- texel.g = detail_texel.g * texel.g;
- texel.b = detail_texel.b * texel.b;
- break;
- case W3DSHADER_DETAILCOLORFUNC_INVSCALE:
- texel.r = texel.r + (1.0f - texel.r) * detail_texel.r;
- texel.g = texel.g + (1.0f - texel.g) * detail_texel.g;
- texel.b = texel.b + (1.0f - texel.b) * detail_texel.b;
- break;
- case W3DSHADER_DETAILCOLORFUNC_ADD:
- texel.r = detail_texel.r + texel.r;
- texel.g = detail_texel.g + texel.g;
- texel.b = detail_texel.b + texel.b;
- break;
- case W3DSHADER_DETAILCOLORFUNC_SUB:
- texel.r = texel.r - detail_texel.r;
- texel.g = texel.g - detail_texel.g;
- texel.b = texel.b - detail_texel.b;
- break;
- case W3DSHADER_DETAILCOLORFUNC_SUBR:
- texel.r = detail_texel.r - texel.r;
- texel.g = detail_texel.g - texel.g;
- texel.b = detail_texel.b - texel.b;
- break;
- case W3DSHADER_DETAILCOLORFUNC_BLEND:
- texel.r = (texel.a * texel.r) + ((1.0f - texel.a)*detail_texel.r);
- texel.g = (texel.a * texel.g) + ((1.0f - texel.a)*detail_texel.g);
- texel.b = (texel.a * texel.b) + ((1.0f - texel.a)*detail_texel.b);
- break;
- case W3DSHADER_DETAILCOLORFUNC_DETAILBLEND:
- texel.r = (detail_texel.a * texel.r) + ((1.0f - detail_texel.a)*detail_texel.r);
- texel.g = (detail_texel.a * texel.g) + ((1.0f - detail_texel.a)*detail_texel.g);
- texel.b = (detail_texel.a * texel.b) + ((1.0f - detail_texel.a)*detail_texel.b);
- break;
- }
- switch (Get_Detail_Alpha_Func(pass))
- {
- case W3DSHADER_DETAILALPHAFUNC_DISABLE:
- break;
- case W3DSHADER_DETAILALPHAFUNC_DETAIL:
- texel.a = detail_texel.a;
- break;
- case W3DSHADER_DETAILALPHAFUNC_SCALE:
- texel.a = texel.a * detail_texel.a;
- break;
- case W3DSHADER_DETAILALPHAFUNC_INVSCALE:
- texel.a = texel.a + (1.0f - texel.a) * detail_texel.a;
- break;
- }
- }
-
- /*
- ** Shader parameters define combination...
- */
- src.r = texel.r;
- src.g = texel.g;
- src.b = texel.b;
- alpha = texel.a * Get_Opacity(pass,sc.CurTime());
-
- switch (Get_Pri_Gradient(pass))
- {
- case W3DSHADER_PRIGRADIENT_DISABLE: break;
- case W3DSHADER_PRIGRADIENT_MODULATE: src = src * pri_gradient; break;
- case W3DSHADER_PRIGRADIENT_ADD: src = src + pri_gradient; break;
- }
-
- switch (Get_Sec_Gradient(pass))
- {
- case W3DSHADER_SECGRADIENT_DISABLE: break;
- case W3DSHADER_SECGRADIENT_ENABLE: src = src + sec_gradient; break;
- }
-
- if (src.r > 1.0f) src.r = 1.0f;
- if (src.g > 1.0f) src.g = 1.0f;
- if (src.b > 1.0f) src.b = 1.0f;
-
- if (src.r < 0.0f) src.r = 0.0f;
- if (src.g < 0.0f) src.g = 0.0f;
- if (src.b < 0.0f) src.b = 0.0f;
-
- Color dest_blend;
- switch (Get_Dest_Blend(pass))
- {
- case W3DSHADER_DESTBLENDFUNC_ZERO: dest_blend = Color(0,0,0); break;
- case W3DSHADER_DESTBLENDFUNC_ONE: dest_blend = Color(1,1,1); break;
- case W3DSHADER_DESTBLENDFUNC_SRC_COLOR: dest_blend = src; break;
- case W3DSHADER_DESTBLENDFUNC_ONE_MINUS_SRC_COLOR: dest_blend = Color(1.0f-src.r,1.0f-src.g, 1.0f-src.b); break;
- case W3DSHADER_DESTBLENDFUNC_SRC_ALPHA: dest_blend = Color(alpha,alpha,alpha); break;
- case W3DSHADER_DESTBLENDFUNC_ONE_MINUS_SRC_ALPHA: dest_blend = Color(1.0f-alpha,1.0f-alpha,1.0f-alpha); break;
- case W3DSHADER_DESTBLENDFUNC_SRC_COLOR_PREFOG: dest_blend = src; break;
- }
-
- Color src_blend;
- switch (Get_Src_Blend(pass))
- {
- case W3DSHADER_SRCBLENDFUNC_ZERO: src_blend = Color(0,0,0); break;
- case W3DSHADER_SRCBLENDFUNC_ONE: src_blend = Color(1,1,1); break;
- case W3DSHADER_SRCBLENDFUNC_SRC_ALPHA: src_blend = Color(alpha,alpha,alpha); break;
- case W3DSHADER_SRCBLENDFUNC_ONE_MINUS_SRC_ALPHA: src_blend = Color(1.0f-alpha,1.0f-alpha,1.0f-alpha); break;
- }
-
- src = scale(src_blend,src) + scale(dest_blend,dest);
-
- /*
- ** Dest becomes Src and we repeat!
- */
- dest = src;
-
- }
-
- sc.out.t = Color(0.0f, 0.0f, 0.0f);
- sc.out.c = dest;
-
-}
-
-
-/***********************************************************************************************
- * GameMtl::ps2_shade -- Emulate the PS2 shader. *
- * *
- * *
- * *
- * *
- * HISTORY: *
- * 10/12/1999MLL: Created. *
- *=============================================================================================*/
-void GameMtl::ps2_shade(ShadeContext& sc)
-{
- if (gbufID) sc.SetGBufferID(gbufID);
-
- /*
- ** Shadowing, return black
- */
- if (sc.mode == SCMODE_SHADOW) {
- sc.out.t = Color(0,0,0);
- return;
- }
-
- /*
- ** Render each pass, initialize dest with the current background
- */
-
- // Background transparency. ???
- Color back_t;
- Color back_c;
-
- AColor dest;
- AColor src(1,1,1,1);
-
- sc.GetBGColor(back_c, back_t, FALSE);
-
- dest.r = back_c.r;
- dest.g = back_c.g;
- dest.b = back_c.b;
- dest.a = 0.0f;
-
- for (int pass=0; pass < Get_Pass_Count(); pass++) {
-
- // Compute the gradients.
- Color ambient = sc.ambientLight;
- Color diffuse(0,0,0);
- Color specular(0,0,0);
-
- for (int light_index = 0; light_index < sc.nLights; light_index++) {
-
- Color light_color;
- Point3 light_dir;
- float dot_nl;
- float diffuse_coef;
-
- LightDesc * light = sc.Light(light_index);
-
- assert(light);
- if(light->Illuminate(sc, sc.Normal(), light_color, light_dir, dot_nl, diffuse_coef)) {
-
- if (dot_nl > 0.0f) diffuse += dot_nl * light_color;
-
- float c = DotProd(light_dir, sc.ReflectVector());
- if (c > 0.f) {
- specular += (float)pow(c, Get_Shininess(pass, sc.CurTime())) * light_color;
- }
- }
- }
-
- ambient = ambient * Get_Ambient(pass,sc.CurTime());
- diffuse = diffuse * Get_Diffuse(pass,sc.CurTime());
- specular = specular * Get_Specular(pass,sc.CurTime());
-
- Color gradient = ambient + diffuse + Get_Emissive(pass,sc.CurTime());
- AColor pri_gradient;
- pri_gradient.r = gradient.r;
- pri_gradient.g = gradient.g;
- pri_gradient.b = gradient.b;
- pri_gradient.a = 1.0f;
- if (pri_gradient.r > 1.0f) pri_gradient.r = 1.0f;
- if (pri_gradient.g > 1.0f) pri_gradient.g = 1.0f;
- if (pri_gradient.b > 1.0f) pri_gradient.b = 1.0f;
-
- /*
- ** Sampling the Texture(s)
- */
- if (Get_Texture_Enable(pass,0) && Texture[pass][0]) {
- src = Texture[pass][0]->EvalColor(sc);
- }
-
-
- /*
- ** Shader parameters define combination...
- */
- src.a *= Get_Opacity(pass,sc.CurTime());
-
- switch (Get_Pri_Gradient(pass))
- {
- case PSS_PRIGRADIENT_MODULATE:
- src = src * pri_gradient;
- break;
- case PSS_PRIGRADIENT_HIGHLIGHT:
- src = src * pri_gradient;
- src += back_t; // ???
- break;
- case PSS_PRIGRADIENT_HIGHLIGHT2:
- src = src * pri_gradient;
- src += back_t; // ???
- break;
- }
-
- if (src.r > 1.0f) src.r = 1.0f;
- if (src.g > 1.0f) src.g = 1.0f;
- if (src.b > 1.0f) src.b = 1.0f;
- if (src.b > 1.0f) src.a = 1.0f;
-
- if (src.r < 0.0f) src.r = 0.0f;
- if (src.g < 0.0f) src.g = 0.0f;
- if (src.b < 0.0f) src.b = 0.0f;
- if (src.a < 0.0f) src.a = 0.0f;
-
- AColor param_a;
- AColor param_b;
- AColor param_c;
- AColor param_d;
- int a_value = Get_PS2_Shader_Param_A(pass);
- int b_value = Get_PS2_Shader_Param_B(pass);
- int c_value = Get_PS2_Shader_Param_C(pass);
- int d_value = Get_PS2_Shader_Param_D(pass);
-
- switch (a_value)
- {
- case PSS_SRC:
- param_a = src;
- break;
- case PSS_DEST:
- param_a = dest;
- break;
- case PSS_ZERO:
- param_a = AColor(0, 0, 0, 0);
- break;
- }
-
- switch (b_value)
- {
- case PSS_SRC:
- param_b = src;
- break;
- case PSS_DEST:
- param_b = dest;
- break;
- case PSS_ZERO:
- param_b = AColor(0, 0, 0, 0);
- break;
- }
-
- switch (c_value)
- {
- case PSS_SRC_ALPHA:
- param_c = AColor(src.a, src.a, src.a, src.a);
- break;
- case PSS_DEST_ALPHA:
- param_c = back_t; // ???
- break;
- case PSS_ONE:
- param_c = AColor(1, 1, 1, 1);
- break;
- }
-
- switch (d_value)
- {
- case PSS_SRC:
- param_d = src;
- break;
- case PSS_DEST:
- param_d = dest;
- break;
- case PSS_ZERO:
- param_d = AColor(0, 0, 0);
- break;
- }
-
- src = scale((param_a - param_b), param_c) + param_d;
-
- if (src.r > 1.0f) src.r = 1.0f;
- if (src.g > 1.0f) src.g = 1.0f;
- if (src.b > 1.0f) src.b = 1.0f;
- if (src.b > 1.0f) src.a = 1.0f;
-
- if (src.r < 0.0f) src.r = 0.0f;
- if (src.g < 0.0f) src.g = 0.0f;
- if (src.b < 0.0f) src.b = 0.0f;
- if (src.a < 0.0f) src.a = 0.0f;
-
- /*
- ** Dest becomes Src and we repeat!
- */
- dest = src;
- }
-
- sc.out.t = Color(0.0f, 0.0f, 0.0f);
- sc.out.c.r = dest.r;
- sc.out.c.g = dest.g;
- sc.out.c.b = dest.b;
-
-
-}
-
-// PS2 equation paramaters.
-// They are set to primes to avoid multiple equation solutions.
-enum Shader_Translation {
- ST_ZERO,
- ST_ONE,
- ST_SRC = 7,
- ST_DEST = 31,
- ST_SRC_ALPHA = 101,
- ST_DEST_ALPHA = 2999,
-};
-
-/***********************************************************************************************
- * GameMtl::Compute_PC_Shader_From_PS2_Shader -- Determine if a PC shader can be created. *
- * *
- * *
- * *
- * *
- * HISTORY: *
- * 10/13/1999MLL: Created. *
- *=============================================================================================*/
-int GameMtl::Compute_PC_Shader_From_PS2_Shader(int pass)
-{
- int param_value[4];
-
- // These match the PC equation paramaters.
- static const int src_blend[4] = {
- ST_ZERO,
- ST_ONE,
- ST_SRC_ALPHA,
- 1 - ST_SRC_ALPHA
- };
- static const int dest_blend[6] = {
- ST_ZERO,
- ST_ONE,
- ST_SRC,
- 1 - ST_SRC,
- ST_SRC_ALPHA,
- 1 - ST_SRC_ALPHA
- };
-
- int i = 0;
- int j = 0;
- int equation_value = 0;
-
- // Get the PS2 shader values.
- param_value[0] = Get_PS2_Shader_Param_A(pass);
- param_value[1] = Get_PS2_Shader_Param_B(pass);
- param_value[2] = Get_PS2_Shader_Param_D(pass);
- param_value[3] = Get_PS2_Shader_Param_C(pass);
-
- // Convert them to the enumeration.
- for (i = 0; i < 3; i++) {
- switch(param_value[i])
- {
- case PSS_SRC:
- param_value[i] = ST_SRC;
- break;
- case PSS_DEST:
- param_value[i] = ST_DEST;
- break;
- case PSS_ZERO:
- param_value[i] = ST_ZERO;
- break;
- }
- }
-
- // The alpha paramater.
- switch(param_value[3])
- {
- case PSS_SRC_ALPHA:
- param_value[3] = ST_SRC_ALPHA;
- break;
- case PSS_DEST_ALPHA:
- param_value[3] = ST_DEST_ALPHA;
- break;
- case PSS_ONE:
- param_value[3] = ST_ONE;
- break;
- }
-
- // Calculate the PS2 shader.
- equation_value = ((param_value[0] - param_value[1]) * param_value[3]) + param_value[2];
-
- for (i = 0; i < 4; i++) {
- for (j = 0; j < 6; j++) {
- // Calculate the PC shader. If equal, we have found a conversion.
- if (((src_blend[i] * ST_SRC) + (dest_blend[j] * ST_DEST)) == equation_value) {
- break;
- }
- }
-
- if (j != 6) {
- break;
- }
- }
-
- if ((j == 6) && (i == 4)) {
- // Set the W3D shader to opaque.
- Set_Dest_Blend(pass, W3DSHADER_DESTBLENDFUNC_ZERO);
- Set_Src_Blend(pass, W3DSHADER_SRCBLENDFUNC_ONE);
-
- // No matches.
- return (FALSE);
- }
-
- // Set the PC shader to an equivalant of the PS2 shader.
- switch (dest_blend[j])
- {
- case ST_ZERO:
- Set_Dest_Blend(pass, W3DSHADER_DESTBLENDFUNC_ZERO);
- break;
- case ST_ONE:
- Set_Dest_Blend(pass, W3DSHADER_DESTBLENDFUNC_ONE);
- break;
- case ST_SRC:
- Set_Dest_Blend(pass, W3DSHADER_DESTBLENDFUNC_SRC_COLOR);
- break;
- case (1 - ST_SRC):
- Set_Dest_Blend(pass, W3DSHADER_DESTBLENDFUNC_ONE_MINUS_SRC_COLOR);
- break;
- case ST_SRC_ALPHA:
- Set_Dest_Blend(pass, W3DSHADER_DESTBLENDFUNC_SRC_ALPHA);
- break;
- case (1 - ST_SRC_ALPHA):
- Set_Dest_Blend(pass, W3DSHADER_DESTBLENDFUNC_ONE_MINUS_SRC_ALPHA);
- break;
- }
-
- switch (src_blend[i])
- {
- case ST_ZERO:
- Set_Src_Blend(pass, W3DSHADER_SRCBLENDFUNC_ZERO);
- break;
- case ST_ONE:
- Set_Src_Blend(pass, W3DSHADER_SRCBLENDFUNC_ONE);
- break;
- case ST_SRC_ALPHA:
- Set_Src_Blend(pass, W3DSHADER_SRCBLENDFUNC_SRC_ALPHA);
- break;
- case (1 - ST_SRC_ALPHA):
- Set_Src_Blend(pass, W3DSHADER_SRCBLENDFUNC_ONE_MINUS_SRC_ALPHA);
- break;
- }
-
- // A match was made.
- return (TRUE);
-}
-
-
-/***********************************************************************************************
- * GameMtl::Compute_PS2_Shader_From_PC_Shader -- Change a W3D material to a PS2 W3D material. *
-W3DSHADER_PRIGRADIENT_ * *
- * *
- * *
- * *
- * HISTORY: *
- * 10/26/1999MLL: Created. *
- *=============================================================================================*/
-int GameMtl::Compute_PS2_Shader_From_PC_Shader(int pass)
-{
-
- // These match the PC equation paramaters.
- static const int a_blend[3] = {
- ST_ZERO,
- ST_SRC,
- ST_DEST,
- };
-
- static const int b_blend[3] = {
- ST_ZERO,
- ST_SRC,
- ST_DEST,
- };
-
- static const int d_blend[3] = {
- ST_ZERO,
- ST_SRC,
- ST_DEST,
- };
-
- static const int c_blend[6] = {
- ST_ONE,
- ST_SRC_ALPHA,
- ST_DEST_ALPHA,
- };
-
- int i = 0;
- int j = 0;
- int k = 0;
- int l = 0;
- int equation_value = 0;
- int param_value[2];
-
- // Get the PC shader values.
- param_value[0] = Get_Src_Blend(pass);
- param_value[1] = Get_Dest_Blend(pass);
-
- switch (param_value[0])
- {
- case W3DSHADER_SRCBLENDFUNC_ZERO:
- param_value[0] = ST_ZERO;
- break;
- case W3DSHADER_SRCBLENDFUNC_ONE:
- param_value[0] = ST_ONE;
- break;
- case W3DSHADER_SRCBLENDFUNC_SRC_ALPHA:
- param_value[0] = ST_SRC_ALPHA;
- break;
- case W3DSHADER_SRCBLENDFUNC_ONE_MINUS_SRC_ALPHA:
- param_value[0] = 1 - ST_SRC_ALPHA;
- break;
- }
-
- // Convert them to the enumeration.
- switch (param_value[1])
- {
- case W3DSHADER_DESTBLENDFUNC_ZERO:
- param_value[1] = ST_ZERO;
- break;
- case W3DSHADER_DESTBLENDFUNC_ONE:
- param_value[1] = ST_ONE;
- break;
- case W3DSHADER_DESTBLENDFUNC_SRC_COLOR:
- param_value[1] = ST_SRC;
- break;
- case W3DSHADER_DESTBLENDFUNC_ONE_MINUS_SRC_COLOR:
- param_value[1] = 1 - ST_SRC;
- break;
- case W3DSHADER_DESTBLENDFUNC_SRC_ALPHA:
- param_value[1] = ST_SRC_ALPHA;
- break;
- case W3DSHADER_DESTBLENDFUNC_ONE_MINUS_SRC_ALPHA:
- param_value[1] = 1 - ST_SRC_ALPHA;
- break;
- case W3DSHADER_DESTBLENDFUNC_SRC_COLOR_PREFOG:
- assert(true);
- break;
- }
-
-
- // Calculate the PC shader.
- equation_value = param_value[0] * ST_SRC + param_value[1] * ST_DEST;
-
- // Set the shader to be a PS2 Shader.
- ShaderType = STE_PS2_SHADER;
-
- // Find a match for the depth compare test.
- switch (Get_Depth_Compare(pass))
- {
- case W3DSHADER_DEPTHCOMPARE_PASS_NEVER:
- Set_Depth_Compare(pass, PSS_DEPTHCOMPARE_PASS_NEVER);
- break;
- case W3DSHADER_DEPTHCOMPARE_PASS_LESS:
- Set_Depth_Compare(pass, PSS_DEPTHCOMPARE_PASS_LESS);
- break;
- case W3DSHADER_DEPTHCOMPARE_PASS_LEQUAL:
- Set_Depth_Compare(pass, PSS_DEPTHCOMPARE_PASS_LEQUAL);
- break;
- case W3DSHADER_DEPTHCOMPARE_PASS_ALWAYS:
- Set_Depth_Compare(pass, PSS_DEPTHCOMPARE_PASS_ALWAYS);
- break;
- default:
- Set_Depth_Compare(pass, PSS_DEPTHCOMPARE_PASS_LEQUAL);
- break;
- }
-
- // Only 1 gradient matches between the PC and PS2.
- switch (Get_Pri_Gradient(pass))
- {
- case W3DSHADER_PRIGRADIENT_MODULATE:
- Set_Pri_Gradient(pass, PSS_PRIGRADIENT_MODULATE);
- break;
- default:
- Set_Pri_Gradient(pass, PSS_PRIGRADIENT_MODULATE);
- break;
- }
-
- for (i = 0; i < 3; i++) {
- for (j = 0; j < 3; j++) {
- for (k = 0; k < 3; k++) {
- for (l = 0; l < 3; l++) {
- // Calculate the PS2 shader. If equal, we have found a conversion.
- if (equation_value == ((a_blend[i] - b_blend[j]) * c_blend[k]) + d_blend[l]) {
- goto finished;
- }
- }
- }
- }
- }
-
- // Set the PS2 W3D shader to opaque.
- Set_PS2_Shader_Param_A(pass, PSS_SRC);
- Set_PS2_Shader_Param_B(pass, PSS_ZERO);
- Set_PS2_Shader_Param_C(pass, PSS_ONE);
- Set_PS2_Shader_Param_D(pass, PSS_ZERO);
- Set_Depth_Mask(pass,W3DSHADER_DEPTHMASK_DEFAULT);
-
- // No matches.
- return (FALSE);
-
-finished:
- // Set the PS2 shader to an equivalant of the PC shader.
- switch (a_blend[i])
- {
- case ST_ZERO:
- Set_PS2_Shader_Param_A(pass, PSS_ZERO);
- break;
- case ST_SRC:
- Set_PS2_Shader_Param_A(pass, PSS_SRC);
- break;
- case ST_DEST:
- Set_PS2_Shader_Param_A(pass, PSS_DEST);
- break;
- }
-
- switch (b_blend[j])
- {
- case ST_ZERO:
- Set_PS2_Shader_Param_B(pass, PSS_ZERO);
- break;
- case ST_SRC:
- Set_PS2_Shader_Param_B(pass, PSS_SRC);
- break;
- case ST_DEST:
- Set_PS2_Shader_Param_B(pass, PSS_DEST);
- break;
- }
-
-
- switch (d_blend[l])
- {
- case ST_ZERO:
- Set_PS2_Shader_Param_D(pass, PSS_ZERO);
- break;
- case ST_SRC:
- Set_PS2_Shader_Param_D(pass, PSS_SRC);
- break;
- case ST_DEST:
- Set_PS2_Shader_Param_D(pass, PSS_DEST);
- break;
- }
-
- switch (c_blend[k])
- {
- case ST_ONE:
- Set_PS2_Shader_Param_C(pass, PSS_ONE);
- break;
- case ST_SRC_ALPHA:
- Set_PS2_Shader_Param_C(pass, PSS_SRC_ALPHA);
- break;
- case ST_DEST_ALPHA:
- Set_PS2_Shader_Param_C(pass, PSS_DEST_ALPHA);
- break;
- }
-
- // A match was made.
- return (TRUE);
-}
-
-void GameMtl::Set_Pass_Count(int passcount)
-{
- assert(MainParameterBlock);
- MainParameterBlock->SetValue(0, TimeValue(0), passcount);
-}
-
-int GameMtl::Get_Pass_Count(void)
-{
- assert(MainParameterBlock);
- int pcount;
- MainParameterBlock->GetValue(0, TimeValue(0), pcount, FOREVER);
- return pcount;
-}
-
-
-Color GameMtl::Get_Ambient(int pass,TimeValue t)
-{
- Color val;
- PassParameterBlock[pass]->GetValue(PB_AMBIENT,t,val,FOREVER);
- return val;
-}
-Color GameMtl::Get_Diffuse(int pass,TimeValue t)
-{
- Color val;
- PassParameterBlock[pass]->GetValue(PB_DIFFUSE,t,val,FOREVER);
- return val;
-}
-Color GameMtl::Get_Specular(int pass,TimeValue t)
-{
- Color val;
- PassParameterBlock[pass]->GetValue(PB_SPECULAR,t,val,FOREVER);
- return val;
-}
-Color GameMtl::Get_Emissive(int pass,TimeValue t)
-{
- Color val;
- PassParameterBlock[pass]->GetValue(PB_EMISSIVE,t,val,FOREVER);
- return val;
-}
-float GameMtl::Get_Shininess(int pass,TimeValue t)
-{
- float val;
- PassParameterBlock[pass]->GetValue(PB_SHININESS,t,val,FOREVER);
- return val;
-}
-float GameMtl::Get_Opacity(int pass,TimeValue t)
-{
- float val;
- PassParameterBlock[pass]->GetValue(PB_OPACITY,t,val,FOREVER);
- return val;
-}
-float GameMtl::Get_Translucency(int pass,TimeValue t)
-{
- float val;
- PassParameterBlock[pass]->GetValue(PB_TRANSLUCENCY,t,val,FOREVER);
- return val;
-}
-int GameMtl::Get_Copy_Specular_To_Diffuse(int pass)
-{
- int val;
- PassParameterBlock[pass]->GetValue(PB_COPY_SPECULAR_TO_DIFFUSE,0,val,FOREVER);
- return val;
-}
-int GameMtl::Get_Mapping_Type(int pass, int stage)
-{
- int val = -1;
- if (stage == 0)
- PassParameterBlock[pass]->GetValue(PB_STAGE0_MAPPING_TYPE,0,val,FOREVER);
- else if (stage == 1)
- PassParameterBlock[pass]->GetValue(PB_STAGE1_MAPPING_TYPE,0,val,FOREVER);
- return val;
-}
-int GameMtl::Get_PSX_Translucency(int pass)
-{
- int val;
- PassParameterBlock[pass]->GetValue(PB_PSX_TRANSLUCENCY,0,val,FOREVER);
- return val;
-}
-int GameMtl::Get_PSX_Lighting(int pass)
-{
- int val;
- PassParameterBlock[pass]->GetValue(PB_PSX_LIGHTING,0,val,FOREVER);
- return val;
-}
-int GameMtl::Get_Depth_Compare(int pass)
-{
- int val;
- PassParameterBlock[pass]->GetValue(PB_DEPTH_COMPARE,0,val,FOREVER);
- return val;
-}
-int GameMtl::Get_Depth_Mask(int pass)
-{
- int val;
- PassParameterBlock[pass]->GetValue(PB_DEPTH_MASK,0,val,FOREVER);
- return val;
-}
-int GameMtl::Get_Alpha_Test(int pass)
-{
- int val;
- PassParameterBlock[pass]->GetValue(PB_ALPHA_TEST,0,val,FOREVER);
- return val;
-}
-int GameMtl::Get_Dest_Blend(int pass)
-{
- int val;
- PassParameterBlock[pass]->GetValue(PB_DEST_BLEND,0,val,FOREVER);
- return val;
-}
-int GameMtl::Get_Pri_Gradient(int pass)
-{
- int val;
- PassParameterBlock[pass]->GetValue(PB_PRI_GRADIENT,0,val,FOREVER);
- return val;
-}
-int GameMtl::Get_Sec_Gradient(int pass)
-{
- int val;
- PassParameterBlock[pass]->GetValue(PB_SEC_GRADIENT,0,val,FOREVER);
- return val;
-}
-int GameMtl::Get_Src_Blend(int pass)
-{
- int val;
- PassParameterBlock[pass]->GetValue(PB_SRC_BLEND,0,val,FOREVER);
- return val;
-}
-int GameMtl::Get_Detail_Color_Func(int pass)
-{
- int val;
- PassParameterBlock[pass]->GetValue(PB_DETAIL_COLOR_FUNC,0,val,FOREVER);
- return val;
-}
-int GameMtl::Get_Detail_Alpha_Func(int pass)
-{
- int val;
- PassParameterBlock[pass]->GetValue(PB_DETAIL_ALPHA_FUNC,0,val,FOREVER);
- return val;
-}
-int GameMtl::Get_Texture_Enable(int pass,int stage)
-{
- int val;
- if (stage == 0) {
- PassParameterBlock[pass]->GetValue(PB_STAGE0_TEXTURE_ENABLE,0,val,FOREVER);
- } else {
- PassParameterBlock[pass]->GetValue(PB_STAGE1_TEXTURE_ENABLE,0,val,FOREVER);
- }
- return val;
-}
-int GameMtl::Get_Texture_Publish(int pass,int stage)
-{
- int val;
- if (stage == 0) {
- PassParameterBlock[pass]->GetValue(PB_STAGE0_TEXTURE_PUBLISH,0,val,FOREVER);
- } else {
- PassParameterBlock[pass]->GetValue(PB_STAGE1_TEXTURE_PUBLISH,0,val,FOREVER);
- }
- return val;
-}
-int GameMtl::Get_Texture_Resize(int pass,int stage)
-{
- int val;
- if (stage == 0) {
- PassParameterBlock[pass]->GetValue(PB_STAGE0_TEXTURE_RESIZE,0,val,FOREVER);
- } else {
- PassParameterBlock[pass]->GetValue(PB_STAGE1_TEXTURE_RESIZE,0,val,FOREVER);
- }
- return val;
-}
-int GameMtl::Get_Texture_No_Mipmap(int pass,int stage)
-{
- int val;
- if (stage == 0) {
- PassParameterBlock[pass]->GetValue(PB_STAGE0_TEXTURE_NO_MIPMAP,0,val,FOREVER);
- } else {
- PassParameterBlock[pass]->GetValue(PB_STAGE1_TEXTURE_NO_MIPMAP,0,val,FOREVER);
- }
- return val;
-}
-int GameMtl::Get_Texture_Clamp_U(int pass,int stage)
-{
- int val;
- if (stage == 0) {
- PassParameterBlock[pass]->GetValue(PB_STAGE0_TEXTURE_CLAMP_U,0,val,FOREVER);
- } else {
- PassParameterBlock[pass]->GetValue(PB_STAGE1_TEXTURE_CLAMP_U,0,val,FOREVER);
- }
- return val;
-}
-int GameMtl::Get_Texture_Clamp_V(int pass,int stage)
-{
- int val;
- if (stage == 0) {
- PassParameterBlock[pass]->GetValue(PB_STAGE0_TEXTURE_CLAMP_V,0,val,FOREVER);
- } else {
- PassParameterBlock[pass]->GetValue(PB_STAGE1_TEXTURE_CLAMP_V,0,val,FOREVER);
- }
- return val;
-}
-int GameMtl::Get_Texture_No_LOD(int pass,int stage)
-{
- int val;
- if (stage == 0) {
- PassParameterBlock[pass]->GetValue(PB_STAGE0_TEXTURE_NO_LOD,0,val,FOREVER);
- } else {
- PassParameterBlock[pass]->GetValue(PB_STAGE1_TEXTURE_NO_LOD,0,val,FOREVER);
- }
- return val;
-}
-int GameMtl::Get_Texture_Alpha_Bitmap(int pass,int stage)
-{
- int val;
- if (stage == 0) {
- PassParameterBlock[pass]->GetValue(PB_STAGE0_TEXTURE_ALPHA_BITMAP,0,val,FOREVER);
- } else {
- PassParameterBlock[pass]->GetValue(PB_STAGE1_TEXTURE_ALPHA_BITMAP,0,val,FOREVER);
- }
- return val;
-}
-int GameMtl::Get_Texture_Hint(int pass,int stage)
-{
- int val;
- if (stage == 0) {
- PassParameterBlock[pass]->GetValue(PB_STAGE0_TEXTURE_HINT,0,val,FOREVER);
- } else {
- PassParameterBlock[pass]->GetValue(PB_STAGE1_TEXTURE_HINT,0,val,FOREVER);
- }
- return val;
-}
-int GameMtl::Get_Texture_Display(int pass,int stage)
-{
- int val;
- if (stage == 0) {
- PassParameterBlock[pass]->GetValue(PB_STAGE0_TEXTURE_DISPLAY,0,val,FOREVER);
- } else {
- PassParameterBlock[pass]->GetValue(PB_STAGE1_TEXTURE_DISPLAY,0,val,FOREVER);
- }
- return val;
-}
-float GameMtl::Get_Texture_Frame_Rate(int pass,int stage)
-{
- float val;
- if (stage == 0) {
- PassParameterBlock[pass]->GetValue(PB_STAGE0_TEXTURE_FRAME_RATE,0,val,FOREVER);
- } else {
- PassParameterBlock[pass]->GetValue(PB_STAGE1_TEXTURE_FRAME_RATE,0,val,FOREVER);
- }
- return val;
-}
-int GameMtl::Get_Texture_Frame_Count(int pass,int stage)
-{
- int val;
- if (stage == 0) {
- PassParameterBlock[pass]->GetValue(PB_STAGE0_TEXTURE_FRAME_COUNT,0,val,FOREVER);
- } else {
- PassParameterBlock[pass]->GetValue(PB_STAGE1_TEXTURE_FRAME_COUNT,0,val,FOREVER);
- }
- return val;
-}
-int GameMtl::Get_Texture_Anim_Type(int pass,int stage)
-{
- int val;
- if (stage == 0) {
- PassParameterBlock[pass]->GetValue(PB_STAGE0_TEXTURE_ANIM_TYPE,0,val,FOREVER);
- } else {
- PassParameterBlock[pass]->GetValue(PB_STAGE1_TEXTURE_ANIM_TYPE,0,val,FOREVER);
- }
- return val;
-}
-Texmap * GameMtl::Get_Texture(int pass,int stage)
-{
- return GetSubTexmap(pass_stage_to_texmap_index(pass,stage));
-}
-
-int GameMtl::Get_PS2_Shader_Param_A(int pass)
-{
- int val;
- PassParameterBlock[pass]->GetValue(PB_PS2_SHADER_PARAM_A,0,val,FOREVER);
- return val;
-}
-
-int GameMtl::Get_PS2_Shader_Param_B(int pass)
-{
- int val;
- PassParameterBlock[pass]->GetValue(PB_PS2_SHADER_PARAM_B,0,val,FOREVER);
- return val;
-}
-
-int GameMtl::Get_PS2_Shader_Param_C(int pass)
-{
- int val;
- PassParameterBlock[pass]->GetValue(PB_PS2_SHADER_PARAM_C,0,val,FOREVER);
- return val;
-}
-
-int GameMtl::Get_PS2_Shader_Param_D(int pass)
-{
- int val;
- PassParameterBlock[pass]->GetValue(PB_PS2_SHADER_PARAM_D,0,val,FOREVER);
- return val;
-}
-
-int GameMtl::Get_Map_Channel(int pass,int stage)
-{
- int val;
- if (stage == 0) {
- PassParameterBlock[pass]->GetValue(PB_STAGE0_MAP_CHANNEL,0,val,FOREVER);
- } else {
- PassParameterBlock[pass]->GetValue(PB_STAGE1_MAP_CHANNEL,0,val,FOREVER);
- }
- return val;
-}
-
-
-void GameMtl::Set_Ambient(int pass,TimeValue t,Color val)
-{
- assert((pass >=0) && (pass < W3dMaterialClass::MAX_PASSES));
- assert(PassParameterBlock[pass]);
- PassParameterBlock[pass]->SetValue(PB_AMBIENT, t, val);
-}
-void GameMtl::Set_Diffuse(int pass,TimeValue t,Color val)
-{
- assert((pass >=0) && (pass < W3dMaterialClass::MAX_PASSES));
- assert(PassParameterBlock[pass]);
- PassParameterBlock[pass]->SetValue(PB_DIFFUSE, t, val);
-}
-void GameMtl::Set_Specular(int pass,TimeValue t,Color val)
-{
- assert((pass >=0) && (pass < W3dMaterialClass::MAX_PASSES));
- assert(PassParameterBlock[pass]);
- PassParameterBlock[pass]->SetValue(PB_SPECULAR, t, val);
-}
-void GameMtl::Set_Emissive(int pass,TimeValue t,Color val)
-{
- assert((pass >=0) && (pass < W3dMaterialClass::MAX_PASSES));
- assert(PassParameterBlock[pass]);
- PassParameterBlock[pass]->SetValue(PB_EMISSIVE, t, val);
-}
-void GameMtl::Set_Shininess(int pass,TimeValue t,float val)
-{
- assert((pass >=0) && (pass < W3dMaterialClass::MAX_PASSES));
- assert(PassParameterBlock[pass]);
- PassParameterBlock[pass]->SetValue(PB_SHININESS, t, val);
-}
-void GameMtl::Set_Opacity(int pass,TimeValue t,float val)
-{
- assert((pass >=0) && (pass < W3dMaterialClass::MAX_PASSES));
- assert(PassParameterBlock[pass]);
- PassParameterBlock[pass]->SetValue(PB_OPACITY, t, val);
-}
-void GameMtl::Set_Translucency(int pass,TimeValue t,float val)
-{
- assert((pass >=0) && (pass < W3dMaterialClass::MAX_PASSES));
- assert(PassParameterBlock[pass]);
- PassParameterBlock[pass]->SetValue(PB_TRANSLUCENCY, t, val);
-}
-void GameMtl::Set_Copy_Specular_To_Diffuse(int pass,bool val)
-{
- assert((pass >=0) && (pass < W3dMaterialClass::MAX_PASSES));
- assert(PassParameterBlock[pass]);
- PassParameterBlock[pass]->SetValue(PB_COPY_SPECULAR_TO_DIFFUSE, 0, val);
-}
-void GameMtl::Set_Mapping_Type(int pass,int stage,int val)
-{
- assert((pass >=0) && (pass < W3dMaterialClass::MAX_PASSES));
- assert(PassParameterBlock[pass]);
- if (stage == 0)
- PassParameterBlock[pass]->SetValue(PB_STAGE0_MAPPING_TYPE, 0, val);
- else if (stage == 1)
- PassParameterBlock[pass]->SetValue(PB_STAGE1_MAPPING_TYPE, 0, val);
-}
-void GameMtl::Set_PSX_Translucency(int pass,int val)
-{
- assert((pass >=0) && (pass < W3dMaterialClass::MAX_PASSES));
- assert(PassParameterBlock[pass]);
- PassParameterBlock[pass]->SetValue(PB_PSX_TRANSLUCENCY, 0, val);
-}
-void GameMtl::Set_PSX_Lighting(int pass,bool val)
-{
- assert((pass >=0) && (pass < W3dMaterialClass::MAX_PASSES));
- assert(PassParameterBlock[pass]);
- PassParameterBlock[pass]->SetValue(PB_PSX_LIGHTING, 0, val);
-}
-void GameMtl::Set_Depth_Compare(int pass,int val)
-{
- assert((pass >=0) && (pass < W3dMaterialClass::MAX_PASSES));
- assert(PassParameterBlock[pass]);
- PassParameterBlock[pass]->SetValue(PB_DEPTH_COMPARE, 0, val);
-}
-void GameMtl::Set_Depth_Mask(int pass,int val)
-{
- assert((pass >=0) && (pass < W3dMaterialClass::MAX_PASSES));
- assert(PassParameterBlock[pass]);
- PassParameterBlock[pass]->SetValue(PB_DEPTH_MASK, 0, val);
-}
-void GameMtl::Set_Alpha_Test(int pass,int val)
-{
- assert((pass >=0) && (pass < W3dMaterialClass::MAX_PASSES));
- assert(PassParameterBlock[pass]);
- PassParameterBlock[pass]->SetValue(PB_ALPHA_TEST, 0, val);
-}
-void GameMtl::Set_Dest_Blend(int pass,int val)
-{
- assert((pass >=0) && (pass < W3dMaterialClass::MAX_PASSES));
- assert(PassParameterBlock[pass]);
- PassParameterBlock[pass]->SetValue(PB_DEST_BLEND, 0, val);
-}
-void GameMtl::Set_Pri_Gradient(int pass,int val)
-{
- assert((pass >=0) && (pass < W3dMaterialClass::MAX_PASSES));
- assert(PassParameterBlock[pass]);
- PassParameterBlock[pass]->SetValue(PB_PRI_GRADIENT, 0, val);
-}
-void GameMtl::Set_Sec_Gradient(int pass,int val)
-{
- assert((pass >=0) && (pass < W3dMaterialClass::MAX_PASSES));
- assert(PassParameterBlock[pass]);
- PassParameterBlock[pass]->SetValue(PB_SEC_GRADIENT, 0, val);
-}
-void GameMtl::Set_Src_Blend(int pass,int val)
-{
- assert((pass >=0) && (pass < W3dMaterialClass::MAX_PASSES));
- assert(PassParameterBlock[pass]);
- PassParameterBlock[pass]->SetValue(PB_SRC_BLEND, 0, val);
-}
-void GameMtl::Set_Detail_Color_Func(int pass,int val)
-{
- assert((pass >=0) && (pass < W3dMaterialClass::MAX_PASSES));
- assert(PassParameterBlock[pass]);
- PassParameterBlock[pass]->SetValue(PB_DETAIL_COLOR_FUNC, 0, val);
-}
-void GameMtl::Set_Detail_Alpha_Func(int pass,int val)
-{
- assert((pass >=0) && (pass < W3dMaterialClass::MAX_PASSES));
- assert(PassParameterBlock[pass]);
- PassParameterBlock[pass]->SetValue(PB_DETAIL_ALPHA_FUNC, 0, val);
-}
-void GameMtl::Set_Texture_Enable(int pass,int stage,bool val)
-{
- assert((pass >=0) && (pass < W3dMaterialClass::MAX_PASSES));
- assert(PassParameterBlock[pass]);
- if (stage == 0) {
- PassParameterBlock[pass]->SetValue(PB_STAGE0_TEXTURE_ENABLE, 0, val);
- } else {
- PassParameterBlock[pass]->SetValue(PB_STAGE1_TEXTURE_ENABLE, 0, val);
- }
-}
-void GameMtl::Set_Texture_Publish(int pass,int stage,bool val)
-{
- assert((pass >=0) && (pass < W3dMaterialClass::MAX_PASSES));
- assert(PassParameterBlock[pass]);
- if (stage == 0) {
- PassParameterBlock[pass]->SetValue(PB_STAGE0_TEXTURE_PUBLISH, 0, val);
- } else {
- PassParameterBlock[pass]->SetValue(PB_STAGE1_TEXTURE_PUBLISH, 0, val);
- }
-}
-void GameMtl::Set_Texture_Resize(int pass,int stage,bool val)
-{
- assert((pass >=0) && (pass < W3dMaterialClass::MAX_PASSES));
- assert(PassParameterBlock[pass]);
- if (stage == 0) {
- PassParameterBlock[pass]->SetValue(PB_STAGE0_TEXTURE_RESIZE, 0, val);
- } else {
- PassParameterBlock[pass]->SetValue(PB_STAGE1_TEXTURE_RESIZE, 0, val);
- }
-}
-void GameMtl::Set_Texture_No_Mipmap(int pass,int stage,bool val)
-{
- assert((pass >=0) && (pass < W3dMaterialClass::MAX_PASSES));
- assert(PassParameterBlock[pass]);
- if (stage == 0) {
- PassParameterBlock[pass]->SetValue(PB_STAGE0_TEXTURE_NO_MIPMAP, 0, val);
- } else {
- PassParameterBlock[pass]->SetValue(PB_STAGE1_TEXTURE_NO_MIPMAP, 0, val);
- }
-}
-void GameMtl::Set_Texture_Clamp_U(int pass,int stage,bool val)
-{
- assert((pass >=0) && (pass < W3dMaterialClass::MAX_PASSES));
- assert(PassParameterBlock[pass]);
- if (stage == 0) {
- PassParameterBlock[pass]->SetValue(PB_STAGE0_TEXTURE_CLAMP_U, 0, val);
- } else {
- PassParameterBlock[pass]->SetValue(PB_STAGE1_TEXTURE_CLAMP_U, 0, val);
- }
-}
-void GameMtl::Set_Texture_Clamp_V(int pass,int stage,bool val)
-{
- assert((pass >=0) && (pass < W3dMaterialClass::MAX_PASSES));
- assert(PassParameterBlock[pass]);
- if (stage == 0) {
- PassParameterBlock[pass]->SetValue(PB_STAGE0_TEXTURE_CLAMP_V, 0, val);
- } else {
- PassParameterBlock[pass]->SetValue(PB_STAGE1_TEXTURE_CLAMP_V, 0, val);
- }
-}
-void GameMtl::Set_Texture_No_LOD(int pass,int stage,bool val)
-{
- assert((pass >=0) && (pass < W3dMaterialClass::MAX_PASSES));
- assert(PassParameterBlock[pass]);
- if (stage == 0) {
- PassParameterBlock[pass]->SetValue(PB_STAGE0_TEXTURE_NO_LOD, 0, val);
- } else {
- PassParameterBlock[pass]->SetValue(PB_STAGE1_TEXTURE_NO_LOD, 0, val);
- }
-}
-void GameMtl::Set_Texture_Alpha_Bitmap(int pass,int stage,bool val)
-{
- assert((pass >=0) && (pass < W3dMaterialClass::MAX_PASSES));
- assert(PassParameterBlock[pass]);
- if (stage == 0) {
- PassParameterBlock[pass]->SetValue(PB_STAGE0_TEXTURE_ALPHA_BITMAP, 0, val);
- } else {
- PassParameterBlock[pass]->SetValue(PB_STAGE1_TEXTURE_ALPHA_BITMAP, 0, val);
- }
-}
-void GameMtl::Set_Texture_Hint(int pass,int stage,int val)
-{
- assert((pass >=0) && (pass < W3dMaterialClass::MAX_PASSES));
- assert(PassParameterBlock[pass]);
- if (stage == 0) {
- PassParameterBlock[pass]->SetValue(PB_STAGE0_TEXTURE_HINT, 0, val);
- } else {
- PassParameterBlock[pass]->SetValue(PB_STAGE1_TEXTURE_HINT, 0, val);
- }
-}
-void GameMtl::Set_Texture_Display(int pass,int stage,bool val)
-{
- assert((pass >=0) && (pass < W3dMaterialClass::MAX_PASSES));
- assert(PassParameterBlock[pass]);
-
- // clear all tex display flags
- for (int pi = 0; piSetValue(PB_STAGE0_TEXTURE_DISPLAY, 0, false);
- PassParameterBlock[pi]->SetValue(PB_STAGE1_TEXTURE_DISPLAY, 0, false);
- }
-
- // set the one we want
- if (val == true) {
-
- if (stage == 0) {
- PassParameterBlock[pass]->SetValue(PB_STAGE0_TEXTURE_DISPLAY, 0, val);
- } else {
- PassParameterBlock[pass]->SetValue(PB_STAGE1_TEXTURE_DISPLAY, 0, val);
- }
- SetMtlFlag( MTL_TEX_DISPLAY_ENABLED, TRUE );
- SetActiveTexmap(Texture[pass][stage]);
- NotifyDependents(FOREVER,PART_ALL,REFMSG_CHANGE);
-
- } else {
-
- SetMtlFlag( MTL_TEX_DISPLAY_ENABLED, FALSE );
- SetActiveTexmap(NULL);
- NotifyDependents(FOREVER,PART_ALL,REFMSG_CHANGE);
-
- }
-
- // tell dialog to refresh...
- if (MaterialDialog) {
- MaterialDialog->ReloadDialog();
- }
-
- if (IsMultiMtl()) {
-
- // Loop through all sub materials of the multi-material.
- for (unsigned mi = 0; mi < NumSubMtls(); mi++) {
-
- // Only change those that are W3D materials.
- if (GetSubMtl(mi)->ClassID() == GameMaterialClassID) {
- int pass;
-
- for (pass = 0; pass < ((GameMtl*)(GetSubMtl(mi)))->Get_Pass_Count(); pass++) {
-
- if (((GameMtl*)(GetSubMtl(mi)))->Get_Texture_Enable(pass, stage)) {
- (GetSubMtl(mi))->SetMtlFlag(MTL_TEX_DISPLAY_ENABLED, TRUE);
- }
- }
- }
- }
- }
-}
-
-void GameMtl::Set_Texture_Frame_Rate(int pass,int stage,float val)
-{
- assert((pass >=0) && (pass < W3dMaterialClass::MAX_PASSES));
- assert(PassParameterBlock[pass]);
- if (stage == 0) {
- PassParameterBlock[pass]->SetValue(PB_STAGE0_TEXTURE_FRAME_RATE, 0, val);
- } else {
- PassParameterBlock[pass]->SetValue(PB_STAGE1_TEXTURE_FRAME_RATE, 0, val);
- }
-}
-void GameMtl::Set_Texture_Frame_Count(int pass,int stage,int val)
-{
- assert((pass >=0) && (pass < W3dMaterialClass::MAX_PASSES));
- assert(PassParameterBlock[pass]);
- if (stage == 0) {
- PassParameterBlock[pass]->SetValue(PB_STAGE0_TEXTURE_FRAME_COUNT, 0, val);
- } else {
- PassParameterBlock[pass]->SetValue(PB_STAGE1_TEXTURE_FRAME_COUNT, 0, val);
- }
-}
-void GameMtl::Set_Texture_Anim_Type(int pass,int stage,int val)
-{
- assert((pass >=0) && (pass < W3dMaterialClass::MAX_PASSES));
- assert(PassParameterBlock[pass]);
- if (stage == 0) {
- PassParameterBlock[pass]->SetValue(PB_STAGE0_TEXTURE_ANIM_TYPE, 0, val);
- } else {
- PassParameterBlock[pass]->SetValue(PB_STAGE1_TEXTURE_ANIM_TYPE, 0, val);
- }
-}
-
-void GameMtl::Set_Texture(int pass,int stage,Texmap * tex)
-{
- SetSubTexmap(pass_stage_to_texmap_index(pass,stage),tex);
-}
-
-void GameMtl::Set_PS2_Shader_Param_A(int pass,int val)
-{
- assert((pass >=0) && (pass < W3dMaterialClass::MAX_PASSES));
- assert(PassParameterBlock[pass]);
- PassParameterBlock[pass]->SetValue(PB_PS2_SHADER_PARAM_A, 0, val);
-}
-
-void GameMtl::Set_PS2_Shader_Param_B(int pass,int val)
-{
- assert((pass >=0) && (pass < W3dMaterialClass::MAX_PASSES));
- assert(PassParameterBlock[pass]);
- PassParameterBlock[pass]->SetValue(PB_PS2_SHADER_PARAM_B, 0, val);
-}
-
-void GameMtl::Set_PS2_Shader_Param_C(int pass,int val)
-{
- assert((pass >=0) && (pass < W3dMaterialClass::MAX_PASSES));
- assert(PassParameterBlock[pass]);
- PassParameterBlock[pass]->SetValue(PB_PS2_SHADER_PARAM_C, 0, val);
-}
-
-void GameMtl::Set_PS2_Shader_Param_D(int pass,int val)
-{
- assert((pass >=0) && (pass < W3dMaterialClass::MAX_PASSES));
- assert(PassParameterBlock[pass]);
- PassParameterBlock[pass]->SetValue(PB_PS2_SHADER_PARAM_D, 0, val);
-}
-
-void GameMtl::Set_Map_Channel(int pass,int stage,int val)
-{
- assert((pass >=0) && (pass < W3dMaterialClass::MAX_PASSES));
- assert(PassParameterBlock[pass]);
- if (stage == 0) {
- PassParameterBlock[pass]->SetValue(PB_STAGE0_MAP_CHANNEL, 0, val);
- } else {
- PassParameterBlock[pass]->SetValue(PB_STAGE1_MAP_CHANNEL, 0, val);
- }
-
- if (Texture[pass][stage] != NULL) {
- UVGen * uvgen = Texture[pass][stage]->GetTheUVGen();
- if (uvgen != NULL) {
- uvgen->SetMapChannel(val);
- }
- }
-
- NotifyDependents(FOREVER,PART_ALL,REFMSG_CHANGE);
-}
-
-
-// This returns the mapping args string buffer for that pass (and stage) after
-// assuring that it can contain a string of length 'len' (if len is 0 no
-// resizing will be performed)..
-char * GameMtl::Get_Mapping_Arg_Buffer(int pass, int stage, unsigned int len)
-{
- assert(pass >= 0);
- assert(pass < W3dMaterialClass::MAX_PASSES);
- assert(stage >= 0);
- assert(stage < W3dMaterialClass::MAX_STAGES);
-
- if (MapperArgLen[pass][stage] < len) {
- MapperArgLen[pass][stage] = len + 10; // New length
- char *temp = new char[MapperArgLen[pass][stage] + 1];
- if (MapperArg[pass][stage]) {
- assert(strlen(MapperArg[pass][stage]) <= MapperArgLen[pass][stage]);
- strcpy(temp, MapperArg[pass][stage]);
- delete [] (MapperArg[pass][stage]);
- MapperArg[pass][stage] = NULL;
- }
-
- MapperArg[pass][stage] = temp;
- }
-
- return MapperArg[pass][stage];
-}
-
-int GameMtl::pass_stage_to_texmap_index(int pass,int stage)
-{
- assert((pass >= 0) && (pass < W3dMaterialClass::MAX_PASSES));
- assert((stage >= 0) && (stage < W3dMaterialClass::MAX_STAGES));
- return pass * W3dMaterialClass::MAX_STAGES + stage;
-}
-
-void GameMtl::texmap_index_to_pass_stage(int index,int * set_pass,int * set_stage)
-{
- *set_pass = index / W3dMaterialClass::MAX_STAGES;
- *set_stage = index % W3dMaterialClass::MAX_STAGES;
-}
-
-float GameMtl::EvalDisplacement(ShadeContext& sc)
-{
- float displacement = 0.0F;
- if (DisplacementMap != NULL) {
- displacement = DisplacementMap->EvalMono(sc);
- displacement = displacement * DisplacementAmt;
- }
- return displacement;
-}
-
-Interval GameMtl::DisplacementValidity(TimeValue t)
-{
- return FOREVER;
-}
-
-void GameMtlPostLoad::proc(ILoad *iload)
-{
- if (IsOld) {
-
- m->Reset();
- m->Set_Pass_Count(1);
- m->Set_Ambient(0,0,AmbientCoeff);
- m->Set_Diffuse(0,0,Diffuse * DiffuseCoeff);
- m->Set_Specular(0,0,Specular * SpecularCoeff);
- m->Set_Emissive(0,0,EmissiveCoeff);
- m->Set_Opacity(0,0,Opacity);
- m->Set_Translucency(0,0,Translucency);
- m->Set_Shininess(0,0,Shininess);
- m->Set_Mapping_Type(0,0,DCTMappingType);
-
- Texmap * tex = (*(m->Maps))[ID_DI].Map;
-
- if ((tex) && (tex->ClassID() == Class_ID(BMTEX_CLASS_ID,0))) {
- m->Set_Texture(0,0,tex);
- m->Set_Texture_Enable(0,0,true);
- m->Set_Texture_Frame_Rate(0,0,DCTFrameRate);
- m->Set_Texture_Frame_Count(0,0,DCTFrames);
-
- if (m->TestMtlFlag(MTL_TEX_DISPLAY_ENABLED)) {
- m->Set_Texture_Display(0,0,true);
- }
- }
-
- m->ReplaceReference(GameMtl::REF_MAPS,NULL);
- }
-
- // older material formats did not save the map channel and will default to zero,
- // we need to change the map channel to one in this case.
- for (int pass = 0; pass < W3dMaterialClass::MAX_PASSES; pass++) {
- for (int stage = 0; stage < W3dMaterialClass::MAX_STAGES; stage++) {
- if ((m->Get_Map_Channel(pass,stage) < 1) || (m->Get_Map_Channel(pass,stage) > 99)) {
- m->Set_Map_Channel(pass,stage,1);
- }
- }
- }
-
- // Now that I've removed the UI for the RESIZE and NO_MIPMAP options in the texture
- // pane, we initialize the No_LOD setting to the existing NO_MIPMAP setting
- // NOTE: I created a new flag for gamemtl which gets set when this conversion takes
- // place for the first time.
- if (m->Get_Flag(GAMEMTL_CONVERTED_TO_NOLOD) == false) {
- for (int pass = 0; pass < W3dMaterialClass::MAX_PASSES; pass++) {
- for (int stage = 0; stage < W3dMaterialClass::MAX_STAGES; stage++) {
- bool no_lod = m->Get_Texture_No_Mipmap(pass,stage) != 0;
- m->Set_Texture_No_LOD(pass,stage,no_lod);
- }
- }
- m->Set_Flag(GAMEMTL_CONVERTED_TO_NOLOD,true);
- }
-
- delete this;
-}
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/GameMtlDlg.cpp b/Generals/Code/Tools/WW3D/max2w3d/GameMtlDlg.cpp
deleted file mode 100644
index c9dc5c24447..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/GameMtlDlg.cpp
+++ /dev/null
@@ -1,685 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Max2W3d *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/GameMtlDlg.cpp $*
- * *
- * Author:: Greg Hjelstrom *
- * *
- * $Modtime:: 12/07/00 5:52p $*
- * *
- * $Revision:: 12 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#include
-#include
-#include
-#include
-
-#include "GameMtlDlg.h"
-#include "gamemtl.h"
-#include "GameMtlPassDlg.h"
-#include "dllmain.h"
-#include "resource.h"
-#include "w3d_file.h"
-
-static BOOL CALLBACK DisplacementMapDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara,LPARAM lParam);
-static BOOL CALLBACK SurfaceTypePanelDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara,LPARAM lParam);
-static BOOL CALLBACK PassCountPanelDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara,LPARAM lParam);
-static BOOL CALLBACK PassCountDialogDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,LPARAM lParam);
-
-static int _Pass_Index_To_Flag[] =
-{
- GAMEMTL_PASS0_ROLLUP_OPEN,
- GAMEMTL_PASS1_ROLLUP_OPEN,
- GAMEMTL_PASS2_ROLLUP_OPEN,
- GAMEMTL_PASS3_ROLLUP_OPEN,
-};
-
-/***********************************************************************************************
- * GameMtlDlg::GameMtlDlg -- constructor *
- * *
- * INPUT: *
- * hwMtlEdit - windows handle of the MAX material editor *
- * imp - Interface object for MAX materials and textures *
- * m - pointer to a GameMtl to be edited *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 06/26/1997 GH : Created. *
- *=============================================================================================*/
-GameMtlDlg::GameMtlDlg(HWND hwMtlEdit, IMtlParams *imp, GameMtl *m)
-{
- HwndEdit = hwMtlEdit;
- HwndPassCount = NULL;
- HwndSurfaceType = NULL;
- HwndDisplacementMap = NULL;
- HpalOld = NULL;
-
- for (int i=0; iRestorePalette(hdc, HpalOld);
- ReleaseDC(HwndPassCount,hdc);
- }
-
- #ifdef WANT_DISPLACEMENT_MAPS
- TheMtl->Set_Flag(GAMEMTL_DISPLACEMENT_ROLLUP_OPEN,IParams->IsRollupPanelOpen(HwndDisplacementMap));
- #endif //WANT_DISPLACEMENT_MAPS
-
- TheMtl->Set_Flag(GAMEMTL_SURFACE_ROLLUP_OPEN,IParams->IsRollupPanelOpen(HwndSurfaceType));
- TheMtl->Set_Flag(GAMEMTL_PASSCOUNT_ROLLUP_OPEN,IParams->IsRollupPanelOpen(HwndPassCount));
- TheMtl->RollScroll = IParams->GetRollupScrollPos();
-
- IParams->UnRegisterDlgWnd(HwndSurfaceType);
- IParams->DeleteRollupPage(HwndSurfaceType);
- HwndSurfaceType = NULL;
-
- #ifdef WANT_DISPLACEMENT_MAPS
- IParams->UnRegisterDlgWnd(HwndDisplacementMap);
- IParams->DeleteRollupPage(HwndDisplacementMap);
- HwndDisplacementMap = NULL;
- #endif //#ifdef WANT_DISPLACEMENT_MAPS
-
- IParams->UnRegisterDlgWnd(HwndPassCount);
- IParams->DeleteRollupPage(HwndPassCount);
- HwndPassCount = NULL;
-
- for (int i=0; iSetParamDlg(NULL);
-}
-
-
-/***********************************************************************************************
- * GameMtlDlg::ClassID -- Returns the ClassID of GameMtl *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 06/26/1997 GH : Created. *
- *=============================================================================================*/
-Class_ID GameMtlDlg::ClassID()
-{
- return GameMaterialClassID;
-}
-
-/***********************************************************************************************
- * GameMtlDlg::SetThing -- Sets the material to be edited *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 06/26/1997 GH : Created. *
- *=============================================================================================*/
-void GameMtlDlg::SetThing(ReferenceTarget *m)
-{
- assert (m);
- assert (m->SuperClassID()==MATERIAL_CLASS_ID);
- assert ((m->ClassID()==GameMaterialClassID) || (m->ClassID()==PS2GameMaterialClassID));
- assert (TheMtl);
-
- int pass;
-
- // destroy our old pass dialogs
- for (pass=0; passGet_Pass_Count();pass++) {
- delete PassDialog[pass];
- PassDialog[pass] = NULL;
- }
-
- // install the new material
- TheMtl->SetParamDlg(NULL);
- TheMtl = (GameMtl *)m;
- TheMtl->SetParamDlg(this);
-
- // build a new set of pass dialogs
- for (pass=0; passGet_Pass_Count(); pass++) {
- PassDialog[pass] = new GameMtlPassDlg(HwndEdit, IParams, TheMtl, pass);
- }
-
- // refresh the contents of the dialogs
- ReloadDialog();
-}
-
-/***********************************************************************************************
- * GameMtlDlg::SetTime -- Sets the time value, updates the material and the dialog *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 06/26/1997 GH : Created. *
- *=============================================================================================*/
-void GameMtlDlg::SetTime(TimeValue t)
-{
- if (t!=CurTime) {
- CurTime = t;
-// TheMtl->Update(IParams->GetTime(),Valid);
- ReloadDialog();
- }
-}
-
-/***********************************************************************************************
- * GameMtlDlg::ReloadDialog -- Updates the values in all of the dialog's controls *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 06/26/1997 GH : Created. *
- *=============================================================================================*/
-void GameMtlDlg::ReloadDialog()
-{
- /*
- ** Init the pass count panel
- */
- assert(TheMtl && HwndPassCount && HwndSurfaceType);
-
- /*
- ** Init the surface count panel
- */
- ::SendMessage (HwndSurfaceType, WM_USER+101, 0, 0L);
-
- #ifdef WANT_DISPLACEMENT_MAPS
- ::SendMessage (HwndDisplacementMap, WM_USER+101, 0, 0L);
- #endif //WANT_DISPLACEMENT_MAPS
-
- /*
- ** Init the pass count panel
- */
- char a[10];
- sprintf(a, "%d", TheMtl->Get_Pass_Count());
- SetWindowText(GetDlgItem(HwndPassCount, IDC_GAMEMTL_PASSCOUNT_STATIC), a);
-
- /*
- ** Init each pass panel
- */
- for(int i = 0; i < TheMtl->Get_Pass_Count(); i++)
- {
- PassDialog[i]->ReloadDialog();
- }
-}
-
-/***********************************************************************************************
- * GameMtlDlg::ActivateDlg -- Activates and deactivates the dialog *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 06/26/1997 GH : Created. *
- *=============================================================================================*/
-void GameMtlDlg::ActivateDlg(BOOL onoff)
-{
- for(int i = 0; i < TheMtl->Get_Pass_Count(); i++)
- {
- assert(PassDialog[i]);
- PassDialog[i]->ActivateDlg(onoff);
- }
-}
-
-/***********************************************************************************************
- * GameMtlDlg::Invalidate -- causes the dialog to be redrawn *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 06/26/1997 GH : Created. *
- *=============================================================================================*/
-void GameMtlDlg::Invalidate()
-{
- InvalidateRect(HwndSurfaceType,NULL,0);
-
- #ifdef WANT_DISPLACEMENT_MAPS
- InvalidateRect(HwndDisplacementMap,NULL,0);
- #endif //WANT_DISPLACEMENT_MAPS
-
- InvalidateRect(HwndPassCount,NULL,0);
-}
-
-BOOL GameMtlDlg::DisplacementMapProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
-{
- switch (message)
- {
-
- case WM_INITDIALOG:
- //SetupIntSpinner(hDlg, IDC_AMOUNT_SPIN, IDC_AMOUNT_EDIT, -999, 999, 0);
- /* no break */
-
- case WM_USER + 101:
- {
- SetDlgItemInt (hDlg, IDC_AMOUNT_EDIT, TheMtl->Get_Displacement_Amount () * 100, TRUE);
- SetupIntSpinner(hDlg, IDC_AMOUNT_SPIN, IDC_AMOUNT_EDIT, -999, 999, TheMtl->Get_Displacement_Amount () * 100);
-
- Texmap *map = TheMtl->Get_Displacement_Map ();
- if (map != NULL) {
- SetDlgItemText (hDlg, IDC_TEXTURE_BUTTON, map->GetFullName ());
- }
- }
- break;
-
- case CC_SPINNER_CHANGE:
- {
- ISpinnerControl *control = (ISpinnerControl *)lParam;
- TheMtl->Set_Displacement_Amount (((float)control->GetIVal ()) / 100.0F);
- }
- break;
-
- case WM_COMMAND:
- switch(LOWORD(wParam))
- {
- case IDC_TEXTURE_BUTTON:
- if(HIWORD(wParam) == BN_CLICKED)
- {
- PostMessage(HwndEdit, WM_TEXMAP_BUTTON, TheMtl->Get_Displacement_Map_Index (), (LPARAM)TheMtl);
- }
- }
- break;
- }
-
- return FALSE;
-}
-
-BOOL GameMtlDlg::SurfaceTypeProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
-{
- switch (message)
- {
-
- case WM_INITDIALOG:
- {
- //
- // Fill the combobox with the names of the different surface types
- //
- for (int index = 0; index < SURFACE_TYPE_MAX; index ++) {
- ::SendDlgItemMessage ( hDlg,
- IDC_SURFACE_TYPE_COMBO,
- CB_ADDSTRING,
- 0,
- (LPARAM)SURFACE_TYPE_STRINGS[index]);
- }
-
- //
- // Limit the range of the static sort level spinner to 0 - MAX_SORT_LEVEL.
- //
- int sort_level = TheMtl->Get_Sort_Level();
- SetupIntSpinner(hDlg, IDC_SORT_LEVEL_SPIN, IDC_SORT_LEVEL, 0, MAX_SORT_LEVEL, sort_level);
-
- // Check the checkbox if sort_level is not SORT_LEVEL_NONE.
- ::SendDlgItemMessage(hDlg, IDC_ENABLE_SORT_LEVEL, BM_SETCHECK,
- sort_level == SORT_LEVEL_NONE ? BST_UNCHECKED : BST_CHECKED, 0);
- }
-
- case WM_USER + 101:
- {
- //
- // Select the current surface type
- //
- ::SendDlgItemMessage ( hDlg,
- IDC_SURFACE_TYPE_COMBO,
- CB_SETCURSEL,
- (WPARAM)TheMtl->Get_Surface_Type (),
-
- 0L);
-
- //
- // Set the correct sort level
- //
- int sort_level = TheMtl->Get_Sort_Level();
- ISpinnerControl *spinner = GetISpinner(::GetDlgItem(hDlg, IDC_SORT_LEVEL_SPIN));
- assert(spinner);
- spinner->SetValue(sort_level, FALSE);
- ::SendDlgItemMessage(hDlg, IDC_ENABLE_SORT_LEVEL, BM_SETCHECK,
- sort_level == SORT_LEVEL_NONE ? BST_UNCHECKED : BST_CHECKED, 0);
- break;
- }
-
- case WM_COMMAND:
- {
- switch(LOWORD(wParam))
- {
- case IDC_SURFACE_TYPE_COMBO:
- if(HIWORD(wParam) == CBN_SELCHANGE)
- {
- unsigned int type = ::SendDlgItemMessage (hDlg, IDC_SURFACE_TYPE_COMBO, CB_GETCURSEL, 0, 0L);
- TheMtl->Set_Surface_Type (type);
- }
- break;
-
- case IDC_ENABLE_SORT_LEVEL:
- if (HIWORD(wParam) == BN_CLICKED)
- {
- // If the 'enable' checkbox was unchecked, set the sort level to NONE.
- int state = ::IsDlgButtonChecked(hDlg, IDC_ENABLE_SORT_LEVEL);
- ISpinnerControl *spinner = GetISpinner(::GetDlgItem(hDlg, IDC_SORT_LEVEL_SPIN));
- assert(spinner);
- if (state == BST_UNCHECKED)
- {
- spinner->SetValue(SORT_LEVEL_NONE, FALSE);
- TheMtl->Set_Sort_Level(SORT_LEVEL_NONE);
- }
- else if (state == BST_CHECKED)
- {
- // Sort level was enabled, so set it's level to 1 if it was NONE before.
- if (spinner->GetIVal() == SORT_LEVEL_NONE)
- {
- spinner->SetValue(1, FALSE);
- TheMtl->Set_Sort_Level(1);
- }
- }
- }
- }
- break;
- }
-
- case CC_SPINNER_CHANGE:
- {
- ISpinnerControl *spinner = (ISpinnerControl*)lParam;
- switch(LOWORD(wParam))
- {
- case IDC_SORT_LEVEL_SPIN:
- // Check the 'enabled' checkbox if sort level != SORT_LEVEL_NONE, uncheck it otherwise.
- ::SendDlgItemMessage(hDlg, IDC_ENABLE_SORT_LEVEL, BM_SETCHECK,
- spinner->GetIVal() == SORT_LEVEL_NONE ? BST_UNCHECKED : BST_CHECKED, 0);
- TheMtl->Set_Sort_Level(spinner->GetIVal());
- break;
- }
- break;
- }
- }
-
- return FALSE;
-}
-
-
-BOOL GameMtlDlg::PassCountProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
-{
- switch (message)
- {
- case WM_INITDIALOG:
- break;
-
- case WM_COMMAND:
- switch(LOWORD(wParam))
- {
- case IDC_SETPASSCOUNT:
- if(HIWORD(wParam) == BN_CLICKED)
- {
- Set_Pass_Count_Dialog();
- }
- }
- break;
- }
-
- return FALSE;
-}
-
-static BOOL CALLBACK DisplacementMapDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,LPARAM lParam)
-{
- GameMtlDlg * theDlg;
- if (msg == WM_INITDIALOG) {
- theDlg = (GameMtlDlg*)lParam;
- theDlg->HwndDisplacementMap = hwndDlg;
- SetWindowLong(hwndDlg, GWL_USERDATA,lParam);
- } else {
- if ((theDlg = (GameMtlDlg *)GetWindowLong(hwndDlg, GWL_USERDATA) ) == NULL) {
- return FALSE;
- }
- }
-
- theDlg->IsActive = 1;
- BOOL res = theDlg->DisplacementMapProc(hwndDlg,msg,wParam,lParam);
- theDlg->IsActive = 0;
-
- return res;
-}
-
-static BOOL CALLBACK SurfaceTypePanelDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,LPARAM lParam)
-{
- GameMtlDlg * theDlg;
- if (msg == WM_INITDIALOG) {
- theDlg = (GameMtlDlg*)lParam;
- theDlg->HwndSurfaceType = hwndDlg;
- SetWindowLong(hwndDlg, GWL_USERDATA,lParam);
- } else {
- if ((theDlg = (GameMtlDlg *)GetWindowLong(hwndDlg, GWL_USERDATA) ) == NULL) {
- return FALSE;
- }
- }
-
- theDlg->IsActive = 1;
- BOOL res = theDlg->SurfaceTypeProc(hwndDlg,msg,wParam,lParam);
- theDlg->IsActive = 0;
-
- return res;
-}
-
-static BOOL CALLBACK PassCountPanelDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,LPARAM lParam)
-{
- GameMtlDlg * theDlg;
- if (msg == WM_INITDIALOG) {
- theDlg = (GameMtlDlg*)lParam;
- theDlg->HwndPassCount = hwndDlg;
- SetWindowLong(hwndDlg, GWL_USERDATA,lParam);
- } else {
- if ((theDlg = (GameMtlDlg *)GetWindowLong(hwndDlg, GWL_USERDATA) ) == NULL) {
- return FALSE;
- }
- }
-
- theDlg->IsActive = 1;
- BOOL res = theDlg->PassCountProc(hwndDlg,msg,wParam,lParam);
- theDlg->IsActive = 0;
-
- return res;
-}
-
-void GameMtlDlg::Set_Pass_Count_Dialog(void)
-{
- int res = DialogBoxParam(
- AppInstance,
- MAKEINTRESOURCE(IDD_GAMEMTL_PASS_COUNT_DIALOG),
- HwndPassCount,
- PassCountDialogDlgProc,
- (LPARAM)TheMtl->Get_Pass_Count());
-
- if (res>=0)
- {
- if (res<=0) res = 1;
- if (res>4) res = 4;
-
- char a[10];
- sprintf(a, "%d", res);
-
- SetWindowText(GetDlgItem(HwndPassCount, IDC_GAMEMTL_PASSCOUNT_STATIC), a);
-
- if(TheMtl->Get_Pass_Count() != res)
- {
- for(int i = 0; i < TheMtl->Get_Pass_Count(); i++)
- {
- delete PassDialog[i];
- PassDialog[i] = NULL;
- }
-
- TheMtl->Set_Pass_Count(res);
-
- for(i = 0; i < TheMtl->Get_Pass_Count(); i++)
- {
- PassDialog[i] = new GameMtlPassDlg(HwndEdit, IParams, TheMtl, i);
- }
-
- ReloadDialog();
- }
- }
-}
-
-static BOOL CALLBACK PassCountDialogDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,LPARAM lParam)
-{
- switch (msg)
- {
- case WM_INITDIALOG:
- {
- ISpinnerControl *spin = SetupIntSpinner(
- hwndDlg,IDC_PASSCOUNT_SPIN, IDC_PASSCOUNT_EDIT,
- 1,4,(int)lParam);
- ReleaseISpinner(spin);
- CenterWindow(hwndDlg,GetParent(hwndDlg));
- break;
- }
-
- case WM_COMMAND:
- switch (LOWORD(wParam))
- {
- case IDOK:
- {
- ISpinnerControl *spin = GetISpinner(GetDlgItem(hwndDlg,IDC_PASSCOUNT_SPIN));
- EndDialog(hwndDlg,spin->GetIVal());
- ReleaseISpinner(spin);
- break;
- }
-
- case IDCANCEL:
- EndDialog(hwndDlg,-1);
- break;
- }
- break;
-
- default:
- return FALSE;
- }
- return TRUE;
-}
-
-
-/***********************************************************************************************
- * GameMtlDlg::Build_Dialog -- Adds the dialog to the material editor *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 06/26/1997 GH : Created. *
- *=============================================================================================*/
-void GameMtlDlg::Build_Dialog()
-{
- if ((TheMtl->Flags&(GAMEMTL_ROLLUP_FLAGS))==0) {
- TheMtl->Set_Flag(GAMEMTL_PASS0_ROLLUP_OPEN,TRUE);
- }
-
- HwndSurfaceType = IParams->AddRollupPage(
- AppInstance,
- MAKEINTRESOURCE(IDD_GAMEMTL_SURFACE_TYPE),
- SurfaceTypePanelDlgProc,
- Get_String(IDS_SURFACE_TYPE),
- (LPARAM)this,
- TheMtl->Get_Flag(GAMEMTL_SURFACE_ROLLUP_OPEN) ? 0:APPENDROLL_CLOSED
- );
-
- #ifdef WANT_DISPLACEMENT_MAPS
- HwndDisplacementMap = IParams->AddRollupPage(
- AppInstance,
- MAKEINTRESOURCE(IDD_GAMEMTL_DISPLACEMENT_MAP),
- DisplacementMapDlgProc,
- Get_String(IDS_DISPLACEMENT_MAP),
- (LPARAM)this,
- TheMtl->Get_Flag(GAMEMTL_DISPLACEMENT_ROLLUP_OPEN) ? 0:APPENDROLL_CLOSED
- );
- #endif //WANT_DISPLACEMENT_MAPS
-
- HwndPassCount = IParams->AddRollupPage(
- AppInstance,
- MAKEINTRESOURCE(IDD_GAMEMTL_PASS_COUNT),
- PassCountPanelDlgProc,
- Get_String(IDS_PASS_COUNT),
- (LPARAM)this,
- TheMtl->Get_Flag(GAMEMTL_PASSCOUNT_ROLLUP_OPEN) ? 0:APPENDROLL_CLOSED
- );
-
- for (int i=0; iGet_Pass_Count(); i++) {
- PassDialog[i] = new GameMtlPassDlg(HwndEdit, IParams, TheMtl, i);
- }
-
- IParams->SetRollupScrollPos(TheMtl->RollScroll);
-
- ReloadDialog();
-}
-
-
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/GameMtlDlg.h b/Generals/Code/Tools/WW3D/max2w3d/GameMtlDlg.h
deleted file mode 100644
index e11efb6ae16..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/GameMtlDlg.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Max2W3d *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/GameMtlDlg.h $*
- * *
- * Author:: Greg Hjelstrom *
- * *
- * $Modtime:: 6/30/99 7:10p $*
- * *
- * $Revision:: 6 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-
-
-#ifndef GAMEMTLDLG_H
-#define GAMEMTLDLG_H
-
-class GameMtl;
-class GameMtlPassDlg;
-
-
-////////////////////////////////////////////////////////////////////////
-// GameMtlDlg
-//
-// Dialog box interface in the material editor for GameMtl
-// This is basically a cannibalized version of the Standard
-// Max material's dialog.
-//
-////////////////////////////////////////////////////////////////////////
-class GameMtlDlg: public ParamDlg
-{
-
-public:
-
- ////////////////////////////////////////////////////////////////////////
- // Methods
- ////////////////////////////////////////////////////////////////////////
- GameMtlDlg(HWND hwMtlEdit, IMtlParams *imp, GameMtl *m);
- ~GameMtlDlg();
-
- // From ParamDlg:
- Class_ID ClassID(void);
- void SetThing(ReferenceTarget *m);
- ReferenceTarget* GetThing(void) { return (ReferenceTarget*)TheMtl; }
- void DeleteThis() { delete this; }
- void SetTime(TimeValue t);
- void ReloadDialog(void);
- void ActivateDlg(BOOL onOff);
-
- void Invalidate(void);
- void Update_Display(void) { IParams->MtlChanged(); }
-
-protected:
-
- void Build_Dialog(void);
-
- BOOL DisplacementMapProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
- BOOL SurfaceTypeProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
- BOOL PassCountProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
- void Set_Pass_Count_Dialog(void);
-
- enum { MAX_PASSES = 4 };
-
- ////////////////////////////////////////////////////////////////////////
- // Windows handles
- ////////////////////////////////////////////////////////////////////////
- HWND HwndEdit; // window handle of the materials editor dialog
- HWND HwndPassCount; // Rollup pass count panel
- HWND HwndSurfaceType; // Rollup surface type panel
- HWND HwndDisplacementMap;
- HPALETTE HpalOld;
-
- GameMtlPassDlg * PassDialog[MAX_PASSES];
-
- ////////////////////////////////////////////////////////////////////////
- // Material dialog interface
- ////////////////////////////////////////////////////////////////////////
- IMtlParams * IParams; // interface to the material editor
- GameMtl * TheMtl; // current mtl being edited.
-
- ////////////////////////////////////////////////////////////////////////
- // Member variables
- ////////////////////////////////////////////////////////////////////////
- TimeValue CurTime;
- int IsActive;
-
- friend BOOL CALLBACK DisplacementMapDlgProc(HWND, UINT, WPARAM,LPARAM);
- friend BOOL CALLBACK SurfaceTypePanelDlgProc(HWND, UINT, WPARAM,LPARAM);
- friend BOOL CALLBACK PassCountPanelDlgProc(HWND, UINT, WPARAM,LPARAM);
- friend class GameMtl;
-};
-
-
-#endif
\ No newline at end of file
diff --git a/Generals/Code/Tools/WW3D/max2w3d/GameMtlForm.cpp b/Generals/Code/Tools/WW3D/max2w3d/GameMtlForm.cpp
deleted file mode 100644
index 463f209352c..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/GameMtlForm.cpp
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Max2W3d *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/GameMtlForm.cpp $*
- * *
- * Author:: Greg Hjelstrom *
- * *
- * $Modtime:: 11/23/98 6:21p $*
- * *
- * $Revision:: 3 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * GameMtlFormClass::GameMtlFormClass -- constructor *
- * GameMtlFormClass::SetThing -- Set the material being edited by this form *
- * GameMtlFormClass::GetThing -- get the material being edited by this form *
- * GameMtlFormClass::DeleteThis -- delete myself *
- * GameMtlFormClass::ClassID -- returns the classID of the object being edited *
- * GameMtlFormClass::SetTime -- set the current time *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#include "GameMtlForm.h"
-#include "gamemtl.h"
-
-
-/***********************************************************************************************
- * GameMtlFormClass::GameMtlFormClass -- constructor *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/23/98 GTH : Created. *
- *=============================================================================================*/
-GameMtlFormClass::GameMtlFormClass
-(
- IMtlParams * imtl_params,
- GameMtl * mtl,
- int pass
-)
-{
- IParams = imtl_params;
- TheMtl = mtl;
- PassIndex = pass;
-}
-
-
-/***********************************************************************************************
- * GameMtlFormClass::SetThing -- Set the material being edited by this form *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/23/98 GTH : Created. *
- *=============================================================================================*/
-void GameMtlFormClass::SetThing(ReferenceTarget * target)
-{
- assert (target->SuperClassID()==MATERIAL_CLASS_ID);
- assert (target->ClassID()==GameMaterialClassID);
-
- TheMtl = (GameMtl *)target;
-}
-
-
-/***********************************************************************************************
- * GameMtlFormClass::GetThing -- get the material being edited by this form *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/23/98 GTH : Created. *
- *=============================================================================================*/
-ReferenceTarget * GameMtlFormClass::GetThing(void)
-{
- return (ReferenceTarget*)TheMtl;
-}
-
-
-/***********************************************************************************************
- * GameMtlFormClass::DeleteThis -- delete myself *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/23/98 GTH : Created. *
- *=============================================================================================*/
-void GameMtlFormClass::DeleteThis(void)
-{
- delete this;
-}
-
-
-/***********************************************************************************************
- * GameMtlFormClass::ClassID -- returns the classID of the object being edited *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/23/98 GTH : Created. *
- *=============================================================================================*/
-Class_ID GameMtlFormClass::ClassID()
-{
- return GameMaterialClassID;
-}
-
-
-/***********************************************************************************************
- * GameMtlFormClass::SetTime -- set the current time *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/23/98 GTH : Created. *
- *=============================================================================================*/
-void GameMtlFormClass::SetTime(TimeValue t)
-{
- // child dialog classes don't have to support
- // the SetTime function.
-}
diff --git a/Generals/Code/Tools/WW3D/max2w3d/GameMtlForm.h b/Generals/Code/Tools/WW3D/max2w3d/GameMtlForm.h
deleted file mode 100644
index 18884ad75d2..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/GameMtlForm.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Max2W3d *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/GameMtlForm.h $*
- * *
- * Author:: Greg Hjelstrom *
- * *
- * $Modtime:: 11/13/98 10:26a $*
- * *
- * $Revision:: 2 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-
-#ifndef GAMEMTLFORM_H
-#define GAMEMTLFORM_H
-
-#include "FormClass.h"
-
-class GameMtl;
-
-class GameMtlFormClass : public FormClass
-{
-public:
- GameMtlFormClass(IMtlParams * imtl_params,GameMtl * mtl,int pass);
-
- void SetThing(ReferenceTarget *m);
- ReferenceTarget* GetThing(void);
- void DeleteThis(void);
- Class_ID ClassID(void);
- void SetTime(TimeValue t);
-
-protected:
-
- IMtlParams * IParams; // interface to the material editor
- GameMtl * TheMtl; // current mtl being edited.
- int PassIndex; // material pass that this form edits
-};
-
-#endif
diff --git a/Generals/Code/Tools/WW3D/max2w3d/GameMtlPassDlg.cpp b/Generals/Code/Tools/WW3D/max2w3d/GameMtlPassDlg.cpp
deleted file mode 100644
index b178f6a2d95..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/GameMtlPassDlg.cpp
+++ /dev/null
@@ -1,393 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Max2W3d *
- * *
- * $Archive:: /Bay/Tools/max2w3d/GameMtlPassDlg.cpp $*
- * *
- * Author:: Greg Hjelstrom *
- * *
- * $Modtime:: 10/22/99 9:54a $*
- * *
- * $Revision:: 9 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * PassDlgProc -- dialog proc which thunks into a GameMtlPassDlg *
- * GameMtlPassDlg::GameMtlPassDlg -- constructor *
- * GameMtlPassDlg::~GameMtlPassDlg -- destructor *
- * GameMtlPassDlg::DialogProc -- windows message handler *
- * GameMtlPassDlg::Invalidate -- invalidate the dialog *
- * GameMtlPassDlg::ReloadDialog -- update the contents of all of the controls *
- * GameMtlPassDlg::ClassID -- returns classID of the object being edited *
- * GameMtlPassDlg::SetThing -- set the material being edited *
- * GameMtlPassDlg::ActivateDlg -- activate or deactivate the dialog *
- * GameMtlPassDlg::SetTime -- set the current time *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#include "GameMtlPassDlg.h"
-#include "dllmain.h"
-#include "resource.h"
-#include "gamemtl.h"
-#include "GameMtlDlg.h"
-#include "GameMtlShaderDlg.h"
-#include "PS2GameMtlShaderDlg.h"
-#include "GameMtlTextureDlg.h"
-#include "GameMtlVertexMaterialDlg.h"
-#include "w3d_file.h"
-
-
-static int _Pass_Index_To_Flag[] =
-{
- GAMEMTL_PASS0_ROLLUP_OPEN,
- GAMEMTL_PASS1_ROLLUP_OPEN,
- GAMEMTL_PASS2_ROLLUP_OPEN,
- GAMEMTL_PASS3_ROLLUP_OPEN,
-};
-
-
-/***********************************************************************************************
- * PassDlgProc -- dialog proc which thunks into a GameMtlPassDlg *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/23/98 GTH : Created. *
- *=============================================================================================*/
-static BOOL CALLBACK PassDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- GameMtlPassDlg *theDlg;
-
- if (msg==WM_INITDIALOG) {
- theDlg = (GameMtlPassDlg*)lParam;
- theDlg->HwndPanel = hwndDlg;
- SetWindowLong(hwndDlg, GWL_USERDATA,lParam);
- } else {
- if ((theDlg = (GameMtlPassDlg *)GetWindowLong(hwndDlg, GWL_USERDATA) ) == NULL) {
- return FALSE;
- }
- }
-
- return theDlg->DialogProc(hwndDlg,msg,wParam,lParam);
-}
-
-
-/***********************************************************************************************
- * GameMtlPassDlg::GameMtlPassDlg -- constructor *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/23/98 GTH : Created. *
- *=============================================================================================*/
-GameMtlPassDlg::GameMtlPassDlg(HWND hwMtlEdit, IMtlParams *imp, GameMtl *m,int pass)
-{
- HwndEdit = hwMtlEdit;
- TheMtl = m;
- IParams = imp;
- PassIndex = pass;
-
- char title[200];
- sprintf(title, "Pass %d", pass + 1);
-
- HwndPanel = IParams->AddRollupPage(
- AppInstance,
- MAKEINTRESOURCE(IDD_GAMEMTL_PASS),
- PassDlgProc,
- title,
- (LPARAM)this,
- TheMtl->Get_Flag(_Pass_Index_To_Flag[PassIndex]) ? 0 : APPENDROLL_CLOSED
- );
-}
-
-
-/***********************************************************************************************
- * GameMtlPassDlg::~GameMtlPassDlg -- destructor *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/23/98 GTH : Created. *
- *=============================================================================================*/
-GameMtlPassDlg::~GameMtlPassDlg()
-{
- TheMtl->Set_Flag(_Pass_Index_To_Flag[PassIndex],IParams->IsRollupPanelOpen(HwndPanel));
- IParams->DeleteRollupPage(HwndPanel);
- SetWindowLong(HwndPanel, GWL_USERDATA, NULL);
-}
-
-
-/***********************************************************************************************
- * GameMtlPassDlg::DialogProc -- windows message handler *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/23/98 GTH : Created. *
- *=============================================================================================*/
-BOOL GameMtlPassDlg::DialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
-{
- int i=0;
- int id = LOWORD(wParam);
- int code = HIWORD(wParam);
-
- switch (message) {
-
- case WM_INITDIALOG:
- {
- Page[0] = new GameMtlVertexMaterialDlg(HwndPanel,IParams,TheMtl,PassIndex);
- if (TheMtl->Get_Shader_Type() == GameMtl::STE_PC_SHADER) {
- Page[1] = new GameMtlShaderDlg(HwndPanel,IParams,TheMtl,PassIndex);
- } else {
- // The PS2 shader is different.
- Page[1] = new PS2GameMtlShaderDlg(HwndPanel,IParams,TheMtl,PassIndex);
- }
-
- Page[2] = new GameMtlTextureDlg(HwndPanel,IParams,TheMtl,PassIndex);
-
- for (i=0; iGet_Hwnd();
-
- // set the tab names
- char name[64];
- ::GetWindowText(hwnd,name,sizeof(name));
- TC_ITEM tcitem = { TCIF_TEXT,0,0,name,0 };
- TabCtrl_InsertItem(GetDlgItem(HwndPanel,IDC_GAMEMTL_TAB),i,&tcitem);
- }
-
- // Get the display rectangle of the tab control
- RECT rect;
- ::GetWindowRect(GetDlgItem(HwndPanel,IDC_GAMEMTL_TAB),&rect);
- TabCtrl_AdjustRect(GetDlgItem(HwndPanel,IDC_GAMEMTL_TAB),FALSE, &rect);
-
- // Convert the display rectangle from screen to client coords
- ScreenToClient(HwndPanel,(POINT *)(&rect));
- ScreenToClient(HwndPanel, ((LPPOINT)&rect) + 1);
-
- for (i=0; iGet_Hwnd();
-
- // Loop through all the tabs in the property sheet
- // Get a pointer to this tab
- SetWindowPos( hwnd,
- NULL,
- rect.left, rect.top,
- rect.right - rect.left, rect.bottom - rect.top,
- SWP_NOZORDER);
- }
-
- CurPage = 0;
- TabCtrl_SetCurSel(GetDlgItem(HwndPanel,IDC_GAMEMTL_TAB),CurPage);
- Page[CurPage]->Show();
-
- break;
- }
-
- case WM_PAINT:
- {
- if (!Valid) {
- Valid = TRUE;
- ReloadDialog();
- }
- return FALSE;
- }
-
- case WM_NOTIFY:
- {
- NMHDR * header = (NMHDR *)lParam;
-
- switch(header->code) {
- case TCN_SELCHANGE:
- {
- int sel = TabCtrl_GetCurSel(GetDlgItem(HwndPanel,IDC_GAMEMTL_TAB));
- Page[sel]->Show();
-
- for (int i=0; i < PAGE_COUNT; i++) {
- if (i != sel) Page[i]->Show(false);
- }
- CurPage = sel;
- TheMtl->Set_Current_Page(PassIndex,CurPage);
- }
- };
- break;
- }
- }
- return FALSE;
-}
-
-
-/***********************************************************************************************
- * GameMtlPassDlg::Invalidate -- invalidate the dialog *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/23/98 GTH : Created. *
- *=============================================================================================*/
-void GameMtlPassDlg::Invalidate()
-{
- Valid = FALSE;
- InvalidateRect(HwndPanel,NULL,0);
-}
-
-
-/***********************************************************************************************
- * GameMtlPassDlg::ReloadDialog -- update the contents of all of the controls *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/23/98 GTH : Created. *
- *=============================================================================================*/
-void GameMtlPassDlg::ReloadDialog()
-{
- int i;
-
- DebugPrint("GameMtlPassDlg::ReloadDialog\n");
- Interval v;
- TheMtl->Update(IParams->GetTime(),v);
-
- for (i=0; iReloadDialog();
- }
-
- CurPage = TheMtl->Get_Current_Page(PassIndex);
- TabCtrl_SetCurSel(GetDlgItem(HwndPanel,IDC_GAMEMTL_TAB),CurPage);
- Page[CurPage]->Show();
- for (i=0; i < PAGE_COUNT; i++) {
- if (i != CurPage) Page[i]->Show(false);
- }
-}
-
-
-/***********************************************************************************************
- * GameMtlPassDlg::ClassID -- returns classID of the object being edited *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/23/98 GTH : Created. *
- *=============================================================================================*/
-Class_ID GameMtlPassDlg::ClassID()
-{
- return GameMaterialClassID;
-}
-
-
-/***********************************************************************************************
- * GameMtlPassDlg::SetThing -- set the material being edited *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/23/98 GTH : Created. *
- *=============================================================================================*/
-void GameMtlPassDlg::SetThing(ReferenceTarget* target)
-{
- // Note, parent will "reload" when our "thing" changes :-)
- assert (target->SuperClassID()==MATERIAL_CLASS_ID);
- assert (target->ClassID()==GameMaterialClassID);
-
- TheMtl = (GameMtl *)target;
-
- for (int i=0; iSetThing(target);
- }
-}
-
-
-/***********************************************************************************************
- * GameMtlPassDlg::ActivateDlg -- activate or deactivate the dialog *
- * *
- * some of the custom max controls need to be activated and deactivated *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/23/98 GTH : Created. *
- *=============================================================================================*/
-void GameMtlPassDlg::ActivateDlg(BOOL onoff)
-{
- for (int i=0; iActivateDlg(onoff);
- }
-}
-
-
-/***********************************************************************************************
- * GameMtlPassDlg::SetTime -- set the current time *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/23/98 GTH : Created. *
- *=============================================================================================*/
-void GameMtlPassDlg::SetTime(TimeValue t)
-{
- // parent dialog class keeps track of the validty and we
- // don't have to do anything in this function (it will never
- // be called in fact)
-}
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/GameMtlPassDlg.h b/Generals/Code/Tools/WW3D/max2w3d/GameMtlPassDlg.h
deleted file mode 100644
index 5dd8a2aa731..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/GameMtlPassDlg.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Max2W3d *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/GameMtlPassDlg.h $*
- * *
- * Author:: Greg Hjelstrom *
- * *
- * $Modtime:: 11/17/98 1:32p $*
- * *
- * $Revision:: 5 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-
-
-#ifndef GAMEMTLPASSDLG_H
-#define GAMEMTLPASSDLG_H
-
-#include
-
-class GameMtl;
-class GameMtlFormClass;
-
-/*
-** The GameMtlPassDlg will contain a Tab Control which switches between
-** editing the VertexMaterial parameters, the Shader parameters and the
-** Texture parameters.
-*/
-class GameMtlPassDlg: public ParamDlg
-{
-public:
-
- GameMtlPassDlg(HWND hwMtlEdit, IMtlParams *imp, GameMtl *m,int pass);
- ~GameMtlPassDlg();
-
- BOOL DialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
-
- void Invalidate();
- void UpdateMtlDisplay() { IParams->MtlChanged(); }
-
- void ReloadDialog();
- Class_ID ClassID();
- void SetThing(ReferenceTarget* target);
- ReferenceTarget * GetThing() { return (ReferenceTarget *)TheMtl; }
- void DeleteThis() { delete this; }
- void SetTime(TimeValue t);
- void ActivateDlg(BOOL onOff);
-
- enum { PAGE_COUNT = 3 };
-
- ////////////////////////////////////////////////////////////////////////
- // Material dialog interface
- ////////////////////////////////////////////////////////////////////////
- IMtlParams * IParams; // interface to the material editor
- GameMtl * TheMtl; // current mtl being edited.
-
- ////////////////////////////////////////////////////////////////////////
- // Windows handles
- ////////////////////////////////////////////////////////////////////////
- HWND HwndEdit; // window handle of the materials editor dialog
- HWND HwndPanel; // Rollup parameters panel
-
- ////////////////////////////////////////////////////////////////////////
- // Variables
- ////////////////////////////////////////////////////////////////////////
- int PassIndex;
- int CurPage;
- BOOL Valid;
-
- GameMtlFormClass* Page[PAGE_COUNT];
-};
-
-#endif
\ No newline at end of file
diff --git a/Generals/Code/Tools/WW3D/max2w3d/GameMtlShaderDlg.cpp b/Generals/Code/Tools/WW3D/max2w3d/GameMtlShaderDlg.cpp
deleted file mode 100644
index c9859f4cff5..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/GameMtlShaderDlg.cpp
+++ /dev/null
@@ -1,397 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Max2W3d *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/GameMtlShaderDlg.cpp $*
- * *
- * Author:: Greg Hjelstrom *
- * *
- * $Modtime:: 2/26/99 7:23p $*
- * *
- * $Revision:: 13 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * GameMtlShaderDlg::GameMtlShaderDlg -- constructor *
- * GameMtlShaderDlg::~GameMtlShaderDlg -- destructor *
- * GameMtlShaderDlg::Dialog_Proc -- windows message handler *
- * GameMtlShaderDlg::ReloadDialog -- reload the contents of all of the controls *
- * GameMtlShaderDlg::ActivateDlg -- activate/deactivate the dialog *
- * GameMtlShaderDlg::Apply_Preset -- apply a preset shader setting *
- * GameMtlShaderDlg::Set_Preset -- determine preset shader setting from game material *
- * GameMtlShaderDlg::CompareShaderToBlendPreset -- compare preset to game material shader *
- * GameMtlShaderDlg::Set_Advanced_Defaults -- set advanced settings to defaults *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#include "GameMtlShaderDlg.h"
-#include "GameMtlDlg.h"
-#include "gamemtl.h"
-#include "resource.h"
-
-/*
-** Shader Blend Setting Presets
-*/
-
-// Note: the array has NUM_SHADER_BLEND_PRESETS + 1 entries (due to the 'Custom' entry).
-
-#define NUM_SHADER_BLEND_PRESETS 8
-
-static char * _ShaderBlendSettingPresetNames[NUM_SHADER_BLEND_PRESETS + 1] =
-{
- "Opaque",
- "Add",
- "Multiply",
- "Multiply and Add",
- "Screen",
- "Alpha Blend",
- "Alpha Test",
- "Alpha Test and Blend",
- "------ Custom -----"
-};
-struct ShaderBlendSettingPreset
-{
- int SrcBlend;
- int DestBlend;
- bool DepthMask;
- bool AlphaTest;
-};
-static const ShaderBlendSettingPreset ShaderBlendSettingPresets[NUM_SHADER_BLEND_PRESETS] = {
- {W3DSHADER_SRCBLENDFUNC_ONE, W3DSHADER_DESTBLENDFUNC_ZERO, true, false}, // Opaque
- {W3DSHADER_SRCBLENDFUNC_ONE, W3DSHADER_DESTBLENDFUNC_ONE, false, false}, // Add
- {W3DSHADER_SRCBLENDFUNC_ZERO, W3DSHADER_DESTBLENDFUNC_SRC_COLOR, false, false}, // Multiply
- {W3DSHADER_SRCBLENDFUNC_ONE, W3DSHADER_DESTBLENDFUNC_SRC_COLOR, false, false}, // Multiply and Add
- {W3DSHADER_SRCBLENDFUNC_ONE, W3DSHADER_DESTBLENDFUNC_ONE_MINUS_SRC_COLOR, false, false}, // Screen
- {W3DSHADER_SRCBLENDFUNC_SRC_ALPHA, W3DSHADER_DESTBLENDFUNC_ONE_MINUS_SRC_ALPHA, false, false}, // Alpha Blend
- {W3DSHADER_SRCBLENDFUNC_ONE, W3DSHADER_DESTBLENDFUNC_ZERO, true, true}, // Alpha Test
- {W3DSHADER_SRCBLENDFUNC_SRC_ALPHA, W3DSHADER_DESTBLENDFUNC_ONE_MINUS_SRC_ALPHA, true, true} // Alpha Test and Blend
-};
-
-
-/***********************************************************************************************
- * GameMtlShaderDlg::GameMtlShaderDlg -- constructor *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/23/98 GTH : Created. *
- *=============================================================================================*/
-GameMtlShaderDlg::GameMtlShaderDlg
-(
- HWND parent,
- IMtlParams * imp,
- GameMtl * mtl,
- int pass
-) :
- GameMtlFormClass(imp,mtl,pass)
-{
- Create_Form(parent,IDD_GAMEMTL_SHADER);
-}
-
-
-/***********************************************************************************************
- * GameMtlShaderDlg::~GameMtlShaderDlg -- destructor *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- *=============================================================================================*/
-GameMtlShaderDlg::~GameMtlShaderDlg()
-{
-}
-
-
-/***********************************************************************************************
- * GameMtlShaderDlg::Dialog_Proc -- windows message handler *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/23/98 GTH : Created. *
- *=============================================================================================*/
-BOOL GameMtlShaderDlg::Dialog_Proc (HWND dlg_wnd, UINT message, WPARAM wparam, LPARAM lparam)
-{
- int cursel;
- int i;
- int id = LOWORD(wparam);
- int code = HIWORD(wparam);
-
- switch (message)
- {
-
- case WM_INITDIALOG:
- for(i = 0; i <= NUM_SHADER_BLEND_PRESETS; i++) {
- SendDlgItemMessage(dlg_wnd,IDC_PRESET_COMBO,CB_ADDSTRING,0,(LONG)_ShaderBlendSettingPresetNames[i]);
- }
- SendDlgItemMessage(dlg_wnd,IDC_PRESET_COMBO,CB_SETCURSEL,0,0);
- break;
-
- case WM_LBUTTONDOWN:
- case WM_LBUTTONUP:
- case WM_MOUSEMOVE:
- {
- IParams->RollupMouseMessage(dlg_wnd,message,wparam,lparam);
- }
- return FALSE;
-
- case WM_COMMAND:
- {
- if (code == CBN_SELCHANGE) {
-
- switch (id)
- {
- case IDC_DEPTHCOMPARE_COMBO:
- cursel = SendDlgItemMessage(dlg_wnd,IDC_DEPTHCOMPARE_COMBO,CB_GETCURSEL,0,0);
- TheMtl->Set_Depth_Compare(PassIndex,cursel);
- break;
- case IDC_DESTBLEND_COMBO:
- cursel = SendDlgItemMessage(dlg_wnd,IDC_DESTBLEND_COMBO,CB_GETCURSEL,0,0);
- TheMtl->Set_Dest_Blend(PassIndex,cursel);
- TheMtl->Notify_Changed();
- Set_Preset();
- break;
- case IDC_PRIGRADIENT_COMBO:
- cursel = SendDlgItemMessage(dlg_wnd,IDC_PRIGRADIENT_COMBO,CB_GETCURSEL,0,0);
- TheMtl->Set_Pri_Gradient(PassIndex,cursel);
- TheMtl->Notify_Changed();
- break;
- case IDC_SECGRADIENT_COMBO:
- cursel = SendDlgItemMessage(dlg_wnd,IDC_SECGRADIENT_COMBO,CB_GETCURSEL,0,0);
- TheMtl->Set_Sec_Gradient(PassIndex,cursel);
- TheMtl->Notify_Changed();
- break;
- case IDC_SRCBLEND_COMBO:
- cursel = SendDlgItemMessage(dlg_wnd,IDC_SRCBLEND_COMBO,CB_GETCURSEL,0,0);
- TheMtl->Set_Src_Blend(PassIndex,cursel);
- TheMtl->Notify_Changed();
- Set_Preset();
- break;
- case IDC_DETAILCOLOR_COMBO:
- cursel = SendDlgItemMessage(dlg_wnd,IDC_DETAILCOLOR_COMBO,CB_GETCURSEL,0,0);
- TheMtl->Set_Detail_Color_Func(PassIndex,cursel);
- TheMtl->Notify_Changed();
- break;
- case IDC_DETAILALPHA_COMBO:
- cursel = SendDlgItemMessage(dlg_wnd,IDC_DETAILALPHA_COMBO,CB_GETCURSEL,0,0);
- TheMtl->Set_Detail_Alpha_Func(PassIndex,cursel);
- TheMtl->Notify_Changed();
- break;
- case IDC_PRESET_COMBO:
- cursel = SendDlgItemMessage(dlg_wnd,IDC_PRESET_COMBO,CB_GETCURSEL,0,0);
- Apply_Preset(cursel);
- break;
- }
-
- } else {
-
- switch(id) {
-
- case IDC_DEPTHMASK_CHECK:
- if (SendDlgItemMessage(dlg_wnd,IDC_DEPTHMASK_CHECK,BM_GETCHECK,0,0)) {
- TheMtl->Set_Depth_Mask(PassIndex,W3DSHADER_DEPTHMASK_WRITE_ENABLE);
- } else {
- TheMtl->Set_Depth_Mask(PassIndex,W3DSHADER_DEPTHMASK_WRITE_DISABLE);
- }
- Set_Preset();
- break;
-
- case IDC_ALPHATEST_CHECK:
- if (SendDlgItemMessage(dlg_wnd,IDC_ALPHATEST_CHECK,BM_GETCHECK,0,0)) {
- TheMtl->Set_Alpha_Test(PassIndex,W3DSHADER_ALPHATEST_ENABLE);
- } else {
- TheMtl->Set_Alpha_Test(PassIndex,W3DSHADER_ALPHATEST_DISABLE);
- }
- Set_Preset();
- break;
-
- case IDC_SHADER_DEFAULTS_BUTTON:
- Set_Advanced_Defaults();
- break;
- }
- }
- }
- }
-
- return FALSE;
-}
-
-
-/***********************************************************************************************
- * GameMtlShaderDlg::ReloadDialog -- reload the contents of all of the controls *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/23/98 GTH : Created. *
- *=============================================================================================*/
-void GameMtlShaderDlg::ReloadDialog(void)
-{
- DebugPrint("GameMtlShaderDlg::ReloadDialog\n");
- SendDlgItemMessage(m_hWnd, IDC_DESTBLEND_COMBO, CB_SETCURSEL, TheMtl->Get_Dest_Blend(PassIndex), 0 );
- SendDlgItemMessage(m_hWnd, IDC_SRCBLEND_COMBO, CB_SETCURSEL, TheMtl->Get_Src_Blend(PassIndex), 0 );
- SendDlgItemMessage(m_hWnd, IDC_PRIGRADIENT_COMBO, CB_SETCURSEL, TheMtl->Get_Pri_Gradient(PassIndex), 0 );
- SendDlgItemMessage(m_hWnd, IDC_SECGRADIENT_COMBO, CB_SETCURSEL, TheMtl->Get_Sec_Gradient(PassIndex), 0 );
- SendDlgItemMessage(m_hWnd, IDC_DEPTHCOMPARE_COMBO, CB_SETCURSEL, TheMtl->Get_Depth_Compare(PassIndex), 0 );
- SendDlgItemMessage(m_hWnd, IDC_DETAILCOLOR_COMBO, CB_SETCURSEL, TheMtl->Get_Detail_Color_Func(PassIndex), 0 );
- SendDlgItemMessage(m_hWnd, IDC_DETAILALPHA_COMBO, CB_SETCURSEL, TheMtl->Get_Detail_Alpha_Func(PassIndex), 0 );
- Set_Preset();
-
- SetCheckBox(m_hWnd,IDC_DEPTHMASK_CHECK, TheMtl->Get_Depth_Mask(PassIndex));
- SetCheckBox(m_hWnd,IDC_ALPHATEST_CHECK, TheMtl->Get_Alpha_Test(PassIndex));
-}
-
-
-/***********************************************************************************************
- * GameMtlShaderDlg::ActivateDlg -- activate/deactivate the dialog *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/23/98 GTH : Created. *
- *=============================================================================================*/
-void GameMtlShaderDlg::ActivateDlg(BOOL onoff)
-{
- // shader has no color swatches which need to be activated...
-}
-
-
-/***********************************************************************************************
- * GameMtlShaderDlg::Apply_Preset -- apply a preset shader setting *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/23/98 GTH : Created. *
- *=============================================================================================*/
-void GameMtlShaderDlg::Apply_Preset(int preset_index)
-{
- if (preset_index < 0 || preset_index >= NUM_SHADER_BLEND_PRESETS) return;
-
- const ShaderBlendSettingPreset &preset = ShaderBlendSettingPresets[preset_index];
-
- TheMtl->Set_Src_Blend(PassIndex, preset.SrcBlend);
-
- TheMtl->Set_Dest_Blend(PassIndex, preset.DestBlend);
-
- int depth_mask = preset.DepthMask ? W3DSHADER_DEPTHMASK_WRITE_ENABLE : W3DSHADER_DEPTHMASK_WRITE_DISABLE;
- TheMtl->Set_Depth_Mask(PassIndex, depth_mask);
-
- int alpha_test = preset.AlphaTest ? W3DSHADER_ALPHATEST_ENABLE : W3DSHADER_ALPHATEST_DISABLE;
- TheMtl->Set_Alpha_Test(PassIndex, alpha_test);
-
- TheMtl->Notify_Changed();
- ReloadDialog();
-}
-
-
-/***********************************************************************************************
- * GameMtlShaderDlg::Set_Preset -- determine preset shader setting from game material *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 02/26/99 NH : Created. *
- *=============================================================================================*/
-void GameMtlShaderDlg::Set_Preset(void)
-{
- for (int i = 0; i < NUM_SHADER_BLEND_PRESETS; i++) {
- if (CompareShaderToBlendPreset(ShaderBlendSettingPresets[i])) break;
- }
- SendDlgItemMessage(m_hWnd, IDC_PRESET_COMBO, CB_SETCURSEL, i, 0);
-}
-
-
-/***********************************************************************************************
- * GameMtlShaderDlg::CompareShaderToBlendPreset -- compare preset to game material shader *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 02/26/99 NH : Created. *
- *=============================================================================================*/
-bool GameMtlShaderDlg::CompareShaderToBlendPreset(const ShaderBlendSettingPreset &blend_preset)
-{
- if (TheMtl->Get_Src_Blend(PassIndex) != blend_preset.SrcBlend) return false;
- if (TheMtl->Get_Dest_Blend(PassIndex) != blend_preset.DestBlend) return false;
- bool depthmask = TheMtl->Get_Depth_Mask(PassIndex) != W3DSHADER_DEPTHMASK_WRITE_DISABLE;
- if (depthmask != blend_preset.DepthMask) return false;
- bool alphatest = TheMtl->Get_Alpha_Test(PassIndex) != W3DSHADER_ALPHATEST_DISABLE;
- if (alphatest != blend_preset.AlphaTest) return false;
- return true;
-}
-
-
-/***********************************************************************************************
- * GameMtlShaderDlg::Set_Advanced_Defaults -- set advanced settings to defaults *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 02/26/99 NH : Created. *
- *=============================================================================================*/
-void GameMtlShaderDlg::Set_Advanced_Defaults(void)
-{
- TheMtl->Set_Pri_Gradient(PassIndex, W3DSHADER_PRIGRADIENT_DEFAULT);
- TheMtl->Set_Sec_Gradient(PassIndex, W3DSHADER_SECGRADIENT_DEFAULT);
- TheMtl->Set_Depth_Compare(PassIndex, W3DSHADER_DEPTHCOMPARE_DEFAULT);
- TheMtl->Set_Detail_Color_Func(PassIndex, W3DSHADER_DETAILCOLORFUNC_DEFAULT);
- TheMtl->Set_Detail_Alpha_Func(PassIndex, W3DSHADER_DETAILALPHAFUNC_DEFAULT);
-
- TheMtl->Notify_Changed();
- ReloadDialog();
-}
\ No newline at end of file
diff --git a/Generals/Code/Tools/WW3D/max2w3d/GameMtlShaderDlg.h b/Generals/Code/Tools/WW3D/max2w3d/GameMtlShaderDlg.h
deleted file mode 100644
index 77b51300c86..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/GameMtlShaderDlg.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Max2W3d *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/GameMtlShaderDlg.h $*
- * *
- * Author:: Greg Hjelstrom *
- * *
- * $Modtime:: 2/26/99 7:00p $*
- * *
- * $Revision:: 5 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-
-#ifndef GAMEMTLSHADERDLG_H
-#define GAMEMTLSHADERDLG_H
-
-#include
-#include "GameMtlForm.h"
-
-
-class GameMtl;
-struct ShaderBlendSettingPreset;
-
-class GameMtlShaderDlg : public GameMtlFormClass
-{
-
-public:
-
- GameMtlShaderDlg(HWND parent, IMtlParams * imp, GameMtl * m, int pass);
- ~GameMtlShaderDlg();
-
- virtual BOOL Dialog_Proc (HWND dlg_wnd, UINT message, WPARAM wparam, LPARAM lparam);
-
- void ActivateDlg(BOOL onOff);
- void ReloadDialog(void);
-
-private:
-
- void Apply_Preset(int preset_index);
- void Set_Preset(void);
- bool CompareShaderToBlendPreset(const ShaderBlendSettingPreset &blend_preset);
- void Set_Advanced_Defaults(void);
-};
-
-#endif
\ No newline at end of file
diff --git a/Generals/Code/Tools/WW3D/max2w3d/GameMtlTextureDlg.cpp b/Generals/Code/Tools/WW3D/max2w3d/GameMtlTextureDlg.cpp
deleted file mode 100644
index f6dd31be76b..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/GameMtlTextureDlg.cpp
+++ /dev/null
@@ -1,667 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Max2W3d *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/GameMtlTextureDlg.cpp $*
- * *
- * Author:: Greg Hjelstrom *
- * *
- * $Modtime:: 8/14/00 1:47p $*
- * *
- * $Revision:: 15 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * GameMtlTextureDlg::GameMtlTextureDlg -- constructor *
- * GameMtlTextureDlg::~GameMtlTextureDlg -- destructor *
- * GameMtlTextureDlg::Dialog_Proc -- windows message handler *
- * GameMtlTextureDlg::ReloadDialog -- reload the contents of all of the controls in this dia *
- * GameMtlTextureDlg::ActivateDlg -- activate/deactivate this dialog *
- * GameMtlTextureDlg::Enable_Stage -- enable or disable a texture stage *
- * GameMtlTextureDlg::Update_Texture_Buttons -- update the texture buttons text *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-
-
-
-#include "GameMtlTextureDlg.h"
-#include "gamemtl.h"
-#include "dllmain.h"
-#include "resource.h"
-#include
-#include
-#include
-
-
-/***********************************************************************************************
- * GameMtlTextureDlg::GameMtlTextureDlg -- constructor *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/23/98 GTH : Created. *
- *=============================================================================================*/
-GameMtlTextureDlg::GameMtlTextureDlg
-(
- HWND parent,
- IMtlParams * imp,
- GameMtl * mtl,
- int pass
-) :
- GameMtlFormClass(imp,mtl,pass)
-{
- Stage0FramesSpin = NULL;
- Stage1FramesSpin = NULL;
- Stage0RateSpin = NULL;
- Stage1RateSpin = NULL;
-
- Stage0PublishButton = NULL;
- Stage1PublishButton = NULL;
- Stage0ClampUButton = NULL;
- Stage1ClampUButton = NULL;
- Stage0ClampVButton = NULL;
- Stage1ClampVButton = NULL;
- Stage0NoLODButton = NULL;
- Stage1NoLODButton = NULL;
- Stage0AlphaBitmapButton = NULL;
- Stage1AlphaBitmapButton = NULL;
- Stage0DisplayButton = NULL;
- Stage1DisplayButton = NULL;
-
- if (mtl->Get_Shader_Type() == GameMtl::STE_PC_SHADER) {
- Create_Form(parent,IDD_GAMEMTL_TEXTURES);
- } else {
- // Use the PS2 dialog. It is the same but it disables some functions that aren't
- // supported yet.
- Create_Form(parent,IDD_GAMEMTL_PS2_TEXTURES);
- }
-}
-
-
-/***********************************************************************************************
- * GameMtlTextureDlg::~GameMtlTextureDlg -- destructor *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/23/98 GTH : Created. *
- *=============================================================================================*/
-GameMtlTextureDlg::~GameMtlTextureDlg()
-{
- assert(Stage0FramesSpin && Stage1FramesSpin && Stage0RateSpin && Stage1RateSpin);
- ReleaseISpinner(Stage0FramesSpin);
- ReleaseISpinner(Stage1FramesSpin);
- ReleaseISpinner(Stage0RateSpin);
- ReleaseISpinner(Stage1RateSpin);
-
- ReleaseICustButton(Stage0PublishButton);
- ReleaseICustButton(Stage1PublishButton);
- ReleaseICustButton(Stage0ClampUButton);
- ReleaseICustButton(Stage1ClampUButton);
- ReleaseICustButton(Stage0ClampVButton);
- ReleaseICustButton(Stage1ClampVButton);
- ReleaseICustButton(Stage0NoLODButton);
- ReleaseICustButton(Stage1NoLODButton);
- ReleaseICustButton(Stage0AlphaBitmapButton);
- ReleaseICustButton(Stage1AlphaBitmapButton);
- ReleaseICustButton(Stage0DisplayButton);
- ReleaseICustButton(Stage1DisplayButton);
-}
-
-
-/***********************************************************************************************
- * GameMtlTextureDlg::Dialog_Proc -- windows message handler *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/23/98 GTH : Created. *
- * 10/6/1999 MLL: Turned off the display button when the texture is turned off. *
- *=============================================================================================*/
-BOOL GameMtlTextureDlg::Dialog_Proc (HWND dlg_wnd, UINT message, WPARAM wparam, LPARAM lparam)
-{
- int cursel;
- int id = LOWORD(wparam);
- int code = HIWORD(wparam);
-
- switch (message)
- {
- case WM_INITDIALOG:
- {
- Stage0FramesSpin = SetupIntSpinner( dlg_wnd,
- IDC_STAGE0_FRAMES_SPIN,
- IDC_STAGE0_FRAMES_EDIT,
- 1,999,
- TheMtl->Get_Texture_Frame_Count(PassIndex,0) );
-
- Stage0RateSpin = SetupFloatSpinner( dlg_wnd,
- IDC_STAGE0_RATE_SPIN,
- IDC_STAGE0_RATE_EDIT,
- 0.0f,60.0f,
- TheMtl->Get_Texture_Frame_Rate(PassIndex,0),
- 1.0f );
-
- Stage1FramesSpin = SetupIntSpinner( dlg_wnd,
- IDC_STAGE1_FRAMES_SPIN,
- IDC_STAGE1_FRAMES_EDIT,
- 1,999,
- TheMtl->Get_Texture_Frame_Count(PassIndex,1) );
-
- Stage1RateSpin = SetupFloatSpinner( dlg_wnd,
- IDC_STAGE1_RATE_SPIN,
- IDC_STAGE1_RATE_EDIT,
- 0.0f,60.0f,
- TheMtl->Get_Texture_Frame_Rate(PassIndex,1),
- 1.0f );
-
- Stage0PublishButton = GetICustButton(GetDlgItem(dlg_wnd, IDC_STAGE0_PUBLISH_BUTTON));
- Stage0PublishButton->SetType(CBT_CHECK);
- Stage0PublishButton->SetHighlightColor(GREEN_WASH);
- Stage0PublishButton->SetCheck(TheMtl->Get_Texture_Publish(PassIndex,0));
- Stage0PublishButton->SetText(Get_String(IDS_PUBLISH));
-
- Stage1PublishButton = GetICustButton(GetDlgItem(dlg_wnd, IDC_STAGE1_PUBLISH_BUTTON));
- Stage1PublishButton->SetType(CBT_CHECK);
- Stage1PublishButton->SetHighlightColor(GREEN_WASH);
- Stage1PublishButton->SetCheck(TheMtl->Get_Texture_Publish(PassIndex,1));
- Stage1PublishButton->SetText(Get_String(IDS_PUBLISH));
-
- Stage0ClampUButton = GetICustButton(GetDlgItem(dlg_wnd, IDC_STAGE0_CLAMP_U_BUTTON));
- Stage0ClampUButton->SetType(CBT_CHECK);
- Stage0ClampUButton->SetHighlightColor(GREEN_WASH);
- Stage0ClampUButton->SetCheck(TheMtl->Get_Texture_Clamp_U(PassIndex,0));
- Stage0ClampUButton->SetText(Get_String(IDS_CLAMP_U));
-
- Stage1ClampUButton = GetICustButton(GetDlgItem(dlg_wnd, IDC_STAGE1_CLAMP_U_BUTTON));
- Stage1ClampUButton->SetType(CBT_CHECK);
- Stage1ClampUButton->SetHighlightColor(GREEN_WASH);
- Stage1ClampUButton->SetCheck(TheMtl->Get_Texture_Clamp_U(PassIndex,1));
- Stage1ClampUButton->SetText(Get_String(IDS_CLAMP_U));
-
- Stage0ClampVButton = GetICustButton(GetDlgItem(dlg_wnd, IDC_STAGE0_CLAMP_V_BUTTON));
- Stage0ClampVButton->SetType(CBT_CHECK);
- Stage0ClampVButton->SetHighlightColor(GREEN_WASH);
- Stage0ClampVButton->SetCheck(TheMtl->Get_Texture_Clamp_V(PassIndex,0));
- Stage0ClampVButton->SetText(Get_String(IDS_CLAMP_V));
-
- Stage1ClampVButton = GetICustButton(GetDlgItem(dlg_wnd, IDC_STAGE1_CLAMP_V_BUTTON));
- Stage1ClampVButton->SetType(CBT_CHECK);
- Stage1ClampVButton->SetHighlightColor(GREEN_WASH);
- Stage1ClampVButton->SetCheck(TheMtl->Get_Texture_Clamp_V(PassIndex,1));
- Stage1ClampVButton->SetText(Get_String(IDS_CLAMP_V));
-
- Stage0NoLODButton = GetICustButton(GetDlgItem(dlg_wnd, IDC_STAGE0_NOLOD_BUTTON));
- Stage0NoLODButton->SetType(CBT_CHECK);
- Stage0NoLODButton->SetHighlightColor(GREEN_WASH);
- Stage0NoLODButton->SetCheck(TheMtl->Get_Texture_No_LOD(PassIndex,0));
- Stage0NoLODButton->SetText(Get_String(IDS_NO_LOD));
-
- Stage1NoLODButton = GetICustButton(GetDlgItem(dlg_wnd, IDC_STAGE1_NOLOD_BUTTON));
- Stage1NoLODButton->SetType(CBT_CHECK);
- Stage1NoLODButton->SetHighlightColor(GREEN_WASH);
- Stage1NoLODButton->SetCheck(TheMtl->Get_Texture_No_LOD(PassIndex,0));
- Stage1NoLODButton->SetText(Get_String(IDS_NO_LOD));
-
- Stage0AlphaBitmapButton = GetICustButton(GetDlgItem(dlg_wnd, IDC_STAGE0_ALPHA_BITMAP_BUTTON));
- Stage0AlphaBitmapButton->SetType(CBT_CHECK);
- Stage0AlphaBitmapButton->SetHighlightColor(GREEN_WASH);
- Stage0AlphaBitmapButton->SetCheck(TheMtl->Get_Texture_Alpha_Bitmap(PassIndex,0));
- Stage0AlphaBitmapButton->SetText(Get_String(IDS_ALPHA_BITMAP));
-
- Stage1AlphaBitmapButton = GetICustButton(GetDlgItem(dlg_wnd, IDC_STAGE1_ALPHA_BITMAP_BUTTON));
- Stage1AlphaBitmapButton->SetType(CBT_CHECK);
- Stage1AlphaBitmapButton->SetHighlightColor(GREEN_WASH);
- Stage1AlphaBitmapButton->SetCheck(TheMtl->Get_Texture_Alpha_Bitmap(PassIndex,1));
- Stage1AlphaBitmapButton->SetText(Get_String(IDS_ALPHA_BITMAP));
-
- Stage0DisplayButton = GetICustButton(GetDlgItem(dlg_wnd, IDC_STAGE0_DISPLAY_BUTTON));
- Stage0DisplayButton->SetType(CBT_CHECK);
- Stage0DisplayButton->SetHighlightColor(GREEN_WASH);
- Stage0DisplayButton->SetCheck(TheMtl->Get_Texture_Display(PassIndex,0));
- Stage0DisplayButton->SetText(Get_String(IDS_DISPLAY));
-
- Stage1DisplayButton = GetICustButton(GetDlgItem(dlg_wnd, IDC_STAGE1_DISPLAY_BUTTON));
- Stage1DisplayButton->SetType(CBT_CHECK);
- Stage1DisplayButton->SetHighlightColor(GREEN_WASH);
- Stage1DisplayButton->SetCheck(TheMtl->Get_Texture_Display(PassIndex,1));
- Stage1DisplayButton->SetText(Get_String(IDS_DISPLAY));
- break;
- }
-
- case WM_LBUTTONDOWN:
- case WM_LBUTTONUP:
- case WM_MOUSEMOVE:
- {
- IParams->RollupMouseMessage(dlg_wnd,message,wparam,lparam);
- return FALSE;
- }
-
- case CC_SPINNER_CHANGE:
- {
- TheMtl->Set_Texture_Frame_Count( PassIndex, 0,
- Stage0FramesSpin->GetIVal());
-
- TheMtl->Set_Texture_Frame_Rate( PassIndex, 0,
- Stage0RateSpin->GetFVal());
-
- TheMtl->Set_Texture_Frame_Count( PassIndex, 1,
- Stage1FramesSpin->GetIVal());
-
- TheMtl->Set_Texture_Frame_Rate( PassIndex, 1,
- Stage1RateSpin->GetFVal());
- break;
- }
-
- case CC_SPINNER_BUTTONUP:
- {
- TheMtl->Notify_Changed();
- break;
- }
-
- case WM_COMMAND:
- {
- switch (id)
- {
- case IDC_STAGE0_BUTTON:
- {
- BitmapInfo bmi;
- BitmapTex * texture;
-
- if (TheManager->SelectFileInput(&bmi, m_hWnd)) {
- texture = NewDefaultBitmapTex();
- if (texture) {
-
- BOOL disp = TheMtl->Get_Texture_Display(PassIndex,0);
- if (disp) {
- TheMtl->Set_Texture_Display(PassIndex,0,FALSE);
- }
-
- texture->SetMapName((char *)bmi.Name());
- int texmap_index = TheMtl->pass_stage_to_texmap_index(PassIndex,0);
- TheMtl->SetSubTexmap(texmap_index,texture);
- Update_Texture_Buttons();
- TheMtl->Notify_Changed();
-
- if (disp) {
- TheMtl->Set_Texture_Display(PassIndex,0,TRUE);
- TheMtl->Notify_Changed();
- }
- }
- }
- break;
- }
- case IDC_STAGE1_BUTTON:
- {
- BitmapInfo bmi;
- BitmapTex * texture;
-
- if (TheManager->SelectFileInput(&bmi, m_hWnd)) {
- texture = NewDefaultBitmapTex();
- if (texture) {
-
- BOOL disp = TheMtl->Get_Texture_Display(PassIndex,1);
- if (disp) {
- TheMtl->Set_Texture_Display(PassIndex,1,FALSE);
- }
-
- texture->SetMapName((char *)bmi.Name());
- int texmap_index = TheMtl->pass_stage_to_texmap_index(PassIndex,1);
- TheMtl->SetSubTexmap(texmap_index,texture);
- Update_Texture_Buttons();
- TheMtl->Notify_Changed();
-
- if (disp) {
- TheMtl->Set_Texture_Display(PassIndex,1,TRUE);
- TheMtl->Notify_Changed();
- }
- }
- }
- break;
- }
- case IDC_STAGE0_ENABLE:
- {
- int checkbox = GetCheckBox(dlg_wnd,IDC_STAGE0_ENABLE);
- Enable_Stage(0,(checkbox == TRUE ? true : false) );
-
- // If the texture stage is turned off, turn off the Display button so that it won't
- // show up in the viewport.
- if (checkbox == FALSE) {
-
- TheMtl->Set_Texture_Display(PassIndex, 0, FALSE);
- TheMtl->Notify_Changed();
- }
- break;
- }
- case IDC_STAGE1_ENABLE:
- {
- int checkbox = GetCheckBox(dlg_wnd,IDC_STAGE1_ENABLE);
-
- Enable_Stage(1,(checkbox == TRUE ? true : false) );
-
- // If the texture stage is turned off, turn off the Display button so that it won't
- // show up in the viewport.
- if (checkbox == FALSE) {
-
- TheMtl->Set_Texture_Display(PassIndex, 1, FALSE);
- TheMtl->Notify_Changed();
- }
- break;
- }
- case IDC_STAGE0_PUBLISH_BUTTON:
- {
- TheMtl->Set_Texture_Publish(PassIndex,0,(Stage0PublishButton->IsChecked() ? TRUE : FALSE));
- break;
- }
- case IDC_STAGE1_PUBLISH_BUTTON:
- {
- TheMtl->Set_Texture_Publish(PassIndex,1,(Stage1PublishButton->IsChecked() ? TRUE : FALSE));
- break;
- }
-
- case IDC_STAGE0_CLAMP_U_BUTTON:
- {
- TheMtl->Set_Texture_Clamp_U(PassIndex,0,(Stage0ClampUButton->IsChecked() ? TRUE : FALSE));
- break;
- }
- case IDC_STAGE1_CLAMP_U_BUTTON:
- {
- TheMtl->Set_Texture_Clamp_U(PassIndex,1,(Stage1ClampUButton->IsChecked() ? TRUE : FALSE));
- break;
- }
- case IDC_STAGE0_CLAMP_V_BUTTON:
- {
- TheMtl->Set_Texture_Clamp_V(PassIndex,0,(Stage0ClampVButton->IsChecked() ? TRUE : FALSE));
- break;
- }
- case IDC_STAGE1_CLAMP_V_BUTTON:
- {
- TheMtl->Set_Texture_Clamp_V(PassIndex,1,(Stage1ClampVButton->IsChecked() ? TRUE : FALSE));
- break;
- }
- case IDC_STAGE0_NOLOD_BUTTON:
- {
- TheMtl->Set_Texture_No_LOD(PassIndex,0,(Stage0NoLODButton->IsChecked() ? TRUE : FALSE));
- break;
- }
- case IDC_STAGE1_NOLOD_BUTTON:
- {
- TheMtl->Set_Texture_No_LOD(PassIndex,1,(Stage1NoLODButton->IsChecked() ? TRUE : FALSE));
- break;
- }
- case IDC_STAGE0_ALPHA_BITMAP_BUTTON:
- {
- TheMtl->Set_Texture_Alpha_Bitmap(PassIndex,0,(Stage0AlphaBitmapButton->IsChecked() ? TRUE : FALSE));
- break;
- }
- case IDC_STAGE1_ALPHA_BITMAP_BUTTON:
- {
- TheMtl->Set_Texture_Alpha_Bitmap(PassIndex,1,(Stage0AlphaBitmapButton->IsChecked() ? TRUE : FALSE));
- break;
- }
- case IDC_STAGE0_DISPLAY_BUTTON:
- {
- TheMtl->Set_Texture_Display(PassIndex,0,(Stage0DisplayButton->IsChecked() ? TRUE : FALSE));
- TheMtl->Notify_Changed();
- break;
- }
- case IDC_STAGE1_DISPLAY_BUTTON:
- {
- TheMtl->Set_Texture_Display(PassIndex,1,(Stage1DisplayButton->IsChecked() ? TRUE : FALSE));
- TheMtl->Notify_Changed();
- break;
- }
- case IDC_STAGE0_ANIM_COMBO:
- {
- if (code == CBN_SELCHANGE) {
- cursel = SendDlgItemMessage(dlg_wnd,IDC_STAGE0_ANIM_COMBO,CB_GETCURSEL,0,0);
- TheMtl->Set_Texture_Anim_Type(PassIndex,0,cursel);
- }
- break;
- }
- case IDC_STAGE1_ANIM_COMBO:
- {
- if (code == CBN_SELCHANGE) {
- cursel = SendDlgItemMessage(dlg_wnd,IDC_STAGE1_ANIM_COMBO,CB_GETCURSEL,0,0);
- TheMtl->Set_Texture_Anim_Type(PassIndex,1,cursel);
- }
- break;
- }
- case IDC_STAGE0_HINT_COMBO:
- {
- if (code == CBN_SELCHANGE) {
- cursel = SendDlgItemMessage(dlg_wnd,IDC_STAGE0_HINT_COMBO,CB_GETCURSEL,0,0);
- TheMtl->Set_Texture_Hint(PassIndex,0,cursel);
- }
- break;
- }
- case IDC_STAGE1_HINT_COMBO:
- {
- if (code == CBN_SELCHANGE) {
- cursel = SendDlgItemMessage(dlg_wnd,IDC_STAGE1_HINT_COMBO,CB_GETCURSEL,0,0);
- TheMtl->Set_Texture_Hint(PassIndex,1,cursel);
- }
- break;
- }
-
- }
- break;
- }
- }
-
- return FALSE;
-}
-
-
-/***********************************************************************************************
- * GameMtlTextureDlg::ReloadDialog -- reload the contents of all of the controls in this dialo *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/23/98 GTH : Created. *
- *=============================================================================================*/
-void GameMtlTextureDlg::ReloadDialog(void)
-{
- DebugPrint("GameMtlTextureDlg::ReloadDialog\n");
- assert(Stage0FramesSpin && Stage1FramesSpin && Stage0RateSpin && Stage1RateSpin);
- Stage0FramesSpin->SetValue(TheMtl->Get_Texture_Frame_Count(PassIndex,0),FALSE);
- Stage1FramesSpin->SetValue(TheMtl->Get_Texture_Frame_Count(PassIndex,1),FALSE);
- Stage0RateSpin->SetValue(TheMtl->Get_Texture_Frame_Rate(PassIndex,0),FALSE);
- Stage1RateSpin->SetValue(TheMtl->Get_Texture_Frame_Rate(PassIndex,1),FALSE);
-
- SendDlgItemMessage( m_hWnd,
- IDC_STAGE0_ANIM_COMBO,
- CB_SETCURSEL,
- TheMtl->Get_Texture_Anim_Type(PassIndex,0), 0 );
-
- SendDlgItemMessage( m_hWnd,
- IDC_STAGE1_ANIM_COMBO,
- CB_SETCURSEL,
- TheMtl->Get_Texture_Anim_Type(PassIndex,1), 0 );
-
- SendDlgItemMessage( m_hWnd,
- IDC_STAGE0_HINT_COMBO,
- CB_SETCURSEL,
- TheMtl->Get_Texture_Hint(PassIndex,0), 0 );
-
- SendDlgItemMessage( m_hWnd,
- IDC_STAGE1_HINT_COMBO,
- CB_SETCURSEL,
- TheMtl->Get_Texture_Hint(PassIndex,1), 0 );
-
- SetCheckBox(m_hWnd,IDC_STAGE0_ENABLE, TheMtl->Get_Texture_Enable(PassIndex,0));
- SetCheckBox(m_hWnd,IDC_STAGE1_ENABLE, TheMtl->Get_Texture_Enable(PassIndex,1));
-
- Stage0PublishButton->SetCheck(TheMtl->Get_Texture_Publish(PassIndex,0));
- Stage1PublishButton->SetCheck(TheMtl->Get_Texture_Publish(PassIndex,1));
- Stage0ClampUButton->SetCheck(TheMtl->Get_Texture_Clamp_U(PassIndex,0));
- Stage1ClampUButton->SetCheck(TheMtl->Get_Texture_Clamp_U(PassIndex,1));
- Stage0ClampVButton->SetCheck(TheMtl->Get_Texture_Clamp_V(PassIndex,0));
- Stage1ClampVButton->SetCheck(TheMtl->Get_Texture_Clamp_V(PassIndex,1));
- Stage0NoLODButton->SetCheck(TheMtl->Get_Texture_No_LOD(PassIndex,0));
- Stage1NoLODButton->SetCheck(TheMtl->Get_Texture_No_LOD(PassIndex,1));
- Stage0AlphaBitmapButton->SetCheck(TheMtl->Get_Texture_Alpha_Bitmap(PassIndex,0));
- Stage1AlphaBitmapButton->SetCheck(TheMtl->Get_Texture_Alpha_Bitmap(PassIndex,1));
- Stage0DisplayButton->SetCheck(TheMtl->Get_Texture_Display(PassIndex,0));
- Stage1DisplayButton->SetCheck(TheMtl->Get_Texture_Display(PassIndex,1));
-
- Update_Texture_Buttons();
-
- Enable_Stage(0,TheMtl->Get_Texture_Enable(PassIndex,0));
- Enable_Stage(1,TheMtl->Get_Texture_Enable(PassIndex,1));
-}
-
-
-/***********************************************************************************************
- * GameMtlTextureDlg::ActivateDlg -- activate/deactivate this dialog *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/23/98 GTH : Created. *
- *=============================================================================================*/
-void GameMtlTextureDlg::ActivateDlg(BOOL onOff)
-{
- // no color swatches to activate.
-}
-
-
-/***********************************************************************************************
- * GameMtlTextureDlg::Enable_Stage -- enable or disable a texture stage *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/23/98 GTH : Created. *
- *=============================================================================================*/
-void GameMtlTextureDlg::Enable_Stage(int stage,BOOL onoff)
-{
- assert((stage >= 0) && (stage < W3dMaterialClass::MAX_STAGES));
- TheMtl->Set_Texture_Enable(PassIndex,stage,(onoff == TRUE ? true : false));
-
- if (stage == 0) {
-
- EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE0_BUTTON),onoff);
-
- // Turn these off if it is a playstation 2 shader.
- // These aren't supported yet.
- if (TheMtl->Get_Shader_Type() == GameMtl::STE_PC_SHADER) {
- EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE0_RATE_SPIN), onoff);
- EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE0_RATE_EDIT), onoff);
- EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE0_FRAMES_SPIN), onoff);
- EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE0_FRAMES_EDIT), onoff);
- EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE0_ANIM_COMBO), onoff);
- } else {
- EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE0_RATE_SPIN), FALSE);
- EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE0_RATE_EDIT), FALSE);
- EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE0_FRAMES_SPIN), FALSE);
- EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE0_FRAMES_EDIT), FALSE);
- EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE0_ANIM_COMBO), FALSE);
- }
-
- EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE0_PUBLISH_BUTTON),onoff);
- EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE0_CLAMP_U_BUTTON),onoff);
- EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE0_CLAMP_V_BUTTON),onoff);
- EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE0_NOLOD_BUTTON),onoff);
- EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE0_ALPHA_BITMAP_BUTTON),onoff);
- EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE0_DISPLAY_BUTTON),onoff);
- EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE0_HINT_COMBO),onoff);
-
- } else {
-
- EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE1_BUTTON),onoff);
- EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE1_RATE_SPIN),onoff);
- EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE1_RATE_EDIT),onoff);
- EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE1_FRAMES_SPIN),onoff);
- EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE1_FRAMES_EDIT),onoff);
- EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE1_PUBLISH_BUTTON),onoff);
- EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE1_CLAMP_U_BUTTON),onoff);
- EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE1_CLAMP_V_BUTTON),onoff);
- EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE1_NOLOD_BUTTON),onoff);
- EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE1_ALPHA_BITMAP_BUTTON),onoff);
- EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE1_DISPLAY_BUTTON),onoff);
- EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE1_ANIM_COMBO),onoff);
- EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE1_HINT_COMBO),onoff);
-
- }
-}
-
-
-/***********************************************************************************************
- * GameMtlTextureDlg::Update_Texture_Buttons -- update the texture buttons text *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/23/98 GTH : Created. *
- *=============================================================================================*/
-void GameMtlTextureDlg::Update_Texture_Buttons(void)
-{
- Texmap * texmap;
- texmap = TheMtl->Get_Texture(PassIndex,0);
- TSTR filename;
-
- if (texmap) {
- SplitPathFile(texmap->GetFullName(),NULL,&filename);
- SetDlgItemText(m_hWnd, IDC_STAGE0_BUTTON,filename);
- } else {
- SetDlgItemText(m_hWnd, IDC_STAGE0_BUTTON,Get_String(IDS_NONE));
- }
-
- texmap = TheMtl->Get_Texture(PassIndex,1);
- if (texmap) {
- SplitPathFile(texmap->GetFullName(),NULL,&filename);
- SetDlgItemText(m_hWnd, IDC_STAGE1_BUTTON,filename);
- } else {
- SetDlgItemText(m_hWnd, IDC_STAGE1_BUTTON,Get_String(IDS_NONE));
- }
-}
diff --git a/Generals/Code/Tools/WW3D/max2w3d/GameMtlTextureDlg.h b/Generals/Code/Tools/WW3D/max2w3d/GameMtlTextureDlg.h
deleted file mode 100644
index 42cea835088..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/GameMtlTextureDlg.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Max2W3d *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/GameMtlTextureDlg.h $*
- * *
- * Author:: Greg Hjelstrom *
- * *
- * $Modtime:: 8/14/00 1:47p $*
- * *
- * $Revision:: 8 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-
-
-#ifndef GAMEMTLTEXTUREDLG_H
-#define GAMEMTLTEXTUREDLG_H
-
-#include
-#include "GameMtlForm.h"
-
-class GameMtl;
-
-class GameMtlTextureDlg : public GameMtlFormClass
-{
-
-public:
-
- GameMtlTextureDlg(HWND parent, IMtlParams * imp, GameMtl * m, int pass);
- ~GameMtlTextureDlg(void);
-
- virtual BOOL Dialog_Proc (HWND dlg_wnd, UINT message, WPARAM wparam, LPARAM lparam);
- void ActivateDlg(BOOL onOff);
- void ReloadDialog(void);
-
-private:
-
- void Enable_Stage(int stage,BOOL onoff);
- void Update_Texture_Buttons(void);
-
- ISpinnerControl * Stage0FramesSpin;
- ISpinnerControl * Stage1FramesSpin;
-
- ISpinnerControl * Stage0RateSpin;
- ISpinnerControl * Stage1RateSpin;
-
- ICustButton * Stage0PublishButton;
- ICustButton * Stage1PublishButton;
- ICustButton * Stage0ClampUButton;
- ICustButton * Stage1ClampUButton;
- ICustButton * Stage0ClampVButton;
- ICustButton * Stage1ClampVButton;
- ICustButton * Stage0NoLODButton;
- ICustButton * Stage1NoLODButton;
- ICustButton * Stage0AlphaBitmapButton;
- ICustButton * Stage1AlphaBitmapButton;
- ICustButton * Stage0DisplayButton;
- ICustButton * Stage1DisplayButton;
-};
-
-
-
-
-#endif
-
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/GameMtlVertexMaterialDlg.cpp b/Generals/Code/Tools/WW3D/max2w3d/GameMtlVertexMaterialDlg.cpp
deleted file mode 100644
index 020173cf2fb..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/GameMtlVertexMaterialDlg.cpp
+++ /dev/null
@@ -1,392 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Max2W3d *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/GameMtlVertexMaterialDlg.cpp $*
- * *
- * Author:: Greg Hjelstrom *
- * *
- * $Modtime:: 7/10/00 3:37p $*
- * *
- * $Revision:: 12 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * GameMtlVertexMaterialDlg::GameMtlVertexMaterialDlg -- constructor *
- * GameMtlVertexMaterialDlg::~GameMtlVertexMaterialDlg -- destructor *
- * GameMtlVertexMaterialDlg::Dialog_Proc -- windows message handler *
- * GameMtlVertexMaterialDlg::ReloadDialog -- reload the contents of the controls *
- * GameMtlVertexMaterialDlg::ActivateDlg -- activate / deactivate this dialog *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#include "GameMtlVertexMaterialDlg.h"
-#include "gamemtl.h"
-#include "dllmain.h"
-#include "resource.h"
-
-
-/***********************************************************************************************
- * GameMtlVertexMaterialDlg::GameMtlVertexMaterialDlg -- constructor *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/23/98 GTH : Created. *
- *=============================================================================================*/
-GameMtlVertexMaterialDlg::GameMtlVertexMaterialDlg
-(
- HWND parent,
- IMtlParams * imp,
- GameMtl * mtl,
- int pass
-) :
- GameMtlFormClass(imp,mtl,pass)
-{
- AmbientSwatch = NULL;
- DiffuseSwatch = NULL;
- SpecularSwatch = NULL;
- EmissiveSwatch = NULL;
-
- OpacitySpin = NULL;
- TranslucencySpin = NULL;
- ShininessSpin = NULL;
-
- for (int i=0; iGet_Ambient(PassIndex,IParams->GetTime()),Get_String(IDS_AMBIENT_COLOR));
- DiffuseSwatch = GetIColorSwatch(GetDlgItem(dlg_wnd, IDC_DIFFUSE_COLOR),TheMtl->Get_Diffuse(PassIndex,IParams->GetTime()),Get_String(IDS_DIFFUSE_COLOR));
- SpecularSwatch = GetIColorSwatch(GetDlgItem(dlg_wnd, IDC_SPECULAR_COLOR),TheMtl->Get_Specular(PassIndex,IParams->GetTime()),Get_String(IDS_SPECULAR_COLOR));
- EmissiveSwatch = GetIColorSwatch(GetDlgItem(dlg_wnd, IDC_EMISSIVE_COLOR),TheMtl->Get_Emissive(PassIndex,IParams->GetTime()),Get_String(IDS_EMISSIVE_COLOR));
-
- OpacitySpin = SetupFloatSpinner(dlg_wnd,IDC_OPACITY_SPIN,IDC_OPACITY_EDIT,0.0f,1.0f,TheMtl->Get_Opacity(PassIndex,IParams->GetTime()),0.01f);
- TranslucencySpin = SetupFloatSpinner(dlg_wnd,IDC_TRANSLUCENCY_SPIN,IDC_TRANSULCENCY_EDIT,0.0f,1.0f,TheMtl->Get_Translucency(PassIndex,IParams->GetTime()),0.01f);
- ShininessSpin = SetupFloatSpinner(dlg_wnd,IDC_SHININESS_SPIN,IDC_SHININESS_EDIT,1.0f,1000.0f,TheMtl->Get_Shininess(PassIndex,IParams->GetTime()),1.0f);
- UVChannelSpin[0] = SetupIntSpinner(dlg_wnd,IDC_STAGE0UVCHAN_SPIN,IDC_STAGE0UVCHAN_EDIT,1,99,1);
- UVChannelSpin[1] = SetupIntSpinner(dlg_wnd,IDC_STAGE1UVCHAN_SPIN,IDC_STAGE1UVCHAN_EDIT,1,99,1);
- break;
- }
-
- case WM_LBUTTONDOWN:
- case WM_LBUTTONUP:
- case WM_MOUSEMOVE:
- {
- IParams->RollupMouseMessage(dlg_wnd,message,wparam,lparam);
- return FALSE;
- }
-
- case WM_COMMAND:
- {
- switch (id)
- {
- case IDC_COPY_SPECULAR_DIFFUSE:
- TheMtl->Set_Copy_Specular_To_Diffuse(PassIndex,GetCheckBox(dlg_wnd, IDC_COPY_SPECULAR_DIFFUSE) == TRUE);
- break;
-
- case IDC_MAPPING0_COMBO:
- if (code == CBN_SELCHANGE) {
- val = SendDlgItemMessage(dlg_wnd,IDC_MAPPING0_COMBO,CB_GETCURSEL,0,0);
- TheMtl->Set_Mapping_Type(PassIndex,0,val);
- }
- break;
-
- case IDC_MAPPING1_COMBO:
- if (code == CBN_SELCHANGE) {
- val = SendDlgItemMessage(dlg_wnd,IDC_MAPPING1_COMBO,CB_GETCURSEL,0,0);
- TheMtl->Set_Mapping_Type(PassIndex,1,val);
- }
- break;
-
- case IDC_MAPPING0_ARGS_EDIT:
- switch (code) {
- case EN_SETFOCUS:
- DisableAccelerators();
- break;
- case EN_KILLFOCUS:
- EnableAccelerators();
- break;
- case EN_CHANGE:
- int len = GetWindowTextLength(GetDlgItem(dlg_wnd, IDC_MAPPING0_ARGS_EDIT));
- char *buffer = TheMtl->Get_Mapping_Arg_Buffer(PassIndex, 0, len);
- GetWindowText(GetDlgItem(dlg_wnd, IDC_MAPPING0_ARGS_EDIT), buffer, len + 1);
- break;
- }
- break;
-
- case IDC_MAPPING1_ARGS_EDIT:
- switch (code) {
- case EN_SETFOCUS:
- DisableAccelerators();
- break;
- case EN_KILLFOCUS:
- EnableAccelerators();
- break;
- case EN_CHANGE:
- int len = GetWindowTextLength(GetDlgItem(dlg_wnd, IDC_MAPPING1_ARGS_EDIT));
- char *buffer = TheMtl->Get_Mapping_Arg_Buffer(PassIndex, 1, len);
- GetWindowText(GetDlgItem(dlg_wnd, IDC_MAPPING1_ARGS_EDIT), buffer, len + 1);
- break;
- }
- break;
-
- case IDC_NO_TRANS:
- TheMtl->Set_PSX_Translucency(PassIndex,GAMEMTL_PSX_TRANS_NONE);
- break;
-
- case IDC_100_TRANS:
- TheMtl->Set_PSX_Translucency(PassIndex,GAMEMTL_PSX_TRANS_100);
- break;
-
- case IDC_50_TRANS:
- TheMtl->Set_PSX_Translucency(PassIndex,GAMEMTL_PSX_TRANS_50);
- break;
-
- case IDC_25_TRANS:
- TheMtl->Set_PSX_Translucency(PassIndex,GAMEMTL_PSX_TRANS_25);
- break;
-
- case IDC_MINUS_100_TRANS:
- TheMtl->Set_PSX_Translucency(PassIndex,GAMEMTL_PSX_TRANS_MINUS_100);
- break;
-
- case IDC_NO_RT_LIGHTING:
- TheMtl->Set_PSX_Lighting(PassIndex,!GetCheckBox(dlg_wnd, IDC_NO_RT_LIGHTING));
- break;
- }
- break;
- }
-
- case CC_COLOR_CHANGE:
- {
- // just update all of the colors
- TheMtl->Set_Ambient(PassIndex,IParams->GetTime(),AmbientSwatch->GetColor());
- TheMtl->Set_Diffuse(PassIndex,IParams->GetTime(),DiffuseSwatch->GetColor());
- TheMtl->Set_Specular(PassIndex,IParams->GetTime(),SpecularSwatch->GetColor());
- TheMtl->Set_Emissive(PassIndex,IParams->GetTime(),EmissiveSwatch->GetColor());
- TheMtl->Notify_Changed();
- break;
- }
-
- case CC_SPINNER_CHANGE:
- {
- TheMtl->Set_Shininess(PassIndex,IParams->GetTime(),ShininessSpin->GetFVal());
- TheMtl->Set_Opacity(PassIndex,IParams->GetTime(),OpacitySpin->GetFVal());
- TheMtl->Set_Translucency(PassIndex,IParams->GetTime(),TranslucencySpin->GetFVal());
- for (int i=0; iSet_Map_Channel(PassIndex,i,UVChannelSpin[i]->GetIVal());
- }
- break;
- }
-
- case CC_SPINNER_BUTTONUP:
- {
- TheMtl->Notify_Changed();
- break;
- }
-
- }
- return FALSE;
-}
-
-
-/***********************************************************************************************
- * GameMtlVertexMaterialDlg::ReloadDialog -- reload the contents of the controls *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/23/98 GTH : Created. *
- *=============================================================================================*/
-void GameMtlVertexMaterialDlg::ReloadDialog(void)
-{
- // Vertex Material Controls
- DebugPrint("GameMtlVertexMaterialDlg::ReloadDialog\n");
- assert(AmbientSwatch && DiffuseSwatch && SpecularSwatch && EmissiveSwatch);
- assert(ShininessSpin && OpacitySpin && TranslucencySpin);
-
- AmbientSwatch->InitColor(TheMtl->Get_Ambient(PassIndex,IParams->GetTime()));
- DiffuseSwatch->InitColor(TheMtl->Get_Diffuse(PassIndex,IParams->GetTime()));
- SpecularSwatch->InitColor(TheMtl->Get_Specular(PassIndex,IParams->GetTime()));
- EmissiveSwatch->InitColor(TheMtl->Get_Emissive(PassIndex,IParams->GetTime()));
-
- ShininessSpin->SetValue(TheMtl->Get_Shininess(PassIndex,IParams->GetTime()),FALSE);
- OpacitySpin->SetValue(TheMtl->Get_Opacity(PassIndex,IParams->GetTime()),FALSE);
- TranslucencySpin->SetValue(TheMtl->Get_Translucency(PassIndex,IParams->GetTime()),FALSE);
- for (int i=0; iSetValue(TheMtl->Get_Map_Channel(PassIndex,i),FALSE);
- }
-
- SetCheckBox(m_hWnd,IDC_COPY_SPECULAR_DIFFUSE, TheMtl->Get_Copy_Specular_To_Diffuse(PassIndex));
-
- SendDlgItemMessage( m_hWnd,
- IDC_MAPPING0_COMBO,
- CB_SETCURSEL,
- TheMtl->Get_Mapping_Type(PassIndex, 0),
- 0 );
-
- SendDlgItemMessage( m_hWnd,
- IDC_MAPPING1_COMBO,
- CB_SETCURSEL,
- TheMtl->Get_Mapping_Type(PassIndex, 1),
- 0 );
-
- // PSX Controls
- SetCheckBox(m_hWnd,IDC_NO_RT_LIGHTING, !TheMtl->Get_PSX_Lighting(PassIndex));
- SetCheckBox(m_hWnd,IDC_NO_TRANS, false);
- SetCheckBox(m_hWnd,IDC_100_TRANS, false);
- SetCheckBox(m_hWnd,IDC_50_TRANS, false);
- SetCheckBox(m_hWnd,IDC_25_TRANS, false);
- SetCheckBox(m_hWnd,IDC_MINUS_100_TRANS, false);
-
- switch (TheMtl->Get_PSX_Translucency(PassIndex)) {
- case 0:
- SetCheckBox(m_hWnd,IDC_NO_TRANS,true);
- break;
- case GAMEMTL_PSX_TRANS_100:
- SetCheckBox(m_hWnd,IDC_100_TRANS,true);
- break;
- case GAMEMTL_PSX_TRANS_50:
- SetCheckBox(m_hWnd,IDC_50_TRANS,true);
- break;
- case GAMEMTL_PSX_TRANS_25:
- SetCheckBox(m_hWnd,IDC_25_TRANS,true);
- break;
- case GAMEMTL_PSX_TRANS_MINUS_100:
- SetCheckBox(m_hWnd,IDC_MINUS_100_TRANS,true);
- break;
- }
-
- // Reload contents of mapper args edit box:
- char *buffer = TheMtl->Get_Mapping_Arg_Buffer(PassIndex, 0);
- SetWindowText(GetDlgItem(m_hWnd, IDC_MAPPING0_ARGS_EDIT), buffer);
- buffer = TheMtl->Get_Mapping_Arg_Buffer(PassIndex, 1);
- SetWindowText(GetDlgItem(m_hWnd, IDC_MAPPING1_ARGS_EDIT), buffer);
-}
-
-
-/***********************************************************************************************
- * GameMtlVertexMaterialDlg::ActivateDlg -- activate / deactivate this dialog *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 11/23/98 GTH : Created. *
- *=============================================================================================*/
-void GameMtlVertexMaterialDlg::ActivateDlg(BOOL onoff)
-{
- if (AmbientSwatch) {
- AmbientSwatch->Activate(onoff);
- }
- if (DiffuseSwatch) {
- DiffuseSwatch->Activate(onoff);
- }
- if (SpecularSwatch) {
- SpecularSwatch->Activate(onoff);
- }
- if (EmissiveSwatch) {
- EmissiveSwatch->Activate(onoff);
- }
-}
diff --git a/Generals/Code/Tools/WW3D/max2w3d/GameMtlVertexMaterialDlg.h b/Generals/Code/Tools/WW3D/max2w3d/GameMtlVertexMaterialDlg.h
deleted file mode 100644
index 3c9fefc4423..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/GameMtlVertexMaterialDlg.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Max2W3d *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/GameMtlVertexMaterialDlg.h $*
- * *
- * Author:: Greg Hjelstrom *
- * *
- * $Modtime:: 5/30/00 12:08p $*
- * *
- * $Revision:: 4 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-
-#ifndef GAMEMTLVERTEXMATERIALDLG_H
-#define GAMEMTLVERTEXMATERIALDLG_H
-
-#include
-#include "GameMtlForm.h"
-
-class GameMtl;
-
-class GameMtlVertexMaterialDlg : public GameMtlFormClass
-{
-
-public:
-
- GameMtlVertexMaterialDlg(HWND parent, IMtlParams * imp, GameMtl * m, int pass);
- ~GameMtlVertexMaterialDlg();
-
- virtual BOOL Dialog_Proc (HWND dlg_wnd, UINT message, WPARAM wparam, LPARAM lparam);
-
- void ActivateDlg(BOOL onoff);
- void ReloadDialog(void);
-
-private:
-
- enum { MAX_STAGES = 2 };
-
- IColorSwatch * AmbientSwatch;
- IColorSwatch * DiffuseSwatch;
- IColorSwatch * SpecularSwatch;
- IColorSwatch * EmissiveSwatch;
-
- ISpinnerControl * OpacitySpin;
- ISpinnerControl * TranslucencySpin;
- ISpinnerControl * ShininessSpin;
- ISpinnerControl * UVChannelSpin[MAX_STAGES];
-};
-
-
-#endif
\ No newline at end of file
diff --git a/Generals/Code/Tools/WW3D/max2w3d/InputDlg.cpp b/Generals/Code/Tools/WW3D/max2w3d/InputDlg.cpp
deleted file mode 100644
index 22cea6d20f5..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/InputDlg.cpp
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : G *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/InputDlg.cpp $*
- * *
- * $Author:: Andre_a $*
- * *
- * $Modtime:: 5/08/00 1:58p $*
- * *
- * $Revision:: 1 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-
-// InputDlg.cpp : implementation file
-//
-
-#include "InputDlg.h"
-#include
-
-
-static BOOL CALLBACK _thunk_dialog_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
-
-
-/////////////////////////////////////////////////////////////////////////////
-// InputDlg dialog
-
-
-InputDlg::InputDlg (HWND hWndParent)
-: m_hWndParent(hWndParent),
- m_hWnd(NULL)
-{
- // Set the strings to default values.
- SetCaption("Input Value...");
- SetLabel("Please enter a value:");
- SetValue(NULL);
-}
-
-
-/////////////////////////////////////////////////////////////////////////////
-// InputDlg Methods
-
-int InputDlg::DoModal (void)
-{
- // Put up the dialog box.
- BOOL result = DialogBoxParam(AppInstance, MAKEINTRESOURCE(IDD),
- m_hWndParent, (DLGPROC)_thunk_dialog_proc,
- (LPARAM)this);
-
- // Return IDOK if the user accepted the new settings.
- return (result == 1) ? IDOK : IDCANCEL;
-}
-
-void InputDlg::SetCaption (const char *caption)
-{
- if (caption)
- {
- assert(strlen(caption) < sizeof(m_Caption));
- strcpy(m_Caption, caption);
- }
- else
- m_Caption[0] = '\0';
-}
-
-void InputDlg::SetLabel (const char *label)
-{
- if (label)
- {
- assert(strlen(label) < sizeof(m_Label));
- strcpy(m_Label, label);
- }
- else
- m_Label[0] = '\0';
-}
-
-void InputDlg::SetValue (const char *value)
-{
- if (value)
- {
- assert(strlen(value) < sizeof(m_Value));
- strcpy(m_Value, value);
- }
- else
- m_Value[0] = '\0';
-}
-
-
-/////////////////////////////////////////////////////////////////////////////
-// InputDlg DialogProc
-
-BOOL CALLBACK _thunk_dialog_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
- static InputDlg *dialog = NULL;
-
- if (uMsg == WM_INITDIALOG)
- {
- dialog = (InputDlg*)lParam;
- dialog->m_hWnd = hWnd;
- }
-
- if (dialog)
- return dialog->DialogProc(hWnd, uMsg, wParam, lParam);
- else
- return 0;
-}
-
-BOOL CALLBACK InputDlg::DialogProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
- int code = HIWORD(wParam);
-
- switch (uMsg)
- {
- /*******************************************************************
- * WM_INITDIALOG
- *
- * Initialize all of the custom controls for the dialog box
- *
- *******************************************************************/
- case WM_INITDIALOG:
-
- OnInitDialog(wParam, lParam);
- return TRUE;
-
-
- /*******************************************************************
- * WM_COMMAND
- *
- *
- *******************************************************************/
- case WM_COMMAND:
-
- switch (LOWORD(wParam))
- {
- case IDOK:
- if (!OnOK())
- return TRUE;
-
- SetCursor(LoadCursor(NULL, IDC_WAIT));
- EndDialog(m_hWnd, 1);
- break;
-
- case IDCANCEL:
- EndDialog(m_hWnd, 0);
- break;
- }
- return TRUE;
- }
-
- return FALSE;
-}
-
-/////////////////////////////////////////////////////////////////////////////
-// InputDlg message handlers
-
-LRESULT InputDlg::OnInitDialog (WPARAM wParam, LPARAM lParam)
-{
- // Set the cursor to the normal arrow.
- SetCursor(LoadCursor(NULL, IDC_ARROW));
-
- // Set the dialog box caption.
- SetWindowText(m_hWnd, m_Caption);
-
- // Set the label text.
- HWND hLabel = GetDlgItem(m_hWnd, IDC_LABEL);
- assert(hLabel != NULL);
- SetWindowText(hLabel, m_Label);
-
- // Set the default value.
- HWND hEdit = GetDlgItem(m_hWnd, IDC_VALUE);
- assert(hEdit != NULL);
- SetWindowText(hEdit, m_Value);
-
- // Select all of the text in the edit box.
- SendMessage(hEdit, EM_SETSEL, 0, -1);
-
- return 0;
-}
-
-BOOL InputDlg::OnOK (void)
-{
- // Update our copy of what the user typed.
- HWND hEdit = GetDlgItem(m_hWnd, IDC_VALUE);
- assert(hEdit != NULL);
- GetWindowText(hEdit, m_Value, sizeof(m_Value));
-
- // The dialog can be dismissed.
- return TRUE;
-}
diff --git a/Generals/Code/Tools/WW3D/max2w3d/InputDlg.h b/Generals/Code/Tools/WW3D/max2w3d/InputDlg.h
deleted file mode 100644
index bbe02e2106e..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/InputDlg.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : G *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/InputDlg.h $*
- * *
- * $Author:: Andre_a $*
- * *
- * $Modtime:: 5/08/00 1:36p $*
- * *
- * $Revision:: 1 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-
-#ifndef INPUTDLG_H
-#define INPUTDLG_H
-
-#include "dllmain.h"
-#include "resource.h"
-
-
-/////////////////////////////////////////////////////////////////////////////
-// InputDlg dialog - a generic input box for MAXScript
-
-class InputDlg
-{
- friend BOOL CALLBACK _thunk_dialog_proc (HWND, UINT, WPARAM, LPARAM);
-
-public:
-
- // Construction
- InputDlg (HWND hWndParent=NULL);
-
- // Methods
- int DoModal (void); // returns IDOK or IDCANCEL
-
- void SetCaption (const char *caption);
- void SetLabel (const char *label);
- void SetValue (const char *value);
-
- // DialogProc
- BOOL CALLBACK DialogProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
-
- // Dialog data associated with GUI components.
- char m_Value[1024]; // edit box
- char m_Label[512]; // description label
- char m_Caption[128]; // dialog caption
-
-protected:
-
- // Dialog data
- enum { IDD = IDD_INPUT_DIALOG };
- HWND m_hWnd;
- HWND m_hWndParent;
-
- // Message Handlers
- LRESULT OnInitDialog (WPARAM wParam, LPARAM lParam);
- BOOL OnOK (void);
-};
-
-
-#endif
diff --git a/Generals/Code/Tools/WW3D/max2w3d/LightGlareSave.cpp b/Generals/Code/Tools/WW3D/max2w3d/LightGlareSave.cpp
deleted file mode 100644
index 945f44b852c..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/LightGlareSave.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Max2W3D *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/LightGlareSave.cpp $*
- * *
- * Original Author:: Greg Hjelstrom *
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 8/06/00 11:21a $*
- * *
- * $Revision:: 2 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#include "LightGlareSave.h"
-#include "w3d_file.h"
-#include "util.h"
-#include "w3dappdata.h"
-#include "errclass.h"
-
-
-LightGlareSaveClass::LightGlareSaveClass
-(
- char * mesh_name,
- char * container_name,
- INode * inode,
- Matrix3 & exportspace,
- TimeValue curtime,
- Progress_Meter_Class & meter
-)
-{
- //////////////////////////////////////////////////////////////////////
- // Init the glare info
- //////////////////////////////////////////////////////////////////////
- memset(&GlareData,0,sizeof(GlareData));
-
- //////////////////////////////////////////////////////////////////////
- // Get the position of the pivot point relative to the given
- // export coordinate system.
- //////////////////////////////////////////////////////////////////////
-
- // Transform the mesh into the desired coordinate system
- Matrix3 node_matrix = inode->GetObjectTM(curtime);
- Matrix3 offset_matrix = node_matrix * Inverse(exportspace);
-
- GlareData.Position.X = offset_matrix.GetTrans().x;
- GlareData.Position.Y = offset_matrix.GetTrans().y;
- GlareData.Position.Z = offset_matrix.GetTrans().z;
-}
-
-
-
-int LightGlareSaveClass::Write_To_File(ChunkSaveClass & csave)
-{
- csave.Begin_Chunk(W3D_CHUNK_LIGHTGLARE);
- csave.Begin_Chunk(W3D_CHUNK_LIGHTGLARE_INFO);
- csave.Write(&GlareData,sizeof(GlareData));
- csave.End_Chunk();
- csave.End_Chunk();
- return 0;
-}
-
-
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/LightGlareSave.h b/Generals/Code/Tools/WW3D/max2w3d/LightGlareSave.h
deleted file mode 100644
index a1752ca6ce1..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/LightGlareSave.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Max2W3D *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/LightGlareSave.h $*
- * *
- * Original Author:: Greg Hjelstrom *
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 8/05/00 10:27a $*
- * *
- * $Revision:: 1 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#if defined(_MSC_VER)
-#pragma once
-#endif
-
-#ifndef LIGHTGLARESAVE_H
-#define LIGHTGLARESAVE_H
-
-#include
-#include "w3d_file.h"
-#include "chunkio.h"
-#include "PROGRESS.H"
-
-
-/*******************************************************************************************
-**
-** LightGlareSaveClass - Create a Light Glare definition from a Max mesh. In the initial
-** implementation, all I need to save is the point at the pivot of the mesh.
-**
-*******************************************************************************************/
-class LightGlareSaveClass
-{
-public:
-
- enum {
- EX_UNKNOWN = 0, // exception error codes
- EX_CANCEL = 1
- };
-
- LightGlareSaveClass( char * mesh_name,
- char * container_name,
- INode * inode,
- Matrix3 & exportspace,
- TimeValue curtime,
- Progress_Meter_Class & meter);
-
- int Write_To_File(ChunkSaveClass & csave);
-
-private:
-
- W3dLightGlareStruct GlareData;
-
-};
-
-
-
-#endif
\ No newline at end of file
diff --git a/Generals/Code/Tools/WW3D/max2w3d/MeshDeform.cpp b/Generals/Code/Tools/WW3D/max2w3d/MeshDeform.cpp
deleted file mode 100644
index 0b30edadd3c..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/MeshDeform.cpp
+++ /dev/null
@@ -1,1446 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/* $Header: /Commando/Code/Tools/max2w3d/MeshDeform.cpp 7 5/01/01 8:56p Greg_h $ */
-/***********************************************************************************************
- *** Confidential - Westwood Studios ***
- ***********************************************************************************************
- * *
- * Project Name : Commando / G 3D engine *
- * *
- * File Name : MeshDeform.cpp *
- * *
- * Programmer : Patrick Smith *
- * *
- * Start Date : 04/19/99 *
- * *
- * Last Update :
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#include "MeshDeform.h"
-#include "MeshDeformData.h"
-#include "MeshDeformPanel.h"
-#include "MeshDeformUndo.h"
-#include "dllmain.h"
-#include "resource.h"
-#include "util.h"
-
-#if defined W3D_MAX4 //defined as in the project (.dsp)
-static GenSubObjType _SubObjectTypeVertex(1);
-#endif
-
-///////////////////////////////////////////////////////////////////////////
-//
-// MeshDeformClass Class ID
-//
-///////////////////////////////////////////////////////////////////////////
-Class_ID _MeshDeformClassID(0x51981f5b, 0x1db2bf3);
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// MeshDeformClassDesc
-//
-///////////////////////////////////////////////////////////////////////////
-class MeshDeformClassDesc : public ClassDesc
-{
- public:
- int IsPublic (void) { return 1; }
- void * Create (BOOL loading) { return new MeshDeformClass (); }
- const TCHAR * ClassName () { return _T("WWDeform"); }
- SClass_ID SuperClassID () { return OSM_CLASS_ID; }
- Class_ID ClassID () { return _MeshDeformClassID; }
- const TCHAR* Category () { return _T("Westwood Modifiers"); }
-};
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Static class desc instance
-//
-///////////////////////////////////////////////////////////////////////////
-#if 0 // (gth) MeshDeform is obsolete! making sure nobody uses it...
-static MeshDeformClassDesc _MeshDeformCD;
-ClassDesc * Get_Mesh_Deform_Desc (void) { return &_MeshDeformCD; }
-#else
-ClassDesc * Get_Mesh_Deform_Desc (void) { return NULL; }
-#endif
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// ChannelsUsed
-//
-///////////////////////////////////////////////////////////////////////////
-ChannelMask
-MeshDeformClass::ChannelsUsed (void)
-{
- return GEOM_CHANNEL | SELECT_CHANNEL | SUBSEL_TYPE_CHANNEL | VERTCOLOR_CHANNEL;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// ChannelsChanged
-//
-///////////////////////////////////////////////////////////////////////////
-ChannelMask
-MeshDeformClass::ChannelsChanged (void)
-{
- return GEOM_CHANNEL | SELECT_CHANNEL | SUBSEL_TYPE_CHANNEL | VERTCOLOR_CHANNEL;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// ModifyObject
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformClass::ModifyObject
-(
- TimeValue time,
- ModContext & mod_context,
- ObjectState * object_state,
- INode * /*node*/
-)
-{
- assert(object_state->obj->IsSubClassOf(triObjectClassID));
-
-
- MeshDeformModData *mod_data = NULL;
- if (mod_context.localData == NULL) {
- mod_data = new MeshDeformModData;
- mod_context.localData = mod_data;
- } else {
- mod_data = static_cast (mod_context.localData);
- }
-
- // Display the verts
- TriObject *tri_obj = (TriObject *)object_state->obj;
- tri_obj->mesh.SetDispFlag (DISP_SELVERTS | DISP_VERTTICKS);
-
- // Record the initial state of the mesh
- bool lock_sets = false;
- if (m_pPanel != NULL) {
- lock_sets = (m_pPanel->Are_Sets_Tied () == TRUE);
- }
- mod_data->Record_Mesh_State (*tri_obj, m_DeformState, lock_sets);
-
- tri_obj->PointsWereChanged();
-
- // Kind of a waste when there's no animation...
- tri_obj->UpdateValidity (GEOM_CHAN_NUM, Interval (time, time + 1));
- tri_obj->UpdateValidity (SELECT_CHAN_NUM, Interval (time, time + 1));
- tri_obj->UpdateValidity (SUBSEL_TYPE_CHAN_NUM, Interval (time, time + 1));
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// InputType
-//
-///////////////////////////////////////////////////////////////////////////
-Class_ID
-MeshDeformClass::InputType (void)
-{
- return triObjectClassID;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// NotifyRefChanged
-//
-///////////////////////////////////////////////////////////////////////////
-RefResult
-MeshDeformClass::NotifyRefChanged
-(
- Interval time,
- RefTargetHandle htarget,
- PartID &part_id,
- RefMessage mesage
-)
-{
- return REF_SUCCEED;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// GetCreateMouseCallBack
-//
-///////////////////////////////////////////////////////////////////////////
-CreateMouseCallBack *
-MeshDeformClass::GetCreateMouseCallBack (void)
-{
- return NULL;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// BeginEditParams
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformClass::BeginEditParams
-(
- IObjParam *max_interface,
- ULONG flags,
- Animatable *prev
-)
-{
- m_MaxInterface = max_interface;
- Update_Set_Count ();
- Set_Max_Deform_Sets (m_MaxSets);
-
- // Add our rollup to the command panel
- m_hRollupWnd = m_MaxInterface->AddRollupPage (AppInstance,
- MAKEINTRESOURCE (IDD_MESH_DEFORM_PANEL),
- MeshDeformPanelClass::Message_Proc,
- "Westwood Mesh Deform",
- 0,
- 0);
-
- //
- // Update the UI
- //
- m_pPanel = MeshDeformPanelClass::Get_Object (m_hRollupWnd);
- m_pPanel->Set_Deformer (this);
- m_pPanel->Set_Max_Sets (m_MaxSets);
- m_pPanel->Set_Current_Set (m_CurrentSet);
- Set_Current_Set (m_CurrentSet, false);
-
- //
- // Register the desired sub-object selection types.
- //
- const TCHAR * ptype[] = { "Vertices" };
-#if defined W3D_MAX4 //defined as in the project (.dsp)
- max_interface->SetSubObjectLevel(1);
-#else
- //---This call is obsolete from max4.
- max_interface->RegisterSubObjectTypes( ptype, 1);
-#endif
-
- //
- // Create the mode handlers
- //
- m_ModeSelect = new SelectModBoxCMode (this, max_interface);
- m_ModeMove = new MoveModBoxCMode (this, max_interface);
- m_ModeRotate = new RotateModBoxCMode (this, max_interface);
- m_ModeUScale = new UScaleModBoxCMode (this, max_interface);
- m_ModeNUScale = new NUScaleModBoxCMode (this, max_interface);
- m_ModeSquash = new SquashModBoxCMode (this, max_interface);
-
- //
- // Restore the selection level.
- ///
- max_interface->SetSubObjectLevel (1);
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// EndEditParams
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformClass::EndEditParams
-(
- IObjParam *max_interface,
- ULONG flags,
- Animatable *next
-)
-{
- // Remove our deform rollup
- if (m_hRollupWnd != NULL) {
- max_interface->DeleteRollupPage (m_hRollupWnd);
- m_hRollupWnd = NULL;
- }
-
- //
- // Free the mode handlers
- //
- max_interface->DeleteMode (m_ModeMove);
- max_interface->DeleteMode (m_ModeSelect);
- max_interface->DeleteMode (m_ModeRotate);
- max_interface->DeleteMode (m_ModeNUScale);
- max_interface->DeleteMode (m_ModeUScale);
- max_interface->DeleteMode (m_ModeSquash);
- SAFE_DELETE (m_ModeMove);
- SAFE_DELETE (m_ModeSelect);
- SAFE_DELETE (m_ModeRotate);
- SAFE_DELETE (m_ModeNUScale);
- SAFE_DELETE (m_ModeUScale);
- SAFE_DELETE (m_ModeSquash);
-
- // Release our hold on the max interface pointer
- m_MaxInterface = NULL;
- m_pPanel = NULL;
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// ActivateSubobjSel
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformClass::ActivateSubobjSel
-(
- int level,
- XFormModes &modes
-)
-{
- switch (level)
- {
- // Vertex manipulation
- case 1:
- modes = XFormModes (m_ModeMove, m_ModeRotate, m_ModeNUScale, m_ModeUScale, m_ModeSquash, m_ModeSelect);
- break;
- }
-
- /*
- ** Notify our dependents that the subselection type,
- ** and the display have changed
- */
- NotifyDependents(FOREVER, PART_SUBSEL_TYPE|PART_DISPLAY, REFMSG_CHANGE);
-
- /*
- ** Notify the pipeline that the selection level has changed.
- */
- m_MaxInterface->PipeSelLevelChanged();
-
- /*
- ** Notify our dependents that the selection channel,
- ** display attributes, and subselection type channels have changed
- */
- NotifyDependents(FOREVER, VERTCOLOR_CHANNEL|SELECT_CHANNEL|DISP_ATTRIB_CHANNEL|SUBSEL_TYPE_CHANNEL, REFMSG_CHANGE);
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// HitTest
-//
-///////////////////////////////////////////////////////////////////////////
-int
-MeshDeformClass::HitTest
-(
- TimeValue time_value,
- INode * node,
- int type,
- int crossing,
- int flags,
- IPoint2 * point,
- ViewExp * viewport,
- ModContext * mod_context
-)
-{
- // Initialize the HitRegion
- HitRegion hit_rgn;
- MakeHitRegion (hit_rgn, type, crossing, 4, point);
-
- Matrix3 transform = node->GetObjectTM (time_value);
- Object * obj = node->EvalWorldState(time_value).obj;
- TriObject * tri = (TriObject *)obj->ConvertToType(time_value, triObjectClassID);
-
- //
- // Set up the graphics window to do the hit-test
- //
- GraphicsWindow *graphics_wnd = viewport->getGW ();
- graphics_wnd->setHitRegion (&hit_rgn);
- graphics_wnd->setTransform (transform);
-
- int saved_limits = graphics_wnd->getRndLimits ();
- graphics_wnd->setRndLimits ((saved_limits | GW_PICK) & ~(GW_ILLUM | GW_BACKCULL));
- graphics_wnd->clearHitCode ();
-
- //
- // Perform the hit test
- //
- SubObjHitList hitlist;
- MeshDeformModData *mod_data = static_cast (mod_context->localData);
- Mesh &mesh = tri->mesh;//mod_data->Peek_Mesh ();
- int result = mesh.SubObjectHitTest (graphics_wnd,
- graphics_wnd->getMaterial (),
- &hit_rgn,
- flags | SUBHIT_VERTS,
- hitlist);
-
- //
- // Record all of the hits
- //
- for (MeshSubHitRec *hit_record = hitlist.First ();
- hit_record != NULL;
- hit_record = hit_record->Next ()) {
-
- // rec->index is the index of vertex which was hit!
- viewport->LogHit (node, mod_context, hit_record->dist, hit_record->index, NULL);
- }
-
- // Cleanup
- graphics_wnd->setRndLimits (saved_limits);
-
- // Return the integer result code
- return result;
-}
-
-///////////////////////////////////////////////////////////////////////////
-//
-// HitTest
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformClass::SelectSubComponent
-(
- HitRecord * hit_record,
- BOOL selected,
- BOOL all,
- BOOL invert
-)
-{
- // Loop through all the hit records
- for (; hit_record != NULL; hit_record = hit_record->Next ()) {
-
- // Peek at the vertex selection array for this hit record
- MeshDeformModData *mod_data = static_cast (hit_record->modContext->localData);
- Mesh *mesh = mod_data->Peek_Mesh ();
- BitArray &array = (mesh->vertSel);
-
- if (all & invert) {
-
- /*
- ** hitRec->hitInfo is the MeshSubHitRec::index that was stored in the
- ** HitTest method through LogHit
- */
- if (array[hit_record->hitInfo]) {
- array.Clear (hit_record->hitInfo);
- } else {
- array.Set (hit_record->hitInfo, selected);
- }
- } else {
- array.Set (hit_record->hitInfo, selected);
- }
-
- if (!all) break;
- }
-
- m_pPanel->Update_Vertex_Color ();
- NotifyDependents (FOREVER, PART_SELECT, REFMSG_CHANGE);
- m_bSetDirty = true;
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// GetSubObjectTMs
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformClass::GetSubObjectTMs
-(
- SubObjAxisCallback *cb,
- TimeValue t,
- INode *node,
- ModContext *mc
-)
-{
- int test = 0;
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// HitTest
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformClass::GetSubObjectCenters
-(
- SubObjAxisCallback * callback,
- TimeValue time_val,
- INode * node,
- ModContext * mod_context
-)
-{
- // Peek at the vertex selection array for this hit record
- MeshDeformModData *mod_data = static_cast (mod_context->localData);
- const Point3 *vertex_array = mod_data->Peek_Orig_Vertex_Array ();
- Mesh *mesh = mod_data->Peek_Mesh ();
-
- BitArray sel_array = mesh->vertSel;
- Matrix3 transform = node->GetObjectTM (time_val);
- Box3 box;
-
- // Loop through all the selected verticies and create a bounding
- // box which we can use to determine the selection center.
- for (int index = 0; index < mesh->getNumVerts (); index++ ) {
- if (sel_array[index]) {
- box += mesh->getVert (index) * transform;
- }
- }
-
- // Pass the 'selection' center onto MAX
- callback->Center (box.Center (), 0);
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// ClearSelection
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformClass::ClearSelection (int selLevel)
-{
- ModContextList mod_context_list;
- INodeTab nodes;
- m_MaxInterface->GetModContexts (mod_context_list, nodes);
-
- for (int i = 0; i < mod_context_list.Count (); i++) {
-
- MeshDeformModData *mod_data = static_cast (mod_context_list[i]->localData);
-
- if (mod_data != NULL) {
- mod_data->Peek_Mesh ()->vertSel.ClearAll ();
- }
- }
-
- /*
- ** Get rid of the temporary copies of the INodes.
- */
- nodes.DisposeTemporary ();
-
- /*
- ** Tell our dependents that the selection set has changed
- */
- NotifyDependents (FOREVER, PART_SELECT, REFMSG_CHANGE);
- m_bSetDirty = true;
- return ;
-}
-
-static Point3 last_delta;
-static Point3 last_scale;
-static Matrix3 last_rot;
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Move
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformClass::Move
-(
- TimeValue time_val,
- Matrix3 & parent_tm,
- Matrix3 & tm_axis,
- Point3 & displacement,
- BOOL local_origin
-)
-{
- if (m_pPanel->Is_Edit_Mode ()) {
-
- INodeTab nodes;
- ModContextList mod_context_list;
- m_MaxInterface->GetModContexts (mod_context_list, nodes);
-
- // Loop through all the modifier contexts
- for (int index = 0; index < mod_context_list.Count (); index ++) {
-
- // Get the data we've cached for this modifier context
- MeshDeformModData *mod_data = static_cast (mod_context_list[index]->localData);
- if (mod_data != NULL) {
- Mesh *mesh = mod_data->Peek_Mesh ();
- const Point3 *vertex_array = mod_data->Peek_Orig_Vertex_Array ();
- Point3 *opstart_array = mod_data->Peek_Vertex_OPStart_Array ();
-
- // Loop through all the selected verts
- for (int vert = 0; vert < mesh->numVerts; vert ++) {
- if (mesh->vertSel[vert]) {
-
- // Do the 'displacment' in axis-space
- Point3 vert_ws = parent_tm * mesh->verts[vert];
- Point3 vert_as = Inverse (tm_axis) * vert_ws;
- vert_as += displacement - last_delta;
-
- // Convert back to obj-space
- vert_ws = tm_axis * vert_as;
- mesh->verts[vert] = Inverse (parent_tm) * vert_ws;
-
- // Record the delta
- //delta_array[vert] = mesh->verts[vert] - vertex_array[vert];
- }
- }
-
- //
- // Record these changes in the current set
- //
- mod_data->Update_Set (m_CurrentSet, VERT_POSITION);
- }
- }
-
- // Remember what our last displacement was because we
- // want to perform our calculations relative to the current
- // position.
- last_delta = displacement;
-
- // Repaint the view
- nodes.DisposeTemporary ();
- NotifyDependents (FOREVER, PART_GEOM, REFMSG_CHANGE);
- }
-
- m_OperationName = "Move";
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Move
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformClass::Scale
-(
- TimeValue time_val,
- Matrix3 & parent_tm,
- Matrix3 & tm_axis,
- Point3 & value,
- BOOL local_origin
-)
-{
- Point3 test = value - last_scale;
- bool bok = (test.x != 0) && (test.y != 0) && (test.z != 0);
- if (m_pPanel->Is_Edit_Mode () && bok) {
-
- INodeTab nodes;
- ModContextList mod_context_list;
- m_MaxInterface->GetModContexts (mod_context_list, nodes);
-
- // Loop through all the modifier contexts
- for (int index = 0; index < mod_context_list.Count (); index ++) {
-
- // Get the data we've cached for this modifier context
- MeshDeformModData *mod_data = static_cast (mod_context_list[index]->localData);
- if (mod_data != NULL) {
- Mesh *mesh = mod_data->Peek_Mesh ();
- const Point3 *vertex_array = mod_data->Peek_Orig_Vertex_Array ();
- Point3 *opstart_array = mod_data->Peek_Vertex_OPStart_Array ();
-
- // Loop through all the selected verts
- for (int vert = 0; vert < mesh->numVerts; vert ++) {
- if (mesh->vertSel[vert]) {
-
- // Do the 'scale' in axis-space
- Point3 vert_ws = parent_tm * opstart_array[vert];//mesh->verts[vert];
- Point3 vert_as = Inverse (tm_axis) * vert_ws;
- vert_as = ScaleMatrix (value) * vert_as;
-
- // Convert back to obj-space
- vert_ws = tm_axis * vert_as;
- mesh->verts[vert] = Inverse (parent_tm) * vert_ws;
-
- // Record the delta
- //delta_array[vert] = mesh->verts[vert] - vertex_array[vert];
- }
- }
-
- //
- // Record these changes in the current set
- //
- mod_data->Update_Set (m_CurrentSet, VERT_POSITION);
- }
- }
-
- // Remember what our last displacement was because we
- // want to perform our calculations relative to the current
- // position.
- //last_scale = value - Point3 (1,1,1);
- //last_delta = displacement;
-
- // Repaint the view
- nodes.DisposeTemporary ();
- NotifyDependents (FOREVER, PART_GEOM, REFMSG_CHANGE);
- }
-
- m_OperationName = "Scale";
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Rotate
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformClass::Rotate
-(
- TimeValue time_val,
- Matrix3 & parent_tm,
- Matrix3 & tm_axis,
- Quat & rotation,
- BOOL local_origin
-)
-{
- if (m_pPanel->Is_Edit_Mode ()) {
- INodeTab nodes;
- ModContextList mod_context_list;
- m_MaxInterface->GetModContexts (mod_context_list, nodes);
-
- Matrix3 matrix_rot;
- rotation.MakeMatrix (matrix_rot);
-
- Matrix3 rel_rot;
- rel_rot = Inverse (last_rot) * matrix_rot;
-
- // Loop through all the modifier contexts
- for (int index = 0; index < mod_context_list.Count (); index ++) {
-
- // Get the data we've cached for this modifier context
- MeshDeformModData *mod_data = static_cast (mod_context_list[index]->localData);
- if (mod_data != NULL) {
- Mesh *mesh = mod_data->Peek_Mesh ();
- const Point3 *vertex_array = mod_data->Peek_Orig_Vertex_Array ();
- Point3 *opstart_array = mod_data->Peek_Vertex_OPStart_Array ();
-
- // Loop through all the selected verts
- for (int vert = 0; vert < mesh->numVerts; vert ++) {
- if (mesh->vertSel[vert]) {
-
- // Do the 'displacment' in axis-space
- Point3 vert_ws = parent_tm * mesh->verts[vert];
- Point3 vert_as = Inverse (tm_axis) * vert_ws;
- vert_as = (rel_rot * vert_as);
-
- // Convert back to obj-space
- vert_ws = tm_axis * vert_as;
- mesh->verts[vert] = Inverse (parent_tm) * vert_ws;
-
- // Record the delta
- //delta_array[vert] = mesh->verts[vert] - vertex_array[vert];
- }
- }
-
- //
- // Record these changes in the current set
- //
- mod_data->Update_Set (m_CurrentSet, VERT_POSITION);
- }
- }
-
- // Remember what our last displacement was because we
- // want to perform our calculations relative to the current
- // position.
- //last_delta = displacement;
- last_rot = matrix_rot;
-
- // Repaint the view
- nodes.DisposeTemporary ();
- NotifyDependents (FOREVER, PART_GEOM, REFMSG_CHANGE);
-
- // Make sure our current 'set' knows what verts have changed
- //Update_Current_Set ();
- }
-
- m_OperationName = "Rotate";
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// TransformStart
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformClass::TransformStart (TimeValue time_val)
-{
- if (m_MaxInterface != NULL) {
- m_MaxInterface->LockAxisTripods (TRUE);
- }
-
- // Reset our last-delta value
- last_delta.x = 0;
- last_delta.y = 0;
- last_delta.z = 0;
- last_rot.IdentityMatrix ();
- last_scale.x = 0;
- last_scale.y = 0;
- last_scale.z = 0;
-
- INodeTab nodes;
- ModContextList mod_context_list;
- m_MaxInterface->GetModContexts (mod_context_list, nodes);
-
- // Begin the undo operation
- theHold.Begin ();
-
- // Loop through all the modifier contexts
- for (int index = 0; index < mod_context_list.Count (); index ++) {
-
- // Get the data we've cached for this modifier context
- MeshDeformModData *mod_data = static_cast (mod_context_list[index]->localData);
- if (mod_data != NULL) {
- Mesh *mesh = mod_data->Peek_Mesh ();
- Point3 *opstart_array = mod_data->Peek_Vertex_OPStart_Array ();
-
- // Copy the current state of the mesh
- for (int vert = 0; vert < mesh->numVerts; vert ++) {
- opstart_array[vert] = mesh->verts[vert];
- }
-
- // Add the 'position restore' object to the undo stack
- theHold.Put (new VertexPositionRestoreClass (mesh, this, mod_data));
- }
- }
-
- // Repaint the view
- nodes.DisposeTemporary ();
- NotifyDependents (FOREVER, PART_GEOM, REFMSG_CHANGE);
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// TransformFinish
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformClass::TransformFinish (TimeValue time_val)
-{
- if (m_MaxInterface != NULL) {
- m_MaxInterface->LockAxisTripods (FALSE);
- }
-
- // Accept the undo operation
- theHold.Accept (m_OperationName);
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// TransformCancel
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformClass::TransformCancel (TimeValue time_val)
-{
- if (m_MaxInterface != NULL) {
- m_MaxInterface->LockAxisTripods (FALSE);
- }
-
- // Cancel the undo operation
- theHold.Cancel ();
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Set_Deform_State
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformClass::Set_Deform_State (float state)
-{
- if ((m_MaxInterface != NULL) && (state != m_DeformState)) {
- m_DeformState = state;
- NotifyDependents (FOREVER, PART_GEOM | PART_VERTCOLOR, REFMSG_CHANGE);
- m_MaxInterface->RedrawViews (m_MaxInterface->GetTime ());
- if (m_pPanel != NULL) {
- m_pPanel->Update_Vertex_Color ();
- }
- }
-
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Set_Vertex_Color
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformClass::Set_Vertex_Color (const Point3 &color, bool button_up)
-{
- if (m_MaxInterface != NULL) {
-
- INodeTab nodes;
- ModContextList mod_context_list;
- m_MaxInterface->GetModContexts (mod_context_list, nodes);
-
- bool save_undo = false;
- if ((button_up == false) && (m_VertColorChanging == false)) {
- theHold.Begin ();
- m_VertColorChanging = true;
- save_undo = true;
- }
-
- // Loop through all the modifier contexts
- for (int index = 0; index < mod_context_list.Count (); index ++) {
-
- // Get the data we've cached for this modifier context
- MeshDeformModData *mod_data = static_cast (mod_context_list[index]->localData);
- if (mod_data != NULL) {
- Mesh *mesh = mod_data->Peek_Mesh ();
-
- //
- // Record the original color in the undo stack
- //
- if (save_undo) {
- theHold.Put (new VertexColorRestoreClass (mesh, this, mod_data));
- }
-
- // Only do this if the mesh is using vertex coloring
- if (mesh->numCVerts >= mesh->numVerts) {
-
- //
- // Loop through all the per-face verts
- //
- for (int face = 0; face < mesh->numFaces; face ++) {
- for (int vert = 0; vert < 3; vert ++) {
-
- //
- // If the vertex is selected, then change its color
- //
- if (mesh->vertSel[mesh->faces[face].v[vert]]) {
- int color_index = mesh->vcFace[face].t[vert];
- mesh->vertCol[color_index] = color;
- }
- }
- }
- }
-
- //
- // Record these changes in the current set
- //
- mod_data->Update_Set (m_CurrentSet, VERT_COLORS);
- }
- }
-
- if (button_up && m_VertColorChanging) {
- theHold.Accept ("Vertex Color");
- }
-
- // Repaint the model
- nodes.DisposeTemporary ();
- NotifyDependents (FOREVER, PART_GEOM | PART_VERTCOLOR, REFMSG_CHANGE);
- m_MaxInterface->RedrawViews (m_MaxInterface->GetTime ());
- }
-
- m_VertColorChanging = !button_up;
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Get_Vertex_Color
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformClass::Get_Vertex_Color (Point3 &color)
-{
- // Assume black
- color.x = 0;
- color.y = 0;
- color.z = 0;
-
- if (m_MaxInterface != NULL) {
-
- INodeTab nodes;
- ModContextList mod_context_list;
- m_MaxInterface->GetModContexts (mod_context_list, nodes);
-
- //
- // Loop through all the modifier contexts
- //
- int sel_count = 0;
- for (int index = 0; index < mod_context_list.Count (); index ++) {
-
- //
- // Get the data we've cached for this modifier context
- //
- MeshDeformModData *mod_data = static_cast (mod_context_list[index]->localData);
- if (mod_data != NULL) {
- Mesh *mesh = mod_data->Peek_Mesh ();
-
- // Only do this if the mesh is using vertex coloring
- if (mesh->numCVerts >= mesh->numVerts) {
-
- //
- // Loop through all the per-face verts
- //
- for (int face = 0; face < mesh->numFaces; face ++) {
- for (int vert = 0; vert < 3; vert ++) {
-
- //
- // If this vert is selected, then add its color to the total
- //
- if (mesh->vertSel[mesh->faces[face].v[vert]]) {
- int color_index = mesh->vcFace[face].t[vert];
- Point3 vert_color = mesh->vertCol[color_index];
- color += vert_color;
- sel_count ++;
- }
- }
- }
- }
- }
- }
-
- //
- // Normalize the selected color
- //
- if (sel_count > 0) {
- color = color / sel_count;
- }
-
- nodes.DisposeTemporary ();
- }
-
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Update_UI
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformClass::Update_UI (MeshDeformModData *mod_data)
-{
- assert (mod_data != NULL);
-
- if (m_pPanel != NULL) {
- Update_Set_Count ();
-
- m_CurrentSet = mod_data->Get_Current_Set ();
- int keyframe = mod_data->Peek_Set (m_CurrentSet).Get_Current_Key_Frame ();
- Set_Deform_State ((float(keyframe + 1) + 0.5F) / 10.0F);
-
- m_pPanel->Update_Vertex_Color ();
- m_pPanel->Set_Max_Sets (m_MaxSets);
- m_pPanel->Set_Current_Set (m_CurrentSet);
- m_pPanel->Set_Current_State (m_DeformState);
- }
-
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Auto_Apply
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformClass::Auto_Apply (bool auto_apply)
-{
- if (m_MaxInterface != NULL) {
-
- // Get a list of contexts that we are part of.
- INodeTab nodes;
- ModContextList mod_context_list;
- m_MaxInterface->GetModContexts (mod_context_list, nodes);
-
- // Loop through all the modifier contexts
- for (int index = 0; index < mod_context_list.Count (); index ++) {
-
- //
- // Let the mod context know what it's auto apply state is
- //
- MeshDeformModData *mod_data = static_cast (mod_context_list[index]->localData);
- if (mod_data != NULL) {
- mod_data->Auto_Apply (auto_apply);
- }
- }
-
- // Cleanup
- nodes.DisposeTemporary ();
- }
-
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Set_Max_Deform_Sets
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformClass::Set_Max_Deform_Sets (int max)
-{
- //
- // Make sure the current set doesn't exceed the total sets
- //
- if (m_CurrentSet >= max) {
- Set_Current_Set (max - 1, true);
- }
-
- m_MaxSets = max;
- if (m_MaxInterface != NULL) {
-
- // Get a list of contexts that we are part of.
- INodeTab nodes;
- ModContextList mod_context_list;
- m_MaxInterface->GetModContexts (mod_context_list, nodes);
-
- // Loop through all the modifier contexts
- for (int index = 0; index < mod_context_list.Count (); index ++) {
-
- //
- // Let the mod context know the max sets have changed
- //
- MeshDeformModData *mod_data = static_cast (mod_context_list[index]->localData);
- if (mod_data != NULL) {
- mod_data->Set_Max_Deform_Sets (max);
- }
- }
-
- // Cleanup
- nodes.DisposeTemporary ();
- NotifyDependents (FOREVER, PART_SELECT, REFMSG_CHANGE);
- m_MaxInterface->RedrawViews (m_MaxInterface->GetTime ());
- }
-
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Update_Set_Count
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformClass::Update_Set_Count (void)
-{
- m_MaxSets = 1;
- if (m_MaxInterface != NULL) {
-
- // Get a list of contexts that we are part of.
- INodeTab nodes;
- ModContextList mod_context_list;
- m_MaxInterface->GetModContexts (mod_context_list, nodes);
-
- // Loop through all the modifier contexts
- for (int index = 0; index < mod_context_list.Count (); index ++) {
-
- //
- // Get the count of sets for this context
- //
- MeshDeformModData *mod_data = static_cast (mod_context_list[index]->localData);
- if ((mod_data != NULL) && (mod_data->Get_Set_Count () > m_MaxSets)) {
- m_MaxSets = mod_data->Get_Set_Count ();
- }
- }
-
- // Cleanup
- nodes.DisposeTemporary ();
- }
-
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Set_Current_Set
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformClass::Set_Current_Set
-(
- int index,
- bool update_selection
-)
-{
- last_delta.x = 0;
- last_delta.y = 0;
- last_delta.z = 0;
-
- m_CurrentSet = index;
- if (m_MaxInterface != NULL) {
- if (update_selection) {
- ClearSelection (1);
- }
-
- // Get a list of contexts that we are part of.
- INodeTab nodes;
- ModContextList mod_context_list;
- m_MaxInterface->GetModContexts (mod_context_list, nodes);
-
- // Loop through all the modifier contexts
- for (int index = 0; index < mod_context_list.Count (); index ++) {
-
- //
- // Have the mod context select the verts in its set
- //
- MeshDeformModData *mod_data = static_cast (mod_context_list[index]->localData);
- if (mod_data != NULL) {
- mod_data->Set_Current_Set (m_CurrentSet);
- if (update_selection) {
- mod_data->Select_Set (m_CurrentSet);
- }
- m_pPanel->Set_Auto_Apply_Check (mod_data->Is_Auto_Apply ());
- }
- }
-
- // Repaint the model
- nodes.DisposeTemporary ();
- if (update_selection) {
- NotifyDependents (FOREVER, PART_SELECT, REFMSG_CHANGE);
- m_MaxInterface->RedrawViews (m_MaxInterface->GetTime ());
- }
-
- // Update the current 'vertex color' on the UI panel
- m_pPanel->Update_Vertex_Color ();
- }
-
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Update_Current_Set
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformClass::Update_Current_Set (void)
-{
- if (m_MaxInterface != NULL) {
-
- // Get a list of contexts that we are part of.
- INodeTab nodes;
- ModContextList mod_context_list;
- m_MaxInterface->GetModContexts (mod_context_list, nodes);
-
- // Loop through all the modifier contexts
- for (int index = 0; index < mod_context_list.Count (); index ++) {
-
- //
- // Notify the mod context so it can update its list of verts
- // in the current set.
- //
- MeshDeformModData *mod_data = static_cast (mod_context_list[index]->localData);
- if (mod_data != NULL) {
- //mod_data->Update_Set (m_CurrentSet);
- }
- }
-
- // Cleanup
- nodes.DisposeTemporary ();
- m_bSetDirty = false;
- }
-
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// SaveLocalData
-//
-///////////////////////////////////////////////////////////////////////////
-IOResult
-MeshDeformClass::SaveLocalData (ISave *save_obj, LocalModData *mod_context)
-{
- assert (mod_context != NULL);
- return ((MeshDeformModData *)mod_context)->Save (save_obj);
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// LoadLocalData
-//
-///////////////////////////////////////////////////////////////////////////
-IOResult
-MeshDeformClass::LoadLocalData (ILoad *load_obj, LocalModData **mod_context)
-{
- assert (mod_context != NULL);
- MeshDeformModData *mod_data = new MeshDeformModData;
- (*mod_context) = mod_data;
- return mod_data->Load (load_obj);
-}
-
-
-
-
-
-
-#if 0
-
-void SkinModifierClass::SelectAll(int selLevel)
-{
- int needsdel = 0;
- Interval valid = FOREVER;
- ModContextList mclist;
- INodeTab nodes;
-
- if (!InterfacePtr) return;
-
- InterfacePtr->GetModContexts(mclist,nodes);
- InterfacePtr->ClearCurNamedSelSet();
-
- for (int i = 0; i < mclist.Count(); i++) {
-
- SkinDataClass * skindata = (SkinDataClass *)mclist[i]->localData;
-
- if (skindata==NULL) continue;
-
- ObjectState os = nodes[i]->EvalWorldState(InterfacePtr->GetTime());
- TriObject * tobj = Get_Tri_Object(InterfacePtr->GetTime(),os,valid,needsdel);
-
- switch (SubObjSelLevel) {
-
- case OBJECT_SEL_LEVEL:
- assert(0);
- return;
-
- case VERTEX_SEL_LEVEL:
-#if 0 // undo/redo
- if (theHold.Holding()) {
- theHold.Put(new VertexSelRestore(meshData,this));
- }
-#endif
- tobj->mesh.vertSel.SetAll();
- skindata->VertSel.SetAll();
- break;
- }
-
- if (needsdel) {
- tobj->DeleteThis();
- }
- }
-
- /*
- ** Get rid of the temporary copies of the INodes.
- */
- nodes.DisposeTemporary();
-
- /*
- ** Tell our dependents that the selection set has changed
- */
- NotifyDependents(FOREVER, PART_SELECT, REFMSG_CHANGE);
-}
-
-void SkinModifierClass::InvertSelection(int selLevel)
-{
- int needsdel = 0;
- Interval valid = FOREVER;
- ModContextList mclist;
- INodeTab nodes;
-
- if (!InterfacePtr) return;
-
- InterfacePtr->GetModContexts(mclist,nodes);
- InterfacePtr->ClearCurNamedSelSet();
-
- for (int i = 0; i < mclist.Count(); i++) {
-
- SkinDataClass * skindata = (SkinDataClass *)mclist[i]->localData;
-
- if (skindata==NULL) continue;
-
- ObjectState os = nodes[i]->EvalWorldState(InterfacePtr->GetTime());
- TriObject * tobj = Get_Tri_Object(InterfacePtr->GetTime(),os,valid,needsdel);
-
- switch (SubObjSelLevel) {
-
- case OBJECT_SEL_LEVEL:
- assert(0);
- return;
-
- case VERTEX_SEL_LEVEL:
-#if 0 // undo/redo
- if (theHold.Holding()) {
- theHold.Put(new VertexSelRestore(meshData,this));
- }
-#endif
- for (int j=0; jmesh.vertSel.GetSize(); j++) {
- if (tobj->mesh.vertSel[j]) tobj->mesh.vertSel.Clear(j);
- else tobj->mesh.vertSel.Set(j);
- }
- skindata->VertSel = tobj->mesh.vertSel;
- break;
- }
-
- if (needsdel) {
- tobj->DeleteThis();
- }
- }
-
- /*
- ** Get rid of the temporary copies of the INodes.
- */
- nodes.DisposeTemporary();
-
- /*
- ** Tell our dependents that the selection set has changed
- */
- NotifyDependents(FOREVER, PART_SELECT, REFMSG_CHANGE);
-
-}
-
-#endif // 0
-
-
-#if defined W3D_MAX4 //defined as in the project (.dsp)
-////////////////////////////////////////////////////////////////////////////////////////
-int MeshDeformClass::NumSubObjTypes()
-{
- return 1;
-}
-////////////////////////////////////////////////////////////////////////////////////////
-ISubObjType *MeshDeformClass::GetSubObjType(int i)
-{
- static bool _initialized = false;
- if(!_initialized){
- _initialized = true;
- _SubObjectTypeVertex.SetName("Vertices");
- }
- if(i == -1){
- if(GetSubObjectLevel() > 0){
- return GetSubObjType(GetSubObjectLevel()-1);
- }
- }
- return &_SubObjectTypeVertex;
-}
-#endif
diff --git a/Generals/Code/Tools/WW3D/max2w3d/MeshDeform.h b/Generals/Code/Tools/WW3D/max2w3d/MeshDeform.h
deleted file mode 100644
index 9a2810d7b92..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/MeshDeform.h
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/* $Header: /Commando/Code/Tools/max2w3d/MeshDeform.h 6 4/24/01 6:02p Greg_h $ */
-/***********************************************************************************************
- *** Confidential - Westwood Studios ***
- ***********************************************************************************************
- * *
- * Project Name : Commando / G 3D engine *
- * *
- * File Name : MeshDeform.H *
- * *
- * Programmer : Patrick Smith *
- * *
- * Start Date : 04/19/99 *
- * *
- * Last Update :
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#ifndef __MESH_DEFORM_H
-#define __MESH_DEFORM_H
-
-#include
-#include "Vector.H"
-
-// Forward declarations
-class MeshDeformPanelClass;
-class MeshDeformModData;
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Prototypes
-//
-///////////////////////////////////////////////////////////////////////////
-ClassDesc *Get_Mesh_Deform_Desc (void);
-extern Class_ID _MeshDeformClassID;
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// MeshDeformClass
-//
-///////////////////////////////////////////////////////////////////////////
-class MeshDeformClass : public OSModifier
-{
- public:
-
- //////////////////////////////////////////////////////////////////////
- // Public constructors/destructors
- //////////////////////////////////////////////////////////////////////
- MeshDeformClass (void)
- : m_MaxInterface (NULL),
- m_ModeMove (NULL),
- m_ModeSelect (NULL),
- m_ModeRotate (NULL),
- m_ModeUScale (NULL),
- m_ModeNUScale (NULL),
- m_ModeSquash (NULL),
- m_DeformState (1.0F),
- m_pPanel (NULL),
- m_CurrentSet (0),
- m_bSetDirty (true),
- m_VertColorChanging (false),
- m_MaxSets (0),
- m_hRollupWnd (NULL) { SetName ("WW Mesh Deformer"); Set_Max_Deform_Sets (1); }
-
- virtual ~MeshDeformClass (void) { }
-#if defined W3D_MAX4 //defined as in the project (.dsp)
- NumSubObjTypes();
- GetSubObjType();
-#endif
- //////////////////////////////////////////////////////////////////////
- // Public methods
- //////////////////////////////////////////////////////////////////////
- void Set_Deform_State (float state = 1.0F);
- float Get_Deform_State (void) const { return m_DeformState; }
- void Set_Vertex_Color (const Point3 &color, bool button_up);
- void Get_Vertex_Color (Point3 &color);
- void Set_Max_Deform_Sets (int max);
- int Get_Max_Deform_Sets (void) const { return m_MaxSets; }
- void Set_Current_Set (int index, bool update_selection);
- int Get_Current_Set (void) const { return m_CurrentSet; }
- void Update_UI (MeshDeformModData *mod_data);
- void Auto_Apply (bool auto_apply = true);
-
- //////////////////////////////////////////////////////////////////////
- // Base class overrides
- //////////////////////////////////////////////////////////////////////
-
- //////////////////////////////////////////////////////////////////////
- // From Animatable
- //////////////////////////////////////////////////////////////////////
- void DeleteThis (void) { delete this; }
- void GetClassName (TSTR& s) { s = TSTR(_T("WWDeform")); }
- TCHAR * GetObjectName (void) { return _T("WWDamage"); }
- SClass_ID SuperClassID (void) { return OSM_CLASS_ID; }
- Class_ID ClassID (void) { return _MeshDeformClassID; }
- //RefTargetHandle Clone(RemapDir& remap = NoRemap());
- void BeginEditParams (IObjParam *ip, ULONG flags,Animatable *prev);
- void EndEditParams (IObjParam *ip, ULONG flags,Animatable *next);
-
- //////////////////////////////////////////////////////////////////////
- // From Modifier
- //////////////////////////////////////////////////////////////////////
- ChannelMask ChannelsUsed (void);
- ChannelMask ChannelsChanged (void);
- void ModifyObject (TimeValue t, ModContext &mod_context, ObjectState* os, INode *node);
- BOOL DependOnTopology (ModContext &mod_context) { return TRUE; }
- int NeedUseSubselButton (void) { return TRUE; }
- Class_ID InputType (void);
-
- //////////////////////////////////////////////////////////////////////
- // From ReferenceMaker
- //////////////////////////////////////////////////////////////////////
- RefResult NotifyRefChanged (Interval time, RefTargetHandle htarget, PartID &part_id, RefMessage mesage);
- IOResult SaveLocalData (ISave *save_obj, LocalModData *mod_context);
- IOResult LoadLocalData (ILoad *load_obj, LocalModData **mod_context);
-
- //////////////////////////////////////////////////////////////////////
- // From BaseObject
- //////////////////////////////////////////////////////////////////////
- CreateMouseCallBack * GetCreateMouseCallBack (void);
- void ActivateSubobjSel (int level, XFormModes &modes);
- int HitTest (TimeValue time_value, INode * node, int type, int crossing, int flags, IPoint2 *point, ViewExp *viewport, ModContext *mod_context);
- void SelectSubComponent (HitRecord *hit_record, BOOL selected, BOOL all, BOOL invert);
-
- void GetSubObjectCenters (SubObjAxisCallback *cb, TimeValue t, INode *node, ModContext *mc);
- void GetSubObjectTMs (SubObjAxisCallback *cb, TimeValue t, INode *node, ModContext *mc);
- int SubObjectIndex (HitRecord *hitRec) { return hitRec->hitInfo; }
- void ClearSelection (int selLevel);
-
- // Transformation managment
- void Move (TimeValue time_val, Matrix3 &parent_tm, Matrix3 &tm_axis, Point3 &point, BOOL local_origin);
- void Rotate (TimeValue time_val, Matrix3 &parent_tm, Matrix3 &tm_axis, Quat &rotation, BOOL local_origin);
- void Scale (TimeValue time_val, Matrix3 &parent_tm, Matrix3 &tm_axis, Point3 &value, BOOL local_origin);
-
- void TransformStart (TimeValue time_val);
- void TransformFinish (TimeValue time_val);
- void TransformCancel (TimeValue time_val);
-#if defined W3D_MAX4 //defined as in the project (.dsp)
- ISubObjType * GetSubObjType(int i) ;
-#endif
-
- protected:
-
- //////////////////////////////////////////////////////////////////////
- // Protected methods
- //////////////////////////////////////////////////////////////////////
- void Update_Current_Set (void);
- void Update_Set_Count (void);
-
- private:
-
- //////////////////////////////////////////////////////////////////////
- // Private member data
- //////////////////////////////////////////////////////////////////////
- IObjParam * m_MaxInterface;
- HWND m_hRollupWnd;
- MeshDeformPanelClass * m_pPanel;
- float m_DeformState;
- bool m_VertColorChanging;
-
- // Mode handlers
- SelectModBoxCMode * m_ModeSelect;
- MoveModBoxCMode * m_ModeMove;
- RotateModBoxCMode * m_ModeRotate;
- UScaleModBoxCMode * m_ModeUScale;
- NUScaleModBoxCMode * m_ModeNUScale;
- SquashModBoxCMode * m_ModeSquash;
-
- // Set managment
- bool m_bSetDirty;
- int m_CurrentSet;
- int m_MaxSets;
-
- // Information
- CStr m_OperationName;
-};
-
-
-#endif //__MESH_DEFORM_H
diff --git a/Generals/Code/Tools/WW3D/max2w3d/MeshDeformData.cpp b/Generals/Code/Tools/WW3D/max2w3d/MeshDeformData.cpp
deleted file mode 100644
index aae3d910d20..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/MeshDeformData.cpp
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** Confidential - Westwood Studios ***
- ***********************************************************************************************
- * *
- * Project Name : Commando / G 3D engine *
- * *
- * File Name : MeshDeformData.cpp *
- * *
- * Programmer : Patrick Smith *
- * *
- * Start Date : 04/26/99 *
- * *
- * Last Update :
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#include "MeshDeformData.h"
-#include "util.h"
-#include "MeshDeformSaveDefs.h"
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// ~MeshDeformModData
-//
-///////////////////////////////////////////////////////////////////////////
-MeshDeformModData::~MeshDeformModData (void)
-{
- Free_Sets_List ();
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Record_Mesh_State
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformModData::Record_Mesh_State (TriObject &tri_obj, float state, bool update_all)
-{
- //
- // Ask each set to update its state
- //
-
- for (int index = 0; index < m_SetsList.Count (); index ++) {
- if (index != m_CurrentSet) {
- if (update_all) {
- m_SetsList[index]->Set_State (state);
- }
- m_SetsList[index]->Update_Mesh (tri_obj);
- }
- }
-
- if (m_CurrentSet < m_SetsList.Count ()) {
- m_SetsList[m_CurrentSet]->Set_State (state);
- m_SetsList[m_CurrentSet]->Update_Mesh (tri_obj);
- }
-
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Free_Sets_List
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformModData::Free_Sets_List (void)
-{
- //
- // Delete all the object pointers in the set list
- //
- for (int index = 0; index < m_SetsList.Count (); index ++) {
- MeshDeformSetClass *set = m_SetsList[index];
- SAFE_DELETE (set);
- }
-
- // Remove all the entries from the list
- m_SetsList.Delete_All ();
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Set_Max_Deform_Sets
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformModData::Set_Max_Deform_Sets (int max)
-{
- int current_max = m_SetsList.Count ();
- if (max > current_max) {
-
- //
- // Add the new sets to the list
- //
- int sets_to_add = max - current_max;
- for (int index = 0; index < sets_to_add; index ++) {
- MeshDeformSetClass *set = new MeshDeformSetClass;
- m_SetsList.Add (set);
- }
-
- } else if (max < current_max) {
-
- //
- // Remove the obsolete sets from the list
- //
- int sets_to_remove = current_max - max;
- for (int index = 0; index < sets_to_remove; index ++) {
-
- // Restore the set before we delete it
- Restore_Set (max);
-
- // Delete the set
- MeshDeformSetClass *set = m_SetsList[max];
- SAFE_DELETE (set);
- m_SetsList.Delete (max);
- }
- }
-
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Restore_Set
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformModData::Restore_Set (int set_index)
-{
- if (set_index == -1) {
-
- // Restore ALL the set
- for (int index = 0; index < m_SetsList.Count (); index ++) {
- m_SetsList[index]->Restore_Members ();
- }
-
- } else {
- m_SetsList[set_index]->Restore_Members ();
- }
-
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Save
-//
-///////////////////////////////////////////////////////////////////////////
-IOResult
-MeshDeformModData::Save (ISave *save_obj)
-{
- DWORD bytes = 0L;
- save_obj->BeginChunk (DEFORM_CHUNK_INFO);
-
- //
- // Write the set count info to the chunk
- //
- DeformChunk info = { 0 };
- info.SetCount = m_SetsList.Count ();
- IOResult result = save_obj->Write (&info, sizeof (info), &bytes);
-
- save_obj->EndChunk ();
-
- //
- // Now write a chunk for each set
- //
- for (int index = 0; (index < m_SetsList.Count ()) && (result == IO_OK); index ++) {
- result = m_SetsList[index]->Save (save_obj);
- }
-
- // Return IO_OK on success IO_ERROR on failure
- return result;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Load
-//
-///////////////////////////////////////////////////////////////////////////
-IOResult
-MeshDeformModData::Load (ILoad *load_obj)
-{
- Free_Sets_List ();
- DWORD bytes = 0L;
-
- //
- // Is this the chunk we were expecting?
- //
- IOResult result = load_obj->OpenChunk ();
- if ( (result == IO_OK) &&
- (load_obj->CurChunkID () == DEFORM_CHUNK_INFO)) {
-
- DeformChunk info = { 0 };
- result = load_obj->Read (&info, sizeof (info), &bytes);
- load_obj->CloseChunk ();
-
- //
- // Read the set information from the chunk
- //
- for (unsigned int index = 0; (index < info.SetCount) && (result == IO_OK); index ++) {
- MeshDeformSetClass *set = new MeshDeformSetClass;
- m_SetsList.Add (set);
- result = set->Load (load_obj);
- }
- }
-
- // Return IO_OK on success IO_ERROR on failure
- return result;
-}
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/MeshDeformData.h b/Generals/Code/Tools/WW3D/max2w3d/MeshDeformData.h
deleted file mode 100644
index c8cf20e29fb..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/MeshDeformData.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** Confidential - Westwood Studios ***
- ***********************************************************************************************
- * *
- * Project Name : Commando / G 3D engine *
- * *
- * File Name : MeshDeformData.h *
- * *
- * Programmer : Patrick Smith *
- * *
- * Start Date : 04/26/99 *
- * *
- * Last Update :
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#ifndef __MESH_DEFORM_DATA_H
-#define __MESH_DEFORM_DATA_H
-
-#include
-#include "Vector.H"
-#include "MeshDeformSet.h"
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Typedefs
-//
-///////////////////////////////////////////////////////////////////////////
-typedef DynamicVectorClass SETS_LIST;
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// MeshDeformModData
-//
-///////////////////////////////////////////////////////////////////////////
-class MeshDeformModData : public LocalModData
-{
- public:
-
- //////////////////////////////////////////////////////////////////////
- // Public constructors/destructors
- //////////////////////////////////////////////////////////////////////
- MeshDeformModData (void)
- : m_CurrentSet (0) { }
-
- virtual ~MeshDeformModData (void);
-
- //////////////////////////////////////////////////////////////////////
- // Public methods
- //////////////////////////////////////////////////////////////////////
- virtual LocalModData * Clone (void) { return new MeshDeformModData; }
- void Record_Mesh_State (TriObject &tri_obj, float state, bool update_all);
-
- // Inline accessors
- Mesh * Peek_Mesh (void) const { return m_SetsList[m_CurrentSet]->Peek_Mesh (); }
- const Point3 * Peek_Orig_Vertex_Array (void) const { return m_SetsList[m_CurrentSet]->Peek_Orig_Vertex_Array (); }
- Point3 * Peek_Vertex_OPStart_Array (void) const { return m_SetsList[m_CurrentSet]->Peek_Vertex_OPStart_Array (); }
- VertColor * Peek_Vertex_Colors (void) const { return m_SetsList[m_CurrentSet]->Peek_Vertex_Colors (); }
-
- // Auto apply
- bool Is_Auto_Apply (void) const { return m_SetsList[m_CurrentSet]->Does_Set_Auto_Apply (); }
- void Auto_Apply (bool auto_apply = true) { m_SetsList[m_CurrentSet]->Auto_Apply (auto_apply); }
-
- // Data modifiers
- void Update_Current_Data (void) { m_SetsList[m_CurrentSet]->Update_Current_Data (); }
- void Set_Vertex_Position (int index, const Point3 &value) { m_SetsList[m_CurrentSet]->Set_Vertex_Position (index, value); }
- void Set_Vertex_Color (int index, int color_index, const VertColor &value) { m_SetsList[m_CurrentSet]->Set_Vertex_Color (index, color_index, value); }
-
- // Set managment
- void Set_Max_Deform_Sets (int max);
- void Set_Current_Set (int set_index) { m_CurrentSet = set_index; }
- int Get_Current_Set (void) const { return m_CurrentSet; }
- void Select_Set (int set_index) { m_SetsList[set_index]->Select_Members (); }
- void Update_Set (int set_index, DEFORM_CHANNELS flags) { m_SetsList[set_index]->Update_Members (flags); }
- void Restore_Set (int set_index = -1);
- MeshDeformSetClass & Peek_Set (int index) { return *(m_SetsList[index]); }
- int Get_Set_Count (void) const { return m_SetsList.Count (); }
-
- // Persistent storage
- IOResult Save (ISave *save_obj);
- IOResult Load (ILoad *load_obj);
-
- protected:
-
- //////////////////////////////////////////////////////////////////////
- // Protected methods
- //////////////////////////////////////////////////////////////////////
- void Resize_Vertex_Array (int count, int color_count);
- void Copy_Vertex_Array (Mesh &mesh);
- void Free_Sets_List (void);
- void Util_Restore_Set (int set_index);
-
- private:
-
- //////////////////////////////////////////////////////////////////////
- // Private member data
- //////////////////////////////////////////////////////////////////////
-
- // Set managment
- int m_CurrentSet;
- SETS_LIST m_SetsList;
-};
-
-
-#endif //__MESH_DEFORM_DATA_H
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/MeshDeformDefs.h b/Generals/Code/Tools/WW3D/max2w3d/MeshDeformDefs.h
deleted file mode 100644
index 22e43e3f311..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/MeshDeformDefs.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** Confidential - Westwood Studios ***
- ***********************************************************************************************
- * *
- * Project Name : Commando / G 3D engine *
- * *
- * File Name : MeshDeformDefs.h *
- * *
- * Programmer : Patrick Smith *
- * *
- * Start Date : 04/28/99 *
- * *
- * Last Update :
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#ifndef __MESH_DEFORM_DEFS_H
-#define __MESH_DEFORM_DEFS_H
-
-#include
-#include "Vector.H"
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Constants
-//
-///////////////////////////////////////////////////////////////////////////
-typedef enum
-{
- VERT_POSITION = 1,
- VERT_COLORS = 2,
- BOTH = VERT_POSITION | VERT_COLORS
-} DEFORM_CHANNELS;
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Structures
-//
-///////////////////////////////////////////////////////////////////////////
-
-///////////////////////////////////////////////////////////////////////////
-//
-// VERT_INFO
-//
-// Used to represent position or color information for a vertex.
-//
-///////////////////////////////////////////////////////////////////////////
-typedef struct _VERT_INFO
-{
- _VERT_INFO (void)
- : index (0),
- color_index (0),
- value (0,0,0) { }
-
- _VERT_INFO (int vert_index, const Point3 &point, int vert_color_index = 0)
- : index (vert_index),
- color_index (vert_color_index),
- value (point) { }
-
- UINT index;
- UINT color_index;
- Point3 value;
-
- // Don't care, DynamicVectorClass needs these
- bool operator== (const _VERT_INFO &src) { return false; }
- bool operator!= (const _VERT_INFO &src) { return true; }
-} VERT_INFO;
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Typedefs
-//
-///////////////////////////////////////////////////////////////////////////
-typedef DynamicVectorClass DEFORM_LIST;
-
-
-#endif //__MESH_DEFORM_DEFS_H
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/MeshDeformPanel.cpp b/Generals/Code/Tools/WW3D/max2w3d/MeshDeformPanel.cpp
deleted file mode 100644
index 462835a3966..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/MeshDeformPanel.cpp
+++ /dev/null
@@ -1,365 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** Confidential - Westwood Studios ***
- ***********************************************************************************************
- * *
- * Project Name : Commando / G 3D engine *
- * *
- * File Name : MeshDeformPanel.cpp *
- * *
- * Programmer : Patrick Smith *
- * *
- * Start Date : 04/22/99 *
- * *
- * Last Update :
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#include "MeshDeformPanel.h"
-#include "resource.h"
-#include "util.h"
-#include "MeshDeform.h"
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Local constants
-//
-///////////////////////////////////////////////////////////////////////////
-const char * const PANEL_OBJ_PROP = "WWPANELOBJ";
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Message_Proc
-//
-///////////////////////////////////////////////////////////////////////////
-BOOL WINAPI
-MeshDeformPanelClass::Message_Proc
-(
- HWND hwnd,
- UINT message,
- WPARAM wparam,
- LPARAM lparam
-)
-{
- // Lookup the controlling object for this panel
- MeshDeformPanelClass *panel_obj = MeshDeformPanelClass::Get_Object (hwnd);
- BOOL result = FALSE;
-
- switch (message)
- {
- // Create the controlling panel-object
- case WM_INITDIALOG:
- panel_obj = new MeshDeformPanelClass (hwnd);
- SetProp (hwnd, PANEL_OBJ_PROP, (HANDLE)panel_obj);
- break;
-
- case WM_DESTROY:
- result = panel_obj->On_Message (message, wparam, lparam);
- RemoveProp (hwnd, PANEL_OBJ_PROP);
- SAFE_DELETE (panel_obj);
- break;
- }
-
- // Pass the message onto the controlling panel-object
- if (panel_obj != NULL) {
- result = panel_obj->On_Message (message, wparam, lparam);
- }
-
- // Return the TRUE/FALSE result code
- return result;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Get_Object
-//
-///////////////////////////////////////////////////////////////////////////
-MeshDeformPanelClass *
-MeshDeformPanelClass::Get_Object (HWND hwnd)
-{
- return (MeshDeformPanelClass *)::GetProp (hwnd, PANEL_OBJ_PROP);
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// On_Message
-//
-///////////////////////////////////////////////////////////////////////////
-BOOL
-MeshDeformPanelClass::On_Message
-(
- UINT message,
- WPARAM wparam,
- LPARAM lparam
-)
-{
- switch (message)
- {
- case WM_INITDIALOG:
- m_pColorSwatch = ::GetIColorSwatch (::GetDlgItem (m_hWnd, IDC_VERTEX_COLOR), RGB (0, 0, 0), "Vertex Color");
- m_pMaxSetsEdit = ::GetICustEdit (::GetDlgItem (m_hWnd, IDC_MAX_SETS_EDIT));
- m_pMaxSetsSpin = ::GetISpinner (::GetDlgItem (m_hWnd, IDC_MAX_SETS_SPIN));
- m_pLockSetsButton = ::GetICustButton (::GetDlgItem (m_hWnd, IDC_LOCK_SETS));
-
- //
- // Setup the 'max-sets' controls
- //
- m_pMaxSetsSpin->LinkToEdit (::GetDlgItem (m_hWnd, IDC_MAX_SETS_EDIT), EDITTYPE_INT);
- m_pMaxSetsSpin->SetLimits (1, 20);
- m_pMaxSetsEdit->SetText (1);
- m_pMaxSetsSpin->SetValue (1, FALSE);
- ::SetDlgItemInt (m_hWnd, IDC_CURRENT_SET_STATIC, 1, FALSE);
-
- //
- // Setup the edit button
- //
- m_pLockSetsButton->SetType (CBT_CHECK);
- m_pLockSetsButton->SetCheck (FALSE);
- m_pLockSetsButton->SetHighlightColor (GREEN_WASH);
- //m_pEditButton->SetType (CBT_CHECK);
- //m_pEditButton->SetCheck (FALSE);
- //m_pEditButton->SetHighlightColor (GREEN_WASH);
-
- //
- // Setup the sliders
- //
- ::SendDlgItemMessage (m_hWnd, IDC_CURRENT_SET_SLIDER, TBM_SETRANGE, (WPARAM)TRUE, MAKELONG (1, 1));
- ::SendDlgItemMessage (m_hWnd, IDC_CURRENT_SET_SLIDER, TBM_SETPOS, (WPARAM)TRUE, 0L);
- ::SendDlgItemMessage (m_hWnd, IDC_STATE_SLIDER, TBM_SETRANGE, (WPARAM)FALSE, MAKELONG (0, 10));
- ::SendDlgItemMessage (m_hWnd, IDC_STATE_SLIDER, TBM_SETPOS, (WPARAM)FALSE, 9L);
-
- //
- // Ensure the sliders are repainted
- //
- //::InvalidateRect (::GetDlgItem (m_hWnd, IDC_STATE_SLIDER), NULL, TRUE);
- //::InvalidateRect (::GetDlgItem (m_hWnd, IDC_CURRENT_SET_SLIDER), NULL, TRUE);
- break;
-
- case WM_DESTROY:
- ::ReleaseIColorSwatch (m_pColorSwatch);
- ::ReleaseICustEdit (m_pMaxSetsEdit);
- ::ReleaseISpinner (m_pMaxSetsSpin);
- //::ReleaseICustButton (m_pEditButton);
- m_pColorSwatch = NULL;
- m_pMaxSetsEdit = NULL;
- m_pMaxSetsSpin = NULL;
- //m_pEditButton = NULL;
- break;
-
- case WM_COMMAND:
- On_Command (wparam, lparam);
- break;
-
- case CC_COLOR_CHANGE:
- {
- // Pass the new color onto the mesh deformer
- COLORREF color_ref = m_pColorSwatch->GetColor ();
- VertColor color;
- color.x = GetRValue (color_ref) / 255.0F;
- color.y = GetGValue (color_ref) / 255.0F;
- color.z = GetBValue (color_ref) / 255.0F;
- m_pMeshDeformer->Set_Vertex_Color (color, HIWORD (wparam) != 0);
- }
- break;
-
- case WM_CUSTEDIT_ENTER:
- case CC_SPINNER_CHANGE:
- {
- Set_Max_Sets (m_pMaxSetsEdit->GetInt (), true);
- }
- break;
-
- case WM_HSCROLL:
- if ((HWND)lparam == ::GetDlgItem (m_hWnd, IDC_CURRENT_SET_SLIDER)) {
- int pos = ::SendDlgItemMessage (m_hWnd, IDC_CURRENT_SET_SLIDER, TBM_GETPOS, 0, 0L);
- Set_Current_Set (pos - 1, true);
- } else {
- int pos = ::SendDlgItemMessage (m_hWnd, IDC_STATE_SLIDER, TBM_GETPOS, 0, 0L);
- m_pMeshDeformer->Set_Deform_State (((float)pos) / 10.0F);
-
- if (pos > 0) {
- m_pColorSwatch->Enable ();
- } else {
- m_pColorSwatch->Disable ();
- }
- }
-
- break;
- }
-
- return FALSE;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// On_Command
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformPanelClass::On_Command
-(
- WPARAM wparam,
- LPARAM lparam
-)
-{
- switch (LOWORD (wparam))
- {
- case IDC_MANUALAPPLY:
- {
- m_pMeshDeformer->Auto_Apply (Get_Auto_Apply_Check ());
- }
- break;
-
- //case IDC_EDIT_BUTTON:
- /*if (m_pEditButton->IsChecked ()) {
- ::SendDlgItemMessage (m_hWnd, IDC_STATE_SLIDER, TBM_SETPOS, (WPARAM)TRUE, 100L);
- ::EnableWindow (::GetDlgItem (m_hWnd, IDC_STATE_SLIDER), FALSE);
- m_pColorSwatch->Enable ();
- m_pMeshDeformer->Set_Deform_State (1.0F);
- } else {
- ::EnableWindow (::GetDlgItem (m_hWnd, IDC_STATE_SLIDER), TRUE);
- m_pColorSwatch->Disable ();
- }*/
- //break;
-
- case IDC_MAX_SETS_EDIT:
- break;
- }
-
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Set_Deformer
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformPanelClass::Set_Deformer (MeshDeformClass *obj)
-{
- if (m_pMeshDeformer != obj) {
- m_pMeshDeformer = obj;
-
- // Set the slider position based on the current state of the deformer
- float state = m_pMeshDeformer->Get_Deform_State ();
- ::SendDlgItemMessage (m_hWnd, IDC_STATE_SLIDER, TBM_SETPOS, (WPARAM)TRUE, LPARAM(state * 10.0F));
-
- // Now update the current vertex color
- Update_Vertex_Color ();
- }
-
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Update_Vertex_Color
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformPanelClass::Update_Vertex_Color (void)
-{
- if (m_pMeshDeformer != NULL) {
-
- // Update the color swatch with data from the deformer
- Point3 color;
- m_pMeshDeformer->Get_Vertex_Color (color);
- m_pColorSwatch->SetColor (RGB (int(color.x * 255.0F), int(color.y * 255.0F), int(color.z * 255.0F)), FALSE);
- }
-
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Set_Max_Sets
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformPanelClass::Set_Max_Sets
-(
- int max,
- bool notify
-)
-{
- // Update the UI
- ::SendDlgItemMessage (m_hWnd, IDC_CURRENT_SET_SLIDER, TBM_SETRANGE, (WPARAM)TRUE, MAKELONG (1, max));
- ::SetDlgItemInt (m_hWnd, IDC_CURRENT_SET_STATIC, max, TRUE);
-
- if (notify == false) {
- m_pMaxSetsSpin->SetValue (max, TRUE);
- } else if (m_pMeshDeformer != NULL) {
-
- // Update the deformer
- m_pMeshDeformer->Set_Max_Deform_Sets (max);
- }
-
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Set_Current_Set
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformPanelClass::Set_Current_Set
-(
- int set,
- bool notify
-)
-{
- // Update the UI
- ::SetDlgItemInt (m_hWnd, IDC_CURRENT_SET_STATIC, set + 1, TRUE);
-
- if (notify == false) {
- ::SendDlgItemMessage (m_hWnd, IDC_CURRENT_SET_SLIDER, TBM_SETPOS, (WPARAM)TRUE, set + 1);
- } else if (m_pMeshDeformer != NULL) {
-
- // Update the deformer
- m_pMeshDeformer->Set_Current_Set (set, true);
- }
-
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Set_Current_State
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformPanelClass::Set_Current_State (float state)
-{
- ::SendDlgItemMessage (m_hWnd, IDC_STATE_SLIDER, TBM_SETPOS, (WPARAM)TRUE, LPARAM(state * 10.0F));
- return ;
-}
diff --git a/Generals/Code/Tools/WW3D/max2w3d/MeshDeformPanel.h b/Generals/Code/Tools/WW3D/max2w3d/MeshDeformPanel.h
deleted file mode 100644
index 1408c2c52e9..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/MeshDeformPanel.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** Confidential - Westwood Studios ***
- ***********************************************************************************************
- * *
- * Project Name : Commando / G 3D engine *
- * *
- * File Name : MeshDeformPanel.H *
- * *
- * Programmer : Patrick Smith *
- * *
- * Start Date : 04/22/99 *
- * *
- * Last Update :
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#ifndef __MESH_DEFORM_PANEL_H
-#define __MESH_DEFORM_PANEL_H
-
-#include
-#include "resource.h"
-
-// Forward declarations
-class MeshDeformClass;
-
-///////////////////////////////////////////////////////////////////////////
-//
-// MeshDeformPanelClass
-//
-///////////////////////////////////////////////////////////////////////////
-class MeshDeformPanelClass
-{
- public:
-
- //////////////////////////////////////////////////////////////////////
- // Public constructors/destructors
- //////////////////////////////////////////////////////////////////////
- MeshDeformPanelClass (HWND hwnd)
- : m_hWnd (hwnd),
- m_pColorSwatch (NULL),
- m_pMaxSetsSpin (NULL),
- m_pMeshDeformer (NULL),
- m_pLockSetsButton (NULL),
- m_pMaxSetsEdit (NULL) { }
- virtual ~MeshDeformPanelClass (void) { }
-
- //////////////////////////////////////////////////////////////////////
- // Public methods
- //////////////////////////////////////////////////////////////////////
-
- // Inline accessors
- IColorSwatch * Get_Color_Swatch (void) const { return m_pColorSwatch; }
- COLORREF Get_Vertex_Color (void) const { return m_pColorSwatch->GetColor (); }
- void Set_Vertex_Color (COLORREF color) { m_pColorSwatch->SetColor (color); }
- void Set_Deformer (MeshDeformClass *obj);
- BOOL Is_Edit_Mode (void) const { return (::SendDlgItemMessage (m_hWnd, IDC_STATE_SLIDER, TBM_GETPOS, 0, 0L) > 0); }
- BOOL Are_Sets_Tied (void) const { return m_pLockSetsButton->IsChecked (); }
- int Get_Current_Set (void) const { return ::SendDlgItemMessage (m_hWnd, IDC_CURRENT_SET_SLIDER, TBM_GETPOS, 0, 0L); }
- void Set_Current_Set (int set, bool notify = false);
- void Set_Max_Sets (int max, bool notify = false);
- void Set_Current_State (float state);
- void Set_Auto_Apply_Check (bool onoff) { ::SendDlgItemMessage (m_hWnd, IDC_MANUALAPPLY, BM_SETCHECK, (WPARAM)(!onoff), 0L); }
- bool Get_Auto_Apply_Check (void) const { return ::SendDlgItemMessage (m_hWnd, IDC_MANUALAPPLY, BM_GETCHECK, 0, 0L) == 0; }
-
- // Update methods
- void Update_Vertex_Color (void);
-
- //////////////////////////////////////////////////////////////////////
- // Static methods
- //////////////////////////////////////////////////////////////////////
- static BOOL WINAPI Message_Proc (HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
- static MeshDeformPanelClass * Get_Object (HWND hwnd);
-
- protected:
-
- //////////////////////////////////////////////////////////////////////
- // Protected methods
- //////////////////////////////////////////////////////////////////////
- BOOL On_Message (UINT message, WPARAM wparam, LPARAM lparam);
- void On_Command (WPARAM wparam, LPARAM lparam);
-
- private:
-
- //////////////////////////////////////////////////////////////////////
- // Private member data
- //////////////////////////////////////////////////////////////////////
- HWND m_hWnd;
- IColorSwatch * m_pColorSwatch;
- ICustEdit * m_pMaxSetsEdit;
- ISpinnerControl * m_pMaxSetsSpin;
- ICustButton * m_pLockSetsButton;
- MeshDeformClass * m_pMeshDeformer;
-};
-
-
-#endif //__MESH_DEFORM_PANEL_H
diff --git a/Generals/Code/Tools/WW3D/max2w3d/MeshDeformSave.cpp b/Generals/Code/Tools/WW3D/max2w3d/MeshDeformSave.cpp
deleted file mode 100644
index f9ff592d57b..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/MeshDeformSave.cpp
+++ /dev/null
@@ -1,420 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/* $Header: /Commando/Code/Tools/max2w3d/MeshDeformSave.cpp 6 11/12/99 11:12a Greg_h $ */
-/***********************************************************************************************
- *** Confidential - Westwood Studios ***
- ***********************************************************************************************
- * *
- * Project Name : Commando / G 3D engine *
- * *
- * File Name : MeshDeformSafe.CPP
- * *
- * Programmer : Patrick Smith *
- * *
- * Start Date : 05/28/99 *
- * *
- * Last Update :
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#include "MeshDeform.h"
-#include "MeshDeformSave.h"
-#include "MeshDeformData.h"
-#include "MeshDeformSet.h"
-#include "MeshDeformSaveSet.h"
-#include "util.h"
-#include "modstack.h"
-#include "meshbuild.h"
-#include "meshsave.h"
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Initialize
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformSaveClass::Initialize
-(
- MeshBuilderClass &builder,
- Object * object,
- Mesh & mesh,
- Matrix3 * transform
-)
-{
- // Start fresh
- Reset ();
-
- //
- // Attempt to gain access to the IDerivedObject this node references
- //
- int test = object->SuperClassID ();
- int test2 = GEN_DERIVOB_CLASS_ID;
- if ((object != NULL) &&
- (object->SuperClassID () == GEN_DERIVOB_CLASS_ID)) {
-
- //
- // Loop through all the modifiers and see if we can find the
- // Westwood Damage Mesh modifier.
- //
- IDerivedObject *derived_object = static_cast (object);
- int modifier_count = derived_object->NumModifiers ();
- bool found = false;
- for (int index = 0; (index < modifier_count) && !found; index ++) {
-
- //
- // If this is the right modifier, then initialize using the
- // data it contains.
- //
- Modifier *modifier = derived_object->GetModifier (index);
- if ((modifier != NULL) && (modifier->ClassID () == _MeshDeformClassID)) {
-
- //
- // Attempt to get at the modifier data for this context
- //
- ModContext *mod_context = derived_object->GetModContext (index);
- if ((mod_context != NULL) && (mod_context->localData != NULL)) {
- MeshDeformModData *mod_data = static_cast (mod_context->localData);
- Initialize (builder, mesh, *mod_data, transform);
- }
-
- // Found it!
- found = true;
- }
- }
- }
-
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Initialize
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformSaveClass::Initialize
-(
- MeshBuilderClass & builder,
- Mesh & mesh,
- MeshDeformModData & mod_data,
- Matrix3 * transform
-)
-{
- //
- // Loop through all the sets in the modifier
- //
- for (int index = 0; index < mod_data.Get_Set_Count (); index ++) {
-
- //
- // If this set isn't empty then add its data to our list
- //
- MeshDeformSetClass &deform_set = mod_data.Peek_Set (index);
- if (deform_set.Is_Empty () == false) {
-
- //
- // Add this set to our list
- //
- MeshDeformSaveSetClass *save_set = new MeshDeformSaveSetClass;
- deform_set.Save (builder, mesh, *save_set, transform);
- m_DeformSets.Add (save_set);
- }
- }
-
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Reset
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformSaveClass::Reset (void)
-{
- //
- // Delete all the damage sets
- //
- for (int index = 0; index < m_DeformSets.Count (); index ++) {
- SAFE_DELETE (m_DeformSets[index]);
- }
-
- m_DeformSets.Delete_All ();
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Export
-//
-///////////////////////////////////////////////////////////////////////////
-bool
-MeshDeformSaveClass::Export (ChunkSaveClass &chunk_save)
-{
- bool retval = true;
-
- if (m_DeformSets.Count() > 0) {
-
- retval = chunk_save.Begin_Chunk (W3D_CHUNK_DEFORM);
- if (retval) {
-
- //
- // Write the deform header to the file
- //
- W3dMeshDeform header = { 0 };
- header.SetCount = m_DeformSets.Count ();
- header.AlphaPasses = m_AlphaPasses;
- retval &= (chunk_save.Write (&header, sizeof (header)) == sizeof (header));
- if (retval) {
-
- //
- // Export all the sets in the deformation
- //
- retval &= Export_Sets (chunk_save);
- }
-
- retval &= chunk_save.End_Chunk ();
- }
- }
-
- // Return the true/false result code
- return retval;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Export_Sets
-//
-///////////////////////////////////////////////////////////////////////////
-bool
-MeshDeformSaveClass::Export_Sets (ChunkSaveClass &chunk_save)
-{
- bool retval = true;
-
- //
- // Loop through all the sets and write them to the file
- //
- for (int set_index = 0; (set_index < m_DeformSets.Count ()) && retval; set_index ++) {
- retval &= chunk_save.Begin_Chunk (W3D_CHUNK_DEFORM_SET);
- if (retval) {
-
- //
- // Write a chunk of information out for this set
- //
- MeshDeformSaveSetClass *set_save = m_DeformSets[set_index];
- W3dDeformSetInfo set_info = { 0 };
- set_info.KeyframeCount = set_save->Get_Keyframe_Count ();
- set_info.flags = set_save->Get_Flags ();
- retval &= (chunk_save.Write (&set_info, sizeof (set_info)) == sizeof (set_info));
- if (retval) {
-
- //
- // Export all the keyframes for this chunk
- //
- retval &= Export_Keyframes (chunk_save, *set_save);
- }
-
- retval &= chunk_save.End_Chunk ();
- }
- }
-
- // Return the true/false result code
- return retval;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Export_Keyframes
-//
-///////////////////////////////////////////////////////////////////////////
-bool
-MeshDeformSaveClass::Export_Keyframes
-(
- ChunkSaveClass & chunk_save,
- MeshDeformSaveSetClass &set_save
-)
-{
- bool retval = true;
-
- //
- // Loop through all the keyframes in the set
- //
- int count = set_save.Get_Keyframe_Count ();
- for (int keyframe_index = 0; (keyframe_index < count) && retval; keyframe_index ++) {
-
- //
- // Write a chunk of information out for this keyframe
- //
- retval &= chunk_save.Begin_Chunk (W3D_CHUNK_DEFORM_KEYFRAME);
- if (retval) {
- W3dDeformKeyframeInfo keyframe_info = { 0 };
- keyframe_info.DeformPercent = set_save.Get_Deform_State (keyframe_index);
- keyframe_info.DataCount = set_save.Get_Deform_Data_Count (keyframe_index);
-
- retval &= (chunk_save.Write (&keyframe_info, sizeof (keyframe_info)) == sizeof (keyframe_info));
- if (retval) {
-
- //
- // Loop through all the verticies in this keyframe
- //
- int data_count = set_save.Get_Deform_Data_Count (keyframe_index);
- for (int index = 0; (index < data_count) && retval; index ++) {
- MeshDeformSaveSetClass::DEFORM_DATA &data = set_save.Get_Deform_Data (keyframe_index, index);
-
- //
- // Write a chunk of information out for this vertex
- //
- retval &= chunk_save.Begin_Chunk (W3D_CHUNK_DEFORM_DATA);
- if (retval) {
- W3dDeformData data_struct = { 0 };
- data_struct.VertexIndex = data.vert_index;
- data_struct.Position.X = data.position.x;
- data_struct.Position.Y = data.position.y;
- data_struct.Position.Z = data.position.z;
- data_struct.Color.R = data.color.x * 255;
- data_struct.Color.G = data.color.y * 255;
- data_struct.Color.B = data.color.z * 255;
-
- // If we are using vertex alpha instead of vertex color, then convert
- // the v-color into an alpha setting
- data_struct.Color.A = 255;
- if (m_AlphaPasses != 0) {
- data_struct.Color.A = (data_struct.Color.R + data_struct.Color.G + data_struct.Color.B) / 3.0F;
- }
-
- retval &= (chunk_save.Write (&data_struct, sizeof (data_struct)) == sizeof (data_struct));
- retval &= chunk_save.End_Chunk ();
- }
- }
- }
-
- retval &= chunk_save.End_Chunk ();
- }
- }
-
- // Return the true/false result code
- return retval;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Re_Index
-//
-///////////////////////////////////////////////////////////////////////////
-/*void
-MeshDeformSaveClass::Re_Index (MeshBuilderClass &builder)
-{
- DynamicVectorClass temp_list;
-
- //
- // Reindex each set of deform data
- //
- for (int set_index = 0; set_index < m_DeformSets.Count (); set_index ++) {
- MeshDeformSaveSetClass *set_save = m_DeformSets[set_index];
-
- //
- // Loop through all the deform entries in this set
- //
- for (int keyframe_index = 0; keyframe_index < set_save->Get_Keyframe_Count (); keyframe_index ++) {
- temp_list.Delete_All ();
- for (int index = 0; index < set_save->Get_Deform_Data_Count (keyframe_index); index ++) {
- MeshDeformSaveSetClass::DEFORM_DATA &data = set_save->Get_Deform_Data (keyframe_index, index);
-
- //
- // Now try to find the 'W3D' index of this vertex (its different than the max version).
- //
- //bool found = false;
- for (int vert_index = 0; vert_index < builder.Get_Vertex_Count (); vert_index++) {
- MeshBuilderClass::VertClass &vert = builder.Get_Vertex (vert_index);
-
- //
- // Reindex this vertex if its the one we are looking for.
- //
- if (vert.Id == (int)data.vert_index) {
- MeshDeformSaveSetClass::DEFORM_DATA new_data = data;
- new_data.vert_index = vert_index;
- temp_list.Add (new_data);
- //data.vert_index = vert_index;
- //found = true;
- }
- }
- }
-
- set_save->Replace_Deform_Data (keyframe_index, temp_list);
- }
- }
-
- return ;
-}*/
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Does_Deformer_Modify_DCG
-//
-///////////////////////////////////////////////////////////////////////////
-bool
-MeshDeformSaveClass::Does_Deformer_Modify_DCG (void)
-{
- bool retval = false;
-
- //
- // Loop through all the sets
- //
- for (int set_index = 0; (set_index < m_DeformSets.Count ()) && !retval; set_index ++) {
- MeshDeformSaveSetClass *set_save = m_DeformSets[set_index];
- if (set_save) {
-
- //
- // Loop through all the keyframes in this set
- //
- int count = set_save->Get_Keyframe_Count ();
- for (int keyframe_index = 0; (keyframe_index < count) && !retval; keyframe_index ++) {
-
- //
- // Loop through all the entries in this keyframe
- //
- int data_count = set_save->Get_Deform_Data_Count (keyframe_index);
- for (int index = 0; (index < data_count) && !retval; index ++) {
- MeshDeformSaveSetClass::DEFORM_DATA &data = set_save->Get_Deform_Data (keyframe_index, index);
-
- //
- // If the color is not 'white' then we will
- // modify the DCG array.
- //
- if ((data.color.x != 1) ||
- (data.color.y != 1) ||
- (data.color.z != 1)) {
- retval = true;
- }
- }
- }
- }
- }
-
- // Return the true/false result code
- return retval;
-}
diff --git a/Generals/Code/Tools/WW3D/max2w3d/MeshDeformSave.h b/Generals/Code/Tools/WW3D/max2w3d/MeshDeformSave.h
deleted file mode 100644
index 03e2c50d36e..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/MeshDeformSave.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/* $Header: /Commando/Code/Tools/max2w3d/MeshDeformSave.h 4 7/07/99 11:52a Patrick $ */
-/***********************************************************************************************
- *** Confidential - Westwood Studios ***
- ***********************************************************************************************
- * *
- * Project Name : Commando / G 3D engine *
- * *
- * File Name : MeshDeformSafe.H
- * *
- * Programmer : Patrick Smith *
- * *
- * Start Date : 05/28/99 *
- * *
- * Last Update :
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#ifndef __MESH_DEFORM_SAVE_H
-#define __MESH_DEFORM_SAVE_H
-
-#include
-#include "Vector.H"
-
-// Forward declarations
-class ChunkSaveClass;
-class MeshDeformModData;
-class MeshDeformSaveSetClass;
-class MeshBuilderClass;
-class MeshDeformSaveSetClass;
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Typdefs
-//
-///////////////////////////////////////////////////////////////////////////
-typedef DynamicVectorClass DEFORM_SAVE_LIST;
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// MeshDeformSaveClass
-//
-///////////////////////////////////////////////////////////////////////////
-class MeshDeformSaveClass
-{
- public:
-
- //////////////////////////////////////////////////////////////////////
- // Public constructors/destructors
- //////////////////////////////////////////////////////////////////////
- MeshDeformSaveClass (void)
- : m_AlphaPasses (0) { }
- ~MeshDeformSaveClass (void) { Reset (); }
-
- //////////////////////////////////////////////////////////////////////
- // Public methods
- //////////////////////////////////////////////////////////////////////
- void Initialize (MeshBuilderClass &builder, Object *object, Mesh &mesh, Matrix3 *transform = NULL);
- void Initialize (MeshBuilderClass &builder, Mesh &mesh, MeshDeformModData &mod_data, Matrix3 *transform = NULL);
-
- //void Re_Index (MeshBuilderClass &builder);
- bool Export (ChunkSaveClass &chunk_save);
-
- void Reset (void);
- bool Is_Empty (void) const { return m_DeformSets.Count () == 0; }
-
- bool Does_Deformer_Modify_DCG (void);
-
- unsigned int Get_Alpha_Passes (void) const { return m_AlphaPasses; }
- void Set_Alpha_Passes (unsigned int pass_mask) { m_AlphaPasses = pass_mask; }
-
- protected:
-
- //////////////////////////////////////////////////////////////////////
- // Protected methods
- //////////////////////////////////////////////////////////////////////
- bool Export_Sets (ChunkSaveClass &chunk_save);
- bool Export_Keyframes (ChunkSaveClass &chunk_save, MeshDeformSaveSetClass &set_save);
-
- private:
-
- //////////////////////////////////////////////////////////////////////
- // Private member data
- //////////////////////////////////////////////////////////////////////
- DEFORM_SAVE_LIST m_DeformSets;
- unsigned int m_AlphaPasses;
-};
-
-#endif //__MESH_DEFORM_SAVE_H
diff --git a/Generals/Code/Tools/WW3D/max2w3d/MeshDeformSaveDefs.h b/Generals/Code/Tools/WW3D/max2w3d/MeshDeformSaveDefs.h
deleted file mode 100644
index 1b3b1ccab14..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/MeshDeformSaveDefs.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** Confidential - Westwood Studios ***
- ***********************************************************************************************
- * *
- * Project Name : Commando / G 3D engine *
- * *
- * File Name : MeshDeformData.cpp *
- * *
- * Programmer : Patrick Smith *
- * *
- * Start Date : 06/07/99 *
- * *
- * Last Update :
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#ifndef __MESH_DEFORM_SAVE_DEFS_H
-#define __MESH_DEFORM_SAVE_DEFS_H
-
-#include
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Constants
-//
-///////////////////////////////////////////////////////////////////////////
-typedef enum
-{
- DEFORM_CHUNK_INFO = 0x000000001,
- DEFORM_CHUNK_SET_INFO,
- DEFORM_CHUNK_KEYFRAME_INFO,
- DEFORM_CHUNK_POSITION_DATA,
- DEFORM_CHUNK_POSITION_VERTS,
- DEFORM_CHUNK_COLOR_DATA,
- DEFORM_CHUNK_COLOR_VERTS
-} DEFORM_CHUNK_IDS;
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Structures
-//
-///////////////////////////////////////////////////////////////////////////
-
-//
-// Deform information. Each mesh can have sets of keyframes of
-// deform info associated with it.
-//
-struct DeformChunk
-{
- uint32 SetCount;
- uint32 reserved[4];
-};
-
-//
-// Deform set information. Each set is made up of a series
-// of keyframes.
-//
-struct DeformChunkSetInfo
-{
- uint32 KeyframeCount;
- uint32 flags;
- uint32 NumVerticies;
- uint32 NumVertexColors;
- uint32 reserved[2];
-};
-
-#define DEFORM_SET_MANUAL_DEFORM 0x00000001 // set is isn't applied during sphere or point tests.
-
-//
-// Deform keyframe information. Each keyframe is made up of
-// a set of per-vert deform data.
-//
-struct DeformChunkKeyframeInfo
-{
- float32 DeformPercent;
- uint32 VertexCount;
- uint32 ColorCount;
- uint32 reserved[2];
-};
-
-//
-// Deform data. Contains deform information about a vertex
-// in the mesh.
-//
-struct DeformDataChunk
-{
- uint32 VertexIndex;
- uint32 ColorIndex;
- Point3 Value;
- uint32 reserved[2];
-};
-
-
-#endif //__MESH_DEFORM_SAVE_DEFS_H
diff --git a/Generals/Code/Tools/WW3D/max2w3d/MeshDeformSaveSet.cpp b/Generals/Code/Tools/WW3D/max2w3d/MeshDeformSaveSet.cpp
deleted file mode 100644
index 9992ddb153b..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/MeshDeformSaveSet.cpp
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/* $Header: /Commando/Code/Tools/max2w3d/MeshDeformSaveSet.cpp 2 6/16/99 6:56p Patrick $ */
-/***********************************************************************************************
- *** Confidential - Westwood Studios ***
- ***********************************************************************************************
- * *
- * Project Name : Commando / G 3D engine *
- * *
- * File Name : MeshDeformSaveSet.CPP
- * *
- * Programmer : Patrick Smith *
- * *
- * Start Date : 05/28/99 *
- * *
- * Last Update :
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#include "MeshDeformSaveSet.h"
-#include "util.h"
-
-
-////////////////////////////////////////////////////////////////////////
-//
-// Reset
-//
-////////////////////////////////////////////////////////////////////////
-void
-MeshDeformSaveSetClass::Reset (void)
-{
- //
- // Free all the keyframe pointers in our list
- //
- for (int index = 0; index < m_DeformData.Count (); index ++) {
- SAFE_DELETE (m_DeformData[index]);
- }
-
- m_DeformData.Delete_All ();
- m_CurrentKeyFrame = NULL;
- return ;
-}
-
-
-////////////////////////////////////////////////////////////////////////
-//
-// Begin_Keyframe
-//
-////////////////////////////////////////////////////////////////////////
-void
-MeshDeformSaveSetClass::Begin_Keyframe (float state)
-{
- //
- // Allocate a new keyframe structure
- //
- m_CurrentKeyFrame = new KEYFRAME;
- m_CurrentKeyFrame->state = state;
-
- //
- // Add this new keyframe to the end of our list
- //
- m_DeformData.Add (m_CurrentKeyFrame);
- return ;
-}
-
-
-////////////////////////////////////////////////////////////////////////
-//
-// End_Keyframe
-//
-////////////////////////////////////////////////////////////////////////
-void
-MeshDeformSaveSetClass::End_Keyframe (void)
-{
- m_CurrentKeyFrame = NULL;
- return ;
-}
-
-
-////////////////////////////////////////////////////////////////////////
-//
-// Add_Vert
-//
-////////////////////////////////////////////////////////////////////////
-void
-MeshDeformSaveSetClass::Add_Vert
-(
- UINT vert_index,
- const Point3 & position,
- const VertColor & color
-)
-{
- // State OK?
- assert (m_CurrentKeyFrame != NULL);
- if (m_CurrentKeyFrame != NULL) {
-
- //
- // Create a structure that will hold the
- // vertex information.
- //
- DEFORM_DATA data;
- data.vert_index = vert_index;
- data.position = position;
- data.color = color;
-
- //
- // Add this vertex information to the keyframe list
- //
- m_CurrentKeyFrame->deform_list.Add (data);
- }
-
- return ;
-}
-
-
-////////////////////////////////////////////////////////////////////////
-//
-// Replace_Deform_Data
-//
-////////////////////////////////////////////////////////////////////////
-void
-MeshDeformSaveSetClass::Replace_Deform_Data
-(
- int keyframe_index,
- DynamicVectorClass &list
-)
-{
- KEYFRAME *key_frame = m_DeformData[keyframe_index];
- if (key_frame != NULL) {
-
- //
- // Replace the vertex deformation list for the keyframe
- //
- key_frame->deform_list.Delete_All ();
- key_frame->deform_list = list;
- }
-
- return ;
-}
-
-
-////////////////////////////////////////////////////////////////////////
-//
-// Get_Deform_Count
-//
-////////////////////////////////////////////////////////////////////////
-/*int
-MeshDeformSaveSetClass::Get_Deform_Count (void) const
-{
- //
- // Count up all the deform entries for all the keyframes
- //
- int count = 0;
- for (int index = 0; index < m_DeformData.Count (); index ++) {
- KEYFRAME *key_frame = m_DeformData[index];
- if (key_frame != NULL) {
- count += key_frame->deform_list.Count ();
- }
- }
-
- return count;
-}*/
-
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/MeshDeformSaveSet.h b/Generals/Code/Tools/WW3D/max2w3d/MeshDeformSaveSet.h
deleted file mode 100644
index 59de050ca19..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/MeshDeformSaveSet.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/* $Header: /Commando/Code/Tools/max2w3d/MeshDeformSaveSet.h 2 6/16/99 6:56p Patrick $ */
-/***********************************************************************************************
- *** Confidential - Westwood Studios ***
- ***********************************************************************************************
- * *
- * Project Name : Commando / G 3D engine *
- * *
- * File Name : MeshDeformSaveSet.H
- * *
- * Programmer : Patrick Smith *
- * *
- * Start Date : 05/28/99 *
- * *
- * Last Update :
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#ifndef __MESH_DEFORM_SAVE_SET_H
-#define __MESH_DEFORM_SAVE_SET_H
-
-#include
-#include "Vector.H"
-
-// Forward declarations
-class ChunkSaveClass;
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// MeshDeformSaveSetClass
-//
-///////////////////////////////////////////////////////////////////////////
-class MeshDeformSaveSetClass
-{
- public:
-
- //////////////////////////////////////////////////////////////////////
- // Public friends
- //////////////////////////////////////////////////////////////////////
- friend class MeshDeformSaveClass;
-
-
- protected:
-
- protected:
-
- //////////////////////////////////////////////////////////////////////
- // Protected data types
- //////////////////////////////////////////////////////////////////////
- typedef struct _DEFORM_DATA
- {
- UINT vert_index;
- Point3 position;
- VertColor color;
-
- // Don't care, DynamicVectorClass needs these
- bool operator== (const _DEFORM_DATA &src) { return false; }
- bool operator!= (const _DEFORM_DATA &src) { return true; }
- } DEFORM_DATA;
-
- //////////////////////////////////////////////////////////////////////
- // Protected data types
- //////////////////////////////////////////////////////////////////////
- typedef struct
- {
- float state;
- DynamicVectorClass deform_list;
- } KEYFRAME;
-
-
-public:
-
- //////////////////////////////////////////////////////////////////////
- // Public constructors/destructors
- //////////////////////////////////////////////////////////////////////
- MeshDeformSaveSetClass (void)
- : m_Flags (0),
- m_CurrentKeyFrame (NULL) { }
- ~MeshDeformSaveSetClass (void) { Reset (); }
-
- //////////////////////////////////////////////////////////////////////
- // Public methods
- //////////////////////////////////////////////////////////////////////
-
- // Keyframe managment
- void Begin_Keyframe (float state);
- void End_Keyframe (void);
-
- // Vertex managment
- void Add_Vert (UINT vert_index, const Point3 &position, const VertColor &color);
-
- // Misc
- void Reset (void);
- bool Is_Empty (void) const { return m_DeformData.Count () == 0; }
-
- // Flag support
- bool Get_Flag (unsigned int flag) const { return (m_Flags & flag) == flag; }
- void Set_Flag (unsigned int flag, bool value) { if (value) (m_Flags |= flag); else (m_Flags &= ~flag); }
- unsigned int Get_Flags (void) const { return m_Flags; }
-
- // Enumeration
- float Get_Deform_State (int key_frame) const { return m_DeformData[key_frame]->state; }
- int Get_Keyframe_Count (void) const { return m_DeformData.Count (); }
- int Get_Deform_Data_Count (int key_frame) const { return m_DeformData[key_frame]->deform_list.Count (); }
- DEFORM_DATA & Get_Deform_Data (int key_frame, int index) { return m_DeformData[key_frame]->deform_list[index]; }
- void Replace_Deform_Data (int keyframe_index, DynamicVectorClass &list);
-
- private:
-
- //////////////////////////////////////////////////////////////////////
- // Private member data
- //////////////////////////////////////////////////////////////////////
- DynamicVectorClass m_DeformData;
- KEYFRAME * m_CurrentKeyFrame;
- unsigned int m_Flags;
-};
-
-#endif //__MESH_DEFORM_SAVE_SET_H
diff --git a/Generals/Code/Tools/WW3D/max2w3d/MeshDeformSet.cpp b/Generals/Code/Tools/WW3D/max2w3d/MeshDeformSet.cpp
deleted file mode 100644
index aa6088ff087..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/MeshDeformSet.cpp
+++ /dev/null
@@ -1,1534 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** Confidential - Westwood Studios ***
- ***********************************************************************************************
- * *
- * Project Name : Commando / G 3D engine *
- * *
- * File Name : MeshDeformSet.cpp *
- * *
- * Programmer : Patrick Smith *
- * *
- * Start Date : 04/26/99 *
- * *
- * Last Update :
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#include "MeshDeformSet.h"
-#include "util.h"
-#include "MeshDeformSaveSet.h"
-#include "meshbuild.h"
-#include "MeshDeformSaveDefs.h"
-#include "MeshDeformDefs.h"
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Constants
-//
-///////////////////////////////////////////////////////////////////////////
-const int MAX_DEFORM_KEY_FRAMES = 10;
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// ~MeshDeformSetClass
-//
-///////////////////////////////////////////////////////////////////////////
-MeshDeformSetClass::~MeshDeformSetClass (void)
-{
- SAFE_DELETE (m_pMesh);
- SAFE_DELETE (m_pVertexArray);
- SAFE_DELETE (m_pVertexOPStartArray);
- SAFE_DELETE (m_pVertexColors);
- Free_Key_Frames ();
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Set_Current_Key_Frame
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformSetClass::Set_Current_Key_Frame (int index)
-{
- if (index >= -1 && index < MAX_DEFORM_KEY_FRAMES) {
- m_CurrentKeyFrame = index;
- }
-
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Set_Vertex_Position
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformSetClass::Set_Vertex_Position
-(
- int index,
- const Point3 & value
-)
-{
- DEFORM_LIST &verticies = m_KeyFrames[m_CurrentKeyFrame]->verticies;
- BitArray &affected_verts = m_KeyFrames[m_CurrentKeyFrame]->affected_verts;
-
- //
- // Set the vert's position
- //
- m_pMesh->verts[index] = value;
- verticies.Add (VERT_INFO (index, value));
-
- //
- // Make sure we remember that this vert is affected
- //
- affected_verts.Set (index, 1);
- m_SetMembers.Set (index, 1);
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Set_Vertex_Color
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformSetClass::Set_Vertex_Color
-(
- int index,
- int color_index,
- const VertColor & value
-)
-{
- DEFORM_LIST &colors = m_KeyFrames[m_CurrentKeyFrame]->colors;
- BitArray &affected_colors = m_KeyFrames[m_CurrentKeyFrame]->affected_colors;
-
- //
- // Set the vert's color
- //
- m_pMesh->vertCol[color_index] = value;
- colors.Add (VERT_INFO (index, value, color_index));
-
- //
- // Make sure we remember that this vert color is affected
- //
- affected_colors.Set (index, 1);
- m_SetMembers.Set (index, 1);
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Update_Set_Members
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformSetClass::Update_Set_Members (void)
-{
- //
- // Examine each keyframe
- //
- m_SetMembers.ClearAll ();
- for (int index = 0; index < m_KeyFrames.Count (); index ++) {
- BitArray &affected_verts = m_KeyFrames[index]->affected_verts;
- BitArray &affected_colors = m_KeyFrames[index]->affected_colors;
-
- //
- // Mark the verts that are affected by this keyframe
- //
- for (int vert = 0; vert < m_VertexCount; vert ++) {
- if (affected_verts[vert] || affected_colors[vert]) {
- m_SetMembers.Set (vert, 1);
- }
- }
- }
-
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Collapse_Keyframe_Data
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformSetClass::Collapse_Keyframe_Data (int keyframe)
-{
- DEFORM_LIST &verticies = m_KeyFrames[keyframe]->verticies;
- DEFORM_LIST &colors = m_KeyFrames[keyframe]->colors;
- BitArray &affected_verts = m_KeyFrames[keyframe]->affected_verts;
- BitArray &affected_colors = m_KeyFrames[keyframe]->affected_colors;
-
- //
- // Collapse the vertex position data
- //
- for (int index = 0; index < verticies.Count (); index ++) {
- VERT_INFO &info = verticies[index];
-
- //
- // If this vertex is unchanged, then remove it
- // from the list.
- //
- if (m_pVertexArray[index] == info.value) {
- verticies.Delete (index);
- index --;
- } else {
- affected_verts.Set (info.index, 1);
- m_SetMembers.Set (info.index, 1);
- }
- }
-
-
- //
- // Collapse the vertex color data
- //
- for (index = 0; index < colors.Count (); index ++) {
- VERT_INFO &info = colors[index];
-
- //
- // If this vertex is unchanged, then remove it
- // from the list.
- //
- if (m_pVertexColors[index] == info.value) {
- verticies.Delete (index);
- index --;
- } else {
- affected_colors.Set (info.index, 1);
- m_SetMembers.Set (info.index, 1);
- }
- }
-
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Reset_Key_Frame_Verts
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformSetClass::Reset_Key_Frame_Verts (int keyframe)
-{
- DEFORM_LIST &verticies = m_KeyFrames[keyframe]->verticies;
- BitArray &affected_verts = m_KeyFrames[keyframe]->affected_verts;
-
- //
- // Reset all data for this keyframe
- //
- affected_verts.ClearAll ();
- verticies.Delete_All ();
-
- //
- // Regenerate the list of set members
- //
- Update_Set_Members ();
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Reset_Key_Frame_Colors
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformSetClass::Reset_Key_Frame_Colors (int keyframe)
-{
- DEFORM_LIST &colors = m_KeyFrames[keyframe]->colors;
- BitArray &affected_colors = m_KeyFrames[keyframe]->affected_colors;
-
- //
- // Reset all data for this keyframe
- //
- affected_colors.ClearAll ();
- colors.Delete_All ();
-
- //
- // Regenerate the list of set members
- //
- Update_Set_Members ();
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Update_Current_Data
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformSetClass::Update_Current_Data (void)
-{
- DEFORM_LIST &verticies = m_KeyFrames[m_CurrentKeyFrame]->verticies;
- DEFORM_LIST &colors = m_KeyFrames[m_CurrentKeyFrame]->colors;
- BitArray &affected_verts = m_KeyFrames[m_CurrentKeyFrame]->affected_verts;
- BitArray &affected_colors = m_KeyFrames[m_CurrentKeyFrame]->affected_colors;
-
- //
- // Assume we have no modifications for this keyframe
- //
- affected_verts.ClearAll ();
- affected_colors.ClearAll ();
- verticies.Delete_All ();
- colors.Delete_All ();
-
- //
- // Record the vertex position data
- //
- for (int index = 0; index < m_VertexCount; index ++) {
-
- // Is this vertex's position different than the undeformed mesh?
- Point3 orig = m_pVertexArray[index];
- Point3 current = m_pMesh->verts[index];
-
- //Apply_Position_Changes (index, m_CurrentKeyFrame, orig);
-
- if ( (orig.x != current.x) ||
- (orig.y != current.y) ||
- (orig.z != current.z)) {
-
- //
- // Record this vertex's position in our lists
- //
- affected_verts.Set (index, 1);
- verticies.Add (VERT_INFO (index, m_pMesh->verts[index]));
- }
- }
-
- // Only do this if the mesh is using vertex coloring
- if (m_pMesh->numCVerts >= m_pMesh->numVerts) {
-
- //
- // Record the vertex color data
- //
- for (int face = 0; face < m_pMesh->numFaces; face ++) {
- for (int vert = 0; vert < 3; vert ++) {
-
- //
- // Has this vertex color changed?
- //
- int vertex_index = m_pMesh->faces[face].v[vert];
- int color_index = m_pMesh->vcFace[face].t[vert];
- VertColor orig = m_pVertexColors[color_index];
- VertColor current = m_pMesh->vertCol[color_index];
- if ( (orig.x != current.x) ||
- (orig.y != current.y) ||
- (orig.z != current.z)) {
- affected_colors.Set (vertex_index, 1);
- colors.Add (VERT_INFO (vertex_index, m_pMesh->vertCol[color_index], color_index));
- }
- }
- }
- }
-
- //
- // Rebuild the list of verticies this 'set' affects
- //
- Update_Set_Members ();
-
- //
- // Collapse all unsused data from the remainder of the keyframes
- //
- for (index = 0; index < m_KeyFrames.Count (); index ++) {
- //Collapse_Keyframe_Data (index);
- }
-
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Update_Key_Frame
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformSetClass::Update_Key_Frame (int key_frame)
-{
- DEFORM_LIST &verticies = m_KeyFrames[key_frame]->verticies;
- DEFORM_LIST &colors = m_KeyFrames[key_frame]->colors;
- BitArray &affected_verts = m_KeyFrames[key_frame]->affected_verts;
- BitArray &affected_colors = m_KeyFrames[key_frame]->affected_colors;
-
- if ((key_frame == m_CurrentKeyFrame) ||
- (verticies.Count () > 0) ||
- (colors.Count () > 0)) {
-
- // Clear all entries from this keyframe
- verticies.Delete_All ();
- colors.Delete_All ();
-
- //
- // Copy the vertex position changes
- //
- for (int vert = 0; vert < m_pMesh->numVerts; vert ++) {
- if (affected_verts[vert]) {
- verticies.Add (VERT_INFO (vert, m_pMesh->verts[vert]));
- }
- }
-
- //
- // Copy the vertex color changes
- //
-
- // Only do this if the mesh is using vertex coloring
- if (m_pMesh->numCVerts >= m_pMesh->numVerts) {
- for (int face = 0; face < m_pMesh->numFaces; face ++) {
-
- if (affected_colors[m_pMesh->faces[face].v[0]]) {
- int color_index = m_pMesh->vcFace[face].t[0];
- colors.Add (VERT_INFO (m_pMesh->faces[face].v[0], m_pMesh->vertCol[color_index], color_index));
- }
-
- if (affected_colors[m_pMesh->faces[face].v[1]]) {
- int color_index = m_pMesh->vcFace[face].t[1];
- colors.Add (VERT_INFO (m_pMesh->faces[face].v[1], m_pMesh->vertCol[color_index], color_index));
- }
-
- if (affected_colors[m_pMesh->faces[face].v[2]]) {
- int color_index = m_pMesh->vcFace[face].t[2];
- colors.Add (VERT_INFO (m_pMesh->faces[face].v[2], m_pMesh->vertCol[color_index], color_index));
- }
- }
- }
- }
-
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Init_Key_Frames
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformSetClass::Init_Key_Frames (void)
-{
- //
- // For now, add all the key frames upfront
- //
- for (int index = 0; index < MAX_DEFORM_KEY_FRAMES; index ++) {
- KEY_FRAME *key_frame = new KEY_FRAME;
- m_KeyFrames.Add (key_frame);
- }
-
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Free_Key_Frames
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformSetClass::Free_Key_Frames (void)
-{
- //
- // Loop through and free all the key frames
- //
- for (int index = 0; index < m_KeyFrames.Count (); index ++) {
- KEY_FRAME *key_frame = m_KeyFrames[index];
- SAFE_DELETE (key_frame);
- }
-
- m_KeyFrames.Delete_All ();
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Copy_Vertex_Array
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformSetClass::Copy_Vertex_Array (Mesh &mesh)
-{
- Resize_Vertex_Array (mesh.numVerts, mesh.numCVerts);
-
- //
- // Copy the vertex positions from the mesh
- //
- for (int vert = 0; vert < mesh.numVerts; vert ++) {
- m_pVertexArray[vert] = mesh.verts[vert];
- }
-
- //
- // Copy the vertex colors from the mesh
- //
- for (int index = 0; index < mesh.numCVerts; index ++) {
- m_pVertexColors[index] = mesh.vertCol[index];
- }
-
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Resize_Vertex_Array
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformSetClass::Resize_Vertex_Array (int count, int color_count)
-{
- if (count != m_VertexCount) {
-
- // Allocate a new array of verticies
- Point3 *vertex_array = new Point3[count];
- Point3 *opstart_array = new Point3[count];
-
- // Delete the old vertex array and remember the new one
- SAFE_DELETE (m_pVertexArray);
- SAFE_DELETE (m_pVertexOPStartArray);
- m_pVertexArray = vertex_array;
- m_pVertexOPStartArray = opstart_array;
- m_VertexCount = count;
-
- //
- // Reset the bounds of the 'affected verts' per keyframe arrays
- //
- for (int index = 0; index < m_KeyFrames.Count (); index ++) {
- m_KeyFrames[index]->affected_verts.SetSize (count);
- m_KeyFrames[index]->affected_colors.SetSize (count);
- m_KeyFrames[index]->affected_verts.ClearAll ();
- m_KeyFrames[index]->affected_colors.ClearAll ();
-
- }
-
- m_SetMembers.SetSize (count);
- m_SetMembers.ClearAll ();
- }
-
- if (color_count != m_VertexColorCount) {
-
- // Recreate the color deltas
- Point3 *color_array = new VertColor[color_count];
- for (int index = 0; index < color_count; index ++) {
- color_array[index].x = 0;
- color_array[index].y = 0;
- color_array[index].z = 0;
- }
-
- // Delete the old delta array and remeber the new one
- SAFE_DELETE (m_pVertexColors);
- m_VertexColorCount = color_count;
- m_pVertexColors = color_array;
- }
-
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Set_State
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformSetClass::Set_State (float state)
-{
- m_State = state;
- int key_frame = (m_State * MAX_DEFORM_KEY_FRAMES) + 0.5F;
- Set_Current_Key_Frame ((key_frame >= 0) ? (key_frame - 1) : -1);
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Determine_Interpolation_Indicies
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformSetClass::Determine_Interpolation_Indicies
-(
- int key_frame,
- bool position,
- int & from,
- int & to,
- float & state
-)
-{
- /*state = m_State;
- from = -1;
- to = key_frame;
-
- //
- // Determine where we should start interpolation
- //
- for (int index = 0; index <= key_frame; index ++) {
- if (position && m_KeyFrames[index]->verticies.Count () > 0) {
- from = index;
- } else if (!position && m_KeyFrames[index]->colors.Count () > 0) {
- from = index;
- }
- }
-
- //
- // Determine where we should end interpolation
- //
- for (index = to; index < MAX_DEFORM_KEY_FRAMES; index ++) {
- if (position && m_KeyFrames[index]->verticies.Count () > 0) {
- to = index;
- break;
- } else if (!position && m_KeyFrames[index]->colors.Count () > 0) {
- to = index;
- break;
- }
- }
-
- //
- // Determine the state (deformation percent)
- //
- state = 0;
- if (m_State > 0) {
- state = 1.0F;
- if ((to != from) && (m_CurrentKeyFrame < to)) {
- float value = m_CurrentKeyFrame;//key_frame;
- state = ((value - ((float)from)) / (float)(to-from));
- }
- }*/
-
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Apply_Position_Changes
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformSetClass::Apply_Position_Changes
-(
- UINT vert,
- int frame_to_check,
- Point3 & position,
- Matrix3 *transform
-)
-{
- //
- // Determine where we should start interpolating this vert
- //
- int from = -1;
- for (int key_frame = frame_to_check; (key_frame >= 0) && (from == -1); key_frame --) {
- if (m_KeyFrames[key_frame]->affected_verts[vert]) {
- from = key_frame;
- }
- }
-
- //
- // Determine where we should end interpolating this vert
- //
- int to = -1;
- if (frame_to_check >= 0) {
- for (key_frame = frame_to_check; (key_frame < m_KeyFrames.Count ()) && (to == -1); key_frame ++) {
- if (m_KeyFrames[key_frame]->affected_verts[vert]) {
- to = key_frame;
- }
- }
- }
-
- //
- // Determine the deformation percent
- //
- float state = 0;
- if (m_State > 0) {
- state = 1.0F;
- if ((to != from) && (frame_to_check < to)) {
- float value = frame_to_check;
- state = ((value - ((float)from)) / (float)(to - from));
- }
- }
-
- if (from != -1) {
-
- //
- // Find the vertex value in the 'from' key frame and set the
- // triangle object's vertex to be this value (we will interplate from it).
- //
- DEFORM_LIST &vert_from = m_KeyFrames[from]->verticies;
- for (int index = 0; index < vert_from.Count (); index ++) {
- VERT_INFO &info = vert_from[index];
- if (info.index == vert) {
- Point3 new_pos = info.value;
-
- // Transform the new position if necessary
- if (transform != NULL) {
- new_pos = new_pos * (*transform);
- }
-
- position = new_pos;
- }
- }
- }
-
- if (to != -1) {
-
- //
- // Find the vertex value in the 'to' key frame and interpolate
- // this value from the triangle object's current vertex value.
- //
- DEFORM_LIST &vert_to = m_KeyFrames[to]->verticies;
- for (int index = 0; index < vert_to.Count (); index ++) {
- VERT_INFO &info = vert_to[index];
- if (info.index == vert) {
-
- Point3 new_pos = info.value;
-
- // Transform the new position if necessary
- if (transform != NULL) {
- new_pos = new_pos * (*transform);
- }
-
- position += state * (new_pos - position);
- //m_pMesh->verts[vert] = position;
- }
- }
- }
-
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Apply_Color_Changes
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformSetClass::Apply_Color_Changes
-(
- UINT vert,
- int frame_to_check,
- Mesh & mesh
- //VertColor & color
-)
-{
- //
- // Determine where we should start interpolating this vert
- //
- int from = -1;
- for (int key_frame = frame_to_check; (key_frame >= 0) && (from == -1); key_frame --) {
- if (m_KeyFrames[key_frame]->affected_colors[vert]) {
- from = key_frame;
- }
- }
-
- //
- // Determine where we should end interpolating this vert
- //
- int to = -1;
- if (frame_to_check >= 0) {
- for (key_frame = frame_to_check; (key_frame < m_KeyFrames.Count ()) && (to == -1); key_frame ++) {
- if (m_KeyFrames[key_frame]->affected_colors[vert]) {
- to = key_frame;
- }
- }
- }
-
- //
- // Determine the deformation percent
- //
- float state = 0;
- if (m_State > 0) {
- state = 1.0F;
- if ((to != from) && (frame_to_check < to)) {
- float value = frame_to_check;
- state = ((value - ((float)from)) / (float)(to - from));
- }
- }
-
- if (from != -1) {
-
- //
- // Find the color value in the 'from' key frame and set the
- // triangle object's color to be this value (we will interplate from it).
- //
- DEFORM_LIST &color_from = m_KeyFrames[from]->colors;
- for (int index = 0; index < color_from.Count (); index ++) {
- VERT_INFO &info = color_from[index];
- if (info.index == vert) {
- //color = info.value;
- mesh.vertCol[info.color_index] = info.value;
- m_pMesh->vertCol[info.color_index] = info.value;
- }
- }
- }
-
- if (to != -1) {
-
- //
- // Find the color value in the 'to' key frame and interpolate
- // this value from the triangle object's current color value.
- //
- DEFORM_LIST &color_to = m_KeyFrames[to]->colors;
- for (int index = 0; index < color_to.Count (); index ++) {
- VERT_INFO &info = color_to[index];
- if (info.index == vert) {
- mesh.vertCol[info.color_index] = m_pMesh->vertCol[info.color_index] + state * (info.value - m_pMesh->vertCol[info.color_index]);
- }
- }
- }
-
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Apply_Color_Changes
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformSetClass::Apply_Color_Changes
-(
- UINT vert_index,
- UINT vert_color_index,
- int frame_to_check,
- VertColor & color
-)
-{
- //
- // Determine where we should start interpolating this vert
- //
- int from = -1;
- for (int key_frame = frame_to_check; (key_frame >= 0) && (from == -1); key_frame --) {
- if (m_KeyFrames[key_frame]->affected_colors[vert_index]) {
- from = key_frame;
- }
- }
-
- //
- // Determine where we should end interpolating this vert
- //
- int to = -1;
- for (key_frame = frame_to_check; (key_frame < m_KeyFrames.Count ()) && (to == -1); key_frame ++) {
- if (m_KeyFrames[key_frame]->affected_colors[vert_index]) {
- to = key_frame;
- }
- }
-
- //
- // Determine the deformation percent
- //
- float state = 0;
- if (m_State > 0) {
- state = 1.0F;
- if ((to != from) && (frame_to_check < to)) {
- float value = frame_to_check;
- state = ((value - ((float)from)) / (float)(to - from));
- }
- }
-
- if (from != -1) {
-
- //
- // Find the color value in the 'from' key frame and set the
- // triangle object's color to be this value (we will interplate from it).
- //
- DEFORM_LIST &color_from = m_KeyFrames[from]->colors;
- for (int index = 0; index < color_from.Count (); index ++) {
- VERT_INFO &info = color_from[index];
- if (info.color_index == vert_color_index) {
- color = info.value;
- break;
- }
- }
- }
-
- if (to != -1) {
-
- //
- // Find the color value in the 'to' key frame and interpolate
- // this value from the triangle object's current color value.
- //
- DEFORM_LIST &color_to = m_KeyFrames[to]->colors;
- for (int index = 0; index < color_to.Count (); index ++) {
- VERT_INFO &info = color_to[index];
- if (info.color_index == vert_color_index) {
- color += state * (info.value - color);
- break;
- }
- }
- }
-
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Update_Mesh
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformSetClass::Update_Mesh (TriObject &tri_obj)
-{
- Copy_Vertex_Array (tri_obj.mesh);
-
- // Should we update the mesh or copy it?
- if (m_pMesh != NULL) {
-
- //
- // Copy the vertex colors from the triangle object
- //
- for (int vert_color = 0; vert_color < m_pMesh->numCVerts; vert_color ++) {
- m_pMesh->vertCol[vert_color] = tri_obj.mesh.vertCol[vert_color];
- }
-
- //
- // Loop through all the verticies and interpolate their
- // positions and colors based on the current 'deformation state'.
- //
- for (UINT vert = 0; vert < (UINT)m_pMesh->numVerts; vert ++) {
-
- // Is this vertex affected by any keyframe in the set?
- if (m_SetMembers[vert]) {
-
- // Interpolate any changes to this vert
- Apply_Position_Changes (vert, m_CurrentKeyFrame, tri_obj.mesh.verts[vert]);
- m_pMesh->verts[vert] = tri_obj.mesh.verts[vert];
- Apply_Color_Changes (vert, m_CurrentKeyFrame, tri_obj.mesh);
- }
- }
-
- //
- // Copy the vertex colors from the triangle object
- //
- for (vert_color = 0; vert_color < m_pMesh->numCVerts; vert_color ++) {
- m_pMesh->vertCol[vert_color] = tri_obj.mesh.vertCol[vert_color];
- }
-
-
- /*for (int index = 0; index < m_pMesh->numCVerts; index ++) {
- m_pMesh->vertCol[index] = tri_obj.mesh.vertCol[index];
- }
-
- //
- for (int key_frame = 0; key_frame < m_KeyFrames.Count (); key_frame ++) {
-
- //
- // Update the verticies
- //
-
- int from = 0;
- int to = 0;
- float state = 0;
- Determine_Interpolation_Indicies (key_frame, true, from, to, state);
- DEFORM_LIST &vert_to = m_KeyFrames[to]->verticies;
-
- if (from <= m_CurrentKeyFrame) {
-
- if (from >= 0) {
- DEFORM_LIST &vert_from = m_KeyFrames[from]->verticies;
- for (int index = 0; index < vert_from.Count (); index ++) {
- VERT_INFO &info = vert_from[index];
- tri_obj.mesh.verts[info.index] = info.value;
- }
- } else {
-
- for (int index = 0; index < vert_to.Count (); index ++) {
- VERT_INFO &info = vert_to[index];
- tri_obj.mesh.verts[info.index] = m_pVertexArray[info.index];
- }
- }
-
- for (int index = 0; index < vert_to.Count (); index ++) {
- VERT_INFO &info = vert_to[index];
- tri_obj.mesh.verts[info.index] += state * (info.value - tri_obj.mesh.verts[info.index]);
- m_pMesh->verts[info.index] = tri_obj.mesh.verts[info.index];
- }
- }
-
- //
- // Update the vertex colors
- //
- Determine_Interpolation_Indicies (key_frame, false, from, to, state);
- DEFORM_LIST &color_to = m_KeyFrames[to]->colors;
-
- if (from <= m_CurrentKeyFrame) {
-
- if (from >= 0) {
- DEFORM_LIST &color_from = m_KeyFrames[from]->colors;
- for (int index = 0; index < color_from.Count (); index ++) {
- VERT_INFO &info = color_from[index];
- tri_obj.mesh.vertCol[info.index] = info.value;
- }
- } else {
-
- for (index = 0; index < color_to.Count (); index ++) {
- VERT_INFO &info = color_to[index];
- tri_obj.mesh.vertCol[info.index] = m_pMesh->vertCol[info.index];
- }
- }
-
- for (index = 0; index < color_to.Count (); index ++) {
- VERT_INFO &info = color_to[index];
- tri_obj.mesh.vertCol[info.index] = m_pMesh->vertCol[info.index] + state * (info.value - m_pMesh->vertCol[info.index]);
- //tri_obj.mesh.vertCol[info.index] += state * (info.value - tri_obj.mesh.vertCol[info.index]);
- }
- }
- }
-
- for (index = 0; index < m_pMesh->numCVerts; index ++) {
- m_pMesh->vertCol[index] = tri_obj.mesh.vertCol[index];
- }*/
-
-
-
-
-
- /*for (int vert = 0; vert < m_VertexCount; vert ++) {
- tri_obj.mesh.verts[vert] += (1.0F * m_pVertexDeltaArray[vert]);
- m_pMesh->verts[vert] = tri_obj.mesh.verts[vert];
- }
-
-
- //
- // Transform the vertex colors based on the current deform state
- //
- for (vert = 0; vert < m_VertexColorCount; vert ++) {
- tri_obj.mesh.vertCol[vert] += (1.0F * m_pVertexColors[vert]);
- }*/
-
- //
- // Pass the new selection onto the mesh
- //
- tri_obj.mesh.vertSel = m_pMesh->vertSel;
- tri_obj.PointsWereChanged ();
-
- } else {
-
- //
- // Make a copy of the mesh as it currently exists
- //
- m_pMesh = new Mesh (tri_obj.mesh);
- tri_obj.mesh.DeepCopy (m_pMesh, GEOM_CHANNEL | SELECT_CHANNEL | SUBSEL_TYPE_CHANNEL | VERTCOLOR_CHANNEL);
- }
-
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Update_Members
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformSetClass::Update_Members (DEFORM_CHANNELS flags)
-{
- assert (m_CurrentKeyFrame >= 0);
-
- //
- // Add all the selected verts to the set array
- //
- for (int vert = 0; vert < m_pMesh->numVerts; vert ++) {
- if (m_pMesh->vertSel[vert]) {
-
- //
- // Should we add this vertex to the array of deformed verts
- // the current keyframe?
- //
- if (flags & VERT_POSITION) {
- m_KeyFrames[m_CurrentKeyFrame]->affected_verts.Set (vert, 1);
- }
-
- //
- // Should we add this vertex to the array of deformed vertex colors
- // the current keyframe?
- //
- if (flags & VERT_COLORS) {
-
- m_KeyFrames[m_CurrentKeyFrame]->affected_colors.Set (vert, 1);
-
- //
- // Map indicies in the vertex color array to the vertex array.
- //
- /*if (m_pMesh->numCVerts >= m_pMesh->numVerts) {
- for (int face = 0; face < m_pMesh->numFaces; face ++) {
-
- if (m_pMesh->faces[face].v[0] == vert) {
- int color_index = m_pMesh->vcFace[face].t[0];
- m_KeyFrames[m_CurrentKeyFrame]->affected_colors.Set (color_index, 1);
- }
-
- if (m_pMesh->faces[face].v[1] == vert) {
- int color_index = m_pMesh->vcFace[face].t[1];
- m_KeyFrames[m_CurrentKeyFrame]->affected_colors.Set (color_index, 1);
- }
-
- if (m_pMesh->faces[face].v[2] == vert) {
- int color_index = m_pMesh->vcFace[face].t[2];
- m_KeyFrames[m_CurrentKeyFrame]->affected_colors.Set (color_index, 1);
- }
- }
- }*/
- }
-
- //
- // Finally, add this vertex to the list of all
- // verticies affected by this set.
- //
- m_SetMembers.Set (vert, 1);
- }
- }
-
- //r (int index = m_CurrentKeyFrame; index < MAX_DEFORM_KEY_FRAMES; index ++) {
- Update_Key_Frame (m_CurrentKeyFrame);
- //
-
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Select_Members
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformSetClass::Select_Members (void)
-{
- //
- // Loop through and select the necessary verts
- //
- for (int vert = 0; vert < m_pMesh->numVerts; vert ++) {
- m_pMesh->vertSel.Set (vert, m_SetMembers[vert]);
- }
-
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Restore_Members
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformSetClass::Restore_Members (void)
-{
-/*
- //
- // Loop through and select the necessary verts
- //
- for (int vert = 0; vert < m_pMesh->numVerts; vert ++) {
-
- if (m_SetMembers[vert]) {
-
- //
- // Restore the vertex positions
- //
- m_pMesh->verts[vert] = m_pVertexArray[vert];
- m_pVertexDeltaArray[vert].x = 0;
- m_pVertexDeltaArray[vert].y = 0;
- m_pVertexDeltaArray[vert].z = 0;
- }
- }
-
- //
- // Restore the vertex colors
- //
-
- // Only do this if the mesh is using vertex coloring
- if (m_pMesh->numCVerts >= m_pMesh->numVerts) {
- for (int face = 0; face < m_pMesh->numFaces; face ++) {
-
- if (m_SetMembers[m_pMesh->faces[face].v[0]]) {
- int color_index = m_pMesh->vcFace[face].t[0];
- m_pVertexColors[color_index].x = 0;
- m_pVertexColors[color_index].y = 0;
- m_pVertexColors[color_index].z = 0;
- }
-
- if (m_SetMembers[m_pMesh->faces[face].v[1]]) {
- int color_index = m_pMesh->vcFace[face].t[1];
- m_pVertexColors[color_index].x = 0;
- m_pVertexColors[color_index].y = 0;
- m_pVertexColors[color_index].z = 0;
- }
-
- if (m_SetMembers[m_pMesh->faces[face].v[2]]) {
- int color_index = m_pMesh->vcFace[face].t[2];
- m_pVertexColors[color_index].x = 0;
- m_pVertexColors[color_index].y = 0;
- m_pVertexColors[color_index].z = 0;
- }
- }
- }
-
-*/
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Is_Empty
-//
-///////////////////////////////////////////////////////////////////////////
-bool
-MeshDeformSetClass::Is_Empty (void) const
-{
- bool is_empty = true;
-
- //
- // If any vertex is 'selected' then this set is not empty.
- //
- for (int vert = 0; (vert < m_VertexCount) && is_empty; vert ++) {
- is_empty = (m_SetMembers[vert] == 0);
- }
-
- // Return the true/false result code
- return is_empty;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Save
-//
-///////////////////////////////////////////////////////////////////////////
-void
-MeshDeformSetClass::Save
-(
- MeshBuilderClass & builder,
- Mesh & mesh,
- MeshDeformSaveSetClass & save_set,
- Matrix3 * transform
-)
-{
- // Start fresh
- save_set.Reset ();
- save_set.Set_Flag (DEFORM_SET_MANUAL_DEFORM, (m_bAutoApply == false));
-
- //
- // Determine how much each state change (from 0 - 1)
- // is associated with each keyframe.
- //
- int key_frames = m_KeyFrames.Count ();
- float state_inc = 1.0F / ((float)key_frames);
- float old_state = m_State;
-
- //
- // Loop through all the keyframes
- //
- for (int key_frame = 0; key_frame < key_frames; key_frame ++) {
-
- //
- // Loop through all the verticies and see if this keyframe
- // modifies any of them
- //
- bool verts_affected = false;
- for (int vert = 0; (vert < m_VertexCount) && !verts_affected; vert ++) {
- verts_affected = (m_KeyFrames[key_frame]->affected_verts[vert] == 1);
- verts_affected |= (m_KeyFrames[key_frame]->affected_colors[vert] == 1);
- }
-
- //
- // If the keyframe modifies any of these verts, then save
- // the state of all verts in the set.
- //
- if (verts_affected) {
- m_State = state_inc * (key_frame + 1);
- save_set.Begin_Keyframe (m_State);
-
- //
- // Save the absolute state of all the verts and colors
- // at this keyframe.
- //
-
- for (int w3d_vert_index = 0; w3d_vert_index < builder.Get_Vertex_Count (); w3d_vert_index ++) {
-
- const MeshBuilderClass::VertClass &w3d_vert = builder.Get_Vertex(w3d_vert_index);
- int max_vert_index = w3d_vert.Id;
-
- if (m_SetMembers[max_vert_index]) {
-
- //
- // Get the absolute position of this vertex
- //
- Point3 position = mesh.verts[max_vert_index];
- Apply_Position_Changes (max_vert_index, key_frame, position, transform);
-
- //
- // Get the absolute color of this vertex
- //
- VertColor color (1, 1, 1);
- if (mesh.vertCol != NULL) {
- int vert_col_index = w3d_vert.MaxVertColIndex;
- color = mesh.vertCol[vert_col_index];
- Apply_Color_Changes (max_vert_index, vert_col_index, key_frame, color);
- }
-
- //
- // Save this vertex's deformations
- //
- save_set.Add_Vert (w3d_vert_index, position, color);
- }
- }
-
- save_set.End_Keyframe ();
- }
- }
-
- m_State = old_state;
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Save
-//
-///////////////////////////////////////////////////////////////////////////
-IOResult
-MeshDeformSetClass::Save (ISave *save_obj)
-{
- int key_frames = m_KeyFrames.Count ();
- float state_inc = 1.0F / ((float)key_frames);
-
- DeformChunkSetInfo set_info = { 0 };
- set_info.KeyframeCount = key_frames;
- set_info.flags = 0;
- set_info.NumVerticies = m_VertexCount;
- set_info.NumVertexColors = m_VertexColorCount;
- if (m_bAutoApply == false) {
- set_info.flags |= DEFORM_SET_MANUAL_DEFORM;
- }
- DWORD bytes = 0L;
-
- //
- // Write the set info to the chunk
- //
- save_obj->BeginChunk (DEFORM_CHUNK_SET_INFO);
- IOResult result = save_obj->Write (&set_info, sizeof (set_info), &bytes);
-
- //
- // Now write a chunk for each keyframe
- //
- for (int index = 0; (index < key_frames) && (result == IO_OK); index ++) {
- KEY_FRAME &key_frame = *(m_KeyFrames[index]);
-
- DeformChunkKeyframeInfo keyframe_info = { 0 };
- keyframe_info.DeformPercent = state_inc * (index + 1);
- keyframe_info.VertexCount = key_frame.verticies.Count ();
- keyframe_info.ColorCount = key_frame.colors.Count ();
-
- //
- // Write keyframe info to the chunk
- //
- //save_obj->BeginChunk (DEFORM_CHUNK_KEYFRAME_INFO);
- result = save_obj->Write (&keyframe_info, sizeof (keyframe_info), &bytes);
- //save_obj->EndChunk ();
-
- //
- // Loop through the verticies and save their position
- //
- for ( unsigned int pos_index = 0;
- (pos_index < keyframe_info.VertexCount) && (result == IO_OK);
- pos_index ++)
- {
- VERT_INFO &deform_data = key_frame.verticies[pos_index];
-
- DeformDataChunk data;
- data.VertexIndex = deform_data.index;
- data.ColorIndex = deform_data.color_index;
- data.Value = deform_data.value;
-
- //
- // Write vertex position info to the chunk
- //
- //save_obj->BeginChunk (DEFORM_CHUNK_POSITION_DATA);
- result = save_obj->Write (&data, sizeof (data), &bytes);
- //save_obj->EndChunk ();
- }
-
- //
- // Loop through the verticies and save their color
- //
- for ( unsigned int color_index = 0;
- (color_index < keyframe_info.ColorCount) && (result == IO_OK);
- color_index ++)
- {
- VERT_INFO &deform_data = key_frame.colors[color_index];
-
- DeformDataChunk data;
- data.VertexIndex = deform_data.index;
- data.ColorIndex = deform_data.color_index;
- data.Value = deform_data.value;
-
- //
- // Write vertex color info to the chunk
- //
- //save_obj->BeginChunk (DEFORM_CHUNK_COLOR_DATA);
- result = save_obj->Write (&data, sizeof (data), &bytes);
- //save_obj->EndChunk ();
- }
-
- //
- // Write the list of affected vertex positions to a chunk
- //
- /*if (result == IO_OK) {
- //save_obj->BeginChunk (DEFORM_CHUNK_POSITION_VERTS);
- result = key_frame.affected_verts.Save (save_obj);
- //save_obj->EndChunk ();
- }
-
- //
- // Write the list of affected vertex colors to a chunk
- //
- if (result == IO_OK) {
- //save_obj->BeginChunk (DEFORM_CHUNK_COLOR_VERTS);
- result = key_frame.affected_colors.Save (save_obj);
- //save_obj->EndChunk ();
- }*/
- }
-
- save_obj->EndChunk ();
-
- // Return IO_OK on success IO_ERROR on failure
- return result;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Load
-//
-///////////////////////////////////////////////////////////////////////////
-IOResult
-MeshDeformSetClass::Load (ILoad *load_obj)
-{
- // Start fresh
- Free_Key_Frames ();
- Init_Key_Frames ();
- DWORD bytes = 0L;
-
-
- //
- // Is this the chunk we were expecting?
- //
- IOResult result = load_obj->OpenChunk ();
- if ( (result == IO_OK) &&
- (load_obj->CurChunkID () == DEFORM_CHUNK_SET_INFO)) {
-
- //
- // Read information about this set from the chunk
- //
- DeformChunkSetInfo set_info = { 0 };
- result = load_obj->Read (&set_info, sizeof (set_info), &bytes);
- m_bAutoApply = !(set_info.flags & DEFORM_SET_MANUAL_DEFORM);
-
- //
- // Resize the internal data to fit the saved state
- //
- if (result == IO_OK) {
- Resize_Vertex_Array (set_info.NumVerticies, set_info.NumVertexColors);
- }
-
- //
- // Read keyframe information from the chunk
- //
- for ( unsigned int index = 0;
- (index < set_info.KeyframeCount) && (result == IO_OK);
- index ++)
- {
- KEY_FRAME &key_frame = *(m_KeyFrames[index]);
-
- DeformChunkKeyframeInfo keyframe_info = { 0 };
- result = load_obj->Read (&keyframe_info, sizeof (keyframe_info), &bytes);
-
- //
- // Read all the vertex positions from the chunk
- //
- for ( unsigned int pos_index = 0;
- (pos_index < keyframe_info.VertexCount) && (result == IO_OK);
- pos_index ++)
- {
- //
- // Read vertex position info from the chunk
- //
- DeformDataChunk data;
- result = load_obj->Read (&data, sizeof (data), &bytes);
- if (result == IO_OK) {
- key_frame.verticies.Add (VERT_INFO (data.VertexIndex, data.Value, data.ColorIndex));
- key_frame.affected_verts.Set (data.VertexIndex, 1);
- m_SetMembers.Set (data.VertexIndex, 1);
- }
- }
-
- //
- // Read all the vertex colors from the chunk
- //
- for ( unsigned int color_index = 0;
- (color_index < keyframe_info.ColorCount) && (result == IO_OK);
- color_index ++)
- {
- //
- // Read vertex color info from the chunk
- //
- DeformDataChunk data;
- result = load_obj->Read (&data, sizeof (data), &bytes);
- if (result == IO_OK) {
- key_frame.colors.Add (VERT_INFO (data.VertexIndex, data.Value, data.ColorIndex));
- key_frame.affected_colors.Set (data.VertexIndex, 1);
- m_SetMembers.Set (data.VertexIndex, 1);
- }
- }
-
- //
- // Read the list of affected vertex positions to a chunk
- //
- /*if (result == IO_OK) {
- result = key_frame.affected_verts.Load (load_obj);
- }
-
- //
- // Read the list of affected vertex colors to a chunk
- //
- if (result == IO_OK) {
- result = key_frame.affected_colors.Load (load_obj);
- }*/
- }
- }
-
- load_obj->CloseChunk ();
-
- // Return IO_OK on success IO_ERROR on failure
- return result;
-}
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/MeshDeformSet.h b/Generals/Code/Tools/WW3D/max2w3d/MeshDeformSet.h
deleted file mode 100644
index 4b00123f4e4..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/MeshDeformSet.h
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** Confidential - Westwood Studios ***
- ***********************************************************************************************
- * *
- * Project Name : Commando / G 3D engine *
- * *
- * File Name : MeshDeformSet.h *
- * *
- * Programmer : Patrick Smith *
- * *
- * Start Date : 04/26/99 *
- * *
- * Last Update :
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#ifndef __MESH_DEFORM_SET_H
-#define __MESH_DEFORM_SET_H
-
-#include
-#include "Vector.H"
-#include "MeshDeformDefs.h"
-
-
-// Forward declarations
-class MeshDeformSaveSetClass;
-class MeshBuilderClass;
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// MeshDeformSetClass
-//
-///////////////////////////////////////////////////////////////////////////
-class MeshDeformSetClass
-{
- public:
-
- //////////////////////////////////////////////////////////////////////
- // Public data types
- //////////////////////////////////////////////////////////////////////
-
-
- //////////////////////////////////////////////////////////////////////
- // Public constructors/destructors
- //////////////////////////////////////////////////////////////////////
- MeshDeformSetClass (void)
- : m_pMesh (NULL),
- m_pVertexArray (NULL),
- m_pVertexOPStartArray (NULL),
- m_pVertexColors (NULL),
- m_VertexColorCount (0),
- m_State (0),
- m_CurrentKeyFrame (0),
- m_bAutoApply (true),
- m_VertexCount (0) { Init_Key_Frames (); }
-
- virtual ~MeshDeformSetClass (void);
-
- //////////////////////////////////////////////////////////////////////
- // Public methods
- //////////////////////////////////////////////////////////////////////
- //virtual LocalModData * Clone (void) { return new MeshDeformSetClass; }
- void Update_Mesh (TriObject &tri_obj);
- void Set_State (float state);
-
- // Inline accessors
- Mesh * Peek_Mesh (void) const { return m_pMesh; }
- const Point3 * Peek_Orig_Vertex_Array (void) const { return m_pVertexArray; }
- Point3 * Peek_Vertex_OPStart_Array (void) const { return m_pVertexOPStartArray; }
- VertColor * Peek_Vertex_Colors (void) const { return m_pVertexColors; }
-
- // Keyframe managment
- void Set_Current_Key_Frame (int index);
- int Get_Current_Key_Frame (void) const { return m_CurrentKeyFrame; }
- void Update_Key_Frame (int key_frame);
- void Update_Current_Data (void);
- void Update_Set_Members (void);
- void Collapse_Keyframe_Data (int keyframe);
- void Reset_Key_Frame_Verts (int keyframe);
- void Reset_Key_Frame_Colors (int keyframe);
-
- // Data managment
- void Set_Vertex_Position (int index, const Point3 &value);
- void Set_Vertex_Color (int index, int color_index, const VertColor &value);
-
- // Set managment
- void Select_Members (void);
- void Update_Members (DEFORM_CHANNELS flags);
- void Restore_Members (void);
-
- // Auto apply
- bool Does_Set_Auto_Apply (void) const { return m_bAutoApply; }
- void Auto_Apply (bool auto_apply = true) { m_bAutoApply = auto_apply; }
-
- // Information
- bool Is_Empty (void) const;
- int Get_Vertex_Count (int keyframe) const { return m_KeyFrames[keyframe]->verticies.Count (); }
- int Get_Color_Count (int keyframe) const { return m_KeyFrames[keyframe]->colors.Count (); }
- const VERT_INFO & Get_Vertex_Data (int keyframe, int index) const { return m_KeyFrames[keyframe]->verticies[index]; }
- const VERT_INFO & Get_Color_Data (int keyframe, int index) const { return m_KeyFrames[keyframe]->colors[index]; }
-
- // Persistent storage
- IOResult Save (ISave *save_obj);
- IOResult Load (ILoad *load_obj);
-
- void Save (MeshBuilderClass &builder, Mesh &mesh, MeshDeformSaveSetClass &save_set, Matrix3 *transform = NULL);
-
- protected:
-
- //////////////////////////////////////////////////////////////////////
- // Protected methods
- //////////////////////////////////////////////////////////////////////
- void Resize_Vertex_Array (int count, int color_count);
- void Copy_Vertex_Array (Mesh &mesh);
-
- // Keyframe methods
- void Init_Key_Frames (void);
- void Free_Key_Frames (void);
- void Determine_Interpolation_Indicies (int key_frame, bool position, int &from, int &to, float &state);
-
- // Deformation application methods
- void Apply_Position_Changes (UINT vert, int frame_to_check, Point3 &position, Matrix3 *transform = NULL);
- void Apply_Color_Changes (UINT vert, int frame_to_check, Mesh &mesh);
- void Apply_Color_Changes (UINT vert_index, UINT vert_color_index, int frame_to_check, VertColor &color);
-
- private:
-
- //////////////////////////////////////////////////////////////////////
- // Private data types
- //////////////////////////////////////////////////////////////////////
- typedef struct
- {
- DEFORM_LIST verticies;
- DEFORM_LIST colors;
- BitArray affected_verts;
- BitArray affected_colors;
- } KEY_FRAME;
-
- typedef DynamicVectorClass KEY_FRAME_LIST;
-
- //////////////////////////////////////////////////////////////////////
- // Private member data
- //////////////////////////////////////////////////////////////////////
- Mesh * m_pMesh;
- Point3 * m_pVertexArray;
- Point3 * m_pVertexOPStartArray;
- VertColor * m_pVertexColors;
- int m_VertexCount;
- int m_VertexColorCount;
- int m_CurrentKeyFrame;
- float m_State;
- bool m_bAutoApply;
-
- // Array representing which verticies are part of the set
- BitArray m_SetMembers;
-
- // List of key frames
- KEY_FRAME_LIST m_KeyFrames;
-};
-
-
-#endif //__MESH_DEFORM_DATA_H
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/MeshDeformUndo.cpp b/Generals/Code/Tools/WW3D/max2w3d/MeshDeformUndo.cpp
deleted file mode 100644
index 2d0de5380c6..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/MeshDeformUndo.cpp
+++ /dev/null
@@ -1,332 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** Confidential - Westwood Studios ***
- ***********************************************************************************************
- * *
- * Project Name : Commando / G 3D engine *
- * *
- * File Name : MeshDeformUndo.h *
- * *
- * Programmer : Patrick Smith *
- * *
- * Start Date : 06/08/99 *
- * *
- * Last Update :
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#include "MeshDeformUndo.h"
-#include "util.h"
-#include "MeshDeformData.h"
-#include "MeshDeformSet.h"
-#include "MeshDeform.h"
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// VertexRestoreClass
-//
-///////////////////////////////////////////////////////////////////////////
-VertexRestoreClass::VertexRestoreClass
-(
- Mesh * mesh,
- MeshDeformClass * modifier,
- MeshDeformModData * mod_data
-)
- : m_pModifier (modifier),
- m_pModData (mod_data),
- m_pMesh (mesh),
- m_SetIndex (0),
- m_KeyframeIndex (0)
-{
- assert (mesh != NULL);
-
- //
- // Remember the deformer's current settings
- //
- m_SetIndex = m_pModData->Get_Current_Set ();
- m_KeyframeIndex = m_pModData->Peek_Set (m_SetIndex).Get_Current_Key_Frame ();
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Free_Vertex_Array
-//
-///////////////////////////////////////////////////////////////////////////
-void
-VertexRestoreClass::Free_Vertex_Array (void)
-{
- m_VertexList.Delete_All ();
- m_RedoVertexList.Delete_All ();
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Restore
-//
-///////////////////////////////////////////////////////////////////////////
-void
-VertexRestoreClass::Restore (int is_undo)
-{
- assert (m_pMesh != NULL);
- assert (m_pModData != NULL);
- assert (m_pModifier != NULL);
-
- // Is this being called as part of an undo operation?
- if (is_undo != 0) {
-
- //
- // Ensure the modifier is in the state it was when
- // the undo operation was recorded
- //
- m_pModData->Set_Current_Set (m_SetIndex);
- m_pModData->Peek_Set (m_SetIndex).Set_Current_Key_Frame (m_KeyframeIndex);
-
- //
- // Apply the original vertex positions to the mesh
- //
- Apply_Vertex_Data (m_VertexList);
-
- //
- // Notify the mesh of geometry changes
- //
- m_pModifier->NotifyDependents (FOREVER, PART_GEOM | PART_VERTCOLOR, REFMSG_CHANGE);
- m_pModifier->Update_UI (m_pModData);
- }
-
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Redo
-//
-///////////////////////////////////////////////////////////////////////////
-void
-VertexRestoreClass::Redo (void)
-{
- assert (m_pMesh != NULL);
- assert (m_pModData != NULL);
- assert (m_pModifier != NULL);
-
- //
- // Ensure the modifier is in the state it was when
- // the undo operation was recorded
- //
- m_pModData->Set_Current_Set (m_SetIndex);
- m_pModData->Peek_Set (m_SetIndex).Set_Current_Key_Frame (m_KeyframeIndex);
-
- //
- // Apply the original vertex positions to the mesh
- //
- Apply_Vertex_Data (m_RedoVertexList);
-
- //
- // Notify the mesh of geometry changes
- //
- m_pModifier->NotifyDependents (FOREVER, PART_GEOM | PART_VERTCOLOR, REFMSG_CHANGE);
- m_pModifier->Update_UI (m_pModData);
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// EndHold
-//
-///////////////////////////////////////////////////////////////////////////
-void
-VertexRestoreClass::EndHold (void)
-{
- //
- // Record the position of all the verts we are about to change
- // (to support redo).
- //
- Copy_Vertex_State (m_RedoVertexList);
- m_pModifier->ClearAFlag (A_HELD);
- return ;
-}
-
-
-/***************************************************************************************/
-/*
-/* End VertexRestoreClass
-/*
-/***************************************************************************************/
-
-/***************************************************************************************/
-/*
-/* Start VertexPositionRestoreClass
-/*
-/***************************************************************************************/
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// VertexPositionRestoreClass
-//
-///////////////////////////////////////////////////////////////////////////
-VertexPositionRestoreClass::VertexPositionRestoreClass
-(
- Mesh * mesh,
- MeshDeformClass * modifier,
- MeshDeformModData * mod_data
-)
- : VertexRestoreClass (mesh, modifier, mod_data)
-{
- //
- // Make a copy of the vertex positions
- //
- Copy_Vertex_State (m_VertexList);
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Copy_Vertex_State
-//
-///////////////////////////////////////////////////////////////////////////
-void
-VertexPositionRestoreClass::Copy_Vertex_State (DEFORM_LIST &list)
-{
- //
- // Make a copy of each vertex in the current keyframe
- //
- list.Delete_All ();
- MeshDeformSetClass &set_obj = m_pModData->Peek_Set (m_SetIndex);
- int count = set_obj.Get_Vertex_Count (m_KeyframeIndex);
- for (int index = 0; index < count; index ++) {
- const VERT_INFO &data = set_obj.Get_Vertex_Data (m_KeyframeIndex, index);
- list.Add (VERT_INFO (data.index, data.value));
- }
-
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Apply_Vertex_Data
-//
-///////////////////////////////////////////////////////////////////////////
-void
-VertexPositionRestoreClass::Apply_Vertex_Data (DEFORM_LIST &list)
-{
- m_pModData->Peek_Set (m_SetIndex).Reset_Key_Frame_Verts (m_KeyframeIndex);
-
- //
- // Apply each vertex in our list
- //
- for (int index = 0; index < list.Count (); index ++) {
- VERT_INFO &info = list[index];
- m_pModData->Set_Vertex_Position (info.index, info.value);
- }
-
- return ;
-}
-
-
-
-/***************************************************************************************/
-/*
-/* End VertexPositionRestoreClass
-/*
-/***************************************************************************************/
-
-/***************************************************************************************/
-/*
-/* Start VertexColorRestoreClass
-/*
-/***************************************************************************************/
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// VertexColorRestoreClass
-//
-///////////////////////////////////////////////////////////////////////////
-VertexColorRestoreClass::VertexColorRestoreClass
-(
- Mesh * mesh,
- MeshDeformClass * modifier,
- MeshDeformModData * mod_data
-)
- : VertexRestoreClass (mesh, modifier, mod_data)
-{
- //
- // Make a copy of the vertex positions
- //
- Copy_Vertex_State (m_VertexList);
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Copy_Vertex_State
-//
-///////////////////////////////////////////////////////////////////////////
-void
-VertexColorRestoreClass::Copy_Vertex_State (DEFORM_LIST &list)
-{
- //
- // Make a copy of each vertex color in the current keyframe
- //
- list.Delete_All ();
- MeshDeformSetClass &set_obj = m_pModData->Peek_Set (m_SetIndex);
- int count = set_obj.Get_Color_Count (m_KeyframeIndex);
- for (int index = 0; index < count; index ++) {
- const VERT_INFO &data = set_obj.Get_Color_Data (m_KeyframeIndex, index);
- list.Add (VERT_INFO (data.index, data.value, data.color_index));
- }
-
- return ;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Apply_Vertex_Data
-//
-///////////////////////////////////////////////////////////////////////////
-void
-VertexColorRestoreClass::Apply_Vertex_Data (DEFORM_LIST &list)
-{
- m_pModData->Peek_Set (m_SetIndex).Reset_Key_Frame_Colors (m_KeyframeIndex);
-
- //
- // Apply each vertex in our list
- //
- for (int index = 0; index < list.Count (); index ++) {
- VERT_INFO &info = list[index];
- m_pModData->Set_Vertex_Color (info.index, info.color_index, info.value);
- }
-
- return ;
-}
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/MeshDeformUndo.h b/Generals/Code/Tools/WW3D/max2w3d/MeshDeformUndo.h
deleted file mode 100644
index acdf8fe47ae..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/MeshDeformUndo.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** Confidential - Westwood Studios ***
- ***********************************************************************************************
- * *
- * Project Name : Commando / G 3D engine *
- * *
- * File Name : MeshDeformUndo.h *
- * *
- * Programmer : Patrick Smith *
- * *
- * Start Date : 06/08/99 *
- * *
- * Last Update :
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#ifndef __MESH_DEFORM_UNDO_H
-#define __MESH_DEFORM_UNDO_H
-
-#include
-#include "Vector.H"
-#include "MeshDeformDefs.h"
-
-// Forward declarations
-class MeshDeformClass;
-class MeshDeformModData;
-
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// VertexRestoreClass
-//
-///////////////////////////////////////////////////////////////////////////
-class VertexRestoreClass : public RestoreObj
-{
- public:
-
- //////////////////////////////////////////////////////////////////
- // Public constructors/destructor
- //////////////////////////////////////////////////////////////////
- VertexRestoreClass (Mesh *mesh, MeshDeformClass *modifier, MeshDeformModData *mod_data);
- virtual ~VertexRestoreClass (void) { Free_Vertex_Array (); };
-
- //////////////////////////////////////////////////////////////////
- // RestoreObj overrides
- //////////////////////////////////////////////////////////////////
- virtual void Restore (int is_undo);
- virtual void Redo (void);
- virtual int Size (void) { return (m_VertexList.Count () * sizeof (Point3) * 2) + sizeof (VertexRestoreClass); }
- virtual void EndHold (void);
-
- protected:
-
- //////////////////////////////////////////////////////////////////
- // Protected methods
- //////////////////////////////////////////////////////////////////
- virtual void Copy_Vertex_State (DEFORM_LIST &list) = 0;
- virtual void Apply_Vertex_Data (DEFORM_LIST &list) = 0;
- void Free_Vertex_Array (void);
-
- //////////////////////////////////////////////////////////////////
- // Protected member data
- //////////////////////////////////////////////////////////////////
- Mesh * m_pMesh;
- MeshDeformClass * m_pModifier;
- MeshDeformModData * m_pModData;
- DEFORM_LIST m_VertexList;
- DEFORM_LIST m_RedoVertexList;
- int m_SetIndex;
- int m_KeyframeIndex;
-};
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// VertexPositionRestoreClass
-//
-///////////////////////////////////////////////////////////////////////////
-class VertexPositionRestoreClass : public VertexRestoreClass
-{
- public:
-
- //////////////////////////////////////////////////////////////////
- // Public constructors/destructor
- //////////////////////////////////////////////////////////////////
- VertexPositionRestoreClass (Mesh *mesh, MeshDeformClass *modifier, MeshDeformModData *mod_data);
- virtual ~VertexPositionRestoreClass (void) { };
-
- //////////////////////////////////////////////////////////////////
- // RestoreObj overrides
- //////////////////////////////////////////////////////////////////
- TSTR Description (void) { return TSTR(_T("Vertex Position")); }
-
- protected:
-
- //////////////////////////////////////////////////////////////////
- // Protected methods
- //////////////////////////////////////////////////////////////////
- virtual void Copy_Vertex_State (DEFORM_LIST &list);
- virtual void Apply_Vertex_Data (DEFORM_LIST &list);
-};
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// VertexColorRestoreClass
-//
-///////////////////////////////////////////////////////////////////////////
-class VertexColorRestoreClass : public VertexRestoreClass
-{
- public:
-
- //////////////////////////////////////////////////////////////////
- // Public constructors/destructor
- //////////////////////////////////////////////////////////////////
- VertexColorRestoreClass (Mesh *mesh, MeshDeformClass *modifier, MeshDeformModData *mod_data);
- virtual ~VertexColorRestoreClass (void) { };
-
- //////////////////////////////////////////////////////////////////
- // RestoreObj overrides
- //////////////////////////////////////////////////////////////////
- TSTR Description (void) { return TSTR(_T("Vertex Color")); }
-
- protected:
-
- //////////////////////////////////////////////////////////////////
- // Protected methods
- //////////////////////////////////////////////////////////////////
- virtual void Copy_Vertex_State (DEFORM_LIST &list);
- virtual void Apply_Vertex_Data (DEFORM_LIST &list);
-};
-
-
-#endif //__MESH_DEFORM_UNDO_H
diff --git a/Generals/Code/Tools/WW3D/max2w3d/PCToPS2Material.cpp b/Generals/Code/Tools/WW3D/max2w3d/PCToPS2Material.cpp
deleted file mode 100644
index c81fcc3ebc7..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/PCToPS2Material.cpp
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project name : Buccaneer Bay *
- * *
- * File name : PCToPS2Material.cpp *
- * *
- * Programmer : Mike Lytle *
- * *
- * Start date : 10/22/1999 *
- * *
- * Last update : 10/27/1999 *
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * PTPMC::BeginEditParams -- Change all W3D materials in the mesh to be PS2 compatible. *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#include
-#include
-#include
-#include "dllmain.h"
-#include "resource.h"
-#include "util.h"
-#include "utilapi.h"
-#include "nodelist.h"
-#include "gamemtl.h"
-
-
-Class_ID PCToPS2MaterialClassID(0x40d11cee, 0x68881657);
-
-class PCToPS2MaterialClass : public UtilityObj {
-
- public:
-
- void BeginEditParams(Interface *ip,IUtil *iu);
- void EndEditParams(Interface *ip,IUtil *iu) {}
- void DeleteThis() {delete this;}
-
-};
-
-
-/***********************************************************************************************
- * PTPMC::BeginEditParams -- Change all W3D materials in the mesh to be PS2 compatible. *
- * *
- * *
- * *
- * *
- * HISTORY: *
- * 10/27/1999MLL: Created. *
- *=============================================================================================*/
-void PCToPS2MaterialClass::BeginEditParams(Interface *ip,IUtil *iu)
-{
- // This function is called when the utility is chosen.
- // Since we don't need any window gadgets, we'll just go through all the materials right away.
- INode *root = ip->GetRootNode();
-
- INodeListClass *meshlist = NULL;
-
- // Change all materials associated with the mesh, starting with the root node.
- if (root) {
- meshlist = new INodeListClass(root, 0);
-
- if (meshlist) {
- int i;
-
- for (i = 0; i < meshlist->Num_Nodes(); i++) {
-
- Mtl *nodemtl = ((*meshlist)[i])->GetMtl();
-
- if (nodemtl == NULL) {
- // No material on this node, go to the next.
- continue;
- }
-
- if (!nodemtl->IsMultiMtl()) {
- // Only change those that are W3D materials.
- if (nodemtl->ClassID() == GameMaterialClassID) {
- int pass;
-
- for (pass = 0; pass < ((GameMtl*)nodemtl)->Get_Pass_Count(); pass++) {
- // Change the material for each pass.
- ((GameMtl*)nodemtl)->Compute_PS2_Shader_From_PC_Shader(pass);
- }
-
- }
- } else {
-
- // Loop through all sub materials of the multi-material.
- for (unsigned mi = 0; mi < nodemtl->NumSubMtls(); mi++) {
-
- // Only change those that are W3D materials.
- if (nodemtl->GetSubMtl(mi)->ClassID() == GameMaterialClassID) {
- int pass;
-
- for (pass = 0; pass < ((GameMtl*)nodemtl->GetSubMtl(mi))->Get_Pass_Count(); pass++) {
- // Change the material for each pass.
- ((GameMtl*)nodemtl->GetSubMtl(mi))->Compute_PS2_Shader_From_PC_Shader(pass);
- }
- } else if (nodemtl->GetSubMtl(mi)->ClassID() == PS2GameMaterialClassID) {
- }
- }
- }
- }
- }
-
- delete meshlist;
- }
-}
-
-class PCToPS2MaterialClassDesc:public ClassDesc {
-
-public:
- int IsPublic() { return 1; }
- void * Create(BOOL loading)
- {
- return ((void*)new PCToPS2MaterialClass);
- }
- const TCHAR * ClassName() { return Get_String(IDS_PC_TO_PS2_MAT_CONVERTER); }
- SClass_ID SuperClassID() { return UTILITY_CLASS_ID; }
- Class_ID ClassID() { return PCToPS2MaterialClassID; }
- const TCHAR* Category() { return _T(""); }
-};
-
-static PCToPS2MaterialClassDesc _PCToPS2MaterialCD;
-
-ClassDesc * Get_PS2_Material_Conversion() { return &_PCToPS2MaterialCD; }
diff --git a/Generals/Code/Tools/WW3D/max2w3d/PS2GameMtl.cpp b/Generals/Code/Tools/WW3D/max2w3d/PS2GameMtl.cpp
deleted file mode 100644
index e6a89eeafe9..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/PS2GameMtl.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project name : Buccaneer Bay *
- * *
- * File name : PS2GameMtl.cpp *
- * *
- * Programmer : Mike Lytle *
- * *
- * Start date : 10/12/1999 *
- * *
- * Last update : 10/12/1999 *
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#include "gamemtl.h"
-#include
-#include
-#include
-#include "dllmain.h"
-#include "resource.h"
-#include "util.h"
-
-
-
-/*****************************************************************
-*
-* PS2 GameMtl Class Descriptor
-*
-*****************************************************************/
-Class_ID PS2GameMaterialClassID(0x2ed62ad7, 0x50571dfd);
-
-// This adds W3D PS2 choice to the Max material selector.
-class PS2GameMaterialClassDesc:public ClassDesc {
-
-public:
- int IsPublic() { return 1; }
- void * Create(BOOL loading)
- {
- GameMtl *mtl = new GameMtl(loading);
- mtl->Set_Shader_Type(GameMtl::STE_PS2_SHADER);
- return ((void*)mtl);
- }
- const TCHAR * ClassName() { return Get_String(IDS_PS2_GAMEMTL); }
- SClass_ID SuperClassID() { return MATERIAL_CLASS_ID; }
- Class_ID ClassID() { return PS2GameMaterialClassID; }
- const TCHAR* Category() { return _T(""); }
-};
-
-static PS2GameMaterialClassDesc _PS2GameMaterialCD;
-
-ClassDesc * Get_PS2_Game_Material_Desc() { return &_PS2GameMaterialCD; }
diff --git a/Generals/Code/Tools/WW3D/max2w3d/PS2GameMtlShaderDlg.cpp b/Generals/Code/Tools/WW3D/max2w3d/PS2GameMtlShaderDlg.cpp
deleted file mode 100644
index b7936662970..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/PS2GameMtlShaderDlg.cpp
+++ /dev/null
@@ -1,371 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project name : Buccaneer Bay *
- * *
- * File name : PS2GameMtlShaderDlg.cpp *
- * *
- * Programmer : Mike Lytle *
- * *
- * Start date : 10/12/1999 *
- * *
- * Last update : 10/12/1999 *
- * *
- * Taken from GTH's GameMtlShaderDlg.cpp *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * PS2GameMtlShaderDlg -- Constructor. *
- * PGMSD::Dialog_Proc -- Respond to user selections. *
- * PGMSD::ReloadDialog -- Setup the dialog box. *
- * PGMSD::Apply_Preset -- Notify the material of the values for the selected setting. *
- * PGMSD::Set_Preset -- Sets the dialog to one of the presets or custom. *
- * PGMSD::CompareShaderToBlendPreset -- Determine if the settings conform to one of the prese*
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#include "PS2GameMtlShaderDlg.h"
-#include "GameMtlDlg.h"
-#include "gamemtl.h"
-#include "resource.h"
-
-
-#define NUM_PS2_SHADER_BLEND_PRESETS 7
-
-static char * _PS2ShaderBlendSettingPresetNames[NUM_PS2_SHADER_BLEND_PRESETS + 1] =
-{
- "Opaque",
- "Additive",
- "Source Subtracted",
- "Destination Subtracted",
- "Alpha Blend",
- "Alpha Test",
- "Alpha Test and Blend",
- "------ Custom -----"
-};
-
-struct PS2ShaderBlendSettingPreset
-{
- int A;
- int B;
- int C;
- int D;
- bool DepthMask;
- bool AlphaTest;
-};
-
-// (A - B) * C + D
-static const PS2ShaderBlendSettingPreset PS2ShaderBlendSettingPresets[NUM_PS2_SHADER_BLEND_PRESETS] = {
- {PSS_SRC, PSS_ZERO, PSS_ONE, PSS_ZERO, true, false}, // Opaque
- {PSS_SRC, PSS_ZERO, PSS_ONE, PSS_DEST, false, false}, // Additive
- {PSS_DEST, PSS_SRC, PSS_ONE, PSS_ZERO, false, false}, // Src subtracted
- {PSS_SRC, PSS_DEST, PSS_ONE, PSS_ZERO, false, false}, // Dest subtracted
- {PSS_SRC, PSS_DEST, PSS_SRC_ALPHA, PSS_DEST, false, false}, // Alpha blend
- {PSS_SRC, PSS_ZERO, PSS_ONE, PSS_ZERO, true, true}, // Alpha test
- {PSS_SRC, PSS_DEST, PSS_SRC_ALPHA, PSS_DEST, true, true}, // Alpha test & blend
-};
-
-
-/***********************************************************************************************
- * PS2GameMtlShaderDlg -- Constructor. *
- * *
- * *
- * *
- * *
- * HISTORY: *
- * 10/12/1999MLL: Created. *
- *=============================================================================================*/
-PS2GameMtlShaderDlg::PS2GameMtlShaderDlg
-(
- HWND parent,
- IMtlParams * imp,
- GameMtl * mtl,
- int pass
-) : GameMtlFormClass(imp,mtl,pass)
-{
- Create_Form(parent, IDD_GAMEMTL_PS2_SHADER);
-}
-
-
-/***********************************************************************************************
- * PGMSD::Dialog_Proc -- Respond to user selections. *
- * *
- * *
- * *
- * *
- * HISTORY: *
- * 10/12/1999MLL: Created. *
- *=============================================================================================*/
-BOOL PS2GameMtlShaderDlg::Dialog_Proc (HWND dlg_wnd, UINT message, WPARAM wparam, LPARAM lparam)
-{
- int cursel;
- int i;
- int id = LOWORD(wparam);
- int code = HIWORD(wparam);
-
- switch (message)
- {
-
- case WM_INITDIALOG:
- for(i = 0; i <= NUM_PS2_SHADER_BLEND_PRESETS; i++) {
- SendDlgItemMessage(dlg_wnd,IDC_PS2_PRESET_COMBO,CB_ADDSTRING,0,(LONG)_PS2ShaderBlendSettingPresetNames[i]);
- }
- SendDlgItemMessage(dlg_wnd,IDC_PS2_PRESET_COMBO,CB_SETCURSEL,0,0);
- break;
-
- case WM_LBUTTONDOWN:
- case WM_LBUTTONUP:
- case WM_MOUSEMOVE:
- {
- IParams->RollupMouseMessage(dlg_wnd,message,wparam,lparam);
- }
- return FALSE;
-
- case WM_COMMAND:
- {
- if (code == CBN_SELCHANGE) {
-
- switch (id)
- {
- // Shared by both shaders.
- case IDC_DEPTHCOMPARE_COMBO:
- cursel = SendDlgItemMessage(dlg_wnd,IDC_DEPTHCOMPARE_COMBO,CB_GETCURSEL,0,0);
- TheMtl->Set_Depth_Compare(PassIndex,cursel);
- break;
- case IDC_PRIGRADIENT_COMBO:
- cursel = SendDlgItemMessage(dlg_wnd,IDC_PRIGRADIENT_COMBO,CB_GETCURSEL,0,0);
- TheMtl->Set_Pri_Gradient(PassIndex,cursel);
- TheMtl->Notify_Changed();
- break;
- case IDC_SECGRADIENT_COMBO:
- cursel = SendDlgItemMessage(dlg_wnd,IDC_SECGRADIENT_COMBO,CB_GETCURSEL,0,0);
- TheMtl->Set_Sec_Gradient(PassIndex,cursel);
- TheMtl->Notify_Changed();
- break;
- case IDC_DETAILCOLOR_COMBO:
- cursel = SendDlgItemMessage(dlg_wnd,IDC_DETAILCOLOR_COMBO,CB_GETCURSEL,0,0);
- TheMtl->Set_Detail_Color_Func(PassIndex,cursel);
- TheMtl->Notify_Changed();
- break;
- case IDC_DETAILALPHA_COMBO:
- cursel = SendDlgItemMessage(dlg_wnd,IDC_DETAILALPHA_COMBO,CB_GETCURSEL,0,0);
- TheMtl->Set_Detail_Alpha_Func(PassIndex,cursel);
- TheMtl->Notify_Changed();
- break;
-
- // Playstation 2 specific.
- case IDC_PS2_PRESET_COMBO:
- cursel = SendDlgItemMessage(dlg_wnd,IDC_PS2_PRESET_COMBO,CB_GETCURSEL,0,0);
- Apply_Preset(cursel);
- break;
- case IDC_A_COMBO:
- cursel = SendDlgItemMessage(dlg_wnd,IDC_A_COMBO,CB_GETCURSEL,0,0);
- TheMtl->Set_PS2_Shader_Param_A(PassIndex,cursel);
- TheMtl->Notify_Changed();
- Set_Preset();
- break;
- case IDC_B_COMBO:
- cursel = SendDlgItemMessage(dlg_wnd,IDC_B_COMBO,CB_GETCURSEL,0,0);
- TheMtl->Set_PS2_Shader_Param_B(PassIndex,cursel);
- TheMtl->Notify_Changed();
- Set_Preset();
- break;
- case IDC_C_COMBO:
- cursel = SendDlgItemMessage(dlg_wnd,IDC_C_COMBO,CB_GETCURSEL,0,0);
- TheMtl->Set_PS2_Shader_Param_C(PassIndex,cursel);
- TheMtl->Notify_Changed();
- Set_Preset();
- break;
- case IDC_D_COMBO:
- cursel = SendDlgItemMessage(dlg_wnd,IDC_D_COMBO,CB_GETCURSEL,0,0);
- TheMtl->Set_PS2_Shader_Param_D(PassIndex,cursel);
- TheMtl->Notify_Changed();
- Set_Preset();
- break;
- }
-
- } else {
-
- switch(id) {
-
- case IDC_DEPTHMASK_CHECK:
- if (SendDlgItemMessage(dlg_wnd,IDC_DEPTHMASK_CHECK,BM_GETCHECK,0,0)) {
- TheMtl->Set_Depth_Mask(PassIndex,W3DSHADER_DEPTHMASK_WRITE_ENABLE);
- } else {
- TheMtl->Set_Depth_Mask(PassIndex,W3DSHADER_DEPTHMASK_WRITE_DISABLE);
- }
- Set_Preset();
- break;
-
- case IDC_ALPHATEST_CHECK:
- if (SendDlgItemMessage(dlg_wnd,IDC_ALPHATEST_CHECK,BM_GETCHECK,0,0)) {
- TheMtl->Set_Alpha_Test(PassIndex,W3DSHADER_ALPHATEST_ENABLE);
- } else {
- TheMtl->Set_Alpha_Test(PassIndex,W3DSHADER_ALPHATEST_DISABLE);
- }
- Set_Preset();
- break;
-
- case IDC_SHADER_DEFAULTS_BUTTON:
- Set_Advanced_Defaults();
- break;
- }
- }
- }
- }
-
- return FALSE;
-}
-
-/***********************************************************************************************
- * PGMSD::ReloadDialog -- Setup the dialog box. *
- * *
- * *
- * *
- * *
- * HISTORY: *
- * 10/12/1999MLL: Created. *
- *=============================================================================================*/
-void PS2GameMtlShaderDlg::ReloadDialog(void)
-{
- DebugPrint("GameMtlShaderDlg::ReloadDialog\n");
- SendDlgItemMessage(m_hWnd, IDC_PRIGRADIENT_COMBO, CB_SETCURSEL, TheMtl->Get_Pri_Gradient(PassIndex), 0 );
- SendDlgItemMessage(m_hWnd, IDC_SECGRADIENT_COMBO, CB_SETCURSEL, TheMtl->Get_Sec_Gradient(PassIndex), 0 );
- SendDlgItemMessage(m_hWnd, IDC_DEPTHCOMPARE_COMBO, CB_SETCURSEL, TheMtl->Get_Depth_Compare(PassIndex), 0 );
- SendDlgItemMessage(m_hWnd, IDC_DETAILCOLOR_COMBO, CB_SETCURSEL, TheMtl->Get_Detail_Color_Func(PassIndex), 0 );
- SendDlgItemMessage(m_hWnd, IDC_DETAILALPHA_COMBO, CB_SETCURSEL, TheMtl->Get_Detail_Alpha_Func(PassIndex), 0 );
- SendDlgItemMessage(m_hWnd, IDC_A_COMBO, CB_SETCURSEL, TheMtl->Get_PS2_Shader_Param_A(PassIndex), 0);
- SendDlgItemMessage(m_hWnd, IDC_B_COMBO, CB_SETCURSEL, TheMtl->Get_PS2_Shader_Param_B(PassIndex), 0);
- SendDlgItemMessage(m_hWnd, IDC_C_COMBO, CB_SETCURSEL, TheMtl->Get_PS2_Shader_Param_C(PassIndex), 0);
- SendDlgItemMessage(m_hWnd, IDC_D_COMBO, CB_SETCURSEL, TheMtl->Get_PS2_Shader_Param_D(PassIndex), 0);
-
- Set_Preset();
-
- SetCheckBox(m_hWnd,IDC_DEPTHMASK_CHECK, TheMtl->Get_Depth_Mask(PassIndex));
- SetCheckBox(m_hWnd,IDC_ALPHATEST_CHECK, TheMtl->Get_Alpha_Test(PassIndex));
-}
-
-
-/***********************************************************************************************
- * PGMSD::Apply_Preset -- Notify the material of the values for the selected setting. *
- * *
- * *
- * *
- * *
- * HISTORY: *
- * 10/12/1999MLL: Created. *
- *=============================================================================================*/
-void PS2GameMtlShaderDlg::Apply_Preset(int preset_index)
-{
- if (preset_index < 0 || preset_index >= NUM_PS2_SHADER_BLEND_PRESETS) return;
-
- const PS2ShaderBlendSettingPreset &preset = PS2ShaderBlendSettingPresets[preset_index];
-
- int depth_mask = preset.DepthMask ? W3DSHADER_DEPTHMASK_WRITE_ENABLE : W3DSHADER_DEPTHMASK_WRITE_DISABLE;
- TheMtl->Set_Depth_Mask(PassIndex, depth_mask);
-
- int alpha_test = preset.AlphaTest ? W3DSHADER_ALPHATEST_ENABLE : W3DSHADER_ALPHATEST_DISABLE;
- TheMtl->Set_Alpha_Test(PassIndex, alpha_test);
-
- TheMtl->Set_PS2_Shader_Param_A(PassIndex, preset.A);
- TheMtl->Set_PS2_Shader_Param_B(PassIndex, preset.B);
- TheMtl->Set_PS2_Shader_Param_C(PassIndex, preset.C);
- TheMtl->Set_PS2_Shader_Param_D(PassIndex, preset.D);
-
- TheMtl->Notify_Changed();
- ReloadDialog();
-
- if (TheMtl->Compute_PC_Shader_From_PS2_Shader(PassIndex))
- SetWindowText(GetDlgItem(m_hWnd,IDC_COMPATIBLE), " Compatible");
- else
- SetWindowText(GetDlgItem(m_hWnd,IDC_COMPATIBLE), " NOT Compatible");
-
-}
-
-/***********************************************************************************************
- * PGMSD::Set_Preset -- Sets the dialog to one of the presets or custom. *
- * *
- * *
- * *
- * *
- * HISTORY: *
- * 10/12/1999MLL: Created. *
- *=============================================================================================*/
-void PS2GameMtlShaderDlg::Set_Preset(void)
-{
- for (int i = 0; i < NUM_PS2_SHADER_BLEND_PRESETS; i++) {
- if (CompareShaderToBlendPreset(PS2ShaderBlendSettingPresets[i])) break;
- }
- SendDlgItemMessage(m_hWnd, IDC_PS2_PRESET_COMBO, CB_SETCURSEL, i, 0);
-
- if (TheMtl->Compute_PC_Shader_From_PS2_Shader(PassIndex))
- SetWindowText(GetDlgItem(m_hWnd,IDC_COMPATIBLE), " Compatible");
- else
- SetWindowText(GetDlgItem(m_hWnd,IDC_COMPATIBLE), " NOT Compatible");
-}
-
-/***********************************************************************************************
- * PGMSD::CompareShaderToBlendPreset -- Determine if the settings conform to one of the presets*
- * *
- * *
- * *
- * *
- * HISTORY: *
- * 10/12/1999MLL: Created. *
- *=============================================================================================*/
-bool PS2GameMtlShaderDlg::CompareShaderToBlendPreset(const PS2ShaderBlendSettingPreset &blend_preset)
-{
- bool depthmask = TheMtl->Get_Depth_Mask(PassIndex) != W3DSHADER_DEPTHMASK_WRITE_DISABLE;
- if (depthmask != blend_preset.DepthMask) return false;
- bool alphatest = TheMtl->Get_Alpha_Test(PassIndex) != W3DSHADER_ALPHATEST_DISABLE;
- if (alphatest != blend_preset.AlphaTest) return false;
-
- if (TheMtl->Get_PS2_Shader_Param_A(PassIndex) != blend_preset.A) return false;
- if (TheMtl->Get_PS2_Shader_Param_B(PassIndex) != blend_preset.B) return false;
- if (TheMtl->Get_PS2_Shader_Param_C(PassIndex) != blend_preset.C) return false;
- if (TheMtl->Get_PS2_Shader_Param_D(PassIndex) != blend_preset.D) return false;
-
- return true;
-}
-
-
-/***********************************************************************************************
- * GameMtlShaderDlg::Set_Advanced_Defaults -- set advanced settings to defaults *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 02/26/99 NH : Created. *
- *=============================================================================================*/
-void PS2GameMtlShaderDlg::Set_Advanced_Defaults(void)
-{
- TheMtl->Set_Pri_Gradient(PassIndex, PSS_PRIGRADIENT_MODULATE);
- TheMtl->Set_Depth_Compare(PassIndex, PSS_DEPTHCOMPARE_PASS_LEQUAL);
- TheMtl->Set_Detail_Color_Func(PassIndex, W3DSHADER_DETAILCOLORFUNC_DEFAULT);
- TheMtl->Set_Detail_Alpha_Func(PassIndex, W3DSHADER_DETAILALPHAFUNC_DEFAULT);
-
- TheMtl->Notify_Changed();
- ReloadDialog();
-}
\ No newline at end of file
diff --git a/Generals/Code/Tools/WW3D/max2w3d/PS2GameMtlShaderDlg.h b/Generals/Code/Tools/WW3D/max2w3d/PS2GameMtlShaderDlg.h
deleted file mode 100644
index adbe1fa0ee9..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/PS2GameMtlShaderDlg.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project name : Buccaneer Bay *
- * *
- * File name : PS2GameMtlShaderDlg.h *
- * *
- * Programmer : Mike Lytle *
- * *
- * Start date : 10/12/1999 *
- * *
- * Last update : 10/12/1999 *
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#ifndef PS2GAMEMTLSHADERDLG_H
-#define PS2GAMEMTLSHADERDLG_H
-
-#include
-#include "GameMtlForm.h"
-
-// This class was taken from GTH's GameMtlShaderDlg.
-
-class GameMtl;
-struct PS2ShaderBlendSettingPreset;
-
-class PS2GameMtlShaderDlg : public GameMtlFormClass
-{
-
-public:
-
- PS2GameMtlShaderDlg(HWND parent, IMtlParams * imp, GameMtl * m, int pass);
-
- virtual BOOL Dialog_Proc (HWND dlg_wnd, UINT message, WPARAM wparam, LPARAM lparam);
-
- void ReloadDialog(void);
-
- // Pure virtual that must be defined.
- void ActivateDlg(BOOL onOff) {}
-
-private:
-
- void Apply_Preset(int preset_index);
- void Set_Preset(void);
- bool CompareShaderToBlendPreset(const PS2ShaderBlendSettingPreset &blend_preset);
- void Set_Advanced_Defaults(void);
-};
-
-#endif
\ No newline at end of file
diff --git a/Generals/Code/Tools/WW3D/max2w3d/SceneSetup.cpp b/Generals/Code/Tools/WW3D/max2w3d/SceneSetup.cpp
deleted file mode 100644
index bce702d5e90..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/SceneSetup.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : G *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/SceneSetup.cpp $*
- * *
- * $Author:: Andre_a $*
- * *
- * $Modtime:: 10/15/99 3:33p $*
- * *
- * $Revision:: 2 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * wwSceneSetup -- Allows the user to select how many LOD and damage models to create. *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-/*
-** SceneSetup.cpp - Implements the "wwSceneSetup" MAXScript function to
-** present a nice dialog to the user for getting a number of parameters
-** that will governs the number, placement, and type of LOD and Damage
-** models created in the scene.
-*/
-
-
-#include "SceneSetupDlg.h"
-
-#undef STRICT
-#include
-#include
-#include
-#include
-
-
-/*
-** Let MAXScript know we're implementing new built-in functions.
-*/
-def_visible_primitive(scene_setup, "wwSceneSetup");
-
-
-/***********************************************************************************************
- * scene_setup_cf - MAXScript function wwSceneSetup *
- * *
- * wwSceneSetup - Usage: wwSceneSetup arg_array *
- * *
- * INPUT: *
- * The contents of the given array is assumed to be as follows: *
- * lod_count (int) - the number of LOD models that will be created *
- * lod_offset (float) - X offset to move the LODs by *
- * lod_clone (int) - 1==copy 2==instance 3==reference *
- * damage_count (int) - the number of damage models that will be created *
- * damage_offset (float) - Y offset to move the LODs by *
- * damage_clone (int) - 1==copy 2==instance 3==reference *
- * *
- * OUTPUT: *
- * The function returns an array of the new values the user selected in the same format as *
- * above.
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 9/27/1999 AJA : Created. *
- *=============================================================================================*/
-Value * scene_setup_cf (Value **arg_list, int count)
-{
- // We don't want any arguments for this function.
- check_arg_count("wwSceneSetup", 1, count);
- type_check(arg_list[0], Array, "Parameter array");
-
- SceneSetupDlg dlg(MAXScript_interface);
- one_typed_value_local(Array* result);
-
- // Read the initial values out of the array.
- Array *args = (Array*)(arg_list[0]);
- dlg.m_LodCount = (args->get(1))->to_int();
- dlg.m_LodOffset = (args->get(2))->to_float();
- dlg.m_LodProc = (args->get(3))->to_int();
- dlg.m_DamageCount = (args->get(4))->to_int();
- dlg.m_DamageOffset = (args->get(5))->to_float();
- dlg.m_DamageProc = (args->get(6))->to_int();
-
- // Display the dialog
- if (dlg.DoModal() == IDCANCEL)
- {
- pop_value_locals();
- return &undefined;
- }
-
- // Stuff the values the user chose into the array we'll return.
- vl.result = new Array(6);
- vl.result->append(Integer::intern(dlg.m_LodCount));
- vl.result->append(Float::intern(dlg.m_LodOffset));
- vl.result->append(Integer::intern(dlg.m_LodProc));
- vl.result->append(Integer::intern(dlg.m_DamageCount));
- vl.result->append(Float::intern(dlg.m_DamageOffset));
- vl.result->append(Integer::intern(dlg.m_DamageProc));
-
- // Return the array of new values.
- return_value(vl.result);
-}
-
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/SceneSetupDlg.cpp b/Generals/Code/Tools/WW3D/max2w3d/SceneSetupDlg.cpp
deleted file mode 100644
index 69c81b74580..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/SceneSetupDlg.cpp
+++ /dev/null
@@ -1,285 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : G *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/SceneSetupDlg.cpp $*
- * *
- * $Author:: Andre_a $*
- * *
- * $Modtime:: 10/15/99 3:37p $*
- * *
- * $Revision:: 2 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-// SceneSetupDlg.cpp : implementation file
-//
-
-#include "SceneSetupDlg.h"
-#include
-#include
-
-static BOOL CALLBACK _thunk_dialog_proc (HWND hWnd, UINT uMsg, WPARAM wAparam, LPARAM lParam);
-
-
-
-/////////////////////////////////////////////////////////////////////////////
-// SceneSetupDlg dialog
-
-
-SceneSetupDlg::SceneSetupDlg(Interface *max_interface)
-{
- m_DamageCount = 0;
- m_DamageOffset = -100.0f;
- m_LodCount = 0;
- m_LodOffset = -100.0f;
- m_DamageProc = 3;
- m_LodProc = 3;
- m_hWnd = NULL;
- m_MaxInterface = max_interface;
- assert(max_interface != NULL);
-}
-
-
-/////////////////////////////////////////////////////////////////////////////
-// SceneSetupDlg Protected Methods
-
-void SceneSetupDlg::SetEditInt (int control_id, int value)
-{
- char buf[64];
- sprintf(buf, "%d", value);
- HWND edit = GetDlgItem(m_hWnd, control_id);
- assert(edit != NULL);
- SetWindowText(edit, buf);
-}
-
-void SceneSetupDlg::SetEditFloat (int control_id, float value)
-{
- char buf[64];
- sprintf(buf, "%.0f", value);
- HWND edit = GetDlgItem(m_hWnd, control_id);
- assert(edit != NULL);
- SetWindowText(edit, buf);
-}
-
-int SceneSetupDlg::GetEditInt (int control_id)
-{
- char buf[64];
- HWND edit = GetDlgItem(m_hWnd, control_id);
- assert(edit != NULL);
- GetWindowText(edit, buf, sizeof(buf));
- int value = 0;
- sscanf(buf, "%d", &value);
- return value;
-}
-
-float SceneSetupDlg::GetEditFloat (int control_id)
-{
- char buf[64];
- HWND edit = GetDlgItem(m_hWnd, control_id);
- assert(edit != NULL);
- GetWindowText(edit, buf, sizeof(buf));
- float value = 0;
- sscanf(buf, "%f", &value);
- return value;
-}
-
-bool SceneSetupDlg::ValidateEditFloat (int control_id)
-{
- char buf[64];
- HWND edit = GetDlgItem(m_hWnd, control_id);
- assert(edit != NULL);
- GetWindowText(edit, buf, sizeof(buf));
- float value = 0;
- if (sscanf(buf, "%f", &value) == 1)
- return true;
- else
- return false;
-}
-
-/////////////////////////////////////////////////////////////////////////////
-// SceneSetupDlg Public Methods
-
-int SceneSetupDlg::DoModal (void)
-{
- // Put up the dialog box.
- BOOL result = DialogBoxParam(AppInstance, MAKEINTRESOURCE(IDD_SCENE_SETUP),
- m_MaxInterface->GetMAXHWnd(), (DLGPROC)_thunk_dialog_proc,
- (LPARAM)this);
-
- // Return IDOK if the user accepted the new settings.
- return (result == 1) ? IDOK : IDCANCEL;
-}
-
-/////////////////////////////////////////////////////////////////////////////
-// SceneSetupDlg DialogProc
-
-BOOL CALLBACK _thunk_dialog_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
- static SceneSetupDlg *dialog = NULL;
-
- if (uMsg == WM_INITDIALOG)
- {
- dialog = (SceneSetupDlg*)lParam;
- dialog->m_hWnd = hWnd;
- }
-
- if (dialog)
- return dialog->DialogProc(hWnd, uMsg, wParam, lParam);
- else
- return 0;
-}
-
-BOOL CALLBACK SceneSetupDlg::DialogProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
- int code = HIWORD(wParam);
-
- switch (uMsg)
- {
-
- /*******************************************************************
- * WM_INITDIALOG
- *
- * Initialize all of the custom controls for the dialog box
- *
- *******************************************************************/
- case WM_INITDIALOG:
-
- OnInitDialog();
- return TRUE;
-
-
- /*******************************************************************
- * WM_COMMAND
- *
- *
- *******************************************************************/
- case WM_COMMAND:
-
- switch (LOWORD(wParam))
- {
- case IDOK:
-
- if (OnOK() == FALSE)
- return TRUE;
-
- SetCursor(LoadCursor(NULL, IDC_WAIT));
- EndDialog(m_hWnd, 1);
- break;
-
- case IDCANCEL:
- EndDialog(m_hWnd, 0);
- break;
-
- }
- return TRUE;
-
- }
-
- return FALSE;
-}
-
-
-/////////////////////////////////////////////////////////////////////////////
-// SceneSetupDlg message handlers
-
-void SceneSetupDlg::OnInitDialog()
-{
- CenterWindow(m_hWnd, m_MaxInterface->GetMAXHWnd());
- SetCursor(LoadCursor(NULL, IDC_ARROW));
-
- // Select the appropriate radio buttons.
- switch (m_LodProc)
- {
- case 1:
- CheckDlgButton(m_hWnd, IDC_LOD_AS_COPY, BST_CHECKED);
- break;
- case 2:
- CheckDlgButton(m_hWnd, IDC_LOD_AS_INSTANCE, BST_CHECKED);
- break;
- case 3:
- CheckDlgButton(m_hWnd, IDC_LOD_AS_REFERENCE, BST_CHECKED);
- break;
- }
- switch (m_DamageProc)
- {
- case 1:
- CheckDlgButton(m_hWnd, IDC_DAMAGE_AS_COPY, BST_CHECKED);
- break;
- case 2:
- CheckDlgButton(m_hWnd, IDC_DAMAGE_AS_INSTANCE, BST_CHECKED);
- break;
- case 3:
- CheckDlgButton(m_hWnd, IDC_DAMAGE_AS_REFERENCE, BST_CHECKED);
- break;
- }
-
- // Set the text for the edit boxes.
- SetEditInt(IDC_LOD_COUNT, m_LodCount);
- SetEditFloat(IDC_LOD_OFFSET, m_LodOffset);
- SetEditInt(IDC_DAMAGE_COUNT, m_DamageCount);
- SetEditFloat(IDC_DAMAGE_OFFSET, m_DamageOffset);
-}
-
-BOOL SceneSetupDlg::OnOK()
-{
- if (!ValidateEditFloat(IDC_LOD_OFFSET))
- {
- MessageBox(m_hWnd, "You must enter a valid number for the LOD Offset.",
- "Not a Number", MB_OK);
- SetFocus(GetDlgItem(m_hWnd, IDC_LOD_OFFSET));
- return FALSE;
- }
- if (!ValidateEditFloat(IDC_DAMAGE_OFFSET))
- {
- MessageBox(m_hWnd, "You must enter a valid number for the Damage Offset.",
- "Not a Number", MB_OK);
- SetFocus(GetDlgItem(m_hWnd, IDC_DAMAGE_OFFSET));
- return FALSE;
- }
-
- // Get the clone procedure the user wants to use.
- if (IsDlgButtonChecked(m_hWnd, IDC_LOD_AS_COPY))
- m_LodProc = 1;
- else if (IsDlgButtonChecked(m_hWnd, IDC_LOD_AS_INSTANCE))
- m_LodProc = 2;
- else if (IsDlgButtonChecked(m_hWnd, IDC_LOD_AS_REFERENCE))
- m_LodProc = 3;
- if (IsDlgButtonChecked(m_hWnd, IDC_DAMAGE_AS_COPY))
- m_DamageProc = 1;
- else if (IsDlgButtonChecked(m_hWnd, IDC_DAMAGE_AS_INSTANCE))
- m_DamageProc = 2;
- else if (IsDlgButtonChecked(m_hWnd, IDC_DAMAGE_AS_REFERENCE))
- m_DamageProc = 3;
-
- // Get the other values the user selected.
- m_LodCount = GetEditInt(IDC_LOD_COUNT);
- m_LodOffset = GetEditFloat(IDC_LOD_OFFSET);
- m_DamageCount = GetEditInt(IDC_DAMAGE_COUNT);
- m_DamageOffset = GetEditFloat(IDC_DAMAGE_OFFSET);
-
- return TRUE;
-}
diff --git a/Generals/Code/Tools/WW3D/max2w3d/SceneSetupDlg.h b/Generals/Code/Tools/WW3D/max2w3d/SceneSetupDlg.h
deleted file mode 100644
index c76bb972955..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/SceneSetupDlg.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : G *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/SceneSetupDlg.h $*
- * *
- * $Author:: Andre_a $*
- * *
- * $Modtime:: 10/15/99 4:24p $*
- * *
- * $Revision:: 2 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#ifndef SCENESETUPDLG_H
-#define SCENESETUPDLG_H
-
-// SceneSetupDlg.h : header file
-//
-
-#include "dllmain.h"
-#include "resource.h"
-
-
-class Interface;
-
-/////////////////////////////////////////////////////////////////////////////
-// SceneSetupDlg dialog
-
-class SceneSetupDlg
-{
-public:
-
- // Construction
- SceneSetupDlg(Interface *max_interface);
-
- // Methods
- int DoModal (void);
-
- // DialogProc
- BOOL CALLBACK DialogProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
-
- // Dialog data associated with GUI components.
- enum { IDD = IDD_SCENE_SETUP };
- int m_DamageCount;
- float m_DamageOffset;
- int m_LodCount;
- float m_LodOffset;
- int m_LodProc;
- int m_DamageProc;
-
- // Dialog Data
- HWND m_hWnd;
-
-protected:
-
- // Message Handlers
- void OnInitDialog (void);
- BOOL OnOK (void); // TRUE if ok to close dialog
-
- // Protected Methods
- void SetEditInt (int control_id, int value);
- void SetEditFloat (int control_id, float value);
- int GetEditInt (int control_id);
- float GetEditFloat (int control_id);
- bool ValidateEditFloat (int control_id);
-
- // Protected Data
- Interface *m_MaxInterface;
-};
-
-#endif
diff --git a/Generals/Code/Tools/WW3D/max2w3d/SkinCopy.cpp b/Generals/Code/Tools/WW3D/max2w3d/SkinCopy.cpp
deleted file mode 100644
index 7603f4bcf0d..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/SkinCopy.cpp
+++ /dev/null
@@ -1,526 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : G *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/SkinCopy.cpp $*
- * *
- * $Author:: Andre_a $*
- * *
- * $Modtime:: 11/03/99 11:51a $*
- * *
- * $Revision:: 3 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * find_skin_binding -- Find the "WWSkin Binding" modifier on this object. *
- * find_skin_wsm -- Finds the node for the WWSkin WSM used by this object. *
- * get_skin_wsm_obj -- Gets the SkinWSMObjectClass from a WWSkin WSM node. *
- * duplicate_wsm -- Duplicates a WWSkin WSM *
- * find_equivalent_node -- Searches a hierarchy for an object equivalent to the given one. *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-/*
--- Copy the skin info for this object into the target object.
--- If we haven't copied the WSM yet, it will be copied.
-new_wsm = wwCopySkinInfo source_root target_root new_wsm
-*/
-
-#include // Main MAXScript header
-#include // MAX* Wrapper objects
-#include // def_* functions to create static function headers
-
-#include
-#include
-
-#include "skin.h"
-#include "util.h"
-#include "w3d_file.h"
-
-
-/*
-** Forward declarations
-*/
-
-Value *find_skin_node_in_tree (INode *root);
-
-SkinModifierClass *find_skin_binding (INode *skinned_obj);
-
-INode *find_skin_wsm (INode *skinned_obj);
-
-SkinWSMObjectClass *get_skin_wsm_obj (INode *wsm_node);
-
-INode *duplicate_wsm (INode *skinned_obj, INode *tree_root);
-
-INode *find_equivalent_node (INode *source, INode *tree, bool name_is_valid = false);
-
-Value *copy_skin_info (INode *source, INode *target, INode *wsm);
-
-IDerivedObject *setup_wsm_derived_obj (INode *node);
-
-ModContext *find_skin_mod_context (INode *node);
-
-
-/*
-** Let MAXScript know we're implementing a new built-in function.
-*/
-def_visible_primitive(find_skin_node, "wwFindSkinNode");
-def_visible_primitive(copy_skin_info, "wwCopySkinInfo");
-def_visible_primitive(dupe_skin_wsm, "wwDuplicateSkinWSM");
-
-
-/*
-**
-** MAXScript Function:
-** wwFindSkinNode - Usage: wwFindSkinNode tree_root_node
-**
-** Searches the given hierarchy tree for the node containing
-** the WWSkin WSM. Returns the node if found, otherwise it
-** returns undefined.
-**
-** Used by the SceneSetup MAXScript.
-*/
-Value *find_skin_node_cf (Value **arg_list, int count)
-{
- // Verify the number and type of the arguments.
- check_arg_count("wwFindSkinNode", 1, count);
- type_check(arg_list[0], MAXNode, "Tree Root INode");
-
- // Get the INode that was passed in.
- INode *tree_root = arg_list[0]->to_node();
-
- // Search the tree for the WWSkin WSM, and return
- // the node which references it.
- return find_skin_node_in_tree(tree_root);
-}
-
-/*
-**
-** MAXScript Function:
-** wwCopySkinInfo - Usage: wwCopySkinInfo from_node to_node wsm_node to_tree_root
-**
-** Copies the skin info for the given node to the target node.
-** If wsm_node is "undefined" then we will create a new WWSkin WSM
-** with the same values as the one being used by from_node.
-** If from_node doesn't have a WWSkin binding, the return value
-** is "undefined". If the function succeeds, it returns the
-** wsm_node (the new WSM if it was created, otherwise the old wsm_node).
-**
-** Used by the SceneSetup MAXScript.
-*/
-Value * copy_skin_info_cf (Value **arg_list, int count)
-{
- // Verify the number and type of the arguments.
- check_arg_count("wwCopySkinInfo", 4, count);
- type_check(arg_list[0], MAXNode, "Source INode");
- type_check(arg_list[1], MAXNode, "Target INode");
- type_check(arg_list[3], MAXNode, "Target Tree Root INode");
-
- // Get the INode pointers that were passed in.
- INode *src_node = arg_list[0]->to_node();
- INode *dest_node = arg_list[1]->to_node();
- INode *wsm_node = NULL;
- INode *tree_root = arg_list[3]->to_node();
- if (arg_list[2] == &undefined)
- {
- // Duplicate the WSM used by src_node.
- wsm_node = duplicate_wsm(find_skin_wsm(src_node), tree_root);
- if (wsm_node == NULL)
- return &undefined;
- }
- else
- wsm_node = arg_list[2]->to_node();
-
- return copy_skin_info(src_node, dest_node, wsm_node);
-}
-
-
-/*
-**
-** MAXScript Function:
-** wwDuplicateSkinWSM - Usage: wwDuplicateSkinWSM wwskin_wsm_node tree_root
-**
-** Duplicates the given WWSkin WSM. tree_root is the root node of a hierarchy
-** containing bones similar to the ones used by the given WSM. The hierarchy
-** will be searched for equivalent bones (ie. names the same except their
-** extension), and those bones will be used by the newly duplicated WSM.
-**
-** Used by the SceneSetup MAXScript.
-*/
-Value * dupe_skin_wsm_cf (Value **arg_list, int count)
-{
- // Verify the number and type of the arguments.
- check_arg_count("wwDuplicateSkinWSM", 2, count);
- type_check(arg_list[0], MAXNode, "WWSkin Object INode");
- type_check(arg_list[1], MAXNode, "Target Tree Root INode");
-
- // Get the INode pointers that were passed in.
- INode *wsm_node = arg_list[0]->to_node();
- INode *root_node = arg_list[1]->to_node();
-
- // Return the duplicated WWSkin WSM.
- INode *dupe = duplicate_wsm(wsm_node, root_node);
- if (!dupe)
- return &undefined;
- else
- {
- // Return the WSM.
- one_typed_value_local(Value* wsm_node);
- vl.wsm_node = MAXNode::intern(dupe);
- return_value(vl.wsm_node);
- }
-}
-
-
-Value *find_skin_node_in_tree (INode *root)
-{
- if (root == NULL)
- return &undefined;
-
- // Is this the node we're looking for?
- if (get_skin_wsm_obj(root))
- {
- one_typed_value_local(Value* wsm_node);
- vl.wsm_node = MAXNode::intern(root);
- return_value(vl.wsm_node);
- }
-
- // Search the children of this node.
- for (int i = 0; i < root->NumChildren(); i++)
- {
- Value *retval = find_skin_node_in_tree(root->GetChildNode(i));
- if (retval != &undefined)
- return retval;
- }
-
- // Didn't find it anywhere!
- return &undefined;
-}
-
-
-/***********************************************************************************************
- * find_skin_binding -- Find the "WWSkin Binding" modifier on this object. *
- * *
- * INPUT: The skinned object. *
- * *
- * OUTPUT: The skin modifier, or NULL if one doesn't exist. *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/19/1999 AJA : Created. *
- *=============================================================================================*/
-SkinModifierClass *find_skin_binding (INode *skinned_obj)
-{
- // WWSkin Binding ties us to a space warp, so search the node's
- // WSM Derived Object for the WWSkin Binding modifier.
- IDerivedObject *dobj = skinned_obj->GetWSMDerivedObject();
- if (dobj == NULL)
- return NULL; // not bound to a space warp
-
- // Search for the WWSkin Binding modifier on this derived object.
- for (int i = 0; i < dobj->NumModifiers(); i++)
- {
- Modifier *mod = dobj->GetModifier(i);
- if (mod->ClassID() != SKIN_MOD_CLASS_ID)
- continue;
-
- // We found the skin modifier.
- return (SkinModifierClass*)mod;
- }
-
- // Skin modifier not found.
- return NULL;
-}
-
-
-/***********************************************************************************************
- * find_skin_wsm -- Finds the node for the WWSkin WSM used by this object. *
- * *
- * INPUT: The node of an object with a WWSkin Binding. *
- * *
- * OUTPUT: The node of the WWSkin WSM referenced by the given object. *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/18/1999 AJA : Created. *
- *=============================================================================================*/
-INode *find_skin_wsm (INode *skinned_obj)
-{
- // Find the skin modifier on this object.
- SkinModifierClass *skin_mod = find_skin_binding(skinned_obj);
- if (skin_mod == NULL)
- return NULL;
-
- // Using the skin modifer, find the WSM's INode.
- INode *wsm = (INode*)( skin_mod->GetReference(SkinModifierClass::NODE_REF) );
- if (wsm == NULL)
- {
- char buf[256];
- sprintf(buf, "%s has a WWSkin Binding, but I can't find its WWSkin WSM!",
- skinned_obj->GetName());
- throw RuntimeError(buf);
- }
-
- return wsm;
-}
-
-
-/***********************************************************************************************
- * get_skin_wsm_obj -- Gets the SkinWSMObjectClass from a WWSkin WSM node. *
- * *
- * INPUT: The node for the WWSkin WSM's representation in the scene. *
- * *
- * OUTPUT: The SkinWSMObjectClass. *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/18/1999 AJA : Created. *
- *=============================================================================================*/
-SkinWSMObjectClass *get_skin_wsm_obj (INode *wsm_node)
-{
- // We need a valid node.
- if (!wsm_node)
- return NULL;
-
- // The node must reference an object.
- Object *obj = wsm_node->GetObjectRef();
- if (!obj)
- return NULL;
-
- // That BASE object must be a SkinWSMObject
- while (obj)
- {
- // If this is a derived object, burrow deeper,
- // otherwise we're at the base object.
- if (obj->SuperClassID() == GEN_DERIVOB_CLASS_ID)
- obj = ((IDerivedObject*)obj)->GetObjRef();
- else
- break;
- }
- if (obj->ClassID() != SKIN_OBJ_CLASS_ID)
- return NULL;
-
- // Return it.
- return (SkinWSMObjectClass*)obj;
-}
-
-
-/***********************************************************************************************
- * duplicate_wsm -- Duplicates a WWSkin WSM *
- * *
- * INPUT: wsm_node - INode of the WWSkin WSM object. *
- * tree - The root of a tree containing equivalents of the bones in the WWSkin used *
- * by skinned_obj. The bone names must be the same (after being processed by *
- * Set_W3D_Name() *
- * *
- * OUTPUT: The node of the newly duplicated WWSkin WSM. *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/18/1999 AJA : Created. *
- * 11/3/1999 AJA : Changed first argument from skinned_obj to wsm_node. *
- *=============================================================================================*/
-INode *duplicate_wsm (INode *wsm_node, INode *tree)
-{
- SkinWSMObjectClass *wsm_obj = get_skin_wsm_obj(wsm_node);
-
- if (!wsm_node || !wsm_obj)
- return NULL;
-
- /*
- ** Duplicate the WSM.
- */
-
- SkinWSMObjectClass *new_wsm_obj =
- (SkinWSMObjectClass*)CreateInstance(WSM_OBJECT_CLASS_ID, SKIN_OBJ_CLASS_ID);
- if (!new_wsm_obj)
- return NULL;
-
- // Create a new node in the scene that points to the new WSM object.
- INode *new_wsm_node = MAXScript_interface->CreateObjectNode(new_wsm_obj);
- if (!new_wsm_node)
- return NULL;
-
- // Copy the bones from one to the other.
- for (int i = 0; i < wsm_obj->Num_Bones(); i++)
- {
- INode *src_bone = wsm_obj->Get_Bone(i);
- INode *dst_bone = find_equivalent_node(src_bone, tree);
- if (!src_bone || !dst_bone)
- return NULL;
-
- new_wsm_obj->Add_Bone(dst_bone);
- }
-
- // Return a pointer to the new WSM node.
- return new_wsm_node;
-}
-
-
-/***********************************************************************************************
- * find_equivalent_node -- Searches a hierarchy for an object equivalent to the given one. *
- * *
- * INPUT: source - The node to search for an equivalent of. *
- * tree - The hierarchy to search in. *
- * *
- * OUTPUT: The equivalent node, or NULL if none was found. *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/19/1999 AJA : Created. *
- *=============================================================================================*/
-INode *find_equivalent_node (INode *source, INode *tree, bool name_is_valid)
-{
- // We need a valid source and tree.
- if (!source || !tree)
- return NULL;
-
- // The name of the source object. We'll only evaluate this once as an easy optimization.
- static char src_name[W3D_NAME_LEN];
- if (!name_is_valid)
- Set_W3D_Name(src_name, source->GetName());
-
- // The name of the current object we're examining.
- char chk_name[W3D_NAME_LEN];
- Set_W3D_Name(chk_name, tree->GetName());
-
- // Is this the node we're looking for?
- if (strcmp(src_name, chk_name) == 0)
- return tree; // Yup, sure is.
-
- // Nope. Check its children.
- for (int i = 0; i < tree->NumberOfChildren(); i++)
- {
- INode *retval = find_equivalent_node(source, tree->GetChildNode(i), true);
- if (retval != NULL)
- return retval; // we found the node in our children
- }
-
- // No equivalent node was found.
- return NULL;
-}
-
-
-Value *copy_skin_info (INode *source, INode *target, INode *wsm)
-{
- // Get the "WWSkin Binding" modifier on the source object.
- SkinModifierClass *source_modifier = find_skin_binding(source);
- if (source_modifier == NULL)
- return &undefined;
-
- // Get the WSMDerivedObject we can add our skin binding modifier to.
- IDerivedObject *dobj = setup_wsm_derived_obj(target);
-
- // Create a new skin modifier and copy the source modifier's settings to it.
- SkinModifierClass *new_modifier = new SkinModifierClass(wsm, get_skin_wsm_obj(wsm));
- if (new_modifier == NULL)
- throw RuntimeError("Out of memory - Unable to allocate a new SkinModifierClass object!");
- new_modifier->SubObjSelLevel = source_modifier->SubObjSelLevel;
-
- // Dupe the mod context, especially the local mod data hanging off of it.
- ModContext *source_context = find_skin_mod_context(source);
- ModContext *new_context = new ModContext(source_context->tm, source_context->box,
- source_context->localData);
- if (new_context == NULL)
- throw RuntimeError("Out of memory - Unable to allocate a new ModContext object!");
-
- // Add a new "WWSkin Binding" modifier to the target object to associate
- // the object with the skin WSM. All of the settings should be correct,
- // and the target object becomes a "skinned object".
- dobj->AddModifier(new_modifier, new_context);
-
- // Return the WSM.
- one_typed_value_local(Value* wsm_node);
- vl.wsm_node = MAXNode::intern(wsm);
- return_value(vl.wsm_node);
-}
-
-
-IDerivedObject *setup_wsm_derived_obj (INode *node)
-{
- // Check if the target object is already bound to a space warp.
- IDerivedObject *dobj = node->GetWSMDerivedObject();
- if (dobj != NULL)
- {
- // It's bound to a space warp. Check if WWSkin is one of the
- // space warp bindings. If so, remove it (we don't want to
- // be bound to an old skin).
- for (int i = 0; i < dobj->NumModifiers(); i++)
- {
- Modifier *mod = dobj->GetModifier(i);
- if (mod->ClassID() != SKIN_MOD_CLASS_ID)
- continue;
-
- // We found the skin modifier, remove it.
- dobj->DeleteModifier(i);
- break;
- }
- }
- else
- {
- // This object isn't bound to a space warp. Create a
- // WSMDerivedObject for the node to play with.
- dobj = CreateWSDerivedObject(node->GetObjectRef());
- if (dobj == NULL)
- {
- char msg[128];
- sprintf(msg, "Error setting up the WSMDerivedObject for %s", node->GetName());
- throw RuntimeError(msg);
- }
- node->SetObjectRef(dobj);
- }
-
- return dobj;
-}
-
-
-ModContext *find_skin_mod_context (INode *node)
-{
- // We need a valid node
- if (node == NULL)
- return NULL;
-
- // The node needs to be bound to a space warp (ie. must have
- // a WSMDerivedObject).
- IDerivedObject *dobj = node->GetWSMDerivedObject();
- if (dobj == NULL)
- return NULL;
-
- // It's bound to a space warp. Find the WWSkin modifier.
- for (int i = 0; i < dobj->NumModifiers(); i++)
- {
- Modifier *mod = dobj->GetModifier(i);
- if (mod->ClassID() != SKIN_MOD_CLASS_ID)
- continue;
-
- // We found the skin modifier, return its mod context.
- return dobj->GetModContext(i);
- }
-
- // We didn't find a WWSkin binding.
- return NULL;
-}
\ No newline at end of file
diff --git a/Generals/Code/Tools/WW3D/max2w3d/SnapPoints.cpp b/Generals/Code/Tools/WW3D/max2w3d/SnapPoints.cpp
deleted file mode 100644
index 0f1ea46d4de..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/SnapPoints.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Max2W3d *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/SnapPoints.cpp $*
- * *
- * Author:: Greg Hjelstrom *
- * *
- * $Modtime:: 11/23/98 11:05a $*
- * *
- * $Revision:: 3 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#if defined(_MSC_VER)
-#pragma once
-#endif
-
-#include "SnapPoints.h"
-#include "chunkio.h"
-#include "max.h"
-#include "nodelist.h"
-#include "w3d_file.h"
-
-
-class PointFilterClass : public INodeFilterClass
-{
-public:
- PointFilterClass(void) { }
-
- virtual BOOL Accept_Node(INode * node, TimeValue time)
- {
- if (node == NULL) return FALSE;
- Object * obj = node->EvalWorldState(time).obj;
- if (obj == NULL) return FALSE;
-
- if
- (
- obj->ClassID() == Class_ID(POINTHELP_CLASS_ID,0) &&
- !node->IsHidden()
- )
- {
- return TRUE;
- } else {
- return FALSE;
- }
- }
-};
-
-
-void SnapPointsClass::Export_Points(INode * scene_root,TimeValue time,ChunkSaveClass & csave)
-{
- if (scene_root == NULL) return;
-
- PointFilterClass pointfilter;
- INodeListClass pointlist(scene_root,time,&pointfilter);
-
- if (pointlist.Num_Nodes() > 0) {
-
- csave.Begin_Chunk(W3D_CHUNK_POINTS);
-
- for (unsigned int ci=0; ciGetNodeTM(time).GetTrans();
- vect.X = pos.x;
- vect.Y = pos.y;
- vect.Z = pos.z;
- csave.Write(&vect,sizeof(vect));
-
- }
-
- csave.End_Chunk();
- }
-}
diff --git a/Generals/Code/Tools/WW3D/max2w3d/SnapPoints.h b/Generals/Code/Tools/WW3D/max2w3d/SnapPoints.h
deleted file mode 100644
index 6071e1d96f8..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/SnapPoints.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Max2W3D *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/SnapPoints.h $*
- * *
- * Author:: Greg Hjelstrom *
- * *
- * $Modtime:: 11/19/98 4:36p $*
- * *
- * $Revision:: 2 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#if defined(_MSC_VER)
-#pragma once
-#endif
-
-#ifndef SNAPPOINTS_H
-#define SNAPPOINTS_H
-
-#include "max.h"
-
-class ChunkSaveClass;
-class INode;
-
-/*
-** This class simply contains static functions which will find
-** helper points that should be exported with a w3d render object and
-** export them in a chunk using the given ChunkSaveClass object.
-*/
-class SnapPointsClass
-{
-public:
- static void Export_Points(INode * scene_root,TimeValue time,ChunkSaveClass & csave);
-};
-
-#endif
diff --git a/Generals/Code/Tools/WW3D/max2w3d/TARGA.CPP b/Generals/Code/Tools/WW3D/max2w3d/TARGA.CPP
deleted file mode 100644
index ba77e106d12..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/TARGA.CPP
+++ /dev/null
@@ -1,1397 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/****************************************************************************
-*
-* C O N F I D E N T I A L --- W E S T W O O D S T U D I O S
-*
-*----------------------------------------------------------------------------
-*
-* FILE
-* targa.cpp
-*
-* DESCRIPTION
-* Targa image file class.
-*
-* PROGRAMMER
-* Denzil E. Long, Jr.
-*
-* DATE
-* August 8, 1995
-*
-*----------------------------------------------------------------------------
-*
-* PUBLIC
-* Open - Open Targa image file.
-* Close - Close Targa image file.
-* Load - Load Targa image file.
-* Save - Save a Targa Image File.
-* XFlip - X flip the image.
-* YFlip - Y flip the image.
-* SetImage - Set the image buffer.
-* GetImage - Get the current image buffer address.
-* SetPalette - Set the palette buffer.
-* GetPalette - Retrieve the current palette buffer address.
-* GetExtension - Get Extension data. (Targa 2.0 files only)
-*
-* PRIVATE
-* DecodeImage - Decompress Targa image data.
-* EncodeImage - Compress the image using targa RLE.
-* InvertImage - Invert TrueColor image data.
-*
-* MODIFICATIONS:
-* Converted to work with FileClass, FileFactory (changes are inside
-* ifdefs, so can be easily reversed). Naty Hoffman, January 25, 2001
-*
-****************************************************************************/
-
-#include "TARGA.H"
-#ifndef TGA_USES_WWLIB_FILE_CLASSES
-#include
-#endif
-#include
-#include
-#include
-#ifdef TGA_USES_WWLIB_FILE_CLASSES
-#include "wwfile.h"
-#include "ffactory.h"
-#else
-#include
-#include
-#include
-#endif
-
-
-/****************************************************************************
-*
-* NAME
-* Targa::Targa - Initialize a Targa instance.
-*
-* SYNOPSIS
-* Targa()
-*
-* void Targa(void);
-*
-* FUNCTION
-* Initialize the targa class instance.
-*
-* INPUTS
-* NONE
-*
-* RESULT
-* NONE
-*
-****************************************************************************/
-
-Targa::Targa(void)
- {
- mImage = NULL;
- mPalette = NULL;
- Clear_File();
- mAccess = TGA_READMODE;
- mFlags = 0;
- memset(&Header, 0, sizeof(TGAHeader));
- memset(&mExtension, 0, sizeof(TGA2Extension));
- }
-
-
-/****************************************************************************
-*
-* NAME
-* Targa::~Targa - Targa class destructor.
-*
-* SYNOPSIS
-* ~Targa()
-*
-* void ~Targa(void);
-*
-* FUNCTION
-*
-* INPUTS
-* NONE
-*
-* RESULT
-* NONE
-*
-****************************************************************************/
-
-Targa::~Targa(void)
-{
- /* Close the file if has been left open. */
- Close();
-
- /* Free the palette buffer if we allocated it. */
- if ((mPalette != NULL) && (mFlags & TGAF_PAL))
- free(mPalette);
-
- /* Free the image buffer if we allocated it. */
- if ((mImage != NULL) && (mFlags & TGAF_IMAGE))
- free(mImage);
-}
-
-
-/****************************************************************************
-*
-* NAME
-* Targa::Open - Open Targa image file.
-*
-* SYNOPSIS
-* Error = Open(Name, Mode)
-*
-* long Open(char *, long);
-*
-* FUNCTION
-* Open a Targa image file and read in its header. The file stream will
-* positioned after the ID field (if there is one).
-*
-* INPUTS
-* Name - Pointer to name of Targa file.
-* Mode - Access mode.
-*
-* RESULT
-* Error - Error code, 0 if okay.
-*
-****************************************************************************/
-
-long Targa::Open(const char* name, long mode)
-{
- TGA2Footer footer;
- long size;
- long error = 0;
-
- /* File already open? */
- if (Is_File_Open() && (mAccess == mode)) {
- return (0);
- }
-
- Close();
-
- /* Initialize the access mode. */
- mAccess = mode;
- mFlags &= ~TGAF_TGA2;
-
- switch (mode) {
-
- /* Open targa file for read. */
- case TGA_READMODE:
- if (File_Open_Read(name)) {
-
- /* Check for 2.0 targa file by loading the footer */
- if (File_Seek(-26, SEEK_END) == -1) {
- error = TGAERR_READ;
- }
-
- if (!error) {
- if (File_Read(&footer, sizeof(TGA2Footer)) != sizeof(TGA2Footer)) {
- error = TGAERR_READ;
- } else {
- /* If this a 2.0 file with an extension? */
- if (strncmp(footer.Signature, TGA2_SIGNATURE, 16) == 0) {
- if (footer.Extension != 0) {
- mFlags |= TGAF_TGA2;
- }
- }
- }
- }
-
- /* Read in Extension data */
- if (!error && (mFlags & TGAF_TGA2)) {
-
- if (File_Seek(footer.Extension, SEEK_SET) == -1) {
- error = TGAERR_READ;
- }
-
- if (!error) {
- if (File_Read(&mExtension, sizeof(TGA2Extension)) != sizeof(TGA2Extension)) {
- error = TGAERR_READ;
- }
- }
- }
-
- /* Read in header. */
- if (!error && (File_Seek(0, SEEK_SET) == -1)) {
- error = TGAERR_READ;
- } else {
-
- size = File_Read(&Header, sizeof(TGAHeader));
- if (size != sizeof(TGAHeader)) {
- error = TGAERR_READ;
- }
- }
-
- /* Skip the ID field */
- if (!error && (Header.IDLength != 0)) {
- if (File_Seek(Header.IDLength, SEEK_CUR) == -1) {
- error = TGAERR_READ;
- }
- }
-
- } else {
- error = TGAERR_OPEN;
- }
- break;
-
- /* Open targa file for write. */
- case TGA_WRITEMODE:
- if (!File_Open_Write(name)) {
- error = TGAERR_OPEN;
- } else {
-// printf("\r");
- }
- break;
-
- /* Open targa file for read/write.*/
- case TGA_RDWRMODE:
- if (File_Open_ReadWrite(name)) {
-
- /* Read in header. */
- size = File_Read(&Header, sizeof(TGAHeader));
-
- if (size != sizeof(TGAHeader)) {
- error = TGAERR_READ;
- }
- /* Skip the ID field */
- if (!error && (Header.IDLength != 0)) {
- if (File_Seek(Header.IDLength, SEEK_CUR) == -1) {
- error = TGAERR_READ;
- }
- }
-
- } else {
- error = TGAERR_OPEN;
- }
- break;
- }
-
- /* Close on any error! */
- if (error) {
- Close();
- }
-
- return (error);
-}
-
-
-/****************************************************************************
-*
-* NAME
-* Targa::Close - Close Targa image file.
-*
-* SYNOPSIS
-* Close()
-*
-* void Close(void);
-*
-* FUNCTION
-* Close the Targa image file and free its handle.
-*
-* INPUTS
-* NONE
-*
-* RESULT
-* NONE
-*
-****************************************************************************/
-
-void Targa::Close(void)
-{
-#ifdef TGA_USES_WWLIB_FILE_CLASSES
- if (TGAFile) {
- TGAFile->Close();
- _TheFileFactory->Return_File(TGAFile);
- TGAFile = NULL;
- }
-#else
- /* Close the file if it is open. */
- if (mFH != -1) {
- close(mFH);
- mFH = -1;
- }
-#endif
-}
-
-
-/****************************************************************************
-*
-* NAME
-* Targa::Load - Load Targa Image File into specified buffers.
-*
-* SYNOPSIS
-* Error = Load(Name, Palette, ImageBuffer)
-*
-* long Load(char *, char *, char *);
-*
-* FUNCTION
-* Open and load the Targa into the specified buffers. If either buffer
-* pointer is NULL then that field will not be processed.
-*
-* INPUTS
-* Name - Name of Targa image file to load.
-* Palette - Pointer to buffer to load the palette into.
-* ImageBuffer - Pointer to buffer to load the image data into.
-*
-* RESULT
-* Error - 0 if successful, or TGAERR_??? error code.
-*
-****************************************************************************/
-
-long Targa::Load(const char* name, char* palette, char* image,bool invert_image)
-{
- long size;
- long depth;
- long error = 0;
-
- /* Open the Targa */
- if (Open(name, TGA_READMODE) == NULL) {
-
- /* Process ColorMap (palette) */
- if (Header.ColorMapType == 1) {
-
- depth = (Header.CMapDepth >> 3);
- size = (Header.CMapLength * depth);
-
- /* Load the palette from the TGA if a palette buffer is provided
- * otherwise we will skip it.
- */
- if ((palette != NULL) && (Header.CMapLength > 0)) {
-
- /* Adjust palette to the starting color entry. */
- palette += (Header.CMapStart * depth);
-
- /* Read in the palette. */
- if (File_Read(palette, size) != size) {
- error = TGAERR_READ;
- }
-
- } else {
- if (File_Seek(size, SEEK_CUR) == -1) {
- error = TGAERR_READ;
- }
- }
- }
-
- /* Load the image data from the TGA if an image buffer is provided
- * otherwise we are done.
- */
- if (!error && (image != NULL)) {
-
- depth = TGA_BytesPerPixel(Header.PixelDepth);
- size = ((Header.Width * Header.Height) * depth);
-
- switch (Header.ImageType) {
- case TGA_CMAPPED:
- if (File_Read(image, size) != size) {
- error = TGAERR_READ;
- }
- break;
-
- case TGA_TRUECOLOR:
- if (File_Read(image, size) == size) {
- if (invert_image) InvertImage();
- } else {
- error = TGAERR_READ;
- }
- break;
-
- case TGA_MONO:
- if (File_Read(image, size) != size) {
- error = TGAERR_READ;
- }
- break;
-
- case TGA_CMAPPED_ENCODED:
- error = DecodeImage();
- break;
-
- case TGA_TRUECOLOR_ENCODED:
- if ((error = DecodeImage()) == NULL) {
- if (invert_image) InvertImage();
- }
- break;
-
- default:
- error = TGAERR_NOTSUPPORTED;
- break;
- }
-
- /* Arrange the image so that the origin position (coordinate 0,0)
- * is the upperleft hand corner of the image.
- */
- if (!error) {
- if ( Header.ImageDescriptor & TGAIDF_XORIGIN ) {
- XFlip();
- Header.ImageDescriptor &= ~TGAIDF_XORIGIN;
- }
-
- // Mod (IML) : Locate the origin at the bottom-left corner instead. This
- // will make ot consistent with .TGA's that have been generated with our
- // existing software.
- // if (( Header.ImageDescriptor & TGAIDF_YORIGIN ) == 0){
- if ( Header.ImageDescriptor & TGAIDF_YORIGIN ) {
- YFlip();
- // Bug fix (IML) : Clear this flag to indicate to the targa reader
- // that the Y-origin is at the bottom of the image.
- Header.ImageDescriptor &= ~TGAIDF_YORIGIN;
- }
- }
- }
-
- /* Close the Targa */
- Close();
-
- } else {
- error = TGAERR_OPEN;
- }
-
- return (error);
-}
-
-
-/****************************************************************************
-*
-* NAME
-* Targa::Load - Load Targa Image File. (Auto buffer allocation).
-*
-* SYNOPSIS
-* Error = Load(Name, Flags)
-*
-* long Load(char, long);
-*
-* FUNCTION
-* Open and load the Targa into buffers allocated by this function.
-*
-* INPUTS
-* Name - Name of Targa image file to load.
-* Flags -
-*
-* RESULT
-* Error - 0 if successful, or TGAERR_??? error code.
-*
-****************************************************************************/
-
-long Targa::Load(const char* name, long flags, bool invert_image)
-{
- long size;
- long error = 0;
-
- /* Open the file to get the header. */
- if (Open(name, TGA_READMODE) == 0) {
-
- /* Allocate palette memory if requested to and the targa has one. */
- if ((flags & TGAF_PAL) && (Header.ColorMapType == 1)) {
-
- /* Dispose of any previous palette. */
- if ((mPalette != NULL) && (mFlags & TGAF_PAL)) {
- free(mPalette);
- mPalette = NULL;
- mFlags &= ~TGAF_PAL;
- }
-
- /* Only allocate a palette if the client hasn't assigned one. */
- if ((mPalette == NULL) && !(mFlags & TGAF_PAL)) {
-
- /* Compute the size of the palette from the targa header. */
- size = (Header.CMapLength * (Header.CMapDepth >> 3));
-
- if (size != 0) {
- /* Allocate memory for the palette. */
- if ((mPalette = (char *)malloc(size)) != NULL) {
- mFlags |= TGAF_PAL; /* We allocated the palette. */
- } else {
- error = TGAERR_NOMEM;
- }
- }
- }
- }
-
- /* Allocate image memory if requested to. */
- if (!error && (flags & TGAF_IMAGE)) {
-
- /* Dispose of any previous image. */
- if ((mImage != NULL) && (mFlags & TGAF_IMAGE)) {
- free(mImage);
- mImage = NULL;
- mFlags &= ~TGAF_IMAGE;
- }
-
- /* Only allocate an image if the client hasn't assigned one. */
- if ((mImage == NULL) && !(mFlags & TGAF_IMAGE)) {
-
- /* Compute the size of the image data from the targa header. */
- size = ((Header.Width * Header.Height) * TGA_BytesPerPixel(Header.PixelDepth));
- if (size != 0) {
- /* Allocate memory for the image. */
- if ((mImage = (char *)malloc(size)) != NULL) {
- mFlags |= TGAF_IMAGE; /* We allocated the image. */
- } else {
- error = TGAERR_NOMEM;
- }
- }
- }
- }
-
- /* Read in the file contents. */
- if (!error) {
- error = Load(name, mPalette, mImage, invert_image);
- }
-
- /* Close the file. */
- Close();
-
- } else {
- error = TGAERR_OPEN;
- }
-
- return (error);
-}
-
-
-/****************************************************************************
-*
-* NAME
-* Targa::Save - Save a Targa Image File.
-*
-* SYNOPSIS
-* Error = Save(Name, Flags)
-*
-* long Save(char *, long);
-*
-* FUNCTION
-*
-* INPUTS
-* Name - Pointer to name of file to save.
-* Flags -
-*
-* RESULT
-* Error - 0 if successful, or TGAERR_??? error code.
-*
-****************************************************************************/
-
-long Targa::Save(const char* name, long flags, bool addextension)
- {
- long size;
- long depth;
- char *palette;
- char *temppal;
- char *ptr;
- //long i,n;
- //char c;
- long error = 0;
- TGA2Footer footer;
-
- /* Open the Targa for write. */
- if (Open(name, TGA_WRITEMODE) == NULL)
- {
- Header.IDLength = 0;
-
- /* Set the ImageType for compression. */
- if (flags & TGAF_COMPRESS)
- {
- switch (Header.ImageType)
- {
- case TGA_CMAPPED:
- case TGA_TRUECOLOR:
- case TGA_MONO:
- Header.ImageType += 8;
- break;
-
- case TGA_CMAPPED_ENCODED:
- case TGA_TRUECOLOR_ENCODED:
- case TGA_MONO_ENCODED:
- break;
-
- /* Turn off compression for unknown types. */
- default:
- flags &= ~TGAF_COMPRESS;
- break;
- }
- }
-
- /*-----------------------------------------------------------------------
- * WRITE THE HEADER DATA SECTION
- *---------------------------------------------------------------------*/
- if (File_Write(&Header, sizeof(TGAHeader)) != sizeof(TGAHeader))
- error = TGAERR_WRITE;
-
- /*-----------------------------------------------------------------------
- * WRITE THE COLORMAP (PALETTE) DATA SECTION
- *---------------------------------------------------------------------*/
- if (!error && (flags & TGAF_PAL) && (mPalette != NULL)
- && (Header.CMapLength > 0))
- {
- /* Adjust palette to the starting color entry. */
- depth = (Header.CMapDepth >> 3);
- palette = mPalette + (Header.CMapStart * depth);
- size = (Header.CMapLength * depth);
-
- /* Allocate temporary buffer for palette manipulation. */
- if ((temppal = (char *)malloc(size)) != NULL)
- {
- memcpy(temppal, palette, size);
- ptr = temppal;
-
- #if(0)
- /* Swap the byte ordering of the palette entries. */
- for (i = 0; i < Header.CMapLength; i++)
- {
- c = *ptr;
- *ptr = *(ptr + (depth - 1));
- *(ptr + (depth - 1)) = c;
-
- /* Next entry */
- palette += depth;
- }
- #endif
-
- /* Write the palette. */
- if (File_Write(temppal, size) != size)
- error = TGAERR_WRITE;
-
- /* Free temporary palette buffer. */
- free(temppal);
- }
- else
- error = TGAERR_NOMEM;
- }
-
- /*-----------------------------------------------------------------------
- * WRITE THE IMAGE DATA SECTION
- *---------------------------------------------------------------------*/
- if (!error && (flags & TGAF_IMAGE) && (mImage != NULL))
- {
-
- bool imageinverted;
-
- /* Invert truecolor data. */
- if ((Header.ImageType == TGA_TRUECOLOR) || (Header.ImageType == TGA_TRUECOLOR_ENCODED)) {
- InvertImage();
- imageinverted = true;
- } else {
- imageinverted = false;
- }
-
- /* Write the image. */
- if (flags & TGAF_COMPRESS)
- EncodeImage();
- else
- {
- depth = TGA_BytesPerPixel(Header.PixelDepth);
- size = (((Header.Width * Header.Height)) * depth);
-
- if (File_Write(mImage, size) != size)
- error = TGAERR_WRITE;
- }
-
- // Bug fix (IML) : If the image was inverted, invert it again to restore it to its prior state.
- if (imageinverted) InvertImage();
- }
-
- /*-----------------------------------------------------------------------
- * WRITE THE EXTENSION DATA SECTION
- *---------------------------------------------------------------------*/
-
- // Mod (IML) Optionally add an extension to the file.
- if (addextension) {
- if (!error) {
-
- mExtension.ExtSize = 495;
- strncpy(mExtension.SoftID, "Denzil's Targa Code", 41);
- mExtension.SoftVer.Number = (1 * 100);
- mExtension.SoftVer.Letter = 0;
-
- /* Save position of extension area. */
- if ((footer.Extension = File_Seek(0, SEEK_CUR)) == -1)
- error = TGAERR_WRITE;
-
- if (!error && (File_Write(&mExtension, sizeof(TGA2Extension))
- != sizeof(TGA2Extension)))
- error = TGAERR_WRITE;
- }
- } else {
- footer.Extension = 0;
- }
-
- /*-----------------------------------------------------------------------
- * WRITE THE FOOTER DATA SECTION
- *---------------------------------------------------------------------*/
- if (!error)
- {
- footer.Developer = 0;
- strncpy(footer.Signature, TGA2_SIGNATURE, 16);
- footer.RsvdChar = '.';
- footer.BZST = 0;
-
- if (File_Write(&footer, sizeof(TGA2Footer)) != sizeof(TGA2Footer))
- error = TGAERR_WRITE;
- }
-
- /* Close targa file. */
- Close();
- }
- else
- error = TGAERR_OPEN;
-
- return (error);
- }
-
-
-/****************************************************************************
-*
-* NAME
-* Targa::XFlip - X flip the image.
-*
-* SYNOPSIS
-* XFlip()
-*
-* void XFlip();
-*
-* FUNCTION
-* Flip the image in memory on its X axis. (left to right)
-*
-* INPUTS
-* NONE
-*
-* RESULT
-* NONE
-*
-****************************************************************************/
-
-void Targa::XFlip(void)
- {
- char *ptr,*ptr1;
- long x,y,d;
- char v,v1;
- char depth;
-
- /* Pixel depth in bytes. */
- depth = TGA_BytesPerPixel(Header.PixelDepth);
-
- for (y = 0; y < Header.Height; y++)
- {
- ptr = (mImage + ((Header.Width * depth) * y));
- ptr1 = (ptr + ((Header.Width * depth) - depth));
-
- for (x = 0; x < (Header.Width / 2); x++)
- {
- for (d = 0; d < depth; d++)
- {
- v = *(ptr + d);
- v1 = *(ptr1 + d);
- *(ptr + d) = v1;
- *(ptr1 + d) = v;
- }
-
- ptr += depth;
- ptr1 -= depth;
- }
- }
- }
-
-
-/****************************************************************************
-*
-* NAME
-* Targa::YFlip - Y flip the image.
-*
-* SYNOPSIS
-* YFlip()
-*
-* void YFlip();
-*
-* FUNCTION
-* Flip the image in memory on its Y axis. (top to bottom)
-*
-* INPUTS
-* NONE
-*
-* RESULT
-* NONE
-*
-****************************************************************************/
-
-void Targa::YFlip(void)
- {
- char *ptr,*ptr1;
- long x,y;
- char v,v1;
- char depth;
-
- /* Pixel depth in bytes. */
- depth = TGA_BytesPerPixel(Header.PixelDepth);
-
- for (y = 0; y < (Header.Height >> 1); y++)
- {
- /* Compute address of lines to exchange. */
- ptr = (mImage + ((Header.Width * y) * depth));
- ptr1 = (mImage + ((Header.Width * (Header.Height - 1)) * depth));
- ptr1 -= ((Header.Width * y) * depth);
-
- /* Exchange all the pixels on this scan line. */
- for (x = 0; x < (Header.Width * depth); x++)
- {
- v = *ptr;
- v1 = *ptr1;
- *ptr = v1;
- *ptr1 = v;
- ptr++;
- ptr1++;
- }
- }
- }
-
-
-/****************************************************************************
-*
-* NAME
-* Targa::SetImage - Set the image buffer.
-*
-* SYNOPSIS
-* OldImage = SetImage(Image)
-*
-* char *SetImage(char *);
-*
-* FUNCTION
-* Set the image buffer to one provided by the caller.
-*
-* INPUTS
-* Image - Pointer to buffer to use for the image buffer.
-*
-* RESULT
-* OldImage - Previous caller assigned image buffer.
-*
-****************************************************************************/
-
-char *Targa::SetImage(char *buffer)
-{
- char *oldbuffer = NULL;
-
- /* Free any image buffer before assigning another. */
- if ((mImage != NULL) && (mFlags & TGAF_IMAGE))
- {
- free(mImage);
- mImage = NULL;
- mFlags &= ~TGAF_IMAGE;
- }
-
- /* Get the old user buffer. */
- if (mImage != NULL)
- oldbuffer = mImage;
-
- /* Assign the new image buffer. */
- mImage = buffer;
-
- return (oldbuffer);
-}
-
-
-/****************************************************************************
-*
-* NAME
-* Targa::SetPalette - Set the palette buffer.
-*
-* SYNOPSIS
-* OldPal = SetPalette(Pal)
-*
-* char *SetPalette(char *);
-*
-* FUNCTION
-*
-* INPUTS
-* Pal - Pointer to buffer to use for palette.
-*
-* RESULT
-* OldPal - Pointer to previous user palette.
-*
-****************************************************************************/
-
-char *Targa::SetPalette(char *buffer)
-{
- char *oldbuffer = NULL;
-
- /* Free any image buffer before assigning another. */
- if ((mPalette != NULL) && (mFlags & TGAF_PAL))
- {
- free(mPalette);
- mPalette = NULL;
- mFlags &= ~TGAF_PAL;
- }
-
- /* Get the old user buffer. */
- if (mPalette != NULL)
- oldbuffer = mPalette;
-
- /* Assign the new image buffer. */
- mPalette = buffer;
-
- return (oldbuffer);
-}
-
-
-bool Targa::IsCompressed(void)
- {
- if (Header.ImageType > 8)
- return true;
-
- return false;
- }
-
-
-/****************************************************************************
-*
-* NAME
-* Targa::GetExtension - Get Extension data. (Targa 2.0 files only)
-*
-* SYNOPSIS
-* Ext = GetExtension()
-*
-* TGA2Extension *GetExtension(void);
-*
-* FUNCTION
-* Retrieve a pointer to the Targa 2.0 extension data area. If the file
-* version is 1.0 OR there is no extensio area then a NULL will be returned.
-*
-* INPUTS
-* NONE
-*
-* RESULT
-* Ext - Pointer to Extension data, NULL if not available.
-*
-****************************************************************************/
-
-TGA2Extension *Targa::GetExtension(void)
- {
- if (mFlags & TGAF_TGA2)
- return (&mExtension);
-
- return (NULL);
- }
-
-
-/****************************************************************************
-*
-* NAME
-* Targa::DecodeImage - Decompress Targa image data.
-*
-* SYNOPSIS
-* Error = DecodeImage()
-*
-* long DecodeImage();
-*
-* FUNCTION
-* Decode the RLE compressed image data into the specified buffer from
-* the file I/O stream.
-*
-* INPUTS
-* NONE
-*
-* RESULT
-* Error - 0 if successful, or TGAERR_??? error code.
-*
-****************************************************************************/
-
-long Targa::DecodeImage()
- {
- char *image;
- char *color;
- unsigned char count;
- unsigned char depth;
- unsigned long pixel_count;
- unsigned long size;
- unsigned long c,i;
- long error = 0;
-
- /* Initialize */
- image = mImage;
-
- /* Compute pixel depth in bytes. */
- depth = TGA_BytesPerPixel(Header.PixelDepth);
-
- /* Total number of pixels compressed in this image. */
- pixel_count = (Header.Width * Header.Height);
-
- while ((pixel_count > 0) && !error)
- {
- /* Read count. */
- if (File_Read(&count, 1) == 1)
- {
- /* If bit 8 of the count is set then we have a run of pixels,
- * otherwise the data is raw pixels.
- */
- if (count & 0x80)
- {
- count &= 0x7F;
- count++;
-
- /* Read in run pixel. */
- if (File_Read(image, depth) == depth)
- {
- color = image;
- image += depth;
-
- /* Repeat the pixel for the run count in the image buffer. */
- for (c = 1; c < count; c++)
- for (i = 0; i < depth; i++)
- *image++ = *(color + i);
- }
- else
- error = TGAERR_READ;
- }
- else
- {
- count++;
- size = (count * depth);
-
- /* Read in raw pixels. */
- if ((unsigned)File_Read(image, size) == size)
- image += size;
- else
- error = TGAERR_READ;
- }
-
- /* Adjust the pixel count. */
- pixel_count -= count;
- }
- else
- error = TGAERR_READ;
- }
-
- return (error);
- }
-
-
-/****************************************************************************
-*
-* NAME
-* Targa::EncodeImage - Compress the image using targa RLE.
-*
-* SYNOPSIS
-* EncodeImage()
-*
-* void EncodeImage(void);
-*
-* FUNCTION
-* Encode the image data using the RLE algorithm outlined in the TARGA
-* file specification.
-*
-* INPUTS
-* NONE
-*
-* RESULT
-* NONE
-*
-****************************************************************************/
-
-long Targa::EncodeImage()
- {
- char *packet;
- long packet_index;
- char *start;
- char *end;
- long depth;
- long pixels;
- long count;
- long match;
- long i;
- long error = 0;
-
- /* Initialize variables. */
- depth = TGA_BytesPerPixel(Header.PixelDepth);
-
- /* Allocate packet buffer to hold maximum encoded data run. */
- if ((packet = (char *)malloc(128 * depth)) != NULL)
- {
- pixels = Header.Width * Header.Height;
- start = mImage;
- end = start;
- count = 0;
- packet[0] = 0;
- packet_index = 1;
-
- while ((pixels != 0) && !error)
- {
- match = 1;
-
- /* Advance to the next pixel */
- end += depth;
- pixels--;
-
- /* Compare pixels. */
- for (i = 0; i < depth; i++)
- {
- if (start[i] != end[i])
- {
- match = 0;
- break;
- }
- }
-
- /* Run of pixels */
- if (match == 1)
- {
- count++;
-
- /* Continue counting until the maximum has been reached. */
- if (count < 128)
- {
- if (packet[0] == 0)
- continue;
- }
- else
- count--;
- }
-
- /* If there is a count then write out the run. Otherwise, write
- * the raw pixel to the packet.
- */
- if ((count != 0) && (packet[0] == 0))
- {
- /* Run count */
- packet[0] = (count | 0x80);
-
- /* Run pixel */
- for (i = 0; i < depth; i++)
- packet[i + 1] = start[i];
-
- /* Write the run packet. */
- if (File_Write(packet, (depth + 1)) != (depth + 1))
- error = TGAERR_WRITE;
-
- /* Reposition start and reset. */
- start = end;
- count = 0;
- packet[0] = 0;
- }
- else
- {
- if (count == 0)
- {
- /* Copy the raw pixel to the packet. */
- for (i = 0; i < depth; i++)
- packet[packet_index + i] = start[i];
-
- /* Increment the raw packet count. */
- packet[0]++;
-
- /* Reposition start */
- start = end;
- packet_index += depth;
- }
-
- /* Write the raw packet if the packet is full or a run has started
- * or all the pixels have been processed.
- */
- if ((packet[0] == 127) || (count != 0) || (pixels == 0))
- {
- i = packet[0];
- packet[0]--;
-
- if (File_Write(packet, ((i * depth) + 1)) != ((i * depth) + 1))
- error = TGAERR_WRITE;
-
- packet_index = 1;
- packet[0] = 0;
- }
- }
- }
-
- /* Free the packet buffer. */
- free(packet);
- }
- else
- error = TGAERR_NOMEM;
-
- return (error);
- }
-
-
-/****************************************************************************
-*
-* NAME
-* Targa::InvertImage - Invert TrueColor image data.
-*
-* SYNOPSIS
-* InvertImage()
-*
-* void InvertImage(void);
-*
-* FUNCTION
-*
-* INPUTS
-* NONE
-*
-* RESULT
-* NONE
-*
-****************************************************************************/
-
-void Targa::InvertImage(void)
- {
- char *buffer;
- long depth;
- long pixel_count;
- long i;
- char c;
-
- /* Initialize */
- buffer = mImage;
-
- /* Compute the pixel depth in bytes. */
- depth = TGA_BytesPerPixel(Header.PixelDepth);
-
- /* Total number of pixels in this image. */
- pixel_count = (Header.Width * Header.Height);
-
- /* 16-bit pixel layout is different that 24-bit and 32-bit. */
- if (depth > 2)
- {
- while (pixel_count > 0)
- {
- for (i = 0; i < (depth / 2); i++)
- {
- c = *(buffer + i);
- *(buffer + i) = *(buffer + ((depth - 1) - i));
- *(buffer + ((depth - 1) - i)) = c;
- }
-
- /* Next pixel */
- pixel_count--;
- buffer += depth;
- }
- }
- }
-
-
-/*
-** These functions are just for ease of ifdef'ing between standard io calls and FileClass.
-*/
-void Targa::Clear_File(void)
-{
-#ifdef TGA_USES_WWLIB_FILE_CLASSES
- TGAFile = NULL;
-#else
- mFH = -1;
-#endif
-}
-bool Targa::Is_File_Open(void)
-{
-#ifdef TGA_USES_WWLIB_FILE_CLASSES
- return (TGAFile != NULL);
-#else
- return (mFH != -1);
-#endif
-}
-bool Targa::File_Open_Read(const char* name)
-{
-#ifdef TGA_USES_WWLIB_FILE_CLASSES
- TGAFile = _TheFileFactory->Get_File(name);
- if (TGAFile && TGAFile->Is_Available()) {
- return (TGAFile->Open(FileClass::READ) != 0);
- } else {
- return false;
- }
-#else
- mFH = open(name, (O_RDONLY|O_BINARY));
- return (mFH != -1);
-#endif
-}
-bool Targa::File_Open_Write(const char* name)
-{
-#ifdef TGA_USES_WWLIB_FILE_CLASSES
- TGAFile = _TheWritingFileFactory->Get_File(name);
- if (TGAFile) {
- return (TGAFile->Open(FileClass::WRITE) != 0);
- } else {
- return false;
- }
-#else
- mFH = open(name, (O_CREAT|O_TRUNC|O_WRONLY|O_BINARY), (S_IREAD|S_IWRITE));
- return (mFH != -1);
-#endif
-}
-bool Targa::File_Open_ReadWrite(const char* name)
-{
-#ifdef TGA_USES_WWLIB_FILE_CLASSES
- TGAFile = _TheWritingFileFactory->Get_File(name);
- if (TGAFile && TGAFile->Is_Available()) {
- return (TGAFile->Open(FileClass::READ|FileClass::WRITE) != 0);
- } else {
- return false;
- }
-#else
- mFH = open(name, (O_RDWR|O_BINARY), (S_IREAD|S_IWRITE));
- return (mFH != -1);
-#endif
-}
-int Targa::File_Seek(int pos, int dir)
-{
-#ifdef TGA_USES_WWLIB_FILE_CLASSES
- return TGAFile->Seek(pos, dir);
-#else
- return lseek(mFH, pos, dir);
-#endif
-}
-int Targa::File_Read(void *buffer, int size)
-{
-#ifdef TGA_USES_WWLIB_FILE_CLASSES
- return TGAFile->Read(buffer, size);
-#else
- return read(mFH, buffer, size);
-#endif
-}
-int Targa::File_Write(void *buffer, int size)
-{
-#ifdef TGA_USES_WWLIB_FILE_CLASSES
- return TGAFile->Write(buffer, size);
-#else
- return write(mFH, buffer, size);
-#endif
-}
-
-// ----------------------------------------------------------------------------
-//
-// Output targa load error message.
-//
-// ----------------------------------------------------------------------------
-
-long Targa_Error_Handler(long load_err,const char* filename)
-{
- switch (load_err) {
- case 0:
- return 0;
- case TGAERR_OPEN:
-// WWDEBUG_SAY(("Targa: Failed to open file \"%s\"\n", filename));
- break;
-
- case TGAERR_READ:
-// WWDEBUG_SAY(("Targa: Failed to read file \"%s\"\n", filename));
- break;
-
- case TGAERR_NOTSUPPORTED:
-// WWDEBUG_SAY(("Targa: File \"%s\" is an unsupported Targa type\n", filename));
- break;
-
- case TGAERR_NOMEM:
-// WWDEBUG_SAY(("Targa: Failed to allocate memory for file \"%s\"\n", filename));
- break;
-
- default:
-// WWDEBUG_SAY(("Targa: Unknown error when loading file \"%s\"\n", filename));
- break;
- }
- return load_err;
-}
diff --git a/Generals/Code/Tools/WW3D/max2w3d/TARGA.H b/Generals/Code/Tools/WW3D/max2w3d/TARGA.H
deleted file mode 100644
index c0b1472ed1b..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/TARGA.H
+++ /dev/null
@@ -1,320 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-#ifndef _TARGA_H_
-#define _TARGA_H_
-/****************************************************************************
-*
-* C O N F I D E N T I A L --- W E S T W O O D S T U D I O S
-*
-*----------------------------------------------------------------------------
-*
-* FILE
-* Targa.h
-*
-* DESCRIPTION
-* Targa image file class definitions.
-*
-* PROGRAMMER
-* Denzil E. Long, Jr.
-*
-* DATE
-* July 15, 1998
-*
-****************************************************************************/
-
-#pragma pack(push, 1)
-
-// If you wish to display loading error messages call targa functions inside of
-// the following macro - for example TARGA_ERROR_HANDLER(targa.Open(filename, TGA_READMODE));
-// The error code is returned back from the handler so it can be used in an expression.
-long Targa_Error_Handler(long error_code,const char* filename);
-#define TARGA_ERROR_HANDLER(call,filename) Targa_Error_Handler(call,filename)
-
-/*---------------------------------------------------------------------------
- * STRUCTURES AND RELATED DEFINITIONS
- *-------------------------------------------------------------------------*/
-
-/* TGAHeader - Targa Image File header.
- *
- * IDLength - Size of Image ID field
- * ColorMapType - Color map type.
- * ImageType - Image type code.
- * CMapStart - Color map origin.
- * CMapLength - Color map length.
- * CMapDepth - Depth of color map entries.
- * XOffset - X origin of image.
- * YOffset - Y origin of image.
- * Width - Width of image.
- * Height - Height of image.
- * PixelDepth - Image pixel size
- * ImageDescriptor - Image descriptor byte.
- */
-typedef struct _TGAHeader
- {
- char IDLength;
- char ColorMapType;
- char ImageType;
- short CMapStart;
- short CMapLength;
- char CMapDepth;
- short XOffset;
- short YOffset;
- short Width;
- short Height;
- char PixelDepth;
- char ImageDescriptor;
- } TGAHeader;
-
-/* ImageType definiton */
-#define TGA_NOIMAGE 0 /* No image data included in file */
-#define TGA_CMAPPED 1 /* Color-mapped image data */
-#define TGA_TRUECOLOR 2 /* Truecolor image data */
-#define TGA_MONO 3 /* Monochrome image data */
-#define TGA_CMAPPED_ENCODED 9 /* Color-mapped image data (Encoded) */
-#define TGA_TRUECOLOR_ENCODED 10 /* Truecolor image data (Encoded) */
-#define TGA_MONO_ENCODED 11 /* Monochrome image data (Encoded) */
-
-/* ImageDescriptor definition */
-#define TGAIDF_ATTRIB_BITS (0x0F<<0) /* Number of attribute bits per pixel */
-#define TGAIDF_XORIGIN (1<<4)
-#define TGAIDF_YORIGIN (1<<5)
-
-/* Access modes. */
-#define TGA_READMODE 0
-#define TGA_WRITEMODE 1
-#define TGA_RDWRMODE 2
-
-/* Error codes */
-#define TGAERR_OPEN -1
-#define TGAERR_READ -2
-#define TGAERR_WRITE -3
-#define TGAERR_SYNTAX -4
-#define TGAERR_NOMEM -5
-#define TGAERR_NOTSUPPORTED -6
-
-/* Flags definitions */
-#define TGAF_IMAGE (1<<0)
-#define TGAF_PAL (1<<1)
-#define TGAF_COMPRESS (1<<2)
-#define TGAF_TGA2 (1<<3)
-
-/* Macro definitions */
-#define TGA_BytesPerPixel(a) ((a+7) >> 3)
-
-/*---------------------------------------------------------------------------
- * TARGA 2.0 DEFINITIONS
- *-------------------------------------------------------------------------*/
-
-#define TGA2_SIGNATURE "TRUEVISION-XFILE"
-
-/* TGA2Footer - Targa 2.0 footer
- *
- * Extension - Offset to the Extension area from start of file.
- * Developer - Offset to the Developer area from start of file.
- * Signature - 16 byte Targa 2.0 signature "TRUEVISION-XFILE"
- * RsvdChar - Reserved character, must be ASCII "." (period)
- * BZST - Binary Zero String Terminator.
- */
-typedef struct _TGA2Footer
- {
- long Extension;
- long Developer;
- char Signature[16];
- char RsvdChar;
- char BZST;
- _TGA2Footer() {}
- } TGA2Footer;
-
-/* TGA2DateStamp - A series of 3 WORD values which define the integer value
- * for the date the image was saved.
- *
- * Month - Month number (1 - 12)
- * Day - Day number (1 - 31)
- * Year - Year number (4 digit, ie. 1989)
- */
-typedef struct _TGA2DateStamp
- {
- short Month;
- short Day;
- short Year;
- } TGA2DateStamp;
-
-/* TGA2TimeStamp - A series of 3 WORD values which define the integer value
- * for the time the image was saved.
- *
- * Hour - Hour number, military time (0 - 23)
- * Minute - Minute number (0 - 59)
- * Second - Second number (0 - 59)
- */
-typedef struct _TGA2TimeStamp
- {
- short Hour;
- short Minute;
- short Second;
- } TGA2TimeStamp;
-
-/* TGA2SoftVer - Define the version of the software used to generate file.
- *
- * Number - Version number * 100
- * Letter - Version letter
- */
-typedef struct _TGA2SoftVer
- {
- short Number;
- char Letter;
- } TGA2SoftVer;
-
-/* TGA2Ratio - Numerator and denominator which when taken together specify
- * a ratio.
- *
- * Numer - Numerator
- * Denom - Denominator (a value of zero indicates no ratio specified)
- */
-typedef struct _TGA2Ratio
- {
- short Numer;
- short Denom;
- } TGA2Ratio;
-
-/* TGA2Extension - Extension area, provided for additional file information.
- * This data is pointed to by the Extension offset in the
- * TGA2Footer.
- *
- * ExtSize - Extension area size. (495 bytes for 2.0)
- * AuthName - Name of the person who created image (NULL terminated ASCII)
- * AuthComment - Comments of the author (NULL terminated ASCII)
- * DateStamp - Date the file was created. (See TGA2DateStamp)
- * TimeStamp - Time the file was created. (See TGA2TimeStamp)
- * JobName - Name of job image belongs to (NULL terminated ASCII)
- * JobTime - Elapsed time of the job.
- * SoftID - ID of software used to create image (NULL terminated ASCII)
- * SoftVer - Version number of software used.
- * KeyColor - Tranparent color value.
- * Aspect - Pixel aspect ratio.
- * Gamma - Fractional gamma value.
- * ColorCor - Color correction table offset.
- * PostStamp - Postage stamp image offset.
- * ScanLine - Scan line table offset.
- * Attributes - Alpha channel attributes. (Set defines below)
- */
-typedef struct _TGA2Extension
- {
- short ExtSize;
- char AuthName[41];
- char AuthComment[324];
- TGA2DateStamp Date;
- TGA2TimeStamp Time;
- char JobName[41];
- TGA2TimeStamp JobTime;
- char SoftID[41];
- TGA2SoftVer SoftVer;
- long KeyColor;
- TGA2Ratio Aspect;
- TGA2Ratio Gamma;
- long ColorCor;
- long PostStamp;
- long ScanLine;
- char Attributes;
- } TGA2Extension;
-
-/* Alpha channel attributes (Extension Area) */
-#define EXTA_NOALPHA 0 /* No alpha data included */
-#define EXTA_IGNORE 1 /* Undefined alpha data, can ignore */
-#define EXTA_RETAIN 2 /* Undefined alpha data, should retain */
-#define EXTA_USEFUL 3 /* Useful alpha channel */
-#define EXTA_PREMULT 4 /* Pre-Multiplied alpha data */
-
-#pragma pack(pop)
-
-/*
-** This define changes this code from code that works with standard IO calls,
-** to code that uses FileClass and FileFactoryClass.
-*/
-//#define TGA_USES_WWLIB_FILE_CLASSES
-
-#ifdef TGA_USES_WWLIB_FILE_CLASSES
-class FileClass;
-#endif
-
-/*---------------------------------------------------------------------------
- * CLASS DEFINITION
- *-------------------------------------------------------------------------*/
-
-class Targa
- {
- public:
- /* Constructor/destructor */
- Targa(void);
- ~Targa();
-
- /* Function prototypes. */
- long Open(const char* name, long mode);
- void Close(void);
-
- long Load(const char* name, char* palette, char* image,bool invert_image=true);
- long Load(const char* name, long flags, bool invert_image=true);
- long Save(const char* name, long flags, bool addextension = false);
-
- void XFlip(void);
- void YFlip(void);
-
- char* SetImage(char* buffer);
- char* GetImage(void) const {return (mImage);}
-
- char* SetPalette(char* buffer);
- char* GetPalette(void) const {return (mPalette);}
-
- bool IsCompressed(void);
-
- TGA2Extension* GetExtension(void);
-
- TGAHeader Header;
-
- protected:
-#ifdef TGA_USES_WWLIB_FILE_CLASSES
- FileClass *TGAFile;
-#else
- long mFH;
-#endif
- long mAccess;
- long mFlags;
- char* mImage;
- char* mPalette;
- TGA2Extension mExtension;
-
- private:
- // Utility functions
- long DecodeImage(void);
- long EncodeImage(void);
- void InvertImage(void);
-
- // These functions are for ease of ifdef'ing between standard io calls
- // and FileClass.
- void Clear_File(void);
- bool Is_File_Open(void);
- bool File_Open_Read(const char* name);
- bool File_Open_Write(const char* name);
- bool File_Open_ReadWrite(const char* name);
- int File_Seek(int pos, int dir);
- int File_Read(void *buffer, int size);
- int File_Write(void *buffer, int size);
- };
-
-#endif /* _TARGA_H_ */
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/Utility.cpp b/Generals/Code/Tools/WW3D/max2w3d/Utility.cpp
deleted file mode 100644
index ca44363ebad..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/Utility.cpp
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : G *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/Utility.cpp $*
- * *
- * $Author:: Andre_a $*
- * *
- * $Modtime:: 5/08/00 11:51a $*
- * *
- * $Revision:: 3 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * wwGetAbsolutePath -- Returns the absolute path based on a relative one. *
- * wwInputBox -- Retrive a string from the user in a nice friendly manner. *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-/*
-** Utility.cpp - Implementation of a some convenient features the WIN32 API provides
-** that the MAXScript API doesn't.
-*/
-
-
-#include
-#include
-#include
-#include
-
-#include "util.h"
-#include "InputDlg.h"
-
-
-/*
-** Let MAXScript know we're implementing new built-in functions.
-*/
-def_visible_primitive(get_absolute_path, "wwGetAbsolutePath");
-def_visible_primitive(input_box, "wwInputBox");
-
-
-/***********************************************************************************************
- * get_absolute_path_cf -- Returns the absolute path based on a relative one. *
- * *
- * wwGetAbsolutePath - Usage: wwGetAbsolutePath *
- * *
- * INPUT: A string containing a relative path, and its context. *
- * *
- * OUTPUT: The equivalent absolute path. *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/4/1999 AJA : Created. *
- *=============================================================================================*/
-Value * get_absolute_path_cf (Value **arg_list, int count)
-{
- // We want an array as an argument
- check_arg_count("wwGetAbsolutePath", 2, count);
- type_check(arg_list[0], String, "Relative path");
- type_check(arg_list[1], String, "Context");
-
- // Grab the arguments out of the array.
- char absolute[MAX_PATH];
- char *relative = arg_list[0]->to_string();
- char *context = arg_list[1]->to_string();
-
- // Turn the relative path into an absolute one.
- Create_Full_Path(absolute, context, relative);
-
- // Return the absolute path.
- one_typed_value_local(String *abs);
- vl.abs = new String(absolute);
- return_value(vl.abs);
-}
-
-
-/***********************************************************************************************
- * input_box_cf -- Retrive a string from the user in a nice friendly manner. *
- * *
- * wwInputBox - Usage: wwInputBox [caption:'caption'] [label:'label'] [value:'value'] *
- * *
- * INPUT: Three optional named arguments. If they are not given values, defaults are used. *
- * *
- * OUTPUT: Returns the string entered by the user. *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- *=============================================================================================*/
-Value * input_box_cf (Value **arg_list, int count)
-{
- // Create the input box (but don't show it yet).
- InputDlg input_box(MAXScript_interface->GetMAXHWnd());
- Value *param = NULL;
-
- // Check the 'caption' parameter.
- param = key_arg(caption);
- if (param && param != &unsupplied)
- input_box.SetCaption(param->to_string());
-
- // Check the 'label' parameter.
- param = key_arg(label);
- if (param && param != &unsupplied)
- input_box.SetLabel(param->to_string());
-
- // Check the 'value' parameter.
- param = key_arg(value);
- if (param && param != &unsupplied)
- input_box.SetValue(param->to_string());
-
- // Show the dialog and let the user enter a value.
- if (input_box.DoModal() == IDCANCEL)
- return &undefined;
-
- // Return the value the user entered.
- one_typed_value_local(String *val);
- vl.val = new String(input_box.m_Value);
- return_value(vl.val);
-}
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/aabtreebuilder.cpp b/Generals/Code/Tools/WW3D/max2w3d/aabtreebuilder.cpp
deleted file mode 100644
index 52edb974b1a..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/aabtreebuilder.cpp
+++ /dev/null
@@ -1,930 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : WW3D *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/aabtreebuilder.cpp $*
- * *
- * Original Author:: Greg Hjelstrom *
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 5/24/00 8:41a $*
- * *
- * $Revision:: 4 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * AABTreeBuilderClass::AABTreeBuilderClass -- Constructor *
- * AABTreeBuilderClass::~AABTreeBuilderClass -- Destructor *
- * AABTreeBuilderClass::Reset -- reset the builder, delete all arrays *
- * AABTreeBuilderClass::Build_AABTree -- Build an AABTree for the given mesh. *
- * AABTreeBuilderClass::Build_Tree -- recursivly builds the culling tree *
- * AABTreeBuilderClass::Select_Splitting_Plane -- select a partition for the given polys *
- * AABTreeBuilderClass::Compute_Plane_Score -- evaluate the suitability of a partition plane *
- * AABTreeBuilderClass::Which_Side -- which side of a plane is the given poly *
- * AABTreeBuilderClass::Split_Polys -- partition the polys with a plane *
- * AABTreeBuilderClass::Compute_Bounding_Box -- compute bounding boxes for the cull nodes *
- * AABTreeBuilderClass::Assign_Index -- assign an array index to each node *
- * AABTreeBuilderClass::Node_Count -- Count the nodes in the tree *
- * AABTreeBuilderClass::Poly_Count -- returns number of polys *
- * AABTreeBuilderClass::Node_Count_Recursive -- internal implementation of Node_Count *
- * AABTreeBuilderClass::Submit_Tree -- install nodes into an AABTreeClass *
- * AABTreeBuilderClass::Submit_Tree_Recursive -- internal implementation of Submit_Tree *
- * AABTreeBuilderClass::Update_Min -- ensure given vector is < min of the poly *
- * AABTreeBuilderClass::Update_Max -- ensure given vector is > max of poly *
- * AABTreeBuilderClass::Update_Min_Max -- ensure given vector is in min max of poly *
- * AABTreeBuilderClass::Export -- Saves this AABTree into a W3D chunk *
- * AABTreeBuilderClass::Build_W3D_AABTree_Recursive -- Build array of indices and W3dMeshAAB *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#include "aabtreebuilder.h"
-#include "chunkio.h"
-#include "w3d_file.h"
-#include
-#include
-#include
-
-#define WWASSERT assert // can't use WWASSERT because we use this module in the MAX plugin...
-const float COINCIDENCE_EPSILON = 0.001f;
-
-
-/***********************************************************************************************
- * AABTreeBuilderClass::AABTreeBuilderClass -- Constructor *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- *=============================================================================================*/
-AABTreeBuilderClass::AABTreeBuilderClass(void) :
- Root(NULL),
- CurPolyIndex(0),
- PolyCount(0),
- Polys(NULL),
- VertCount(0),
- Verts(NULL)
-{
-}
-
-
-/***********************************************************************************************
- * AABTreeBuilderClass::~AABTreeBuilderClass -- Destructor *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 5/19/2000 gth : Created. *
- *=============================================================================================*/
-AABTreeBuilderClass::~AABTreeBuilderClass(void)
-{
- Reset();
-}
-
-
-/***********************************************************************************************
- * AABTreeBuilderClass::Reset -- reset the builder, delete all arrays *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 5/19/2000 gth : Created. *
- *=============================================================================================*/
-void AABTreeBuilderClass::Reset(void)
-{
- if (Root) {
- delete Root; Root = NULL;
- }
-
- if (Verts != NULL) {
- delete[] Verts;
- Verts = NULL;
- }
-
- if (Polys != NULL) {
- delete[] Polys;
- Polys = NULL;
- }
-}
-
-/***********************************************************************************************
- * AABTreeBuilderClass::Build_AABTree -- Build an AABTree for the given mesh. *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 6/19/98 GTH : Created. *
- *=============================================================================================*/
-void AABTreeBuilderClass::Build_AABTree(int polycount,Vector3i * polys,int vertcount,Vector3 * verts)
-{
- WWASSERT(polycount > 0);
- WWASSERT(vertcount > 0);
- WWASSERT(polys != NULL);
- WWASSERT(verts != NULL);
-
- /*
- ** If we already have allocated data, release it
- */
- Reset();
-
- /*
- ** Copy the mesh data
- */
- VertCount = vertcount;
- PolyCount = polycount;
- Verts = new Vector3[VertCount];
- Polys = new Vector3i[PolyCount];
-
- for (int vi=0; viPolyCount = polycount;
- node->PolyIndices = polyindices;
- return;
- }
-
- /*
- ** Try to find a suitable partitioning plane.
- */
- SplitChoiceStruct sc;
-
- sc = Select_Splitting_Plane(polycount,polyindices);
-
- /*
- ** If the algorithm could not separate any polys, just install the polys
- ** in this node and terminate. TODO: explore how this happens.
- */
- if (sc.FrontCount + sc.BackCount != polycount) {
- node->PolyCount = polycount;
- node->PolyIndices = polyindices;
- return;
- }
-
- /*
- ** Decide whether to actually partition this node. If the partitioning
- ** will not gain us anything, just install the polys in this node and terminate
- ** the tree.
- */
-#if 0
- if (sc.Cost == MAX_COST) {
- node->PolyCount = polycount;
- node->PolyIndices = polyindices;
- return;
- }
-#endif
-
- /*
- ** Ok, split the polys
- */
- SplitArraysStruct arrays;
- Split_Polys(polycount,polyindices,sc,&arrays);
-
- /*
- ** Free the memory in use by the input tile-list
- */
- delete[] polyindices;
-
- /*
- ** Build a front tree if necessary. Remember that the Build function
- ** deletes the poly array.
- */
- if (arrays.FrontCount) {
- WWASSERT(arrays.FrontPolys != NULL);
- node->Front = new CullNodeStruct;
- Build_Tree(node->Front,arrays.FrontCount,arrays.FrontPolys);
- arrays.FrontPolys = NULL;
- }
-
- /*
- ** Build a back tree if necessary. Remember that the build function
- ** deletes the tile array.
- */
- if (arrays.BackCount) {
- WWASSERT(arrays.BackPolys != NULL);
-
- node->Back = new CullNodeStruct;
- Build_Tree(node->Back,arrays.BackCount,arrays.BackPolys);
- arrays.BackPolys = NULL;
- }
-
-}
-
-
-/***********************************************************************************************
- * AABTreeBuilderClass::Select_Splitting_Plane -- select a partition for the given polys *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 6/19/98 GTH : Created. *
- *=============================================================================================*/
-AABTreeBuilderClass::SplitChoiceStruct
-AABTreeBuilderClass::Select_Splitting_Plane(int polycount,int * polyindices)
-{
- WWASSERT(polyindices != NULL);
-
- const int NUM_TRYS = 50;
-
- SplitChoiceStruct best_plane_stats;
- SplitChoiceStruct considered_plane_stats;
-
- /*
- ** Try putting axis-aligned planes through some random vertices
- */
- for (int trys = 0; trys < MIN(NUM_TRYS,polycount); trys++) {
-
- AAPlaneClass plane;
-
- /*
- ** Select a random poly and vertex index;
- */
- int poly_index = polyindices[rand() % polycount];
- int vert_index = rand() % 3;
- const Vector3i * polyverts = Polys + poly_index;
- const Vector3 * vert = Verts + (*polyverts)[vert_index];
-
- /*
- ** Select a random plane
- */
- switch(rand() % 3) {
- case 0: plane.Set(AAPlaneClass::XNORMAL,vert->X); break;
- case 1: plane.Set(AAPlaneClass::YNORMAL,vert->Y); break;
- case 2: plane.Set(AAPlaneClass::ZNORMAL,vert->Z); break;
- };
-
- /*
- ** Get the score for this plane
- */
- considered_plane_stats = Compute_Plane_Score(polycount,polyindices,plane);
-
- if (considered_plane_stats.Cost < best_plane_stats.Cost) {
- best_plane_stats = considered_plane_stats;
- }
- }
-
- return best_plane_stats;
-}
-
-
-/***********************************************************************************************
- * AABTreeBuilderClass::Compute_Plane_Score -- evaluate the suitability of a partition plane *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 6/19/98 GTH : Created. *
- *=============================================================================================*/
-AABTreeBuilderClass::SplitChoiceStruct
-AABTreeBuilderClass::Compute_Plane_Score(int polycount,int * polyindices,const AAPlaneClass & plane)
-{
- /*
- ** The score of a splitting plane is based on the following factors:
- ** - the volumes of the resulting two children volumes,
- ** - the number of polys in each child volume
- */
- SplitChoiceStruct sc;
- sc.Plane = plane;
-
- for (int i=0; i COINCIDENCE_EPSILON) {
- mask |= POS;
- }
- if (delta < -COINCIDENCE_EPSILON) {
- mask |= NEG;
- }
- mask |= ON;
- }
-
- /*
- ** Now evaluate the status of all of the verts to determine whether the
- ** triangle is in front, behind, on or overlapping the plane
- */
-
- /*
- ** If all verts were ON the plane, the triangle is ON the plane
- */
- if (mask == ON) {
- return ON;
- }
-
- /*
- ** If all verts were POS or ON, the triangle is POS (IN_FRONT)
- */
- if ((mask & ~(POS | ON)) == 0) {
- return POS;
- }
-
- /*
- ** If all verts were NEG or ON, the triangle is NEG (BEHIND)
- */
- if ((mask & ~(NEG | ON)) == 0) {
- return NEG;
- }
-
- /*
- ** Otherwise, the triangle spans the plane
- */
- return BOTH;
-}
-
-
-/***********************************************************************************************
- * AABTreeBuilderClass::Split_Polys -- partition the polys with a plane *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 6/19/98 GTH : Created. *
- *=============================================================================================*/
-void AABTreeBuilderClass::Split_Polys
-(
- int polycount,
- int * polyindices,
- const SplitChoiceStruct & sc,
- SplitArraysStruct * arrays
-)
-{
- /*
- ** Note that this routine arrays of polygons. The caller is then responsible for keeping
- ** track of the memory this routine allocates.
- */
- if (sc.FrontCount > 0) {
- arrays->FrontPolys = new int[sc.FrontCount];
- }
-
- if (sc.BackCount > 0) {
- arrays->BackPolys = new int[sc.BackCount];
- }
-
- arrays->FrontCount = 0;
- arrays->BackCount = 0;
-
- for (int i=0; iFrontPolys[arrays->FrontCount++] = polyindices[i];
- break;
-
- case BACK:
- arrays->BackPolys[arrays->BackCount++] = polyindices[i];
- break;
- }
- }
-
- /*
- ** when we are all done, the counts should match.
- */
- WWASSERT(arrays->FrontCount == sc.FrontCount);
- WWASSERT(arrays->BackCount == sc.BackCount);
-}
-
-
-/***********************************************************************************************
- * AABTreeBuilderClass::Compute_Bounding_Box -- compute bounding boxes for the cull nodes *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 6/19/98 GTH : Created. *
- *=============================================================================================*/
-void AABTreeBuilderClass::Compute_Bounding_Box(CullNodeStruct * node)
-{
- /*
- ** compute bounding volumes of the children
- */
- if (node->Front) {
- Compute_Bounding_Box(node->Front);
- }
-
- if (node->Back) {
- Compute_Bounding_Box(node->Back);
- }
-
- /*
- ** compute bounding volume for the polys in this node
- */
- node->Min.Set(100000.0f,100000.0f,100000.0f);
- node->Max.Set(-100000.0f,-100000.0f,-100000.0f);
-
- for (int poly_index = 0; poly_index < node->PolyCount; poly_index++) {
- Update_Min_Max(node->PolyIndices[poly_index],node->Min,node->Max );
- }
-
- /*
- ** bound the polys in the front child node
- */
- if (node->Front) {
- if (node->Front->Min.X < node->Min.X) node->Min.X = node->Front->Min.X;
- if (node->Front->Max.X > node->Max.X) node->Max.X = node->Front->Max.X;
-
- if (node->Front->Min.Y < node->Min.Y) node->Min.Y = node->Front->Min.Y;
- if (node->Front->Max.Y > node->Max.Y) node->Max.Y = node->Front->Max.Y;
-
- if (node->Front->Min.Z < node->Min.Z) node->Min.Z = node->Front->Min.Z;
- if (node->Front->Max.Z > node->Max.Z) node->Max.Z = node->Front->Max.Z;
- }
-
- /*
- ** bound the polys in the back child node
- */
- if (node->Back) {
- if (node->Back->Min.X < node->Min.X) node->Min.X = node->Back->Min.X;
- if (node->Back->Max.X > node->Max.X) node->Max.X = node->Back->Max.X;
-
- if (node->Back->Min.Y < node->Min.Y) node->Min.Y = node->Back->Min.Y;
- if (node->Back->Max.Y > node->Max.Y) node->Max.Y = node->Back->Max.Y;
-
- if (node->Back->Min.Z < node->Min.Z) node->Min.Z = node->Back->Min.Z;
- if (node->Back->Max.Z > node->Max.Z) node->Max.Z = node->Back->Max.Z;
- }
-
- WWASSERT(node->Min.X != 100000.0f);
- WWASSERT(node->Min.Y != 100000.0f);
- WWASSERT(node->Min.Z != 100000.0f);
- WWASSERT(node->Max.X != -100000.0f);
- WWASSERT(node->Max.Y != -100000.0f);
- WWASSERT(node->Max.Z != -100000.0f);
-}
-
-
-/***********************************************************************************************
- * AABTreeBuilderClass::Assign_Index -- assign an array index to each node *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 6/19/98 GTH : Created. *
- *=============================================================================================*/
-int AABTreeBuilderClass::Assign_Index(CullNodeStruct * node,int index)
-{
- /*
- ** This function is used to assign a sequential index to
- ** each node in the tree. The AABTree stores its nodes in
- ** an array so this index is used to determine which slot
- ** in the array to put each node into.
- */
- WWASSERT(node);
- node->Index = index;
- index++;
-
- if (node->Front) {
- index = Assign_Index(node->Front,index);
- }
-
- if (node->Back) {
- index = Assign_Index(node->Back,index);
- }
-
- return index;
-}
-
-
-/***********************************************************************************************
- * AABTreeBuilderClass::Node_Count -- Count the nodes in the tree *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 6/19/98 GTH : Created. *
- *=============================================================================================*/
-int AABTreeBuilderClass::Node_Count(void)
-{
- if (Root) {
- return Node_Count_Recursive(Root,0);
- } else {
- return 0;
- }
-}
-
-
-/***********************************************************************************************
- * AABTreeBuilderClass::Poly_Count -- returns number of polys *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/23/98 GTH : Created. *
- *=============================================================================================*/
-int AABTreeBuilderClass::Poly_Count(void)
-{
- return PolyCount;
-}
-
-/***********************************************************************************************
- * AABTreeBuilderClass::Node_Count_Recursive -- internal implementation of Node_Count *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 6/19/98 GTH : Created. *
- *=============================================================================================*/
-int AABTreeBuilderClass::Node_Count_Recursive(CullNodeStruct * node,int curcount)
-{
- curcount++;
- if (node->Front) {
- curcount = Node_Count_Recursive(node->Front,curcount);
- }
- if (node->Back) {
- curcount = Node_Count_Recursive(node->Back,curcount);
- }
- return curcount;
-}
-
-
-/***********************************************************************************************
- * AABTreeBuilderClass::Update_Min -- ensure given vector is < min of the poly *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 6/22/98 GTH : Created. *
- *=============================================================================================*/
-void AABTreeBuilderClass::Update_Min(int poly_index,Vector3 & min)
-{
- for (int vert_index = 0; vert_index < 3; vert_index++) {
-
- const Vector3i * polyverts = Polys + poly_index;
- const Vector3 * point = Verts + (*polyverts)[vert_index];
-
- if (point->X < min.X) min.X = point->X;
- if (point->Y < min.Y) min.Y = point->Y;
- if (point->Z < min.Z) min.Z = point->Z;
- }
-}
-
-
-/***********************************************************************************************
- * AABTreeBuilderClass::Update_Max -- ensure given vector is > max of poly *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 6/22/98 GTH : Created. *
- *=============================================================================================*/
-void AABTreeBuilderClass::Update_Max(int poly_index,Vector3 & max)
-{
- for (int vert_index = 0; vert_index < 3; vert_index++) {
-
- const Vector3i * polyverts = Polys + poly_index;
- const Vector3 * point = Verts + (*polyverts)[vert_index];
-
- if (point->X > max.X) max.X = point->X;
- if (point->Y > max.Y) max.Y = point->Y;
- if (point->Z > max.Z) max.Z = point->Z;
- }
-}
-
-
-/***********************************************************************************************
- * AABTreeBuilderClass::Update_Min_Max -- ensure given vector is in min max of poly *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 9/24/98 BMG : Created. *
- *=============================================================================================*/
-void AABTreeBuilderClass::Update_Min_Max(int poly_index, Vector3 & min, Vector3 & max)
-{
- for (int vert_index = 0; vert_index < 3; vert_index++) {
-
- const Vector3i * polyverts = Polys + poly_index;
- const Vector3 * point = Verts + (*polyverts)[vert_index];
-
- if (point->X < min.X) min.X = point->X;
- if (point->Y < min.Y) min.Y = point->Y;
- if (point->Z < min.Z) min.Z = point->Z;
-
- if (point->X > max.X) max.X = point->X;
- if (point->Y > max.Y) max.Y = point->Y;
- if (point->Z > max.Z) max.Z = point->Z;
- }
-}
-
-
-
-/***********************************************************************************************
- * AABTreeBuilderClass::Export -- Saves this AABTree into a W3D chunk *
- * *
- * This function will export the AABTree into a W3D chunk so that it can be loaded by its *
- * sister class "AABTreeClass" in the WW3D library. *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 5/22/2000 gth : Created. *
- *=============================================================================================*/
-void AABTreeBuilderClass::Export(ChunkSaveClass & csave)
-{
- csave.Begin_Chunk(W3D_CHUNK_AABTREE);
-
- /*
- ** Pack the tree into an array of W3dMeshAABTreeNode's and polygon indices
- */
- W3dMeshAABTreeNode * nodes = new W3dMeshAABTreeNode[Node_Count()];
- uint32 * poly_indices = new uint32[Poly_Count()];
-
- int cur_node = 0;
- int cur_poly = 0;
- Build_W3D_AABTree_Recursive(Root,nodes,poly_indices,cur_node,cur_poly);
-
- /*
- ** Write out the header
- */
- csave.Begin_Chunk(W3D_CHUNK_AABTREE_HEADER);
- W3dMeshAABTreeHeader header;
- memset(&header,0,sizeof(header));
- header.NodeCount = Node_Count();
- header.PolyCount = Poly_Count();
- csave.Write(&header,sizeof(header));
- csave.End_Chunk();
-
- /*
- ** Write out the array of polygon indices
- */
- csave.Begin_Chunk(W3D_CHUNK_AABTREE_POLYINDICES);
- csave.Write(poly_indices,Poly_Count() * sizeof(uint32));
- csave.End_Chunk();
-
- /*
- ** Write out the array of nodes
- */
- csave.Begin_Chunk(W3D_CHUNK_AABTREE_NODES);
- for (int ni=0; niIndex]);
- newnode->Min.X = node->Min.X;
- newnode->Min.Y = node->Min.Y;
- newnode->Min.Z = node->Min.Z;
- newnode->Max.X = node->Max.X;
- newnode->Max.Y = node->Max.Y;
- newnode->Max.Z = node->Max.Z;
-
- /*
- ** If this is a non-leaf node, set up the child indices, otherwise set up the polygon indices
- */
- if (node->Front != NULL) {
-
- WWASSERT(node->Back != NULL); // if we have one child, we better have both!
- newnode->FrontOrPoly0 = node->Front->Index;
- newnode->BackOrPolyCount = node->Back->Index;
-
- } else {
-
- newnode->FrontOrPoly0 = cur_poly | 0x80000000;
- newnode->BackOrPolyCount = node->PolyCount;
-
- }
-
- /*
- ** Copy the polygon indices for this node into our array
- */
- for (int pcounter = 0; pcounter < node->PolyCount; pcounter++) {
- poly_indices[cur_poly++] = node->PolyIndices[pcounter];
- }
-
- /*
- ** Install the children
- */
- if (node->Front) {
- Build_W3D_AABTree_Recursive(node->Front,w3d_nodes,poly_indices,cur_node,cur_poly);
- }
- if (node->Back) {
- Build_W3D_AABTree_Recursive(node->Back,w3d_nodes,poly_indices,cur_node,cur_poly);
- }
-}
-
-
-
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/aabtreebuilder.h b/Generals/Code/Tools/WW3D/max2w3d/aabtreebuilder.h
deleted file mode 100644
index 25a843a8edf..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/aabtreebuilder.h
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : WW3D *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/aabtreebuilder.h $*
- * *
- * Original Author:: Greg Hjelstrom *
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 5/22/00 2:02p $*
- * *
- * $Revision:: 2 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#if defined(_MSC_VER)
-#pragma once
-#endif
-
-#ifndef AABTREEBUILDER_H
-#define AABTREEBUILDER_H
-
-#include "always.h"
-#include "vector3.h"
-#include "vector3i.h"
-#include "aaplane.h"
-#include "BITTYPE.H"
-#include
-
-class AABTreeClass;
-class ChunkSaveClass;
-struct W3dMeshAABTreeNode;
-
-/*
-** AABTreeBuilderClass
-** This class serves simply to build AABTreeClasses. It first builds a tree
-** which uses an easier to manage data structure (but uses more memory). Then
-** the tree is converted into the representation used in the AABTreeClass.
-*/
-class AABTreeBuilderClass
-{
-public:
-
- AABTreeBuilderClass(void);
- ~AABTreeBuilderClass(void);
-
- void Build_AABTree(int polycount,Vector3i * polys,int vertcount,Vector3 * verts);
- void Export(ChunkSaveClass & csave);
-
- int Node_Count(void);
- int Poly_Count(void);
-
- enum
- {
- MIN_POLYS_PER_NODE = 4,
- SMALL_VERTEX = -100000,
- BIG_VERTEX = 100000
- };
-
-private:
-
- /*
- ** This CullNodeStruct is used in building the AABTree. It is much more
- ** wasteful in terms of memory footprint and number of allocations than the
- ** streamlined version found in the actual AABTreeClass.
- */
- struct CullNodeStruct
- {
- CullNodeStruct(void) : Index(0),Min(0,0,0),Max(0,0,0),Front(NULL),Back(NULL),PolyCount(0),PolyIndices(NULL) {}
- ~CullNodeStruct(void)
- {
- if (Front) { delete Front; }
- if (Back) { delete Back; }
- if (PolyIndices) { delete[] PolyIndices; }
- }
-
- int Index;
- Vector3 Min;
- Vector3 Max;
- CullNodeStruct * Front;
- CullNodeStruct * Back;
- int PolyCount;
- int * PolyIndices;
- };
-
- /*
- ** SplitChoiceStruct - encapsulates the results of evaluating the suitability of a partition
- */
- struct SplitChoiceStruct
- {
- SplitChoiceStruct(void) :
- Cost(FLT_MAX),
- FrontCount(0),
- BackCount(0),
- BMin(BIG_VERTEX,BIG_VERTEX,BIG_VERTEX),
- BMax(SMALL_VERTEX,SMALL_VERTEX,SMALL_VERTEX),
- FMin(BIG_VERTEX,BIG_VERTEX,BIG_VERTEX),
- FMax(SMALL_VERTEX,SMALL_VERTEX,SMALL_VERTEX),
- Plane(AAPlaneClass::XNORMAL,0)
- {
- }
-
- float Cost; // try to minimize this!
- int FrontCount; // number of polys in front of the plane
- int BackCount; // number of polys behind the plane
- Vector3 BMin; // min of the bounding box of the "back" child
- Vector3 BMax; // max of the bounding box of the "back" child
- Vector3 FMin; // min of the bounding box of the "front" child
- Vector3 FMax; // max of the bounding box of the "front" child
- AAPlaneClass Plane; // partitioning plane
- };
-
- struct SplitArraysStruct
- {
- SplitArraysStruct(void) :
- FrontCount(0),
- BackCount(0),
- FrontPolys(NULL),
- BackPolys(NULL)
- {
- }
-
- int FrontCount;
- int BackCount;
- int * FrontPolys;
- int * BackPolys;
- };
-
- enum OverlapType
- {
- POS = 0x01,
- NEG = 0x02,
- ON = 0x04,
- BOTH = 0x08,
- OUTSIDE = POS,
- INSIDE = NEG,
- OVERLAPPED = BOTH,
- FRONT = POS,
- BACK = NEG,
- };
-
-
- /*
- ** Internal functions
- */
- void Reset();
- void Build_Tree(CullNodeStruct * node,int polycount,int * polyindices);
- SplitChoiceStruct Select_Splitting_Plane(int polycount,int * polyindices);
- SplitChoiceStruct Compute_Plane_Score(int polycont,int * polyindices,const AAPlaneClass & plane);
- void Split_Polys(int polycount,int * polyindices,const SplitChoiceStruct & sc,SplitArraysStruct * arrays);
- OverlapType Which_Side(const AAPlaneClass & plane,int poly_index);
- void Compute_Bounding_Box(CullNodeStruct * node);
- int Assign_Index(CullNodeStruct * node,int index);
- int Node_Count_Recursive(CullNodeStruct * node,int curcount);
- void Update_Min(int poly_index,Vector3 & set_min);
- void Update_Max(int poly_index,Vector3 & set_max);
- void Update_Min_Max(int poly_index, Vector3 & set_min, Vector3 & set_max);
-
- void Build_W3D_AABTree_Recursive(CullNodeStruct * node,
- W3dMeshAABTreeNode * w3dnodes,
- uint32 * poly_indices,
- int & cur_node,
- int & cur_poly);
- /*
- ** Tree
- */
- CullNodeStruct * Root;
- int CurPolyIndex;
-
- /*
- ** Mesh data
- */
- int PolyCount;
- Vector3i * Polys;
- int VertCount;
- Vector3 * Verts;
-
- friend class AABTreeClass;
-};
-
-
-
-
-#endif //AABTREEBUILDER_H
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/animationcompressionsettings.cpp b/Generals/Code/Tools/WW3D/max2w3d/animationcompressionsettings.cpp
deleted file mode 100644
index 00d939acfc6..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/animationcompressionsettings.cpp
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Max2W3d *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/animationcompressionsettings.cpp $*
- * *
- * Original Author:: Patrick Smith *
- * *
- * $Author:: Patrick $*
- * *
- * $Modtime:: 10/30/00 1:57p $*
- * *
- * $Revision:: 2 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#include "animationcompressionsettings.h"
-#include "dllmain.h"
-#include "resource.h"
-#include "w3dexp.h"
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-//
-// AnimationCompressionSettingsDialogClass
-//
-////////////////////////////////////////////////////////////////////////////////////////
-AnimationCompressionSettingsDialogClass::AnimationCompressionSettingsDialogClass (Interface *maxinterface, HWND parent_wnd) :
- MaxInterface (maxinterface),
- Options (NULL),
- Wnd (NULL),
- ParentWnd (parent_wnd)
-{
- return ;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-//
-// ~AnimationCompressionSettingsDialogClass
-//
-////////////////////////////////////////////////////////////////////////////////////////
-AnimationCompressionSettingsDialogClass::~AnimationCompressionSettingsDialogClass (void)
-{
- return ;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-//
-// Do_Modal
-//
-////////////////////////////////////////////////////////////////////////////////////////
-int
-AnimationCompressionSettingsDialogClass::Do_Modal (void)
-{
- int retval = ::DialogBoxParam (AppInstance, MAKEINTRESOURCE (IDD_ANIMATION_COMPRESSION),
- ParentWnd, Real_Message_Proc, (LPARAM)this);
- return retval;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-//
-// Real_Message_Proc
-//
-////////////////////////////////////////////////////////////////////////////////////////
-BOOL CALLBACK
-AnimationCompressionSettingsDialogClass::Real_Message_Proc
-(
- HWND wnd,
- UINT message,
- WPARAM wparam,
- LPARAM lparam
-)
-{
- AnimationCompressionSettingsDialogClass *dialog_obj = NULL;
-
- //
- // Setup the framework we need so that the instance
- // can process the messages instead of this static callback.
- //
- if (message == WM_INITDIALOG) {
- dialog_obj = (AnimationCompressionSettingsDialogClass *)lparam;
- dialog_obj->Wnd = wnd;
- ::SetProp (wnd, "DIALOG_OBJ", (HANDLE)dialog_obj);
- } else {
- dialog_obj = (AnimationCompressionSettingsDialogClass *)::GetProp (wnd, "DIALOG_OBJ");
- }
-
- //
- // Allow the instance to handle the call
- //
- BOOL retval = FALSE;
- if (dialog_obj != NULL) {
- retval = dialog_obj->Message_Proc (message, wparam, lparam);
- }
-
- //
- // Cleanup the framework
- //
- if (message == WM_DESTROY) {
- ::RemoveProp (wnd, "DIALOG_OBJ");
- }
-
- return retval;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-//
-// Message_Proc
-//
-////////////////////////////////////////////////////////////////////////////////////////
-BOOL
-AnimationCompressionSettingsDialogClass::Message_Proc
-(
- UINT message,
- WPARAM wparam,
- LPARAM lparam
-)
-{
- BOOL retval = FALSE;
-
- switch (message)
- {
- case WM_INITDIALOG:
- {
- //
- // Center the dialog
- //
- RECT parent_rect = { 0 };
- RECT rect = { 0 };
- ::GetWindowRect (ParentWnd, &parent_rect);
- ::GetWindowRect (Wnd, &rect);
- int width = parent_rect.right - parent_rect.left;
- int height = parent_rect.bottom - parent_rect.top;
- ::SetWindowPos ( Wnd, NULL,
- parent_rect.left + (width / 2) - ((rect.right - rect.left) / 2),
- parent_rect.top + (height / 2) - ((rect.bottom - rect.top) / 2),
- 0, 0, SWP_NOZORDER | SWP_NOSIZE);
-
- //
- // Initialize the dialog controls
- //
- Initialize_Controls ();
- }
- break;
-
- case WM_COMMAND:
- {
- switch (LOWORD (wparam))
- {
- case IDCANCEL:
- EndDialog (Wnd, IDCANCEL);
- break;
-
- case IDOK:
- Save_Settings ();
- EndDialog (Wnd, IDOK);
- break;
- }
- }
- break;
- }
-
- return retval;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-//
-// Initialize_Controls
-//
-////////////////////////////////////////////////////////////////////////////////////////
-void
-AnimationCompressionSettingsDialogClass::Initialize_Controls (void)
-{
- SetCheckBox (Wnd, IDC_REDUCE_ANIMATION_CHECK, Options->ReduceAnimation);
- char string[128] = { 0 };
-
- //
- // Populate the reduction percent combo box
- //
- HWND percent_combo = ::GetDlgItem (Wnd, IDC_REDUCE_ANIMATION_COMBO);
- for (int index = 1; index < 100; index ++) {
- sprintf (string, "%d", index);
- ComboBox_AddString (percent_combo, string);
- }
-
- //
- // Populate the animation type combo box
- //
- HWND flavor_combo = ::GetDlgItem (Wnd, IDC_COMPRESS_ANIMATION_FLAVOR_COMBO);
- ComboBox_AddString (flavor_combo, "TimeCoded");
- ComboBox_AddString (flavor_combo, "Adaptive Delta");
-
- //
- // Bounds check the parameters
- //
- if ((Options->ReduceAnimationPercent < 1) || (Options->ReduceAnimationPercent > 99)) {
- Options->ReduceAnimationPercent = 50;
-
- }
-
- if ((Options->CompressAnimationFlavor < 0) || (Options->CompressAnimationFlavor >= ANIM_FLAVOR_VALID)) {
- Options->CompressAnimationFlavor = 0;
- }
-
- //
- // Select the correct entries in the combo boxes
- //
- ComboBox_SetCurSel (percent_combo, Options->ReduceAnimationPercent - 1);
- ComboBox_SetCurSel (flavor_combo, Options->CompressAnimationFlavor);
-
- //
- // Fill in the error fields
- //
- ::sprintf (string, "%f", Options->CompressAnimationTranslationError);
- ::SetDlgItemText (Wnd, IDC_MAX_TRANS_ERROR_EDIT, string);
-
- ::sprintf (string, "%f", Options->CompressAnimationRotationError);
- ::SetDlgItemText (Wnd, IDC_MAX_ROT_ERROR_EDIT, string);
- return ;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-//
-// Save_Settings
-//
-////////////////////////////////////////////////////////////////////////////////////////
-void
-AnimationCompressionSettingsDialogClass::Save_Settings (void)
-{
- //
- // Read the compression type setting
- //
- int flavor = ComboBox_GetCurSel (::GetDlgItem (Wnd, IDC_COMPRESS_ANIMATION_FLAVOR_COMBO));
- Options->CompressAnimationFlavor = flavor;
-
- //
- // Determine whether or not we want to force reduction
- //
- Options->ReduceAnimation = (IsDlgButtonChecked (Wnd, IDC_REDUCE_ANIMATION_CHECK) == 1);
-
- //
- // Read the reduction percent setting
- //
- int reduce_percent = ComboBox_GetCurSel (::GetDlgItem (Wnd, IDC_REDUCE_ANIMATION_COMBO)) + 1;
- Options->ReduceAnimationPercent = reduce_percent;
-
- //
- // Read the amount of compression error we'll allow in the translational component
- //
- char string[128];
- ::GetDlgItemText (Wnd, IDC_MAX_TRANS_ERROR_EDIT, string, sizeof (string));
- float trans_error = ::atof (string);
- Options->CompressAnimationTranslationError = trans_error;
-
- //
- // Read the amount of compression error we'll allow in the rotational component
- //
- ::GetDlgItemText (Wnd, IDC_MAX_ROT_ERROR_EDIT, string, sizeof (string));
- float rot_error = ::atof (string);
- Options->CompressAnimationRotationError = rot_error;
- return ;
-}
diff --git a/Generals/Code/Tools/WW3D/max2w3d/animationcompressionsettings.h b/Generals/Code/Tools/WW3D/max2w3d/animationcompressionsettings.h
deleted file mode 100644
index 5e6ab3ca3cd..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/animationcompressionsettings.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Max2W3d *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/animationcompressionsettings.h $*
- * *
- * Original Author:: Patrick Smith *
- * *
- * $Author:: Patrick $*
- * *
- * $Modtime:: 10/30/00 1:57p $*
- * *
- * $Revision:: 2 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#ifndef __ANIMATION_COMPRESSION_SETTINGS_H
-#define __ANIMATION_COMPRESSION_SETTINGS_H
-
-#include
-#include
-#include "w3dutil.h"
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-//
-// AnimationCompressionSettingsDialogClass
-//
-////////////////////////////////////////////////////////////////////////////////////////
-class AnimationCompressionSettingsDialogClass
-{
-public:
-
- //////////////////////////////////////////////////////////////////
- // Public constructors/destructors
- //////////////////////////////////////////////////////////////////
- AnimationCompressionSettingsDialogClass (Interface *maxinterface, HWND parent_wnd = NULL);
- ~AnimationCompressionSettingsDialogClass (void);
-
-
- //////////////////////////////////////////////////////////////////
- // Public methods
- //////////////////////////////////////////////////////////////////
-
- void Set_Options (W3dExportOptionsStruct *options) { Options = options; }
- int Do_Modal (void);
-
-private:
-
- //////////////////////////////////////////////////////////////////
- // Static methods
- //////////////////////////////////////////////////////////////////
- static BOOL CALLBACK Real_Message_Proc (HWND wnd, UINT message, WPARAM wparam, LPARAM lparam);
-
- //////////////////////////////////////////////////////////////////
- // Private methods
- //////////////////////////////////////////////////////////////////
- BOOL Message_Proc (UINT message, WPARAM wparam, LPARAM lparam);
- void Initialize_Controls (void);
- void Save_Settings (void);
-
- //////////////////////////////////////////////////////////////////
- // Private member data
- //////////////////////////////////////////////////////////////////
- W3dExportOptionsStruct * Options;
- Interface * MaxInterface;
- HWND Wnd;
- HWND ParentWnd;
-};
-
-
-#endif //__ANIMATION_COMPRESSION_SETTINGS_H
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/bchannel.cpp b/Generals/Code/Tools/WW3D/max2w3d/bchannel.cpp
deleted file mode 100644
index 1682caf8b1f..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/bchannel.cpp
+++ /dev/null
@@ -1,319 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : W3D Tools *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/bchannel.cpp $*
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 10/30/00 5:25p $*
- * *
- * $Revision:: 6 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#include "bchannel.h"
-#include "w3d_file.h"
-#include "logdlg.h"
-#include "exportlog.h"
-
-
-BitChannelClass::BitChannelClass
-(
- uint32 id,
- int maxframes,
- uint32 chntype,
- bool default_val
-) :
- ID(id),
- ChannelType(chntype),
- MaxFrames(maxframes),
- IsEmpty(true),
- DefaultVal(default_val),
- Data(maxframes),
- Begin(0),
- End(0)
-{
- // start "Begin" at the end of the array, whenever we set a value
- // at an index less than "Begin", we push "Begin" back.
- Begin = MaxFrames;
- End = 0;
-}
-
-BitChannelClass::~BitChannelClass(void)
-{
-}
-
-void BitChannelClass::Set_Bit(int frameidx,bool bit)
-{
- assert(frameidx >= 0);
- assert(frameidx < MaxFrames);
-
- Data[frameidx] = bit;
-
- if (!is_default(bit)) {
- IsEmpty = false;
- }
-}
-
-void BitChannelClass::Set_Bits(BooleanVectorClass & bits)
-{
- for (int i=0; i= 0);
- assert(frameidx < MaxFrames);
-
- return Data[frameidx];
-}
-
-
-bool BitChannelClass::Save(ChunkSaveClass & csave, bool compress)
-{
- if (IsEmpty) return true;
-
- if (compress) {
- // Save the Channel Data Compressed
- // TIMECODED
- if (!csave.Begin_Chunk(W3D_CHUNK_COMPRESSED_BIT_CHANNEL)) {
- return false;
- }
-
- uint32 channelsize = sizeof(W3dTimeCodedBitChannelStruct);
- uint32 packetsize = sizeof(uint32);
-
- channelsize += packetsize * MaxFrames;
- channelsize -= sizeof(uint32);
-
- W3dTimeCodedBitChannelStruct * chn = (W3dTimeCodedBitChannelStruct *)malloc(channelsize);
-
- if (chn == NULL) {
- return false;
- }
-
- chn->NumTimeCodes = MaxFrames;
- chn->Pivot = ID;
- chn->Flags = ChannelType;
- chn->DefaultVal = DefaultVal;
-
- // copy data into the channel struct, in timecoded raw format
-
- for (uint32 fcount=0; fcount < chn->NumTimeCodes; fcount++) {
-
- if (Get_Bit(fcount)) {
- chn->Data[fcount] = fcount | W3D_TIMECODED_BIT_MASK;
- }
- else {
- chn->Data[fcount] = fcount;
- }
- }
-
- // Compress the new structure
-
- BitChannelClass::compress( chn );
-
- float originalchannelsize = channelsize;
-
- // Update Channel Size
- channelsize = sizeof(W3dTimeCodedBitChannelStruct);
- channelsize += packetsize * chn->NumTimeCodes;
- channelsize -= sizeof(uint32);
-
- float percent = (((float) channelsize) / originalchannelsize) * 100.0f;
-
- ExportLog::printf("%.0f", percent);
-
-
- // save
-
- if (csave.Write(chn,channelsize) != channelsize) {
- return false;
- }
-
- if (chn != NULL) {
- free(chn);
- }
-
- if (!csave.End_Chunk()) {
- return false;
- }
-
- }
- else {
- // Stock Raw Save
- if (!csave.Begin_Chunk(W3D_CHUNK_BIT_CHANNEL)) {
- return false;
- }
-
- compute_range();
-
- int numbits = End - Begin + 1;
- assert(numbits > 0);
- int numbytes = (numbits + 7) / 8;
-
- unsigned int channelsize = sizeof(W3dBitChannelStruct);
- channelsize += numbytes - 1; // one byte inside the W3dBitChannelStruct...
-
- W3dBitChannelStruct * chn = (W3dBitChannelStruct *)malloc(channelsize);
-
- if (chn == NULL) {
- return false;
- }
-
- chn->FirstFrame = Begin;
- chn->LastFrame = End;
- chn->Flags = ChannelType;
- chn->Pivot = ID;
- chn->DefaultVal = DefaultVal;
-
- uint8 * bits = (uint8 *)&(chn->Data[0]);
-
- for (int fcount=0; fcount < End-Begin+1; fcount++) {
- ::Set_Bit(bits,fcount,Get_Bit(Begin + fcount));
- }
-
- if (csave.Write(chn,channelsize) != channelsize) {
- return false;
- }
-
- if (chn != NULL) {
- free(chn);
- }
-
- if (!csave.End_Chunk()) {
- return false;
- }
-
- }
-
- return true;
-}
-
-
-bool BitChannelClass::is_default(bool bit)
-{
- return (bit == DefaultVal);
-}
-
-void BitChannelClass::compute_range(void)
-{
- Begin = 0;
- while ((Begin < MaxFrames) && (is_default(Get_Bit(Begin)))) {
- Begin++;
- }
-
- End = MaxFrames-1;
- while ((End >= 0) && (is_default(Get_Bit(End)))) {
- End--;
- }
-} // compute_range
-
-
-//
-// find a packet that isn't needed, and return the index
-// if all packets are necessary, then return back PACKETS_ALL_USEFUL
-// a useless packet is defined, as a packet that can be recreated
-//
-#define PACKETS_ALL_USEFUL (0xFFFFFFFF)
-//
-uint32 BitChannelClass::find_useless_packet(W3dTimeCodedBitChannelStruct * c)
-{
-
- assert( c ); // make sure pointer exists
- assert( c->NumTimeCodes ); // make sure some packets exist
-
- if (c->NumTimeCodes > 2) {
-
- for(uint32 try_idx = 0; try_idx < (c->NumTimeCodes - 1); try_idx++) {
-
- if ((c->Data[try_idx] & W3D_TIMECODED_BIT_MASK) ==
- (c->Data[try_idx+1] & W3D_TIMECODED_BIT_MASK)) {
- return(try_idx + 1);
- }
-
- } // for
- }
-
- return( PACKETS_ALL_USEFUL );
-
-} // find_useless_packet
-
-
-//
-// Remove a packet from a W3dTimeCodedBitChannelStruct
-//
-void BitChannelClass::remove_packet(W3dTimeCodedBitChannelStruct * c, uint32 packet_idx)
-{
- assert( c );
- assert( c->NumTimeCodes > 1 );
-
- uint32 packet_size = 1;
- uint32 packet_len = packet_size * sizeof(uint32);
-
- uint32 *src, *dst;
-
- dst = (uint32 *) &c->Data[ packet_size * packet_idx ];
- src = (uint32 *) &c->Data[ packet_size * (packet_idx + 1) ];
-
- uint32 copy_length = (c->NumTimeCodes - (packet_idx + 1)) * packet_len;
-
- if (copy_length) {
-
- memcpy(dst, src, copy_length);
-
- }
-
- // Decrement Packet Count
- c->NumTimeCodes--;
-
-} // remove_packet
-
-//
-// Take a non-compressed TimeCoded Bit Channel
-// and compress the packets
-//
-void BitChannelClass::compress(W3dTimeCodedBitChannelStruct * c)
-{
- while(1) {
-
- uint32 idx = find_useless_packet( c );
-
- if (PACKETS_ALL_USEFUL == idx) break;
-
- remove_packet( c, idx );
-
- }
-
-} // compress
-
-
-
-
-// EOF - bchannel.cpp
diff --git a/Generals/Code/Tools/WW3D/max2w3d/bchannel.h b/Generals/Code/Tools/WW3D/max2w3d/bchannel.h
deleted file mode 100644
index 88225578c44..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/bchannel.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : W3D Tools *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/bchannel.h $*
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 10/30/00 5:25p $*
- * *
- * $Revision:: 5 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#ifndef BCHANNEL_H
-#define BCHANNEL_H
-
-#ifndef ALWAYS_H
-#include "always.h"
-#endif
-
-#ifndef BITTYPE_H
-#include "BITTYPE.H"
-#endif
-
-#ifndef CHUNKIO_H
-#include "chunkio.h"
-#endif
-
-#ifndef VECTOR_H
-#include "Vector.H"
-#endif
-
-#ifndef W3D_FILE_H
-#include "w3d_file.h"
-#endif
-
-class LogDataDialogClass;
-
-class BitChannelClass
-{
-public:
-
- BitChannelClass(uint32 id,int maxframes,uint32 chntype,bool def_val);
- ~BitChannelClass(void);
-
- void Set_Bit(int framenumber,bool bit);
- void Set_Bits(BooleanVectorClass & bits);
- bool Get_Bit(int frameidx);
- bool Is_Empty(void) { return IsEmpty; }
- bool Save(ChunkSaveClass & csave, bool compress);
-
-private:
-
- uint32 ID;
- uint32 ChannelType;
- int MaxFrames;
- bool IsEmpty;
-
- bool DefaultVal;
- BooleanVectorClass Data;
- int Begin;
- int End;
-
- // Test a bit against the "default" bit
- bool is_default(bool bit);
-
- // This function finds the start and end of the "non-default" data
- void compute_range(void);
-
- // compress functions
- void remove_packet(W3dTimeCodedBitChannelStruct * c, uint32 packet_idx);
- uint32 find_useless_packet(W3dTimeCodedBitChannelStruct * c);
- void compress(W3dTimeCodedBitChannelStruct * c);
-
-
-};
-
-
-#endif
\ No newline at end of file
diff --git a/Generals/Code/Tools/WW3D/max2w3d/boneicon.cpp b/Generals/Code/Tools/WW3D/max2w3d/boneicon.cpp
deleted file mode 100644
index 75e34564b82..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/boneicon.cpp
+++ /dev/null
@@ -1,606 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/* $Header: /Commando/Code/Tools/max2w3d/boneicon.cpp 6 1/12/98 4:02p Greg_h $ */
-/***********************************************************************************************
- *** Confidential - Westwood Studios ***
- ***********************************************************************************************
- * *
- * Project Name : Commando Tools - WWSkin *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/boneicon.cpp $*
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 1/09/98 3:09p $*
- * *
- * $Revision:: 6 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#include "boneicon.h"
-
-const int NumBoneIconVerts = 184;
-const int NumBoneIconFaces = 366;
-
-/*
-** Don't try this at home :-)
-*/
-#pragma warning(disable:4305)
-
-VertexStruct BoneIconVerts[NumBoneIconVerts] = {
-
- { 0.07, -0.37, 0.23 },
- { 0.07, -0.38, 0.22 },
- { 0.07, -0.37, 0.22 },
- { -0.07, -0.38, 0.22 },
- { -0.07, -0.38, 0.22 },
- { -0.05, -0.31, 0.21 },
- { -0.07, -0.38, 0.22 },
- { -0.07, -0.37, 0.21 },
- { 0.07, -0.38, 0.22 },
- { 0.06, -0.34, 0.18 },
- { 0.07, -0.38, 0.23 },
- { -0.07, -0.38, 0.22 },
- { -0.10, -0.42, 0.19 },
- { -0.04, -0.47, 0.11 },
- { -0.04, -0.51, 0.21 },
- { -0.04, -0.36, 0.12 },
- { 0.05, -0.41, 0.10 },
- { 0.05, -0.51, 0.15 },
- { 0.05, -0.49, 0.26 },
- { 0.11, -0.42, 0.19 },
- { -0.05, -0.45, 0.26 },
- { -0.06, -0.43, 0.25 },
- { -0.04, -0.45, 0.27 },
- { -0.07, -0.40, 0.23 },
- { 0.00, -0.46, 0.27 },
- { 0.04, -0.45, 0.27 },
- { 0.05, -0.44, 0.27 },
- { -0.00, -0.46, 0.27 },
- { 0.06, -0.43, 0.25 },
- { 0.07, -0.39, 0.24 },
- { -0.11, -0.37, 0.28 },
- { -0.05, -0.47, 0.30 },
- { -0.05, -0.38, 0.37 },
- { -0.05, -0.29, 0.32 },
- { 0.04, -0.44, 0.35 },
- { 0.04, -0.33, 0.36 },
- { 0.04, -0.28, 0.26 },
- { 0.10, -0.37, 0.28 },
- { 0.04, -0.30, 0.23 },
- { 0.04, -0.29, 0.24 },
- { 0.01, -0.29, 0.24 },
- { -0.03, -0.30, 0.25 },
- { -0.05, -0.31, 0.22 },
- { -0.04, -0.35, 0.15 },
- { -0.03, -0.35, 0.13 },
- { -0.02, -0.35, 0.13 },
- { 0.04, -0.36, 0.14 },
- { 0.05, -0.34, 0.16 },
- { -0.05, 0.36, -0.16 },
- { -0.05, 0.36, -0.15 },
- { -0.07, 0.41, -0.22 },
- { 0.05, 0.33, -0.22 },
- { 0.06, 0.35, -0.21 },
- { 0.07, 0.41, -0.22 },
- { 0.04, 0.38, -0.14 },
- { 0.07, 0.40, -0.20 },
- { 0.07, 0.41, -0.21 },
- { 0.04, 0.38, -0.13 },
- { 0.01, 0.38, -0.13 },
- { -0.03, 0.38, -0.13 },
- { -0.07, 0.40, -0.21 },
- { -0.04, 0.33, -0.22 },
- { -0.07, 0.41, -0.22 },
- { -0.03, 0.32, -0.24 },
- { -0.02, 0.32, -0.24 },
- { 0.04, 0.33, -0.24 },
- { -0.10, 0.40, -0.27 },
- { -0.04, 0.36, -0.35 },
- { -0.04, 0.31, -0.25 },
- { -0.04, 0.47, -0.34 },
- { 0.05, 0.41, -0.36 },
- { 0.05, 0.32, -0.31 },
- { 0.05, 0.50, -0.28 },
- { 0.11, 0.40, -0.27 },
- { -0.06, 0.46, -0.24 },
- { -0.07, 0.42, -0.23 },
- { -0.05, 0.48, -0.25 },
- { -0.04, 0.48, -0.25 },
- { 0.00, 0.49, -0.26 },
- { 0.04, 0.48, -0.25 },
- { 0.05, 0.48, -0.25 },
- { -0.00, 0.49, -0.26 },
- { 0.07, 0.43, -0.21 },
- { 0.06, 0.46, -0.24 },
- { -0.11, 0.45, -0.18 },
- { -0.05, 0.44, -0.08 },
- { -0.05, 0.54, -0.14 },
- { -0.05, 0.52, -0.25 },
- { 0.04, 0.39, -0.11 },
- { 0.04, 0.50, -0.10 },
- { 0.04, 0.54, -0.20 },
- { 0.10, 0.45, -0.18 },
- { 0.07, 0.37, 0.22 },
- { 0.07, 0.37, 0.22 },
- { 0.07, 0.37, 0.21 },
- { -0.07, 0.37, 0.22 },
- { -0.07, 0.37, 0.22 },
- { -0.05, 0.33, 0.17 },
- { -0.07, 0.37, 0.22 },
- { -0.07, 0.36, 0.22 },
- { 0.07, 0.37, 0.22 },
- { 0.06, 0.31, 0.21 },
- { 0.07, 0.37, 0.22 },
- { -0.07, 0.37, 0.22 },
- { -0.10, 0.37, 0.27 },
- { -0.04, 0.32, 0.36 },
- { -0.04, 0.43, 0.34 },
- { -0.04, 0.27, 0.25 },
- { 0.05, 0.28, 0.31 },
- { 0.05, 0.38, 0.37 },
- { 0.05, 0.46, 0.29 },
- { 0.11, 0.37, 0.27 },
- { -0.05, 0.44, 0.26 },
- { -0.06, 0.43, 0.25 },
- { -0.04, 0.45, 0.26 },
- { -0.07, 0.39, 0.24 },
- { 0.00, 0.46, 0.26 },
- { 0.04, 0.45, 0.26 },
- { 0.05, 0.44, 0.25 },
- { -0.00, 0.46, 0.27 },
- { 0.06, 0.42, 0.25 },
- { 0.07, 0.40, 0.22 },
- { -0.11, 0.42, 0.19 },
- { -0.05, 0.48, 0.26 },
- { -0.05, 0.50, 0.15 },
- { -0.05, 0.41, 0.09 },
- { 0.04, 0.51, 0.21 },
- { 0.04, 0.46, 0.10 },
- { 0.04, 0.35, 0.12 },
- { 0.10, 0.42, 0.19 },
- { 0.04, 0.35, 0.15 },
- { 0.04, 0.35, 0.14 },
- { 0.01, 0.34, 0.13 },
- { -0.03, 0.35, 0.14 },
- { -0.05, 0.33, 0.16 },
- { -0.04, 0.30, 0.23 },
- { -0.03, 0.28, 0.24 },
- { -0.02, 0.28, 0.24 },
- { 0.04, 0.29, 0.25 },
- { 0.05, 0.30, 0.22 },
- { -0.05, -0.34, -0.21 },
- { -0.05, -0.34, -0.22 },
- { -0.07, -0.41, -0.22 },
- { 0.05, -0.37, -0.16 },
- { 0.06, -0.37, -0.17 },
- { 0.07, -0.41, -0.22 },
- { 0.04, -0.33, -0.23 },
- { 0.07, -0.40, -0.22 },
- { 0.07, -0.41, -0.23 },
- { 0.04, -0.32, -0.24 },
- { 0.01, -0.32, -0.24 },
- { -0.03, -0.33, -0.24 },
- { -0.07, -0.40, -0.21 },
- { -0.04, -0.38, -0.15 },
- { -0.07, -0.41, -0.22 },
- { -0.03, -0.38, -0.13 },
- { -0.02, -0.38, -0.13 },
- { 0.04, -0.39, -0.14 },
- { -0.10, -0.45, -0.19 },
- { -0.04, -0.50, -0.11 },
- { -0.04, -0.39, -0.12 },
- { -0.04, -0.54, -0.21 },
- { 0.05, -0.54, -0.15 },
- { 0.05, -0.44, -0.10 },
- { 0.05, -0.52, -0.26 },
- { 0.11, -0.45, -0.19 },
- { -0.06, -0.46, -0.26 },
- { -0.07, -0.43, -0.23 },
- { -0.05, -0.48, -0.26 },
- { -0.04, -0.48, -0.27 },
- { 0.00, -0.49, -0.27 },
- { 0.04, -0.48, -0.27 },
- { 0.05, -0.47, -0.27 },
- { -0.00, -0.49, -0.27 },
- { 0.07, -0.42, -0.24 },
- { 0.06, -0.46, -0.25 },
- { -0.11, -0.40, -0.28 },
- { -0.05, -0.32, -0.32 },
- { -0.05, -0.41, -0.37 },
- { -0.05, -0.50, -0.30 },
- { 0.04, -0.31, -0.26 },
- { 0.04, -0.35, -0.36 },
- { 0.04, -0.47, -0.35 },
- { 0.10, -0.40, -0.28 }
-};
-
-
-FaceStruct BoneIconFaces[NumBoneIconFaces] = {
-
- { 0, 1, 2 },
- { 3, 4, 5 },
- { 6, 3, 7 },
- { 1, 8, 9 },
- { 1, 0, 10 },
- { 4, 3, 11 },
- { 11, 3, 6 },
- { 11, 4, 11 },
- { 10, 8, 1 },
- { 12, 13, 14 },
- { 12, 15, 13 },
- { 13, 16, 17 },
- { 14, 17, 18 },
- { 17, 14, 13 },
- { 16, 13, 15 },
- { 19, 18, 17 },
- { 19, 17, 16 },
- { 12, 14, 20 },
- { 21, 12, 20 },
- { 14, 22, 20 },
- { 22, 14, 18 },
- { 12, 21, 23 },
- { 24, 18, 25 },
- { 18, 26, 25 },
- { 26, 18, 19 },
- { 18, 24, 27 },
- { 22, 18, 27 },
- { 26, 19, 28 },
- { 19, 29, 28 },
- { 30, 31, 32 },
- { 30, 32, 33 },
- { 32, 34, 35 },
- { 33, 35, 36 },
- { 34, 32, 31 },
- { 35, 33, 32 },
- { 37, 35, 34 },
- { 37, 36, 35 },
- { 31, 30, 21 },
- { 20, 31, 21 },
- { 31, 20, 22 },
- { 30, 23, 21 },
- { 34, 31, 24 },
- { 25, 34, 24 },
- { 34, 25, 37 },
- { 37, 25, 26 },
- { 31, 27, 24 },
- { 27, 31, 22 },
- { 28, 37, 26 },
- { 37, 28, 29 },
- { 38, 36, 37 },
- { 37, 2, 38 },
- { 2, 37, 29 },
- { 0, 2, 29 },
- { 36, 38, 39 },
- { 33, 36, 40 },
- { 40, 36, 39 },
- { 33, 40, 41 },
- { 33, 42, 30 },
- { 42, 33, 41 },
- { 5, 30, 42 },
- { 23, 30, 4 },
- { 30, 5, 4 },
- { 12, 23, 6 },
- { 7, 12, 6 },
- { 12, 7, 15 },
- { 43, 15, 7 },
- { 15, 43, 44 },
- { 16, 15, 45 },
- { 45, 15, 44 },
- { 16, 45, 46 },
- { 47, 16, 46 },
- { 16, 47, 19 },
- { 9, 19, 47 },
- { 9, 19, 9 },
- { 29, 19, 8 },
- { 19, 9, 8 },
- { 29, 10, 0 },
- { 6, 23, 11 },
- { 11, 23, 11 },
- { 11, 23, 4 },
- { 10, 29, 8 },
- { 48, 3, 49 },
- { 49, 3, 5 },
- { 50, 3, 48 },
- { 3, 50, 7 },
- { 51, 1, 9 },
- { 1, 51, 52 },
- { 53, 1, 52 },
- { 1, 53, 2 },
- { 56, 38, 2 },
- { 38, 54, 39 },
- { 38, 56, 55 },
- { 38, 55, 54 },
- { 2, 53, 56 },
- { 57, 39, 54 },
- { 39, 57, 40 },
- { 40, 58, 41 },
- { 57, 58, 40 },
- { 59, 41, 58 },
- { 41, 59, 42 },
- { 42, 59, 5 },
- { 49, 5, 59 },
- { 7, 50, 43 },
- { 43, 50, 60 },
- { 43, 60, 61 },
- { 43, 61, 44 },
- { 60, 50, 62 },
- { 63, 44, 61 },
- { 44, 63, 45 },
- { 45, 63, 64 },
- { 45, 64, 46 },
- { 65, 46, 64 },
- { 46, 65, 47 },
- { 47, 65, 9 },
- { 51, 9, 65 },
- { 66, 67, 68 },
- { 66, 69, 67 },
- { 67, 70, 71 },
- { 69, 72, 70 },
- { 71, 68, 67 },
- { 70, 67, 69 },
- { 73, 70, 72 },
- { 73, 71, 70 },
- { 74, 66, 75 },
- { 66, 74, 69 },
- { 69, 74, 76 },
- { 77, 69, 76 },
- { 69, 77, 72 },
- { 72, 78, 79 },
- { 80, 72, 79 },
- { 72, 80, 73 },
- { 78, 72, 81 },
- { 72, 77, 81 },
- { 82, 73, 83 },
- { 73, 80, 83 },
- { 84, 85, 86 },
- { 84, 86, 87 },
- { 85, 88, 89 },
- { 86, 89, 90 },
- { 89, 86, 85 },
- { 90, 87, 86 },
- { 91, 89, 88 },
- { 91, 90, 89 },
- { 75, 84, 87 },
- { 75, 87, 74 },
- { 87, 76, 74 },
- { 76, 87, 77 },
- { 87, 90, 78 },
- { 90, 79, 78 },
- { 79, 90, 91 },
- { 79, 91, 80 },
- { 81, 87, 78 },
- { 87, 81, 77 },
- { 91, 83, 80 },
- { 83, 91, 82 },
- { 84, 48, 85 },
- { 49, 85, 48 },
- { 48, 84, 50 },
- { 84, 75, 50 },
- { 51, 71, 73 },
- { 73, 52, 51 },
- { 52, 73, 53 },
- { 73, 82, 53 },
- { 56, 82, 91 },
- { 88, 54, 91 },
- { 91, 54, 55 },
- { 91, 55, 56 },
- { 56, 53, 82 },
- { 54, 88, 57 },
- { 88, 85, 58 },
- { 57, 88, 58 },
- { 58, 85, 59 },
- { 49, 59, 85 },
- { 66, 60, 75 },
- { 68, 60, 66 },
- { 68, 61, 60 },
- { 62, 75, 60 },
- { 75, 62, 50 },
- { 61, 68, 63 },
- { 64, 68, 71 },
- { 68, 64, 63 },
- { 64, 71, 65 },
- { 51, 65, 71 },
- { 92, 93, 94 },
- { 95, 96, 97 },
- { 98, 95, 99 },
- { 93, 100, 101 },
- { 93, 92, 102 },
- { 96, 95, 103 },
- { 103, 95, 98 },
- { 103, 96, 103 },
- { 102, 100, 93 },
- { 104, 105, 106 },
- { 104, 107, 105 },
- { 105, 108, 109 },
- { 106, 109, 110 },
- { 109, 106, 105 },
- { 108, 105, 107 },
- { 111, 110, 109 },
- { 111, 109, 108 },
- { 104, 106, 112 },
- { 113, 104, 112 },
- { 106, 114, 112 },
- { 114, 106, 110 },
- { 104, 113, 115 },
- { 116, 110, 117 },
- { 110, 118, 117 },
- { 118, 110, 111 },
- { 110, 116, 119 },
- { 114, 110, 119 },
- { 118, 111, 120 },
- { 111, 121, 120 },
- { 122, 123, 124 },
- { 122, 124, 125 },
- { 124, 126, 127 },
- { 125, 127, 128 },
- { 126, 124, 123 },
- { 127, 125, 124 },
- { 129, 127, 126 },
- { 129, 128, 127 },
- { 123, 122, 113 },
- { 112, 123, 113 },
- { 123, 112, 114 },
- { 122, 115, 113 },
- { 126, 123, 116 },
- { 117, 126, 116 },
- { 126, 117, 129 },
- { 129, 117, 118 },
- { 123, 119, 116 },
- { 119, 123, 114 },
- { 120, 129, 118 },
- { 129, 120, 121 },
- { 130, 128, 129 },
- { 129, 94, 130 },
- { 94, 129, 121 },
- { 92, 94, 121 },
- { 128, 130, 131 },
- { 125, 128, 132 },
- { 132, 128, 131 },
- { 125, 132, 133 },
- { 125, 134, 122 },
- { 134, 125, 133 },
- { 97, 122, 134 },
- { 115, 122, 96 },
- { 122, 97, 96 },
- { 104, 115, 98 },
- { 99, 104, 98 },
- { 104, 99, 107 },
- { 135, 107, 99 },
- { 107, 135, 136 },
- { 108, 107, 137 },
- { 137, 107, 136 },
- { 108, 137, 138 },
- { 139, 108, 138 },
- { 108, 139, 111 },
- { 101, 111, 139 },
- { 101, 111, 101 },
- { 121, 111, 100 },
- { 111, 101, 100 },
- { 121, 102, 92 },
- { 98, 115, 103 },
- { 103, 115, 103 },
- { 103, 115, 96 },
- { 102, 121, 100 },
- { 140, 95, 141 },
- { 141, 95, 97 },
- { 142, 95, 140 },
- { 95, 142, 99 },
- { 143, 93, 101 },
- { 93, 143, 144 },
- { 145, 93, 144 },
- { 93, 145, 94 },
- { 148, 130, 94 },
- { 130, 146, 131 },
- { 130, 148, 147 },
- { 130, 147, 146 },
- { 94, 145, 148 },
- { 149, 131, 146 },
- { 131, 149, 132 },
- { 132, 150, 133 },
- { 149, 150, 132 },
- { 151, 133, 150 },
- { 133, 151, 134 },
- { 134, 151, 97 },
- { 141, 97, 151 },
- { 99, 142, 135 },
- { 135, 142, 152 },
- { 135, 152, 153 },
- { 135, 153, 136 },
- { 152, 142, 154 },
- { 155, 136, 153 },
- { 136, 155, 137 },
- { 137, 155, 156 },
- { 137, 156, 138 },
- { 157, 138, 156 },
- { 138, 157, 139 },
- { 139, 157, 101 },
- { 143, 101, 157 },
- { 158, 159, 160 },
- { 158, 161, 159 },
- { 159, 162, 163 },
- { 161, 164, 162 },
- { 163, 160, 159 },
- { 162, 159, 161 },
- { 165, 162, 164 },
- { 165, 163, 162 },
- { 166, 158, 167 },
- { 158, 166, 161 },
- { 161, 166, 168 },
- { 169, 161, 168 },
- { 161, 169, 164 },
- { 164, 170, 171 },
- { 172, 164, 171 },
- { 164, 172, 165 },
- { 170, 164, 173 },
- { 164, 169, 173 },
- { 174, 165, 175 },
- { 165, 172, 175 },
- { 176, 177, 178 },
- { 176, 178, 179 },
- { 177, 180, 181 },
- { 178, 181, 182 },
- { 181, 178, 177 },
- { 182, 179, 178 },
- { 183, 181, 180 },
- { 183, 182, 181 },
- { 167, 176, 179 },
- { 167, 179, 166 },
- { 179, 168, 166 },
- { 168, 179, 169 },
- { 179, 182, 170 },
- { 182, 171, 170 },
- { 171, 182, 183 },
- { 171, 183, 172 },
- { 173, 179, 170 },
- { 179, 173, 169 },
- { 183, 175, 172 },
- { 175, 183, 174 },
- { 176, 140, 177 },
- { 141, 177, 140 },
- { 140, 176, 142 },
- { 176, 167, 142 },
- { 143, 163, 165 },
- { 165, 144, 143 },
- { 144, 165, 145 },
- { 165, 174, 145 },
- { 148, 174, 183 },
- { 180, 146, 183 },
- { 183, 146, 147 },
- { 183, 147, 148 },
- { 148, 145, 174 },
- { 146, 180, 149 },
- { 180, 177, 150 },
- { 149, 180, 150 },
- { 150, 177, 151 },
- { 141, 151, 177 },
- { 158, 152, 167 },
- { 160, 152, 158 },
- { 160, 153, 152 },
- { 154, 167, 152 },
- { 167, 154, 142 },
- { 153, 160, 155 },
- { 156, 160, 163 },
- { 160, 156, 155 },
- { 156, 163, 157 },
- { 143, 157, 163 }
-};
\ No newline at end of file
diff --git a/Generals/Code/Tools/WW3D/max2w3d/boneicon.h b/Generals/Code/Tools/WW3D/max2w3d/boneicon.h
deleted file mode 100644
index 81d8afbb0b9..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/boneicon.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/* $Header: /Commando/Code/Tools/max2w3d/boneicon.h 5 10/28/97 6:08p Greg_h $ */
-/***********************************************************************************************
- *** Confidential - Westwood Studios ***
- ***********************************************************************************************
- * *
- * Project Name : Commando Tools - WWSkin *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/boneicon.h $*
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 10/21/97 2:06p $*
- * *
- * $Revision:: 5 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#ifndef BONEICON_H
-#define BONEICON_H
-
-struct VertexStruct
-{
- float X,Y,Z;
-};
-
-struct FaceStruct
-{
- int V0,V1,V2;
-};
-
-extern const int NumBoneIconVerts;
-extern const int NumBoneIconFaces;
-extern VertexStruct BoneIconVerts[];
-extern FaceStruct BoneIconFaces[];
-
-#endif
diff --git a/Generals/Code/Tools/WW3D/max2w3d/bpick.cpp b/Generals/Code/Tools/WW3D/max2w3d/bpick.cpp
deleted file mode 100644
index d1ed8630cdf..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/bpick.cpp
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/* $Header: /Commando/Code/Tools/max2w3d/bpick.cpp 7 1/04/01 11:12a Greg_h $ */
-/***********************************************************************************************
- *** Confidential - Westwood Studios ***
- ***********************************************************************************************
- * *
- * Project Name : Commando Tools - WWSkin *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/bpick.cpp $*
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 1/04/01 11:12a $*
- * *
- * $Revision:: 7 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * BonePickerClass::Filter -- determine whether the passed node is suitable *
- * BonePickerClass::HitTest -- MAX HitTest method *
- * BonePickerClass::Pick -- MAX Pick method *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#include "bpick.h"
-#include "dllmain.h"
-#include "resource.h"
-
-
-/*
-** Global instance of a bone picker :-)
-*/
-BonePickerClass TheBonePicker;
-
-
-/***********************************************************************************************
- * BonePickerClass::Filter -- determine whether the passed node is suitable *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/26/1997 GH : Created. *
- *=============================================================================================*/
-BOOL BonePickerClass::Filter(INode *node)
-{
- if (BoneList == NULL) {
- ObjectState os = node->EvalWorldState(0);
- if (os.obj) {
- return TRUE;
- }
-
- } else {
- for (int i=0; iCount(); i++) {
- if ((*BoneList)[i] == node) return TRUE;
- }
- }
-
- return FALSE;
-}
-
-/***********************************************************************************************
- * BonePickerClass::HitTest -- MAX HitTest method *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/26/1997 GH : Created. *
- *=============================================================================================*/
-BOOL BonePickerClass::HitTest(IObjParam *ip,HWND hwnd,ViewExp *vpt,IPoint2 m,int flags)
-{
- if (ip->PickNode(hwnd,m,GetFilter())) {
- return TRUE;
- } else {
- return FALSE;
- }
-}
-
-/***********************************************************************************************
- * BonePickerClass::Pick -- MAX Pick method *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/26/1997 GH : Created. *
- *=============================================================================================*/
-BOOL BonePickerClass::Pick(IObjParam *ip,ViewExp *vpt)
-{
- INode *node = vpt->GetClosestHit();
-
- if (node) {
-
- /*
- ** Tell the "owning" skin modifier about the
- ** bone which was picked.
- */
- assert(User);
- User->User_Picked_Bone(node);
- User = NULL;
- BoneList = NULL;
- }
-
- return TRUE;
-}
-
-BOOL BonePickerClass::filter(INode * inode)
-{
- return Filter(inode);
-}
-
-void BonePickerClass::proc(INodeTab & nodetab)
-{
- assert(User != NULL);
- User->User_Picked_Bones(nodetab);
- User = NULL;
- BoneList = NULL;
-}
-
-TCHAR * BonePickerClass::dialogTitle(void)
-{
- return Get_String(IDS_PICK_BONE_DIALOG_TITLE);
-}
-
-TCHAR * BonePickerClass::buttonText(void)
-{
- return Get_String(IDS_PICK_BONE_BUTTON_TEXT);
-}
diff --git a/Generals/Code/Tools/WW3D/max2w3d/bpick.h b/Generals/Code/Tools/WW3D/max2w3d/bpick.h
deleted file mode 100644
index ca6078c4a87..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/bpick.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/* $Header: /Commando/Code/Tools/max2w3d/bpick.h 6 10/28/97 6:08p Greg_h $ */
-/***********************************************************************************************
- *** Confidential - Westwood Studios ***
- ***********************************************************************************************
- * *
- * Project Name : Commando Tools - WWSkin *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/bpick.h $*
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 10/21/97 2:05p $*
- * *
- * $Revision:: 6 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#ifndef BPICK_H
-#define BPICK_H
-
-#include "max.h"
-//#include "dllmain.h"
-//#include "resource.h"
-
-
-/*
-** To use the Bone picking class, you should inherit from this class
-** and implement the User_Picked... functions.
-*/
-class BonePickerUserClass
-{
-public:
- virtual void User_Picked_Bone(INode * node) = 0;
- virtual void User_Picked_Bones(INodeTab & nodetab) = 0;
-};
-
-
-/*
-** BonePickerClass
-** Uses Max's interface to let the user pick bones out of the scene
-** or by using a dialog box to pick by name.
-*/
-class BonePickerClass : public PickNodeCallback, public PickModeCallback, public HitByNameDlgCallback
-{
-public:
-
- BonePickerClass(void) : User(NULL), BoneList(NULL), SinglePick(FALSE) {}
-
- /*
- ** Tell this class who is using it and optionally the list
- ** of bones to allow the user to select from.
- ** Call this before giving this class to MAX...
- */
- void Set_User(BonePickerUserClass * user,int singlepick = FALSE, INodeTab * bonelist = NULL) { User = user; SinglePick = singlepick; BoneList = bonelist; }
-
- /*
- ** From BonePickNodeCallback:
- */
- BOOL Filter(INode *node);
-
- /*
- ** From BonePickModeCallback:
- */
- BOOL HitTest(IObjParam *ip,HWND hWnd,ViewExp *vpt,IPoint2 m,int flags);
- BOOL Pick(IObjParam *ip,ViewExp *vpt);
-
- void EnterMode(IObjParam *ip) { }
- void ExitMode(IObjParam *ip) { }
-
- PickNodeCallback * GetFilter() {return this;}
- BOOL RightClick(IObjParam *ip,ViewExp *vpt) { return TRUE; }
-
- /*
- ** From HitByNameDlgCallback
- */
- virtual TCHAR * dialogTitle(void);
- virtual TCHAR * buttonText(void);
- virtual BOOL singleSelect(void) { return SinglePick; }
- virtual BOOL useFilter(void) { return TRUE; }
- virtual BOOL useProc(void) { return TRUE; }
- virtual BOOL doCustomHilite(void) { return FALSE; }
- virtual BOOL filter(INode * inode);
- virtual void proc(INodeTab & nodeTab);
-
-protected:
-
- /*
- ** The bone picker will pass the bones on to the "user" of
- ** the class.
- */
- BonePickerUserClass * User;
-
- /*
- ** List of bones that the user is being allowed to pick from.
- ** If this is NULL, then the user can pick any bone
- */
- INodeTab * BoneList;
-
- /*
- ** Flag for whether to allow multiple selection or not
- */
- int SinglePick;
-};
-
-extern BonePickerClass TheBonePicker;
-
-
-#endif
diff --git a/Generals/Code/Tools/WW3D/max2w3d/colboxsave.cpp b/Generals/Code/Tools/WW3D/max2w3d/colboxsave.cpp
deleted file mode 100644
index 80b2f8ac1b5..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/colboxsave.cpp
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Max2W3d *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/colboxsave.cpp $*
- * *
- * Author:: Greg Hjelstrom *
- * *
- * $Modtime:: 12/06/00 4:06p $*
- * *
- * $Revision:: 7 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#include "colboxsave.h"
-#include "w3d_file.h"
-#include "util.h"
-#include "w3dappdata.h"
-#include "errclass.h"
-
-
-CollisionBoxSaveClass::CollisionBoxSaveClass
-(
- char * mesh_name,
- char * container_name,
- INode * inode,
- Matrix3 & exportspace,
- TimeValue curtime,
- Progress_Meter_Class & meter
-)
-{
- //////////////////////////////////////////////////////////////////////
- // wrestle the mesh out of 3dsMAX
- //////////////////////////////////////////////////////////////////////
- Object * obj = inode->EvalWorldState(curtime).obj;
- TriObject * tri = (TriObject *)obj->ConvertToType(curtime, triObjectClassID);
- Mesh mesh = tri->mesh;
- DWORD wirecolor = inode->GetWireColor();
-
- if (mesh.getNumVerts() == 0) {
- throw ErrorClass("Mesh %s has no vertices!\n",mesh_name);
- }
-
- //////////////////////////////////////////////////////////////////////
- // Generate the AABox or OBBox data.
- //////////////////////////////////////////////////////////////////////
- memset(&BoxData,0,sizeof(BoxData));
-
- BoxData.Version = W3D_BOX_CURRENT_VERSION;
- if ((container_name != NULL) && (strlen(container_name) > 0)) {
- strcpy(BoxData.Name,container_name);
- strcat(BoxData.Name,".");
- }
- strcat(BoxData.Name,mesh_name);
-
- BoxData.Attributes = 0;
- if (Is_Collision_AABox(inode)) {
- BoxData.Attributes |= W3D_BOX_ATTRIBUTE_ALIGNED;
- } else {
- BoxData.Attributes |= W3D_BOX_ATTRIBUTE_ORIENTED;
- }
- if (Is_Physical_Collision(inode)) {
- BoxData.Attributes |= W3D_BOX_ATTRIBTUE_COLLISION_TYPE_PHYSICAL;
- }
- if (Is_Projectile_Collision(inode)) {
- BoxData.Attributes |= W3D_BOX_ATTRIBTUE_COLLISION_TYPE_PROJECTILE;
- }
- if (Is_Vis_Collision(inode)) {
- BoxData.Attributes |= W3D_BOX_ATTRIBTUE_COLLISION_TYPE_VIS;
- }
- if (Is_Camera_Collision(inode)) {
- BoxData.Attributes |= W3D_BOX_ATTRIBTUE_COLLISION_TYPE_CAMERA;
- }
- if (Is_Vehicle_Collision(inode)) {
- BoxData.Attributes |= W3D_BOX_ATTRIBTUE_COLLISION_TYPE_VEHICLE;
- }
-
- BoxData.Color.R = GetRValue(wirecolor);
- BoxData.Color.G = GetGValue(wirecolor);
- BoxData.Color.B = GetBValue(wirecolor);
-
- // if this is an axis-aligned box, then use the world coord system
- if (Is_Collision_AABox(inode)) {
- exportspace.NoRot();
- }
-
- // Transform the mesh into the desired coordinate system
- Matrix3 node_matrix = inode->GetObjectTM(curtime);
- Matrix3 offset_matrix = node_matrix * Inverse(exportspace);
- int ivert;
-
- for (ivert = 0; ivert < mesh.getNumVerts (); ++ivert) {
- mesh.verts[ivert] = mesh.verts[ivert] * offset_matrix;
- }
-
- // Find the center and extent of the box.
- Point3 min_point = mesh.verts[0];
- Point3 max_point = mesh.verts[1];
-
- for (ivert=0; ivert < mesh.getNumVerts(); ++ivert) {
- if (mesh.verts[ivert].x < min_point.x) min_point.x = mesh.verts[ivert].x;
- if (mesh.verts[ivert].y < min_point.y) min_point.y = mesh.verts[ivert].y;
- if (mesh.verts[ivert].z < min_point.z) min_point.z = mesh.verts[ivert].z;
-
- if (mesh.verts[ivert].x > max_point.x) max_point.x = mesh.verts[ivert].x;
- if (mesh.verts[ivert].y > max_point.y) max_point.y = mesh.verts[ivert].y;
- if (mesh.verts[ivert].z > max_point.z) max_point.z = mesh.verts[ivert].z;
- }
-
- Point3 center = (max_point + min_point) / 2.0f;
- Point3 extent = (max_point - min_point) / 2.0f;
-
- BoxData.Center.X = center.x;
- BoxData.Center.Y = center.y;
- BoxData.Center.Z = center.z;
-
- BoxData.Extent.X = extent.x;
- BoxData.Extent.Y = extent.y;
- BoxData.Extent.Z = extent.z;
-}
-
-
-
-int CollisionBoxSaveClass::Write_To_File(ChunkSaveClass & csave)
-{
- csave.Begin_Chunk(W3D_CHUNK_BOX);
- csave.Write(&BoxData,sizeof(BoxData));
- csave.End_Chunk();
- return 0;
-}
-
-
-
\ No newline at end of file
diff --git a/Generals/Code/Tools/WW3D/max2w3d/colboxsave.h b/Generals/Code/Tools/WW3D/max2w3d/colboxsave.h
deleted file mode 100644
index a9f05c3ebdb..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/colboxsave.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Max2W3d *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/colboxsave.h $*
- * *
- * Author:: Greg Hjelstrom *
- * *
- * $Modtime:: 3/16/99 8:37a $*
- * *
- * $Revision:: 2 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#if defined(_MSC_VER)
-#pragma once
-#endif
-
-#ifndef COLBOXSAVE_H
-#define COLBOXSAVE_H
-
-#include
-#include "w3d_file.h"
-#include "chunkio.h"
-#include "PROGRESS.H"
-
-
-/*******************************************************************************************
-**
-** CollisionBoxSaveClass - Create an AABox or an OBBox from a Max mesh (typically the
-** artist should use a 'box' to generate this. In any case, we're just using the bounding
-** box).
-**
-*******************************************************************************************/
-class CollisionBoxSaveClass
-{
-public:
-
- enum {
- EX_UNKNOWN = 0, // exception error codes
- EX_CANCEL = 1
- };
-
- CollisionBoxSaveClass( char * mesh_name,
- char * container_name,
- INode * inode,
- Matrix3 & exportspace,
- TimeValue curtime,
- Progress_Meter_Class & meter);
-
- int Write_To_File(ChunkSaveClass & csave);
-
-private:
-
- W3dBoxStruct BoxData; // contains same information as the W3dOBBoxStruct
-
-};
-
-
-
-#endif //COLBOXSAVE_H
\ No newline at end of file
diff --git a/Generals/Code/Tools/WW3D/max2w3d/dazzlesave.cpp b/Generals/Code/Tools/WW3D/max2w3d/dazzlesave.cpp
deleted file mode 100644
index 9f95b876a29..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/dazzlesave.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Max2W3D *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/dazzlesave.cpp $*
- * *
- * Original Author:: Greg Hjelstrom *
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 9/21/00 4:14p $*
- * *
- * $Revision:: 1 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#include "dazzlesave.h"
-#include "w3d_file.h"
-#include "util.h"
-#include "w3dappdata.h"
-#include "errclass.h"
-
-
-DazzleSaveClass::DazzleSaveClass
-(
- char * mesh_name,
- char * container_name,
- INode * inode,
- Matrix3 & exportspace,
- TimeValue curtime,
- Progress_Meter_Class & meter
-)
-{
- assert(mesh_name != NULL);
- assert(container_name != NULL);
-
- /*
- ** Set up the render object name
- */
- memset(&W3DName,0,sizeof(W3DName));
- if ((container_name != NULL) && (strlen(container_name) > 0)) {
- strcpy(W3DName,container_name);
- strcat(W3DName,".");
- }
- strcat(W3DName,mesh_name);
-
- /*
- ** Dig the dazzle-type out of the appropriate App-Data chunk on
- ** the INode.
- */
- W3DDazzleAppDataStruct * dazzle_data = W3DDazzleAppDataStruct::Get_App_Data(inode);
- strncpy(DazzleType,dazzle_data->DazzleType,sizeof(DazzleType));
-}
-
-
-
-int DazzleSaveClass::Write_To_File(ChunkSaveClass & csave)
-{
- csave.Begin_Chunk(W3D_CHUNK_DAZZLE);
-
- csave.Begin_Chunk(W3D_CHUNK_DAZZLE_NAME);
- csave.Write(W3DName,strlen(W3DName) + 1);
- csave.End_Chunk();
-
- csave.Begin_Chunk(W3D_CHUNK_DAZZLE_TYPENAME);
- csave.Write(DazzleType,strlen(DazzleType) + 1);
- csave.End_Chunk();
-
- csave.End_Chunk();
- return 0;
-}
-
-
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/dazzlesave.h b/Generals/Code/Tools/WW3D/max2w3d/dazzlesave.h
deleted file mode 100644
index 943fb89454c..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/dazzlesave.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Max2W3D *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/dazzlesave.h $*
- * *
- * Original Author:: Greg Hjelstrom *
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 9/21/00 4:09p $*
- * *
- * $Revision:: 1 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#if defined(_MSC_VER)
-#pragma once
-#endif
-
-#ifndef DAZZLESAVE_H
-#define DAZZLESAVE_H
-
-#include
-#include "w3d_file.h"
-#include "chunkio.h"
-#include "PROGRESS.H"
-
-
-/*******************************************************************************************
-**
-** DazzleSaveClass - Create a Dazzle definition from an INode. Basically, we just save
-** the transform and the dazzle type that the user has selected.
-**
-*******************************************************************************************/
-class DazzleSaveClass
-{
-public:
-
- enum {
- EX_UNKNOWN = 0, // exception error codes
- EX_CANCEL = 1
- };
-
- DazzleSaveClass( char * mesh_name,
- char * container_name,
- INode * inode,
- Matrix3 & exportspace,
- TimeValue curtime,
- Progress_Meter_Class & meter);
-
- int Write_To_File(ChunkSaveClass & csave);
-
-private:
-
- char W3DName[128];
- char DazzleType[128];
-
-};
-
-
-
-
-
-
-
-#endif //DAZZLESAVE_H
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/dllmain.cpp b/Generals/Code/Tools/WW3D/max2w3d/dllmain.cpp
deleted file mode 100644
index e992552b212..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/dllmain.cpp
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/* $Header: /Commando/Code/Tools/max2w3d/dllmain.cpp 8 7/24/01 5:11p Moumine_ballo $ */
-/***********************************************************************************************
- *** Confidential - Westwood Studios ***
- ***********************************************************************************************
- * *
- * Project Name : Commando / G *
- * *
- * File Name : DLLMAIN.CPP *
- * *
- * Programmer : Greg Hjelstrom *
- * *
- * Start Date : 06/09/97 *
- * *
- * Last Update : June 9, 1997 [GH] *
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * DllMain -- Entry point for the dll *
- * LibDescription -- Returns description of this library *
- * LibNumberClasses -- Returns number of classes in this library *
- * LibClassDesc -- Returns a ClassDesc for the specified class *
- * LibVersion -- Returns the version number of this library *
- * GetString -- Gets a string out of the resources *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#include
-#include
-#include "dllmain.h"
-#include "w3ddesc.h"
-#include "w3dexp.h"
-#include "w3dutil.h"
-#include "skin.h"
-#include "gamemtl.h"
-#include "gamemaps.h"
-#include "MeshDeform.h"
-#include "AlphaModifier.h"
-#include "gridsnapmodifier.h"
-
-#include "resource.h"
-
-#define DLLEXPORT __declspec(dllexport)
-
-
-/*****************************************************************************
-* Globals
-*****************************************************************************/
-
-HINSTANCE AppInstance = NULL;
-static int ControlsInit = FALSE;
-static W3dClassDesc W3d_Export_Class_Descriptor;
-
-
-
-/***********************************************************************************************
- * DllMain -- Entry point for the dll *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 06/09/1997 GH : Created. *
- *=============================================================================================*/
-BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG /*fdwReason*/,LPVOID /*lpvReserved*/)
-{
- AppInstance = hinstDLL;
-
- if ( !ControlsInit )
- {
- ControlsInit = TRUE;
- InitCustomControls(AppInstance);
- InitCommonControls();
- }
-
- return TRUE;
-}
-
-
-/***********************************************************************************************
- * LibDescription -- Returns description of this library *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 06/09/1997 GH : Created. *
- *=============================================================================================*/
-DLLEXPORT const TCHAR * LibDescription()
-{
- return Get_String(IDS_LIB_DESCRIPTION);
-}
-
-/***********************************************************************************************
- * LibNumberClasses -- Returns number of classes in this library *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 06/09/1997 GH : Created. *
- *=============================================================================================*/
-DLLEXPORT int LibNumberClasses()
-{
- return 9; //Moumine 7/24/2001 4:38:27 PM was 10. Removed Mesh_Deformation(#6)
-}
-
-
-/***********************************************************************************************
- * LibClassDesc -- Returns a ClassDesc for the specified class *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 06/09/1997 GH : Created. *
- *=============================================================================================*/
-DLLEXPORT ClassDesc * LibClassDesc(int i)
-{
- switch(i)
- {
- case 0: return & W3d_Export_Class_Descriptor; break;
- case 1: return Get_W3D_Utility_Desc(); break;
- case 2: return Get_Skin_Obj_Desc(); break;
- case 3: return Get_Skin_Mod_Desc(); break;
- case 4: return Get_Game_Material_Desc(); break;
- case 5: return Get_Game_Maps_Desc(); break;
- case 6: return Get_PS2_Game_Material_Desc(); break;
- case 7: return Get_PS2_Material_Conversion(); break;
- case 8: return Get_Alpha_Desc(); break;
- //case 6: return Get_Mesh_Deform_Desc(); break;
- //Moumine 7/24/2001 4:33:52 PM Removed #6 and shifted up instead of returning NULL
- // NULL causes a crash in "File->Summary info->Plug-in ifo..."
- default: return NULL; break;
- }
-}
-
-
-/***********************************************************************************************
- * LibVersion -- Returns the version number of this library *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 06/09/1997 GH : Created. *
- *=============================================================================================*/
-DLLEXPORT ULONG LibVersion()
-{
- return VERSION_3DSMAX;
-}
-
-
-/***********************************************************************************************
- * Get_String -- Gets a string out of the resources *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 06/09/1997 GH : Created. *
- *=============================================================================================*/
-TCHAR * Get_String( int id )
-{
- static TCHAR buf[256];
- if (AppInstance)
- return LoadString(AppInstance, id, buf, sizeof(buf)) ? buf : NULL;
- return NULL;
-}
-
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/dllmain.h b/Generals/Code/Tools/WW3D/max2w3d/dllmain.h
deleted file mode 100644
index fd94fdefe03..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/dllmain.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/* $Header: /Commando/Code/Tools/max2w3d/dllmain.h 4 10/28/97 6:08p Greg_h $ */
-/***********************************************************************************************
- *** Confidential - Westwood Studios ***
- ***********************************************************************************************
- * *
- * Project Name : Commando / G *
- * *
- * File Name : DLLMAIN.H *
- * *
- * Programmer : Greg Hjelstrom *
- * *
- * Start Date : 06/09/97 *
- * *
- * Last Update : June 9, 1997 [GH] *
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#ifndef DLLMAIN_H
-#define DLLMAIN_H
-
-#include
-
-extern HINSTANCE AppInstance;
-
-#define MAX_STRING_LENGTH 256
-#define MAX_PATH_LENGTH _MAX_PATH
-
-TCHAR * Get_String(int id);
-
-#endif /*DLLMAIN_H*/
\ No newline at end of file
diff --git a/Generals/Code/Tools/WW3D/max2w3d/exportlog.cpp b/Generals/Code/Tools/WW3D/max2w3d/exportlog.cpp
deleted file mode 100644
index 6c90bda55be..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/exportlog.cpp
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Max2W3d *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/exportlog.cpp $*
- * *
- * Original Author:: Greg Hjelstrom *
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 11/07/00 3:16p $*
- * *
- * $Revision:: 3 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * ExportLog::Init -- Initialize the export logging system *
- * ExportLog::Shutdown -- Shutdown the export logging system *
- * ExportLog::printf -- Print a string to the log window *
- * ExportLog::rprintf -- Print a string over the last line printed *
- * ExportLog::updatebar -- Set the position of the progress bar *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#include "exportlog.h"
-#include "logdlg.h"
-#include
-
-
-/*
-** Static variables
-*/
-LogDataDialogClass * _LogDialog = NULL;
-
-
-/*
-**
-** ExportLog implementation. Note, this is a class which only contains static functions.
-**
-*/
-
-
-/***********************************************************************************************
- * ExportLog::Init -- Initialize the export logging system *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/30/2000 gth : Created. *
- *=============================================================================================*/
-void ExportLog::Init(HWND parent)
-{
- assert(_LogDialog == NULL);
- _LogDialog = new LogDataDialogClass(parent);
-}
-
-
-/***********************************************************************************************
- * ExportLog::Shutdown -- Shutdown the export logging system *
- * *
- * INPUT: *
- * wait_for_ok - should we wait for the user to press OK on the dialog? *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/30/2000 gth : Created. *
- *=============================================================================================*/
-void ExportLog::Shutdown(bool wait_for_ok)
-{
- if (_LogDialog != NULL) {
-
- if (wait_for_ok) {
- _LogDialog->Wait_OK();
- }
-
- delete _LogDialog;
- _LogDialog = NULL;
- }
-}
-
-
-/***********************************************************************************************
- * ExportLog::printf -- Print a string to the log window *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/30/2000 gth : Created. *
- *=============================================================================================*/
-void ExportLog::printf(const char * format, ...)
-{
- if (_LogDialog != NULL) {
- va_list arguments;
- va_start(arguments, format);
- _LogDialog->printf(format,arguments);
- }
-}
-
-
-/***********************************************************************************************
- * ExportLog::rprintf -- Print a string over the last line printed *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/30/2000 gth : Created. *
- *=============================================================================================*/
-void ExportLog::rprintf(const char * format, ...)
-{
- if (_LogDialog != NULL) {
- va_list arguments;
- va_start(arguments, format);
- _LogDialog->rprintf(format,arguments);
- }
-}
-
-
-/***********************************************************************************************
- * ExportLog::updatebar -- Set the position of the progress bar *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/30/2000 gth : Created. *
- *=============================================================================================*/
-void ExportLog::updatebar(float position, float total)
-{
- if (_LogDialog != NULL) {
- _LogDialog->updatebar(position,total);
- }
-}
-
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/exportlog.h b/Generals/Code/Tools/WW3D/max2w3d/exportlog.h
deleted file mode 100644
index 4c9e8797c52..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/exportlog.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Max2W3d *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/exportlog.h $*
- * *
- * Original Author:: Greg Hjelstrom *
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 11/07/00 3:18p $*
- * *
- * $Revision:: 3 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#ifndef EXPORTLOG_H
-#define EXPORTLOG_H
-
-#include
-
-/**
-** ExportLog
-** This is an interface to the export log dialog.
-*/
-class ExportLog
-{
-public:
- static void Init(HWND parent);
- static void Shutdown(bool wait_for_ok);
-
- static void printf(const char *, ...);
- static void rprintf(const char *, ...);
- static void updatebar(float position, float total);
-};
-
-
-#endif //EXPORTLOG_H
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/floaterdialog.cpp b/Generals/Code/Tools/WW3D/max2w3d/floaterdialog.cpp
deleted file mode 100644
index dd0518116b6..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/floaterdialog.cpp
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Max2W3d *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/floaterdialog.cpp $*
- * *
- * Original Author:: Greg Hjelstrom *
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 10/30/00 2:58p $*
- * *
- * $Revision:: 2 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * FloaterDialogClass::FloaterDialogClass -- Constructor *
- * FloaterDialogClass::~FloaterDialogClass -- Destructor *
- * FloaterDialogClass::Is_Created -- test whether the floater has already been created *
- * FloaterDialogClass::Create -- create the window *
- * FloaterDialogClass::Dialog_Proc -- Dialog Proc for the floater *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#include "floaterdialog.h"
-#include "dllmain.h"
-#include "resource.h"
-#include
-
-
-/**********************************************************************************************
-**
-** FloaterDialogClass Implementation
-**
-**********************************************************************************************/
-
-BOOL CALLBACK _floater_dialog_proc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)
-{
- if (message == WM_INITDIALOG) {
- FloaterDialogClass * floater = (FloaterDialogClass *)lParam;
- ::SetProp(hwnd,"FloaterDialogClass",(HANDLE)floater);
- }
-
- FloaterDialogClass * floater = (FloaterDialogClass *)::GetProp(hwnd,"FloaterDialogClass");
-
- if (message == WM_DESTROY) {
- ::RemoveProp(hwnd,"FloaterDialogClass");
- }
-
-
- if (floater) {
- return floater->Dialog_Proc(hwnd,message,wParam,lParam);
- } else {
- return FALSE;
- }
-}
-
-
-/***********************************************************************************************
- * FloaterDialogClass::FloaterDialogClass -- Constructor *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- *=============================================================================================*/
-FloaterDialogClass::FloaterDialogClass(void) :
- Hwnd(NULL),
- ChildDialogTemplateID(-1),
- ChildDialogProc(NULL)
-{
-}
-
-
-/***********************************************************************************************
- * FloaterDialogClass::~FloaterDialogClass -- Destructor *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- *=============================================================================================*/
-FloaterDialogClass::~FloaterDialogClass(void)
-{
- if (Hwnd != NULL) {
- ::DestroyWindow(Hwnd);
- }
-}
-
-
-/***********************************************************************************************
- * FloaterDialogClass::Is_Created -- test whether the floater has already been created *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/11/2000 gth : Created. *
- *=============================================================================================*/
-bool FloaterDialogClass::Is_Created(void)
-{
- return (Hwnd != NULL);
-}
-
-
-/***********************************************************************************************
- * FloaterDialogClass::Create -- create the window *
- * *
- * This function will return automatically if the floater has been created already. *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/11/2000 gth : Created. *
- *=============================================================================================*/
-void FloaterDialogClass::Create(Interface * ip, int child_dlg_id, DLGPROC child_dlg_proc)
-{
- /*
- ** Don't create multiple ones
- */
- if (Is_Created()) {
- return;
- }
-
- /*
- ** Copy down the data needed to create the child window later
- */
- ChildDialogTemplateID = child_dlg_id;
- ChildDialogProc = child_dlg_proc;
-
-
- /*
- ** Create the dialog box
- */
- Hwnd = CreateDialogParam(
- AppInstance,
- MAKEINTRESOURCE(IDD_W3DUTILITY_FLOATER_DIALOG),
- ::GetCOREInterface()->GetMAXHWnd(),
- (DLGPROC) _floater_dialog_proc,
- (LPARAM) this
- );
- ::GetCOREInterface()->RegisterDlgWnd(Hwnd);
-}
-
-
-
-/***********************************************************************************************
- * FloaterDialogClass::Dialog_Proc -- Dialog Proc for the floater *
- * *
- * The only thing we need to do here is to create the child dialog and resize ourselves to *
- * contain it. *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/11/2000 gth : Created. *
- *=============================================================================================*/
-bool FloaterDialogClass::Dialog_Proc(HWND hWnd,UINT message,WPARAM wParam,LPARAM)
-{
- switch (message ) {
-
- case WM_INITDIALOG:
- {
- HWND childhwnd = CreateDialogParam(
- AppInstance,
- MAKEINTRESOURCE(ChildDialogTemplateID),
- hWnd,
- ChildDialogProc,
- 0
- );
- if (childhwnd!= NULL) {
- RECT rect;
- LONG style = ::GetWindowLong(hWnd,GWL_STYLE);
- ::GetWindowRect(childhwnd,&rect);
- ::AdjustWindowRect(&rect,style,FALSE);
- ::SetWindowPos(hWnd,NULL,0,0,rect.right - rect.left,rect.bottom - rect.top,SWP_NOZORDER|SWP_NOMOVE);
- ::SetWindowPos(childhwnd,NULL,0,0,0,0,SWP_NOZORDER|SWP_NOSIZE|SWP_SHOWWINDOW);
- }
- }
- return 1;
-
- case WM_COMMAND:
- switch (LOWORD(wParam))
- {
- case IDCANCEL:
- DestroyWindow(Hwnd);
- break;
- }
- return 1;
-
- case WM_DESTROY:
- ::GetCOREInterface()->UnRegisterDlgWnd(Hwnd);
- Hwnd = NULL;
- break;
- }
- return 0;
-}
diff --git a/Generals/Code/Tools/WW3D/max2w3d/floaterdialog.h b/Generals/Code/Tools/WW3D/max2w3d/floaterdialog.h
deleted file mode 100644
index 6d7a94d883c..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/floaterdialog.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Max2W3d *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/floaterdialog.h $*
- * *
- * Original Author:: Greg Hjelstrom *
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 10/11/00 11:23a $*
- * *
- * $Revision:: 1 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#ifndef FLOATERDIALOG_H
-#define FLOATERDIALOG_H
-
-#include
-
-class Interface;
-
-/**
-** FloaterDialogClass
-** This class is designed to be used by modeless dialog boxes. See w3dutil.cpp for an
-** example of how to embed an arbitrary dialog template and dialog proc into a floating
-** window.
-*/
-class FloaterDialogClass
-{
-public:
-
- FloaterDialogClass(void);
- ~FloaterDialogClass();
-
- bool Is_Created(void);
- void Create(Interface * ip, int child_dialog_id, DLGPROC child_dlg_proc);
- bool Dialog_Proc(HWND hWnd,UINT message,WPARAM wParam,LPARAM);
-
-private:
-
- HWND Hwnd;
- int ChildDialogTemplateID;
- DLGPROC ChildDialogProc;
-
-};
-
-
-
-#endif //FLOATERDIALOG_H
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/gamemaps.cpp b/Generals/Code/Tools/WW3D/max2w3d/gamemaps.cpp
deleted file mode 100644
index de0aed7a34b..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/gamemaps.cpp
+++ /dev/null
@@ -1,287 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/* $Header: /Commando/Code/Tools/max2w3d/gamemaps.cpp 5 10/28/97 6:08p Greg_h $ */
-/***********************************************************************************************
- *** Confidential - Westwood Studios ***
- ***********************************************************************************************
- * *
- * Project Name : Commando / G 3D engine *
- * *
- * File Name : GAMEMAPS.CPP *
- * *
- * Programmer : Greg Hjelstrom *
- * *
- * Start Date : 06/26/97 *
- * *
- * Last Update : June 26, 1997 [GH] *
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * GameMapsClass::ClassID -- Returns the ClassID for GameMapsClass *
- * GameMapsClass::AssignController -- Assigns a controller to one of the Sub-Anims *
- * GameMapsClass::NotifyRefChanged -- Max is notifying GameMapsClass that a reference has cha*
- * GameMapsClass::Clone -- Create a clone of the GameMapsClass *
- * GameMapsClass::Save -- Saves the GameMapsClass data into a MAX file *
- * GameMapsClass::Load -- Loads GameMapsClass data from a MAX file *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#include "gamemaps.h"
-
-
-/*****************************************************************
-*
-* Chunk ID's for saving data in the MAX file.
-*
-*****************************************************************/
-#define GAMEMAPS_ONOFF_CHUNK 0x0000
-#define GAMEMAPS_AMT0_CHUNK 0x0001
-#define GAMEMAPS_AMT1_CHUNK 0x0002
-#define GAMEMAPS_AMT2_CHUNK 0x0003
-#define GAMEMAPS_AMT3_CHUNK 0x0004
-#define GAMEMAPS_AMT4_CHUNK 0x0005
-#define GAMEMAPS_AMT5_CHUNK 0x0006
-#define GAMEMAPS_AMT6_CHUNK 0x0007
-#define GAMEMAPS_AMT7_CHUNK 0x0008
-#define GAMEMAPS_AMT8_CHUNK 0x0009
-#define GAMEMAPS_AMT9_CHUNK 0x000A
-#define GAMEMAPS_AMTA_CHUNK 0x000B
-
-
-/*****************************************************************
-*
-* A PostLoadCallback which does nothing...
-*
-*****************************************************************/
-class GameMapsPostLoad : public PostLoadCallback
-{
-public:
- GameMapsClass *tm;
- GameMapsPostLoad(GameMapsClass *b) {tm=b;}
- void proc(ILoad *iload) { delete this; }
-};
-
-
-/*****************************************************************
-*
-* GameMapsClass Class Desriptor
-*
-*****************************************************************/
-static Class_ID _GameMapsClassID(0x36d23f7b, 0x79ce63e1);
-
-class GameMapsClassDesc : public ClassDesc
-{
- public:
- int IsPublic() { return 0; }
- void * Create(BOOL loading) { return new GameMapsClass(NULL); }
- const TCHAR * ClassName() { return _T("GameMaps"); }
- SClass_ID SuperClassID() { return REF_MAKER_CLASS_ID; }
- Class_ID ClassID() { return _GameMapsClassID; }
- const TCHAR* Category() { return _T(""); }
-};
-
-static GameMapsClassDesc _GameMapsCD;
-
-ClassDesc * Get_Game_Maps_Desc() { return &_GameMapsCD; }
-
-
-/***********************************************************************************************
- * GameMapsClass::ClassID -- Returns the ClassID for GameMapsClass *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 06/26/1997 GH : Created. *
- *=============================================================================================*/
-Class_ID GameMapsClass::ClassID()
-{
- return _GameMapsClassID;
-}
-
-/***********************************************************************************************
- * GameMapsClass::AssignController -- Assigns a controller to one of the Sub-Anims *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 06/26/1997 GH : Created. *
- *=============================================================================================*/
-BOOL GameMapsClass::AssignController(Animatable *control,int subAnim)
-{
- ReplaceReference(SubNumToRefNum(subAnim),(ReferenceTarget *)control);
- return TRUE;
-}
-
-/***********************************************************************************************
- * GameMapsClass::NotifyRefChanged -- Max is notifying GameMapsClass that a reference has chan *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 06/26/1997 GH : Created. *
- *=============================================================================================*/
-RefResult GameMapsClass::NotifyRefChanged
-(
- Interval changeInt,
- RefTargetHandle hTarget,
- PartID & partID,
- RefMessage message
-)
-{
- switch (message) {
- case REFMSG_GET_PARAM_DIM: {
- GetParamDim *gpd = (GetParamDim*)partID;
- break;
- }
- case REFMSG_GET_PARAM_NAME: {
- GetParamName *gpn = (GetParamName*)partID;
- return REF_STOP;
- }
- }
- return(REF_SUCCEED);
-}
-
-/***********************************************************************************************
- * GameMapsClass::Clone -- Create a clone of the GameMapsClass *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 06/26/1997 GH : Created. *
- *=============================================================================================*/
-RefTargetHandle GameMapsClass::Clone(RemapDir &remap)
-{
- GameMapsClass *tm = new GameMapsClass(NULL);
-
- for (int i=0; iTextureSlot[i].MapOn = TextureSlot[i].MapOn;
- tm->TextureSlot[i].Map = NULL;
-
- if (TextureSlot[i].Map) {
- tm->ReplaceReference(i,remap.CloneRef(TextureSlot[i].Map));
- }
- }
-
- return tm;
-}
-
-
-/***********************************************************************************************
- * GameMapsClass::Save -- Saves the GameMapsClass data into a MAX file *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 06/26/1997 GH : Created. *
- *=============================================================================================*/
-IOResult GameMapsClass::Save(ISave * isave)
-{
- ULONG nb,f=0;
-
- isave->BeginChunk(GAMEMAPS_ONOFF_CHUNK);
- for (int i=0; iWrite(&f,sizeof(f),&nb);
- isave->EndChunk();
-
- for (i=0; iBeginChunk(GAMEMAPS_AMT0_CHUNK + i);
- isave->Write(&(TextureSlot[i].Amount),sizeof(float),&nb);
- isave->EndChunk();
- }
- }
- return IO_OK;
-}
-
-
-/***********************************************************************************************
- * GameMapsClass::Load -- Loads GameMapsClass data from a MAX file *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 06/26/1997 GH : Created. *
- *=============================================================================================*/
-IOResult GameMapsClass::Load(ILoad * iload)
-{
- ULONG nb;
- int id;
- IOResult res;
-
- while (IO_OK==(res=iload->OpenChunk())) {
-
- switch (id = iload->CurChunkID()) {
- case GAMEMAPS_ONOFF_CHUNK:
- {
- ULONG f;
- res = iload->Read(&f,sizeof(f), &nb);
- for (int i=0; iRead(&(TextureSlot[index].Amount),sizeof(float),&nb);
- break;
- }
-
- iload->CloseChunk();
- if (res!=IO_OK) {
- return res;
- }
- }
- return IO_OK;
-}
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/gamemaps.h b/Generals/Code/Tools/WW3D/max2w3d/gamemaps.h
deleted file mode 100644
index 983377e87d5..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/gamemaps.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/* $Header: /Commando/Code/Tools/max2w3d/gamemaps.h 7 10/28/97 6:08p Greg_h $ */
-/***********************************************************************************************
- *** Confidential - Westwood Studios ***
- ***********************************************************************************************
- * *
- * Project Name : Commando / G 3D engine *
- * *
- * File Name : GAMEMAPS.H *
- * *
- * Programmer : Greg Hjelstrom *
- * *
- * Start Date : 06/26/97 *
- * *
- * Last Update : June 26, 1997 [GH] *
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#ifndef GAMEMAPS_H
-#define GAMEMAPS_H
-
-#include
-#include "stdmat.h"
-
-
-ClassDesc * Get_Game_Maps_Desc();
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// TexmapSlotClass
-//
-///////////////////////////////////////////////////////////////////////////
-class TexmapSlotClass
-{
-public:
-
- BOOL MapOn;
- float Amount;
- Texmap * Map;
-
- TexmapSlotClass() : MapOn(FALSE), Amount(1.0f), Map(NULL) {};
-
- RGBA Eval(ShadeContext& sc) { return Map->EvalColor(sc); }
- float EvalMono(ShadeContext& sc) { return Map->EvalMono(sc); }
- Point3 EvalNormalPerturb(ShadeContext &sc) { return Map->EvalNormalPerturb(sc); }
- BOOL IsActive() { return (Map && MapOn); }
- void Update(TimeValue t, Interval &ivalid) { if (IsActive()) Map->Update(t,ivalid); };
- float GetAmount(TimeValue t) { return Amount; }
-};
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Texture Maps for In-Game material
-//
-// This class can contain a collection of all of the maps which
-// MAX uses but the GameMtl plugin will only give the user access
-// to the ones we can actually use in the game.
-//
-///////////////////////////////////////////////////////////////////////////
-class GameMapsClass: public ReferenceTarget
-{
-public:
-
- MtlBase * Client;
- TexmapSlotClass TextureSlot[NTEXMAPS];
-
- GameMapsClass() { Client = NULL; }
- GameMapsClass(MtlBase *mb) { Client = mb; }
-
- void DeleteThis() { delete this; }
- void SetClientPtr(MtlBase *mb) { Client = mb; }
- TexmapSlotClass & operator[](int i) { return TextureSlot[i]; }
- Class_ID ClassID();
- SClass_ID SuperClassID() { return REF_MAKER_CLASS_ID; }
- int NumSubs() { return NTEXMAPS; }
- Animatable * SubAnim(int i) { return TextureSlot[i].Map; }
- TSTR SubAnimName(int i) { return Client->GetSubTexmapTVName(i); }
- int NumRefs() { return NTEXMAPS; }
- RefTargetHandle GetReference(int i) { return TextureSlot[i].Map; }
- void SetReference(int i, RefTargetHandle rtarg) { TextureSlot[i].Map = (Texmap*)rtarg; }
- int SubNumToRefNum(int subNum) { return subNum; }
-
-
- BOOL AssignController(Animatable *control,int subAnim);
- RefTargetHandle Clone(RemapDir &remap);
- RefResult NotifyRefChanged( Interval changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message);
-
- IOResult Save(ISave * isave);
- IOResult Load(ILoad * iload);
-};
-
-
-#endif /*GAMEMAPS_H*/
\ No newline at end of file
diff --git a/Generals/Code/Tools/WW3D/max2w3d/gamemtl.h b/Generals/Code/Tools/WW3D/max2w3d/gamemtl.h
deleted file mode 100644
index 8c96c984e06..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/gamemtl.h
+++ /dev/null
@@ -1,373 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/* $Header: /Commando/Code/Tools/max2w3d/gamemtl.h 38 8/22/01 7:56a Greg_h $ */
-/***********************************************************************************************
- *** Confidential - Westwood Studios ***
- ***********************************************************************************************
- * *
- * Project Name : Commando / G 3D engine *
- * *
- * File Name : GAMEMTL.H *
- * *
- * Programmer : Greg Hjelstrom *
- * *
- * Start Date : 06/26/97 *
- * *
- * Last Update : June 26, 1997 [GH] *
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#ifndef GAMEMTL_H
-#define GAMEMTL_H
-
-#include
-#include "w3dmtl.h"
-#include "w3d_file.h"
-
-
-// GameMtl flags values
-#define GAMEMTL_CONVERTED_TO_NOLOD (1<<0) // this material has been converted to use the NO_LOD flag on textures
-
-#define GAMEMTL_DISPLACEMENT_ROLLUP_OPEN (1<<25)
-#define GAMEMTL_SURFACE_ROLLUP_OPEN (1<<26)
-#define GAMEMTL_PASSCOUNT_ROLLUP_OPEN (1<<27)
-#define GAMEMTL_PASS0_ROLLUP_OPEN (1<<28)
-#define GAMEMTL_PASS1_ROLLUP_OPEN (1<<29)
-#define GAMEMTL_PASS2_ROLLUP_OPEN (1<<30)
-#define GAMEMTL_PASS3_ROLLUP_OPEN (1<<31)
-
-#define GAMEMTL_ROLLUP_FLAGS ( GAMEMTL_SURFACE_ROLLUP_OPEN | \
- GAMEMTL_DISPLACEMENT_ROLLUP_OPEN | \
- GAMEMTL_PASSCOUNT_ROLLUP_OPEN | \
- GAMEMTL_PASS0_ROLLUP_OPEN | \
- GAMEMTL_PASS1_ROLLUP_OPEN | \
- GAMEMTL_PASS2_ROLLUP_OPEN | \
- GAMEMTL_PASS3_ROLLUP_OPEN )
-
-#define GAMEMTL_ID_PARTA 0x29397211
-#define GAMEMTL_ID_PARTB 0x28c016c2
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Mapping types
-//
-///////////////////////////////////////////////////////////////////////////
-#define GAMEMTL_MAPPING_UV 0
-#define GAMEMTL_MAPPING_ENV 1
-#define GAMEMTL_MAPPING_CHEAP_ENV 2
-#define GAMEMTL_MAPPING_SCREEN 3
-#define GAMEMTL_MAPPING_LINEAR_OFFSET 4
-#define GAMEMTL_MAPPING_SILHOUETTE 5
-#define GAMEMTL_MAPPING_SCALE 6
-#define GAMEMTL_MAPPING_GRID 7
-#define GAMEMTL_MAPPING_ROTATE 8
-#define GAMEMTL_MAPPING_SINE_LINEAR_OFFSET 9
-#define GAMEMTL_MAPPING_STEP_LINEAR_OFFSET 10
-#define GAMEMTL_MAPPING_ZIGZAG_LINEAR_OFFSET 11
-#define GAMEMTL_MAPPING_WS_CLASSIC_ENV 12
-#define GAMEMTL_MAPPING_WS_ENVIRONMENT 13
-#define GAMEMTL_MAPPING_GRID_CLASSIC_ENV 14
-#define GAMEMTL_MAPPING_GRID_ENVIRONMENT 15
-#define GAMEMTL_MAPPING_RANDOM 16
-#define GAMEMTL_MAPPING_EDGE 17
-#define GAMEMTL_MAPPING_BUMPENV 18
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// PSX Translucency Type
-//
-///////////////////////////////////////////////////////////////////////////
-#define GAMEMTL_PSX_TRANS_NONE 0
-#define GAMEMTL_PSX_TRANS_100 1
-#define GAMEMTL_PSX_TRANS_50 2
-#define GAMEMTL_PSX_TRANS_25 3
-#define GAMEMTL_PSX_TRANS_MINUS_100 4
-
-class GameMtlDlg;
-class GameMapsClass;
-
-extern Class_ID GameMaterialClassID;
-extern ClassDesc * Get_Game_Material_Desc();
-
-// MLL
-// For Playstation 2 materials.
-extern Class_ID PS2GameMaterialClassID;
-extern ClassDesc * Get_PS2_Game_Material_Desc();
-
-extern Class_ID PCToPS2MaterialClassID;
-extern ClassDesc * Get_PS2_Material_Conversion();
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Game Material
-// This is a plugin-material which attempts to emulate the material
-// used in our in-game 3D engine. It has varying degrees of success
-// at making Max render things like our game but it gives us the
-// ability to have control over all parameters in our material.
-//
-///////////////////////////////////////////////////////////////////////////
-class GameMtl: public Mtl
-{
-
-public:
-
- enum ShaderTypeEnum
- {
- STE_PC_SHADER,
- STE_PS2_SHADER,
- };
-
- GameMtl(BOOL loading = FALSE);
- ~GameMtl(void);
-
- Class_ID ClassID();
- SClass_ID SuperClassID();
-
- // From Animatable
- void GetClassName(TSTR& s);
- void DeleteThis() { delete this; }
- int NumSubs();
- Animatable * SubAnim(int i);
- TSTR SubAnimName(int i);
-
- // References
- int NumRefs() { return REF_COUNT; }
- RefTargetHandle Clone(RemapDir &remap = NoRemap());
- RefResult NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message);
- void SetReference(int i, RefTargetHandle rtarg);
- RefTargetHandle GetReference(int i);
-
- // From MtlBase and Mtl
- void SetAmbient(Color c, TimeValue t) { Set_Ambient(0,t,c); }
- void SetDiffuse(Color c, TimeValue t) { Set_Diffuse(0,t,c); }
- void SetSpecular(Color c, TimeValue t) { Set_Specular(0,t,c); }
- void SetShininess(float v, TimeValue t) { Set_Shininess(0,t,v); }
- Color GetAmbient(int mtlNum=0, BOOL backFace=FALSE) { return Get_Ambient(0,0); }
- Color GetDiffuse(int mtlNum=0, BOOL backFace=FALSE) { return Get_Diffuse(0,0); }
- Color GetSpecular(int mtlNum=0, BOOL backFace=FALSE) { return Get_Specular(0,0); }
- float GetXParency(int mtlNum=0, BOOL backFace=FALSE) { return 0.0f; }
- float GetShininess(int mtlNum=0, BOOL backFace=FALSE) { return Get_Shininess(0,0); }
- float GetShinStr(int mtlNum=0, BOOL backFace=FALSE) { return 1.0f; }
- void Reset(void);
- void Update(TimeValue t, Interval& validr);
- Interval Validity(TimeValue t);
-
- int NumSubTexmaps(void);
- void SetSubTexmap(int i, Texmap * m);
- Texmap * GetSubTexmap(int i);
-
- float EvalDisplacement(ShadeContext& sc);
- Interval DisplacementValidity(TimeValue t);
-
- // Rendering
- void Shade(ShadeContext& sc);
- ULONG Requirements(int subMtlNum);
- //ULONG LocalRequirements(int subMtlNum);
-
- // Material editor
- void SetParamDlg(GameMtlDlg * pd) { MaterialDialog = pd; }
- ParamDlg* CreateParamDlg(HWND hwMtlEdit, IMtlParams *imp);
-
- // IO stuff
- IOResult Save(ISave* iSave);
- IOResult Load(ILoad* iLoad);
-
- // Accessors...
- void Set_Flag(ULONG f, ULONG val) { if (val) Flags|=f; else Flags &= ~f; }
- int Get_Flag(ULONG f) { return ((Flags&f) ? 1 : 0); }
-
- void Set_Surface_Type(unsigned int type) { SurfaceType = type; }
- unsigned int Get_Surface_Type(void) const { return SurfaceType; }
-
- void Set_Sort_Level(int level) { SortLevel = level; }
- int Get_Sort_Level(void) const { return SortLevel; }
-
- void Set_Pass_Count(int passcount);
- int Get_Pass_Count(void);
-
- IParamBlock * Get_Parameter_Block(int pass);
- int Get_Current_Page(int pass) { return CurPage[pass]; }
- Color Get_Ambient(int pass,TimeValue t);
- Color Get_Diffuse(int pass,TimeValue t);
- Color Get_Specular(int pass,TimeValue t);
- Color Get_Emissive(int pass,TimeValue t);
- float Get_Shininess(int pass,TimeValue t);
- float Get_Opacity(int pass,TimeValue t);
- float Get_Translucency(int pass,TimeValue t);
- int Get_Copy_Specular_To_Diffuse(int pass);
- int Get_Mapping_Type(int pass, int stage=0);
- int Get_PSX_Translucency(int pass);
- int Get_PSX_Lighting(int pass);
-
- int Get_Depth_Compare(int pass);
- int Get_Depth_Mask(int pass);
- int Get_Alpha_Test(int pass);
- int Get_Dest_Blend(int pass);
- int Get_Pri_Gradient(int pass);
- int Get_Sec_Gradient(int pass);
- int Get_Src_Blend(int pass);
- int Get_Detail_Color_Func(int pass);
- int Get_Detail_Alpha_Func(int pass);
- int Get_PS2_Shader_Param_A(int pass);
- int Get_PS2_Shader_Param_B(int pass);
- int Get_PS2_Shader_Param_C(int pass);
- int Get_PS2_Shader_Param_D(int pass);
-
- int Get_Texture_Enable(int pass,int stage);
- int Get_Texture_Publish(int pass,int stage);
- int Get_Texture_Resize(int pass,int stage); // NOTE: obsolete, replaced by Get_Texture_No_LOD
- int Get_Texture_No_Mipmap(int pass,int stage); // NOTE: obsolete, replaced by Get_Texture_No_LOD
- int Get_Texture_Clamp_U(int pass,int stage);
- int Get_Texture_Clamp_V(int pass,int stage);
- int Get_Texture_No_LOD(int pass,int stage);
- int Get_Texture_Alpha_Bitmap(int pass,int stage);
- int Get_Texture_Hint(int pass,int stage);
- int Get_Texture_Display(int pass,int stage);
- float Get_Texture_Frame_Rate(int pass,int stage);
- int Get_Texture_Frame_Count(int pass,int stage);
- int Get_Texture_Anim_Type(int pass,int stage);
- Texmap * Get_Texture(int pass,int stage);
- Texmap * Get_Displacement_Map(void) const { return DisplacementMap; }
- float Get_Displacement_Amount(void) const { return DisplacementAmt; }
- int Get_Displacement_Map_Index(void) const;
- int Get_Map_Channel(int pass,int stage);
-
- void Set_Current_Page(int pass,int page) { CurPage[pass] = page; }
- void Set_Ambient(int pass,TimeValue t,Color color);
- void Set_Diffuse(int pass,TimeValue t,Color color);
- void Set_Specular(int pass,TimeValue t,Color color);
- void Set_Emissive(int pass,TimeValue t,Color color);
- void Set_Shininess(int pass,TimeValue t,float val);
- void Set_Opacity(int pass,TimeValue t,float val);
- void Set_Translucency(int pass,TimeValue t,float val);
- void Set_Copy_Specular_To_Diffuse(int pass,bool val);
- void Set_Mapping_Type(int pass,int stage,int val);
- void Set_PSX_Translucency(int pass,int val);
- void Set_PSX_Lighting(int pass,bool val);
-
- void Set_Depth_Compare(int pass,int val);
- void Set_Depth_Mask(int pass,int val);
- void Set_Alpha_Test(int pass,int val);
- void Set_Dest_Blend(int pass,int val);
- void Set_Pri_Gradient(int pass,int val);
- void Set_Sec_Gradient(int pass,int val);
- void Set_Src_Blend(int pass,int val);
- void Set_Detail_Color_Func(int pass,int val);
- void Set_Detail_Alpha_Func(int pass,int val);
- void Set_PS2_Shader_Param_A(int pass,int val);
- void Set_PS2_Shader_Param_B(int pass,int val);
- void Set_PS2_Shader_Param_C(int pass,int val);
- void Set_PS2_Shader_Param_D(int pass,int val);
-
- void Set_Texture_Enable(int pass,int stage,bool val);
- void Set_Texture_Publish(int pass,int stage,bool val);
- void Set_Texture_Resize(int pass,int stage,bool val); // NOTE: obsolete: replaced by Set_Texture_No_LOD
- void Set_Texture_No_Mipmap(int pass,int stage,bool val); // NOTE: obsolete: replaced by Set_Texture_No_LOD
- void Set_Texture_Clamp_U(int pass,int stage,bool val);
- void Set_Texture_Clamp_V(int pass,int stage,bool val);
- void Set_Texture_No_LOD(int pass,int stage,bool val);
- void Set_Texture_Alpha_Bitmap(int pass,int stage,bool val);
- void Set_Texture_Hint(int pass,int stage,int val);
- void Set_Texture_Display(int pass,int stage,bool val);
- void Set_Texture_Frame_Rate(int pass,int stage,float val);
- void Set_Texture_Frame_Count(int pass,int stage,int val);
- void Set_Texture_Anim_Type(int pass,int stage,int val);
- void Set_Texture(int pass,int stage,Texmap * tex);
- void Set_Displacement_Amount(float amount) { DisplacementAmt = amount; Notify_Changed (); }
-
- void Set_Map_Channel(int pass,int stage,int channel);
-
- void Notify_Changed(void);
-
- // This returns the mapping args string buffer for that pass after
- // assuring that it is at least of length 'len'.
- char * Get_Mapping_Arg_Buffer(int pass, int stage=0, unsigned int len = 0U);
-
- int pass_stage_to_texmap_index(int pass,int stage);
- void texmap_index_to_pass_stage(int index,int * set_pass,int * set_stage);
-
- // Set and get the type of shader, PC or PS2.
- // MLL
- int Get_Shader_Type() {return (ShaderType);}
- void Set_Shader_Type(int shadertype) {ShaderType = shadertype;}
-
- // Approximate the PS2 shader on the PC.
- int Compute_PC_Shader_From_PS2_Shader(int pass);
- int Compute_PS2_Shader_From_PC_Shader(int pass);
-
- // IML: Get/set substitute material.
- Mtl* Substitute_Material() {return (SubstituteMaterial);}
- void Set_Substitute_Material (Mtl *m) {SubstituteMaterial = m;}
-
-private:
-
- int texture_ref_index(int pass,int stage) { return REF_TEXTURE + pass*W3dMaterialClass::MAX_STAGES + stage; }
- int pass_ref_index(int pass) { return REF_PASS_PARAMETERS + pass; }
-
- void update_viewport_display();
-
- // Do the shade functions specific to the Playstation 2.
- void ps2_shade(ShadeContext& sc);
-
-
- unsigned int SurfaceType;
- int SortLevel;
-
- Interval Ivalid; // Valid interval
- GameMtlDlg * MaterialDialog; // Dialog
- ULONG Flags; // Flags
- int RollScroll; // Rollup scroll position
- int CurPage[W3dMaterialClass::MAX_PASSES]; // which page was last open for each pass
-
- GameMapsClass * Maps; // ref 0 (obsolete...)
- IParamBlock * MainParameterBlock;
- IParamBlock * PassParameterBlock[W3dMaterialClass::MAX_PASSES];
- Texmap * Texture[W3dMaterialClass::MAX_PASSES][W3dMaterialClass::MAX_STAGES];
- char * MapperArg[W3dMaterialClass::MAX_PASSES][W3dMaterialClass::MAX_STAGES];
- unsigned int MapperArgLen[W3dMaterialClass::MAX_PASSES][W3dMaterialClass::MAX_STAGES];
- Texmap * DisplacementMap;
- float DisplacementAmt;
-
- // MLL
- int ShaderType;
- enum
- {
- REF_MAPS = 0, // obsolete, gamemaps object
- REF_MAIN = 1, // main parameter block is ref 1
- REF_PASS_PARAMETERS = 2, // pass parameter blocks are refs 2,3,4,5
- REF_TEXTURE = 6, // textures are refs 6,7,8,9,10,11,12,13,14 (14 is the displacement map)
- REF_COUNT = 15
- };
-
- Mtl *SubstituteMaterial; // IML: Temporary material used during game to standard material conversion and vice-versa.
-
- friend class GameMtlDlg;
- friend class GameMtlPostLoad;
-};
-
-Mtl * CreateGameMtl();
-
-#endif
-
-
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/genlodextensiondialog.cpp b/Generals/Code/Tools/WW3D/max2w3d/genlodextensiondialog.cpp
deleted file mode 100644
index 1684038e172..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/genlodextensiondialog.cpp
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Max2W3D *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/genlodextensiondialog.cpp $*
- * *
- * Original Author:: Greg Hjelstrom *
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 10/10/00 11:14a $*
- * *
- * $Revision:: 1 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * GenLodExtensionDialogClass::GenLodExtensionDialogClass -- Constructor *
- * GenLodExtensionDialogClass::~GenLodExtensionDialogClass -- Destructor *
- * GenLodExtensionDialogClass::Get_Options -- Presents the dialog, gets user input *
- * GenLodExtensionDialogClass::Dialog_Proc -- Windows message handling *
- * _gen_lod_ext_dialog_proc -- windows dialog proc *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#include "genlodextensiondialog.h"
-#include "dllmain.h"
-#include "resource.h"
-#include
-
-
-/**********************************************************************************************
-**
-** GenLodExtensionDialogClass Implementation
-**
-**********************************************************************************************/
-
-
-/***********************************************************************************************
- * GenLodExtensionDialogClass::GenLodExtensionDialogClass -- Constructor *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- *=============================================================================================*/
-GenLodExtensionDialogClass::GenLodExtensionDialogClass(Interface * maxinterface) :
- Hwnd(NULL),
- Options(NULL),
- MaxInterface(maxinterface),
- LodIndexSpin(NULL)
-{
-}
-
-
-/***********************************************************************************************
- * GenLodExtensionDialogClass::~GenLodExtensionDialogClass -- Destructor *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/10/2000 gth : Created. *
- *=============================================================================================*/
-GenLodExtensionDialogClass::~GenLodExtensionDialogClass(void)
-{
- ReleaseISpinner(LodIndexSpin);
-}
-
-
-/***********************************************************************************************
- * GenLodExtensionDialogClass::Get_Options -- Presents the dialog, gets user input *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/10/2000 gth : Created. *
- *=============================================================================================*/
-bool GenLodExtensionDialogClass::Get_Options(OptionsStruct * options)
-{
- Options = options;
-
- // Put up the options dialog box.
- BOOL result = DialogBoxParam
- (
- AppInstance,
- MAKEINTRESOURCE (IDD_GENERATE_LOD_EXTENSION_DIALOG),
- MaxInterface->GetMAXHWnd(),
- (DLGPROC) _gen_lod_ext_dialog_proc,
- (LPARAM) this
- );
-
- if (result == TRUE) {
- return true;
- } else {
- return false;
- }
-}
-
-
-/***********************************************************************************************
- * GenLodExtensionDialogClass::Dialog_Proc -- Windows message handling *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/10/2000 gth : Created. *
- *=============================================================================================*/
-bool GenLodExtensionDialogClass::Dialog_Proc(HWND hWnd,UINT message,WPARAM wParam,LPARAM)
-{
- switch (message ) {
-
- case WM_INITDIALOG:
-
- // Setup the LOD spinner control.
- LodIndexSpin = SetupIntSpinner
- (
- Hwnd,
- IDC_LOD_INDEX_SPIN,
- IDC_LOD_INDEX_EDIT,
- MIN_LOD_INDEX,MAX_LOD_INDEX,INITIAL_LOD_INDEX
- );
-
- return 1;
-
- case WM_COMMAND:
-
- switch (LOWORD(wParam))
- {
- case IDOK:
- Options->LodIndex = LodIndexSpin->GetIVal();
- EndDialog(Hwnd, 1);
- break;
-
- case IDCANCEL:
- EndDialog(Hwnd, 0);
- break;
- }
- return 1;
- }
- return 0;
-}
-
-
-/***********************************************************************************************
- * _gen_lod_ext_dialog_proc -- windows dialog proc *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/10/2000 gth : Created. *
- *=============================================================================================*/
-static BOOL CALLBACK _gen_lod_ext_dialog_proc(HWND hwnd,UINT message,WPARAM wparam,LPARAM lparam)
-{
- static GenLodExtensionDialogClass * dialog = NULL;
-
- if (message == WM_INITDIALOG) {
- dialog = (GenLodExtensionDialogClass *)lparam;
- dialog->Hwnd = hwnd;
- }
-
- if (dialog) {
- return dialog->Dialog_Proc(hwnd, message, wparam, lparam);
- } else {
- return FALSE;
- }
-}
-
-
-
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/genlodextensiondialog.h b/Generals/Code/Tools/WW3D/max2w3d/genlodextensiondialog.h
deleted file mode 100644
index a3ef870f59e..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/genlodextensiondialog.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Max2W3d *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/genlodextensiondialog.h $*
- * *
- * Original Author:: Greg Hjelstrom *
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 10/10/00 11:14a $*
- * *
- * $Revision:: 1 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#ifndef GENLODEXTENSIONDIALOG_H
-#define GENLODEXTENSIONDIALOG_H
-
-#include
-
-class Interface;
-class ISpinnerControl;
-
-/**********************************************************************************************
-**
-** GenLodExtensionDialogClass - Dialog box for the LOD extension naming parameters
-**
-**********************************************************************************************/
-class GenLodExtensionDialogClass
-{
-public:
-
- GenLodExtensionDialogClass(Interface * maxinterface);
- ~GenLodExtensionDialogClass();
-
- struct OptionsStruct
- {
- OptionsStruct(void) : LodIndex(0)
- {
- }
-
- // name options
- int LodIndex;
- };
-
- bool Get_Options(OptionsStruct * options);
- bool Dialog_Proc(HWND hWnd,UINT message,WPARAM wParam,LPARAM);
-
-private:
-
- enum
- {
- MIN_LOD_INDEX = 0,
- MAX_LOD_INDEX = 99,
- INITIAL_LOD_INDEX = 0,
- };
-
- HWND Hwnd;
-
- OptionsStruct * Options;
- Interface * MaxInterface;
- ISpinnerControl * LodIndexSpin;
-
- friend BOOL CALLBACK _gen_lod_ext_dialog_proc(HWND Hwnd,UINT message,WPARAM wParam,LPARAM lParam);
-
-};
-
-
-
-
-#endif //GENLODEXTENSIONDIALOG_H
\ No newline at end of file
diff --git a/Generals/Code/Tools/WW3D/max2w3d/genmtlnamesdialog.cpp b/Generals/Code/Tools/WW3D/max2w3d/genmtlnamesdialog.cpp
deleted file mode 100644
index 7240376c96f..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/genmtlnamesdialog.cpp
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Max2W3D *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/genmtlnamesdialog.cpp $*
- * *
- * Original Author:: Greg Hjelstrom *
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 10/10/00 11:12a $*
- * *
- * $Revision:: 1 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * GenMtlNamesDialogClass::GenMtlNamesDialogClass -- Constructor *
- * GenMtlNamesDialogClass::~GenMtlNamesDialogClass -- Destructor *
- * GenMtlNamesDialogClass::Get_Options -- present the dialog, get user input *
- * GenMtlNamesDialogClass::Ok_To_Exit -- verify that the input is valid *
- * GenMtlNamesDialogClass::Dialog_Proc -- windows message handling *
- * _gen_mtl_names_dialog_proc -- windows dialog proc for GenMtlNamesDialog *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#include "genmtlnamesdialog.h"
-#include "dllmain.h"
-#include "resource.h"
-#include "w3d_file.h"
-#include
-
-static BOOL CALLBACK _gen_mtl_names_dialog_proc(HWND Hwnd,UINT message,WPARAM wParam,LPARAM lParam);
-
-
-/**********************************************************************************************
-**
-** GenMtlNamesDialogClass Implementation
-**
-**********************************************************************************************/
-
-
-/***********************************************************************************************
- * GenMtlNamesDialogClass::GenMtlNamesDialogClass -- Constructor *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- *=============================================================================================*/
-GenMtlNamesDialogClass::GenMtlNamesDialogClass(Interface * maxinterface) :
- Hwnd(NULL),
- Options(NULL),
- MaxInterface(maxinterface),
- NameIndexSpin(NULL)
-{
-}
-
-
-/***********************************************************************************************
- * GenMtlNamesDialogClass::~GenMtlNamesDialogClass -- Destructor *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/10/2000 gth : Created. *
- *=============================================================================================*/
-GenMtlNamesDialogClass::~GenMtlNamesDialogClass(void)
-{
- ReleaseISpinner(NameIndexSpin);
-}
-
-
-/***********************************************************************************************
- * GenMtlNamesDialogClass::Get_Options -- present the dialog, get user input *
- * *
- * INPUT: *
- * options - pointer to structure to hold the user's input *
- * *
- * OUTPUT: *
- * true - user pressed ok and the input is valid *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/10/2000 gth : Created. *
- *=============================================================================================*/
-bool GenMtlNamesDialogClass::Get_Options(OptionsStruct * options)
-{
- Options = options;
-
- // Put up the options dialog box.
- BOOL result = DialogBoxParam
- (
- AppInstance,
- MAKEINTRESOURCE (IDD_GENERATE_MTL_NAMES_DIALOG),
- MaxInterface->GetMAXHWnd(),
- (DLGPROC) _gen_mtl_names_dialog_proc,
- (LPARAM) this
- );
-
- if (result == TRUE) {
- return true;
- } else {
- return false;
- }
-}
-
-
-/***********************************************************************************************
- * GenMtlNamesDialogClass::Ok_To_Exit -- verify that the input is valid *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/10/2000 gth : Created. *
- *=============================================================================================*/
-bool GenMtlNamesDialogClass::Ok_To_Exit(void)
-{
- // just check that the user entered a name
- char buf[W3D_NAME_LEN];
- GetWindowText(GetDlgItem(Hwnd,IDC_BASE_NAME_EDIT),buf,sizeof(buf));
-
- if (strlen(buf) == 0) {
- MessageBox(Hwnd,"Please enter a root name to use.\n","Error",MB_OK);
- return false;
- } else {
- return true;
- }
-
- return true;
-}
-
-
-/***********************************************************************************************
- * GenMtlNamesDialogClass::Dialog_Proc -- windows message handling *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/10/2000 gth : Created. *
- *=============================================================================================*/
-bool GenMtlNamesDialogClass::Dialog_Proc(HWND hWnd,UINT message,WPARAM wParam,LPARAM)
-{
- switch (message ) {
-
- case WM_INITDIALOG:
-
- NameIndexSpin = SetupIntSpinner
- (
- Hwnd,
- IDC_NAME_INDEX_SPIN,
- IDC_NAME_INDEX_EDIT,
- MIN_NAME_INDEX,MAX_NAME_INDEX,INITIAL_NAME_INDEX
- );
-
- // limit the edit box characters
- SendDlgItemMessage(Hwnd,IDC_BASE_NAME_EDIT,EM_LIMITTEXT,MAX_ROOT_NAME_LEN,0);
-
- // set initial name to root of the filename
- char buf[_MAX_FNAME];
- _splitpath(MaxInterface->GetCurFileName(),NULL,NULL,buf,NULL);
- buf[MAX_ROOT_NAME_LEN+1] = 0;
- SetWindowText(GetDlgItem(Hwnd,IDC_BASE_NAME_EDIT),buf);
-
- // init radio buttons
- CheckDlgButton(Hwnd,IDC_AFFECT_ALL_RADIO,BST_UNCHECKED);
- CheckDlgButton(Hwnd,IDC_AFFECT_SELECTED_RADIO,BST_CHECKED);
-
- return 1;
-
- case WM_COMMAND:
-
- switch (LOWORD(wParam))
- {
- case IDOK:
- if (Ok_To_Exit()) {
- // general options
- Options->OnlyAffectSelected = (IsDlgButtonChecked(Hwnd,IDC_AFFECT_SELECTED_RADIO) == BST_CHECKED);
-
- // naming options
- Options->NameIndex = NameIndexSpin->GetIVal();
- GetWindowText(GetDlgItem(Hwnd,IDC_BASE_NAME_EDIT),Options->RootName,sizeof(Options->RootName));
-
- EndDialog(Hwnd, 1);
- }
- break;
-
- case IDCANCEL:
- EndDialog(Hwnd, 0);
- break;
-
- }
- return 1;
- }
- return 0;
-}
-
-
-/***********************************************************************************************
- * _gen_mtl_names_dialog_proc -- windows dialog proc for GenMtlNamesDialog *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/10/2000 gth : Created. *
- *=============================================================================================*/
-static BOOL CALLBACK _gen_mtl_names_dialog_proc(HWND hwnd,UINT message,WPARAM wparam,LPARAM lparam)
-{
- static GenMtlNamesDialogClass * dialog = NULL;
-
- if (message == WM_INITDIALOG) {
- dialog = (GenMtlNamesDialogClass *)lparam;
- dialog->Hwnd = hwnd;
- }
-
- if (dialog) {
- return dialog->Dialog_Proc(hwnd, message, wparam, lparam);
- } else {
- return FALSE;
- }
-}
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/genmtlnamesdialog.h b/Generals/Code/Tools/WW3D/max2w3d/genmtlnamesdialog.h
deleted file mode 100644
index f53bbb012e3..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/genmtlnamesdialog.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Max2W3d *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/genmtlnamesdialog.h $*
- * *
- * Original Author:: Greg Hjelstrom *
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 10/10/00 11:12a $*
- * *
- * $Revision:: 1 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#ifndef GENMTLNAMESDIALOG_H
-#define GENMTLNAMESDIALOG_H
-
-#include
-
-class Interface;
-class ISpinnerControl;
-
-/**********************************************************************************************
-**
-** GenMtlNamesDialogClass - Dialog box for the material naming parameters
-**
-**********************************************************************************************/
-class GenMtlNamesDialogClass
-{
-public:
-
- GenMtlNamesDialogClass(Interface * maxinterface);
- ~GenMtlNamesDialogClass();
-
- enum
- {
- MAX_MATERIAL_NAME_LEN = 32,
- MIN_NAME_INDEX = 0,
- MAX_NAME_INDEX = 999,
- INITIAL_NAME_INDEX = 0,
- MAX_ROOT_NAME_LEN = 28,
- };
-
- struct OptionsStruct
- {
- OptionsStruct(void) : OnlyAffectSelected(true), NameIndex(0)
- {
- memset(RootName,0,sizeof(RootName));
- }
-
- // overall options
- bool OnlyAffectSelected;
-
- // name options
- char RootName[MAX_MATERIAL_NAME_LEN];
- int NameIndex;
- };
-
- bool Get_Options(OptionsStruct * options);
- bool Dialog_Proc(HWND hWnd,UINT message,WPARAM wParam,LPARAM);
- bool Ok_To_Exit(void);
-
-private:
-
- HWND Hwnd;
-
- OptionsStruct * Options;
- Interface * MaxInterface;
- ISpinnerControl * NameIndexSpin;
-
- friend BOOL CALLBACK _gen_mtl_names_dialog_proc(HWND hwnd,UINT message,WPARAM wparam,LPARAM lparam);
-
-};
-
-
-#endif //GENMTLNAMESDIALOG_H
-
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/gennamesdialog.cpp b/Generals/Code/Tools/WW3D/max2w3d/gennamesdialog.cpp
deleted file mode 100644
index 5beb4ded9c3..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/gennamesdialog.cpp
+++ /dev/null
@@ -1,357 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Max2W3D *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/gennamesdialog.cpp $*
- * *
- * Original Author:: Greg Hjelstrom *
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 12/06/00 3:24p $*
- * *
- * $Revision:: 2 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * GenNamesDialogClass::GenNamesDialogClass -- Constructor *
- * GenNamesDialogClass::~GenNamesDialogClass -- Destructor *
- * GenNamesDialogClass::Get_Options -- Get_Options *
- * GenNamesDialogClass::Ok_To_Exit -- verifies that the input is valid *
- * GenNamesDialogClass::Toggle_Name_Assignment -- toggles the controls related to name assig *
- * GenNamesDialogClass::Toggle_Collision_Bits_Assignment -- toggles the controls related to *
- * GenNamesDialogClass::Dialog_Proc -- windows dialog proc *
- * _gen_names_dialog_proc -- dialog proc that "thunks" to the class's dialog proc *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#include "gennamesdialog.h"
-#include "dllmain.h"
-#include "resource.h"
-
-
-static BOOL CALLBACK _gen_names_dialog_proc(HWND Hwnd,UINT message,WPARAM wParam,LPARAM lParam);
-
-
-/**********************************************************************************************
-**
-** GenNamesDialogClass Implementation
-**
-**********************************************************************************************/
-
-
-/***********************************************************************************************
- * GenNamesDialogClass::GenNamesDialogClass -- Constructor *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- *=============================================================================================*/
-GenNamesDialogClass::GenNamesDialogClass(Interface * maxinterface) :
- Hwnd(NULL),
- Options(NULL),
- MaxInterface(maxinterface),
- NameIndexSpin(NULL)
-{
-}
-
-
-/***********************************************************************************************
- * GenNamesDialogClass::~GenNamesDialogClass -- Destructor *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/10/2000 gth : Created. *
- *=============================================================================================*/
-GenNamesDialogClass::~GenNamesDialogClass(void)
-{
- ReleaseISpinner(NameIndexSpin);
-}
-
-
-/***********************************************************************************************
- * GenNamesDialogClass::Get_Options -- Get_Options *
- * *
- * presents the dialog to the user and records his selections into the passed-in options *
- * structure. *
- * *
- * INPUT: *
- * options - pointer to a OptionsStruct to store the users input in. *
- * *
- * OUTPUT: *
- * true - user pressed ok and entered valid input *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/10/2000 gth : Created. *
- *=============================================================================================*/
-bool GenNamesDialogClass::Get_Options(OptionsStruct * options)
-{
- Options = options;
-
- // Put up the options dialog box.
- BOOL result = DialogBoxParam
- (
- AppInstance,
- MAKEINTRESOURCE (IDD_GENERATE_NAMES_DIALOG),
- MaxInterface->GetMAXHWnd(),
- (DLGPROC) _gen_names_dialog_proc,
- (LPARAM) this
- );
-
- if (result == TRUE) {
- return true;
- } else {
- return false;
- }
-}
-
-
-/***********************************************************************************************
- * GenNamesDialogClass::Ok_To_Exit -- verifies that the input is valid *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * true - dialog contains valid input *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/10/2000 gth : Created. *
- *=============================================================================================*/
-bool GenNamesDialogClass::Ok_To_Exit(void)
-{
- if (IsDlgButtonChecked(Hwnd,IDC_ASSIGN_NAMES_CHECK) == BST_CHECKED) {
-
- // just check that the user entered a name
- char buf[W3D_NAME_LEN];
- GetWindowText(GetDlgItem(Hwnd,IDC_BASE_NAME_EDIT),buf,sizeof(buf));
-
- if (strlen(buf) == 0) {
- MessageBox(Hwnd,"Please enter a root name to use.\n","Error",MB_OK);
- return false;
- } else {
- return true;
- }
- }
-
- return true;
-}
-
-
-/***********************************************************************************************
- * GenNamesDialogClass::Toggle_Name_Assignment -- toggles the controls related to name assignm *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/10/2000 gth : Created. *
- *=============================================================================================*/
-void GenNamesDialogClass::Toggle_Name_Assignment(void)
-{
- bool onoff = (IsDlgButtonChecked(Hwnd,IDC_ASSIGN_NAMES_CHECK) == BST_CHECKED);
- EnableWindow(GetDlgItem(Hwnd,IDC_BASE_NAME_EDIT),onoff);
- EnableWindow(GetDlgItem(Hwnd,IDC_LOD_INDEX_EDIT),onoff);
- EnableWindow(GetDlgItem(Hwnd,IDC_LOD_INDEX_SPIN),onoff);
- EnableWindow(GetDlgItem(Hwnd,IDC_NAME_INDEX_EDIT),onoff);
- EnableWindow(GetDlgItem(Hwnd,IDC_NAME_INDEX_SPIN),onoff);
-}
-
-
-/***********************************************************************************************
- * GenNamesDialogClass::Toggle_Collision_Bits_Assignment -- toggles the controls related to co *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/10/2000 gth : Created. *
- *=============================================================================================*/
-void GenNamesDialogClass::Toggle_Collision_Bits_Assignment(void)
-{
- bool onoff = (IsDlgButtonChecked(Hwnd,IDC_ASSIGN_COLLISION_BITS_CHECK) == BST_CHECKED);
- EnableWindow(GetDlgItem(Hwnd,IDC_COLLISION_PHYSICAL),onoff);
- EnableWindow(GetDlgItem(Hwnd,IDC_COLLISION_PROJECTILE),onoff);
- EnableWindow(GetDlgItem(Hwnd,IDC_COLLISION_VIS),onoff);
- EnableWindow(GetDlgItem(Hwnd,IDC_COLLISION_CAMERA),onoff);
- EnableWindow(GetDlgItem(Hwnd,IDC_COLLISION_VEHICLE),onoff);
-}
-
-
-/***********************************************************************************************
- * GenNamesDialogClass::Dialog_Proc -- windows dialog proc *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/10/2000 gth : Created. *
- *=============================================================================================*/
-bool GenNamesDialogClass::Dialog_Proc(HWND hWnd,UINT message,WPARAM wParam,LPARAM)
-{
- switch (message ) {
-
- case WM_INITDIALOG:
-
- NameIndexSpin = SetupIntSpinner
- (
- Hwnd,
- IDC_NAME_INDEX_SPIN,
- IDC_NAME_INDEX_EDIT,
- MIN_NAME_INDEX,MAX_NAME_INDEX,INITIAL_NAME_INDEX
- );
-
- // limit the base name edit box to 10 characters
- SendDlgItemMessage(Hwnd,IDC_BASE_NAME_EDIT,EM_LIMITTEXT,MAX_ROOT_NAME_LEN,0);
-
- // limit the suffix and prefix edit boxes
- SendDlgItemMessage(Hwnd,IDC_PREFIX_EDIT,EM_LIMITTEXT,MAX_PREFIX_LEN,0);
- SendDlgItemMessage(Hwnd,IDC_SUFFIX_EDIT,EM_LIMITTEXT,MAX_SUFFIX_LEN,0);
-
- // set initial name to root of the filename
- char buf[_MAX_FNAME];
- _splitpath(MaxInterface->GetCurFileName(),NULL,NULL,buf,NULL);
- buf[MAX_ROOT_NAME_LEN+1] = 0;
- SetWindowText(GetDlgItem(Hwnd,IDC_BASE_NAME_EDIT),buf);
-
- // init radio buttons
- CheckDlgButton(Hwnd,IDC_AFFECT_ALL_RADIO,BST_UNCHECKED);
- CheckDlgButton(Hwnd,IDC_AFFECT_SELECTED_RADIO,BST_CHECKED);
-
- // init the check boxes
- CheckDlgButton(Hwnd,IDC_ASSIGN_NAMES_CHECK,BST_CHECKED);
- CheckDlgButton(Hwnd,IDC_ASSIGN_PREFIX_CHECK,BST_UNCHECKED);
- CheckDlgButton(Hwnd,IDC_ASSIGN_SUFFIX_CHECK,BST_UNCHECKED);
- CheckDlgButton(Hwnd,IDC_ASSIGN_COLLISION_BITS_CHECK,BST_CHECKED);
- CheckDlgButton(Hwnd,IDC_COLLISION_PHYSICAL,BST_CHECKED);
- CheckDlgButton(Hwnd,IDC_COLLISION_PROJECTILE,BST_CHECKED);
- CheckDlgButton(Hwnd,IDC_COLLISION_VIS,BST_CHECKED);
- CheckDlgButton(Hwnd,IDC_COLLISION_CAMERA,BST_CHECKED);
- CheckDlgButton(Hwnd,IDC_COLLISION_VEHICLE,BST_CHECKED);
- return 1;
-
- case WM_COMMAND:
-
- switch (LOWORD(wParam))
- {
- case IDOK:
- if (Ok_To_Exit()) {
- // general options
- Options->AssignNames = (IsDlgButtonChecked(Hwnd,IDC_ASSIGN_NAMES_CHECK) == BST_CHECKED);
- Options->AssignPrefix = (IsDlgButtonChecked(Hwnd,IDC_ASSIGN_PREFIX_CHECK) == BST_CHECKED);
- Options->AssignSuffix = (IsDlgButtonChecked(Hwnd,IDC_ASSIGN_SUFFIX_CHECK) == BST_CHECKED);
- Options->AssignCollisionBits = (IsDlgButtonChecked(Hwnd,IDC_ASSIGN_COLLISION_BITS_CHECK) == BST_CHECKED);
- Options->OnlyAffectSelected = (IsDlgButtonChecked(Hwnd,IDC_AFFECT_SELECTED_RADIO) == BST_CHECKED);
-
- // naming options
- Options->NameIndex = NameIndexSpin->GetIVal();
- GetWindowText(GetDlgItem(Hwnd,IDC_BASE_NAME_EDIT),Options->RootName,sizeof(Options->RootName));
- GetWindowText(GetDlgItem(Hwnd,IDC_PREFIX_EDIT),Options->PrefixName,sizeof(Options->PrefixName));
- GetWindowText(GetDlgItem(Hwnd,IDC_SUFFIX_EDIT),Options->SuffixName,sizeof(Options->SuffixName));
-
- // collision options
- Options->PhysicalCollision = (IsDlgButtonChecked(Hwnd,IDC_COLLISION_PHYSICAL) == BST_CHECKED);
- Options->ProjectileCollision = (IsDlgButtonChecked(Hwnd,IDC_COLLISION_PROJECTILE) == BST_CHECKED);
- Options->VisCollision = (IsDlgButtonChecked(Hwnd,IDC_COLLISION_VIS) == BST_CHECKED);
- Options->CameraCollision = (IsDlgButtonChecked(Hwnd,IDC_COLLISION_CAMERA) == BST_CHECKED);
- Options->VehicleCollision = (IsDlgButtonChecked(Hwnd,IDC_COLLISION_VEHICLE) == BST_CHECKED);
- EndDialog(Hwnd, 1);
- }
- break;
-
- case IDCANCEL:
- EndDialog(Hwnd, 0);
- break;
-
- case IDC_ASSIGN_NAMES_CHECK:
- Toggle_Name_Assignment();
- break;
-
- case IDC_ASSIGN_PREFIX_CHECK:
- EnableWindow(GetDlgItem(Hwnd,IDC_PREFIX_EDIT),(IsDlgButtonChecked(Hwnd,IDC_ASSIGN_SUFFIX_CHECK) == BST_CHECKED));
- break;
-
- case IDC_ASSIGN_SUFFIX_CHECK:
- EnableWindow(GetDlgItem(Hwnd,IDC_SUFFIX_EDIT),(IsDlgButtonChecked(Hwnd,IDC_ASSIGN_SUFFIX_CHECK) == BST_CHECKED));
- break;
-
- case IDC_ASSIGN_COLLISION_BITS_CHECK:
- Toggle_Collision_Bits_Assignment();
- break;
- }
- return 1;
- }
- return 0;
-}
-
-
-/***********************************************************************************************
- * _gen_names_dialog_proc -- dialog proc that "thunks" to the class's dialog proc *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/10/2000 gth : Created. *
- *=============================================================================================*/
-static BOOL CALLBACK _gen_names_dialog_proc(HWND hwnd,UINT message,WPARAM wparam,LPARAM lparam)
-{
- static GenNamesDialogClass * dialog = NULL;
-
- if (message == WM_INITDIALOG) {
- dialog = (GenNamesDialogClass *)lparam;
- dialog->Hwnd = hwnd;
- }
-
- if (dialog) {
- return dialog->Dialog_Proc(hwnd, message, wparam, lparam);
- } else {
- return FALSE;
- }
-}
-
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/gennamesdialog.h b/Generals/Code/Tools/WW3D/max2w3d/gennamesdialog.h
deleted file mode 100644
index 6c52343ee5b..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/gennamesdialog.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Max2W3D *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/gennamesdialog.h $*
- * *
- * Original Author:: Greg Hjelstrom *
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 12/06/00 3:25p $*
- * *
- * $Revision:: 2 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#include
-#include "w3d_file.h"
-
-
-/**********************************************************************************************
-**
-** GenNamesDialogClass - Dialog box for the node naming parameters
-**
-**********************************************************************************************/
-class GenNamesDialogClass
-{
-public:
-
- GenNamesDialogClass(Interface * maxinterface);
- ~GenNamesDialogClass();
-
- struct OptionsStruct
- {
- OptionsStruct(void) : OnlyAffectSelected(false), NameIndex(0), AssignCollisionBits(false)
- {
- memset(RootName,0,sizeof(RootName));
- memset(PrefixName,0,sizeof(PrefixName));
- memset(SuffixName,0,sizeof(SuffixName));
- }
-
- // overall options
- bool AssignNames;
- bool AssignPrefix;
- bool AssignSuffix;
- bool AssignCollisionBits;
- bool OnlyAffectSelected;
-
- // name options
- char RootName[W3D_NAME_LEN];
- char PrefixName[W3D_NAME_LEN];
- char SuffixName[W3D_NAME_LEN];
- int NameIndex;
-
- // collision bit options
- bool PhysicalCollision;
- bool ProjectileCollision;
- bool VisCollision;
- bool CameraCollision;
- bool VehicleCollision;
- };
-
- bool Get_Options(OptionsStruct * options);
- bool Dialog_Proc(HWND hWnd,UINT message,WPARAM wParam,LPARAM);
- bool Ok_To_Exit(void);
- void Toggle_Collision_Bits_Assignment(void);
- void Toggle_Name_Assignment(void);
-
-private:
-
- enum
- {
- MIN_NAME_INDEX = 0,
- MAX_NAME_INDEX = 999,
- INITIAL_NAME_INDEX = 0,
- MAX_ROOT_NAME_LEN = 10,
- MAX_PREFIX_LEN = 3,
- MAX_SUFFIX_LEN = 3,
- };
-
- HWND Hwnd;
-
- OptionsStruct * Options;
- Interface * MaxInterface;
- ISpinnerControl * NameIndexSpin;
-
- friend BOOL CALLBACK _gen_names_dialog_proc(HWND Hwnd,UINT message,WPARAM wParam,LPARAM lParam);
-
-};
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/geometryexportcontext.h b/Generals/Code/Tools/WW3D/max2w3d/geometryexportcontext.h
deleted file mode 100644
index ce86342bdf9..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/geometryexportcontext.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Max2W3D *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/geometryexportcontext.h $*
- * *
- * Original Author:: Greg Hjelstrom *
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 10/19/00 11:32a $*
- * *
- * $Revision:: 1 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#ifndef GEOMETRYEXPORTCONTEXT_H
-#define GEOMETRYEXPORTCONTEXT_H
-
-#include
-
-class ChunkSaveClass;
-class MaxWorldInfoClass;
-class HierarchySaveClass;
-class INodeListClass;
-class Progress_Meter_Class;
-struct W3dExportOptionsStruct;
-
-
-/**
-** ExportContextClass
-** This class encapsulates a bunch of datastructures needed during the geometry export
-** process.
-** NOTE: The user must plug in a valid ProgressMeter before each export operation.
-*/
-class GeometryExportContextClass
-{
-public:
- GeometryExportContextClass( char * model_name,
- ChunkSaveClass & csave,
- MaxWorldInfoClass & world_info,
- W3dExportOptionsStruct & options,
- HierarchySaveClass * htree,
- INode * origin,
- INodeListClass * origin_list,
- TimeValue curtime,
- unsigned int *materialColors
- ) :
- CSave(csave),
- WorldInfo(world_info),
- Options(options),
- CurTime(curtime),
- HTree(htree),
- OriginList(origin_list),
- Origin(origin),
- OriginTransform(1),
- ProgressMeter(NULL),
- materialColors(materialColors),
- numMaterialColors(0),
- numHouseColors(0),
- materialColorTexture(NULL)
- {
- ModelName = strdup(model_name);
- OriginTransform = Origin->GetNodeTM(CurTime);
- }
-
- ~GeometryExportContextClass(void)
- {
- delete[] ModelName;
- }
-
- char * ModelName;
- ChunkSaveClass & CSave;
- MaxWorldInfoClass & WorldInfo;
- W3dExportOptionsStruct & Options;
- TimeValue CurTime;
- HierarchySaveClass * HTree;
- INodeListClass * OriginList;
-
- INode * Origin;
- Matrix3 OriginTransform;
- Progress_Meter_Class * ProgressMeter;
- unsigned int * materialColors; ///MW: holds all used material colors.
- int numMaterialColors; ///MW: number of used material colors.
- int numHouseColors; ///MW: number of used house colors
- char * materialColorTexture; //MW: texture to hold material colors
-};
-
-
-
-#endif //GEOMETRYEXPORTCONTEXT_H
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/geometryexporttask.cpp b/Generals/Code/Tools/WW3D/max2w3d/geometryexporttask.cpp
deleted file mode 100644
index be3baf4bef0..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/geometryexporttask.cpp
+++ /dev/null
@@ -1,1176 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Max2W3D *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/geometryexporttask.cpp $*
- * *
- * Original Author:: Greg Hjelstrom *
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 10/31/00 10:35a $*
- * *
- * $Revision:: 7 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * GeometryExportTaskClass::GeometryExportTaskClass -- Constructor *
- * GeometryExportTaskClass::GeometryExportTaskClass -- Copy Constructor *
- * GeometryExportTaskClass::~GeometryExportTaskClass -- Destructor *
- * GeometryExportTaskClass::Get_Full_Name -- Composes the full name of this robj *
- * GeometryExportTaskClass::Create_Task -- virtual constructor for export tasks *
- * GeometryExportTaskClass::Optimize_Geometry -- Optimizes the export tasks *
- * GeometryExportTaskClass::Generate_Unique_Name -- create a unique name for this object *
- * MeshGeometryExportTaskClass::Is_Single_Material -- Tests if this mesh uses a single mater *
- * MeshGeometryExportTaskClass::Get_Single_Material -- returns pointer to the material *
- * MeshGeometryExportTaskClass::Cache_Single_Material -- updates the cached material pointer *
- * MeshGeometryExportTaskClass::Split -- Splits into single material meshes *
- * MeshGeometryExportTaskClass::Reduce_To_Single_Material -- deletes polys *
- * MeshGeometryExportTaskClass::Can_Combine -- can this mesh combine with anything *
- * MeshGeometryExportTaskClass::Can_Combine_With -- can this mesh be combined with the given *
- * MeshGeometryExportTaskClass::Combine_Mesh -- Add the given mesh into this mesh *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#include "geometryexporttask.h"
-#include "geometryexportcontext.h"
-#include "util.h"
-#include "w3dutil.h"
-#include "w3dappdata.h"
-#include "hiersave.h"
-#include "maxworldinfo.h"
-#include "meshsave.h"
-#include "colboxsave.h"
-#include "dazzlesave.h"
-#include
-
-
-const int OPTIMIZATION_FACECOUNT_LIMIT = 256; // TODO: what should this number be...
-const float OPTIMIZATION_COMBINING_DISTANCE = 20.0f; // TODO: need a smarter method for combining...
-
-
-/**
-** MeshGeometryExportTaskClass
-** Export task for INodes which are to generate W3D meshes
-*/
-class MeshGeometryExportTaskClass : public GeometryExportTaskClass
-{
-public:
-
- MeshGeometryExportTaskClass(INode * node,GeometryExportContextClass & context) :
- GeometryExportTaskClass(node,context),
- NameDirty(false),
- SingleMtl(NULL)
- {
- /*
- ** Copy the export options
- */
- ExportOptions = *(W3DAppData2Struct::Get_App_Data(Node));
-
- /*
- ** Copy the mesh
- */
- Object * obj = Node->EvalWorldState(CurTime).obj;
- TriObject * tri = (TriObject *)obj->ConvertToType(CurTime, triObjectClassID);
- MeshData = tri->mesh;
-
- /*
- ** Store a pointer to the material if this mesh uses only one material (even inside a Multi-Sub)
- */
- Update_Cached_Data();
- }
-
- MeshGeometryExportTaskClass(const MeshGeometryExportTaskClass & that) :
- GeometryExportTaskClass(that),
- MeshData(that.MeshData),
- ExportOptions(that.ExportOptions),
- NameDirty(false)
- {
- }
-
- virtual ~MeshGeometryExportTaskClass(void)
- {
- }
-
- virtual void Export_Geometry(GeometryExportContextClass & context)
- {
- /*
- ** Create the mesh
- */
- context.WorldInfo.Set_Current_Task(this);
- context.WorldInfo.Set_Export_Transform(ExportSpace);
-
- MeshSaveClass * mesh = new MeshSaveClass( Name,
- ContainerName,
- Node,
- &MeshData,
- ExportSpace,
- ExportOptions,
- context.HTree,
- context.CurTime,
- *context.ProgressMeter,
- context.materialColors,
- context.numMaterialColors,
- context.numHouseColors,
- context.materialColorTexture,
- &context.WorldInfo
- );
-
- /*
- ** Export It
- */
- mesh->Write_To_File(context.CSave,!context.Options.DisableExportAABTrees);
- delete mesh;
- context.ProgressMeter->Add_Increment();
- };
-
- /*
- ** Naming. During the optimization phase, sometimes new meshes are created and require
- ** new unique names. These meshes are flagged and then new names are generated prior
- ** to exporting.
- */
- bool Is_Name_Dirty(void) { return NameDirty; }
- void Set_Name_Dirty(bool onoff) { NameDirty = onoff; }
-
- /*
- ** Vertex Normal smoothing support!
- */
- virtual Point3 Get_Shared_Vertex_Normal(const Point3 & pos,int smgroup);
-
- /*
- ** Optimization functions
- */
- bool Is_Single_Material(void);
- Mtl * Get_Single_Material(void);
- void Split(DynamicVectorClass & simple_meshes);
- void Reduce_To_Single_Material(int mat_id);
- bool Can_Combine(void);
- bool Can_Combine_With(MeshGeometryExportTaskClass * other_mesh);
- void Combine_Mesh(MeshGeometryExportTaskClass * other_mesh);
-
-protected:
-
- virtual int Get_Geometry_Type(void) { return MESH; }
- void Update_Cached_Data(void);
-
- Mesh MeshData; // Copy of the mesh data to be exported.
- W3DAppData2Struct ExportOptions; // Copy of the export options in case we want to change them during optimization
- bool NameDirty;
-
- // Cached Data about the Node/Mesh. Updated by calling Update_Cached_Data whenever the mesh changes.
- Mtl * SingleMtl; // Pointer to the single material (if the mesh uses only one, even in a multi-mtl)
- Point3 BoxCenter; // Center of the bounding box (in object space)
- Point3 BoxExtent; // Extent of the bounding box (in object space)
- Box3 WorldBounds; // World-space bounding box
-};
-
-
-
-
-
-/**
-** CollisionBoxGeometryExportTaskClass
-** Export task for INodes which are to generate W3D AABoxes or OBBoxes
-*/
-class CollisionBoxGeometryExportTaskClass : public GeometryExportTaskClass
-{
-public:
- CollisionBoxGeometryExportTaskClass(INode * node,GeometryExportContextClass & context) :
- GeometryExportTaskClass(node,context)
- {
- }
-
- virtual void Export_Geometry(GeometryExportContextClass & context)
- {
- /*
- ** Create the collision box
- */
- CollisionBoxSaveClass * colbox = new CollisionBoxSaveClass( Name,
- ContainerName,
- Node,
- ExportSpace,
- context.CurTime,
- *context.ProgressMeter);
-
- /*
- ** Export it
- */
- colbox->Write_To_File(context.CSave);
- delete colbox;
- context.ProgressMeter->Add_Increment();
- };
-
-protected:
-
- virtual int Get_Geometry_Type(void) { return COLLISIONBOX; }
-
-};
-
-
-
-
-
-/**
-** DazzleGeometryExportTaskClass
-** Export task for INodes which are to generate W3D Dazzle objects
-*/
-class DazzleGeometryExportTaskClass : public GeometryExportTaskClass
-{
-public:
- DazzleGeometryExportTaskClass(INode * node,GeometryExportContextClass & context) :
- GeometryExportTaskClass(node,context)
- {
- }
-
- virtual void Export_Geometry(GeometryExportContextClass & context)
- {
- /*
- ** Create the dazzle object
- */
- DazzleSaveClass * dazzle = new DazzleSaveClass( Name,
- ContainerName,
- Node,
- ExportSpace,
- context.CurTime,
- *context.ProgressMeter);
- /*
- ** Export it.
- */
- dazzle->Write_To_File(context.CSave);
- delete dazzle;
- context.ProgressMeter->Add_Increment();
- };
-
-protected:
-
- virtual int Get_Geometry_Type(void) { return DAZZLE; }
-
-};
-
-
-
-
-/**
-** NullGeometryExportTaskClass
-** Export task for INodes which are to generate W3D NULL objects. Note that this
-** does not do anything in the Export_Geometry call, these only create entries in
-** any Hierarhcical model or collection object being exported.
-*/
-class NullGeometryExportTaskClass : public GeometryExportTaskClass
-{
-public:
- NullGeometryExportTaskClass(INode * node,GeometryExportContextClass & context) :
- GeometryExportTaskClass(node,context)
- {
- memset(ContainerName,0,sizeof(ContainerName));
- memset(Name,0,sizeof(Name));
- strcpy(Name,"NULL");
- }
-
- virtual void Export_Geometry(GeometryExportContextClass & context)
- {
- context.ProgressMeter->Add_Increment();
- };
-
-protected:
-
- virtual int Get_Geometry_Type(void) { return NULLOBJ; }
-
-};
-
-
-/**
-** AggregateGeometryExportTaskClass
-** Export task for INodes which are to generate W3D Aggregates. These are nodes
-** that refer to some external W3D object. This export task doesn't export any
-** geometry (similer to the Null export task) and it clears its container name
-** because the object to be attached is not a sub-object of the model we are
-** currently exporting.
-*/
-class AggregateGeometryExportTaskClass : public GeometryExportTaskClass
-{
-public:
- AggregateGeometryExportTaskClass(INode * node,GeometryExportContextClass & context) :
- GeometryExportTaskClass(node,context)
- {
- memset(ContainerName,0,sizeof(ContainerName));
- }
-
- virtual void Export_Geometry(GeometryExportContextClass & context)
- {
- context.ProgressMeter->Add_Increment();
- };
-
- virtual bool Is_Aggregate(void)
- {
- return true;
- }
-
-protected:
-
- virtual int Get_Geometry_Type(void) { return AGGREGATE; }
-
-};
-
-
-/**
-** ProxyExportTaskClass
-** These are used by the Renegade Level Editor to cause game objects to be
-** instantiated at the specified transform. Like aggregates they have to
-** be handled specially and therefore have the Is_Proxy member function devoted
-** solely to them :-) Hopefully we don't have any more geometry types which
-** have to be handled specially or this is going to get messy again.
-*/
-class ProxyExportTaskClass : public GeometryExportTaskClass
-{
-public:
-
- ProxyExportTaskClass(INode * node,GeometryExportContextClass & context) :
- GeometryExportTaskClass(node,context)
- {
- /*
- ** clear the container name
- */
- memset(ContainerName,0,sizeof(ContainerName));
-
- /*
- ** strip the trailing ~
- */
- char *tilda = ::strchr(Name, '~');
- memset(tilda,0,sizeof(Name) - ((int)tilda - (int)Name));
-
- }
-
- virtual void Export_Geometry(GeometryExportContextClass & context)
- {
- context.ProgressMeter->Add_Increment();
- };
-
- virtual bool Is_Proxy(void) { return true; }
-
-protected:
-
- virtual int Get_Geometry_Type(void) { return PROXY; }
-
-};
-
-
-
-
-
-/***********************************************************************************************
-**
-** Implementations
-**
-***********************************************************************************************/
-
-/***********************************************************************************************
- * GeometryExportTaskClass::GeometryExportTaskClass -- Constructor *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/20/2000 gth : Created. *
- *=============================================================================================*/
-GeometryExportTaskClass::GeometryExportTaskClass(INode * node,GeometryExportContextClass & context) :
- BoneIndex(0),
- ExportSpace(1),
- CurTime(context.CurTime),
- Node(node)
-{
- /*
- ** Set up the names
- */
- Set_W3D_Name(Name,Node->GetName());
- Append_Lod_Character(Name,Get_Lod_Level(context.Origin),context.OriginList);
- Set_W3D_Name(ContainerName,context.ModelName);
-
- /*
- ** Set up the bone index and export coordinate system.
- */
- if (context.HTree != NULL) {
- if (!Is_Skin(node)) {
- context.HTree->Get_Export_Coordinate_System(Node,&BoneIndex,NULL,&ExportSpace);
- } else {
- BoneIndex = 0;
- ExportSpace = context.OriginTransform;
- }
- }
-}
-
-
-/***********************************************************************************************
- * GeometryExportTaskClass::GeometryExportTaskClass -- Copy Constructor *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/20/2000 gth : Created. *
- *=============================================================================================*/
-GeometryExportTaskClass::GeometryExportTaskClass(const GeometryExportTaskClass & that) :
- BoneIndex(that.BoneIndex),
- ExportSpace(that.ExportSpace),
- CurTime(that.CurTime),
- Node(that.Node)
-{
- Set_W3D_Name(Name,that.Name);
- Set_W3D_Name(ContainerName,that.ContainerName);
-}
-
-
-/***********************************************************************************************
- * GeometryExportTaskClass::~GeometryExportTaskClass -- Destructor *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- *=============================================================================================*/
-GeometryExportTaskClass::~GeometryExportTaskClass(void)
-{
-}
-
-
-/***********************************************************************************************
- * GeometryExportTaskClass::Get_Full_Name -- Composes the full name of this robj *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/24/2000 gth : Created. *
- *=============================================================================================*/
-void GeometryExportTaskClass::Get_Full_Name(char * buffer,int size)
-{
- char tmp[128];
- memset(tmp,0,sizeof(tmp));
- if (strlen(ContainerName) > 0) {
- strcat(tmp,ContainerName);
- strcat(tmp,".");
- }
- strcat(tmp,Name);
-
- strncpy(buffer,tmp,size);
-}
-
-
-/***********************************************************************************************
- * GeometryExportTaskClass::Create_Task -- virtual constructor for export tasks *
- * *
- * Virtual constructor for geometry export tasks. Will create the proper task *
- * type depending on the W3D flag settings. *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/20/2000 gth : Created. *
- *=============================================================================================*/
-GeometryExportTaskClass *
-GeometryExportTaskClass::Create_Task(INode * node,GeometryExportContextClass & context)
-{
- if (!::Is_Geometry(node)) {
- return NULL;
- }
-
- // NOTE: we *have* to check Is_Proxy first because it is tied to a naming convention
- // rather than an explicit UI setting like the rest of the types.
- if (::Is_Proxy(*node)) {
- return new ProxyExportTaskClass(node,context);
- }
-
- if (::Is_Normal_Mesh(node) || Is_Camera_Aligned_Mesh(node) || Is_Camera_Oriented_Mesh(node) || Is_Skin(node)) {
- return new MeshGeometryExportTaskClass(node,context);
- }
-
- if (::Is_Collision_AABox(node) || Is_Collision_OBBox(node)) {
- return new CollisionBoxGeometryExportTaskClass(node,context);
- }
-
- if (::Is_Null_Object(node)) {
- return new NullGeometryExportTaskClass(node,context);
- }
-
- if (::Is_Dazzle(node)) {
- return new DazzleGeometryExportTaskClass(node,context);
- }
-
- if (::Is_Aggregate(node)) {
- return new AggregateGeometryExportTaskClass(node,context);
- }
-
- return NULL;
-}
-
-
-/***********************************************************************************************
- * GeometryExportTaskClass::Optimize_Geometry -- Optimizes the export tasks *
- * *
- * This function will attempt to split meshes so that they use only a single material and *
- * then try to combine small meshes that use the same material. Export tasks may be *
- * removed and new ones added. *
- * *
- * INPUT: *
- * tasks - dynamic vector of export task pointers. Some tasks may be deleted, some added *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/20/2000 gth : Created. *
- *=============================================================================================*/
-void GeometryExportTaskClass::Optimize_Geometry
-(
- DynamicVectorClass & tasks,
- GeometryExportContextClass & context
-)
-{
- int j=0,i=0;
-
- /*
- ** Pass 1: Extract all mesh geometry tasks from the input task array.
- ** NOTE: We're not optimizing Skin meshes so we leave them in the task array.
- */
- DynamicVectorClass meshes;
- while (iGet_Geometry_Type() == GeometryExportTaskClass::MESH) &&
- (!Is_Skin(tasks[i]->Get_Object_Node())) )
- {
- /*
- ** Add to the mesh array, remove from the tasks array
- */
- meshes.Add((MeshGeometryExportTaskClass *)(tasks[i]));
- tasks.Delete(i);
- } else {
-
- /*
- ** Leave in the task array and move to the next one.
- */
- i++;
- }
- }
-
- /*
- ** Pass 2: Split all meshes which use more than one material
- */
- DynamicVectorClass simple_meshes;
- while (meshes.Count() > 0) {
-
- int cur_index = meshes.Count() - 1;
- MeshGeometryExportTaskClass * cur_mesh = meshes[cur_index];
-
- /*
- ** If this mesh already uses only one material, just transfer it to the simple_meshes array.
- ** Otherwise, have it split into new tasks, add them to the simple_meshes array, and delete this task.
- */
- if (cur_mesh->Is_Single_Material()) {
- simple_meshes.Add(cur_mesh);
- } else {
- cur_mesh->Split(simple_meshes);
- delete cur_mesh;
- }
- meshes.Delete(cur_index);
- }
-
- /*
- ** Pass 3: Combine meshes which satisfy the following
- ** - They use the same (single) material
- ** - They have fewer than 'x' polygons
- ** - They are 'close' to each other
- */
- i=0;
- while (i < simple_meshes.Count()) {
-
- if (simple_meshes[i]->Can_Combine()) {
-
- j=i+1;
- while (j < simple_meshes.Count()) {
- if (simple_meshes[i]->Can_Combine_With(simple_meshes[j])) {
-
- /*
- ** Add mesh 'j' into mesh 'i', delete its task.
- */
- simple_meshes[i]->Combine_Mesh(simple_meshes[j]);
- delete simple_meshes[j];
- simple_meshes.Delete(j);
-
- /*
- ** If we've just exceeded the max poly count, move to the next mesh
- */
- if (simple_meshes[i]->Can_Combine() == false) {
- j = simple_meshes.Count();
- }
-
- } else {
-
- /*
- ** Otherwise, move to the next mesh
- */
- j++;
- }
- }
- }
- i++;
- }
-
-
-
- /*
- ** Generate names for each of the meshes that were created
- */
- for (i=0; iIs_Name_Dirty()) {
- simple_meshes[i]->Generate_Name("MESH",i,context);
-// }
- }
-
- /*
- ** Finally, transfer all of the optimized tasks into the big task array
- */
- for (i=0; iGetMtl();
-
- /*
- ** Set the SingleMtl pointer if this mesh uses only one material (again, even if its in a Multi-Sub)
- */
- if (nodemtl == NULL) {
-
- SingleMtl = NULL;
-
- } else if (nodemtl->NumSubMtls() <= 1) {
-
- SingleMtl = nodemtl;
-
- } else {
-
- int mat_index;
- int face_index;
- int sub_mtl_count = nodemtl->NumSubMtls();
- bool * sub_mtl_flags = new bool[sub_mtl_count];
-
- /*
- ** Initialize each sub-material flag to false (indicates that the material is un-used)
- */
- for (mat_index=0; mat_indexGetSubMtl(mat_index);
- mat_count++;
- }
- }
-
- if (mat_count > 1) {
- SingleMtl = NULL;
- }
- }
-
- /*
- ** Update the bounding box
- */
- Point3 boxmin(0,0,0);
- Point3 boxmax(0,0,0);
-
- if (MeshData.numVerts > 0) {
- boxmin = MeshData.verts[1];
- boxmax = MeshData.verts[0];
- for (int i=0; iGetObjectTM(CurTime);
-}
-
-
-/***********************************************************************************************
- * MeshGeometryExportTaskClass::Is_Single_Material -- Tests if this mesh uses a single materia *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/20/2000 gth : Created. *
- *=============================================================================================*/
-bool MeshGeometryExportTaskClass::Is_Single_Material(void)
-{
- return ((SingleMtl != NULL) || (Node->GetMtl() == NULL));
-}
-
-
-/***********************************************************************************************
- * MeshGeometryExportTaskClass::Get_Single_Material -- returns pointer to the material *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/23/2000 gth : Created. *
- *=============================================================================================*/
-Mtl* MeshGeometryExportTaskClass::Get_Single_Material(void)
-{
- return SingleMtl;
-}
-
-/***********************************************************************************************
- * MeshGeometryExportTaskClass::Split -- Splits into single material meshes *
- * *
- * This function will create new export tasks and add them to the supplied array. Each of *
- * these will be single-material meshes. *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/20/2000 gth : Created. *
- *=============================================================================================*/
-void MeshGeometryExportTaskClass::Split(DynamicVectorClass & simple_meshes)
-{
- assert(!Is_Single_Material());
-
- Mtl * nodemtl = Node->GetMtl();
-
- int mat_index;
- int face_index;
- int sub_mtl_count = nodemtl->NumSubMtls();
- bool * sub_mtl_flags = new bool[sub_mtl_count];
-
- /*
- ** Initialize each sub-material flag to false (indicates that the material is un-used)
- */
- for (mat_index=0; mat_indexReduce_To_Single_Material(mat_index);
- new_task->Set_Name_Dirty(true);
- simple_meshes.Add(new_task);
-
- }
- }
-}
-
-
-/***********************************************************************************************
- * MeshGeometryExportTaskClass::Reduce_To_Single_Material -- deletes polys *
- * *
- * This function deletes all polys (and subsequent un-used vertices) except for the ones *
- * that use the specified material. *
- * *
- * INPUT: *
- * mat_id - only faces using this material id will remain in the mesh. *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/20/2000 gth : Created. *
- *=============================================================================================*/
-void MeshGeometryExportTaskClass::Reduce_To_Single_Material(int mat_id)
-{
- int sub_mtl_count = Node->GetMtl()->NumSubMtls();
-
- BitArray faces_to_delete(MeshData.getNumFaces());
- BitArray verts_to_delete(MeshData.getNumVerts());
-
- faces_to_delete.ClearAll();
- verts_to_delete.ClearAll();
-
- for (int i=0; i OPTIMIZATION_FACECOUNT_LIMIT) {
- return false;
- }
- if (ExportOptions.Is_Vis_Collision_Enabled()) {
- return false;
- }
- return true;
-}
-
-
-/***********************************************************************************************
- * MeshGeometryExportTaskClass::Can_Combine_With -- can this mesh be combined with the given m *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/24/2000 gth : Created. *
- *=============================================================================================*/
-bool MeshGeometryExportTaskClass::Can_Combine_With(MeshGeometryExportTaskClass * other_mesh)
-{
- /*
- ** Does the mesh attach to the same W3D bone that we do?
- */
- if (other_mesh->BoneIndex != BoneIndex) {
- return false;
- }
-
- /*
- ** Does the mesh use the same (single) material that we do?
- */
- Mtl * other_mtl = other_mesh->Get_Single_Material();
- if (other_mtl == NULL) {
- return false;
- }
-
- Mtl * my_mtl = Get_Single_Material();
- if (my_mtl != other_mtl) {
- return false;
- }
-
- /*
- ** Are its relevant W3D options the same as ours?
- */
- if (ExportOptions.Geometry_Options_Match(other_mesh->ExportOptions)) {
- return false;
- }
-
- /*
- ** Would our combined polygon count be reasonable
- */
- if (MeshData.numFaces + other_mesh->MeshData.numFaces > OPTIMIZATION_FACECOUNT_LIMIT) {
- return false;
- }
-
- /*
- ** Is the other mesh near me?
- */
- Point3 my_center = Node->GetObjectTM(CurTime) * BoxCenter;
- Point3 other_center = other_mesh->Node->GetObjectTM(CurTime) * BoxCenter;
- float dist = ::FLength(my_center - other_center);
- if (dist > OPTIMIZATION_COMBINING_DISTANCE) {
- return false;
- }
-
- return true;
-}
-
-
-/***********************************************************************************************
- * MeshGeometryExportTaskClass::Combine_Mesh -- Add the given mesh into this mesh *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/24/2000 gth : Created. *
- *=============================================================================================*/
-void MeshGeometryExportTaskClass::Combine_Mesh(MeshGeometryExportTaskClass * other_mesh)
-{
- /*
- ** Compute the transform from other_mesh's coordinate system to ours so that
- ** its polygons can be combined with ours (by calling CombineMeshes)
- */
- Matrix3 our_tm = Node->GetObjectTM(CurTime);
- Matrix3 his_tm = other_mesh->Node->GetObjectTM(CurTime);
- Matrix3 tm = Inverse(our_tm) * his_tm;
-
- /*
- ** Store our current material index
- */
- int matid = MeshData.faces[0].getMatID();
- if (Node->GetMtl()->NumSubMtls() > 1) {
- matid = matid % Node->GetMtl()->NumSubMtls();
- }
-
- /*
- ** Combine the meshes
- */
- Mesh new_mesh;
- ::CombineMeshes(new_mesh,MeshData,other_mesh->MeshData,&our_tm,&his_tm,0);
- MeshData = new_mesh;
-
- /*
- ** Set all material ID's
- */
- for (int i=0; iGetObjectTM(CurTime);
- Point3 obj_pos = world_pos * Inverse(tm);
-
- /*
- ** Loop through all the faces in this mesh and find out which ones
- ** share the same smoothing group as the vertex we are looking for.
- */
- for (int face_index = 0; face_index < MeshData.numFaces; face_index ++) {
- Face &maxface = MeshData.faces[face_index];
- int face_smgroup = maxface.getSmGroup();
- if ((face_smgroup & smgroup) || (face_smgroup == smgroup)) {
-
- /*
- ** Find out if any of the verticies of this face share the
- ** same space as the vertex we are looking for.
- */
- bool found = false;
- for (int vert_index = 0; (vert_index < 3) && !found; vert_index ++) {
- int max_vert_index = maxface.v[vert_index];
- Point3 delta = obj_pos - MeshData.verts[max_vert_index];
- if ((fabs (delta.x) < EPSILON) &&
- (fabs (delta.y) < EPSILON) &&
- (fabs (delta.z) < EPSILON))
- {
-
- /*
- ** Compute the normal for this face
- */
- Point3 v0 = MeshData.verts[maxface.v[0]];
- Point3 v1 = MeshData.verts[maxface.v[1]];
- Point3 v2 = MeshData.verts[maxface.v[2]];
- Point3 face_normal = (v1-v0)^(v2-v1);
- face_normal = ::Normalize(face_normal);
-
- /*
- ** Add this face normal to the sum
- */
- normal.x += face_normal.x;
- normal.y += face_normal.y;
- normal.z += face_normal.z;
-
- /*
- ** Done with this face, look for more
- */
- found = true;
- }
- }
- }
- }
-
- /*
- ** Transform the "normal" to world space. Note that this vector isn't
- ** normalized because we are basically summing the contributions of each
- ** face in each mesh which shares this normal. The final normal
- ** will be normalized in the MeshBuilderClass.
- */
- tm.NoTrans();
- normal = tm.PointTransform(normal);
- }
-
- return normal;
-}
diff --git a/Generals/Code/Tools/WW3D/max2w3d/geometryexporttask.h b/Generals/Code/Tools/WW3D/max2w3d/geometryexporttask.h
deleted file mode 100644
index 36114cd7e23..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/geometryexporttask.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Max2W3d *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/geometryexporttask.h $*
- * *
- * Original Author:: Greg Hjelstrom *
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 10/27/00 5:00p $*
- * *
- * $Revision:: 6 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#ifndef GEOMETRYEXPORTTASK_H
-#define GEOMETRYEXPORTTASK_H
-
-#include
-#include
-#include "w3d_file.h"
-#include "Vector.H"
-
-
-class GeometryExportContextClass;
-
-
-/**
-** GeometryExportTaskClass
-** This abstract base class defines the interface for a geometry export task.
-** Derived classes will encapsulate the job of exporting meshes, collision
-** boxes, dazzles, etc. The factory function Create_Task will create the
-** appropriate task for a given INode.
-*/
-class GeometryExportTaskClass
-{
-public:
-
- GeometryExportTaskClass(INode * node,GeometryExportContextClass & context);
- GeometryExportTaskClass(const GeometryExportTaskClass & that);
- virtual ~GeometryExportTaskClass(void);
-
- virtual void Export_Geometry(GeometryExportContextClass & context) = 0;
-
- /*
- ** Accessors
- */
- char * Get_Name(void) { return Name; }
- char * Get_Container_Name(void) { return ContainerName; }
- void Get_Full_Name(char * buffer,int size);
-
- int Get_Bone_Index(void) { return BoneIndex; }
- INode * Get_Object_Node(void) { return Node; }
- Matrix3 Get_Export_Transform(void) { return ExportSpace; }
-
- void Set_Name(char * name) { strncpy(Name,name,sizeof(Name)); }
- void Set_Container_Name(char * name) { strncpy(ContainerName,name,sizeof(ContainerName)); }
- /*
- ** Unique Name generation. During optimization, new meshes may get created. When this happens,
- ** we have to create a unique name for each one. The name will be generated from the original
- ** mesh's name, the index passed in, and the LOD level of the original mesh.
- */
- void Generate_Name(char * root,int index,GeometryExportContextClass & context);
-
-
- /*
- ** Get vertex normal. This function should return the normal of a vertex at the
- ** specified x,y,z and smoothing_group if one exists. It is used in the algorithm which
- ** smooths the vertex normals on the boundaries of meshes.
- */
- virtual Point3 Get_Shared_Vertex_Normal(const Point3 & world_space_point,int smgroup) { return Point3(0,0,0); }
-
- /*
- ** Aggregate Model Detection. An "aggregate" is an external W3D model that we are requesting
- ** to be attached to a bone in the model being exported. In order for our LOD system to work
- ** properly, some special handling of aggregates is required (they must be added into the model
- ** as "additional models" rather than being placed in the normal LOD arrays). This virtual
- ** can be used to detect "aggregate" models.
- */
- virtual bool Is_Aggregate(void) { return false; }
-
- /*
- ** Proxy Detection. A "proxy" is a reference (by name) to an external game object that should
- ** be instantiated at the specified transform. Like the aggregates, these had to unfortunately
- ** be handled with special cases and therefore have this virtual function devoted solely to them.
- */
- virtual bool Is_Proxy(void) { return false; }
-
- /*
- ** Virtual Constructor
- */
- static GeometryExportTaskClass * Create_Task(INode * node,GeometryExportContextClass & context);
-
- /*
- ** Pre-Export Optimization of a set of geometry export tasks. This does things like
- ** separating multi-material meshes, combining small meshes which are nearby and use the
- ** same material, etc.
- */
- static void Optimize_Geometry( DynamicVectorClass & tasks,
- GeometryExportContextClass & context );
-
-protected:
-
- /*
- ** Internal RTTI
- */
- enum
- {
- MESH = 0,
- COLLISIONBOX,
- DAZZLE,
- NULLOBJ,
- AGGREGATE,
- PROXY,
- };
- virtual int Get_Geometry_Type(void) = 0;
-
-protected:
-
- char Name[W3D_NAME_LEN];
- char ContainerName[W3D_NAME_LEN];
- int BoneIndex;
-
- Matrix3 ExportSpace;
- TimeValue CurTime;
- INode * Node;
-};
-
-
-
-#endif //GEOMETRYEXPORTTASK_H
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/gmtldlg.cpp b/Generals/Code/Tools/WW3D/max2w3d/gmtldlg.cpp
deleted file mode 100644
index e7d393341c0..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/gmtldlg.cpp
+++ /dev/null
@@ -1,1235 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/* $Header: /Commando/Code/Tools/max2w3d/gmtldlg.cpp 18 5/27/98 8:34a Greg_h $ */
-/***********************************************************************************************
- *** Confidential - Westwood Studios ***
- ***********************************************************************************************
- * *
- * Project Name : Commando / G 3D engine *
- * *
- * File Name : GMTLDLG.CPP *
- * *
- * Programmer : Greg Hjelstrom *
- * *
- * Start Date : 06/26/97 *
- * *
- * Last Update : June 26, 1997 [GH] *
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * GameMtlDlg::GameMtlDlg -- constructor *
- * GameMtlDlg::~GameMtlDlg -- destructor! *
- * GameMtlDlg::ClassID -- Returns the ClassID of GameMtl *
- * GameMtlDlg::Invalidate -- causes the dialog to be redrawn *
- * GameMtlDlg::ReloadDialog -- Updates the values in all of the dialog's controls *
- * GameMtlDlg::SetTime -- Sets the time value, updates the material and the dialog *
- * GameMtlDlg::PanelProc -- Windows Message handler *
- * PanelDlgProc -- Windows Proc which thunks into GameMtlDlg::PanelProc *
- * GameMtlDlg::LoadDialog -- Sets the state of all of the dialog's controls *
- * GameMtlDlg::UpdateMtlDisplay -- Informs MAX that the material parameters have changed *
- * GameMtlDlg::ActivateDlg -- Activates and deactivates the dialog *
- * GameMtlDlg::SetThing -- Sets the material to be edited *
- * GameMtlDlg::BuildDialog -- Adds the dialog to the material editor *
- * GameMtlDlg::UpdateTexmapDisplay -- Updates the texture map buttons *
- * NotesDlgProc -- Dialog Proc which thunks to GameMtlDlg::NotesProc *
- * GameMtlDlg::NotesProc -- Dialog Proc for the Notes panel *
- * HintsDlgProc -- Dialog proc which thunks to GameMtlDlg::HintsProc *
- * GameMtlDlg::HintsProc -- Dialog Proc for the hints panel *
- * GameMtlDlg::PsxProc -- Dialog proc for the PSX options panel *
- * PsxDlgProc -- Dialog proc which thunks into GameMtlDlg::PsxProc *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#include
-#include
-#include
-#include
-
-#include "gmtldlg.h"
-#include "gamemtl.h"
-#include "gamemaps.h"
-#include "dllmain.h"
-#include "resource.h"
-#include "w3d_file.h"
-
-
-
-static inline float PcToFrac(int pc)
-{
- return (float)pc/100.0f;
-}
-
-static inline int FracToPc(float f)
-{
- if (f<0.0) return (int)(100.0f*f - .5f);
- else return (int) (100.0f*f + .5f);
-}
-
-
-/***********************************************************************************************
- * GameMtlDlg::GameMtlDlg -- constructor *
- * *
- * INPUT: *
- * hwMtlEdit - windows handle of the MAX material editor *
- * imp - Interface object for MAX materials and textures *
- * m - pointer to a GameMtl to be edited *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 06/26/1997 GH : Created. *
- *=============================================================================================*/
-GameMtlDlg::GameMtlDlg(HWND hwMtlEdit, IMtlParams *imp, GameMtl *m)
-{
- HwndEdit = hwMtlEdit;
- HwndPanel = NULL;
- HwndHints = NULL;
- HwndPsx = NULL;
- HwndNotes = NULL;
- HpalOld = NULL;
-
- TheMtl = m;
- IParams = imp;
- Valid = FALSE;
- IsActive = 0;
- InstCopy = FALSE;
-
- DiffuseSwatch = NULL;
- SpecularSwatch = NULL;
-
- AmbientCoeffSwatch = NULL;
- DiffuseCoeffSwatch = NULL;
- SpecularCoeffSwatch = NULL;
- EmissiveCoeffSwatch = NULL;
-
- DCTFramesSpin = NULL;
- DITFramesSpin = NULL;
- SCTFramesSpin = NULL;
- SITFramesSpin = NULL;
-
- DCTRateSpin = NULL;
- DITRateSpin = NULL;
- SCTRateSpin = NULL;
- SITRateSpin = NULL;
-
- OpacitySpin = NULL;
- TranslucencySpin = NULL;
- ShininessSpin = NULL;
- FogSpin = NULL;
-}
-
-/***********************************************************************************************
- * GameMtlDlg::~GameMtlDlg -- destructor! *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 06/26/1997 GH : Created. *
- *=============================================================================================*/
-GameMtlDlg::~GameMtlDlg()
-{
- if (DiffuseSwatch) {
- ReleaseIColorSwatch(DiffuseSwatch);
- DiffuseSwatch = NULL;
- }
-
- if (SpecularSwatch) {
- ReleaseIColorSwatch(SpecularSwatch);
- SpecularSwatch = NULL;
- }
-
- if (AmbientCoeffSwatch) {
- ReleaseIColorSwatch(AmbientCoeffSwatch);
- AmbientCoeffSwatch = NULL;
- }
-
- if (DiffuseCoeffSwatch) {
- ReleaseIColorSwatch(DiffuseCoeffSwatch);
- DiffuseCoeffSwatch = NULL;
- }
-
- if (SpecularCoeffSwatch) {
- ReleaseIColorSwatch(SpecularCoeffSwatch);
- SpecularCoeffSwatch = NULL;
- }
-
- if (EmissiveCoeffSwatch) {
- ReleaseIColorSwatch(EmissiveCoeffSwatch);
- EmissiveCoeffSwatch = NULL;
- }
-
- if (HwndPanel) {
- HDC hdc = GetDC(HwndPanel);
- GetGPort()->RestorePalette(hdc, HpalOld);
- ReleaseDC(HwndPanel,hdc);
- }
-
- TheMtl->SetFlag(GAMEMTL_ROLLUP1_OPEN,IParams->IsRollupPanelOpen(HwndPanel));
- TheMtl->SetFlag(GAMEMTL_ROLLUP2_OPEN,IParams->IsRollupPanelOpen(HwndPsx));
- TheMtl->SetFlag(GAMEMTL_ROLLUP3_OPEN,IParams->IsRollupPanelOpen(HwndHints));
- TheMtl->SetFlag(GAMEMTL_ROLLUP4_OPEN,IParams->IsRollupPanelOpen(HwndNotes));
- TheMtl->RollScroll = IParams->GetRollupScrollPos();
- TheMtl->SetParamDlg(NULL);
-
- IParams->UnRegisterDlgWnd(HwndPanel);
- IParams->DeleteRollupPage(HwndPanel);
- HwndPanel = NULL;
-
- IParams->UnRegisterDlgWnd(HwndPsx);
- IParams->DeleteRollupPage(HwndPsx);
- HwndPsx = NULL;
-
- IParams->UnRegisterDlgWnd(HwndHints);
- IParams->DeleteRollupPage(HwndHints);
- HwndHints = NULL;
-
- IParams->UnRegisterDlgWnd(HwndNotes);
- IParams->DeleteRollupPage(HwndNotes);
- HwndNotes = NULL;
-}
-
-
-/***********************************************************************************************
- * GameMtlDlg::ClassID -- Returns the ClassID of GameMtl *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 06/26/1997 GH : Created. *
- *=============================================================================================*/
-Class_ID GameMtlDlg::ClassID()
-{
- return GameMaterialClassID;
-}
-
-/***********************************************************************************************
- * GameMtlDlg::Invalidate -- causes the dialog to be redrawn *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 06/26/1997 GH : Created. *
- *=============================================================================================*/
-void GameMtlDlg::Invalidate()
-{
- Valid = FALSE;
- InvalidateRect(HwndPanel,NULL,0);
- InvalidateRect(HwndPsx,NULL,0);
- InvalidateRect(HwndHints,NULL,0);
- InvalidateRect(HwndNotes,NULL,0);
-}
-
-/***********************************************************************************************
- * GameMtlDlg::ReloadDialog -- Updates the values in all of the dialog's controls *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 06/26/1997 GH : Created. *
- *=============================================================================================*/
-void GameMtlDlg::ReloadDialog()
-{
- Interval v;
- TheMtl->Update(IParams->GetTime(),v);
- LoadDialog(FALSE);
-}
-
-/***********************************************************************************************
- * GameMtlDlg::SetTime -- Sets the time value, updates the material and the dialog *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 06/26/1997 GH : Created. *
- *=============================================================================================*/
-void GameMtlDlg::SetTime(TimeValue t)
-{
- if (t!=CurTime) {
- CurTime = t;
- Interval v;
- TheMtl->Update(IParams->GetTime(),v);
- LoadDialog(TRUE);
- }
-}
-
-
-/***********************************************************************************************
- * GameMtlDlg::PanelProc -- Windows Message handler *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 06/26/1997 GH : Created. *
- *=============================================================================================*/
-BOOL GameMtlDlg::PanelProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam )
-{
- int id = LOWORD(wParam);
- int code = HIWORD(wParam);
- int mtype;
-
- switch (msg) {
-
- case WM_INITDIALOG:
- {
- HDC theHDC = GetDC(hwndDlg);
- HpalOld = GetGPort()->PlugPalette(theHDC);
- ReleaseDC(hwndDlg,theHDC);
-
- DiffuseSwatch = GetIColorSwatch(GetDlgItem(hwndDlg, IDC_DIFFUSE_COLOR),TheMtl->GetDiffuse(),Get_String(IDS_DIFFUSE_COLOR));
- SpecularSwatch = GetIColorSwatch(GetDlgItem(hwndDlg, IDC_SPECULAR_COLOR),TheMtl->GetSpecular(),Get_String(IDS_SPECULAR_COLOR));
-
- AmbientCoeffSwatch = GetIColorSwatch(GetDlgItem(hwndDlg, IDC_AMBIENT_COEFF),TheMtl->GetAmbientCoeff(),Get_String(IDS_AMBIENT_COEFF));
- DiffuseCoeffSwatch = GetIColorSwatch(GetDlgItem(hwndDlg, IDC_DIFFUSE_COEFF),TheMtl->GetDiffuseCoeff(),Get_String(IDS_DIFFUSE_COEFF));
- SpecularCoeffSwatch = GetIColorSwatch(GetDlgItem(hwndDlg, IDC_SPECULAR_COEFF),TheMtl->GetSpecularCoeff(),Get_String(IDS_SPECULAR_COEFF));
- EmissiveCoeffSwatch = GetIColorSwatch(GetDlgItem(hwndDlg, IDC_EMISSIVE_COEFF),TheMtl->GetEmissiveCoeff(),Get_String(IDS_EMISSIVE_COEFF));
-
- DCTFramesSpin = SetupIntSpinner(hwndDlg,IDC_DCT_FRAMES_SPIN,IDC_DCT_FRAMES_EDIT,1,999,TheMtl->DCTFrames);
- DITFramesSpin = SetupIntSpinner(hwndDlg,IDC_DIT_FRAMES_SPIN,IDC_DIT_FRAMES_EDIT,1,999,TheMtl->DITFrames);
- SCTFramesSpin = SetupIntSpinner(hwndDlg,IDC_SCT_FRAMES_SPIN,IDC_SCT_FRAMES_EDIT,1,999,TheMtl->SCTFrames);
- SITFramesSpin = SetupIntSpinner(hwndDlg,IDC_SIT_FRAMES_SPIN,IDC_SIT_FRAMES_EDIT,1,999,TheMtl->SITFrames);
-
- DCTRateSpin = SetupFloatSpinner(hwndDlg,IDC_DCT_RATE_SPIN,IDC_DCT_RATE_EDIT,0.0f,60.0f,TheMtl->DCTFrameRate,5.0f);
- DITRateSpin = SetupFloatSpinner(hwndDlg,IDC_DIT_RATE_SPIN,IDC_DIT_RATE_EDIT,0.0f,60.0f,TheMtl->DITFrameRate,5.0f);
- SCTRateSpin = SetupFloatSpinner(hwndDlg,IDC_SCT_RATE_SPIN,IDC_SCT_RATE_EDIT,0.0f,60.0f,TheMtl->SCTFrameRate,5.0f);
- SITRateSpin = SetupFloatSpinner(hwndDlg,IDC_SIT_RATE_SPIN,IDC_SIT_RATE_EDIT,0.0f,60.0f,TheMtl->SITFrameRate,5.0f);
-
- OpacitySpin = SetupFloatSpinner(hwndDlg,IDC_OPACITY_SPIN,IDC_OPACITY_EDIT,0.0f,1.0f,TheMtl->GetOpacity(),0.01f);
- TranslucencySpin = SetupFloatSpinner(hwndDlg,IDC_TRANSLUCENCY_SPIN,IDC_TRANSULCENCY_EDIT,0.0f,1.0f,TheMtl->GetTranslucency(),0.01f);
- ShininessSpin = SetupFloatSpinner(hwndDlg,IDC_SHININESS_SPIN,IDC_SHININESS_EDIT,1.0f,1000.0f,TheMtl->GetShininess(),1.0f);
- FogSpin = SetupFloatSpinner(hwndDlg,IDC_FOG_SPIN,IDC_FOG_EDIT,0.0f,1.0f,TheMtl->FogCoeff,0.01f);
-
- SendDlgItemMessage( hwndDlg, IDC_DCT_MAPPING_COMBO, CB_ADDSTRING, 0, (LPARAM) (LPCTSTR) Get_String(IDS_UV_MAPPING));
- SendDlgItemMessage( hwndDlg, IDC_DCT_MAPPING_COMBO, CB_ADDSTRING, 0, (LPARAM) (LPCTSTR) Get_String(IDS_ENVIRONMENT_MAPPING) );
-
- SendDlgItemMessage( hwndDlg, IDC_DIT_MAPPING_COMBO, CB_ADDSTRING, 0, (LPARAM) (LPCTSTR) Get_String(IDS_UV_MAPPING));
- SendDlgItemMessage( hwndDlg, IDC_DIT_MAPPING_COMBO, CB_ADDSTRING, 0, (LPARAM) (LPCTSTR) Get_String(IDS_ENVIRONMENT_MAPPING) );
-
- SendDlgItemMessage( hwndDlg, IDC_SCT_MAPPING_COMBO, CB_ADDSTRING, 0, (LPARAM) (LPCTSTR) Get_String(IDS_UV_MAPPING));
- SendDlgItemMessage( hwndDlg, IDC_SCT_MAPPING_COMBO, CB_ADDSTRING, 0, (LPARAM) (LPCTSTR) Get_String(IDS_ENVIRONMENT_MAPPING) );
-
- SendDlgItemMessage( hwndDlg, IDC_SIT_MAPPING_COMBO, CB_ADDSTRING, 0, (LPARAM) (LPCTSTR) Get_String(IDS_UV_MAPPING));
- SendDlgItemMessage( hwndDlg, IDC_SIT_MAPPING_COMBO, CB_ADDSTRING, 0, (LPARAM) (LPCTSTR) Get_String(IDS_ENVIRONMENT_MAPPING) );
-
- /* Installing a windproc for texmap buttons which will handle drag-n-drop
- HWND hw = GetDlgItem(hwndDlg, texMapID[i]);
- WNDPROC oldp = (WNDPROC)GetWindowLong(hw, GWL_WNDPROC);
- SetWindowLong( hw, GWL_WNDPROC, (LONG)TexSlotWndProc);
- SetWindowLong( hw, GWL_USERDATA, (LONG)oldp);
- */
-
- return TRUE;
- }
- break;
-
- case WM_COMMAND:
- {
- switch (id) {
-
- case IDC_DCT_BUTTON:
- {
- BitmapInfo bmi;
- BitmapTex * texture;
-
- if (TheManager->SelectFileInput(&bmi, HwndEdit)) {
- texture = NewDefaultBitmapTex();
- if (texture) {
- texture->SetMapName((char *)bmi.Name());
- TheMtl->SetSubTexmap(ID_DI,texture);
- UpdateMtlDisplay();
- TheMtl->NotifyChanged();
- }
- }
- }
- break;
-
- case IDC_DIT_BUTTON:
- {
- BitmapInfo bmi;
- BitmapTex * texture;
-
- if (TheManager->SelectFileInput(&bmi, HwndEdit)) {
- texture = NewDefaultBitmapTex();
- if (texture) {
- texture->SetMapName((char *)bmi.Name());
- TheMtl->SetSubTexmap(ID_SI,texture);
- UpdateMtlDisplay();
- TheMtl->NotifyChanged();
- }
- }
- }
- break;
-
- case IDC_SCT_BUTTON:
- {
- BitmapInfo bmi;
- BitmapTex * texture;
-
- if (TheManager->SelectFileInput(&bmi, HwndEdit)) {
- texture = NewDefaultBitmapTex();
- if (texture) {
- texture->SetMapName((char *)bmi.Name());
- TheMtl->SetSubTexmap(ID_SP,texture);
- UpdateMtlDisplay();
- TheMtl->NotifyChanged();
- }
- }
- }
- break;
-
- case IDC_SIT_BUTTON:
- {
- BitmapInfo bmi;
- BitmapTex * texture;
-
- if (TheManager->SelectFileInput(&bmi, HwndEdit)) {
- texture = NewDefaultBitmapTex();
- if (texture) {
- texture->SetMapName((char *)bmi.Name());
- TheMtl->SetSubTexmap(ID_RL,texture);
- UpdateMtlDisplay();
- TheMtl->NotifyChanged();
- }
- }
- }
- break;
-
- case IDC_MAPON_DCT:
- TheMtl->EnableMap(ID_DI,GetCheckBox(hwndDlg, id));
- if (!GetCheckBox(hwndDlg,id)) TheMtl->SetSubTexmap(ID_DI,NULL);
- UpdateTexmapDisplay(ID_DI);
- UpdateMtlDisplay();
- TheMtl->NotifyChanged();
- break;
- case IDC_MAPON_DIT:
- TheMtl->EnableMap(ID_SI,GetCheckBox(hwndDlg, id));
- if (!GetCheckBox(hwndDlg,id)) TheMtl->SetSubTexmap(ID_SI,NULL);
- UpdateTexmapDisplay(ID_SI);
- UpdateMtlDisplay();
- TheMtl->NotifyChanged();
- break;
- case IDC_MAPON_SCT:
- TheMtl->EnableMap(ID_SP,GetCheckBox(hwndDlg, id));
- if (!GetCheckBox(hwndDlg,id)) TheMtl->SetSubTexmap(ID_SP,NULL);
- UpdateTexmapDisplay(ID_SP);
- UpdateMtlDisplay();
- TheMtl->NotifyChanged();
- break;
- case IDC_MAPON_SIT:
- TheMtl->EnableMap(ID_RL,GetCheckBox(hwndDlg, id));
- if (!GetCheckBox(hwndDlg,id)) TheMtl->SetSubTexmap(ID_RL,NULL);
- UpdateTexmapDisplay(ID_RL);
- UpdateMtlDisplay();
- TheMtl->NotifyChanged();
- break;
- case IDC_USE_ALPHA_CHECK:
- TheMtl->SetAttribute(GAMEMTL_USE_ALPHA,GetCheckBox(hwndDlg,IDC_USE_ALPHA_CHECK));
- UpdateMtlDisplay();
- TheMtl->NotifyChanged();
- break;
- case IDC_USE_SORTING_CHECK:
- TheMtl->SetAttribute(GAMEMTL_USE_SORTING,GetCheckBox(hwndDlg,IDC_USE_SORTING_CHECK));
- break;
- case IDC_DCT_MAPPING_COMBO:
- mtype = SendDlgItemMessage(hwndDlg,IDC_DCT_MAPPING_COMBO,CB_GETCURSEL,0,0);
- TheMtl->DCTMappingType = mtype;
- break;
- case IDC_DIT_MAPPING_COMBO:
- mtype = SendDlgItemMessage(hwndDlg,IDC_DIT_MAPPING_COMBO,CB_GETCURSEL,0,0);
- TheMtl->DITMappingType = mtype;
- break;
- case IDC_SCT_MAPPING_COMBO:
- mtype = SendDlgItemMessage(hwndDlg,IDC_SCT_MAPPING_COMBO,CB_GETCURSEL,0,0);
- TheMtl->SCTMappingType = mtype;
- break;
- case IDC_SIT_MAPPING_COMBO:
- mtype = SendDlgItemMessage(hwndDlg,IDC_SIT_MAPPING_COMBO,CB_GETCURSEL,0,0);
- TheMtl->SITMappingType = mtype;
- break;
- case IDC_VIEWPORT_DISPLAY_CHECK:
- TheMtl->Set_Viewport_Display_Status(GetCheckBox(hwndDlg,IDC_VIEWPORT_DISPLAY_CHECK));
- TheMtl->NotifyChanged();
- UpdateMtlDisplay();
- break;
- }
- }
- break;
-
- case CC_COLOR_CHANGE:
- {
- // just update all of the colors
- TheMtl->Diffuse = DiffuseSwatch->GetColor();
- TheMtl->Specular = SpecularSwatch->GetColor();
- TheMtl->AmbientCoeff = AmbientCoeffSwatch->GetColor();
- TheMtl->DiffuseCoeff = DiffuseCoeffSwatch->GetColor();
- TheMtl->SpecularCoeff = SpecularCoeffSwatch->GetColor();
- TheMtl->EmissiveCoeff = EmissiveCoeffSwatch->GetColor();
-
- TheMtl->NotifyChanged();
- UpdateMtlDisplay();
- }
- break;
-
- case WM_LBUTTONDOWN:
- case WM_LBUTTONUP:
- case WM_MOUSEMOVE:
- {
- IParams->RollupMouseMessage(hwndDlg,msg,wParam,lParam);
- }
- return FALSE;
-
- case CC_SPINNER_CHANGE:
- {
- TheMtl->DCTFrames = DCTFramesSpin->GetIVal();
- TheMtl->DITFrames = DITFramesSpin->GetIVal();
- TheMtl->SCTFrames = SCTFramesSpin->GetIVal();
- TheMtl->SITFrames = SITFramesSpin->GetIVal();
-
- TheMtl->DCTFrameRate = DCTRateSpin->GetFVal();
- TheMtl->DITFrameRate = DITRateSpin->GetFVal();
- TheMtl->SCTFrameRate = SCTRateSpin->GetFVal();
- TheMtl->SITFrameRate = SITRateSpin->GetFVal();
-
- TheMtl->SetOpacity(OpacitySpin->GetFVal());
- TheMtl->SetTranslucency(TranslucencySpin->GetFVal());
- TheMtl->SetShininess(ShininessSpin->GetFVal());
- TheMtl->FogCoeff = FogSpin->GetFVal();
-
- TheMtl->NotifyChanged();
- UpdateMtlDisplay();
- }
- break;
-
- case CC_SPINNER_BUTTONUP:
- {
- #if 0
- UpdateMtlDisplay();
- #endif
- }
- break;
-
- case WM_PAINT:
- {
- if (!Valid) {
- Valid = TRUE;
- ReloadDialog();
- }
- }
- return FALSE;
-
- case WM_CLOSE:
- break;
-
- case WM_DESTROY:
-
- TheMtl->DCTFrames = DCTFramesSpin->GetIVal();
- TheMtl->DITFrames = DITFramesSpin->GetIVal();
- TheMtl->SCTFrames = SCTFramesSpin->GetIVal();
- TheMtl->SITFrames = SITFramesSpin->GetIVal();
-
- TheMtl->DCTFrameRate = DCTRateSpin->GetFVal();
- TheMtl->DITFrameRate = DITRateSpin->GetFVal();
- TheMtl->SCTFrameRate = SCTRateSpin->GetFVal();
- TheMtl->SITFrameRate = SITRateSpin->GetFVal();
-
- TheMtl->SetOpacity(OpacitySpin->GetFVal());
- TheMtl->SetTranslucency(TranslucencySpin->GetFVal());
- TheMtl->SetShininess(ShininessSpin->GetFVal());
- TheMtl->FogCoeff = FogSpin->GetFVal();
-
- ReleaseISpinner(DCTFramesSpin);
- ReleaseISpinner(DITFramesSpin);
- ReleaseISpinner(SCTFramesSpin);
- ReleaseISpinner(SITFramesSpin);
- ReleaseISpinner(DCTRateSpin);
- ReleaseISpinner(DITRateSpin);
- ReleaseISpinner(SCTRateSpin);
- ReleaseISpinner(SITRateSpin);
- ReleaseISpinner(OpacitySpin);
- ReleaseISpinner(TranslucencySpin);
- ReleaseISpinner(ShininessSpin);
- ReleaseISpinner(FogSpin);
-
- DCTFramesSpin = DITFramesSpin = SCTFramesSpin = SITFramesSpin = NULL;
- DCTRateSpin = DITRateSpin = SCTRateSpin = SITRateSpin = NULL;
- OpacitySpin = TranslucencySpin = ShininessSpin = FogSpin = NULL;
-
- break;
-
- }
-
- return FALSE;
-}
-
-
-/***********************************************************************************************
- * PanelDlgProc -- Windows Proc which thunks into GameMtlDlg::PanelProc *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 06/26/1997 GH : Created. *
- *=============================================================================================*/
-static BOOL CALLBACK PanelDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- GameMtlDlg *theDlg;
-
- if (msg==WM_INITDIALOG) {
- theDlg = (GameMtlDlg*)lParam;
- theDlg->HwndPanel = hwndDlg;
- SetWindowLong(hwndDlg, GWL_USERDATA,lParam);
- } else {
- if ((theDlg = (GameMtlDlg *)GetWindowLong(hwndDlg, GWL_USERDATA) ) == NULL) {
- return FALSE;
- }
- }
-
- BOOL res;
- theDlg->IsActive = 1;
- res = theDlg->PanelProc(hwndDlg,msg,wParam,lParam);
- theDlg->IsActive = 0;
- return res;
-}
-
-/***********************************************************************************************
- * GameMtlDlg::NotesProc -- Dialog Proc for the Notes panel *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 06/26/1997 GH : Created. *
- *=============================================================================================*/
-BOOL GameMtlDlg::NotesProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- int id = LOWORD(wParam);
- int code = HIWORD(wParam);
-
- switch (msg) {
-
- case WM_LBUTTONDOWN:
- case WM_LBUTTONUP:
- case WM_MOUSEMOVE:
- {
- IParams->RollupMouseMessage(hwndDlg,msg,wParam,lParam);
- return FALSE;
- }
-
- case WM_COMMAND:
- {
- int i = lParam;
- }
- break;
-
- }
- return FALSE;
-}
-
-
-/***********************************************************************************************
- * NotesDlgProc -- Dialog Proc which thunks to GameMtlDlg::NotesProc *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 06/26/1997 GH : Created. *
- *=============================================================================================*/
-static BOOL CALLBACK NotesDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- GameMtlDlg *theDlg;
-
- if (msg==WM_INITDIALOG) {
- theDlg = (GameMtlDlg*)lParam;
- theDlg->HwndNotes = hwndDlg;
- SetWindowLong(hwndDlg, GWL_USERDATA,lParam);
- } else {
- if ((theDlg = (GameMtlDlg *)GetWindowLong(hwndDlg, GWL_USERDATA) ) == NULL) {
- return FALSE;
- }
- }
-
- BOOL res;
- theDlg->IsActive = 1;
- res = theDlg->NotesProc(hwndDlg,msg,wParam,lParam);
- theDlg->IsActive = 0;
- return res;
-}
-
-
-/***********************************************************************************************
- * GameMtlDlg::HintsProc -- Dialog Proc for the hints panel *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 3/30/98 GTH : Created. *
- *=============================================================================================*/
-BOOL GameMtlDlg::HintsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- int id = LOWORD(wParam);
- int code = HIWORD(wParam);
-
- switch (msg) {
-
-
- case WM_LBUTTONDOWN:
- case WM_LBUTTONUP:
- case WM_MOUSEMOVE:
- {
- IParams->RollupMouseMessage(hwndDlg,msg,wParam,lParam);
- return FALSE;
- }
-
- case WM_COMMAND:
- {
- switch(id)
- {
- case IDC_DIT_OVER_DCT_CHECK:
- TheMtl->SetAttribute(GAMEMTL_DIT_OVER_DCT, GetCheckBox(hwndDlg, IDC_DIT_OVER_DCT_CHECK));
- break;
-
- case IDC_SIT_OVER_SCT_CHECK:
- TheMtl->SetAttribute(GAMEMTL_SIT_OVER_SCT, GetCheckBox(hwndDlg, IDC_SIT_OVER_SCT_CHECK));
- break;
-
- case IDC_DIT_OVER_DIG_CHECK:
- TheMtl->SetAttribute(GAMEMTL_DIT_OVER_DIG, GetCheckBox(hwndDlg, IDC_DIT_OVER_DIG_CHECK));
- break;
-
- case IDC_SIT_OVER_SIG_CHECK:
- TheMtl->SetAttribute(GAMEMTL_SIT_OVER_SIG, GetCheckBox(hwndDlg, IDC_SIT_OVER_SIG_CHECK));
- break;
-
- case IDC_FAST_SPECULAR_AFTER_ALPHA_CHECK:
- TheMtl->SetAttribute(GAMEMTL_FAST_SPECULAR_AFTER_ALPHA, GetCheckBox(hwndDlg, IDC_FAST_SPECULAR_AFTER_ALPHA_CHECK));
- break;
- }
- }
- break;
- }
- return FALSE;
-}
-
-
-/***********************************************************************************************
- * HintsDlgProc -- Dialog proc which thunks to GameMtlDlg::HintsProc *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 3/30/98 GTH : Created. *
- *=============================================================================================*/
-static BOOL CALLBACK HintsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- GameMtlDlg *theDlg;
-
- if (msg==WM_INITDIALOG) {
- theDlg = (GameMtlDlg*)lParam;
- theDlg->HwndHints = hwndDlg;
- SetWindowLong(hwndDlg, GWL_USERDATA,lParam);
- } else {
- if ((theDlg = (GameMtlDlg *)GetWindowLong(hwndDlg, GWL_USERDATA) ) == NULL) {
- return FALSE;
- }
- }
-
- BOOL res;
- theDlg->IsActive = 1;
- res = theDlg->HintsProc(hwndDlg,msg,wParam,lParam);
- theDlg->IsActive = 0;
- return res;
-}
-
-
-/***********************************************************************************************
- * GameMtlDlg::PsxProc -- Dialog proc for the PSX options panel *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 3/31/98 GTH : Created. *
- *=============================================================================================*/
-BOOL GameMtlDlg::PsxProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- int id = LOWORD(wParam);
- int code = HIWORD(wParam);
-
- switch (msg) {
-
- case WM_LBUTTONDOWN:
- case WM_LBUTTONUP:
- case WM_MOUSEMOVE:
- {
- IParams->RollupMouseMessage(hwndDlg,msg,wParam,lParam);
- return FALSE;
- }
-
- case WM_COMMAND:
- {
- switch(id)
- {
- case IDC_NO_TRANS:
- TheMtl->SetMaskedAttribute(GAMEMTL_PSX_TRANS_MASK,0);
- break;
-
- case IDC_100_TRANS:
- TheMtl->SetMaskedAttribute(GAMEMTL_PSX_TRANS_MASK,GAMEMTL_PSX_100_TRANS);
- break;
-
- case IDC_50_TRANS:
- TheMtl->SetMaskedAttribute(GAMEMTL_PSX_TRANS_MASK,GAMEMTL_PSX_50_TRANS);
- break;
-
- case IDC_25_TRANS:
- TheMtl->SetMaskedAttribute(GAMEMTL_PSX_TRANS_MASK,GAMEMTL_PSX_25_TRANS);
- break;
-
- case IDC_MINUS_100_TRANS:
- TheMtl->SetMaskedAttribute(GAMEMTL_PSX_TRANS_MASK,GAMEMTL_PSX_MINUS_100_TRANS);
- break;
-
- case IDC_NO_RT_LIGHTING:
- TheMtl->SetAttribute(GAMEMTL_PSX_NO_RT_LIGHTING, GetCheckBox(hwndDlg, IDC_NO_RT_LIGHTING));
- break;
- }
- }
- break;
- }
- return FALSE;
-}
-
-
-/***********************************************************************************************
- * PsxDlgProc -- Dialog proc which thunks into GameMtlDlg::PsxProc *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 3/31/98 GTH : Created. *
- *=============================================================================================*/
-static BOOL CALLBACK PsxDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- GameMtlDlg *theDlg;
-
- if (msg==WM_INITDIALOG) {
- theDlg = (GameMtlDlg*)lParam;
- theDlg->HwndPsx = hwndDlg;
- SetWindowLong(hwndDlg, GWL_USERDATA,lParam);
- } else {
- if ((theDlg = (GameMtlDlg *)GetWindowLong(hwndDlg, GWL_USERDATA) ) == NULL) {
- return FALSE;
- }
- }
-
- BOOL res;
- theDlg->IsActive = 1;
- res = theDlg->PsxProc(hwndDlg,msg,wParam,lParam);
- theDlg->IsActive = 0;
- return res;
-}
-
-
-/***********************************************************************************************
- * GameMtlDlg::LoadDialog -- Sets the state of all of the dialog's controls *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 06/26/1997 GH : Created. *
- *=============================================================================================*/
-void GameMtlDlg::LoadDialog(BOOL draw)
-{
-
- /*
- ** Set the state of the entire panel based on the current material.
- */
- if (TheMtl && HwndPanel) {
-
- /*
- ** Init all of the color swatches
- */
- if (DiffuseSwatch) {
- DiffuseSwatch->InitColor(TheMtl->GetDiffuse());
- }
- if (SpecularSwatch) {
- SpecularSwatch->InitColor(TheMtl->GetSpecular());
- }
- if (AmbientCoeffSwatch) {
- AmbientCoeffSwatch->InitColor(TheMtl->GetAmbientCoeff());
- }
- if (DiffuseCoeffSwatch) {
- DiffuseCoeffSwatch->InitColor(TheMtl->GetDiffuseCoeff());
- }
- if (SpecularCoeffSwatch) {
- SpecularCoeffSwatch->InitColor(TheMtl->GetSpecularCoeff());
- }
- if (EmissiveCoeffSwatch) {
- EmissiveCoeffSwatch->InitColor(TheMtl->GetEmissiveCoeff());
- }
-
- /*
- ** Checkboxes
- */
- SetCheckBox(HwndPanel,IDC_USE_ALPHA_CHECK, TheMtl->GetAttribute(GAMEMTL_USE_ALPHA));
- SetCheckBox(HwndPanel,IDC_USE_SORTING_CHECK, TheMtl->GetAttribute(GAMEMTL_USE_SORTING));
- SetCheckBox(HwndPanel,IDC_VIEWPORT_DISPLAY_CHECK,TheMtl->Get_Viewport_Display_Status());
-
- /*
- ** Texture maps enable checks.
- */
- SetCheckBox(HwndPanel,IDC_MAPON_DCT, TheMtl->SubTexmapOn(ID_DI));
- SetCheckBox(HwndPanel,IDC_MAPON_DIT, TheMtl->SubTexmapOn(ID_SI));
- SetCheckBox(HwndPanel,IDC_MAPON_SCT, TheMtl->SubTexmapOn(ID_SP));
- SetCheckBox(HwndPanel,IDC_MAPON_SIT, TheMtl->SubTexmapOn(ID_RL));
-
- /*
- ** Mapping types
- */
- SendDlgItemMessage( HwndPanel, IDC_DCT_MAPPING_COMBO, CB_SETCURSEL, TheMtl->DCTMappingType, 0 );
- SendDlgItemMessage( HwndPanel, IDC_DIT_MAPPING_COMBO, CB_SETCURSEL, TheMtl->DITMappingType, 0 );
- SendDlgItemMessage( HwndPanel, IDC_SCT_MAPPING_COMBO, CB_SETCURSEL, TheMtl->SCTMappingType, 0 );
- SendDlgItemMessage( HwndPanel, IDC_SIT_MAPPING_COMBO, CB_SETCURSEL, TheMtl->SITMappingType, 0 );
-
- /*
- ** Texture animation parameters
- */
- DCTFramesSpin->SetValue(TheMtl->DCTFrames,FALSE);
- DITFramesSpin->SetValue(TheMtl->DITFrames,FALSE);
- SCTFramesSpin->SetValue(TheMtl->SCTFrames,FALSE);
- SITFramesSpin->SetValue(TheMtl->SITFrames,FALSE);
-
- DCTRateSpin->SetValue(TheMtl->DCTFrameRate,FALSE);
- DITRateSpin->SetValue(TheMtl->DITFrameRate,FALSE);
- SCTRateSpin->SetValue(TheMtl->SCTFrameRate,FALSE);
- SITRateSpin->SetValue(TheMtl->SITFrameRate,FALSE);
-
- /*
- ** Opacity, translucency, etc
- */
- OpacitySpin->SetValue(TheMtl->Opacity,FALSE);
- TranslucencySpin->SetValue(TheMtl->Translucency,FALSE);
- ShininessSpin->SetValue(TheMtl->Shininess,FALSE);
- FogSpin->SetValue(TheMtl->FogCoeff,FALSE);
-
- /*
- ** Init the Psx flags state
- */
- SetCheckBox(HwndPsx,IDC_NO_RT_LIGHTING, TheMtl->GetAttribute(GAMEMTL_PSX_NO_RT_LIGHTING));
-
- SetCheckBox(HwndPsx,IDC_NO_TRANS, false);
- SetCheckBox(HwndPsx,IDC_100_TRANS, false);
- SetCheckBox(HwndPsx,IDC_50_TRANS, false);
- SetCheckBox(HwndPsx,IDC_25_TRANS, false);
- SetCheckBox(HwndPsx,IDC_MINUS_100_TRANS, false);
-
- switch (TheMtl->GetMaskedAttribute(GAMEMTL_PSX_TRANS_MASK)) {
- case 0:
- SetCheckBox(HwndPsx,IDC_NO_TRANS,true);
- break;
- case GAMEMTL_PSX_100_TRANS:
- SetCheckBox(HwndPsx,IDC_100_TRANS,true);
- break;
- case GAMEMTL_PSX_50_TRANS:
- SetCheckBox(HwndPsx,IDC_50_TRANS,true);
- break;
- case GAMEMTL_PSX_25_TRANS:
- SetCheckBox(HwndPsx,IDC_25_TRANS,true);
- break;
- case GAMEMTL_PSX_MINUS_100_TRANS:
- SetCheckBox(HwndPsx,IDC_MINUS_100_TRANS,true);
- break;
- }
-
-
- /*
- ** Init the Hints state
- */
- SetCheckBox(HwndHints,IDC_DIT_OVER_DCT_CHECK, TheMtl->GetAttribute(GAMEMTL_DIT_OVER_DCT));
- SetCheckBox(HwndHints,IDC_SIT_OVER_SCT_CHECK, TheMtl->GetAttribute(GAMEMTL_SIT_OVER_SCT));
- SetCheckBox(HwndHints,IDC_DIT_OVER_DIG_CHECK, TheMtl->GetAttribute(GAMEMTL_DIT_OVER_DIG));
- SetCheckBox(HwndHints,IDC_SIT_OVER_SIG_CHECK, TheMtl->GetAttribute(GAMEMTL_SIT_OVER_SIG));
- SetCheckBox(HwndHints,IDC_FAST_SPECULAR_AFTER_ALPHA_CHECK, TheMtl->GetAttribute(GAMEMTL_FAST_SPECULAR_AFTER_ALPHA));
-
- /*
- ** Init the texmaps state
- */
- for (int i=0; iMtlChanged();
-}
-
-
-/***********************************************************************************************
- * GameMtlDlg::ActivateDlg -- Activates and deactivates the dialog *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 06/26/1997 GH : Created. *
- *=============================================================================================*/
-void GameMtlDlg::ActivateDlg(BOOL onOff)
-{
- if (DiffuseSwatch) {
- DiffuseSwatch->Activate(onOff);
- }
- if (SpecularSwatch) {
- SpecularSwatch->Activate(onOff);
- }
- if (AmbientCoeffSwatch) {
- AmbientCoeffSwatch->Activate(onOff);
- }
- if (DiffuseCoeffSwatch) {
- DiffuseCoeffSwatch->Activate(onOff);
- }
- if (SpecularCoeffSwatch) {
- SpecularCoeffSwatch->Activate(onOff);
- }
- if (EmissiveCoeffSwatch) {
- EmissiveCoeffSwatch->Activate(onOff);
- }
-}
-
-/***********************************************************************************************
- * GameMtlDlg::SetThing -- Sets the material to be edited *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 06/26/1997 GH : Created. *
- *=============================================================================================*/
-void GameMtlDlg::SetThing(ReferenceTarget *m)
-{
- assert (m->SuperClassID()==MATERIAL_CLASS_ID);
- assert (m->ClassID()==GameMaterialClassID);
-
- if (TheMtl) {
- TheMtl->ParamPanel = NULL;
- }
-
- TheMtl = (GameMtl *)m;
-
- if (TheMtl) {
- TheMtl->ParamPanel = this;
- }
-
- LoadDialog(TRUE);
-
- if (HwndPanel && DiffuseSwatch) {
- DiffuseSwatch->InitColor(TheMtl->GetDiffuse());
- }
- if (HwndPanel && SpecularSwatch) {
- SpecularSwatch->InitColor(TheMtl->GetSpecular());
- }
- if (HwndPanel && AmbientCoeffSwatch) {
- AmbientCoeffSwatch->InitColor(TheMtl->GetAmbientCoeff());
- }
- if (HwndPanel && DiffuseCoeffSwatch) {
- DiffuseCoeffSwatch->InitColor(TheMtl->GetDiffuseCoeff());
- }
- if (HwndPanel && SpecularCoeffSwatch) {
- SpecularCoeffSwatch->InitColor(TheMtl->GetSpecularCoeff());
- }
- if (HwndPanel && EmissiveCoeffSwatch) {
- EmissiveCoeffSwatch->InitColor(TheMtl->GetEmissiveCoeff());
- }
-}
-
-/***********************************************************************************************
- * GameMtlDlg::BuildDialog -- Adds the dialog to the material editor *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 06/26/1997 GH : Created. *
- *=============================================================================================*/
-void GameMtlDlg::BuildDialog()
-{
- if ((TheMtl->Flags&(GAMEMTL_ROLLUP_FLAGS))==0) {
- TheMtl->SetFlag(GAMEMTL_ROLLUP1_OPEN,TRUE);
- }
-
- HwndPanel = IParams->AddRollupPage(
- AppInstance,
- MAKEINTRESOURCE(IDD_GAMEMTL_PANEL),
- PanelDlgProc,
- Get_String(IDS_PARAMETERS),
- (LPARAM)this,
- (TheMtl->GetFlag(GAMEMTL_ROLLUP1_OPEN) ? 0:APPENDROLL_CLOSED)
- );
-
- HwndPsx = IParams->AddRollupPage(
- AppInstance,
- MAKEINTRESOURCE(IDD_GAMEMTL_PSX_PANEL),
- PsxDlgProc,
- Get_String(IDS_PSX_OPTIONS),
- (LPARAM)this,
- (TheMtl->GetFlag(GAMEMTL_ROLLUP2_OPEN) ? 0:APPENDROLL_CLOSED)
- );
-
- HwndHints = IParams->AddRollupPage(
- AppInstance,
- MAKEINTRESOURCE(IDD_GAMEMTL_HINTS_PANEL),
- HintsDlgProc,
- Get_String(IDS_MATERIAL_HINTS),
- (LPARAM)this,
- (TheMtl->GetFlag(GAMEMTL_ROLLUP3_OPEN) ? 0:APPENDROLL_CLOSED)
- );
-
- HwndNotes = IParams->AddRollupPage(
- AppInstance,
- MAKEINTRESOURCE(IDD_MATERIAL_NOTES_PANEL),
- NotesDlgProc,
- Get_String(IDS_NOTES),
- (LPARAM)this,
- (TheMtl->GetFlag(GAMEMTL_ROLLUP4_OPEN) ? 0:APPENDROLL_CLOSED)
- );
-
- IParams->SetRollupScrollPos(TheMtl->RollScroll);
-}
-
-/***********************************************************************************************
- * GameMtlDlg::UpdateTexmapDisplay -- Updates the texture map buttons *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 06/26/1997 GH : Created. *
- *=============================================================================================*/
-void GameMtlDlg::UpdateTexmapDisplay(int i)
-{
- TSTR nm = Get_String(IDS_NONE);
- Texmap *texmap = (*TheMtl->Maps)[i].Map;
- if (texmap) nm = texmap->GetFullName();
-
- // Diffuse Map -> Surrender Diffuse Color Channel
- if (i == ID_DI) {
- SetCheckBox(HwndPanel, IDC_MAPON_DCT, TheMtl->IsMapEnabled(i));
- SetDlgItemText(HwndPanel, IDC_DCT_BUTTON, nm.data());
- }
-
- // Self Illumination Map -> Surrender Diffuse Illumination Channel
- if (i == ID_SI) {
- SetCheckBox(HwndPanel, IDC_MAPON_DIT, TheMtl->IsMapEnabled(i));
- SetDlgItemText(HwndPanel, IDC_DIT_BUTTON, nm.data());
- }
-
- // Specular Map -> Surrender Specular Color Channel
- if (i == ID_SP) {
- SetCheckBox(HwndPanel, IDC_MAPON_SCT, TheMtl->IsMapEnabled(i));
- SetDlgItemText(HwndPanel, IDC_SCT_BUTTON, nm.data());
- }
-
- // Reflection Map -> Surrender Specular Illumination Channel
- if (i == ID_RL) {
- SetCheckBox(HwndPanel, IDC_MAPON_SIT, TheMtl->IsMapEnabled(i));
- SetDlgItemText(HwndPanel, IDC_SIT_BUTTON, nm.data());
- }
-
-}
-
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/gridsnapmodifier.cpp b/Generals/Code/Tools/WW3D/max2w3d/gridsnapmodifier.cpp
deleted file mode 100644
index 5905ff1e565..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/gridsnapmodifier.cpp
+++ /dev/null
@@ -1,282 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Max2W3d *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/gridsnapmodifier.cpp $*
- * *
- * Original Author:: Greg Hjelstrom *
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 5/01/01 8:29p $*
- * *
- * $Revision:: 1 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-
-#include "max.h"
-#include "resource.h"
-#include "simpmod.h"
-#include "dllmain.h"
-#include "iparamb2.h"
-
-
-/*
-
- WARNING WARNING WARNING PLEASE READ - This modifier was an experiment to see if we could
- solve cracks in adjacent meshes by snapping to a world-space grid. It didn't work for a
- few reasons:
- - I couldn't implement the world space snapping; the SimpleMod code seems to always force
- you to work relative to each object.
- - Snapping to a grid won't always snap vertices to the same grid. The probability that
- it will work is a function of the distance between the points and the grid spacing
-
-*/
-
-
-
-#define GRIDSNAPMOD_CLASSID Class_ID(0x7a2d399b, 0x1e3d2004)
-
-
-/**
-** GridSnapModifierClass
-** This modifier will snap all vertices in the geometry being modified to a grid. Its motivation is to
-** try to help solve the problem of cracks between adjacent meshes in Renegade levels. This will work
-** a lot better if the objects have reset-transforms prior to being processed by this modifier.
-*/
-class GridSnapModifierClass : public SimpleMod2
-{
-public:
-
- GridSnapModifierClass();
-
- // From Animatable
- void DeleteThis() { delete this; }
- void GetClassName(TSTR& s) { s = Get_String(IDS_GRIDSNAPMODIFIER); }
- virtual Class_ID ClassID() { return GRIDSNAPMOD_CLASSID; }
- void BeginEditParams( IObjParam *ip, ULONG flags,Animatable *prev);
- void EndEditParams( IObjParam *ip,ULONG flags,Animatable *next);
- RefTargetHandle Clone(RemapDir& remap = NoRemap());
- TCHAR *GetObjectName() { return Get_String(IDS_GRIDSNAPMODIFIER);}
- IOResult Load(ILoad *iload);
-
- // Direct paramblock access
- int NumParamBlocks() { return 1; }
- IParamBlock2* GetParamBlock(int i) { return pblock2; }
- IParamBlock2* GetParamBlockByID(BlockID id) { return (pblock2->ID() == id) ? pblock2 : NULL; }
-
- // From simple mod
- Deformer& GetDeformer(TimeValue t,ModContext &mc,Matrix3& mat,Matrix3& invmat);
- Interval GetValidity(TimeValue t);
-
- //RefTargetHandle GetReference(int i)
- //void SetReference(int i,RefTargetHandle rtar)
- //Animatable * SubAnim(int i)
-};
-
-/**
-** GridSnapDeformerClass
-** This is the callback object used by GridSnapModifierClass to implement the actual geometry changes. This
-** architecture is required by the SimpleMod base-class. This Deformer simply snaps vertex positions
-** to the grid defined by its parameters.
-*/
-class GridSnapDeformerClass : public Deformer
-{
-public:
- GridSnapDeformerClass(void) : GridDimension(0.001f) {}
-
- void Set_Grid_Dimension(float grid_dim) { GridDimension = grid_dim; }
- float Get_Grid_Dimension(void) { return GridDimension; }
-
- void Set_Matrices(const Matrix3 & tm,const Matrix3 & invtm) { Transform = tm; InvTransform = invtm; }
-
- virtual Point3 Map(int i,Point3 p)
- {
- p = p*Transform;
- p.x = floor(p.x / GridDimension) * GridDimension;
- p.y = floor(p.y / GridDimension) * GridDimension;
- p.z = floor(p.z / GridDimension) * GridDimension;
- p = p*InvTransform;
-
- return p;
- }
-
-private:
- float GridDimension;
- Matrix3 Transform;
- Matrix3 InvTransform;
-};
-
-
-/**
-** GridSnapModifier Class Descriptor
-** This object "links" the plugin into Max's plugin system. It links the Class-ID to a virtual construction
-** method. The function Get_Grid_Snap_Modifier_Desc is the only hook to external code.
-*/
-class GridSnapModifierClassDesc:public ClassDesc2
-{
-public:
- int IsPublic() { return 1; }
- void * Create(BOOL loading = FALSE) { return new GridSnapModifierClass; }
- const TCHAR * ClassName() { return _T("Grid Snap Modifier"); }
- SClass_ID SuperClassID() { return OSM_CLASS_ID; }
- Class_ID ClassID() { return GRIDSNAPMOD_CLASSID; }
- const TCHAR* Category() { return _T("Westwood Modifiers");}
- HINSTANCE HInstance() { return AppInstance; }
- const TCHAR * InternalName() { return _T("Westwood GridSnap"); }
-};
-
-static GridSnapModifierClassDesc _GridSnapModifierDesc;
-
-ClassDesc* Get_Grid_Snap_Modifier_Desc(void)
-{
- return &_GridSnapModifierDesc;
-}
-
-
-/*
-** ParamBlock2 Setup
-*/
-enum
-{
- GSM_PARAMS = 0,
-};
-
-enum
-{
- GSM_PARAM_GRIDDIMENSION = 0,
-};
-
-static ParamBlockDesc2 _GridSnapParamBlockDesc
-(
- // parameter block settings
- GSM_PARAMS,_T("GridSnap Parameters"), 0, &_GridSnapModifierDesc, P_AUTO_CONSTRUCT + P_AUTO_UI, SIMPMOD_PBLOCKREF,
-
- // dialog box
- IDD_GRIDSNAP_PARAMS, IDS_GRIDSNAP_TITLE, 0, 0, NULL,
-
- // parameters
- GSM_PARAM_GRIDDIMENSION, _T("Grid Dimension"), TYPE_FLOAT, P_RESET_DEFAULT, IDS_GRID_DIMENSION,
- p_default, 0.001f,
- p_range, 0.0001f, 10.0f,
- p_ui, TYPE_SPINNER, EDITTYPE_FLOAT, IDC_GRIDDIM_EDIT, IDC_GRIDDIM_SPIN, 0.0001f,
- end,
-
- end
-);
-
-
-/********************************************************************************************
-**
-** GridSnapModifierClass Implementation
-**
-********************************************************************************************/
-
-GridSnapModifierClass::GridSnapModifierClass()
-{
- // create the parameter block, storing in the base-class's pblock variable
- _GridSnapModifierDesc.MakeAutoParamBlocks(this);
- assert(pblock2);
-}
-
-void GridSnapModifierClass::BeginEditParams( IObjParam *ip, ULONG flags,Animatable *prev)
-{
- this->ip = ip;
-
- SimpleMod2::BeginEditParams(ip,flags,prev);
- _GridSnapModifierDesc.BeginEditParams(ip, this, flags, prev);
-}
-
-void GridSnapModifierClass::EndEditParams( IObjParam *ip,ULONG flags,Animatable *next)
-{
- SimpleMod2::EndEditParams(ip,flags,next);
- _GridSnapModifierDesc.EndEditParams(ip, this, flags, next);
-
- this->ip = NULL;
-}
-
-RefTargetHandle GridSnapModifierClass::Clone(RemapDir& remap)
-{
- GridSnapModifierClass * newmod = new GridSnapModifierClass();
- newmod->ReplaceReference(SIMPMOD_PBLOCKREF,pblock2->Clone(remap));
- newmod->SimpleModClone(this);
- return(newmod);
-}
-
-IOResult GridSnapModifierClass::Load(ILoad *iload)
-{
- Modifier::Load(iload);
- return IO_OK;
-}
-
-Deformer& GridSnapModifierClass::GetDeformer(TimeValue t,ModContext &mc,Matrix3& mat,Matrix3& invmat)
-{
- float dimension = 0.0f; Interval valid = FOREVER;
- pblock2->GetValue(GSM_PARAM_GRIDDIMENSION, t, dimension, FOREVER);
-
- static GridSnapDeformerClass deformer;
- deformer.Set_Grid_Dimension(dimension);
- deformer.Set_Matrices(mat,invmat);
- return deformer;
-}
-
-Interval GridSnapModifierClass::GetValidity(TimeValue t)
-{
- float f;
- Interval valid = FOREVER;
- pblock2->GetValue(GSM_PARAM_GRIDDIMENSION, t, f, valid);
- return valid;
-}
-
-RefTargetHandle SimpleMod2::GetReference(int i)
-{
- switch (i) {
- case 0: return tmControl;
- case 1: return posControl;
- case 2: return pblock2;
- default: return NULL;
- }
-}
-
-void SimpleMod2::SetReference(int i,RefTargetHandle rtarg)
-{
- switch (i) {
- case 0: tmControl = (Control*)rtarg; break;
- case 1: posControl = (Control*)rtarg; break;
- case 2: pblock2 = (IParamBlock2*)rtarg; break;
- }
-}
-
-Animatable * SimpleMod2::SubAnim(int i)
-{
- switch (i) {
- case 0: return posControl;
- case 1: return tmControl;
- case 2: return pblock2;
- default: return NULL;
- }
-}
\ No newline at end of file
diff --git a/Generals/Code/Tools/WW3D/max2w3d/gridsnapmodifier.h b/Generals/Code/Tools/WW3D/max2w3d/gridsnapmodifier.h
deleted file mode 100644
index 559bea7ee20..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/gridsnapmodifier.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Max2W3d *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/gridsnapmodifier.h $*
- * *
- * Original Author:: Greg Hjelstrom *
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 5/01/01 5:56p $*
- * *
- * $Revision:: 1 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#ifndef GRIDSNAPMODIFIER_H
-#define GRIDSNAPMODIFIER_H
-
-class ClassDesc;
-
-ClassDesc * Get_Grid_Snap_Modifier_Desc(void);
-
-
-#endif //GRIDSNAPMODIFIER_H
\ No newline at end of file
diff --git a/Generals/Code/Tools/WW3D/max2w3d/hiersave.cpp b/Generals/Code/Tools/WW3D/max2w3d/hiersave.cpp
deleted file mode 100644
index b894244e2e2..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/hiersave.cpp
+++ /dev/null
@@ -1,1009 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/* $Header: /Commando/Code/Tools/max2w3d/hiersave.cpp 56 10/30/00 6:58p Greg_h $ */
-/***********************************************************************************************
- *** Confidential - Westwood Studios ***
- ***********************************************************************************************
- * *
- * Project Name : Commando / G 3D Engine *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/hiersave.cpp $*
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 10/30/00 6:14p $*
- * *
- * $Revision:: 56 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * HierarchySaveClass::HierarchySaveClass -- constructor *
- * HierarchySaveClass::HierarchySaveClass -- constructor *
- * HierarchySaveClass::HierarchySaveClass -- constructor *
- * HierarchySaveClass::~HierarchySaveClass -- destructor *
- * HierarchySaveClass::Free -- releases all allocated memory *
- * HierarchySaveClass::Get_Node_Transform -- returns the transformation matrix of specified n*
- * HierarchySaveClass::get_relative_transform -- retruns tm between this node and its parent *
- * HierarchySaveClass::Get_Name -- returns the name of this hierarchy *
- * HierarchySaveClass::Get_Node -- Get the Max INode *
- * HierarchySaveClass::Get_Node_Name -- returns name of this hierarchy node *
- * HierarchySaveClass::Find_Named_Node -- returns index of a named node *
- * HierarchySaveClass::Get_Export_Coordinate_System - find the bone and coordinate system *
- * HierarchySaveClass::Save -- write the hierarchy into a W3D file *
- * HierarchySaveClass::Load -- read the hierarchy from a W3D file *
- * HierarchySaveClass::add_tree -- adds a node and all of its children *
- * HierarchySaveClass::add_node -- adds a single node to the tree *
- * HierarchySaveClass::Get_Fixup_Transform -- gets the "fixup" transform for a node *
- * HierarchySaveClass::fixup_matrix -- conditions a matrix *
- * HierarchySaveClass::save_header -- writes the header into a W3D file *
- * HierarchySaveClass::save_pivots -- writes the pivots into a W3D file *
- * HierarchySaveClass::save_fixups -- writes the fixup transforms into a W3D file *
- * HierarchySaveClass::load_header -- reads the header from a W3D file *
- * HierarchySaveClass::load_pivots -- reads the pivots from a W3D file *
- * HierarchySaveClass::load_fixups -- reads the fixup transforms from a W3D file *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#include "hiersave.h"
-#include "w3d_file.h"
-#include "nodefilt.h"
-#include "EULER.H"
-#include "util.h"
-#include "w3dappdata.h"
-#include "errclass.h"
-#include "exportlog.h"
-
-
-bool HierarchySaveClass::TerrainModeEnabled = false;
-
-
-/***********************************************************************************************
- * HierarchySaveClass::HierarchySaveClass -- constructor *
- * *
- * INPUT: *
- * root - root INode to construct the HTree from *
- * time - current time in Max, transforms at this time will be used *
- * treemeter - progress meter *
- * hname - name for the hierarchy tree *
- * fixup_type - can be used to force all transforms to be translation only *
- * fixuptree - htree loaded from a previous export *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/26/1997 GH : Created. *
- *=============================================================================================*/
-HierarchySaveClass::HierarchySaveClass
-(
- INode * root,
- TimeValue time,
- Progress_Meter_Class & treemeter,
- char * hname,
- int fixuptype,
- HierarchySaveClass * fixuptree
-) :
- Node(DEFAULT_NODE_ARRAY_SIZE),
- CurNode(0),
- FixupType(fixuptype),
- FixupTree(fixuptree)
-{
- CurNode = 0;
- CurTime = time;
-
- /*
- ** This code-path is activated when the user has created a custom origin. In this case, we
- ** need to compute the transform which will make all bones relative to this origin.
- */
- OriginOffsetTransform = Inverse(root->GetNodeTM(CurTime));
-
- /*
- ** Build our tree from the given tree of nodes
- */
- int rootidx = add_node(NULL,-1);
- assert(rootidx == 0);
- add_tree(root,rootidx);
-
- HierarchyHeader.Version = W3D_CURRENT_HTREE_VERSION;
- Set_W3D_Name(HierarchyHeader.Name,hname);
- HierarchyHeader.NumPivots = CurNode;
- HierarchyHeader.Center.X = 0.0f;
- HierarchyHeader.Center.Y = 0.0f;
- HierarchyHeader.Center.Z = 0.0f;
-}
-
-/***********************************************************************************************
- * HierarchySaveClass::HierarchySaveClass -- constructor *
- * *
- * INPUT: *
- * *
- * rootlist - list of root nodes to add to the htree *
- * time - current time in Max, transforms at this time will be used *
- * treemeter - progress meter *
- * hname - name for the hierarchy tree *
- * fixup_type - can be used to force all transforms to be translation only *
- * fixuptree - htree loaded from a previous export *
- * origin_offset - origin offset transform *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/26/1997 GH : Created. *
- *=============================================================================================*/
-HierarchySaveClass::HierarchySaveClass
-(
- INodeListClass * rootlist,
- TimeValue time,
- Progress_Meter_Class & treemeter,
- char * hname,
- int fixuptype,
- HierarchySaveClass * fixuptree,
- const Matrix3 & origin_offset
-) :
- Node(DEFAULT_NODE_ARRAY_SIZE),
- CurNode(0),
- FixupType(fixuptype),
- FixupTree(fixuptree),
- OriginOffsetTransform(origin_offset)
-{
- CurNode = 0;
- CurTime = time;
-
- /*
- ** Build the tree with all leaves of all of the nodes given
- */
- int rootidx = add_node(NULL,-1);
- assert(rootidx == 0);
-
- for (unsigned int i = 0; i < rootlist->Num_Nodes(); i++) {
- add_tree((*rootlist)[i],rootidx);
- }
-
- HierarchyHeader.Version = W3D_CURRENT_HTREE_VERSION;
- Set_W3D_Name(HierarchyHeader.Name,hname);
- HierarchyHeader.NumPivots = CurNode;
- HierarchyHeader.Center.X = 0.0f;
- HierarchyHeader.Center.Y = 0.0f;
- HierarchyHeader.Center.Z = 0.0f;
-
-}
-
-/***********************************************************************************************
- * HierarchySaveClass::HierarchySaveClass -- constructor *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/26/1997 GH : Created. *
- *=============================================================================================*/
-HierarchySaveClass::HierarchySaveClass():
- Node(NULL),
- CurNode(0),
- CurTime(0)
-{
-}
-
-/***********************************************************************************************
- * HierarchySaveClass::~HierarchySaveClass -- destructor *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/26/1997 GH : Created. *
- *=============================================================================================*/
-HierarchySaveClass::~HierarchySaveClass(void)
-{
- Free();
-}
-
-/***********************************************************************************************
- * HierarchySaveClass::Free -- releases all allocated memory *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/26/1997 GH : Created. *
- *=============================================================================================*/
-void HierarchySaveClass::Free(void)
-{
- Node.Clear();
-}
-
-
-/***********************************************************************************************
- * HierarchySaveClass::Get_Node_Transform -- returns the transformation matrix of specified no *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/26/1997 GH : Created. *
- *=============================================================================================*/
-Matrix3 HierarchySaveClass::Get_Node_Transform(int nodeidx) const
-{
- Matrix3 tm(1);
-
- int idx = nodeidx;
-
- while (idx != -1) {
- tm = tm * get_relative_transform(idx);
- idx = Node[idx].Pivot.ParentIdx;
- }
-
- return tm;
-}
-
-
-/***********************************************************************************************
- * HierarchySaveClass::get_relative_transform -- retruns tm between this node and its parent *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/26/1997 GH : Created. *
- *=============================================================================================*/
-Matrix3 HierarchySaveClass::get_relative_transform(int nodeidx) const
-{
- assert(nodeidx >= 0);
- assert(nodeidx < CurNode);
-
- Point3 trans;
- Quat rot;
- Matrix3 tm(true);
- Matrix3 rtm(true);
-
- trans.x = Node[nodeidx].Pivot.Translation.X;
- trans.y = Node[nodeidx].Pivot.Translation.Y;
- trans.z = Node[nodeidx].Pivot.Translation.Z;
-
- // WARNING! I had to fudge the orientation
- // quaternion (Max's representation seems to
- // rotate in the opposite sense as mine...)
- rot[0] = -Node[nodeidx].Pivot.Rotation.Q[0];
- rot[1] = -Node[nodeidx].Pivot.Rotation.Q[1];
- rot[2] = -Node[nodeidx].Pivot.Rotation.Q[2];
- rot[3] = Node[nodeidx].Pivot.Rotation.Q[3];
-
- tm.Translate(trans);
- rot.MakeMatrix(rtm);
- tm = rtm * tm;
-
- return tm;
-}
-
-
-/***********************************************************************************************
- * HierarchySaveClass::Get_Name -- returns the name of this hierarchy *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/26/1997 GH : Created. *
- *=============================================================================================*/
-const char * HierarchySaveClass::Get_Name(void) const
-{
- return HierarchyHeader.Name;
-}
-
-
-/***********************************************************************************************
- * HierarchySaveClass::Get_Node -- Get the Max INode *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 1/15/98 GTH : Created. *
- *=============================================================================================*/
-INode * HierarchySaveClass::Get_Node(int node) const
-{
- assert(node >= 0);
- assert(node < CurNode);
-
- return Node[node].MaxNode;
-}
-
-/***********************************************************************************************
- * HierarchySaveClass::Get_Node_Name -- returns name of this hierarchy node *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/26/1997 GH : Created. *
- *=============================================================================================*/
-const char * HierarchySaveClass::Get_Node_Name(int node) const
-{
- assert(node >= 0);
- assert(node < CurNode);
-
- return Node[node].Pivot.Name;
-}
-
-
-/***********************************************************************************************
- * HierarchySaveClass::Find_Named_Node -- returns index of a named node *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/26/1997 GH : Created. *
- *=============================================================================================*/
-int HierarchySaveClass::Find_Named_Node(const char * name) const
-{
- int match = -1;
- for (int index=0; indexGetName());
-
- boneidx = Find_Named_Node(name);
-
- if (boneidx != -1) {
-
- /*
- ** We found the parent bone!
- */
- done = true;
-
- } else if (Is_Origin(pbone)) {
-
- /*
- ** Don't go up past our origin, use this as our bone.
- */
- boneidx = 0;
- done = true;
-
- } else {
-
- /*
- ** Nope, try the next parent
- */
- pbone = pbone->GetParentNode();
- assert(pbone != NULL);
-
-#if 0
- if (pbone == NULL) {
-
- /*
- ** mesh isn't connected to a bone, use the root
- */
- boneidx = 0;
- pbone = node;
- done = true;
- }
-#endif
- }
- }
-
- if (set_bone_index != NULL) {
- *set_bone_index = boneidx;
- }
- if (set_bone_node != NULL) {
- *set_bone_node = pbone;
- }
- if (set_transform != NULL) {
- *set_transform = Get_Fixup_Transform(boneidx) * pbone->GetNodeTM(CurTime);
- }
-}
-
-/***********************************************************************************************
- * HierarchySaveClass::Save -- write the hierarchy into a W3D file *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/26/1997 GH : Created. *
- *=============================================================================================*/
-bool HierarchySaveClass::Save(ChunkSaveClass & csave)
-{
- ExportLog::printf("\nSaving Hierarchy Tree %s.\n",HierarchyHeader.Name);
- ExportLog::printf("Node Count: %d\n",CurNode);
- ExportLog::printf("Nodes: \n");
- for (int inode = 0; inode < CurNode; inode++) {
- ExportLog::printf(" %s\n",Node[inode].Pivot.Name);
- }
-
- if (!csave.Begin_Chunk(W3D_CHUNK_HIERARCHY)) {
- return false;
- }
-
- if (!save_header(csave)) {
- return false;
- }
-
- if (!save_pivots(csave)) {
- return false;
- }
-
- if (!save_fixups(csave)) {
- return false;
- }
-
- if (!csave.End_Chunk()) {
- return false;
- }
-
- return true;
-}
-
-
-/***********************************************************************************************
- * HierarchySaveClass::Load -- read the hierarchy from a W3D file *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/26/1997 GH : Created. *
- *=============================================================================================*/
-bool HierarchySaveClass::Load(ChunkLoadClass & cload)
-{
- Free();
- bool error = false;
-
- while (cload.Open_Chunk()) {
- switch (cload.Cur_Chunk_ID()) {
- case W3D_CHUNK_HIERARCHY_HEADER:
- if (!load_header(cload)) error = true;
- break;
- case W3D_CHUNK_PIVOTS:
- if (!load_pivots(cload)) error = true;
- break;
- case W3D_CHUNK_PIVOT_FIXUPS:
- if (!load_fixups(cload)) error = true;
- break;
- default:
- break;
- }
-
- if (!cload.Close_Chunk() || error) {
- return false;
- }
- }
-
- CurNode = HierarchyHeader.NumPivots;
-
- return true;
-}
-
-
-/***********************************************************************************************
- * HierarchySaveClass::add_tree -- adds a node and all of its children *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/26/1997 GH : Created. *
- *=============================================================================================*/
-void HierarchySaveClass::add_tree(INode * node,int pidx)
-{
- int nextparent;
-
- if (node->IsHidden ()) {
-
- // if the node is hidden, do not add it but add its children to the current parent.
- nextparent = pidx;
-
- } else if (TerrainModeEnabled && (Is_Normal_Mesh(node) || Is_Null_Object(node))) {
-
- // terrain optimization, normal meshes are not allowed to have transforms
- nextparent = pidx;
-
- } else if (!Is_Bone(node)) {
-
- // This node isn't a bone, don't add it
- nextparent = pidx;
-
- } else {
-
- // Add new pivot! it will be parent of all below it.
- nextparent = add_node(node,pidx);
-
- }
-
- // Add all of this nodes children
- for (int i=0; i < node->NumberOfChildren(); i++) {
- add_tree(node->GetChildNode(i),nextparent);
- }
-}
-
-
-/***********************************************************************************************
- * HierarchySaveClass::add_node -- adds a single node to the tree *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/26/1997 GH : Created. *
- *=============================================================================================*/
-int HierarchySaveClass::add_node(INode * node,int pidx)
-{
- /*
- ** 'grow' the node array if necessary
- */
- if (CurNode >= Node.Length ()) {
- Node.Resize (Node.Length () + NODE_ARRAY_GROWTH_SIZE);
- }
-
- /*
- ** setup the pivot
- */
- Node[CurNode].MaxNode = node;
- Node[CurNode].Pivot.ParentIdx = pidx;
-
- if (node) {
- Set_W3D_Name(Node[CurNode].Pivot.Name,node->GetName());
- } else {
- Set_W3D_Name(Node[CurNode].Pivot.Name,"RootTransform");
- }
-
- /*
- ** Now, check if there is a bone with this W3D name already
- ** if there is, scold the user and bail out
- */
- if (Find_Named_Node(Node[CurNode].Pivot.Name) != -1) {
- char buf[128];
- sprintf(buf,"Bones with duplicate names found!\nDuplicated Name: %s\n",Node[CurNode].Pivot.Name);
- throw ErrorClass(buf);
- }
-
- /*
- ** Compute the transformation for this node
- */
- Matrix3 maxnodeTM(1);
- Matrix3 ournodeTM(1);
- Matrix3 fixupTM(1);
- Point3 trans(0,0,0);
- Quat rot(1);
- Point3 scale(1,1,1);
-
- if (node) {
- maxnodeTM = node->GetNodeTM(CurTime) * OriginOffsetTransform;
- } else {
- maxnodeTM = Matrix3(1);
- }
-
- /*
- ** If this tree is being "fixed up" the first thing we do
- ** is to transform Max's nodeTM by the fixup transform.
- ** This is done when a base pose was created using our own
- ** types of transforms and we want to apply the same
- ** changes to this tree.
- **
- ** Note that if FixupType is not "NONE", FixupTree must be NULL,
- */
- assert(!((FixupTree != NULL) && (FixupType != MATRIX_FIXUP_NONE)));
-
- if (FixupTree != NULL) {
- int fi = FixupTree->Find_Named_Node(Node[CurNode].Pivot.Name);
- if (fi == -1) {
- char buf[128];
- sprintf(buf,"Incompatible Base Pose!\nMissing Bone: %s\n",Node[CurNode].Pivot.Name);
- throw ErrorClass(buf);
- }
-
- Matrix3 fixup = FixupTree->Get_Fixup_Transform(fi);
-
- maxnodeTM = fixup * maxnodeTM;
- }
-
-
- ournodeTM = fixup_matrix(maxnodeTM);
- fixupTM = ournodeTM * Inverse(maxnodeTM);
-
- /*
- ** Now, make ournodeTM relative to its parent transform. We
- ** will always store relative transformations. (Also, note
- ** that it is relative to our version of the parent transform
- ** which is not necessarily the same as the MAX version...)
- */
- if (pidx != -1) {
- Matrix3 parentTM = Get_Node_Transform(pidx);
- Matrix3 pinv = Inverse(parentTM);
- ournodeTM = ournodeTM * pinv;
- }
-
-
- /*
- ** Break the matrix down into a rotation and translation.
- */
- DecomposeMatrix(ournodeTM,trans,rot,scale);
-
- /*
- ** Save the "fixup" matrix
- */
- for (int j=0;j<4;j++) {
- Point3 row = fixupTM.GetRow(j);
- Node[CurNode].Fixup.TM[j][0] = row.x;
- Node[CurNode].Fixup.TM[j][1] = row.y;
- Node[CurNode].Fixup.TM[j][2] = row.z;
- }
-
- /*
- ** Set the translation and rotation for this pivot.
- */
- Node[CurNode].Pivot.Translation.X = trans.x;
- Node[CurNode].Pivot.Translation.Y = trans.y;
- Node[CurNode].Pivot.Translation.Z = trans.z;
-
- Node[CurNode].Pivot.Rotation.Q[0] = -rot[0];
- Node[CurNode].Pivot.Rotation.Q[1] = -rot[1];
- Node[CurNode].Pivot.Rotation.Q[2] = -rot[2];
- Node[CurNode].Pivot.Rotation.Q[3] = rot[3];
-
- /*
- ** Compute the Euler angles and set them.
- */
- Matrix3 rotmat;
- rot.MakeMatrix(rotmat);
- EulerAnglesClass eangs(rotmat,EulerOrderXYZr);
-
- Node[CurNode].Pivot.EulerAngles.X = eangs.Get_Angle(0);
- Node[CurNode].Pivot.EulerAngles.Y = eangs.Get_Angle(1);
- Node[CurNode].Pivot.EulerAngles.Z = eangs.Get_Angle(2);
-
- return CurNode++;
-}
-
-/***********************************************************************************************
- * HierarchySaveClass::Get_Fixup_Transform -- gets the "fixup" transform for a node *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/26/1997 GH : Created. *
- *=============================================================================================*/
-Matrix3 HierarchySaveClass::Get_Fixup_Transform(int node) const
-{
- assert(node >= 0);
- assert(node < CurNode);
-
- Matrix3 m;
-
- for (int j=0;j<4;j++) {
- m.SetRow(j,Point3(Node[node].Fixup.TM[j][0],Node[node].Fixup.TM[j][1],Node[node].Fixup.TM[j][2]));
- }
-
- return m;
-}
-
-/***********************************************************************************************
- * HierarchySaveClass::fixup_matrix -- conditions a matrix *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/26/1997 GH : Created. *
- *=============================================================================================*/
-Matrix3 HierarchySaveClass::fixup_matrix(const Matrix3 & csrc) const
-{
- Matrix3 src = csrc; // the GetTrans function is not const correct...
- Matrix3 newtm(1);
- Point3 trans;
- Quat rot;
- Point3 scale;
-
- switch (FixupType) {
- case MATRIX_FIXUP_NONE:
- newtm = src;
- break;
-
- case MATRIX_FIXUP_TRANS:
- newtm.SetTrans(src.GetTrans());
- newtm = Cleanup_Orthogonal_Matrix(newtm);
- break;
-
- case MATRIX_FIXUP_TRANS_ROT:
- DecomposeMatrix(src,trans,rot,scale);
- rot.MakeMatrix(newtm);
- newtm.SetTrans(trans);
- newtm = Cleanup_Orthogonal_Matrix(newtm);
- break;
- };
-
- return newtm;
-}
-
-
-/***********************************************************************************************
- * HierarchySaveClass::save_header -- writes the header into a W3D file *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/26/1997 GH : Created. *
- *=============================================================================================*/
-bool HierarchySaveClass::save_header(ChunkSaveClass & csave)
-{
- if (!csave.Begin_Chunk(W3D_CHUNK_HIERARCHY_HEADER)) {
- return false;
- }
-
- if (csave.Write(&HierarchyHeader,sizeof(HierarchyHeader)) != sizeof(HierarchyHeader)) {
- return false;
- }
-
- if (!csave.End_Chunk()) {
- return false;
- }
-
- return true;
-}
-
-
-/***********************************************************************************************
- * HierarchySaveClass::save_pivots -- writes the pivots into a W3D file *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/26/1997 GH : Created. *
- *=============================================================================================*/
-bool HierarchySaveClass::save_pivots(ChunkSaveClass & csave)
-{
- if (!csave.Begin_Chunk(W3D_CHUNK_PIVOTS)) {
- return false;
- }
-
- for (uint32 i=0; i.
-*/
-
-/* $Header: /Commando/Code/Tools/max2w3d/hiersave.h 29 10/26/00 5:59p Greg_h $ */
-/***********************************************************************************************
- *** Confidential - Westwood Studios ***
- ***********************************************************************************************
- * *
- * Project Name : Commando / G 3D Engine *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/hiersave.h $*
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 10/26/00 5:09p $*
- * *
- * $Revision:: 29 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#ifndef HIERSAVE_H
-#define HIERSAVE_H
-
-#include "always.h"
-
-#include
-#include
-
-#ifndef W3D_FILE_H
-#include "w3d_file.h"
-#endif
-
-#ifndef PROGRESS_H
-#include "PROGRESS.H"
-#endif
-
-#ifndef CHUNKIO_H
-#include "chunkio.h"
-#endif
-
-#ifndef NODELIST_H
-#include "nodelist.h"
-#endif
-
-#ifndef VECTOR_H
-#include "Vector.H"
-#endif
-
-
-
-struct HierarchyNodeStruct
-{
- INode * MaxNode;
- W3dPivotStruct Pivot;
- W3dPivotFixupStruct Fixup;
-
- bool operator == (const HierarchyNodeStruct & that) { return false; }
- bool operator != (const HierarchyNodeStruct & that) { return !(*this == that); }
-};
-
-
-class HierarchySaveClass
-{
-
-public:
-
- enum {
- MATRIX_FIXUP_NONE = 0,
- MATRIX_FIXUP_TRANS = 1,
- MATRIX_FIXUP_TRANS_ROT = 2
- };
-
- HierarchySaveClass();
-
- HierarchySaveClass(
- INode * root,
- TimeValue time,
- Progress_Meter_Class & treemeter,
- char * hname,
- int fixup_type = MATRIX_FIXUP_NONE,
- HierarchySaveClass * fixuptree = NULL);
-
- HierarchySaveClass(
- INodeListClass * rootlist,
- TimeValue time,
- Progress_Meter_Class & treemeter,
- char * hname,
- int fixup_type = MATRIX_FIXUP_NONE,
- HierarchySaveClass * fixuptree = NULL,
- const Matrix3 & origin_offset = Matrix3(1));
-
- ~HierarchySaveClass();
-
- bool Save(ChunkSaveClass & csave);
- bool Load(ChunkLoadClass & cload);
- int Num_Nodes(void) const { return CurNode; }
- const char * Get_Name(void) const;
- const char * Get_Node_Name(int node) const;
-
- // get ahold of the max inode
- INode * Get_Node(int node) const;
-
- // Returns the node's transform from object to world space
- Matrix3 Get_Node_Transform(int node) const;
-
- // Returns the node's transform relative to its parent
- Matrix3 Get_Node_Relative_Transform(int node) const { return get_relative_transform(node); }
-
- // Get the fixup matrix for the given pivot (always applied to the *relative* transform)
- Matrix3 Get_Fixup_Transform(int node) const;
-
- // Finds a node by name
- int Find_Named_Node(const char * name) const;
-
- // Get the coordinate system to use when exporting the given INode. Note that this
- // function takes into account the multiple skeletons present when exporting LOD models.
- void Get_Export_Coordinate_System(INode * node,int * set_bone_index,INode ** set_bone_node,Matrix3 * set_transform);
-
- // Turning on terrian mode will cause all HTrees to force all normal meshes to be
- // attached to the RootTransform regardless of the status of their 'Export_Transform' flag
- static void Enable_Terrain_Optimization(bool onoff) { TerrainModeEnabled = onoff; }
-
-private:
-
- enum { MAX_PIVOTS = 4096, DEFAULT_NODE_ARRAY_SIZE = 512, NODE_ARRAY_GROWTH_SIZE = 32 };
-
- TimeValue CurTime;
- W3dHierarchyStruct HierarchyHeader;
- DynamicVectorClass Node;
- int CurNode;
- int FixupType;
- Matrix3 OriginOffsetTransform; // this transform makes a node relative to the origin
- HierarchySaveClass * FixupTree;
-
- static bool TerrainModeEnabled;
-
- void add_tree(INode * node,int pidx);
- int add_node(INode * node,int pidx);
-
- bool save_header(ChunkSaveClass & csave);
- bool save_pivots(ChunkSaveClass & csave);
- bool save_fixups(ChunkSaveClass & csave);
-
- bool load_header(ChunkLoadClass & cload);
- bool load_pivots(ChunkLoadClass & cload);
- bool load_fixups(ChunkLoadClass & cload);
-
- Matrix3 get_relative_transform(int nodeidx) const;
- Matrix3 fixup_matrix(const Matrix3 & src) const;
- void Free(void);
-};
-
-#endif /*HIERSAVE_H*/
\ No newline at end of file
diff --git a/Generals/Code/Tools/WW3D/max2w3d/hlodsave.cpp b/Generals/Code/Tools/WW3D/max2w3d/hlodsave.cpp
deleted file mode 100644
index 065ab1e228d..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/hlodsave.cpp
+++ /dev/null
@@ -1,426 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Renegade / G *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/hlodsave.cpp $*
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 11/07/00 5:24p $*
- * *
- * $Revision:: 9 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * -- The constructor builds the whole HLOD tree in a *
- * -- Destructor blows away the dynamic memory we used. *
- * -- Method called when saving to a W3D file. Saves the chunks *
- * -- Write the header *
- * -- Writes each LOD *
- * -- Writes the mesh to bone connectivity info for each mesh in an LOD. *
- * HLodSaveClass::save_aggregate_array -- save the aggregates (if any) *
- * HLodSaveClass::save_proxy_array -- save the array of proxies (if any) *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#include "hlodsave.h"
-#include "meshcon.h"
-#include "errclass.h"
-#include "util.h"
-#include "w3dappdata.h"
-#include "wwmath.h" // NO_MAX_SCREEN_SIZE
-#include "exportlog.h"
-
-
-
-/* Behold, the applicable snippets of code from w3d_file.h that are applicable to this module!
-
- W3D_CHUNK_HLOD =0x00000700, // description of an HLod object (see HLodClass)
- W3D_CHUNK_HLOD_HEADER, // general information such as name and version
- W3D_CHUNK_HLOD_LOD_ARRAY, // wrapper around the array of objects for each level of detail
- W3D_CHUNK_HLOD_LOD_ARRAY_HEADER, // info on the objects in this level of detail array
- W3D_CHUNK_HLOD_SUB_OBJECT, // an object in this level of detail array
-
-struct W3dHLodHeaderStruct
-{
- uint32 Version;
- uint32 LodCount;
- char Name[W3D_NAME_LEN];
- char HierarchyName[W3D_NAME_LEN]; // name of the hierarchy tree to use (\0 if none)
-};
-
-struct W3dHLodArrayHeaderStruct
-{
- uint32 ModelCount;
- float32 MaxScreenSize; // if model is bigger than this, switch to higher lod.
-};
-
-struct W3dHLodSubObjectStruct
-{
- uint32 BoneIndex;
- char Name[W3D_NAME_LEN*2];
-};
-*/
-
-
-/***********************************************************************************************
- * HLodSaveClass -- The constructor builds the whole HLOD tree in a form suitable for saving *
- * to a W3D file. *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 9/14/1999 AJA : Created. *
- *=============================================================================================*/
-HLodSaveClass::HLodSaveClass (MeshConnectionsClass **connections, int lod_count, TimeValue CurTime,
- char *name, const char *htree_name, Progress_Meter_Class &meter,
- INodeListClass *origin_list)
-: lod_array(NULL)
-{
- /*
- ** Fill in the W3dHLodHeaderStruct
- */
- header.Version = W3D_CURRENT_HLOD_VERSION;
- header.LodCount = lod_count;
- Set_W3D_Name(header.Name, name);
- Set_W3D_Name(header.HierarchyName, htree_name);
- ExportLog::printf("\nExporting HLOD object: %s\n",header.Name);
- ExportLog::printf(" lod count: %d\n",header.LodCount);
-
- /*
- ** Create the array of stuff for each LOD.
- */
- lod_array = new HLodArrayEntry[lod_count];
- if (!lod_array)
- throw ErrorClass("Out Of Memory!");
-
- int i;
- for (i = 0; i < lod_count; i++)
- {
-
- ExportLog::printf(" Exporting LOD Array %d\n",i);
-
- INode *origin = connections[i]->Get_Origin();
- int sub_obj_count = connections[i]->Get_Sub_Object_Count();
- lod_array[i].Allocate_Sub_Objects(sub_obj_count);
- lod_array[i].header.ModelCount = sub_obj_count;
-
- float screen_size = NO_MAX_SCREEN_SIZE;
- if (origin)
- origin->GetUserPropFloat("MaxScreenSize", screen_size);
- lod_array[i].header.MaxScreenSize = screen_size;
-
- /*
- ** Create the info per mesh in this LOD.
- */
- int j;
- W3dHLodSubObjectStruct *sub_obj = lod_array[i].sub_obj;
- ExportLog::printf(" sub-object count: %d\n",sub_obj_count);
- for (j = 0; j < sub_obj_count; j++)
- {
- char *mesh_name;
- int bone_index;
- INode *mesh_node;
- if (!connections[i]->Get_Sub_Object_Data(j, &mesh_name, &bone_index, &mesh_node))
- throw ErrorClass("Model %s is missing connection data!", name);
-
- strcpy(sub_obj[j].Name, mesh_name);
- sub_obj[j].BoneIndex = bone_index;
-
- ExportLog::printf(" Sub Object: %s Bone: %d\n",mesh_name,bone_index);
- }
- }
-
- /*
- ** Copy aggregates from the Top-Level LOD
- */
- int agg_count = connections[lod_count-1]->Get_Aggregate_Count();
- aggregate_array.Allocate_Sub_Objects(agg_count);
- aggregate_array.header.ModelCount = agg_count;
- aggregate_array.header.MaxScreenSize = 0.0f;
-
- ExportLog::printf(" Exporting Aggregates:\n");
- ExportLog::printf(" aggregate count: %d\n",agg_count);
-
- for (i=0; iGet_Aggregate_Data(i, &mesh_name, &bone_index, &mesh_node);
-
- W3dHLodSubObjectStruct & sub_obj = aggregate_array.sub_obj[i];
- strcpy(sub_obj.Name, mesh_name);
- sub_obj.BoneIndex = bone_index;
-
- ExportLog::printf(" Aggregate object: %s Bone: %d\n",mesh_name,bone_index);
-
- }
-
- /*
- ** Copy the proxy objects from the Top-Level LOD
- */
- int proxy_count = connections[lod_count-1]->Get_Proxy_Count();
- proxy_array.Allocate_Sub_Objects(proxy_count);
- proxy_array.header.ModelCount = proxy_count;
- proxy_array.header.MaxScreenSize = 0.0f;
-
- ExportLog::printf(" Exporting Proxies\n");
- ExportLog::printf(" proxy count: %d\n",proxy_count);
- for (i=0; iGet_Proxy_Data(i, &mesh_name, &bone_index, &mesh_node);
-
- W3dHLodSubObjectStruct & sub_obj = proxy_array.sub_obj[i];
- strcpy(sub_obj.Name, mesh_name);
- sub_obj.BoneIndex = bone_index;
-
- ExportLog::printf(" Proxy object: %s Bone: %d\n",mesh_name,bone_index);
- }
-
-}
-
-
-/***********************************************************************************************
- * ~HLodSaveClass -- Destructor blows away the dynamic memory we used. *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 9/14/1999 AJA : Created. *
- *=============================================================================================*/
-HLodSaveClass::~HLodSaveClass (void)
-{
- if (lod_array)
- {
- delete []lod_array;
- lod_array = NULL;
- }
-}
-
-
-/***********************************************************************************************
- * HLodSaveClass::Save -- Method called when saving to a W3D file. Saves the chunks that *
- * define a HLOD. *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 9/14/1999 AJA : Created. *
- *=============================================================================================*/
-bool HLodSaveClass::Save(ChunkSaveClass &csave)
-{
- if (!lod_array)
- return false;
-
- if (!csave.Begin_Chunk(W3D_CHUNK_HLOD))
- return false;
-
- if (!save_header(csave))
- return false;
-
- if (!save_lod_arrays(csave))
- return false;
-
- if (!save_aggregate_array(csave))
- return false;
-
- if (!save_proxy_array(csave))
- return false;
-
- if (!csave.End_Chunk())
- return false;
-
- return true;
-}
-
-
-/***********************************************************************************************
- * HLodSaveClass::save_header -- Write the header *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 9/14/1999 AJA : Created. *
- *=============================================================================================*/
-bool HLodSaveClass::save_header (ChunkSaveClass &csave)
-{
- if (!csave.Begin_Chunk(W3D_CHUNK_HLOD_HEADER))
- return false;
-
- if (csave.Write(&header, sizeof(header)) != sizeof(header))
- return false;
-
- if (!csave.End_Chunk())
- return false;
-
- return true;
-}
-
-
-/***********************************************************************************************
- * HLodSaveClass::save_lod_arrays -- Writes each LOD *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 9/14/1999 AJA : Created. *
- *=============================================================================================*/
-bool HLodSaveClass::save_lod_arrays(ChunkSaveClass &csave)
-{
- for (int i = 0; i < header.LodCount; i++)
- {
- if (!csave.Begin_Chunk(W3D_CHUNK_HLOD_LOD_ARRAY))
- return false;
-
- if (!save_sub_object_array(csave, lod_array[i]))
- return false;
-
- if (!csave.End_Chunk())
- return false;
- }
-
- return true;
-}
-
-
-
-/***********************************************************************************************
- * HLodSaveClass::save_aggregate_array -- save the aggregates (if any) *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/25/2000 gth : Created. *
- *=============================================================================================*/
-bool HLodSaveClass::save_aggregate_array(ChunkSaveClass & csave)
-{
- if (aggregate_array.num_sub_objects > 0) {
- if (!csave.Begin_Chunk(W3D_CHUNK_HLOD_AGGREGATE_ARRAY))
- return false;
-
- if (!save_sub_object_array(csave, aggregate_array))
- return false;
-
- if (!csave.End_Chunk())
- return false;
- }
- return true;
-}
-
-
-/***********************************************************************************************
- * HLodSaveClass::save_proxy_array -- save the array of proxies (if any) *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/27/2000 gth : Created. *
- *=============================================================================================*/
-bool HLodSaveClass::save_proxy_array(ChunkSaveClass & csave)
-{
- if (proxy_array.num_sub_objects > 0) {
- if (!csave.Begin_Chunk(W3D_CHUNK_HLOD_PROXY_ARRAY))
- return false;
-
- if (!save_sub_object_array(csave, proxy_array))
- return false;
-
- if (!csave.End_Chunk())
- return false;
- }
- return true;
-}
-
-
-/***********************************************************************************************
- * HLodSaveClass::save_sub_object_array -- Writes the mesh to bone connectivity info for each *
- * mesh in an LOD. *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 9/14/1999 AJA : Created. *
- *=============================================================================================*/
-bool HLodSaveClass::save_sub_object_array(ChunkSaveClass &csave, const HLodArrayEntry & array)
-{
- if (!csave.Begin_Chunk(W3D_CHUNK_HLOD_SUB_OBJECT_ARRAY_HEADER))
- return false;
-
- if (csave.Write(&(array.header), sizeof(array.header)) != sizeof(array.header))
- return false;
-
- if (!csave.End_Chunk())
- return false;
-
- for (int j = 0; j < array.num_sub_objects; j++)
- {
- if (!csave.Begin_Chunk(W3D_CHUNK_HLOD_SUB_OBJECT))
- return false;
-
- if (csave.Write(&(array.sub_obj[j]), sizeof(array.sub_obj[j])) != sizeof(array.sub_obj[j]))
- return false;
-
- if (!csave.End_Chunk())
- return false;
- }
-
- return true;
-}
-
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/hlodsave.h b/Generals/Code/Tools/WW3D/max2w3d/hlodsave.h
deleted file mode 100644
index a74189285be..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/hlodsave.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Renegade / G *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/hlodsave.h $*
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 10/27/00 10:22a $*
- * *
- * $Revision:: 4 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#ifndef HLODSAVE_H
-#define HLODSAVE_H
-
-#include "always.h"
-
-#include
-#include
-
-#include "w3d_file.h"
-#include "PROGRESS.H"
-#include "chunkio.h"
-#include "meshcon.h"
-
-
-class INodeListClass;
-class MeshConnectionsClass;
-
-
-/**
-** HLodSaveClass
-** This object takes an array of mesh-connections objects and exports an LOD model
-** constructed from them.
-*/
-class HLodSaveClass
-{
-public:
- HLodSaveClass (MeshConnectionsClass **connections, int lod_count, TimeValue CurTime,
- char *name, const char *htree_name, Progress_Meter_Class &meter,
- INodeListClass *origin_list);
- ~HLodSaveClass (void);
-
- bool Save (ChunkSaveClass &csave);
-
-
-protected:
-
- /*
- ** class HLodArrayEntry hold the HLOD tree that we will save out in the Save() method.
- */
- class HLodArrayEntry
- {
- public:
- W3dHLodArrayHeaderStruct header;
- W3dHLodSubObjectStruct *sub_obj;
- int num_sub_objects;
-
- HLodArrayEntry (int num_sub_objs = 0)
- {
- sub_obj = NULL;
- num_sub_objects = 0;
- Allocate_Sub_Objects(num_sub_objs);
- }
-
- ~HLodArrayEntry (void)
- {
- if (sub_obj)
- {
- delete sub_obj;
- sub_obj = NULL;
- num_sub_objects = 0;
- }
- }
-
- bool Allocate_Sub_Objects (int num)
- {
- if (num <= 0) return false;
- num_sub_objects = 0;
- sub_obj = new W3dHLodSubObjectStruct[num];
- if (!sub_obj) return false;
- num_sub_objects = num;
- return true;
- }
-
- bool operator == (const HLodArrayEntry & that) { return false; }
- bool operator != (const HLodArrayEntry & that) { return !(*this == that); }
- };
-
- bool save_header (ChunkSaveClass &csave);
- bool save_lod_arrays (ChunkSaveClass &csave);
- bool save_aggregate_array (ChunkSaveClass & csave);
- bool save_proxy_array(ChunkSaveClass & csave);
- bool save_sub_object_array(ChunkSaveClass & csave, const HLodArrayEntry & array);
-
- W3dHLodHeaderStruct header;
- HLodArrayEntry * lod_array;
- HLodArrayEntry aggregate_array;
- HLodArrayEntry proxy_array;
-};
-
-
-
-#endif
diff --git a/Generals/Code/Tools/WW3D/max2w3d/logdlg.cpp b/Generals/Code/Tools/WW3D/max2w3d/logdlg.cpp
deleted file mode 100644
index d5d26567fce..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/logdlg.cpp
+++ /dev/null
@@ -1,388 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/* $Header: /Commando/Code/Tools/max2w3d/logdlg.cpp 5 11/07/00 5:40p Greg_h $ */
-/***********************************************************************************************
- *** Confidential - Westwood Studios ***
- ***********************************************************************************************
- * *
- * Project Name : Commando Tools - W3D export *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/logdlg.cpp $*
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 11/07/00 4:24p $*
- * *
- * $Revision:: 5 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#include "logdlg.h"
-#include "resource.h"
-#include "dllmain.h"
-#include "w3dexp.h"
-#include "util.h"
-#include "rawfile.h"
-#include "units.h"
-
-
-/*
-** Static functions
-*/
-static BOOL CALLBACK _logdata_dialog_proc(HWND Hwnd,UINT message,WPARAM wParam,LPARAM lParam);
-static DWORD WINAPI _logdata_thread_function(LPVOID log_obj_ptr);
-
-
-/***********************************************************************************************
- * LogDataDialogClass::LogDataDialogClass -- constructor for the options dialog object *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 02/09/2000 JGA : Created. *
- *=============================================================================================*/
-LogDataDialogClass::LogDataDialogClass(HWND parent):
- Hwnd(NULL),
- ParentHwnd(parent),
- buffer_index(0),
- last_buffer_index(0),
- status(0)
-{
- ThreadHandle = CreateThread(NULL, 0, _logdata_thread_function, (LPVOID)this, 0, &ThreadID);
-
- if (ThreadHandle) {
- while (status == 0) {
- // sync, wait for init
- }
- }
-}
-
-LogDataDialogClass::~LogDataDialogClass(void)
-{
- status = 3;
- if (::IsWindow(Hwnd)) {
- SendMessage( Hwnd, WM_CLOSE, 0, 0 );
- }
-}
-
-
-/***********************************************************************************************
- * LogDataDialogClass::printf -- handles doing printfs into the current log window *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 02/11/2000 JGA : Created. *
- *=============================================================================================*/
-void LogDataDialogClass::printf(const char *text, ...)
-{
- va_list arguments;
- va_start(arguments, text);
-} // printf
-
-void LogDataDialogClass::printf(const char * text, va_list args)
-{
- static char string_buffer[256];
-
- vsprintf(string_buffer, text, args);
-
- HWND ctrlHwnd = GetDlgItem(Hwnd, IDC_ANIM_LOG_RICHEDIT);
-
- SendMessage(ctrlHwnd, EM_SETSEL, -1, -1 );
- SendMessage(ctrlHwnd, EM_REPLACESEL, FALSE, (long)string_buffer);
-
- last_buffer_index = buffer_index;
- buffer_index+=strlen(string_buffer);
-
- //int min,max,pos;
- //GetScrollRange(ctrlHwnd, SB_VERT, &min, &max);
- //pos = GetScrollPos(ctrlHwnd, SB_VERT);
-
- //if (pos == max) {
- SendMessage(GetDlgItem(Hwnd,IDC_ANIM_LOG_RICHEDIT), EM_SCROLLCARET, 0, 0);
- //}
-
-
-}
-
-/***********************************************************************************************
- * LogDataDialogClass::rprintf -- replace last printf, with this new printf *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 02/14/2000 JGA : Created. *
- *=============================================================================================*/
-void LogDataDialogClass::rprintf(const char *text, ...)
-{
- va_list arguments;
- va_start(arguments, text);
-
- rprintf(text,arguments);
-}
-
-void LogDataDialogClass::rprintf(const char *text, va_list args)
-{
- static char string_buffer[256];
- vsprintf(string_buffer, text, args);
-
- HWND ctrlHwnd = GetDlgItem(Hwnd, IDC_ANIM_LOG_RICHEDIT);
-
- SendMessage(ctrlHwnd, EM_SETSEL, last_buffer_index, buffer_index );
- SendMessage(ctrlHwnd, EM_REPLACESEL, FALSE, (long)string_buffer);
-
- buffer_index = strlen(string_buffer) + last_buffer_index;
-
- //int min,max,pos;
- //GetScrollRange(ctrlHwnd, SB_VERT, &min, &max);
- //pos = GetScrollPos(ctrlHwnd, SB_VERT);
-
- //SendMessage(GetDlgItem(Hwnd,IDC_ANIM_LOG_RICHEDIT), EM_SCROLLCARET, 0, 0);
-
-} // rprintf
-
-
-/***********************************************************************************************
- * LogDataDialogClass::updatebar - send message to progress meter *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 02/14/2000 JGA : Created. *
- *=============================================================================================*/
-void LogDataDialogClass::updatebar(float position, float total)
-{
- int pos;
-
- pos = ((position / total) * 100.0f);
-
- HWND ctrlHwnd = GetDlgItem(Hwnd, IDC_ANIM_COMPRESS_PROGRESS);
-
- SendMessage(ctrlHwnd, PBM_SETPOS, pos, 0 );
-
-} // updatebar
-
-
-/***********************************************************************************************
- * LogDataDialogClass::Wait_OK - Give user a chance to review log, then hit ok *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 02/14/2000 JGA : Created. *
- *=============================================================================================*/
-void LogDataDialogClass::Wait_OK()
-{
- ::EnableWindow(GetDlgItem(Hwnd,IDOK),TRUE);
- ::SetForegroundWindow(Hwnd);
-
- while (status < 2) {
- // wait for the OK
- }
-
-} // Wait_OK
-
-
-
-/***********************************************************************************************
- * LogDataDialogClass::Dialog_Proc -- Handles the windows message for the options dialog *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 07/24/1997 GH : Created. *
- *=============================================================================================*/
-bool LogDataDialogClass::Dialog_Proc
-(
- HWND hwnd,
- UINT message,
- WPARAM wParam,
- LPARAM
-)
-{
- int code = HIWORD(wParam);
-
- switch (message ) {
-
- /*******************************************************************
- * WM_INITDIALOG
- *
- * Initialize all of the custom controls for the dialog box
- *
- *******************************************************************/
- case WM_INITDIALOG:
-
- Dialog_Init();
- return TRUE;
-
-
- /*******************************************************************
- * WM_COMMAND
- *
- *
- *******************************************************************/
- case WM_COMMAND:
-
- switch (LOWORD(wParam))
- {
- case IDOK:
-
- status = 2;
-
- EndDialog(Hwnd, 1);
- Hwnd = NULL;
- return TRUE;
- break;
-
- }
- break;
-
- //case WM_VSCROLL:
- // return TRUE;
- // break;
-
- case WM_CLOSE:
-
- if (status >= 2) {
- EndDialog(Hwnd, 1);
- Hwnd = NULL;
- }
-
- return TRUE;
- break;
-
- }
- return FALSE;
-
-} // Dialog_Proc
-
-void LogDataDialogClass::Dialog_Init()
-{
-
- SetCursor(LoadCursor (NULL, IDC_ARROW));
-
- RECT desktop;
- RECT ourwin;
-
- GetWindowRect(GetDesktopWindow(), &desktop);
- GetWindowRect(Hwnd, &ourwin);
-
- int sx,sy,cx,cy;
-
- sx = ourwin.right - ourwin.left;
- sy = ourwin.bottom - ourwin.top;
-
- cx = (((desktop.right - desktop.left) - sx)/2) + desktop.left;
- cy = (((desktop.bottom - desktop.top) - sy)/2) + desktop.top;
-
- //SetWindowPos(Hwnd, HWND_TOPMOST, cx, cy, 0, 0, SWP_NOSIZE);
- SetWindowPos(Hwnd, HWND_TOP, cx, cy, 0, 0, SWP_NOSIZE);
-
- EnableWindow(GetDlgItem(Hwnd,IDOK),FALSE);
-
- status = 1; // signal init
-
-
-} // Dialog_Init
-
-
-
-/***********************************************************************************************
- * _logdata_dialog_proc -- thunks into the logdata dialog class's windows message handler *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 02/09/2000 JGA : Created. *
- *=============================================================================================*/
-BOOL CALLBACK _logdata_dialog_proc
-(
- HWND hwnd,
- UINT message,
- WPARAM wParam,
- LPARAM lParam
-)
-{
- if (message == WM_INITDIALOG) {
- LogDataDialogClass * log = (LogDataDialogClass *)lParam;
- log->Hwnd = hwnd;
- ::SetProp(hwnd,"LogDataDialogClass",(HANDLE)log);
- }
-
- LogDataDialogClass * log = (LogDataDialogClass *)::GetProp(hwnd,"LogDataDialogClass");
-
- if (message == WM_DESTROY) {
- ::RemoveProp(hwnd,"LogDataDialogClass");
- }
-
- if (log) {
- return log->Dialog_Proc(hwnd,message,wParam,lParam);
- } else {
- return FALSE;
- }
-
-} // _logdata_dialog_proc
-
-
-DWORD WINAPI _logdata_thread_function(LPVOID log_obj_ptr)
-{
- // put logdata dialog box (lpParameter is the "this" pointer of the object)
- DialogBoxParam( AppInstance,
- MAKEINTRESOURCE(IDD_W3D_LOG),
- ((LogDataDialogClass*)log_obj_ptr)->ParentHwnd,
- (DLGPROC) _logdata_dialog_proc,
- (LPARAM) log_obj_ptr);
-
-
- // When this exits it should terminate the thread
- return(0);
-}
-
-
-// EOF - logdlg.cpp
diff --git a/Generals/Code/Tools/WW3D/max2w3d/logdlg.h b/Generals/Code/Tools/WW3D/max2w3d/logdlg.h
deleted file mode 100644
index 23e0a12336f..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/logdlg.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/* $Header: /Commando/Code/Tools/max2w3d/logdlg.h 4 11/07/00 5:40p Greg_h $ */
-/***********************************************************************************************
- *** Confidential - Westwood Studios ***
- ***********************************************************************************************
- * *
- * Project Name : Commando Tools - W3D export *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/logdlg.h $*
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 11/07/00 3:15p $*
- * *
- * $Revision:: 4 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#ifndef LOGDLG_H
-#define LOGDLG_H
-
-#include
-
-
-class LogDataDialogClass
-{
-public:
-
- LogDataDialogClass(HWND parent);
- ~LogDataDialogClass();
-
- void Wait_OK(); // wait for user to hit OK
-
- void printf(const char *, ...);
- void printf(const char * text, va_list args);
- void rprintf(const char *, ...);
- void rprintf(const char *text, va_list args);
-
- void updatebar(float position, float total);
-
- bool Dialog_Proc(HWND hWnd,UINT message,WPARAM wParam,LPARAM);
-
-public:
-// public variables
- HWND Hwnd;
- HWND ParentHwnd;
-
-private:
-
- void Dialog_Init();
-
-private:
-
- HANDLE ThreadHandle;
- DWORD ThreadID;
-
- int last_buffer_index;
- int buffer_index;
-
-volatile int status;
-
-};
-
-
-#endif
-
-// EOF - logdlg.h
diff --git a/Generals/Code/Tools/WW3D/max2w3d/maxworldinfo.cpp b/Generals/Code/Tools/WW3D/max2w3d/maxworldinfo.cpp
deleted file mode 100644
index f37b8b59baf..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/maxworldinfo.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Max2W3d *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/maxworldinfo.cpp $*
- * *
- * Original Author:: Patrick Smith *
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 10/27/00 7:11p $*
- * *
- * $Revision:: 2 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#include "maxworldinfo.h"
-#include "geometryexporttask.h"
-
-/*
-** Get_Shared_Vertex_Normal
-** Loops through all the other meshes in the world and builds a vertex normal for
-** the verticies that share the same space and are part of the same smoothing group.
-*/
-Vector3 MaxWorldInfoClass::Get_Shared_Vertex_Normal (Vector3 pos, int smgroup)
-{
- Point3 normal(0,0,0);
- Point3 world_pos = ExportTrans * Point3(pos.X,pos.Y,pos.Z);
-
- //
- // Loop through all the meshes in the world and see which ones contain
- // verticies that share the same space and are part of the same smoothing group.
- //
- for(unsigned int index = 0; index < MeshList.Count(); index ++) {
- GeometryExportTaskClass * task = MeshList[index];
- if (task != CurrentTask) {
- normal += task->Get_Shared_Vertex_Normal(world_pos,smgroup);
- }
- }
-
- return Vector3(normal.x,normal.y,normal.z);
-}
diff --git a/Generals/Code/Tools/WW3D/max2w3d/maxworldinfo.h b/Generals/Code/Tools/WW3D/max2w3d/maxworldinfo.h
deleted file mode 100644
index d8b34590800..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/maxworldinfo.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Max2W3D *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/maxworldinfo.h $*
- * *
- * Original Author:: Patrick Smith *
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 10/27/00 6:55p $*
- * *
- * $Revision:: 2 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#ifndef MAXWORLDINFO_H
-#define MAXWORLDINFO_H
-
-
-#include
-#include "meshbuild.h"
-#include "nodelist.h"
-#include "Vector.H"
-
-
-class GeometryExportTaskClass;
-
-
-/**
-** MaxWorldInfoClass - Provides information about the max 'world' (or scene)
-** This class is used by the plugin to cause the MeshBuilder to smooth normals
-** across adjacent meshes.
-*/
-class MaxWorldInfoClass : public WorldInfoClass
-{
- public:
- MaxWorldInfoClass(DynamicVectorClass & mesh_list)
- : MeshList (mesh_list),
- SmoothBetweenMeshes (true),
- CurrentTask(NULL),
- CurrentTime(0) { }
- virtual ~MaxWorldInfoClass(void) { }
-
- // Public methods
- virtual Vector3 Get_Shared_Vertex_Normal(Vector3 pos, int smgroup);
-
- virtual GeometryExportTaskClass * Get_Current_Task(void) const { return CurrentTask; }
- virtual void Set_Current_Task(GeometryExportTaskClass * task) { CurrentTask = task; }
-
- virtual TimeValue Get_Current_Time(void) const { return CurrentTime; }
- virtual void Set_Current_Time(TimeValue &time) { CurrentTime = time; }
-
- virtual Matrix3 Get_Export_Transform(void) const { return ExportTrans; }
- virtual void Set_Export_Transform(const Matrix3 &matrix) { ExportTrans = matrix; }
-
- virtual void Allow_Mesh_Smoothing (bool onoff) { SmoothBetweenMeshes = onoff; }
- virtual bool Are_Meshes_Smoothed (void) const { return SmoothBetweenMeshes; }
-
- private:
-
- DynamicVectorClass & MeshList;
- GeometryExportTaskClass * CurrentTask;
- TimeValue CurrentTime;
- Matrix3 ExportTrans;
- bool SmoothBetweenMeshes;
-};
-
-
-
-#endif
\ No newline at end of file
diff --git a/Generals/Code/Tools/WW3D/max2w3d/meshbuild.cpp b/Generals/Code/Tools/WW3D/max2w3d/meshbuild.cpp
deleted file mode 100644
index 654a626df84..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/meshbuild.cpp
+++ /dev/null
@@ -1,1835 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : WW3D *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/meshbuild.cpp $*
- * *
- * Author:: Greg_h *
- * *
- * $Modtime:: 11/02/00 6:28p $*
- * *
- * $Revision:: 15 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * MeshBuilderClass::VertClass::Reset -- reset this vertex *
- * MeshBuilderClass::FaceClass::Reset -- rest this face *
- * MeshBuilderClass::FaceClass::Compute_Plane -- compute the plane for this face *
- * MeshBuilderClass::FaceClass::Is_Degenerate -- check if a face is degenerate *
- * MeshBuilderClass::MeshStatsStruct::Reset -- reset the stats to all false *
- * MeshBuilderClass::MeshBuilderClass -- constructor *
- * MeshBuilderClass::~MeshBuilderClass -- destructor *
- * MeshBuilderClass::Free -- release all memory in use *
- * MeshBuilderClass::Reset -- Get the builder ready to process a mesh *
- * MeshBuilderClass::Add_Face -- Add a face to the mesh *
- * MeshBuilderClass::Build_Mesh -- process the mesh *
- * MeshBuilderClass::Compute_Face_Normals -- computes all of the face normals from the index *
- * MeshBuilderClass::Verify_Face_Normals -- checks if any faces have flipped *
- * MeshBuilderClass::Compute_Vertex_Normals -- Computes the vertex normals for the mesh *
- * MeshBuilderClass::Remove_Degenerate_Faces -- discard invalid or duplicated faces *
- * MeshBuilderClass::Compute_Mesh_Stats -- compute some stats about the mesh *
- * MeshBuilderClass::Compute_Bounding_Box -- computes an axis-aligned bounding box for the m *
- * MeshBuilderClass::Compute_Bounding_Sphere -- computes a bounding sphere for the mesh *
- * MeshBuilderClass::Optimize_Mesh -- "optimize" the mesh *
- * MeshBuilderClass::Strip_Optimize_Mesh -- optimize the mesh for triangle strips *
- * MeshBuilderClass::Grow_Face_Array -- increases the size of the face array *
- * MeshBuilderClass::Sort_Vertices -- Sorts vertices according to the given key array *
- * MeshBuilderClass::Sort_Vertices_By_Bone_Index -- sorts verts by bone index *
- * MeshBuilderClass::Sort_Vertices_By_Vertex_Material -- sorts verts by vertex mtl in pass0 *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#include "meshbuild.h"
-#include "uarray.h"
-#include
-#include
-#include
-
-
-const float EPSILON = 0.0001f;
-
-/*
-** qsort compare functions
-*/
-static int face_material_compare(const void *elem1, const void *elem2);
-static int pass0_stage0_compare(const void *elem1, const void *elem2);
-static int pass0_stage1_compare(const void *elem1, const void *elem2);
-static int pass1_stage0_compare(const void *elem1, const void *elem2);
-static int pass1_stage1_compare(const void *elem1, const void *elem2);
-static int pass2_stage0_compare(const void *elem1, const void *elem2);
-static int pass2_stage1_compare(const void *elem1, const void *elem2);
-static int pass3_stage0_compare(const void *elem1, const void *elem2);
-static int pass3_stage1_compare(const void *elem1, const void *elem2);
-static int vertex_compare(const void *elem1, const void *elem2);
-
-typedef int (*COMPARE_FUNC_TYPE)(const void * elem1,const void * elem2);
-
-COMPARE_FUNC_TYPE Texture_Compare_Funcs[MeshBuilderClass::MAX_PASSES][MeshBuilderClass::MAX_STAGES] =
-{
- { pass0_stage0_compare, pass0_stage1_compare },
- { pass1_stage0_compare, pass1_stage1_compare },
- { pass2_stage0_compare, pass2_stage1_compare },
- { pass3_stage0_compare, pass3_stage1_compare },
-};
-
-
-/************************************************************************************
-**
-** FaceHasherClass, support class for the unique faces hash table. The unique
-** faces table is going to detect exactly duplicated faces and discard them. It
-** appears that the artists occasionally accidentally duplicate a face which causes
-** problems in the stripping algorithm...
-**
-************************************************************************************/
-class FaceHasherClass : public HashCalculatorClass
-{
-public:
-
- virtual bool Items_Match(const MeshBuilderClass::FaceClass & a, const MeshBuilderClass::FaceClass & b)
- {
- // Note: if we want this to detect duplicates that are "rotated", must change
- // both this function and the Compute_Hash function...
- return
- (
- (a.VertIdx[0] == b.VertIdx[0]) &&
- (a.VertIdx[1] == b.VertIdx[1]) &&
- (a.VertIdx[2] == b.VertIdx[2])
- );
- }
-
- virtual void Compute_Hash(const MeshBuilderClass::FaceClass & item)
- {
- HashVal = (int)(item.VertIdx[0]*12345.6f + item.VertIdx[1]*1714.38484f + item.VertIdx[2]*27561.3f)&1023;
- }
-
- virtual int Num_Hash_Bits(void)
- {
- return 10;
- }
-
- virtual int Num_Hash_Values(void)
- {
- return 1;
- }
-
- virtual int Get_Hash_Value(int /*index*/)
- {
- return HashVal;
- }
-
-private:
-
- int HashVal;
-
-};
-
-
-/************************************************************************************
-**
-** VertexArray, build an array of unique vertices. Can't use the UniqueArray
-** template due to the special considerations needed to properly handle smoothing
-** groups... (DAMN!!! this was the reason I *WROTE* UniqueArray, oh well :-)
-**
-************************************************************************************/
-class VertexArrayClass
-{
-public:
-
- enum
- {
- HASH_TABLE_SIZE = 4096,
- };
-
- VertexArrayClass(int maxsize,int match_normals = 0)
- {
- Verts = NULL;
- assert(maxsize > 0);
- Verts = new MeshBuilderClass::VertClass[maxsize];
- assert(Verts);
- VertCount = 0;
- UVSplits = 0;
-
- HashTable = new MeshBuilderClass::VertClass * [HASH_TABLE_SIZE];
- memset(HashTable,0,sizeof(MeshBuilderClass::VertClass *) * HASH_TABLE_SIZE);
-
- MatchNormals = match_normals;
-
- // initialize the center and extent to do nothing to the points input
- Center.Set(0.0f,0.0f,0.0f);
- Extent.Set(1.0f,1.0f,1.0f);
- }
-
- ~VertexArrayClass(void)
- {
- delete[] Verts;
- delete[] HashTable;
- }
-
- void Set_Bounds(const Vector3 & minv,const Vector3 & maxv)
- {
- Extent = (maxv - minv) / 2.0f;
- Center = (maxv + minv) / 2.0f;
- }
-
- int Submit_Vertex(const MeshBuilderClass::VertClass & vert)
- {
- // 2D floating point hashing...
- unsigned int lasthash = 0xFFFFFFFF;
- unsigned int hash;
- unsigned int shadeindex = 0xFFFFFFFF;
-
- // transform the position of the point into the range
- // -1 < p < 1 as defined by the center and extent.
- // aja/ehc 19991005 - Handle the case where an extent is zero.
- Vector3 position = (vert.Position - Center);
- double xstart;
- if(fabs(Extent.X) > EPSILON)
- xstart = (vert.Position.X - Center.X) / Extent.X;
- else
- xstart = Center.X;
-
- double ystart;
- if(fabs(Extent.Y) > EPSILON)
- ystart = (vert.Position.Y - Center.Y) / Extent.Y;
- else
- ystart = Center.Y;
-
- double x,y;
-
- for (x = xstart - EPSILON; x <= xstart + EPSILON + 0.0000001; x+= EPSILON) {
- for (y = ystart - EPSILON; y <= ystart + EPSILON + 0.000001; y+= EPSILON) {
-
- hash = compute_hash((float)x,(float)y);
-
- if (hash != lasthash) {
- MeshBuilderClass::VertClass * test_vert = HashTable[hash];
- while (test_vert) {
-
- if (Verts_Shading_Match(vert,*test_vert)) {
- if (shadeindex == 0xFFFFFFFF) {
- shadeindex = test_vert->UniqueIndex;
-
- // mask the "master" smoothed vertex's smoothing group with our
- // face's smoothing group since we are going to be smoothed with it.
- Verts[shadeindex].SharedSmGroup &= vert.SmGroup;
- }
- }
-
- if (Verts_Match(vert,*test_vert)) {
- return test_vert->UniqueIndex;
- }
- test_vert = test_vert->NextHash;
- }
- }
-
- lasthash = hash;
- }
- }
-
- // Not found, add to the end of the array
- int newindex = VertCount;
- VertCount++;
-
- Verts[newindex] = vert;
- Verts[newindex].UniqueIndex = newindex;
- if (shadeindex == 0xFFFFFFFF) {
-
- Verts[newindex].ShadeIndex = newindex;
-
- // This is a new vertex,so store the face's smoothing group into SharedSmGroup
- Verts[newindex].SharedSmGroup = Verts[newindex].SmGroup;
-
- } else {
-
- Verts[newindex].ShadeIndex = shadeindex;
-
- }
-
- // This is a new vertex, store the face's smoothing group with it
- //Verts[newindex].SmoothingGroup = face_smooth_group;
-
- // And add to the hash table
- x = (vert.Position.X - Center.X) / Extent.X;
- y = (vert.Position.Y - Center.Y) / Extent.Y;
- hash = compute_hash((float)x,(float)y);
- Verts[newindex].NextHash = HashTable[hash];
- HashTable[hash] = &Verts[newindex];
-
- return newindex;
- }
-
- int Verts_Match(const MeshBuilderClass::VertClass & v0,const MeshBuilderClass::VertClass & v1)
- {
- // if user is specifying unique id's, they must match:
- if (v0.Id != v1.Id) return 0;
-
- // position must match:
- float dp = (v0.Position - v1.Position).Length();
- if (dp > EPSILON) return 0;
-
- // normal or smoothing group must match:
- if (MatchNormals == 0) {
- int smgroup_match = ((v0.SmGroup & v1.SmGroup) || (v0.SmGroup == v1.SmGroup));
- if (!smgroup_match)
- return 0;
- } else {
- float dn = (v0.Normal - v1.Normal).Length();
- if (dn > EPSILON) return 0;
- }
-
- // colors, and material id's must match for all passes
- int pass=0;
- for (; pass < MeshBuilderClass::MAX_PASSES; pass++) {
-
- if (v0.DiffuseColor[pass] != v1.DiffuseColor[pass])
- return 0;
- if (v0.SpecularColor[pass] != v1.SpecularColor[pass])
- return 0;
- if (v0.DiffuseIllumination[pass] != v1.DiffuseIllumination[pass])
- return 0;
- if (v0.Alpha[pass] != v1.Alpha[pass])
- return 0;
- if (v0.VertexMaterialIndex[pass] != v1.VertexMaterialIndex[pass])
- return 0;
-
- }
-
- // texcoords must match for all passes and stages
- // Note: I'm checking them separately and last so that I can keep track
- // of how many splits are caused solely by u-v discontinuities...
- for (pass=0; pass 0.0000001f) {
- ok = false;
- }
- }
- return ok;
-}
-
-/***********************************************************************************************
- * MeshBuilderClass::Compute_Vertex_Normals -- Computes the vertex normals for the mesh *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * This function should only be called after the mesh has been "optimized". The algorithm *
- * relies on non-smooth vertices having been split... *
- * *
- * HISTORY: *
- * 5/15/98 GTH : Created. *
- *=============================================================================================*/
-void MeshBuilderClass::Compute_Vertex_Normals(void)
-{
- int vertidx;
- int faceidx;
- int facevertidx;
-
- /*
- ** First, zero all vertex normals
- */
- for (vertidx = 0; vertidx < VertCount; vertidx++) {
- Verts[vertidx].Normal.Set(0,0,0);
- }
-
- /*
- ** Now, go through all of the faces, accumulating the face normals into the
- ** "first" vertices containing the appropriate vertex normal for each vertex.
- */
- for (faceidx = 0; faceidx < FaceCount; faceidx++) {
- for (facevertidx = 0; facevertidx < 3; facevertidx++) {
- int vertindex = Faces[faceidx].VertIdx[facevertidx];
- int shadeindex = Verts[vertindex].ShadeIndex;
- Verts[shadeindex].Normal += Faces[faceidx].Normal;
- }
- }
-
- /*
- ** Smooth this mesh with neighboring meshes!
- */
- if (WorldInfo != NULL && WorldInfo->Are_Meshes_Smoothed ()) {
- for (vertidx = 0; vertidx < VertCount; vertidx++) {
- if (Verts[vertidx].ShadeIndex == vertidx) {
- Verts[vertidx].Normal += WorldInfo->Get_Shared_Vertex_Normal(Verts[vertidx].Position, Verts[vertidx].SharedSmGroup);
- }
- }
- }
-
- /*
- ** Propogate the accumulated normals to all of the other verts which share them
- */
- for (vertidx = 0; vertidx < VertCount; vertidx++) {
- int shadeindex = Verts[vertidx].ShadeIndex;
- Verts[vertidx].Normal = Verts[shadeindex].Normal;
- Verts[vertidx].Normal.Normalize();
- }
-}
-
-/***********************************************************************************************
- * MeshBuilderClass::Remove_Degenerate_Faces -- discard invalid or duplicated faces *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 7/10/98 GTH : Created. *
- *=============================================================================================*/
-void MeshBuilderClass::Remove_Degenerate_Faces(void)
-{
- int faceidx;
- FaceHasherClass facehasher;
- UniqueArrayClass uniquefaces(FaceCount,FaceCount/4,&facehasher);
-
- for (faceidx = 0; faceidx < FaceCount; faceidx++) {
- if (!Faces[faceidx].Is_Degenerate()) {
- uniquefaces.Add(Faces[faceidx]);
- }
- }
-
- FaceCount = uniquefaces.Count();
- AllocFaceCount = uniquefaces.Count();
- CurFace = FaceCount;
-
- delete[] Faces;
- Faces = new FaceClass[AllocFaceCount];
-
- for (faceidx = 0; faceidx < FaceCount; faceidx++) {
- Faces[faceidx] = uniquefaces.Get(faceidx);
- }
-}
-
-
-
-/***********************************************************************************************
- * MeshBuilderClass::Compute_Mesh_Stats -- compute some stats about the mesh *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/19/98 GTH : Created. *
- *=============================================================================================*/
-void MeshBuilderClass::Compute_Mesh_Stats(void)
-{
- int pass;
- int stage;
- int face_index;
- int vert_index;
-
- int tex_index[MAX_PASSES][MAX_STAGES];
- int shader_index[MAX_PASSES];
- int vmat_index[MAX_PASSES];
-
- Stats.Reset();
-
- for (pass = 0; passX = Verts[0].Position.X;
- set_min->Y = Verts[0].Position.Y;
- set_min->Z = Verts[0].Position.Z;
- set_max->X = Verts[0].Position.X;
- set_max->Y = Verts[0].Position.Y;
- set_max->Z = Verts[0].Position.Z;
-
- for (i=0; iX) set_min->X = Verts[i].Position.X;
- if (Verts[i].Position.Y < set_min->Y) set_min->Y = Verts[i].Position.Y;
- if (Verts[i].Position.Z < set_min->Z) set_min->Z = Verts[i].Position.Z;
-
- if (Verts[i].Position.X > set_max->X) set_max->X = Verts[i].Position.X;
- if (Verts[i].Position.Y > set_max->Y) set_max->Y = Verts[i].Position.Y;
- if (Verts[i].Position.Z > set_max->Z) set_max->Z = Verts[i].Position.Z;
- }
-}
-
-
-/***********************************************************************************************
- * MeshBuilderClass::Compute_Bounding_Sphere -- computes a bounding sphere for the mesh *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/29/98 GTH : Created. *
- *=============================================================================================*/
-void MeshBuilderClass::Compute_Bounding_Sphere(Vector3 * set_center,float * set_radius)
-{
- int i;
- double dx,dy,dz;
-
- // bounding sphere
- // Using the algorithm described in Graphics Gems I page 301.
- // This algorithm supposedly generates a bounding sphere within
- // 5% of the optimal one but is much faster and simpler to implement.
- Vector3 xmin(Verts[0].Position.X,Verts[0].Position.Y,Verts[0].Position.Z);
- Vector3 xmax(Verts[0].Position.X,Verts[0].Position.Y,Verts[0].Position.Z);
- Vector3 ymin(Verts[0].Position.X,Verts[0].Position.Y,Verts[0].Position.Z);
- Vector3 ymax(Verts[0].Position.X,Verts[0].Position.Y,Verts[0].Position.Z);
- Vector3 zmin(Verts[0].Position.X,Verts[0].Position.Y,Verts[0].Position.Z);
- Vector3 zmax(Verts[0].Position.X,Verts[0].Position.Y,Verts[0].Position.Z);
-
-
- // FIRST PASS:
- // finding the 6 minima and maxima points
- for (i=1; i xmax.X) {
- xmax.X = Verts[i].Position.X; xmax.Y = Verts[i].Position.Y; xmax.Z = Verts[i].Position.Z;
- }
- if (Verts[i].Position.Y < ymin.Y) {
- ymin.X = Verts[i].Position.X; ymin.Y = Verts[i].Position.Y; ymin.Z = Verts[i].Position.Z;
- }
- if (Verts[i].Position.Y > ymax.Y) {
- ymax.X = Verts[i].Position.X; ymax.Y = Verts[i].Position.Y; ymax.Z = Verts[i].Position.Z;
- }
- if (Verts[i].Position.Z < zmin.Z) {
- zmin.X = Verts[i].Position.X; zmin.Y = Verts[i].Position.Y; zmin.Z = Verts[i].Position.Z;
- }
- if (Verts[i].Position.Z > zmax.Z) {
- zmax.X = Verts[i].Position.X; zmax.Y = Verts[i].Position.Y; zmax.Z = Verts[i].Position.Z;
- }
- }
-
- // xspan = distance between the 2 points xmin and xmax squared.
- // same goes for yspan and zspan.
- dx = xmax.X - xmin.X;
- dy = xmax.Y - xmin.Y;
- dz = xmax.Z - xmin.Z;
- double xspan = dx*dx + dy*dy + dz*dz;
-
- dx = ymax.X - ymin.X;
- dy = ymax.Y - ymin.Y;
- dz = ymax.Z - ymin.Z;
- double yspan = dx*dx + dy*dy + dz*dz;
-
- dx = zmax.X - zmin.X;
- dy = zmax.Y - zmin.Y;
- dz = zmax.Z - zmin.Z;
- double zspan = dx*dx + dy*dy + dz*dz;
-
-
- // Set points dia1 and dia2 to the maximally separated pair
- // This will be the diameter of the initial sphere
- Vector3 dia1 = xmin;
- Vector3 dia2 = xmax;
- double maxspan = xspan;
-
- if (yspan > maxspan) {
- maxspan = yspan;
- dia1 = ymin;
- dia2 = ymax;
- }
- if (zspan > maxspan) {
- maxspan = zspan;
- dia1 = zmin;
- dia2 = zmax;
- }
-
-
- // Compute initial center and radius and radius squared
- Vector3 center;
- center.X = (dia1.X + dia2.X) / 2.0f;
- center.Y = (dia1.Y + dia2.Y) / 2.0f;
- center.Z = (dia1.Z + dia2.Z) / 2.0f;
-
- dx = dia2.X - center.X;
- dy = dia2.Y - center.Y;
- dz = dia2.Z - center.Z;
-
- double radsqr = dx*dx + dy*dy + dz*dz;
- double radius = sqrt(radsqr);
-
-
- // SECOND PASS:
- // Increment current sphere if any points fall outside of it.
- for (i=0; i radsqr) {
-
- // this point was outside the old sphere, compute a new
- // center point and radius which contains this point
- double testrad = sqrt(testrad2);
-
- // adjust center and radius
- radius = (radius + testrad) / 2.0;
- radsqr = radius * radius;
-
- double oldtonew = testrad - radius;
- center.X = (radius * center.X + oldtonew * Verts[i].Position.X) / testrad;
- center.Y = (radius * center.Y + oldtonew * Verts[i].Position.Y) / testrad;
- center.Z = (radius * center.Z + oldtonew * Verts[i].Position.Z) / testrad;
- }
- }
-
- *set_center = center;
- *set_radius = radius;
-}
-
-/***********************************************************************************************
- * MeshBuilderClass::Optimize_Mesh -- "optimize" the mesh *
- * *
- * Generates the array of unique vertices and sets the vertex indices in each face. Then *
- * all of the faces are sorted by material and then into stripping order. *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 5/15/98 GTH : Created. *
- *=============================================================================================*/
-void MeshBuilderClass::Optimize_Mesh(bool compute_normals)
-{
- int faceidx;
- int vertidx;
- int facevertidx;
-
- int match_normals = 0;
- if (!compute_normals) {
- match_normals = 1;
- }
-
- VertexArrayClass unique_verts(FaceCount * 3,match_normals);
-
- /*
- ** Find the min and max of the array of vertices
- */
- Vector3 minv = Faces[0].Verts[0].Position;
- Vector3 maxv = Faces[0].Verts[0].Position;
-
- for (faceidx = 0; faceidx < FaceCount; faceidx++) {
- for (facevertidx = 0; facevertidx < 3; facevertidx++) {
-
- minv.Update_Min(Faces[faceidx].Verts[facevertidx].Position);
- maxv.Update_Max(Faces[faceidx].Verts[facevertidx].Position);
- }
- }
-
- /*
- ** Tell the vertex array the bounds so that it can do better hashing.
- */
- unique_verts.Set_Bounds(minv,maxv);
-
- /*
- ** Build the array of unique vertices
- */
- for (faceidx = 0; faceidx < FaceCount; faceidx++) {
- for (facevertidx = 0; facevertidx < 3; facevertidx++) {
- Faces[faceidx].VertIdx[facevertidx] =
- unique_verts.Submit_Vertex(Faces[faceidx].Verts[facevertidx]);
- }
- }
-
- /*
- ** Assign the shared smoothing groups from each 'master' vertex
- ** to each referring vertex.
- */
- unique_verts.Propogate_Shared_Smooth_Groups();
-
- /*
- ** Replace the vertex array with the new unique vertex array
- */
- VertCount = unique_verts.VertCount;
- Verts = new VertClass[VertCount];
-
- for (vertidx=0; vertidx v1) { int tmp = v0; v0 = v1; v1 = tmp; }
-
- // hash value for the edge
- hash = (v0 + v1*119)&511;
-
- // seek edge from hash table
- for (edge = edgehash[hash]; edge; edge = edge->Next) {
- if (edge->Vertex[0] == v0 && edge->Vertex[1] == v1 && edge->MaterialIdx == mat)
- break;
- }
-
- if (edge) {
-
- // found the edge
- edge->Poly[1] = i;
-
- } else {
-
- // create new edge and link it to hash table
- edge = edgetab + edgecount++;
- edge->Next = edgehash[hash];
- edgehash[hash] = edge;
- edge->Vertex[0] = v0;
- edge->Vertex[1] = v1;
- edge->Poly[0] = i;
- edge->Poly[1] = -1;
- edge->MaterialIdx = mat;
- }
-
- pedges[i].Edge[j] = edge;
- }
- }
-
- // the following loop inserts polygons into a new polygon list until
- // all polygons have been inserted. Internally it attempts to create
- // as long strips as possible while minimizing material switches
- // and maintaining vertex reusage coherency to optimize geometry
- // engine performance.
- while (polysinserted < FaceCount) {
-
- int startpoly = -1; // best polygon found so far
- int bestc = (1<<29); // best polygon weight value found so far
- int startpass = 0; // should we start from pass 0 or 1?
- int findpass; // 0 = same material only, 1 = any polygon
- int c; // c = number of shared edges
-
- // first attempt to minimize material switches by choosing a polygon with same material
- // as the starting poly. Basically what we want is the poly with same material with
- // least shared edges and most recent vertices (as we'd like to start the strip from
- // a 'corner polygon'). This pass is done only if mesh has multiple materials.
- // The second pass scans through all polygons.
-
- // this loop is O(N*N) -> might turn a bit nasty on larger meshes. Try
- // to figure out a way to solve the problem...
-
- for (findpass = startpass; findpass < 2; findpass++)
- {
- // loop through all polygons
- for (i = 0; i < FaceCount; i++) {
-
- // if polygon not picked yet
- if (premap[i]==-1) {
-
- // if material mismatch, cannot choose poly (except in pass 1)
- if (findpass == 0 && Faces[i].TextureIndex[PolyOrderPass][PolyOrderStage] != lastmat)
- continue;
-
- // calculate number of shared edges
- for (c = 0, j = 0; j < 3; j++) {
-
- // if edge j is shared by two tris,
- // use a weight factor of vCount for each edge
- if (pedges[i].Edge[j]->Poly[1] >= 0) {
- c += (vcount+1);
- }
- }
-
- // calculate delta vertex timestamp
- for (j = 0; j < 3; j++) {
- c += (vcount-vtimestamp[Faces[i].VertIdx[j]]);
- }
-
- // if better than current best pick
- if (c < bestc) {
- bestc = c;
- startpoly = i;
- }
- }
- }
-
- // if we managed to find a suitable starting poly
- if (startpoly != -1)
- break;
- }
-
- // track the fact that we created a new strip:
- Stats.StripCount++;
-
- // update the material index
- lastmat = Faces[startpoly].TextureIndex[PolyOrderPass][PolyOrderStage];
- newmat[polysinserted] = Faces[startpoly].TextureIndex[PolyOrderPass][PolyOrderStage];
-
- // Add the selected polygon to the new polygon list.
- // for each edge of start poly, see if the "other" polygon using that edge
- // is untaken, if so, store the new polygon such that that edge index is last
-
- bool found_shared_edge = false;
- newpolys[polysinserted] = Faces[startpoly];
- FaceClass * newpoly = &(newpolys[polysinserted]);
-
- for (int edge_index = 0; (edge_index < 3) && !found_shared_edge; edge_index++) {
-
- for (int side_index = 0; (side_index < 2) && !found_shared_edge; side_index++) {
-
- // if this polygon is not the startpoly and it is not "taken", then this edge is ok!
- int poly = pedges[startpoly].Edge[edge_index]->Poly[side_index];
- if ((poly != -1) && (poly != startpoly) && (premap[poly] == -1)) {
-
- // find vert which is not on the final edge
- int first_vert = -1;
- for (int vidx=0; vidx<3; vidx++) {
- if ( (newpoly->VertIdx[vidx] != pedges[startpoly].Edge[edge_index]->Vertex[0]) &&
- (newpoly->VertIdx[vidx] != pedges[startpoly].Edge[edge_index]->Vertex[1])) {
-
- first_vert = newpoly->VertIdx[vidx];
- break;
- }
- }
- assert(first_vert != -1);
-
- // rotate the vertex indices until first_vert is the index of VertIdx[0]
- while (newpoly->VertIdx[0] != first_vert) {
- int tmp = newpoly->VertIdx[0];
- newpoly->VertIdx[0] = newpoly->VertIdx[1];
- newpoly->VertIdx[1] = newpoly->VertIdx[2];
- newpoly->VertIdx[2] = tmp;
- }
-
- // ok, we found a shareable edge and adjusted our poly so the strip
- // will start with it. Now break out of this loop...
- found_shared_edge = true;
- break;
- }
- }
- }
-
- // if a shared edge wasn't found, just copy the poly
- if (!found_shared_edge) {
- newpolys[polysinserted] = Faces[startpoly];
- }
-
- // Increment the count. Mark the vertices as used (i.e. update their timestamps)
- premap[startpoly] = polysinserted;
- polysinserted++;
-
- for (i = 0; i < 3; i++) {
- if (vtimestamp[Faces[startpoly].VertIdx[i]]==-1) {
- vtimestamp[Faces[startpoly].VertIdx[i]] = vcount++;
- }
- }
-
- // If we have no shared edges, this is a lone poly, start another strip
- if (pedges[startpoly].Edge[0]->Poly[1] == -1 &&
- pedges[startpoly].Edge[1]->Poly[1] == -1 &&
- pedges[startpoly].Edge[2]->Poly[1] == -1)
- continue;
-
- // Build the strip starting from the polygon chosen in the previous loop
- int vFIFO[2]; // vertex fifo
- int scnt = 0; // strip index count (for poly order flipping)
- int nextpoly = startpoly;
-
- vFIFO[0] = newpoly->VertIdx[1]; // setup the vFIFO
- vFIFO[1] = newpoly->VertIdx[2];
-
- while (nextpoly != -1)
- {
- startpoly = nextpoly;
- nextpoly = -1;
-
- for (i = 0; i < 3; i++) {
-
- // if edge 'i' of startpoly matches the vertices in the fifo
- if ((pedges[startpoly].Edge[i]->Vertex[0] == vFIFO[0] && pedges[startpoly].Edge[i]->Vertex[1] == vFIFO[1]) ||
- (pedges[startpoly].Edge[i]->Vertex[1] == vFIFO[0] && pedges[startpoly].Edge[i]->Vertex[0] == vFIFO[1]))
- {
-
- for (j = 0; j < 2; j++) {
-
- // if poly 'j' attached to this edge has not been used already, use it!
- if (pedges[startpoly].Edge[i]->Poly[j] > -1 &&
- premap[pedges[startpoly].Edge[i]->Poly[j]] == -1)
- {
- nextpoly = pedges[startpoly].Edge[i]->Poly[j];
- goto found;
- }
- }
- }
- }
-
- // couldn't find another poly, break from loop
- break;
-
- found:;
-
- // now, find the new vertex (two verts are on the edge, find the third)
- int nw = -1;
- for (i = 0; i < 3; i++) {
- if (Faces[nextpoly].VertIdx[i] != vFIFO[0] && Faces[nextpoly].VertIdx[i] != vFIFO[1]) {
- nw = i;
- break;
- }
- }
- assert(nw != -1);
-
- int new_vindex = Faces[nextpoly].VertIdx[nw];
-
- newmat[polysinserted] = Faces[nextpoly].TextureIndex[PolyOrderPass][PolyOrderStage];
-
- // add the poly to the newpolys array.
- newpolys[polysinserted].VertIdx[0] = vFIFO[0];
- newpolys[polysinserted].VertIdx[1] = vFIFO[1];
- newpolys[polysinserted].VertIdx[2] = new_vindex;
-
- // if we are on an even triangle, swap the vertex ordering
- if (!(scnt&1)) {
- int tmp = newpolys[polysinserted].VertIdx[0];
- newpolys[polysinserted].VertIdx[0] = newpolys[polysinserted].VertIdx[1];
- newpolys[polysinserted].VertIdx[1] = tmp;
- }
-
- // push the new vertex into the fifo
- vFIFO[0] = vFIFO[1];
- vFIFO[1] = new_vindex;
-
- if (vtimestamp[new_vindex]==-1) {
- vtimestamp[new_vindex] = vcount++;
- }
-
- premap[nextpoly] = polysinserted++;
- scnt++;
- }
-
- // scnt+1 is the number of polys that were added to the strip
- Stats.AvgStripLength += scnt+1;
- if (scnt+1 > Stats.MaxStripLength) {
- Stats.MaxStripLength = scnt+1;
- }
- }
-
- // Use the premap array to get the rest of the info into the new face table,
- for (i=0; iTextureIndex[0][0] < f1->TextureIndex[0][0]) return -1;
- if (f0->TextureIndex[0][0] > f1->TextureIndex[0][0]) return 1;
- return 0;
-}
-
-inline int tex_compare(const void * elem1,const void * elem2,int pass,int stage)
-{
- MeshBuilderClass::FaceClass * f0 = (MeshBuilderClass::FaceClass *)elem1;
- MeshBuilderClass::FaceClass * f1 = (MeshBuilderClass::FaceClass *)elem2;
-
- /*
- ** Primarily, sort by texture
- */
- if (f0->TextureIndex[pass][stage] < f1->TextureIndex[pass][stage]) return -1;
- if (f0->TextureIndex[pass][stage] > f1->TextureIndex[pass][stage]) return 1;
-
- /*
- ** Secondarily, sort by vertex material index
- */
- if (f0->Verts[0].VertexMaterialIndex[pass] < f1->Verts[0].VertexMaterialIndex[pass]) return -1;
- if (f0->Verts[0].VertexMaterialIndex[pass] > f1->Verts[0].VertexMaterialIndex[pass]) return 1;
-
- return 0;
-}
-
-int pass0_stage0_compare(const void *elem1, const void *elem2)
-{
- return tex_compare(elem1,elem2,0,0);
-}
-
-int pass0_stage1_compare(const void *elem1, const void *elem2)
-{
- return tex_compare(elem1,elem2,0,1);
-}
-
-int pass1_stage0_compare(const void *elem1, const void *elem2)
-{
- return tex_compare(elem1,elem2,1,0);
-}
-
-int pass1_stage1_compare(const void *elem1, const void *elem2)
-{
- return tex_compare(elem1,elem2,1,1);
-}
-
-int pass2_stage0_compare(const void *elem1, const void *elem2)
-{
- return tex_compare(elem1,elem2,2,0);
-}
-
-int pass2_stage1_compare(const void *elem1, const void *elem2)
-{
- return tex_compare(elem1,elem2,2,1);
-}
-
-int pass3_stage0_compare(const void *elem1, const void *elem2)
-{
- return tex_compare(elem1,elem2,3,0);
-}
-
-int pass3_stage1_compare(const void *elem1, const void *elem2)
-{
- return tex_compare(elem1,elem2,3,1);
-}
-
-int vertex_compare(const void *elem1, const void *elem2)
-{
- MeshBuilderClass::VertClass * v0 = (MeshBuilderClass::VertClass *)elem1;
- MeshBuilderClass::VertClass * v1 = (MeshBuilderClass::VertClass *)elem2;
-
- /*
- ** Sort first by bone index, then by vertex material in pass0
- */
- if (v0->BoneIndex < v1->BoneIndex) return -1;
- if (v0->BoneIndex > v1->BoneIndex) return 1;
-
- if (v0->VertexMaterialIndex[0] < v1->VertexMaterialIndex[0]) return -1;
- if (v0->VertexMaterialIndex[0] > v1->VertexMaterialIndex[0]) return 1;
-
- return 0;
-}
-
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/meshbuild.h b/Generals/Code/Tools/WW3D/max2w3d/meshbuild.h
deleted file mode 100644
index 3173b7e6e20..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/meshbuild.h
+++ /dev/null
@@ -1,379 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : WW3D *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/meshbuild.h $*
- * *
- * Author:: Greg_h *
- * *
- * $Modtime:: 5/22/00 3:17p $*
- * *
- * $Revision:: 12 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#if defined(_MSC_VER)
-#pragma once
-#endif
-
-#ifndef MESHBUILD_H
-#define MESHBUILD_H
-
-#include "always.h"
-#include "vector2.h"
-#include "vector3.h"
-#include "BITTYPE.H"
-
-#include
-
-/*
-** WorldInfoClass
-** Abstract base class that defines an interface for 'world information'.
-** This class provides the mesh builder with information about the world
-** outside of its mesh.
-*/
-class WorldInfoClass
-{
- public:
- WorldInfoClass(void) { }
- virtual ~WorldInfoClass(void) { }
-
- // Public methods
- virtual Vector3 Get_Shared_Vertex_Normal (Vector3 pos, int smgroup) = 0;
- virtual bool Are_Meshes_Smoothed (void) const { return true; }
-};
-
-/*
-** MeshBuilderClass
-** This class will process meshes for you, splitting all vertices which do not
-** share all parameters (such as texture coordinates), sort the polygons by
-** material, and put them into strip order.
-**
-** To "build" a mesh:
-** 1. Reset the builder with the number of polys you're going to sumbit
-** 2. Enable the vertex channels that you want
-** 3. Submit each face in the form of a FaceClass
-** 4. Call Build_Mesh
-**
-** To use the results:
-** 1. Call Get_Vertex_Count and Get_Face_Count to get the counts
-** 2. Loop through the verts, looking at each one using Get_Vertex
-** 3. Loop through the faces, looking at each one using Get_Face
-**
-** *NOTE* This class is meant to be relatively self-sufficient. It is used in a
-** variety of different applications which are built on completely different
-** code-bases. Do not introduce dependencies into this module lightly! :-)
-*/
-class MeshBuilderClass
-{
-
-public:
-
- enum {
- STATE_ACCEPTING_INPUT = 0, // mesh builder is accepting input triangles
- STATE_MESH_PROCESSED, // mesh builder has processed the mesh
-
- MAX_PASSES = 4, // maximum number of material passes supported
- MAX_STAGES = 2, // maximum number of texture stages supported in a single pass
- };
-
- /*
- ** Constructor, Destructor
- */
- MeshBuilderClass(int pass_count=1,int face_count_guess=255,int face_count_growth_rate=64);
- ~MeshBuilderClass(void);
-
- /*
- ** VertClass. The MeshBuilder deals with vertices in this format.
- */
- class VertClass
- {
- public:
- VertClass(void) { Reset(); }
- void Reset(void);
-
- public:
-
- Vector3 Position; // position of the vertex
- Vector3 Normal; // vertex normal (can be calculated by mesh builder)
- int SmGroup; // smoothing group of the face this vertex was submitted with
- int Id; // id of the vertex, must match for vert to be welded, ok at zero if you don't care
- int BoneIndex; // bone influence if the mesh is a skin
-
- int MaxVertColIndex; // Index into the Max mesh.vertCol array of this vertex.
-
- Vector2 TexCoord[MAX_PASSES][MAX_STAGES];
- Vector3 DiffuseColor[MAX_PASSES]; // diffuse color
- Vector3 SpecularColor[MAX_PASSES]; // specular color
- Vector3 DiffuseIllumination[MAX_PASSES]; // pre-calced diffuse illum
- float Alpha[MAX_PASSES]; // alpha
- int VertexMaterialIndex[MAX_PASSES]; // vertex material index
-
- int Attribute0; // user-set attributes (passed on through...)
- int Attribute1; // user-set attributes
-
- // These values are set up by the mesh builder:
-
- int SharedSmGroup; // smooth bits that were on in all faces that contributed to this final vertex
- int UniqueIndex; // used internally!
- int ShadeIndex; // used internally!
- VertClass * NextHash; // used internally!
-
- };
-
- /*
- ** FaceClass. The MeshBuilder deals faces in this format. When inputing faces, set the
- ** top half of the struct and the builder will fill in the bottom (vertex indices, normal,
- ** and distance).
- */
- class FaceClass
- {
- public:
- FaceClass(void) { Reset(); }
- void Reset(void); // reset this face
-
- public:
- VertClass Verts[3]; // array of 3 verts
- int SmGroup; // smoothing group
- int Index; // user-set index of the face
- int Attributes; // user-set attributes
- int TextureIndex[MAX_PASSES][MAX_STAGES]; // texture to use for each pass
- int ShaderIndex[MAX_PASSES]; // shader for each pass
- uint32 SurfaceType; // surface type identifier
-
- int AddIndex; // set by builder: index of addition
- int VertIdx[3]; // set by builder: "optimized" vertex indices
- Vector3 Normal; // set by builder: Face normal
- float32 Dist; // set by builder: Plane distance
-
- void Compute_Plane(void);
- bool operator != (const FaceClass & that) { return !(*this == that); }
- bool operator == (const FaceClass & /*that*/) { return false; }
- bool Is_Degenerate(void);
-
- friend class MeshBuilderClass;
- };
-
- /*
- ** To "build" a mesh:
- ** 1. Reset the builder with the approximate number of polys you're going to sumbit, etc.
- ** 3. Submit each face in the form of a FaceClass, set only the fields you need (leave others at default)
- ** 4. Call Build_Mesh
- */
- void Reset(int pass_count,int face_count_guess,int face_count_growth_rate);
- int Add_Face(const FaceClass & face);
- void Build_Mesh(bool compute_normals);
-
- /*
- ** Optional controls:
- ** If one of your passes has more textures than another, you may wish to do the
- ** stripping and sorting based on that channel. By default, everything will
- ** be stripped and sorted based on pass 0, stage 0
- ** Sort_Vertices can be used to order the vertices arbitrarily. I use it to
- ** sort them according to the bone they are attached for skin meshes.
- */
- void Set_Polygon_Ordering_Channel(int pass,int texstage);
-
- /*
- ** To use the results:
- ** 1. Call Get_Vertex_Count and Get_Face_Count to get the counts
- ** 2. Loop through the verts, looking at each one using Get_Vertex
- ** 3. Loop through the faces, looking at each one using Get_Face
- */
- int Get_Pass_Count(void) const;
- int Get_Vertex_Count(void) const;
- int Get_Face_Count(void) const;
- const VertClass & Get_Vertex(int index) const;
- const FaceClass & Get_Face(int index) const;
-
- /*
- ** Access to the Vertices and Faces for modifications. This is used by
- ** the max plugin when generating a skin mesh for example. Be careful
- ** what you do to them. (I haven't thought through all of the
- ** possible things you might do to mess up my nice clean mesh...).
- */
- VertClass & Get_Vertex(int index);
- FaceClass & Get_Face(int index);
-
- /*
- ** Bounding volume information about the mesh. These functions can compute
- ** various types of bounding volumes for the mesh you just processed...
- */
- void Compute_Bounding_Box(Vector3 * set_min,Vector3 * set_max);
- void Compute_Bounding_Sphere(Vector3 * set_center,float * set_radius);
-
- /*
- ** World information managment. Used to give the mesh builder information
- ** about the world outside of its mesh.
- */
- WorldInfoClass * Peek_World_Info(void) const { return WorldInfo; }
- void Set_World_Info(WorldInfoClass *world_info) { WorldInfo = world_info; }
-
- /*
- ** Mesh Stats, mainly lots of flags for whether this mesh has various
- ** channels of information.
- */
- struct MeshStatsStruct
- {
- void Reset(void);
-
- bool HasTexture[MAX_PASSES][MAX_STAGES]; // has at least one texture in given pass/stage
- bool HasShader[MAX_PASSES]; // has at least one shader in given pass
- bool HasVertexMaterial[MAX_PASSES]; // has at least one vert material in given pass
-
- bool HasPerPolyTexture[MAX_PASSES][MAX_STAGES]; // has 2+ textures in given pass/stage
- bool HasPerPolyShader[MAX_PASSES]; // has 2+ shaders in given pass
- bool HasPerVertexMaterial[MAX_PASSES]; // has 2+ vertex materials in given pass
-
- bool HasDiffuseColor[MAX_PASSES]; // has diffuse colors in given pass
- bool HasSpecularColor[MAX_PASSES]; // has specular colors in given pass
- bool HasDiffuseIllumination[MAX_PASSES]; // has diffuse illum in given pass
-
- bool HasTexCoords[MAX_PASSES][MAX_STAGES]; // has texture coords in given pass
-
- int UVSplitCount; // how many vertices were split due solely to UV discontinuities
- int StripCount; // number of strips that were created
- int MaxStripLength; // longest strip created
- float AvgStripLength; // average strip length
- };
-
- const MeshStatsStruct & Get_Mesh_Stats(void) const;
-
-private:
-
- void Free(void);
- void Compute_Mesh_Stats(void);
- void Optimize_Mesh(bool compute_normals);
- void Strip_Optimize_Mesh(void);
- void Remove_Degenerate_Faces(void);
- void Compute_Face_Normals(void);
- bool Verify_Face_Normals(void);
- void Compute_Vertex_Normals(void);
- void Grow_Face_Array(void);
- void Sort_Vertices(void);
-
- /*
- ** Winged edge stuff is used by the strip optimize function
- */
- struct WingedEdgeStruct
- {
- int MaterialIdx;
- WingedEdgeStruct * Next;
- int Vertex[2];
- int Poly[2];
- };
-
- struct WingedEdgePolyStruct
- {
- WingedEdgeStruct * Edge[3];
- };
-
-
- int State; // is the builder accepting input or already processed the mesh.
- int PassCount; // number of render passes for this mesh
- int FaceCount; // number of faces
- FaceClass * Faces; // array of faces
- int InputVertCount; // number of input verts;
- int VertCount; // number of verts;
- VertClass * Verts; // array of verts;
- int CurFace; // current face being added
-
- WorldInfoClass * WorldInfo; // obj containing info about other meshes in the world
-
- MeshStatsStruct Stats; // internally useful junk about the mesh being processed.
- int PolyOrderPass; // order the polys using the texture indices in this pass
- int PolyOrderStage; // order the polys using the texture indices in this stage
-
- int AllocFaceCount; // number of faces allocated
- int AllocFaceGrowth; // growth rate of face array
-};
-
-inline void MeshBuilderClass::Set_Polygon_Ordering_Channel(int pass,int texstage)
-{
- assert(pass >= 0);
- assert(pass < MAX_PASSES);
- assert(texstage >= 0);
- assert(texstage < MAX_STAGES);
-
- PolyOrderPass = pass;
- PolyOrderStage = texstage;
-}
-
-inline int MeshBuilderClass::Get_Pass_Count(void) const
-{
- return PassCount;
-}
-
-inline int MeshBuilderClass::Get_Vertex_Count(void) const
-{
- assert(State == STATE_MESH_PROCESSED);
- return VertCount;
-}
-
-inline int MeshBuilderClass::Get_Face_Count(void) const
-{
- assert(State == STATE_MESH_PROCESSED);
- return FaceCount;
-}
-
-inline const MeshBuilderClass::VertClass & MeshBuilderClass::Get_Vertex(int index) const
-{
- assert(State == STATE_MESH_PROCESSED);
- assert(index >= 0);
- assert(index < VertCount);
- return Verts[index];
-}
-
-inline const MeshBuilderClass::FaceClass & MeshBuilderClass::Get_Face(int index) const
-{
- assert(State == STATE_MESH_PROCESSED);
- assert(index >= 0);
- assert(index < FaceCount);
- return Faces[index];
-}
-
-inline MeshBuilderClass::VertClass & MeshBuilderClass::Get_Vertex(int index)
-{
- assert(State == STATE_MESH_PROCESSED);
- assert(index >= 0);
- assert(index < VertCount);
- return Verts[index];
-}
-
-inline MeshBuilderClass::FaceClass & MeshBuilderClass::Get_Face(int index)
-{
- assert(State == STATE_MESH_PROCESSED);
- assert(index >= 0);
- assert(index < FaceCount);
- return Faces[index];
-}
-
-inline const MeshBuilderClass::MeshStatsStruct & MeshBuilderClass::Get_Mesh_Stats(void) const
-{
- assert(State == STATE_MESH_PROCESSED);
- return Stats;
-}
-
-#endif
diff --git a/Generals/Code/Tools/WW3D/max2w3d/meshcon.cpp b/Generals/Code/Tools/WW3D/max2w3d/meshcon.cpp
deleted file mode 100644
index 7fc479a334e..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/meshcon.cpp
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/* $Header: /Commando/Code/Tools/max2w3d/meshcon.cpp 34 10/27/00 4:12p Greg_h $ */
-/***********************************************************************************************
- *** Confidential - Westwood Studios ***
- ***********************************************************************************************
- * *
- * Project Name : Commando / G Math Library *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/meshcon.cpp $*
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 10/27/00 10:39a $*
- * *
- * $Revision:: 34 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * MeshConnectionsClass::MeshConnectionsClass -- Constructor *
- * MeshConnectionsClass::~MeshConnectionsClass -- Destructor *
- * MeshConnectionsClass::Get_Aggregate_Data -- name and bone for the given aggregate *
- * MeshConnectionsClass::Get_Proxy_Data -- name and transform for the specified proxy object *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#include "meshcon.h"
-#include "util.h"
-#include "SnapPoints.h"
-#include "w3dappdata.h"
-#include "geometryexporttask.h"
-#include "geometryexportcontext.h"
-
-
-/***********************************************************************************************
- * MeshConnectionsClass::MeshConnectionsClass -- Constructor *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/19/2000 gth : New version which uses the GeometryExportTasks *
- *=============================================================================================*/
-MeshConnectionsClass::MeshConnectionsClass
-(
- DynamicVectorClass sub_object_list,
- GeometryExportContextClass & context
-) :
- CurTime(context.CurTime),
- Origin(context.Origin)
-{
- unsigned int i;
- assert(Origin != NULL);
-
- /*
- ** Set the name, count the sub-objects and aggregates
- */
- Set_W3D_Name(Name,context.ModelName);
-
- /*
- ** For each sub-object, record the bone it is attached to and its name
- */
- int count = sub_object_list.Count();
- for (i=0; iGet_Full_Name(con.ObjectName,sizeof(con.ObjectName));
- con.BoneIndex = sub_object_list[i]->Get_Bone_Index();
- con.MeshINode = sub_object_list[i]->Get_Object_Node();
-
- if (sub_object_list[i]->Is_Aggregate()) {
- Aggregates.Add(con);
- } else if (sub_object_list[i]->Is_Proxy()) {
- ProxyObjects.Add(con);
- } else {
- SubObjects.Add(con);
- }
- }
-}
-
-
-/***********************************************************************************************
- * MeshConnectionsClass::~MeshConnectionsClass -- Destructor *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 07/24/1997 GH : Created. *
- *=============================================================================================*/
-MeshConnectionsClass::~MeshConnectionsClass(void)
-{
-}
-
-
-/***********************************************************************************************
- * MeshConnectionsClass::Get_Sub_Object_Data -- Returns the name and bone index for a given obj*
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 9/14/1999 AJA : Created. *
- *=============================================================================================*/
-bool MeshConnectionsClass::Get_Sub_Object_Data (int mesh_idx, char **out_name, int *out_boneindex,
- INode **out_inode)
-{
- if (mesh_idx >= SubObjects.Count()) return false;
-
- if (out_name)
- *out_name = SubObjects[mesh_idx].ObjectName;
- if (out_boneindex)
- *out_boneindex = SubObjects[mesh_idx].BoneIndex;
- if (out_inode)
- *out_inode = SubObjects[mesh_idx].MeshINode;
-
- return true;
-}
-
-
-/***********************************************************************************************
- * MeshConnectionsClass::Get_Aggregate_Data -- name and bone for the given aggregate *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/25/2000 gth : Created. *
- *=============================================================================================*/
-bool MeshConnectionsClass::Get_Aggregate_Data(int mesh_idx, char **out_name, int *out_boneindex,
- INode **out_inode)
-{
- if (mesh_idx >= Aggregates.Count()) return false;
-
- if (out_name)
- *out_name = Aggregates[mesh_idx].ObjectName;
- if (out_boneindex)
- *out_boneindex = Aggregates[mesh_idx].BoneIndex;
- if (out_inode)
- *out_inode = Aggregates[mesh_idx].MeshINode;
-
- return true;
-}
-
-
-/***********************************************************************************************
- * MeshConnectionsClass::Get_Proxy_Data -- name and transform for the specified proxy object *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/26/2000 gth : Created. *
- *=============================================================================================*/
-bool MeshConnectionsClass::Get_Proxy_Data(int index, char **out_name, int *out_boneindex,
- INode **out_inode)
-{
- if (index >= ProxyObjects.Count()) return false;
-
- if (out_name)
- *out_name = ProxyObjects[index].ObjectName;
- if (out_boneindex)
- *out_boneindex = ProxyObjects[index].BoneIndex;
- if (out_inode)
- *out_inode = ProxyObjects[index].MeshINode;
-
- return true;
-}
diff --git a/Generals/Code/Tools/WW3D/max2w3d/meshcon.h b/Generals/Code/Tools/WW3D/max2w3d/meshcon.h
deleted file mode 100644
index 848e1fe0743..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/meshcon.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/* $Header: /Commando/Code/Tools/max2w3d/meshcon.h 26 10/27/00 4:11p Greg_h $ */
-/***********************************************************************************************
- *** Confidential - Westwood Studios ***
- ***********************************************************************************************
- * *
- * Project Name : Commando / G Tools *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/meshcon.h $*
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 10/27/00 10:31a $*
- * *
- * $Revision:: 26 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#ifndef MESHCON_H
-#define MESHCON_H
-
-
-#ifndef ALWAYS_H
-#include "always.h"
-#endif
-
-#ifndef CHUNKIO_H
-#include "chunkio.h"
-#endif
-
-#ifndef NODELIST_H
-#include "nodelist.h"
-#endif
-
-#ifndef HIERSAVE_H
-#include "hiersave.h"
-#endif
-
-#ifndef W3D_FILE
-#include "w3d_file.h"
-#endif
-
-#ifndef VECTOR_H
-#include "Vector.H"
-#endif
-
-
-class GeometryExportTaskClass;
-class GeometryExportContextClass;
-
-
-struct ConnectionStruct
-{
- ConnectionStruct(void) : BoneIndex(0),MeshINode(NULL)
- {
- memset(ObjectName,0,sizeof(ObjectName));
- }
-
- int BoneIndex;
- char ObjectName[2*W3D_NAME_LEN];
- INode * MeshINode;
-
- // required by DynamicVectorClass...
- operator == (const ConnectionStruct & that) { return false; }
- operator != (const ConnectionStruct & that) { return !(*this==that); }
-};
-
-
-/**
-** MeshConnectionsClass
-** This class is the description of a hierarchical model. It contains an array of "ConnectionStructs" which
-** associate pieces of geometry with nodes in a hierarchy tree.
-*/
-class MeshConnectionsClass
-{
-public:
-
- MeshConnectionsClass( DynamicVectorClass sub_objects,
- GeometryExportContextClass & context );
-
- ~MeshConnectionsClass(void);
-
- /*
- ** Get the name of the mesh connections object (will be
- ** the name of the runtime HierarchyModel that this
- ** object is describing.
- */
- const char * Get_Name(void) const { return Name; }
-
- /*
- ** Get the total number of meshes (of all types).
- */
- int Get_Sub_Object_Count (void) const { return SubObjects.Count(); }
- int Get_Aggregate_Count(void) const { return Aggregates.Count(); }
- int Get_Proxy_Count(void) const { return ProxyObjects.Count(); }
-
- /*
- ** Retrieve data about the mesh of the given index.
- ** out_name - name of the mesh is passed back by setting the char* pointed to by this value.
- ** out_boneindex - the index of the bone used is passed back by setting the int pointed to by this value.
- ** out_inode - mesh INode is passed by setting the INode* pointed to by this value. If this
- ** parameter is NULL, the value is not passed back.
- */
- bool Get_Sub_Object_Data(int index, char **out_name, int *out_boneindex, INode **out_inode = NULL);
- bool Get_Aggregate_Data(int index, char **out_name, int *out_boneindex, INode **out_inode = NULL);
- bool Get_Proxy_Data(int index, char **out_name, int *out_boneindex, INode **out_inode = NULL);
-
- /*
- ** Returns the origin node used by this model.
- */
- INode * Get_Origin (void) const { return Origin; }
-
-private:
-
- TimeValue CurTime;
- INode * Origin;
-
- char Name[W3D_NAME_LEN];
-
- // array of SubObjects
- DynamicVectorClass SubObjects;
- DynamicVectorClass Aggregates;
- DynamicVectorClass ProxyObjects;
-
-
-};
-
-
-#endif /*MESHCON_H*/
\ No newline at end of file
diff --git a/Generals/Code/Tools/WW3D/max2w3d/meshsave.cpp b/Generals/Code/Tools/WW3D/max2w3d/meshsave.cpp
deleted file mode 100644
index 49955e87d15..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/meshsave.cpp
+++ /dev/null
@@ -1,2246 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/* $Header: /Commando/Code/Tools/max2w3d/meshsave.cpp 107 8/21/01 10:28a Greg_h $ */
-/***********************************************************************************************
- *** Confidential - Westwood Studios ***
- ***********************************************************************************************
- * *
- * Project Name : Commando / G *
- * *
- * File Name : MESHSAVE.CPP *
- * *
- * Programmer : Greg Hjelstrom *
- * *
- * Start Date : 06/10/97 *
- * *
- * Last Update : 10/20/1999997 [GH] *
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * MeshSaveClass::MeshSaveClass -- constructor, processes a Max mesh *
- * MeshSaveClass::~MeshSaveClass -- destructor, frees all allocated memory *
- * MeshSaveClass::write_verts -- write the vertex chunk into a wtm file *
- * MeshSaveClass::write_header -- write a mesh header chunk into a wtm file *
- * MeshSaveClass::Write_To_File -- Append the mesh to an open wtm file *
- * MeshSaveClass::write_normals -- writes the vertex normals chunk into a wtm file *
- * MeshSaveClass::write_vert_normals -- Writes the surrender normal chunk into a wtm file *
- * MeshSaveClass::write_triangles -- Write the triangles chunk into a wtm file. *
- * MeshSaveClass::write_sr_triangles -- writes the triangles in surrender friendly format *
- * MeshSaveClass::write_triangles -- write the triangles chunk *
- * MeshSaveClass::compute_surrender_vertex -- Compute the surrender vertex normals *
- * MeshSaveClass::setup_material -- Gets the texture names and base colors for a material *
- * MeshSaveClass::compute_bounding_volumes -- computes a bounding box and bounding sphere for*
- * MeshSaveClass::set_transform -- set the default transformation matrix for the mesh *
- * MeshSaveClass::compute_physical_properties -- computes the volume and moment of inertia *
- * MeshSaveClass::prep_mesh -- pre-transform the MAX mesh by a specified matrix *
- * MeshSaveClass::write_user_text -- write the user text chunk *
- * MeshSaveClass::get_htree_bone_index_for_inode -- searches the htree for the given INode *
- * MeshSaveClass::get_skin_modifier_objects -- Searches for the WWSkin modifier for this mes *
- * MeshSaveClass::inv_deform_mesh -- preprocess the mesh for skinning *
- * MeshSaveClass::create_materials -- create the materials for this mesh *
- * MeshSaveClass::write_ps2_shaders -- Write shaders specific to the PS2 in their own chunk. *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#include "meshsave.h"
-#include
-#include
-#include
-#include "gamemtl.h"
-#include "errclass.h"
-#include "vxl.h"
-#include "vxldbg.h"
-#include "nodelist.h"
-#include "hiersave.h"
-#include "util.h"
-#include "w3dappdata.h"
-#include "skin.h"
-#include "skindata.h"
-#include "meshbuild.h"
-#include "AlphaModifier.h"
-#include "aabtreebuilder.h"
-#include "exportlog.h"
-
-
-static char _string1[512];
-const int VOXEL_RESOLUTION = 64; // resolution to use when computing I, V and CM
-
-#define DEBUG_VOXELS 0
-#define MIN_AABTREE_POLYGONS 8
-#define DIFFUSE_HOUSECOLOR_TEXTURE_PREFIX 0x4443485A //'ZHCD' prefix put on all code generated textures
-#define DIFFUSE_COLOR_TEXTURE_PREFIX 0x44434d5A //'ZMCD' prefix put on all code generated textures
-#define DIFFUSE_COLOR_TEXTURE_MASK 0x4443005A
-
-/************************************************************************************
-**
-** Compute the determinant of the 3x3 portion of the given matrix
-**
-************************************************************************************/
-float Compute_3x3_Determinant(const Matrix3 & tm)
-{
- float det = tm[0][0] * (tm[1][1]*tm[2][2] - tm[1][2]*tm[2][1]);
- det -= tm[0][1] * (tm[1][0]*tm[2][2] - tm[1][2]*tm[2][0]);
- det += tm[0][2] * (tm[1][0]*tm[2][1] - tm[1][1]*tm[2][0]);
-
- return det;
-}
-
-/************************************************************************************
-**
-** check if this is a mesh which should use a simple rendering method. I don't
-** compute vertex normals or store u-v's in that case (prevents vertex splitting)
-**
-************************************************************************************/
-bool use_simple_rendering(int geo_type)
-{
- geo_type &= W3D_MESH_FLAG_GEOMETRY_TYPE_MASK;
-
- if ( (geo_type == OBSOLETE_W3D_MESH_FLAG_GEOMETRY_TYPE_SHADOW) ||
- (geo_type == W3D_MESH_FLAG_GEOMETRY_TYPE_AABOX) ||
- (geo_type == W3D_MESH_FLAG_GEOMETRY_TYPE_OBBOX) )
- {
- return true;
- } else {
- return false;
- }
-}
-
-/************************************************************************************
-**
-** build the bitfield of W3D mesh attributes for the given node
-**
-************************************************************************************/
-uint32 setup_mesh_attributes(INode * node)
-{
- uint32 attributes = W3D_MESH_FLAG_NONE;
-
- /*
- ** Mesh will be one of:
- ** W3D_MESH_FLAG_NONE,
- ** W3D_MESH_FLAG_COLLISION_BOX,
- ** W3D_MESH_FLAG_SKIN,
- ** W3D_MESH_FLAG_ALIGNED
- ** W3D_MESH_FLAG_ORIENTED
- */
- if (Is_Collision_AABox(node)) {
- attributes = W3D_MESH_FLAG_GEOMETRY_TYPE_AABOX;
- } else if (Is_Collision_OBBox(node)) {
- attributes = W3D_MESH_FLAG_GEOMETRY_TYPE_OBBOX;
- } else if (Is_Skin(node)) {
- attributes = W3D_MESH_FLAG_GEOMETRY_TYPE_SKIN;
- } else if (Is_Camera_Aligned_Mesh(node)) {
- attributes = W3D_MESH_FLAG_GEOMETRY_TYPE_CAMERA_ALIGNED;
- } else if (Is_Camera_Oriented_Mesh(node)) {
- attributes = W3D_MESH_FLAG_GEOMETRY_TYPE_CAMERA_ORIENTED;
- }
-
- /*
- ** And, a mesh may have one or more types of collision detection enabled.
- ** W3D_MESH_FLAG_COLLISION_TYPE_PHYSICAL
- ** W3D_MESH_FLAG_COLLISION_TYPE_PROJECTILE
- ** However, if the mesh is SKIN, SHADOW, ALIGNED, ORIENTED or NULL, don't let
- ** the collision bits get set...
- */
- if ( attributes != W3D_MESH_FLAG_GEOMETRY_TYPE_SKIN &&
- attributes != W3D_MESH_FLAG_GEOMETRY_TYPE_CAMERA_ALIGNED &&
- attributes != W3D_MESH_FLAG_GEOMETRY_TYPE_CAMERA_ORIENTED )
- {
-
- if (Is_Physical_Collision(node)) {
- attributes |= W3D_MESH_FLAG_COLLISION_TYPE_PHYSICAL;
- }
-
- if (Is_Projectile_Collision(node)) {
- attributes |= W3D_MESH_FLAG_COLLISION_TYPE_PROJECTILE;
- }
-
- if (Is_Vis_Collision(node)) {
- attributes |= W3D_MESH_FLAG_COLLISION_TYPE_VIS;
- }
-
- if (Is_Camera_Collision(node)) {
- attributes |= W3D_MESH_FLAG_COLLISION_TYPE_CAMERA;
- }
-
- if (Is_Vehicle_Collision(node)) {
- attributes |= W3D_MESH_FLAG_COLLISION_TYPE_VEHICLE;
- }
-
- }
-
- /*
- ** A mesh may have one of the following bits set as well
- */
- if (Is_Hidden(node)) {
- attributes |= W3D_MESH_FLAG_HIDDEN;
- }
- if (Is_Two_Sided(node)) {
- attributes |= W3D_MESH_FLAG_TWO_SIDED;
- }
- if (Is_Shadow(node)) {
- attributes |= W3D_MESH_FLAG_CAST_SHADOW;
- }
- if (Is_Shatterable(node)) {
- attributes |= W3D_MESH_FLAG_SHATTERABLE;
- }
- if (Is_NPatchable(node)) {
- attributes |= W3D_MESH_FLAG_NPATCHABLE;
- }
-
- return attributes;
-}
-
-
-
-/***********************************************************************************************
- * MeshSaveClass::MeshSaveClass -- constructor, processes a Max mesh *
- * *
- * This class takes a MAX mesh and computes the information for a W3D mesh or skin. *
- * *
- * INPUT: *
- * *
- * inode - the max INode containing the mesh/skin to export *
- * exportspace - matrix defining the desired coordinate system for the mesh *
- * htree - hierarchy tree that this mesh is being connected to *
- * curtime - current time in Max. *
- * meter - progress meter *
- * mesh_name - name to use for the mesh *
- * container_name - name of the container *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 06/10/1997 GH : Created. *
- *=============================================================================================*/
-MeshSaveClass::MeshSaveClass
-(
- char * mesh_name,
- char * container_name,
- INode * inode,
- const Mesh * input_mesh,
- Matrix3 & exportspace,
- W3DAppData2Struct & exportoptions,
- HierarchySaveClass * htree,
- TimeValue curtime,
- Progress_Meter_Class & meter,
- unsigned int * materialColors,
- int &numMaterialColors,
- int &numHouseColors,
- char *materialColorTexture,
- WorldInfoClass * world_info
-) :
- MaxINode(inode),
- ExportOptions(exportoptions),
- CurTime(curtime),
- ExportSpace(exportspace),
- HTree(htree),
- UserText(NULL),
- VertInfluences(NULL),
- MaterialRemapTable(NULL)
-{
- Mesh mesh = *input_mesh; // copy the mesh so we can modify it
- Mtl * nodemtl = inode->GetMtl();
- DWORD wirecolor = inode->GetWireColor();
-
- PS2Material = FALSE;
-
- // Check to see if the mesh uses PS2 game materials. If so, set a flag so
- // that write_shaders will know to make a PS2 shader chunk.
- if (nodemtl) {
- if (nodemtl->ClassID() == PS2GameMaterialClassID) {
- PS2Material = TRUE;
- } else if (nodemtl->IsMultiMtl()) {
- for (int i = 0; i < nodemtl->NumSubMtls(); i++) {
- Mtl *sub = nodemtl->GetSubMtl(i);
- if (sub->ClassID() == PS2GameMaterialClassID) {
- PS2Material = TRUE;
- }
- }
- }
- }
-
- //////////////////////////////////////////////////////////////////////
- // Check if the mesh is being inverted by its transform. If this
- // is the case, then we will need to reverse the winding of all
- // polygons later.
- //////////////////////////////////////////////////////////////////////
- Matrix3 objtm = MaxINode->GetObjectTM(curtime);
- MeshInverted = (Compute_3x3_Determinant(objtm) < 0.0f);
-
- //////////////////////////////////////////////////////////////////////
- // Prep the mesh by transforming it by the delta between exportspace
- // and this INodes current space
- // (this is the delta between the bone and the mesh if one exists...)
- //////////////////////////////////////////////////////////////////////
- MeshToExportSpace = objtm * Inverse(ExportSpace);
- prep_mesh(mesh,MeshToExportSpace);
-
- //////////////////////////////////////////////////////////////////////
- // Prepare the mesh header.
- //////////////////////////////////////////////////////////////////////
- assert(mesh_name != NULL);
- assert(container_name != NULL);
-
- memset(&Header,0,sizeof(Header));
- Set_W3D_Name(Header.MeshName,mesh_name);
- Set_W3D_Name(Header.ContainerName,container_name);
-
- Header.Version = W3D_CURRENT_MESH_VERSION;
- Header.Attributes = setup_mesh_attributes(MaxINode);
-
- meter.Finish_In_Steps(
- 3*Header.NumTris + // normals
- Header.NumVertices + // surrender normals
- 64 // voxelization
- );
-
- ExportLog::printf("\nProcessing Mesh: %s\n",Header.MeshName);
-
- //////////////////////////////////////////////////////////////////////
- // Enforce that we have enough data to actually make a mesh
- //////////////////////////////////////////////////////////////////////
- if (mesh.getNumFaces() <= 0) {
- throw ErrorClass("No Triangles in Mesh: %s",Header.MeshName);
- }
-
- if (mesh.getNumVerts() <= 0) {
- throw ErrorClass("No Vertices in Mesh: %s",Header.MeshName);
- }
-
- //////////////////////////////////////////////////////////////////////
- // process the materials
- //////////////////////////////////////////////////////////////////////
- DebugPrint("processing materials\n");
- scan_used_materials(mesh,nodemtl);
- create_materials(nodemtl,wirecolor,materialColorTexture);
-
- //////////////////////////////////////////////////////////////////////
- // what face and vertex attributes are we going to export?
- //////////////////////////////////////////////////////////////////////
- Header.FaceChannels = W3D_FACE_CHANNEL_FACE;
- Header.VertexChannels = W3D_VERTEX_CHANNEL_LOCATION;
-
- if (!use_simple_rendering(Header.Attributes)) {
- Header.VertexChannels |= W3D_VERTEX_CHANNEL_NORMAL;
- }
-
- if (((Header.Attributes & W3D_MESH_FLAG_GEOMETRY_TYPE_MASK) == W3D_MESH_FLAG_GEOMETRY_TYPE_SKIN) && (HTree != NULL)) {
- Header.VertexChannels |= W3D_VERTEX_CHANNEL_BONEID;
- }
-
- //////////////////////////////////////////////////////////////////////
- // Process the mesh
- //////////////////////////////////////////////////////////////////////
- Builder.Set_World_Info (world_info);
- Build_Mesh(mesh, nodemtl, materialColors, numMaterialColors, numHouseColors);
-
- if (materialColorTexture)
- { //diffuse color materials are replaced by textures
- //set diffuse to 255,255,255 so it has no effect.
- fix_diffuse_materials(numHouseColors != 0);
- }
-
- //////////////////////////////////////////////////////////////////////
- // Create damage (deform) information for the mesh
- //////////////////////////////////////////////////////////////////////
- Object *ref_obj = MaxINode->GetObjectRef ();
- DeformSave.Initialize(Builder, ref_obj, mesh, &MeshToExportSpace);
-
- //////////////////////////////////////////////////////////////////////
- // Determine if the deformer should use alpha or v-color info
- //////////////////////////////////////////////////////////////////////
- if (ExportOptions.Is_Vertex_Alpha_Enabled()) {
- unsigned int alpha_passes = 0;
- for (int pass=0; pass < MaterialDesc.Pass_Count(); pass++) {
- if (MaterialDesc.Pass_Uses_Vertex_Alpha(pass)) {
- alpha_passes |= (1 << pass);
- }
- }
- DeformSave.Set_Alpha_Passes(alpha_passes);
- }
-
- //////////////////////////////////////////////////////////////////////
- // Set the counts in the mesh header
- //////////////////////////////////////////////////////////////////////
- Header.NumTris = Builder.Get_Face_Count();
- Header.NumVertices = Builder.Get_Vertex_Count();
-
- //////////////////////////////////////////////////////////////////////
- // Compute the mesh's bounding box and sphere. This must be done
- // before we pre-deform the mesh (if its a skin).
- //////////////////////////////////////////////////////////////////////
- compute_bounding_volumes();
-
- //////////////////////////////////////////////////////////////////////
- // Voxelize the mesh and compute the Moment of Inertia and
- // Center of Mass. This must come after we compute the bounding
- // volumes and before we pre-deform the mesh.
- //////////////////////////////////////////////////////////////////////
- Progress_Meter_Class voxelmeter(meter, 64.0f * meter.Increment);
- compute_physical_constants(MaxINode,voxelmeter,false /*usevoxelizer*/);
-
- //////////////////////////////////////////////////////////////////////
- // If this is a skin, pre-deform the mesh.
- //////////////////////////////////////////////////////////////////////
- if (((Header.Attributes & W3D_MESH_FLAG_GEOMETRY_TYPE_MASK) == W3D_MESH_FLAG_GEOMETRY_TYPE_SKIN) && (HTree != NULL)) {
- inv_deform_mesh();
- }
-
- //////////////////////////////////////////////////////////////////////
- // Get the user text from MAX's properties window.
- //////////////////////////////////////////////////////////////////////
- TSTR usertext;
- MaxINode->GetUserPropBuffer(usertext);
- CStr usertext8 = usertext;
-
- if (usertext8.Length() > 0) {
- UserText = new char[usertext8.Length() + 1];
- memset(UserText,0,usertext8.Length() + 1);
- memcpy(UserText,usertext8.data(),usertext8.Length());
- }
-}
-
-/***********************************************************************************************
- * MeshSaveClass::~MeshSaveClass -- destructor, frees all allocated memory *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 06/10/1997 GH : Created. *
- *=============================================================================================*/
-MeshSaveClass::~MeshSaveClass(void)
-{
- if (UserText) {
- delete[] UserText;
- UserText = NULL;
- }
-
- if (VertInfluences) {
- delete[] VertInfluences;
- VertInfluences = NULL;
- }
-
- if (MaterialRemapTable) {
- delete[] MaterialRemapTable;
- MaterialRemapTable = NULL;
- }
-}
-
-//search through previously found material colors and return index. house colors are always placed in top row.
-void getMaterialUV(UVVert &tvert,unsigned int diffuse, unsigned int *materialColors, int &numMaterialColors, int &numHouseColors, bool house)
-{
- int i;
-
- if (house)
- { //this material is a house color, place it in first row.
- for (i=0; i<16; i++)
- {
- if (materialColors[i]==diffuse)
- {
- tvert.x=((double)(i%16)+0.5)/16.0; ///@todo: MW: Remove hard-coded texture size
- tvert.y=1.0-((double)(i/16)+0.5)/16.0;
- numHouseColors=16;
- return;
- }
- }
-
- ExportLog::printf("\nUndefined House Color %d,%d,%d",(diffuse>>16)&0xff,(diffuse>>8)&0xff,diffuse&0xff);
- assert(0); //all house colors must be from a predefined range of reds
- }
-
- for (i=16; i<(16+numMaterialColors); i++)
- {
- if (materialColors[i]==diffuse)
- {
- tvert.x=((double)(i%16)+0.5)/16.0; ///@todo: MW: Remove hard-coded texture size
- tvert.y=1.0-((double)(i/16)+0.5)/16.0;
- return;
- }
- }
-
- //new color found
- tvert.x=((double)(i%16)+0.5)/16.0; ///@todo: MW: Remove hard-coded texture size
- tvert.y=1.0-((double)(i/16)+0.5)/16.0;
-
- materialColors[i]=diffuse;
- numMaterialColors++;
-}
-
-void MeshSaveClass::Build_Mesh(Mesh & mesh, Mtl *node_mtl, unsigned int *materialColors, int &numMaterialColors, int &numHouseColors)
-{
- int vert_counter;
- int face_index;
- int pass;
- int stage;
- float *vdata = NULL;
- int firstSolidColoredMaterial=-1;
-
- Builder.Reset(true,mesh.getNumFaces(),mesh.getNumFaces()/3);
-
- // Get a pointer to the channel that has alpha values entered by the artist.
- // This pointer will be NULL if they didn't use the channel.
- vdata = mesh.vertexFloat(ALPHA_VERTEX_CHANNEL);
-
- /*
- ** Get the skin info
- */
- bool is_skin = false;
- SkinDataClass * skindata = NULL;
- SkinWSMObjectClass * skinobj = NULL;
-
- get_skin_modifier_objects(&skindata,&skinobj);
-
- if ( ((Header.Attributes & W3D_MESH_FLAG_GEOMETRY_TYPE_MASK) == W3D_MESH_FLAG_GEOMETRY_TYPE_SKIN) &&
- (HTree != NULL) )
- {
- is_skin = ((skindata != NULL) && (skinobj != NULL));
- }
-
- /*
- ** Submit all of the faces
- */
- MeshBuilderClass::FaceClass face;
- for (face_index = 0; face_index < mesh.getNumFaces(); face_index++) {
-
- Face maxface = mesh.faces[face_index];
-
- int mat_index = 0;
- if (Header.NumMaterials > 0) {
- mat_index = MaterialRemapTable[(maxface.getMatID() % Header.NumMaterials)];
- }
- assert(mat_index != -1);
-
- for (pass=0; passNumSubMtls() > 1)) {
- mtl_to_use = node_mtl->GetSubMtl (maxface.getMatID() % node_mtl->NumSubMtls());
- }
-
- if ((mtl_to_use != NULL) && ((mtl_to_use->ClassID() == GameMaterialClassID) ||
- (mtl_to_use->ClassID() == PS2GameMaterialClassID))) {
- face.SurfaceType = ((GameMtl *)mtl_to_use)->Get_Surface_Type ();
- }
-
- for (vert_counter = 0; vert_counter < 3; vert_counter++) {
-
- /*
- ** if this mesh is being inverted, we need to insert the verts in
- ** the opposite order. max_vert_counter will count backwards
- ** in this case; causing all vertex data to be entered in the
- ** reverse winding.
- */
- int max_vert_counter;
-
- if (MeshInverted) {
- max_vert_counter = 2 - vert_counter;
- } else {
- max_vert_counter = vert_counter;
- }
-
- int max_vert_index = maxface.v[max_vert_counter];
-
- /*
- ** Vertex Id, to prevent unwanted welding!
- */
- face.Verts[vert_counter].Id = max_vert_index;
-
- /*
- ** Vertex Position
- */
- face.Verts[vert_counter].Position.X = mesh.verts[max_vert_index].x;
- face.Verts[vert_counter].Position.Y = mesh.verts[max_vert_index].y;
- face.Verts[vert_counter].Position.Z = mesh.verts[max_vert_index].z;
-
- if (vdata) {
-
- // If an alpha channel has been created, use its value.
- for (int pass=0; pass < MaterialDesc.Pass_Count(); pass++) {
- if (MaterialDesc.Pass_Uses_Vertex_Alpha(pass)) {
- // Mulitiply by .01 to change from percentage.
- face.Verts[vert_counter].Alpha[pass] = vdata[max_vert_index] * .01;
- }
- }
- }
-
-
- /*
- ** Texture coordinate. Apply uv coords if the mesh has them and is not being
- ** instructed to ignore them.
- ** - check if the mesh needs them (uses_simple_rendering() == false)
- ** - for each pass and stage, look up what map channel this face's material is using
- ** - ask Max for the tfaces and tverts for that map channel
- ** - copy the values into each vertex
- */
- for (pass=0; passFilename && *((unsigned int *)map3d->Filename) == DIFFUSE_COLOR_TEXTURE_PREFIX) //check for prefix
- {
- double Diffuse = vmat->Diffuse.Get_Color() >> 8; //get material color
-
- //MW: Encode the material color into the u texture coordinate
- tvert.x=Diffuse;
- tvert.y=Diffuse;
-
- //find out material color location within texture page
- if (strnicmp(MaterialDesc.Get_Vertex_Material_Name(mat_index,pass),"HouseColor",10)==0)
- getMaterialUV(tvert,vmat->Diffuse.Get_Color() >> 8, materialColors, numMaterialColors, numHouseColors, true);
- else
- getMaterialUV(tvert,vmat->Diffuse.Get_Color() >> 8, materialColors, numMaterialColors, numHouseColors, false);
-
- //Keep track of first vertex material converted, so we can remap all other non-textured
- //materials to use the same material.
- if (firstSolidColoredMaterial == -1)
- firstSolidColoredMaterial=MaterialDesc.Get_Vertex_Material_Index(mat_index,pass);
- }
-
- /*
- ** If the mesh needs uv coords and they are present, copy the uv into tvert
- */
- else
- if (!use_simple_rendering(Header.Attributes)) {
-
- int channel = MaterialDesc.Get_Map_Channel(mat_index,pass,stage);
-
- UVVert * uvarray = mesh.mapVerts(channel);
- TVFace * tvfacearray = mesh.mapFaces(channel);
-
- ///@todo: MW: Forced ingoring of uv coordinates if no texture! Is this ok?
- W3dMapClass *map3d=MaterialDesc.Get_Texture(mat_index,pass,stage);
-
- if (map3d && (uvarray != NULL) && (tvfacearray != NULL)) {
-
- int tvert_index = tvfacearray[face_index].t[max_vert_counter];
- tvert = uvarray[tvert_index];
- }
- }
-
- /*
- ** Copy the texture coordinate into the vertex structure
- */
- face.Verts[vert_counter].TexCoord[pass][stage].X = tvert.x;
- face.Verts[vert_counter].TexCoord[pass][stage].Y = tvert.y;
-
- }
- }
-
- /*
- ** Vertex Color
- */
- if (mesh.vcFace) {
-
- /*
- ** If the mesh is being mirrored, remap the index
- */
- int max_cvert_index = mesh.vcFace[face_index].t[max_vert_counter];
-
- VertColor vc;
- vc = mesh.vertCol[max_cvert_index];
-
- /*
- ** If Vertex Alpha is specified, the vertex color is converted
- ** to alpha. If the (obsolete) Node-flag for vertex alpha is enabled,
- ** the alpha is put into each pass which has alpha enabled. Otherwise,
- ** we check the material settings for which passes should get the alpha
- ** values. If neither alpha options are enabled, we put the color
- ** value into the first pass.
- */
- if (ExportOptions.Is_Vertex_Alpha_Enabled()) {
-
- float alpha = (vc.x + vc.y + vc.z) / 3.0f;
- for (int pass=0; pass < MaterialDesc.Pass_Count(); pass++) {
- if (MaterialDesc.Pass_Uses_Vertex_Alpha(pass)) {
- face.Verts[vert_counter].Alpha[pass] = alpha;
- }
- }
- } else {
- face.Verts[vert_counter].DiffuseColor[0].X = vc.x;
- face.Verts[vert_counter].DiffuseColor[0].Y = vc.y;
- face.Verts[vert_counter].DiffuseColor[0].Z = vc.z;
- }
-
- face.Verts[vert_counter].MaxVertColIndex = max_cvert_index;
-
- } else {
- face.Verts[vert_counter].MaxVertColIndex = 0;
- }
-
- /*
- ** Vertex materials (get's index of sub-material)
- */
- for (pass = 0; passFilename && *((unsigned int *)map3d->Filename) == DIFFUSE_COLOR_TEXTURE_PREFIX) //check for prefix
- face.Verts[vert_counter].VertexMaterialIndex[pass]=firstSolidColoredMaterial;
- else
- face.Verts[vert_counter].VertexMaterialIndex[pass] = MaterialDesc.Get_Vertex_Material_Index(mat_index,pass);
- }
-
- face.Verts[vert_counter].Attribute0 = max_vert_index;
- face.Verts[vert_counter].Attribute1 = face_index;
-
- /*
- ** Skin attachment
- */
- face.Verts[vert_counter].BoneIndex = 0;
- if (is_skin) {
-
- int skin_bone_index = skindata->VertData[max_vert_index].BoneIdx[0];
-
- // If this is a valid bone, try to find the corresponding bone index in the HTree
- if ( (skin_bone_index != -1) &&
- (skin_bone_index < skinobj->Num_Bones()) &&
- (skinobj->BoneTab[skin_bone_index] != NULL) )
- {
- face.Verts[vert_counter].BoneIndex = get_htree_bone_index_for_inode(skinobj->BoneTab[skin_bone_index]);
- }
- }
- }
-
- Builder.Add_Face(face);
- }
-
- /*
- ** Process the mesh
- */
- Builder.Build_Mesh(true);
-
- const MeshBuilderClass::MeshStatsStruct & stats = Builder.Get_Mesh_Stats();
- int vcount = Builder.Get_Vertex_Count();
- int pcount = mesh.numFaces;
- float vert_poly_ratio = (float)vcount / (float)pcount;
-
- ExportLog::printf(" triangle count: %d\n",pcount);
- ExportLog::printf(" final vertex count: %d\n",vcount);
- ExportLog::printf(" vertex/triangle ratio: %f\n",vert_poly_ratio);
- ExportLog::printf(" strip count: %d\n",stats.StripCount);
- ExportLog::printf(" average strip length: %f\n",stats.AvgStripLength);
- ExportLog::printf(" longest strip: %d\n",stats.MaxStripLength);
-}
-
-
-/***********************************************************************************************
- * MeshSaveClass::get_skin_modifier_objects -- Searches for the WWSkin modifier for this mesh *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- *=============================================================================================*/
-void MeshSaveClass::get_skin_modifier_objects(SkinDataClass ** skin_data_ptr,SkinWSMObjectClass ** skin_obj_ptr)
-{
- *skin_data_ptr = NULL;
- *skin_obj_ptr = NULL;
-
- // loop through the references that our node has
- for (int i = 0; i < MaxINode->NumRefs(); i++) {
-
- ReferenceTarget *refTarg = MaxINode->GetReference(i);
-
- // if the reference is a WSM Derived Object.
- if (refTarg != NULL && refTarg->ClassID() == Class_ID(WSM_DERIVOB_CLASS_ID,0)) {
-
- IDerivedObject * wsm_der_obj = (IDerivedObject *)refTarg;
-
- // loop through the WSM's attached to this WSM Derived object
- for (int j = 0; j < wsm_der_obj->NumModifiers(); j++) {
- Modifier * mod = wsm_der_obj->GetModifier(j);
- if (mod->ClassID() == SKIN_MOD_CLASS_ID) {
-
- // This is our modifier! Get the data from it!
- SkinModifierClass * skinmod = (SkinModifierClass *)mod;
- ModContext * mc = wsm_der_obj->GetModContext(j);
- *skin_data_ptr = (SkinDataClass *)(mc->localData);
- *skin_obj_ptr = (SkinWSMObjectClass *)skinmod->GetReference(SkinModifierClass::OBJ_REF);
- }
- }
- }
- }
-}
-
-
-/***********************************************************************************************
- * MeshSaveClass::get_htree_bone_index_for_inode -- searches the htree for the given INode *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 5/1/2000 gth : Created. *
- *=============================================================================================*/
-int MeshSaveClass::get_htree_bone_index_for_inode(INode * node)
-{
- // index of this INode in the hierarchy tree (it better be there :-)
- char w3dname[W3D_NAME_LEN];
- Set_W3D_Name(w3dname,node->GetName());
- int bindex = HTree->Find_Named_Node(w3dname);
-
- // If the desired bone isn't being exported, export the point
- // relative to the root.
- if (bindex == -1) {
- bindex = 0;
- }
-
- return bindex;
-}
-
-/***********************************************************************************************
- * MeshSaveClass::inv_deform_mesh -- preprocess the mesh for skinning *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/26/1997 GH : Created. *
- * 5/1/2000 gth : Created. *
- *=============================================================================================*/
-void MeshSaveClass::inv_deform_mesh()
-{
- // Got the skinning info, now pre-deform each vertex and
- // create an array of vertex influence indexes.
- VertInfluences = new W3dVertInfStruct[Builder.Get_Vertex_Count()];
- memset(VertInfluences,0,sizeof(W3dVertInfStruct) * Builder.Get_Vertex_Count());
- Header.VertexChannels |= W3D_VERTEX_CHANNEL_BONEID;
-
- for (int vert_index = 0; vert_index < Builder.Get_Vertex_Count(); vert_index++) {
-
- MeshBuilderClass::VertClass & vert = Builder.Get_Vertex(vert_index);
-
- if (vert.BoneIndex == 0) {
-
- // set the influence to 0 (root node) and leave the vert and normal unchanged
- // (gth) 07/11/2000: Note that in this case, the mesh coordinates have already been
- // transformed relative to the user or scene origin and do not need to be further modified.
- VertInfluences[vert_index].BoneIdx = 0;
-
- } else {
-
- // here we go! get the matrix from the hierarchy tree and transform
- // the point into the bone's coordinate system.
- // (gth) 07/11/2000: The origin_offset_tm is no longer needed because
- // skin meshes are transformed into the origin coordinate system before
- // we get to this code.
- Matrix3 bonetm = HTree->Get_Node_Transform(vert.BoneIndex);
- Matrix3 invbonetm = Inverse(bonetm);
- Point3 pos;
-
- pos.x = vert.Position.X;
- pos.y = vert.Position.Y;
- pos.z = vert.Position.Z;
-
- pos = pos * invbonetm;
-
- vert.Position.X = pos.x;
- vert.Position.Y = pos.y;
- vert.Position.Z = pos.z;
-
- // Now, transform the normal into the bone's coordinate system.
- invbonetm.NoTrans();
- Point3 norm;
-
- norm.x = vert.Normal.X;
- norm.y = vert.Normal.Y;
- norm.z = vert.Normal.Z;
-
- norm = norm * invbonetm;
-
- vert.Normal.X = norm.x;
- vert.Normal.Y = norm.y;
- vert.Normal.Z = norm.z;
-
- VertInfluences[vert_index].BoneIdx = vert.BoneIndex;
- }
- }
-}
-
-
-/***********************************************************************************************
- * MeshSaveClass::Write_To_File -- Append the mesh to an open wtm file *
- * *
- * INPUT: *
- * csave - ChunkSaveClass object to handle writing the chunk-based file *
- * export_aabtree - should we generate an aabtree for this mesh *
- * *
- * OUTPUT: *
- * 0 if nothing went wrong, Non-Zero otherwise *
- * *
- * WARNINGS: *
- * *
- * *
- * HISTORY: *
- * 06/10/1997 GH : Created. *
- *=============================================================================================*/
-int MeshSaveClass::Write_To_File(ChunkSaveClass & csave,bool export_aabtree)
-{
- if (!csave.Begin_Chunk(W3D_CHUNK_MESH)) {
- return 1;
- }
-
- if (write_header(csave) != 0) {
- return 1;
- }
-
- if (write_user_text(csave) != 0) {
- return 1;
- }
-
- if (write_verts(csave) != 0) {
- return 1;
- }
-
- if (write_vert_normals(csave) != 0) {
- return 1;
- }
-
- if (write_triangles(csave) != 0) {
- return 1;
- }
-
- if (write_vert_influences(csave) != 0) {
- return 1;
- }
-
- if (write_vert_shade_indices(csave) != 0) {
- return 1;
- }
-
- if (write_material_info(csave) != 0) {
- return 1;
- }
-
- if (write_vertex_materials(csave) != 0) {
- return 1;
- }
-
- if (PS2Material == TRUE) {
-
- // The ps2 shaders must be written out first.
- if (write_ps2_shaders(csave) != 0) {
- return 1;
- }
- }
-
- if (write_shaders(csave) != 0) {
- return 1;
- }
-
-
- if (write_textures(csave) != 0) {
- return 1;
- }
-
- for (int pass=0; pass 0);
- assert(Builder.Get_Vertex_Count() == (int)Header.NumVertices);
-
- for (int i=0; i= Header.Min.X);
- assert(vert.Position.Y >= Header.Min.Y);
- assert(vert.Position.Z >= Header.Min.Z);
-
- }
-
- W3dVectorStruct w3dvert;
- w3dvert.X = vert.Position.X;
- w3dvert.Y = vert.Position.Y;
- w3dvert.Z = vert.Position.Z;
-
- if (csave.Write(&(w3dvert),sizeof(W3dVectorStruct)) != sizeof(W3dVectorStruct)) {
- return 1;
- }
- }
-
- if (!csave.End_Chunk()) {
- return 1;
- }
- return 0;
-}
-
-
-/***********************************************************************************************
- * MeshSaveClass::write_vert_normals -- Writes the surrender normal chunk into a wtm file *
- * *
- * INPUT: *
- * csave - chunk save object *
- * *
- * OUTPUT: *
- * 0 if nothing went wrong, Non-Zero otherwise *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 06/10/1997 GH : Created. *
- *=============================================================================================*/
-int MeshSaveClass::write_vert_normals(ChunkSaveClass & csave)
-{
- if (!(Header.VertexChannels & W3D_VERTEX_CHANNEL_NORMAL)) return 0;
-
- if (!csave.Begin_Chunk(W3D_CHUNK_VERTEX_NORMALS)) {
- return 1;
- }
-
- for (int i=0; i < Builder.Get_Vertex_Count(); i++) {
-
- const MeshBuilderClass::VertClass & vert = Builder.Get_Vertex(i);
-
- W3dVectorStruct norm;
-
- if (ExportOptions.Is_ZNormals_Enabled()) {
- norm.X = 0.0f;
- norm.Y = 0.0f;
- norm.Z = 1.0f;
- } else {
- norm.X = vert.Normal.X;
- norm.Y = vert.Normal.Y;
- norm.Z = vert.Normal.Z;
- }
-
- if (csave.Write(&(norm),sizeof(W3dVectorStruct)) != sizeof(W3dVectorStruct)) {
- return 1;
- }
- }
-
- if (!csave.End_Chunk()) {
- return 1;
- }
-
- return 0;
-}
-
-/***********************************************************************************************
- * MeshSaveClass::write_vert_influences -- skins will have this chunk that binds verts to bones*
- * *
- * INPUT: *
- * csave - chunk save object *
- * *
- * OUTPUT: *
- * 0 if nothing went wrong, Non-Zero otherwise *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 06/10/1997 GH : Created. *
- *=============================================================================================*/
-int MeshSaveClass::write_vert_influences(ChunkSaveClass & csave)
-{
- if (((Header.Attributes & W3D_MESH_FLAG_GEOMETRY_TYPE_MASK) != W3D_MESH_FLAG_GEOMETRY_TYPE_SKIN) ||
- !(Header.VertexChannels & W3D_VERTEX_CHANNEL_BONEID) ||
- (VertInfluences == NULL)) {
- return 0;
- }
-
- if (!csave.Begin_Chunk(W3D_CHUNK_VERTEX_INFLUENCES)) {
- return 1;
- }
-
- int count = Builder.Get_Vertex_Count();
- if (csave.Write(VertInfluences,count * sizeof(W3dVertInfStruct)) != count * sizeof(W3dVertInfStruct)) {
- return 1;
- }
-
- if (!csave.End_Chunk()) {
- return 1;
- }
-
- return 0;
-}
-
-
-/***********************************************************************************************
- * MeshSaveClass::write_triangles -- write the triangles chunk *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 4/7/98 GTH : Created. *
- *=============================================================================================*/
-int MeshSaveClass::write_triangles(ChunkSaveClass & csave)
-{
- if (!csave.Begin_Chunk(W3D_CHUNK_TRIANGLES)) {
- return 1;
- }
-
- assert(Builder.Get_Face_Count() == (int)Header.NumTris);
- for (int i=0; i 0);
-
- if (PS2Material == TRUE) {
-
- // Make the PC shader as close to the PS2 shader as possible.
- // This will allow for viewing in W3D View.
- setup_PC_shaders_from_PS2_shaders();
- }
-
- if (!csave.Begin_Chunk(W3D_CHUNK_SHADERS)) {
- return 1;
- }
-
- W3dShaderStruct * shader;
-
- for (int i=0; iFilename,strlen(map->Filename) + 1) != strlen(map->Filename) + 1) return 1;
- csave.End_Chunk();
-
- // optionally write an animation info chunk
- if (map->AnimInfo != NULL) {
- csave.Begin_Chunk(W3D_CHUNK_TEXTURE_INFO);
- if (csave.Write(map->AnimInfo,sizeof(W3dTextureInfoStruct)) != sizeof(W3dTextureInfoStruct)) return 1;
- csave.End_Chunk();
- }
-
- csave.End_Chunk();
- }
-
- if (!csave.End_Chunk()) {
- return 1;
- }
- return 0;
-}
-
-int MeshSaveClass::write_pass(ChunkSaveClass & csave,int pass)
-{
- assert(pass >= 0);
- assert(pass < MaterialDesc.Pass_Count());
-
- if (!csave.Begin_Chunk(W3D_CHUNK_MATERIAL_PASS)) {
- return 1;
- }
-
- const MeshBuilderClass::MeshStatsStruct & stats = Builder.Get_Mesh_Stats();
-
- if (stats.HasVertexMaterial[pass]) {
- write_vertex_material_ids(csave,pass);
- }
-
- if (stats.HasShader[pass]) {
- write_shader_ids(csave,pass);
- }
-
- if (stats.HasDiffuseColor[pass] || DeformSave.Does_Deformer_Modify_DCG ()) {
- write_dcg(csave,pass);
- }
-
- for (int stage = 0; stage < MeshBuilderClass::MAX_STAGES; stage++) {
- write_texture_stage(csave,pass,stage);
- }
-
- if (!csave.End_Chunk()) {
- return 1;
- }
- return 0;
-}
-
-int MeshSaveClass::write_vertex_material_ids(ChunkSaveClass & csave,int pass)
-{
- const MeshBuilderClass::MeshStatsStruct & stats = Builder.Get_Mesh_Stats();
-
- if (!csave.Begin_Chunk(W3D_CHUNK_VERTEX_MATERIAL_IDS)) {
- return 1;
- }
-
- uint32 matid;
-
- if (stats.HasPerVertexMaterial[pass]) {
- for (int i=0; i= MIN_AABTREE_POLYGONS) &&
- ((Header.Attributes & W3D_MESH_FLAG_GEOMETRY_TYPE_MASK) == W3D_MESH_FLAG_GEOMETRY_TYPE_NORMAL)
- )
- {
-
- /*
- ** Build temporary array representations of the mesh
- */
- int vertcount = Builder.Get_Vertex_Count();
- int polycount = Builder.Get_Face_Count();
- Vector3 * verts = new Vector3[vertcount];
- Vector3i * polys = new Vector3i[polycount];
-
- for (int vi=0; viNumSubMtls() <= 1)) {
-
- MaterialRemapTable = new int[1];
- MaterialRemapTable[0] = 0;
- return 1;
-
- } else {
-
- int sub_mtl_count = nodemtl->NumSubMtls();
- MaterialRemapTable = new int[sub_mtl_count];
-
- // Initialize each remap to -1 (indicates that the material is un-used)
- for (mat_index=0; mat_index 0);
- return matcount;
- }
-}
-
-//Check if material is solid, non-textured.
-int isTexturedMaterial(Mtl * mtl)
-{
- Texmap * tmap;
-
- tmap = mtl->GetSubTexmap(ID_DI);
- if (mtl->ClassID() == GameMaterialClassID)
- {
- GameMtl * gamemtl=(GameMtl *)mtl;
-
- for (int pass=0;passGet_Pass_Count(); pass++)
- {
- for (int stage=0; stage < W3dMaterialClass::MAX_STAGES; stage++)
- { if (gamemtl->Get_Texture_Enable(pass,stage) && gamemtl->Get_Texture(pass,stage))
- return 1; //using a texture
- }
- }
- return 0;
- }
- else
- {
- return (tmap && tmap->ClassID() == Class_ID(BMTEX_CLASS_ID,0));
- }
-}
-
-//count number of used solid materials (no texture)
-int MeshSaveClass::getNumSolidMaterials(Mtl * nodemtl)
-{
- int mat_index;
- int numSolid=0;
-
- if ((nodemtl == NULL) || (nodemtl->NumSubMtls() <= 1))
- { //Check if diffuse texture present
- if (isTexturedMaterial(nodemtl))
- return 00;
- return 1;
- }
- else
- {
- int sub_mtl_count = nodemtl->NumSubMtls();
-
- for (mat_index=0; mat_indexGetSubMtl(mat_index)))
- continue;
- numSolid++;
- }
- }
- return numSolid;
- }
-}
-
-//Cancels out the material colors by setting them to white.
-//Also changes prefix on texture names to use DIFFUSE_HOUSECOLOR_TEXTURE_PREFIX
-//if house color is used.
-void MeshSaveClass::fix_diffuse_materials(bool isHouseColor)
-{
- uint8 color=255;
- char materialColorFilename[_MAX_FNAME + 1];
-
- for (int mat_index=0; mat_indexFilename && (*((unsigned int *)map3d->Filename) & 0xffff00ff) == DIFFUSE_COLOR_TEXTURE_MASK) //check for 'TXC^' prefix
- { //found a material which had its material color replaced by a texture
- //set the material color to white so it's not being used.
- vmat->Diffuse.Set(color,color,color);
- vmat->Ambient.Set(color,color,color);
-
- if (isHouseColor && *(map3d->Filename+1) != 'H')
- { //our material texture contains house colors, adjust the name
- //by adding H prefix.
- sprintf(materialColorFilename,"%s%s","ZHCD",map3d->Filename+4);
- map3d->Set_Filename(materialColorFilename);
- }
- }
- }
- }
- }
-}
-
-/***********************************************************************************************
- * MeshSaveClass::create_materials -- create the materials for this mesh *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/26/1997 GH : Created. *
- * 2/8/99 GTH : modified to use the MaterialRemapTable *
- *=============================================================================================*/
-void MeshSaveClass::create_materials(Mtl * nodemtl,DWORD wirecolor, char *materialColorTexture)
-{
- bool domaps = !use_simple_rendering(Header.Attributes);
-
- //////////////////////////////////////////////////////////////////////
- // Create materials
- // Four cases:
- // - Creating a collision object: use a hard-coded material
- // - The material is null: use wire color
- // - The material is a simple material: create one material
- // - The material is a multi-material: create n materials
- //////////////////////////////////////////////////////////////////////
- int geo_type = Header.Attributes & W3D_MESH_FLAG_GEOMETRY_TYPE_MASK;
- if ((geo_type == W3D_MESH_FLAG_GEOMETRY_TYPE_AABOX) ||
- (geo_type == W3D_MESH_FLAG_GEOMETRY_TYPE_OBBOX))
- {
- Header.NumMaterials = 1;
-
- W3dVertexMaterialStruct vmat;
- W3dShaderStruct shader;
- W3dMaterialClass material;
-
- Color diffuse;
- if (Header.Attributes & W3D_MESH_FLAG_COLLISION_TYPE_PHYSICAL) {
- diffuse.r = 0.0f;
- diffuse.g = 0.0f;
- diffuse.b = 1.0f;
- } else {
- diffuse.r = 0.4f;
- diffuse.g = 1.0f;
- diffuse.b = 0.4f;
- }
-
- W3d_Shader_Reset(&shader);
- W3d_Shader_Set_Dest_Blend_Func(&shader,W3DSHADER_DESTBLENDFUNC_ONE_MINUS_SRC_ALPHA);
- W3d_Shader_Set_Src_Blend_Func(&shader,W3DSHADER_SRCBLENDFUNC_SRC_ALPHA);
-
- W3d_Vertex_Material_Reset(&vmat);
- vmat.Opacity = 0.5f;
-
- // add material 0
- vmat.Diffuse.R = (uint8)(diffuse.r * 255.0f);
- vmat.Diffuse.G = (uint8)(diffuse.g * 255.0f);
- vmat.Diffuse.B = (uint8)(diffuse.b * 255.0f);
- material.Set_Pass_Count(1);
- material.Set_Vertex_Material(vmat,0);
- material.Set_Shader(shader,0);
- MaterialDesc.Add_Material(material);
-
- assert(MaterialDesc.Material_Count() == 1);
-
- } else if (!nodemtl) {
-
- // Create a single material using the wire color
- Header.NumMaterials = 1;
-
- W3dVertexMaterialStruct vmat;
- W3dShaderStruct shader;
- W3dMaterialClass material;
-
- W3d_Vertex_Material_Reset(&vmat);
- W3d_Shader_Reset(&shader);
-
- vmat.Diffuse.R = GetRValue(wirecolor);
- vmat.Diffuse.G = GetGValue(wirecolor);
- vmat.Diffuse.B = GetBValue(wirecolor);
-
- material.Set_Pass_Count(1);
- material.Set_Vertex_Material(vmat,0);
- material.Set_Shader(shader,0);
-
- MaterialDesc.Add_Material(material,"WireColor");
- assert(MaterialDesc.Material_Count() == 1);
-
- } else if (!nodemtl->IsMultiMtl()) {
-
- Header.NumMaterials = 1;
- W3dMaterialClass mat;
-
- if (isTexturedMaterial(nodemtl) == 0)
- mat.Init(nodemtl,materialColorTexture);
- else
- mat.Init(nodemtl,NULL);
-
- W3dMaterialDescClass::ErrorType err;
- err = MaterialDesc.Add_Material(mat,nodemtl->GetName());
- if (err == W3dMaterialDescClass::MULTIPASS_TRANSPARENT) {
- sprintf(_string1,"Exporting Materials for Mesh: %s\nMaterial %s is multi-pass and transparent\nMulti-pass transparent materials are not allowed.\n",
- Header.MeshName,
- nodemtl->GetName());
- ExportLog::printf(_string1);
- throw ErrorClass(_string1);
- }
- assert(MaterialDesc.Material_Count() == 1);
-
- } else {
-
- Header.NumMaterials = nodemtl->NumSubMtls();
- W3dMaterialClass mat;
-
- for (unsigned mi = 0; mi < Header.NumMaterials; mi++) {
-
- // only process materials that were found to be used in the scan_used_materials call
- if (MaterialRemapTable[mi] != -1) {
-
- if (isTexturedMaterial(nodemtl->GetSubMtl(mi)) == 0)
- mat.Init(nodemtl->GetSubMtl(mi),materialColorTexture);
- else
- mat.Init(nodemtl->GetSubMtl(mi),NULL);
-
- char * name;
- W3dMaterialDescClass::ErrorType err;
-
- name = nodemtl->GetSubMtl(mi)->GetName();
- err = MaterialDesc.Add_Material(mat,name);
-
- if (err == W3dMaterialDescClass::INCONSISTENT_PASSES) {
- sprintf(_string1,"Exporting Materials for Mesh: %s\nMaterial %s has %d passes.\nThe other materials have %d passes.\nAll Materials must have the same number of passes.\n",
- Header.MeshName,
- nodemtl->GetSubMtl(mi)->GetName(),
- mat.Get_Pass_Count(),
- MaterialDesc.Pass_Count());
- ExportLog::printf(_string1);
- throw ErrorClass(_string1);
- }
- if (err == W3dMaterialDescClass::MULTIPASS_TRANSPARENT) {
- sprintf(_string1,"Exporting Materials for Mesh: %s\nMaterial %s is multi-pass and transparent\nMulti-pass transparent materials are not allowed.\n",
- Header.MeshName,
- nodemtl->GetSubMtl(mi)->GetName());
- throw ErrorClass(_string1);
- }
- if (err == W3dMaterialDescClass::INCONSISTENT_SORT_LEVEL) {
- sprintf(_string1,"Exporting Materials for Mesh: %s\nMaterial %s does not have the same Static Sort Level as other materials used on the mesh.\nAll materials for a mesh must use the same Static Sort Level value.\n",
- Header.MeshName,
- nodemtl->GetSubMtl(mi)->GetName());
- ExportLog::printf(_string1);
- throw ErrorClass(_string1);
- }
- }
- }
- }
-
- // Store the material's sort level in the mesh header.
- Header.SortLevel = MaterialDesc.Get_Sort_Level();
-}
-
-/***********************************************************************************************
- * MeshSaveClass::compute_bounding_volumes -- computes a bounding box and bounding sphere for *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 08/01/1997 GH : Created. *
- *=============================================================================================*/
-void MeshSaveClass::compute_bounding_volumes(void)
-{
- Vector3 min,max,center;
- float radius;
-
- Builder.Compute_Bounding_Box(&min,&max);
- Builder.Compute_Bounding_Sphere(¢er,&radius);
-
- Header.SphCenter.X = center.X;
- Header.SphCenter.Y = center.Y;
- Header.SphCenter.Z = center.Z;
- Header.SphRadius = radius;
-
- Header.Min.X = min.X;
- Header.Min.Y = min.Y;
- Header.Min.Z = min.Z;
- Header.Max.X = max.X;
- Header.Max.Y = max.Y;
- Header.Max.Z = max.Z;
-}
-
-
-/***********************************************************************************************
- * MeshSaveClass::compute_physical_properties -- computes the volume and moment of inertia *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 08/01/1997 GH : Created. *
- *=============================================================================================*/
-void MeshSaveClass::compute_physical_constants
-(
- INode * inode,
- Progress_Meter_Class & meter,
- bool voxelize
-)
-{
-
-#if 0 // IF we need this again, move the data to a physics chunk (header doesn't have it anymore)
-
- if (voxelize) {
-
- // Create an INodeList object for this mesh
- AnyINodeFilter nodefilt;
- INodeListClass meshlist(CurTime,&nodefilt);
- meshlist.Insert(inode);
-
- // Create a Voxel object for this mesh
- VoxelClass * voxel = new VoxelClass
- (
- meshlist,
- VOXEL_RESOLUTION,
- ExportSpace,
- CurTime,
- meter
- );
-
-#if DEBUG_VOXELS
- VoxelDebugWindowClass dbgwin(voxel);
- dbgwin.Display_Window();
-#endif
-
- double vol[1];
- double cm[3];
- double inertia[9];
-
- voxel->Compute_Physical_Properties(vol,cm,inertia);
-
- Header.Volume = (float)vol[0];
-
- Header.MassCenter.X = (float)cm[0];
- Header.MassCenter.Y = (float)cm[1];
- Header.MassCenter.Z = (float)cm[2];
-
- Header.Inertia[0] = (float)inertia[0];
- Header.Inertia[1] = (float)inertia[1];
- Header.Inertia[2] = (float)inertia[2];
- Header.Inertia[3] = (float)inertia[3];
- Header.Inertia[4] = (float)inertia[4];
- Header.Inertia[5] = (float)inertia[5];
- Header.Inertia[6] = (float)inertia[6];
- Header.Inertia[7] = (float)inertia[7];
- Header.Inertia[8] = (float)inertia[8];
-
- } else {
-
- // Set mass center to the center of the bounding box
- Header.MassCenter.X = (Header.Max.X + Header.Min.X) / 2.0f;
- Header.MassCenter.Y = (Header.Max.Y + Header.Min.Y) / 2.0f;
- Header.MassCenter.Z = (Header.Max.Z + Header.Min.Z) / 2.0f;
-
- // Set inertia tensor to inertia tensor of the bounding box
- // (gth) !!!! DO THIS !!!!
- Header.Inertia[0] = 1.0f;
- Header.Inertia[1] = 0.0f;
- Header.Inertia[2] = 0.0f;
- Header.Inertia[3] = 0.0f;
- Header.Inertia[4] = 1.0f;
- Header.Inertia[5] = 0.0f;
- Header.Inertia[6] = 0.0f;
- Header.Inertia[7] = 0.0f;
- Header.Inertia[8] = 1.0f;
-
- Header.Volume = (Header.Max.X - Header.Min.X) * (Header.Max.Y - Header.Min.Y) * (Header.Max.Z - Header.Min.Z);
- }
-
-#endif
-}
-
-
-/***********************************************************************************************
- * MeshSaveClass::prep_mesh -- pre-transform the MAX mesh by a specified matrix *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 08/01/1997 GH : Created. *
- *=============================================================================================*/
-void MeshSaveClass::prep_mesh(Mesh & mesh,Matrix3 & objoff)
-{
- int vert_index;
-
- // Transform the mesh's vertices so that they are relative to the coordinate
- // system that we want to use with the mesh
- for (vert_index = 0; vert_index < mesh.getNumVerts (); vert_index++) {
- mesh.verts[vert_index] = mesh.verts[vert_index] * objoff;
- }
-
- // Re-Build the normals.
- mesh.buildNormals();
-}
-
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/meshsave.h b/Generals/Code/Tools/WW3D/max2w3d/meshsave.h
deleted file mode 100644
index 48c9b6681d5..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/meshsave.h
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/* $Header: /Commando/Code/Tools/max2w3d/meshsave.h 44 10/30/00 1:12p Greg_h $ */
-/***********************************************************************************************
- *** Confidential - Westwood Studios ***
- ***********************************************************************************************
- * *
- * Project Name : Commando / G *
- * *
- * File Name : MESHSAVE.H *
- * *
- * Programmer : Greg Hjelstrom *
- * *
- * Start Date : 06/10/97 *
- * *
- * Last Update : June 10, 1997 [GH] *
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#if defined(_MSC_VER)
-#pragma once
-#endif
-
-#ifndef MESHSAVE_H
-#define MESHSAVE_H
-
-#include "rawfile.h" // have to include this before Max.h
-#include
-#include "BITTYPE.H"
-#include "w3d_file.h"
-#include "chunkio.h"
-#include "PROGRESS.H"
-#include "nodelist.h"
-#include "util.h"
-#include "w3dmtl.h"
-#include "meshbuild.h"
-#include "MeshDeformSave.h"
-#include "w3dappdata.h"
-
-class HierarchySaveClass;
-class MeshConnectionsClass;
-class MeshSaveClass;
-class SkinDataClass;
-
-
-/*******************************************************************************************
-**
-** VertStruct
-**
-*******************************************************************************************/
-struct VertStruct
-{
- Point3 Vertex;
- Point3 Normal;
- Point2 TexCoord;
- Color Color;
-
- uint32 MaxVertIdx; // index of the MAX vertex that this vert came from
- uint32 MaxFaceIdx; // index of the MAX face that this vert came from
- VertStruct * Next; // used by the hash table...
-};
-
-/*******************************************************************************************
-**
-** FaceStruct
-**
-*******************************************************************************************/
-struct FaceStruct
-{
- uint32 MaxVidx[3]; // original 3ds-MAX vertex index (for smoothing computations)
- uint32 OurVidx[3]; // vertex, vertex normal, and texture coord indices
- uint32 MaterialIdx; // material index
- uint32 SmGroup; // smoothing group (not really needed, normals pre-calced)
- Point3 Normal; // Face normal
- float32 Dist; // Plane distance
- uint32 Attributes; // collision flags, sort method, etc
-};
-
-/*******************************************************************************************
-**
-** MeshSaveClass - this is the big one, create meshes and skins from a MAX mesh.
-**
-*******************************************************************************************/
-class MeshSaveClass
-{
-public:
-
- enum {
- EX_UNKNOWN = 0, // exception error codes
- EX_CANCEL = 1
- };
-
- MeshSaveClass(
- char * mesh_name,
- char * container_name,
- INode * inode,
- const Mesh * input_mesh,
- Matrix3 & exportspace,
- W3DAppData2Struct & exportoptions,
- HierarchySaveClass * htree,
- TimeValue curtime,
- Progress_Meter_Class & meter,
- unsigned int * materialColors,
- int &numMaterialColors,
- int &numHouseColors,
- char * materialColorTexture,
- WorldInfoClass * world_info = NULL
- );
-
- ~MeshSaveClass(void);
-
- int Write_To_File(ChunkSaveClass & csave,bool export_aabtrees = false);
-
-private:
-
- INode * MaxINode;
- W3DAppData2Struct & ExportOptions;
-
- W3dMeshHeader3Struct Header;
- W3dMaterialDescClass MaterialDesc;
- MeshBuilderClass Builder;
- MeshDeformSaveClass DeformSave;
- TimeValue CurTime;
- Matrix3 ExportSpace;
- Matrix3 MeshToExportSpace;
- Matrix3 PivotSpace;
- HierarchySaveClass * HTree;
- char * UserText;
- bool MeshInverted; // this flag indicates that the transform is inverting this mesh
- W3dVertInfStruct * VertInfluences;
-
- int * MaterialRemapTable; // reindexes mtl_idx after un-used mtls are removed
-
- // Flag set if the mesh uses a PS2 material.
- int PS2Material;
-
-private:
-
- // Use a MeshBuilderClass to process the mesh
- void Build_Mesh(Mesh & mesh, Mtl *node_mtl, unsigned int *materialColors, int &numMaterialColors, int &numHouseColors);
-
- // compute properties for the mesh
- void compute_bounding_volumes(void);
- void compute_physical_constants(INode * inode,Progress_Meter_Class & meter,bool voxelize);
-
- // create the materials
- int scan_used_materials(Mesh & mesh, Mtl * nodemtl);
- void create_materials(Mtl * nodemtl,DWORD wirecolor, char *materialColorTexture);
- void fix_diffuse_materials(bool isHouseColor);
-
- // count number of used solid materials (no texture)
- int getNumSolidMaterials(Mtl * nodemtl);
-
- // creating damage stages
- void add_damage_stage(MeshSaveClass * damage_mesh);
-
- // methods used in building the wtm file
- int write_header(ChunkSaveClass & csave);
- int write_user_text(ChunkSaveClass & csave);
-
- int write_verts(ChunkSaveClass & csave);
- int write_vert_normals(ChunkSaveClass & csave);
- int write_vert_influences(ChunkSaveClass & csave);
- int write_vert_shade_indices(ChunkSaveClass & csave);
-
- int write_triangles(ChunkSaveClass & csave);
-
- int write_material_info(ChunkSaveClass & csave);
- int write_shaders(ChunkSaveClass & csave);
- int write_vertex_materials(ChunkSaveClass & csave);
- int write_textures(ChunkSaveClass & csave);
-
- int write_pass(ChunkSaveClass & csave,int pass);
- int write_vertex_material_ids(ChunkSaveClass & csave,int pass);
- int write_shader_ids(ChunkSaveClass & csave,int pass);
- int write_dcg(ChunkSaveClass & csave,int pass);
-
- int write_texture_stage(ChunkSaveClass & csave,int pass,int stage);
- int write_texture_ids(ChunkSaveClass & csave,int pass,int stage);
- int write_texture_coords(ChunkSaveClass & csave,int pass,int stage);
-
- int write_aabtree(ChunkSaveClass & csave);
-
- // transforms mesh so that it uses the desired coordinate system
- void prep_mesh(Mesh & mesh,Matrix3 & objoff);
-
- // inverse deform the mesh so that its ready to be used as a skin!
- void get_skin_modifier_objects(SkinDataClass ** skin_data_ptr,SkinWSMObjectClass ** skin_obj_ptr);
- int get_htree_bone_index_for_inode(INode * node);
- void inv_deform_mesh(void);
-
- // get rendering settings for the materials
- void customize_materials(void);
-
- // Write the ps2 shaders and approximate them as close as possible in the W3D shaders.
- int write_ps2_shaders(ChunkSaveClass & csave);
-
- // Make the PC shader emulate the PS2 shader.
- void setup_PC_shaders_from_PS2_shaders();
-
- friend class DamageClass;
-};
-
-
-
-
-
-#endif /*MESHSAVE_H*/
\ No newline at end of file
diff --git a/Generals/Code/Tools/WW3D/max2w3d/motion.cpp b/Generals/Code/Tools/WW3D/max2w3d/motion.cpp
deleted file mode 100644
index f2c883ba053..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/motion.cpp
+++ /dev/null
@@ -1,1027 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/* $Header: /Commando/Code/Tools/max2w3d/motion.cpp 26 10/30/00 6:56p Greg_h $ */
-/***********************************************************************************************
- *** Confidential - Westwood Studios ***
- ***********************************************************************************************
- * *
- * Project Name : Commando Tools - W3D export *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/motion.cpp $*
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 10/30/00 5:25p $*
- * *
- * $Revision:: 26 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * MotionClass::MotionClass -- constructor *
- * MotionClass::MotionClass -- constructor *
- * MotionClass::init -- initialize *
- * MotionClass::~MotionClass -- destructor *
- * MotionClass::compute_frame_motion -- compute the motion for a specified frame *
- * MotionClass::set_motion_matrix -- save a motin matrix *
- * MotionClass::get_motion_matrix -- retrieve a motion matrix *
- * MotionClass::set_eulers -- store euler angles *
- * MotionClass::get_eulers -- retrieve euler angles *
- * MotionClass::Save -- save the motion to a W3D file *
- * MotionClass::save_header -- save the header *
- * MotionClass::save_channels -- save the motion channels *
- * MotionClass::set_visibility -- store a visibility bit *
- * MotionClass::get_visibility -- retrieve the visibility bit for this node:frame *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#include "motion.h"
-#include "w3d_file.h"
-#include "vchannel.h"
-#include "bchannel.h"
-#include "EULER.H"
-#include "util.h"
-#include "errclass.h"
-#include "w3dutil.h"
-#include "exportlog.h"
-
-
-
-/***********************************************************************************************
- * MotionClass::MotionClass -- constructor *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/26/1997 GH : Created. *
- *=============================================================================================*/
-MotionClass::MotionClass
-(
- IScene * scene,
- INode * rootnode,
- HierarchySaveClass * basepose,
- W3dExportOptionsStruct & options,
- int framerate,
- Progress_Meter_Class * meter,
- HWND MaxHwnd,
- char * name,
- Matrix3 & offset
-):
- BasePose(basepose),
- Scene(scene),
- RootNode(rootnode),
- RootList(NULL),
- StartFrame(options.StartFrame),
- EndFrame(options.EndFrame),
- ReduceAnimation(options.ReduceAnimation),
- ReduceAnimationPercent(options.ReduceAnimationPercent),
- CompressAnimation(options.CompressAnimation),
- CompressAnimationFlavor(options.CompressAnimationFlavor),
- CompressAnimationTranslationError(options.CompressAnimationTranslationError),
- CompressAnimationRotationError(options.CompressAnimationRotationError),
- FrameRate(framerate),
- Meter(meter),
- Offset(offset)
-{
-
- ExportLog::printf("Initializing Capture....\n");
-
- init();
-
- Set_W3D_Name(Name,name);
-}
-
-/***********************************************************************************************
- * MotionClass::MotionClass -- constructor *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/26/1997 GH : Created. *
- *=============================================================================================*/
-MotionClass::MotionClass
-(
- IScene * scene,
- INodeListClass * rootlist,
- HierarchySaveClass * basepose,
- W3dExportOptionsStruct & options,
- int framerate,
- Progress_Meter_Class * meter,
- HWND MaxHwnd,
- char * name,
- Matrix3 & offset
-):
- BasePose(basepose),
- Scene(scene),
- RootNode(NULL),
- RootList(rootlist),
- StartFrame(options.StartFrame),
- EndFrame(options.EndFrame),
- ReduceAnimation(options.ReduceAnimation),
- ReduceAnimationPercent(options.ReduceAnimationPercent),
- CompressAnimation(options.CompressAnimation),
- CompressAnimationFlavor(options.CompressAnimationFlavor),
- CompressAnimationTranslationError(options.CompressAnimationTranslationError),
- CompressAnimationRotationError(options.CompressAnimationRotationError),
- FrameRate(framerate),
- Meter(meter),
- Offset(offset)
-{
-
- ExportLog::printf("Initializing Capture....\n");
-
- init();
-
- Set_W3D_Name(Name,name);
-}
-
-/***********************************************************************************************
- * MotionClass::init -- initialize *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/26/1997 GH : Created. *
- *=============================================================================================*/
-void MotionClass::init(void)
-{
- int i,j;
-
- NumFrames = (EndFrame - StartFrame + 1);
-
- ExportLog::printf("Extracting %d frames of animation from Max\n", NumFrames);
- ExportLog::printf("\n");
-
- /*
- ** Allocate space for a matrix per frame per node
- ** and an XYZEulers per frame per node.
- */
- MotionMatrix = new Matrix3 * [BasePose->Num_Nodes()];
- if (MotionMatrix == NULL) {
- throw (ErrorClass("Out of Memory"));
- }
-
- EulerDelta = new Point3 * [BasePose->Num_Nodes()];
- if (EulerDelta == NULL) {
- throw (ErrorClass("Out of Memory"));
- }
-
- for (i=0; iNum_Nodes(); i++) {
- MotionMatrix[i] = new Matrix3[NumFrames];
- if (MotionMatrix[i] == NULL) {
- throw (ErrorClass("Out of Memory"));
- }
-
- /*
- ** Initialize all of the matrices to identity.
- */
- for (j=0; jNum_Nodes(); i++) {
- EulerDelta[i] = new Point3[NumFrames];
- if (EulerDelta[i] == NULL) {
- throw (ErrorClass("Out of Memory"));
- }
-
- /*
- ** Initialize all of the Euler angles to 0,0,0
- */
- for (j=0; jNum_Nodes()];
-
- for (i=0; iNum_Nodes(); i++) {
- VisData[i].Resize(NumFrames);
-
- /*
- ** initialize to always visible
- */
- for (j=0; jNum_Nodes()];
-
- for (i=0; iNum_Nodes(); i++) {
- BinMoveData[i].Resize(NumFrames);
-
- /*
- ** initialize to always interpolate
- */
- for (j=0; jNum_Nodes());
-
- for (i=0; iNum_Nodes(); i++) {
- NodeValidFlags[i] = 0;
- }
-
- /*
- ** Compute motion data for each frame
- */
- for (i=0; i < NumFrames; i++) {
- ExportLog::rprintf("( %d ) ", i);
- ExportLog::updatebar(i, NumFrames);
- compute_frame_motion(i);
- }
-
- ExportLog::updatebar(1, 1); // 100%
- ExportLog::rprintf("Extraction Complete.\n");
-}
-
-
-
-/***********************************************************************************************
- * MotionClass::~MotionClass -- destructor *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/26/1997 GH : Created. *
- *=============================================================================================*/
-MotionClass::~MotionClass(void)
-{
- int i;
-
- for (i=0; iNum_Nodes(); i++) {
- if (MotionMatrix[i]) delete[] MotionMatrix[i];
- }
- if (MotionMatrix) {
- delete[] MotionMatrix;
- }
-
- for (i=0; iNum_Nodes(); i++) {
- if (EulerDelta[i]) delete[] EulerDelta[i];
- }
- if (EulerDelta) {
- delete[] EulerDelta;
- }
-
- if (VisData) {
- delete[] VisData;
- }
-
- if (BinMoveData) {
- delete[] BinMoveData;
- }
-
- ExportLog::printf("Destroy Log..%d,%d,%d,%d, %s..\n",1,2,3,4,"go");
-
-}
-
-
-/***********************************************************************************************
- * MotionClass::compute_frame_motion -- compute the motion for a specified frame *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/26/1997 GH : Created. *
- *=============================================================================================*/
-void MotionClass::compute_frame_motion(int frame)
-{
- /*
- ** Compute MAX's time value for this frame
- ** NOTE: the frame index passed in is the offset from StartFrame
- ** to get the original MAX frame number, we add StartFrame.
- */
- TimeValue frametime = (StartFrame + frame) * GetTicksPerFrame();
-
- /*
- ** Create a hierarchy tree object for the scene at this frame
- */
- HierarchySaveClass * tree;
-
- if (RootNode != NULL) {
- tree = new HierarchySaveClass(RootNode,frametime,*Meter,"NoName",false,BasePose);
- } else {
- tree = new HierarchySaveClass(RootList,frametime,*Meter,"NoName",false,BasePose,Offset);
- }
-
- if (tree == NULL) {
- throw (ErrorClass("Out of memory!"));
- }
-
- /*
- ** Loop over each node in this frame's tree
- */
- for (int tindex=0; tindexNum_Nodes(); tindex++) {
-
- /*
- ** Find the node in the Base Pose corresponding to this node.
- ** If this node is not in the base pose, skip
- */
- int bindex = BasePose->Find_Named_Node(tree->Get_Node_Name(tindex));
-
- if (bindex != -1) {
-
- /*
- ** Get the relative transform from the base and from
- ** this frame's tree. Assume that both have already been "fixed";
- ** obviously the base pose has... However, the current tree
- ** needs to be built by passing the basepose in as the "fixup tree"
- **
- ** What are the "fixup" matrices? These are the transforms which
- ** were applied to the base pose when the user wanted to force the
- ** base pose to use only matrices with certain properties. For
- ** example, if we wanted the base pose to use translations only,
- ** the fixup transform for each node is a transform which when
- ** multiplied by the real node's world transform, yeilds a pure
- ** translation matrix. Fixup matrices also show up in the mesh
- ** exporter since all vertices must be transformed by their inverses
- ** in order to make things work...
- */
- Matrix3 basetm = BasePose->Get_Node_Relative_Transform(bindex);
- Matrix3 thistm = tree->Get_Node_Relative_Transform(tindex);
- INode *tree_node = tree->Get_Node(tindex);
-
- Matrix3 motion = thistm * Inverse(basetm);
-
- motion = Cleanup_Orthogonal_Matrix(motion);
-
- set_motion_matrix(bindex,frame,motion);
-
- /*
- ** Also, store the Euler angles for this node
- */
- EulerAnglesClass my_eulers(motion,EulerOrderXYZr);
- float ex = my_eulers.Get_Angle(0);
- float ey = my_eulers.Get_Angle(1);
- float ez = my_eulers.Get_Angle(2);
-
- set_eulers(bindex,frame,ex,ey,ez);
-
- /*
- ** Store the visibility bit for this node
- */
- INode * node = tree->Get_Node(tindex);
- bool vis;
- if (node) {
- vis = (node->GetVisibility(frametime) > 0.0f);
- } else {
- vis = 1;
- }
- set_visibility(bindex,frame,vis);
-
- //
- // Store out binary move or not
- //
- bool binary_move = false;
-
- if ((node)&&(vis)) {
-
- if (frame != 0) {
- // sample previous frame, and an inbetween time
- // to determine if there's a binary movement
-
- TimeValue frametime_prev = frametime - GetTicksPerFrame();
- TimeValue frametime_mid = (frametime + frametime_prev) / 2;
-
- // if data at frametime_prev == data at frametime_mid and != data at frametime
- // then we have a binary movement!
-
- Control *c;
-
- c = node->GetTMController()->GetPositionController();
-
- if (c) {
-
- Interval iValid;
-
- Matrix3 smat1; // sample matrix 1
- Matrix3 smat2; // sample matrix 2
- Matrix3 smat3; // sample matrix 3
-
- iValid = FOREVER;
- smat1 = node->GetParentTM(frametime_prev);
- c->GetValue(frametime_prev, &smat1, iValid, CTRL_RELATIVE);
-
- iValid = FOREVER;
- smat2 = node->GetParentTM(frametime_mid);
- c->GetValue(frametime_mid, &smat2, iValid, CTRL_RELATIVE);
-
- iValid = FOREVER;
- smat3 = node->GetParentTM(frametime);
- c->GetValue(frametime, &smat3, iValid, CTRL_RELATIVE);
-
- if ((smat1 == smat2) && (!(smat2 == smat3))) {
- binary_move = true;
- DebugPrint(_T("Binary Move on Translation\n"));
- }
-
- if (false == binary_move) {
- c = node->GetTMController()->GetRotationController();
-
- if (c) {
-
- iValid = FOREVER;
- smat1 = node->GetParentTM(frametime_prev);
- c->GetValue(frametime_prev, &smat1, iValid, CTRL_RELATIVE);
-
- iValid = FOREVER;
- smat2 = node->GetParentTM(frametime_mid);
- c->GetValue(frametime_mid, &smat2, iValid, CTRL_RELATIVE);
-
- iValid = FOREVER;
- smat3 = node->GetParentTM(frametime);
- c->GetValue(frametime, &smat3, iValid, CTRL_RELATIVE);
-
- if ((smat1 == smat2) && (!(smat2 == smat3))) {
- binary_move = true;
- DebugPrint(_T("Binary Move on Rotation\n"));
- }
- }
- }
- }
- }
- }
-
-
- set_binary_movement(bindex, frame, binary_move);
-
- } // if(bindex!=-1)
- }
-
- /*
- ** release allocated memory
- */
- delete tree;
-}
-
-
-/***********************************************************************************************
- * MotionClass::set_motion_matrix -- store a motion matrix *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/26/1997 GH : Created. *
- *=============================================================================================*/
-void MotionClass::set_motion_matrix(int node,int frame,const Matrix3 & motion)
-{
- assert(node >= 0);
- assert(frame >= 0);
- assert(node < BasePose->Num_Nodes());
- assert(frame < NumFrames);
-
- MotionMatrix[node][frame] = motion;
- NodeValidFlags[node] = 1;
-}
-
-
-/***********************************************************************************************
- * MotionClass::get_motion_matrix -- retrieve a motion matrix *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/26/1997 GH : Created. *
- *=============================================================================================*/
-Matrix3 MotionClass::get_motion_matrix(int node,int frame)
-{
- assert(node >= 0);
- assert(frame >= 0);
- assert(node < BasePose->Num_Nodes());
- assert(frame < NumFrames);
-
- return MotionMatrix[node][frame];
-}
-
-
-/***********************************************************************************************
- * MotionClass::set_eulers -- store euler angles *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/26/1997 GH : Created. *
- *=============================================================================================*/
-void MotionClass::set_eulers(int node,int frame, float x, float y, float z)
-{
- /*
- ** if we're past the first frame, massage the euler angles to the
- ** representation closest to the previous frame.
- */
- if (frame > 0) {
-
- /*
- ** First, compute equivalent euler angles
- */
- double x2 = PI + x;
- double y2 = PI - y;
- double z2 = PI + z;
-
- if (x2 > PI) {
- x2 = x2 - 2*PI;
- }
-
- if (y2 > PI) {
- y2 = y2 - 2*PI;
- }
-
- if (z2 > PI) {
- z2 = z2 - 2*PI;
- }
-
- /*
- ** load up the previous frame eulers
- */
- double px,py,pz;
- px = get_eulers(node,frame - 1)[0];
- py = get_eulers(node,frame - 1)[1];
- pz = get_eulers(node,frame - 1)[2];
-
- // now, pick between the two
- double mag0 = (x - px) * (x - px) + (y - py) * (y - py) + (z - pz) * (z - pz);
- double mag1 = (x2 - px) * (x2 - px) + (y2 - py) * (y2 - py) + (z2 - pz) * (z2 - pz);
-
- if (mag1 < mag0) {
- x = x2;
- y = y2;
- z = z2;
- }
- }
-
- EulerDelta[node][frame].x = x;
- EulerDelta[node][frame].y = y;
- EulerDelta[node][frame].z = z;
- NodeValidFlags[node] = 1;
-}
-
-
-/***********************************************************************************************
- * MotionClass::get_eulers -- retrieve euler angles *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/26/1997 GH : Created. *
- *=============================================================================================*/
-Point3 MotionClass::get_eulers(int node,int frame)
-{
- return Point3(
- EulerDelta[node][frame].x,
- EulerDelta[node][frame].y,
- EulerDelta[node][frame].z
- );
-}
-
-
-/***********************************************************************************************
- * MotionClass::set_visibility -- store a visibility bit *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 1/15/98 GTH : Created. *
- *=============================================================================================*/
-void MotionClass::set_visibility(int node,int frame,bool visible)
-{
- VisData[node][frame] = visible;
- NodeValidFlags[node] = 1;
-}
-
-
-/***********************************************************************************************
- * MotionClass::get_visibility -- retrieve the visibility bit for this node:frame *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 1/15/98 GTH : Created. *
- *=============================================================================================*/
-bool MotionClass::get_visibility(int node,int frame)
-{
- return VisData[node][frame];
-}
-
-
-/***********************************************************************************************
- * MotionClass::set_binary_movement -- store a binary movement bit *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 1/15/98 GTH : Created. *
- *=============================================================================================*/
-void MotionClass::set_binary_movement(int node,int frame,bool visible)
-{
- BinMoveData[node][frame] = visible;
- //NodeValidFlags[node] = 1;
-}
-
-
-/***********************************************************************************************
- * MotionClass::get_visibility -- retrieve the movement bit for this node:frame *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 1/15/98 GTH : Created. *
- *=============================================================================================*/
-bool MotionClass::get_binary_movement(int node,int frame)
-{
- return BinMoveData[node][frame];
-}
-
-
-
-/***********************************************************************************************
- * MotionClass::Save -- save the motion to a W3D file *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/26/1997 GH : Created. *
- *=============================================================================================*/
-bool MotionClass::Save(ChunkSaveClass & csave)
-{
- uint32 chunk_anim_type = W3D_CHUNK_ANIMATION;
-
- ExportLog::printf("\nBegin Save Motion Data\n");
-
- if (CompressAnimation) {
- chunk_anim_type = W3D_CHUNK_COMPRESSED_ANIMATION;
- }
-
- if (!csave.Begin_Chunk( chunk_anim_type )) {
- return false;
- }
-
- if (!save_header(csave)) {
- return false;
- }
-
- if (!save_channels(csave)) {
- return false;
- }
-
- if (!csave.End_Chunk()) {
- return false;
- }
-
- return true;
-}
-
-
-/***********************************************************************************************
- * MotionClass::save_header -- save the header *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/26/1997 GH : Created. *
- *=============================================================================================*/
-bool MotionClass::save_header(ChunkSaveClass & csave)
-{
-
- ExportLog::printf("Save Header Type: ");
-
- if (CompressAnimation) {
- // New Compressed Style
- if (!csave.Begin_Chunk(W3D_CHUNK_COMPRESSED_ANIMATION_HEADER)) {
- return false;
- }
-
- W3dCompressedAnimHeaderStruct aheader;
- aheader.Version = W3D_CURRENT_COMPRESSED_HANIM_VERSION;
- Set_W3D_Name(aheader.Name,Name);
- Set_W3D_Name(aheader.HierarchyName,BasePose->Get_Name());
- aheader.NumFrames = NumFrames;
- aheader.FrameRate = FrameRate;
- aheader.Flavor = CompressAnimationFlavor; // for future expansion
-
- switch (CompressAnimationFlavor) {
-
- case ANIM_FLAVOR_TIMECODED:
- ExportLog::printf("TimeCoded\n");
- break;
- case ANIM_FLAVOR_ADAPTIVE_DELTA:
- ExportLog::printf("Adaptive Delta\n");
- break;
- default:
- ExportLog::printf("UNKNOWN\n");
- break;
- }
-
- if (csave.Write(&aheader,sizeof(aheader)) != sizeof(aheader)) {
- return false;
- }
-
- if (!csave.End_Chunk()) {
- return false;
- }
- }
- else {
-
- ExportLog::printf("Non-Compressed.\n");
-
- // Classic Non-Compressed Style
- if (!csave.Begin_Chunk(W3D_CHUNK_ANIMATION_HEADER)) {
- return false;
- }
-
- W3dAnimHeaderStruct aheader;
- aheader.Version = W3D_CURRENT_HANIM_VERSION;
- Set_W3D_Name(aheader.Name,Name);
- Set_W3D_Name(aheader.HierarchyName,BasePose->Get_Name());
- aheader.NumFrames = NumFrames;
- aheader.FrameRate = FrameRate;
-
- if (csave.Write(&aheader,sizeof(aheader)) != sizeof(aheader)) {
- return false;
- }
-
- if (!csave.End_Chunk()) {
- return false;
- }
- }
-
-
- return true;
-}
-
-/***********************************************************************************************
- * MotionClass::save_channels -- save the motion channels *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/26/1997 GH : Created. *
- *=============================================================================================*/
-bool MotionClass::save_channels(ChunkSaveClass & csave)
-{
-
- int NumNodes = BasePose->Num_Nodes();
-
- ExportLog::printf("\nSaving Channel Data for %d Nodes\n", NumNodes);
-
- for (int nodeidx = 0; nodeidx < BasePose->Num_Nodes(); nodeidx++) {
-
- ExportLog::printf("\nnode: %d ", nodeidx);
-
- /*
- ** Just ignore this node if it didn't appear in the max scene.
- */
- if (NodeValidFlags[nodeidx]) {
-
- float identity[] = { 0.0f,0.0f,0.0f,1.0f };
-
- VectorChannelClass xchan (nodeidx, NumFrames, ANIM_CHANNEL_X, 1, identity);
- VectorChannelClass ychan (nodeidx, NumFrames, ANIM_CHANNEL_Y, 1, identity);
- VectorChannelClass zchan (nodeidx, NumFrames, ANIM_CHANNEL_Z, 1, identity);
- VectorChannelClass xrchan(nodeidx, NumFrames, ANIM_CHANNEL_XR, 1, identity);
- VectorChannelClass yrchan(nodeidx, NumFrames, ANIM_CHANNEL_YR, 1, identity);
- VectorChannelClass zrchan(nodeidx, NumFrames, ANIM_CHANNEL_ZR, 1, identity);
- VectorChannelClass qchan (nodeidx, NumFrames, ANIM_CHANNEL_Q, 4, identity);
-
- xchan.SetSaveOptions(CompressAnimation, CompressAnimationFlavor, CompressAnimationTranslationError, CompressAnimationRotationError, ReduceAnimation, ReduceAnimationPercent);
- ychan.SetSaveOptions(CompressAnimation, CompressAnimationFlavor, CompressAnimationTranslationError, CompressAnimationRotationError, ReduceAnimation, ReduceAnimationPercent);
- zchan.SetSaveOptions(CompressAnimation, CompressAnimationFlavor, CompressAnimationTranslationError, CompressAnimationRotationError, ReduceAnimation, ReduceAnimationPercent);
- xrchan.SetSaveOptions(CompressAnimation, CompressAnimationFlavor, CompressAnimationTranslationError, CompressAnimationRotationError, ReduceAnimation, ReduceAnimationPercent);
- yrchan.SetSaveOptions(CompressAnimation, CompressAnimationFlavor, CompressAnimationTranslationError, CompressAnimationRotationError, ReduceAnimation, ReduceAnimationPercent);
- zrchan.SetSaveOptions(CompressAnimation, CompressAnimationFlavor, CompressAnimationTranslationError, CompressAnimationRotationError, ReduceAnimation, ReduceAnimationPercent);
- qchan.SetSaveOptions(CompressAnimation, CompressAnimationFlavor, CompressAnimationTranslationError, CompressAnimationRotationError, ReduceAnimation, ReduceAnimationPercent);
-
- BitChannelClass vischan(nodeidx, NumFrames, BIT_CHANNEL_VIS, 1);
- vischan.Set_Bits(VisData[nodeidx]);
-
- BitChannelClass binmovechan(nodeidx, NumFrames, 0, 0);
- binmovechan.Set_Bits(BinMoveData[nodeidx]);
-
- for (int frameidx = 0; frameidx < NumFrames; frameidx++) {
-
- float vec[4];
- Matrix3 tm = get_motion_matrix(nodeidx,frameidx);
- Point3 eulers = get_eulers(nodeidx,frameidx);
-
-
- Point3 old_tran = tm.GetTrans();
- Quat old_rot(tm);
-
- Point3 tran;
- Point3 scale;
- Quat rot;
-
- DecomposeMatrix(tm,tran,rot,scale);
-
- /*
- ** fixup the quaternion - max's quaternions are different than mine(?)
- */
- rot[0] = -rot[0];
- rot[1] = -rot[1];
- rot[2] = -rot[2];
- rot[3] = rot[3];
-
- /*
- ** Build the x translation channel
- */
- vec[0] = tran.x;
- xchan.Set_Vector(frameidx,vec);
-
- /*
- ** Build the y translation channel
- */
- vec[0] = tran.y;
- ychan.Set_Vector(frameidx,vec);
-
- /*
- ** Build the z translation channel
- */
- vec[0] = tran.z;
- zchan.Set_Vector(frameidx,vec);
-
- /*
- ** Build the x rotation channel
- */
- vec[0] = eulers.x;
- xrchan.Set_Vector(frameidx,vec);
-
- /*
- ** Build the y rotation channel
- */
- vec[0] = eulers.y;
- yrchan.Set_Vector(frameidx,vec);
-
- /*
- ** Build the z rotation channel
- */
- vec[0] = eulers.z;
- zrchan.Set_Vector(frameidx,vec);
-
- /*
- ** Build the quaternion rotation channel
- */
- vec[0] = rot[0];
- vec[1] = rot[1];
- vec[2] = rot[2];
- vec[3] = rot[3];
-
- qchan.Set_Vector(frameidx,vec);
-
- /*
- ** build the visibility channel
- */
- vischan.Set_Bit(frameidx,get_visibility(nodeidx,frameidx));
- //
- // build binarymovement channel
- //
- binmovechan.Set_Bit(frameidx, get_binary_movement(nodeidx, frameidx));
- }
-
- // If objects arn't visible, then the channel data may as well be empty
-
- if (!vischan.Is_Empty()) {
-
- if (!xchan.Is_Empty()) xchan.ClearInvisibleData(&vischan);
- if (!ychan.Is_Empty()) ychan.ClearInvisibleData(&vischan);
- if (!zchan.Is_Empty()) zchan.ClearInvisibleData(&vischan);
- if (!qchan.Is_Empty()) qchan.ClearInvisibleData(&vischan);
-
- }
-
- if (!xchan.Is_Empty()) {
- ExportLog::printf("x");
- xchan.Save(csave, &binmovechan );
- }
- if (!ychan.Is_Empty()) {
- ExportLog::printf("y");
- ychan.Save(csave, &binmovechan );
- }
- if (!zchan.Is_Empty()) {
- ExportLog::printf("z");
- zchan.Save(csave, &binmovechan );
- }
-
-
- // (gth) not saving Euler angles any more since we don't use them
-// if (!xrchan.Is_Empty()) xrchan.Save(csave);
-// if (!yrchan.Is_Empty()) yrchan.Save(csave);
-// if (!zrchan.Is_Empty()) zrchan.Save(csave);
-
- if (!qchan.Is_Empty()) {
- ExportLog::printf("q");
- qchan.Save(csave, &binmovechan);
- }
-
- if (!vischan.Is_Empty()) {
- ExportLog::printf("v");
- vischan.Save(csave, CompressAnimation);
- }
- }
-
- ExportLog::updatebar(nodeidx ,NumNodes);
-
- }
-
- ExportLog::updatebar(1,1);
-
- ExportLog::printf("\n\nSave Channel Data Complete.\n");
-
- return true;
-}
-
-// EOF - motion.cpp
-
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/motion.h b/Generals/Code/Tools/WW3D/max2w3d/motion.h
deleted file mode 100644
index 1caade3ffec..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/motion.h
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/* $Header: /Commando/Code/Tools/max2w3d/motion.h 13 10/30/00 6:56p Greg_h $ */
-/***********************************************************************************************
- *** Confidential - Westwood Studios ***
- ***********************************************************************************************
- * *
- * Project Name : Commando Tools - W3D export *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/motion.h $*
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 10/30/00 5:25p $*
- * *
- * $Revision:: 13 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#ifndef MOTION_H
-#define MOTION_H
-
-
-#ifndef ALWAYS_H
-#include "always.h"
-#endif
-
-#include
-
-#ifndef HIERSAVE_H
-#include "hiersave.h"
-#endif
-
-#ifndef PROGRESS_H
-#include "PROGRESS.H"
-#endif
-
-#ifndef CHUNKIO_H
-#include "chunkio.h"
-#endif
-
-#ifndef VECTOR_H
-#include "Vector.H"
-#endif
-
-#ifndef LOGDLG_H
-#include "logdlg.h"
-#endif
-
-struct W3dExportOptionsStruct;
-
-
-class MotionClass
-{
-public:
-
- MotionClass (
- IScene * scene,
- INode * rootnode,
- HierarchySaveClass * basepose,
- W3dExportOptionsStruct & options,
- int framerate,
- Progress_Meter_Class * meter,
- HWND MaxHwnd,
- char * name,
- Matrix3 & offset = Matrix3(1) // matrix to bring current object space into
- // base object space (for damage animations)
- );
-
- MotionClass (
- IScene * scene,
- INodeListClass * rootlist,
- HierarchySaveClass * basepose,
- W3dExportOptionsStruct & options,
- int framerate,
- Progress_Meter_Class * meter,
- HWND MaxHwnd,
- char * name,
- Matrix3 & offset = Matrix3(1) // matrix to bring current object space into
- // base object space (for damage animations)
- );
-
- ~MotionClass(void);
-
- bool Save(ChunkSaveClass & csave);
-
-private:
-
- IScene * Scene;
- INode * RootNode;
- INodeListClass * RootList;
- HierarchySaveClass * BasePose;
- int StartFrame;
- int EndFrame;
- int NumFrames;
- int FrameRate;
-
- bool ReduceAnimation;
- int ReduceAnimationPercent;
-
- bool CompressAnimation;
- int CompressAnimationFlavor;
- float CompressAnimationTranslationError;
- float CompressAnimationRotationError;
-
- Progress_Meter_Class * Meter;
- char Name[W3D_NAME_LEN];
- Matrix3 Offset;
-
- // 2D array of matrices, one per node per frame
- Matrix3 * * MotionMatrix;
-
- // 2D array of euler angles, one per node per frame
- Point3 * * EulerDelta;
-
- // Visibility bits, one bit per node per frame
- BooleanVectorClass * VisData;
-
- // Movement bits, one bit per node per frame, to designate a movement as interpolated, or not
- BooleanVectorClass * BinMoveData;
-
- // flag for each node in the base pose, indicating
- // whether the node actually appeard in the max scene
- // being exported.
- BooleanVectorClass NodeValidFlags;
-
- void compute_frame_motion(int frame);
- void set_motion_matrix(int node,int frame,const Matrix3 & motion);
- Matrix3 get_motion_matrix(int node,int frame);
- void set_eulers(int node,int frame,float x,float y,float z);
- Point3 get_eulers(int node,int frame);
- void set_visibility(int node,int frame,bool visible);
- bool get_visibility(int node,int frame);
- void set_binary_movement(int node,int frame,bool visible);
- bool get_binary_movement(int node,int frame);
-
- bool save_header(ChunkSaveClass & csave);
- bool save_channels(ChunkSaveClass & csave);
-
- void init(void);
-
-};
-
-
-#endif /*MOTION_H*/
\ No newline at end of file
diff --git a/Generals/Code/Tools/WW3D/max2w3d/namedsel.cpp b/Generals/Code/Tools/WW3D/max2w3d/namedsel.cpp
deleted file mode 100644
index 42acab32b7b..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/namedsel.cpp
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/* $Header: /Commando/Code/Tools/max2w3d/namedsel.cpp 4 10/28/97 6:08p Greg_h $ */
-/***********************************************************************************************
- *** Confidential - Westwood Studios ***
- ***********************************************************************************************
- * *
- * Project Name : Commando Tools - WWSkin *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/namedsel.cpp $*
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 10/26/97 1:29p $*
- * *
- * $Revision:: 4 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#include "namedsel.h"
-
-
-NamedSelSetList::~NamedSelSetList()
-{
- for (int i=0; i= 0) Delete_Set(i);
-}
-
-void NamedSelSetList::Reset(void)
-{
- while (Sets.Count() > 0) {
- Delete_Set(0);
- }
-}
-
-void NamedSelSetList::Set_Size(int size)
-{
- for (int i=0; iSetSize(size,TRUE);
- }
-}
-
-NamedSelSetList& NamedSelSetList::operator=(NamedSelSetList& from)
-{
- for (int i=0; iBeginChunk(NAMED_SEL_SET_CHUNK);
-
- isave->BeginChunk(NAMED_SEL_NAME_CHUNK);
- isave->WriteWString(*Names[i]);
- isave->EndChunk();
-
- isave->BeginChunk(NAMED_SEL_BITS_CHUNK);
- Sets[i]->Save(isave);
- isave->EndChunk();
-
- isave->EndChunk();
-
- }
- return IO_OK;
-}
-
-
-IOResult NamedSelSetList::Load(ILoad *iload)
-{
- IOResult res;
-
- while (IO_OK==(res=iload->OpenChunk())) {
-
- switch (iload->CurChunkID()) {
-
- case NAMED_SEL_SET_CHUNK:
- res = Load_Set(iload);
- break;
-
- default:
- assert(0);
- break;
- }
-
- iload->CloseChunk();
- if (res!=IO_OK) return res;
- }
- return IO_OK;
-}
-
-IOResult NamedSelSetList::Load_Set(ILoad * iload)
-{
- IOResult res;
- BitArray set;
- TCHAR * name;
-
- BOOL gotset = FALSE;
- BOOL gotname = FALSE;
-
- res = iload->OpenChunk();
-
- while (IO_OK==(res=iload->OpenChunk())) {
-
- switch (iload->CurChunkID()) {
-
- case NAMED_SEL_BITS_CHUNK:
- {
- res = set.Load(iload);
- gotset = TRUE;
- break;
- }
-
- case NAMED_SEL_NAME_CHUNK:
- {
- res = iload->ReadWStringChunk(&name);
- gotname = TRUE;
- break;
- }
- }
- iload->CloseChunk();
- if (res != IO_OK) return res;
- }
-
- assert(gotset && gotname);
- Append_Set(set,TSTR(name));
-
- return IO_OK;
-}
\ No newline at end of file
diff --git a/Generals/Code/Tools/WW3D/max2w3d/namedsel.h b/Generals/Code/Tools/WW3D/max2w3d/namedsel.h
deleted file mode 100644
index bc03d3b653a..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/namedsel.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/* $Header: /Commando/Code/Tools/max2w3d/namedsel.h 4 10/28/97 6:08p Greg_h $ */
-/***********************************************************************************************
- *** Confidential - Westwood Studios ***
- ***********************************************************************************************
- * *
- * Project Name : Commando Tools - WWSkin *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/namedsel.h $*
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 10/21/97 2:05p $*
- * *
- * $Revision:: 4 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#ifndef NAMEDSEL_H
-#define NAMEDSEL_H
-
-
-#include "max.h"
-
-/*
-** This is a class for containing bit arrays for
-** the named selection sets. I stole it from
-** the Edit Mesh modifier code...
-** It is basically a dynamically sized array
-** of bitarrays.
-*/
-class NamedSelSetList
-{
-public:
- Tab Sets;
- Tab Names;
-
- ~NamedSelSetList();
-
- BitArray & operator[](int i) { return *Sets[i]; }
- int Count() { return Sets.Count(); }
-
- int Find_Set(TSTR & setname);
- void Delete_Set(int i);
- void Delete_Set(TSTR & setname);
- void Reset(void);
- void Append_Set(BitArray & nset,TSTR & setname);
-
- IOResult Load(ILoad * iload);
- IOResult Save(ISave * isave);
- IOResult Load_Set(ILoad * iload);
-
- void Set_Size(int size);
- NamedSelSetList & operator=(NamedSelSetList & from);
-
- enum {
- NAMED_SEL_SET_CHUNK = 0x0021,
- NAMED_SEL_BITS_CHUNK = 0x0022,
- NAMED_SEL_NAME_CHUNK = 0x0023
- };
-};
-
-
-#endif /*NAMEDSEL_H*/
diff --git a/Generals/Code/Tools/WW3D/max2w3d/nullsave.cpp b/Generals/Code/Tools/WW3D/max2w3d/nullsave.cpp
deleted file mode 100644
index 008d3656740..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/nullsave.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Max2W3d *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/nullsave.cpp $*
- * *
- * Author:: Greg Hjelstrom *
- * *
- * $Modtime:: 8/05/99 3:14p $*
- * *
- * $Revision:: 2 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#include "nullsave.h"
-
-
-NullSaveClass::NullSaveClass
-(
- char * mesh_name,
- char * container_name,
- Progress_Meter_Class & meter
-)
-{
- //////////////////////////////////////////////////////////////////////
- // Set up the NullObject description
- //////////////////////////////////////////////////////////////////////
- memset(&NullData,0,sizeof(NullData));
-
- NullData.Version = W3D_NULL_OBJECT_CURRENT_VERSION;
- if ((container_name != NULL) && (strlen(container_name) > 0)) {
- strcpy(NullData.Name,container_name);
- strcat(NullData.Name,".");
- }
- strcat(NullData.Name,mesh_name);
-}
-
-
-
-int NullSaveClass::Write_To_File(ChunkSaveClass & csave)
-{
- csave.Begin_Chunk(W3D_CHUNK_NULL_OBJECT);
- csave.Write(&NullData,sizeof(NullData));
- csave.End_Chunk();
- return 0;
-}
-
-
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/nullsave.h b/Generals/Code/Tools/WW3D/max2w3d/nullsave.h
deleted file mode 100644
index a7ce19de370..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/nullsave.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Max2W3d *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/nullsave.h $*
- * *
- * Author:: Greg Hjelstrom *
- * *
- * $Modtime:: 8/05/99 3:05p $*
- * *
- * $Revision:: 2 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#if defined(_MSC_VER)
-#pragma once
-#endif
-
-#ifndef NULLSAVE_H
-#define NULLSAVE_H
-
-
-#include
-#include "w3d_file.h"
-#include "chunkio.h"
-#include "PROGRESS.H"
-
-
-/*******************************************************************************************
-**
-** NullSaveClass - Create a Null object.
-**
-*******************************************************************************************/
-class NullSaveClass
-{
-public:
-
- enum {
- EX_UNKNOWN = 0, // exception error codes
- EX_CANCEL = 1
- };
-
- NullSaveClass( char * mesh_name,
- char * container_name,
- Progress_Meter_Class & meter);
-
- int Write_To_File(ChunkSaveClass & csave);
-
-private:
-
- W3dNullObjectStruct NullData;
-
-};
-
-
-
-
-#endif //NULLSAVE_H
diff --git a/Generals/Code/Tools/WW3D/max2w3d/presetexportoptionsdialog.cpp b/Generals/Code/Tools/WW3D/max2w3d/presetexportoptionsdialog.cpp
deleted file mode 100644
index c4f31e2fd10..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/presetexportoptionsdialog.cpp
+++ /dev/null
@@ -1,914 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Max2W3d *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/presetexportoptionsdialog.cpp $*
- * *
- * Original Author:: Patrick Smith *
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 11/10/00 2:26p $*
- * *
- * $Revision:: 5 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#include "presetexportoptionsdialog.h"
-#include "dllmain.h"
-#include "resource.h"
-#include "w3dexp.h"
-#include "animationcompressionsettings.h"
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-// Constants
-////////////////////////////////////////////////////////////////////////////////////////
-
-static const char *BROWSE_FILTER = "W3D Files (*.W3D)\0*.W3D\0WHT Files (*.WHT)\0*.WHT\0\0";
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-//
-// PresetExportOptionsDialogClass
-//
-////////////////////////////////////////////////////////////////////////////////////////
-PresetExportOptionsDialogClass::PresetExportOptionsDialogClass (Interface *maxinterface, HWND parent_wnd) :
- MaxInterface (maxinterface),
- Options (NULL),
- Wnd (NULL),
- ParentWnd (parent_wnd),
- CurrentPane (-1)
-{
- ::memset (PaneWnds, 0, sizeof (PaneWnds));
- return ;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-//
-// ~PresetExportOptionsDialogClass
-//
-////////////////////////////////////////////////////////////////////////////////////////
-PresetExportOptionsDialogClass::~PresetExportOptionsDialogClass (void)
-{
- return ;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-//
-// Do_Modal
-//
-////////////////////////////////////////////////////////////////////////////////////////
-int
-PresetExportOptionsDialogClass::Do_Modal (void)
-{
- int retval = ::DialogBoxParam (AppInstance, MAKEINTRESOURCE (IDD_W3D_PRESET_EXPORT_OPTIONS),
- ParentWnd, Real_Message_Proc, (LPARAM)this);
- return retval;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-//
-// Real_Message_Proc
-//
-////////////////////////////////////////////////////////////////////////////////////////
-BOOL CALLBACK
-PresetExportOptionsDialogClass::Real_Message_Proc
-(
- HWND wnd,
- UINT message,
- WPARAM wparam,
- LPARAM lparam
-)
-{
- PresetExportOptionsDialogClass *dialog_obj = NULL;
-
- //
- // Setup the framework we need so that the instance
- // can process the messages instead of this static callback.
- //
- if (message == WM_INITDIALOG) {
- dialog_obj = (PresetExportOptionsDialogClass *)lparam;
- dialog_obj->Wnd = wnd;
- ::SetProp (wnd, "DIALOG_OBJ", (HANDLE)dialog_obj);
- } else {
- dialog_obj = (PresetExportOptionsDialogClass *)::GetProp (wnd, "DIALOG_OBJ");
- }
-
- //
- // Allow the instance to handle the call
- //
- BOOL retval = FALSE;
- if (dialog_obj != NULL) {
- retval = dialog_obj->Message_Proc (message, wparam, lparam);
- }
-
- //
- // Cleanup the framework
- //
- if (message == WM_DESTROY) {
- ::RemoveProp (wnd, "DIALOG_OBJ");
- }
-
- return retval;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-//
-// Settings_Pane_Message_Proc
-//
-////////////////////////////////////////////////////////////////////////////////////////
-BOOL CALLBACK
-PresetExportOptionsDialogClass::Settings_Pane_Message_Proc
-(
- HWND wnd,
- UINT message,
- WPARAM wparam,
- LPARAM lparam
-)
-{
- PresetExportOptionsDialogClass *dialog_obj = NULL;
-
- //
- // Setup the framework we need so that the instance
- // can process the messages instead of this static callback.
- //
- if (message == WM_INITDIALOG) {
- dialog_obj = (PresetExportOptionsDialogClass *)lparam;
- ::SetProp (wnd, "DIALOG_OBJ", (HANDLE)dialog_obj);
- } else {
- dialog_obj = (PresetExportOptionsDialogClass *)::GetProp (wnd, "DIALOG_OBJ");
- }
-
- //
- // Allow the instance to handle the call
- //
- BOOL retval = FALSE;
- if (dialog_obj != NULL) {
- retval = dialog_obj->Pane_Message_Proc (message, wparam, lparam);
- }
-
- //
- // Cleanup the framework
- //
- if (message == WM_DESTROY) {
- ::RemoveProp (wnd, "DIALOG_OBJ");
- }
-
- return retval;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-//
-// Pane_Message_Proc
-//
-////////////////////////////////////////////////////////////////////////////////////////
-BOOL
-PresetExportOptionsDialogClass::Pane_Message_Proc
-(
- UINT message,
- WPARAM wparam,
- LPARAM lparam
-)
-{
- BOOL retval = FALSE;
-
- switch (message)
- {
- case WM_CUSTEDIT_ENTER:
-
- switch (wparam)
- {
- case IDC_RANGE_LOW_EDIT:
- {
- //
- // Update the start frame
- //
- ICustEdit *edit_ctrl = GetICustEdit ((HWND)lparam);
- if (edit_ctrl != NULL) {
- Options->StartFrame = edit_ctrl->GetInt ();
-
- //
- // Bounds check the value
- //
- if (Options->StartFrame > Options->EndFrame) {
- Options->StartFrame = Options->EndFrame;
- }
-
- Update_Controls ();
- }
- }
- break;
-
- case IDC_RANGE_HIGH_EDIT:
- {
- //
- // Update the end frame
- //
- ICustEdit *edit_ctrl = GetICustEdit ((HWND)lparam);
- if (edit_ctrl != NULL) {
- Options->EndFrame = edit_ctrl->GetInt ();
-
- //
- // Bounds check the value
- //
- if (Options->EndFrame < Options->StartFrame) {
- Options->EndFrame = Options->StartFrame;
- }
-
- Update_Controls ();
- }
- }
- break;
- }
-
- break;
-
- case CC_SPINNER_BUTTONUP:
- {
- ISpinnerControl *spin_ctrl = (ISpinnerControl *)lparam;
- if (spin_ctrl != NULL) {
-
- switch (LOWORD (wparam))
- {
- //
- // Update the start frame
- //
- case IDC_RANGE_LOW_SPIN:
- Options->StartFrame = spin_ctrl->GetIVal ();
-
- //
- // Bounds check the value
- //
- if (Options->StartFrame > Options->EndFrame) {
- Options->StartFrame = Options->EndFrame;
- }
- Update_Controls ();
- break;
-
- //
- // Update the end frame
- //
- case IDC_RANGE_HIGH_SPIN:
- Options->EndFrame = spin_ctrl->GetIVal ();
-
- //
- // Bounds check the value
- //
- if (Options->EndFrame < Options->StartFrame) {
- Options->EndFrame = Options->StartFrame;
- }
-
- Update_Controls ();
- break;
- }
- }
- }
- break;
-
- case WM_COMMAND:
- {
- HWND control_wnd = reinterpret_cast (lparam);
- bool update_controls = true;
-
- switch (LOWORD (wparam))
- {
- case IDC_EXPORT_MESH_SMOOTH_CHECK:
- Options->SmoothBetweenMeshes = (SendMessage (control_wnd, BM_GETCHECK, 0, 0L) == 1);
- break;
-
- case IDC_EXPORT_MESH_AABTREES:
- Options->DisableExportAABTrees = (SendMessage (control_wnd, BM_GETCHECK, 0, 0L) != 1);
- break;
-
-#if 0
- case IDC_EXPORT_MESH_OPTIMIZE:
- Options->EnableOptimizeMeshData = (SendMessage (control_wnd, BM_GETCHECK, 0, 0L) == 1);
- break;
-#endif
-
- case IDC_USE_SKELETON_CHECK:
- Options->LoadHierarchy = (SendMessage (control_wnd, BM_GETCHECK, 0, 0L) == 1);
- break;
-
- case IDC_COMPRESS_ANIMATION_CHECK:
- Options->CompressAnimation = (SendMessage (control_wnd, BM_GETCHECK, 0, 0L) == 1);
- break;
-
- case IDC_WHT_BROWSE_BUTTON:
- {
- OPENFILENAME ofn = { sizeof (OPENFILENAME), 0 };
- ofn.lpstrFilter = BROWSE_FILTER;
- ofn.nMaxFile = _MAX_PATH;
- ofn.nMaxFileTitle = _MAX_FNAME + _MAX_EXT;
- ofn.Flags = OFN_HIDEREADONLY | OFN_CREATEPROMPT;
- ofn.lpstrDefExt = "wht";
- ofn.hwndOwner = Wnd;
- ofn.lpstrFile = Options->HierarchyFilename;
-
- if (::GetOpenFileName (&ofn)) {
-
- //
- // Get the relative path between the current export path
- // and the full file path to the hierarchy file:
- //
- Create_Relative_Path (Options->RelativeHierarchyFilename,
- W3dExportClass::CurrentExportPath,
- ofn.lpstrFile);
- }
- }
- break;
-
- case IDC_COMPRESSION_SETTINGS:
- {
- //
- // Display the compression options dialog
- //
- AnimationCompressionSettingsDialogClass dialog (MaxInterface, Wnd);
- dialog.Set_Options (Options);
- dialog.Do_Modal ();
- }
- break;
-
- case IDC_EXPORT_MESH_MAT_TO_TEXTURE:
- Options->EnableMaterialColorToTextureConversion = (SendMessage (control_wnd, BM_GETCHECK, 0, 0L) == 1);
- break;
-
- default:
- update_controls = false;
- break;
- }
-
- if (update_controls) {
- Update_Controls ();
- }
- }
- break;
- }
-
- return retval;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-//
-// Message_Proc
-//
-////////////////////////////////////////////////////////////////////////////////////////
-BOOL
-PresetExportOptionsDialogClass::Message_Proc
-(
- UINT message,
- WPARAM wparam,
- LPARAM lparam
-)
-{
- BOOL retval = FALSE;
-
- switch (message)
- {
- case WM_INITDIALOG:
- {
- //
- // Center the dialog
- //
- RECT parent_rect = { 0 };
- RECT rect = { 0 };
- ::GetWindowRect (ParentWnd, &parent_rect);
- ::GetWindowRect (Wnd, &rect);
- int width = parent_rect.right - parent_rect.left;
- int height = parent_rect.bottom - parent_rect.top;
- ::SetWindowPos ( Wnd, NULL,
- parent_rect.left + (width / 2) - ((rect.right - rect.left) / 2),
- parent_rect.top + (height / 2) - ((rect.bottom - rect.top) / 2),
- 0, 0, SWP_NOZORDER | SWP_NOSIZE);
-
- //
- // Initialize the controls
- //
- Create_Settings_Panes ();
- Initialize_Controls ();
- Update_Controls ();
- Determine_Preset_Type ();
- retval = TRUE;
- }
- break;
-
- case WM_COMMAND:
- retval = On_Command (wparam, lparam);
- break;
- }
-
- return retval;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-//
-// On_Command
-//
-////////////////////////////////////////////////////////////////////////////////////////
-BOOL
-PresetExportOptionsDialogClass::On_Command (WPARAM wparam, LPARAM lparam)
-{
- BOOL retval = FALSE;
-
- switch (LOWORD (wparam))
- {
- case IDC_HLOD_RADIO:
- Show_Settings_Pane (PANE_HLOD);
- break;
-
- case IDC_ANIM_HLOD_RADIO:
- Show_Settings_Pane (PANE_ANIM_HLOD);
- break;
-
- case IDC_ANIM_RADIO:
- Show_Settings_Pane (PANE_ANIM);
- break;
-
- case IDC_TERRAIN_RADIO:
- Show_Settings_Pane (PANE_TERRAIN);
- break;
-
- case IDC_SKELETON_RADIO:
- Show_Settings_Pane (PANE_SKELETON);
- break;
-
- case IDC_MESH_RADIO:
- Show_Settings_Pane (PANE_MESH);
- break;
-
- case IDCANCEL:
- ::memcpy (Options, &OrigOptions, sizeof (OrigOptions));
- EndDialog (Wnd, IDCANCEL);
- break;
-
- case IDOK:
- Save_Settings ();
- EndDialog (Wnd, IDOK);
- break;
- }
-
- return retval;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-//
-// Show_Settings_Pane
-//
-////////////////////////////////////////////////////////////////////////////////////////
-void
-PresetExportOptionsDialogClass::Show_Settings_Pane (int pane_id)
-{
- if (pane_id != CurrentPane) {
-
- //
- // Show the new pane and hide the old pane
- //
- ::ShowWindow (PaneWnds[pane_id], SW_SHOW);
- if (CurrentPane >= 0) {
- ::ShowWindow (PaneWnds[CurrentPane], SW_HIDE);
- }
- CurrentPane = pane_id;
- }
-
- return ;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-//
-// Create_Settings_Panes
-//
-////////////////////////////////////////////////////////////////////////////////////////
-void
-PresetExportOptionsDialogClass::Create_Settings_Panes (void)
-{
- PaneWnds[PANE_HLOD] = ::CreateDialogParam (AppInstance, MAKEINTRESOURCE (IDD_EXPORT_PANE_HLOD),
- Wnd, Settings_Pane_Message_Proc, (LPARAM)this);
-
- PaneWnds[PANE_ANIM_HLOD] = ::CreateDialogParam (AppInstance, MAKEINTRESOURCE (IDD_EXPORT_PANE_ANIMATED_HLOD),
- Wnd, Settings_Pane_Message_Proc, (LPARAM)this);
-
- PaneWnds[PANE_ANIM] = ::CreateDialogParam (AppInstance, MAKEINTRESOURCE (IDD_EXPORT_PANE_ANIMATION),
- Wnd, Settings_Pane_Message_Proc, (LPARAM)this);
-
- PaneWnds[PANE_TERRAIN] = ::CreateDialogParam (AppInstance, MAKEINTRESOURCE (IDD_EXPORT_PANE_TERRAIN),
- Wnd, Settings_Pane_Message_Proc, (LPARAM)this);
-
- PaneWnds[PANE_SKELETON] = ::CreateDialogParam (AppInstance, MAKEINTRESOURCE (IDD_EXPORT_PANE_SKELETON),
- Wnd, Settings_Pane_Message_Proc, (LPARAM)this);
-
- PaneWnds[PANE_MESH] = ::CreateDialogParam (AppInstance, MAKEINTRESOURCE (IDD_EXPORT_PANE_MESH),
- Wnd, Settings_Pane_Message_Proc, (LPARAM)this);
-
-
- //
- // Get the position and size of the group box the settings panes will be
- // displayed inside
- //
- RECT group_rect = { 0 };
- ::GetWindowRect (::GetDlgItem (Wnd, IDC_GROUP_BOX), &group_rect);
- ::ScreenToClient (Wnd, (LPPOINT)&group_rect);
- ::ScreenToClient (Wnd, ((LPPOINT)&group_rect) + 1);
- int width = group_rect.right - group_rect.left;
- int height = group_rect.bottom - group_rect.top;
-
- //
- // Loop over all the panes and make sure they are in the proper location
- //
- for (int index = 0; index < PANE_MAX; index ++) {
- HWND pane_wnd = PaneWnds[index];
-
- //
- // Get the size of this pane
- //
- RECT rect = { 0 };
- ::GetWindowRect (pane_wnd, &rect);
-
- //
- // Center the pane inside of the group box
- //
- ::SetWindowPos ( pane_wnd, ::GetDlgItem (Wnd, IDC_GROUP_BOX),
- group_rect.left + (width / 2) - ((rect.right - rect.left) / 2),
- group_rect.top + (height / 2) - ((rect.bottom - rect.top) / 2),
- 0, 0, SWP_NOSIZE);
- }
-
- return ;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-//
-// Destroy_Settings_Panes
-//
-////////////////////////////////////////////////////////////////////////////////////////
-void
-PresetExportOptionsDialogClass::Destroy_Settings_Panes (void)
-{
- //
- // Loop over all the panes and destroy them
- //
- for (int index = 0; index < PANE_MAX; index ++) {
- ::DestroyWindow (PaneWnds[index]);
- PaneWnds[index] = NULL;
- }
-
- return ;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-//
-// Determine_Preset_Type
-//
-////////////////////////////////////////////////////////////////////////////////////////
-void
-PresetExportOptionsDialogClass::Determine_Preset_Type (void)
-{
- //
- // Examine the current options and try to determine which
- // preset best matches this configuration.
- //
-
- if (Options->EnableTerrainMode) {
-
- //
- // Select the terrain UI
- //
- Show_Settings_Pane (PANE_TERRAIN);
- SendDlgItemMessage (Wnd, IDC_TERRAIN_RADIO, BM_SETCHECK, (WPARAM)TRUE, 0L);
-
- } else if (Options->ExportGeometry == false) {
-
- if (Options->ExportAnimation == false) {
-
- //
- // Select the skeleton UI
- //
- Show_Settings_Pane (PANE_SKELETON);
- SendDlgItemMessage (Wnd, IDC_SKELETON_RADIO, BM_SETCHECK, (WPARAM)TRUE, 0L);
- } else {
-
- //
- // Select the anim UI
- //
- Show_Settings_Pane (PANE_ANIM);
- SendDlgItemMessage (Wnd, IDC_ANIM_RADIO, BM_SETCHECK, (WPARAM)TRUE, 0L);
- }
-
- } else if (Options->ExportHierarchy == false && Options->LoadHierarchy == false) {
-
- //
- // Select the mesh UI
- //
- Show_Settings_Pane (PANE_MESH);
- SendDlgItemMessage (Wnd, IDC_MESH_RADIO, BM_SETCHECK, (WPARAM)TRUE, 0L);
-
- } else if (Options->ExportAnimation == false) {
-
- //
- // Select the HLOD UI
- //
- Show_Settings_Pane (PANE_HLOD);
- SendDlgItemMessage (Wnd, IDC_HLOD_RADIO, BM_SETCHECK, (WPARAM)TRUE, 0L);
-
- } else {
-
- //
- // Select the HLOD anim UI
- //
- Show_Settings_Pane (PANE_ANIM_HLOD);
- SendDlgItemMessage (Wnd, IDC_ANIM_HLOD_RADIO, BM_SETCHECK, (WPARAM)TRUE, 0L);
- }
-
- return ;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-//
-// Initialize_Controls
-//
-////////////////////////////////////////////////////////////////////////////////////////
-void
-PresetExportOptionsDialogClass::Initialize_Controls (void)
-{
- //
- // Check the review log file button if necessary
- //
- CheckDlgButton (Wnd, IDC_REVIEW_LOG, Options->ReviewLog);
-
- //
- // Precompute some of the animation data
- //
- int ticksperframe = ::GetTicksPerFrame();
- int startframe = MaxInterface->GetAnimRange ().Start () / ticksperframe;
- int endframe = MaxInterface->GetAnimRange ().End () / ticksperframe;
-
- //
- // Clamp the real options the same way the displayed values are clamped
- //
- if (startframe > Options->StartFrame) {
- Options->StartFrame = startframe;
- }
- if (endframe < Options->EndFrame) {
- Options->EndFrame = endframe;
- }
-
- //
- // Loop over all the panes and update any of the controls therein
- //
- for (int index = 0; index < PANE_MAX; index ++) {
- HWND pane_wnd = PaneWnds[index];
-
- //
- // Are there any animation controls on this pane to initialize?
- //
- if (::GetDlgItem (pane_wnd, IDC_RANGE_LOW_SPIN) != NULL) {
-
- ISpinnerControl *low_spin = NULL;
- ISpinnerControl *high_spin = NULL;
-
- low_spin = ::SetupIntSpinner (pane_wnd, IDC_RANGE_LOW_SPIN, IDC_RANGE_LOW_EDIT,
- startframe, endframe, 0);
-
- high_spin = ::SetupIntSpinner (pane_wnd, IDC_RANGE_HIGH_SPIN, IDC_RANGE_HIGH_EDIT,
- startframe, endframe, 0);
-
- ::SetProp (::GetDlgItem (pane_wnd, IDC_RANGE_LOW_SPIN), "ISpinnerControl", (HANDLE)low_spin);
- ::SetProp (::GetDlgItem (pane_wnd, IDC_RANGE_HIGH_SPIN), "ISpinnerControl", (HANDLE)high_spin);
- }
- }
-
- return ;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-//
-// Update_Controls
-//
-////////////////////////////////////////////////////////////////////////////////////////
-void
-PresetExportOptionsDialogClass::Update_Controls (void)
-{
- //
- // Loop over all the panes and update any of the controls therein
- //
- for (int index = 0; index < PANE_MAX; index ++) {
- HWND pane_wnd = PaneWnds[index];
-
- //
- // Handle the check boxes
- //
- CheckDlgButton (pane_wnd, IDC_EXPORT_MESH_SMOOTH_CHECK, Options->SmoothBetweenMeshes);
- CheckDlgButton (pane_wnd, IDC_EXPORT_MESH_AABTREES, !Options->DisableExportAABTrees);
-#if ENABLE_MESH_OPTIMIZING
- CheckDlgButton (pane_wnd, IDC_EXPORT_MESH_OPTIMIZE, Options->EnableOptimizeMeshData);
-#endif
- CheckDlgButton (pane_wnd, IDC_USE_SKELETON_CHECK, Options->LoadHierarchy);
- CheckDlgButton (pane_wnd, IDC_COMPRESS_ANIMATION_CHECK, Options->CompressAnimation);
- CheckDlgButton (pane_wnd, IDC_EXPORT_MESH_MAT_TO_TEXTURE, Options->EnableMaterialColorToTextureConversion);
-
- //
- // Enable/disable the compression settings button
- //
- HWND compress_settings_btn = ::GetDlgItem (pane_wnd, IDC_COMPRESSION_SETTINGS);
- if (compress_settings_btn != NULL) {
- ::EnableWindow (compress_settings_btn, Options->CompressAnimation);
- }
-
- //
- // Setup the skeleton browse button
- //
- HWND skeleten_browse_btn = ::GetDlgItem (pane_wnd, IDC_WHT_BROWSE_BUTTON);
- if (skeleten_browse_btn != NULL) {
-
- //
- // Honor the relative path if it is present
- //
- if (Options->RelativeHierarchyFilename[0] != 0) {
- SetWindowText (skeleten_browse_btn, Options->RelativeHierarchyFilename);
- ::Create_Full_Path (Options->HierarchyFilename,
- W3dExportClass::CurrentExportPath,
- Options->RelativeHierarchyFilename);
-
- } else if (Options->HierarchyFilename[0] != 0) {
- SetWindowText (skeleten_browse_btn, Options->HierarchyFilename);
- ::Create_Relative_Path (Options->RelativeHierarchyFilename,
- W3dExportClass::CurrentExportPath,
- Options->HierarchyFilename);
- }
-
- //
- // Set the enable state of the window
- //
- ::EnableWindow (skeleten_browse_btn, Options->LoadHierarchy);
- }
-
- //
- // Are there any animation controls on this pane to update?
- //
- HWND low_spin_wnd = ::GetDlgItem (pane_wnd, IDC_RANGE_LOW_SPIN);
- HWND high_spin_wnd = ::GetDlgItem (pane_wnd, IDC_RANGE_HIGH_SPIN);
- if (low_spin_wnd != NULL && high_spin_wnd != NULL) {
-
- //
- // Peek at the spinner control objects
- //
- ISpinnerControl *low_spin = NULL;
- ISpinnerControl *high_spin = NULL;
- low_spin = (ISpinnerControl *)::GetProp (low_spin_wnd, "ISpinnerControl");
- high_spin = (ISpinnerControl *)::GetProp (high_spin_wnd, "ISpinnerControl");
-
- //
- // Update the spin controls
- //
- low_spin->SetValue (Options->StartFrame, FALSE);
- high_spin->SetValue (Options->EndFrame, FALSE);
- }
- }
-
- return ;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-//
-// Save_Settings
-//
-////////////////////////////////////////////////////////////////////////////////////////
-void
-PresetExportOptionsDialogClass::Save_Settings (void)
-{
- //
- // Force settings that certain preset types need
- //
- if (::IsDlgButtonChecked (Wnd, IDC_TERRAIN_RADIO)) {
-
- //
- // Force some settings for the "Renegade Terrain" preset
- //
- Options->ExportHierarchy = true;
- Options->LoadHierarchy = false;
- Options->ExportAnimation = false;
- Options->ExportGeometry = true;
- Options->CompressAnimation = false;
- Options->ReduceAnimation = false;
- Options->EnableTerrainMode = true;
- Options->DisableExportAABTrees = false;
- Options->EnableMaterialColorToTextureConversion = false;
- } else if (::IsDlgButtonChecked (Wnd, IDC_SKELETON_RADIO)) {
-
- //
- // Force some settings for the "Skeleton" preset
- //
- Options->ExportHierarchy = true;
- Options->LoadHierarchy = false;
- Options->ExportAnimation = false;
- Options->ExportGeometry = false;
- Options->CompressAnimation = false;
- Options->ReduceAnimation = false;
- Options->EnableTerrainMode = false;
- Options->EnableOptimizeMeshData = false;
- Options->DisableExportAABTrees = true;
- Options->SmoothBetweenMeshes = false;
- Options->EnableTerrainMode = false;
- Options->EnableMaterialColorToTextureConversion = false;
- } else if (::IsDlgButtonChecked (Wnd, IDC_MESH_RADIO)) {
-
- //
- // Force some settings for the "Simple Mesh" preset
- //
- Options->ExportHierarchy = false;
- Options->LoadHierarchy = false;
- Options->ExportAnimation = false;
- Options->ExportGeometry = true;
- Options->CompressAnimation = false;
- Options->ReduceAnimation = false;
- Options->EnableTerrainMode = false;
- Options->EnableOptimizeMeshData = false;
- Options->SmoothBetweenMeshes = false;
- Options->EnableTerrainMode = false;
- } else if (::IsDlgButtonChecked (Wnd, IDC_HLOD_RADIO)) {
-
- //
- // Force some settings for the "Hierarchical Model" preset
- //
- Options->ExportHierarchy = !Options->LoadHierarchy;
- Options->ExportAnimation = false;
- Options->ExportGeometry = true;
- Options->CompressAnimation = false;
- Options->ReduceAnimation = false;
- Options->EnableTerrainMode = false;
- } else if (::IsDlgButtonChecked (Wnd, IDC_ANIM_HLOD_RADIO)) {
-
- //
- // Force some settings for the "Hierarchical Animated Model" preset
- //
- Options->ExportHierarchy = !Options->LoadHierarchy;
- Options->ExportAnimation = true;
- Options->ExportGeometry = true;
- Options->EnableTerrainMode = false;
- } else if (::IsDlgButtonChecked (Wnd, IDC_ANIM_RADIO)) {
-
- //
- // Force some settings for the "Pure Animation" preset
- //
- Options->ExportHierarchy = !Options->LoadHierarchy;
- Options->ExportAnimation = true;
- Options->ExportGeometry = false;
- Options->EnableTerrainMode = false;
- Options->EnableOptimizeMeshData = false;
- Options->DisableExportAABTrees = true;
- Options->SmoothBetweenMeshes = false;
- Options->EnableMaterialColorToTextureConversion = false;
- }
-
- //
- // Record the "Review Log File" option
- //
- Options->ReviewLog = (::IsDlgButtonChecked (Wnd, IDC_REVIEW_LOG) == 1);
-
- //
- // Check to see if anything has changed
- //
- if (::memcmp (Options, &OrigOptions, sizeof (OrigOptions)) != 0) {
- SetSaveRequiredFlag (true);
- }
-
- return ;
-}
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/presetexportoptionsdialog.h b/Generals/Code/Tools/WW3D/max2w3d/presetexportoptionsdialog.h
deleted file mode 100644
index 66b8c529120..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/presetexportoptionsdialog.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Max2W3d *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/presetexportoptionsdialog.h $*
- * *
- * Original Author:: Patrick Smith *
- * *
- * $Author:: Patrick $*
- * *
- * $Modtime:: 10/30/00 2:45p $*
- * *
- * $Revision:: 2 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#ifndef __PRESET_EXPORT_OPTIONS_DIALOG_H
-#define __PRESET_EXPORT_OPTIONS_DIALOG_H
-
-#include
-#include
-#include "w3dutil.h"
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-//
-// PresetExportOptionsDialogClass
-//
-////////////////////////////////////////////////////////////////////////////////////////
-class PresetExportOptionsDialogClass
-{
-public:
-
- //////////////////////////////////////////////////////////////////
- // Public constructors/destructors
- //////////////////////////////////////////////////////////////////
- PresetExportOptionsDialogClass (Interface *maxinterface, HWND parent_wnd = NULL);
- ~PresetExportOptionsDialogClass (void);
-
-
- //////////////////////////////////////////////////////////////////
- // Public methods
- //////////////////////////////////////////////////////////////////
-
- void Set_Options (W3dExportOptionsStruct *options) { Options = options; ::memcpy (&OrigOptions, Options, sizeof (OrigOptions)); }
- int Do_Modal (void);
-
-private:
-
- //////////////////////////////////////////////////////////////////
- // Private data types
- //////////////////////////////////////////////////////////////////
-
- enum
- {
- PANE_HLOD = 0,
- PANE_ANIM_HLOD,
- PANE_ANIM,
- PANE_TERRAIN,
- PANE_SKELETON,
- PANE_MESH,
- PANE_MAX
- };
-
-
- //////////////////////////////////////////////////////////////////
- // Static methods
- //////////////////////////////////////////////////////////////////
- static BOOL CALLBACK Real_Message_Proc (HWND wnd, UINT message, WPARAM wparam, LPARAM lparam);
- static BOOL CALLBACK Settings_Pane_Message_Proc (HWND wnd, UINT message, WPARAM wparam, LPARAM lparam);
-
- //////////////////////////////////////////////////////////////////
- // Private methods
- //////////////////////////////////////////////////////////////////
- BOOL Message_Proc (UINT message, WPARAM wparam, LPARAM lparam);
- BOOL Pane_Message_Proc (UINT message, WPARAM wparam, LPARAM lparam);
- BOOL Settings_Message_Proc (UINT message, WPARAM wparam, LPARAM lparam);
- BOOL On_Command (WPARAM wparam, LPARAM lparam);
- void Show_Settings_Pane (int pane_id);
- void Create_Settings_Panes (void);
- void Destroy_Settings_Panes (void);
- void Determine_Preset_Type (void);
- void Initialize_Controls (void);
- void Update_Controls (void);
- void Save_Settings (void);
-
- //////////////////////////////////////////////////////////////////
- // Private member data
- //////////////////////////////////////////////////////////////////
- W3dExportOptionsStruct * Options;
- W3dExportOptionsStruct OrigOptions;
- Interface * MaxInterface;
- HWND Wnd;
- HWND ParentWnd;
- HWND PaneWnds[PANE_MAX];
- int CurrentPane;
-};
-
-
-#endif //__PRESET_EXPORT_OPTIONS_DIALOG_H
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/rcmenu.cpp b/Generals/Code/Tools/WW3D/max2w3d/rcmenu.cpp
deleted file mode 100644
index 08ba749ac78..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/rcmenu.cpp
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/* $Header: /Commando/Code/Tools/max2w3d/rcmenu.cpp 6 4/19/00 12:24p Greg_h $ */
-/***********************************************************************************************
- *** Confidential - Westwood Studios ***
- ***********************************************************************************************
- * *
- * Project Name : Commando Tools - W3D export *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/rcmenu.cpp $*
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 4/18/00 8:26p $*
- * *
- * $Revision:: 6 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * RCMenuClass::Init -- initialize the "right-click" menu *
- * RCMenuClass::Selected -- menu selection callback *
- * RCMenuClass::Toggle_Hierarchy -- toggle the "export hierarchy" option *
- * RCMenuClass::Toggle_Geometry -- toggle the "export geometry" option *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#include "rcmenu.h"
-#include "w3dutil.h"
-#include "util.h"
-
-
-RCMenuClass TheRCMenu;
-
-/***********************************************************************************************
- * RCMenuClass::Init -- initialize the "right-click" menu *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/26/1997 GH : Created. *
- *=============================================================================================*/
-void RCMenuClass::Init(RightClickMenuManager* manager, HWND hWnd, IPoint2 m)
-{
- Installed=TRUE;
-
- SelNode = InterfacePtr->PickNode(hWnd,m);
-
- if (SelNode) {
-
- UINT menuflags;
- W3DAppData2Struct * wdata = W3DAppData2Struct::Get_App_Data(SelNode);
-
- /*
- ** Add the menu separator
- */
- manager->AddMenu(this, MF_SEPARATOR, MENU_SEPARATOR, NULL);
-
- /*
- ** Add the Name of the object
- */
- char string[64];
- sprintf(string,"%s:",SelNode->GetName());
- manager->AddMenu(this, MF_STRING | MF_DISABLED, MENU_NODE_NAME, string);
-
- /*
- ** Add the pointer
- */
-// sprintf(string,"0x%X",(unsigned long)SelNode);
-// manager->AddMenu(this, MF_STRING | MF_GRAYED, MENU_NODE_POINTER, string);
-
- /*
- ** Add the hierarchy menu option
- */
- if (wdata->Is_Bone()) {
- menuflags = MF_STRING | MF_CHECKED;
- } else {
- menuflags = MF_STRING;
- }
- manager->AddMenu(this, menuflags, MENU_TOGGLE_HIERARCHY, "W3D: Export Hierarchy");
-
- /*
- ** Add the geometry menu option
- */
- if (wdata->Is_Geometry()) {
- menuflags = MF_STRING | MF_CHECKED;
- } else {
- menuflags = MF_STRING;
- }
- manager->AddMenu(this, menuflags, MENU_TOGGLE_GEOMETRY, "W3D: Export Geometry");
-
- }
-}
-
-/***********************************************************************************************
- * RCMenuClass::Selected -- menu selection callback *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/26/1997 GH : Created. *
- *=============================================================================================*/
-void RCMenuClass::Selected(UINT id)
-{
- switch (id) {
-
- case MENU_TOGGLE_HIERARCHY:
- Toggle_Hierarchy(SelNode);
- break;
- case MENU_TOGGLE_GEOMETRY:
- Toggle_Geometry(SelNode);
- break;
-
- }
-}
-
-/***********************************************************************************************
- * RCMenuClass::Toggle_Hierarchy -- toggle the "export hierarchy" option *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/26/1997 GH : Created. *
- *=============================================================================================*/
-void RCMenuClass::Toggle_Hierarchy(INode * node)
-{
-
- W3DAppData2Struct * wdata = W3DAppData2Struct::Get_App_Data(SelNode);
- assert(wdata);
-
- if (wdata->Is_Bone()) {
- wdata->Enable_Export_Transform(false);
- } else {
- wdata->Enable_Export_Transform(true);
- }
-}
-
-/***********************************************************************************************
- * RCMenuClass::Toggle_Geometry -- toggle the "export geometry" option *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/26/1997 GH : Created. *
- *=============================================================================================*/
-void RCMenuClass::Toggle_Geometry(INode * node)
-{
- W3DAppData2Struct * wdata = W3DAppData2Struct::Get_App_Data(SelNode);
- assert(wdata);
-
- if (wdata->Is_Geometry()) {
- wdata->Enable_Export_Geometry(false);
- } else {
- wdata->Enable_Export_Geometry(true);
- }
-}
-
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/rcmenu.h b/Generals/Code/Tools/WW3D/max2w3d/rcmenu.h
deleted file mode 100644
index 024c8878c67..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/rcmenu.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/* $Header: /Commando/Code/Tools/max2w3d/rcmenu.h 3 1/14/98 10:23a Greg_h $ */
-/***********************************************************************************************
- *** Confidential - Westwood Studios ***
- ***********************************************************************************************
- * *
- * Project Name : Commando Tools - W3D export *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/rcmenu.h $*
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 1/13/98 3:44p $*
- * *
- * $Revision:: 3 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#ifndef RCMENU_H
-#define RCMENU_H
-
-#include "max.h"
-#include "dllmain.h"
-#include "resource.h"
-#include "istdplug.h"
-
-class W3DUtilityClass;
-
-/**********************************************************************************************
-**
-** RCMenuClass - W3D Utility's right-click menu.
-**
-**********************************************************************************************/
-class RCMenuClass : public RightClickMenu
-{
-
-public:
-
- RCMenuClass() {Installed=FALSE;}
- ~RCMenuClass() {}
-
- void Bind(Interface * ipi, W3DUtilityClass * eni) { InterfacePtr = ipi; UtilityPtr = eni; }
-
- void Init(RightClickMenuManager* manager, HWND hWnd, IPoint2 m);
- void Selected(UINT id);
- void Toggle_Hierarchy(INode * node);
- void Toggle_Geometry(INode * node);
-
-public:
-
- BOOL Installed;
-
-private:
-
- Interface * InterfacePtr;
- W3DUtilityClass * UtilityPtr;
- INode * SelNode;
-
- enum {
- MENU_SEPARATOR = 0,
- MENU_TOGGLE_HIERARCHY,
- MENU_TOGGLE_GEOMETRY,
- MENU_NODE_NAME,
- MENU_NODE_POINTER
- };
-};
-
-extern RCMenuClass TheRCMenu;
-
-#endif
diff --git a/Generals/Code/Tools/WW3D/max2w3d/resource.h b/Generals/Code/Tools/WW3D/max2w3d/resource.h
deleted file mode 100644
index 06a6e74f004..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/resource.h
+++ /dev/null
@@ -1,422 +0,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Developer Studio generated include file.
-// Used by max2w3d.rc
-//
-#define IDS_COPYRIGHT_NOTICE 1
-#define IDS_AUTHOR_NAME 2
-#define IDS_GAMEMTL 3
-#define IDS_MAP_TEXTURE 4
-#define IDS_ENVMAP 5
-#define IDS_SCENE_EXPORT 6
-#define IDS_LIB_DESCRIPTION 7
-#define IDS_FILE_OPEN_ERROR 8
-#define IDS_DLL_NAME 9
-#define IDS_WTM_SHORT_DESCRIPTION 10
-#define IDS_WTM_LONG_DESCRIPTION 11
-#define IDS_WHT_SHORT_DESCRIPTION 12
-#define IDS_WHT_LONG_DESCRIPTION 13
-#define IDS_WHA_SHORT_DESCRIPTION 14
-#define IDS_WHA_LONG_DESCRIPTION 15
-#define IDS_WTM_FILE_EXTEN 16
-#define IDS_WHT_FILE_EXTEN 17
-#define IDS_WHA_FILE_EXTEN 18
-#define IDS_W3D_FILE_EXTEN 19
-#define IDS_W3D_LONG_DESCRIPTION 20
-#define IDS_W3D_SHORT_DESCRIPTION 21
-#define IDS_W3D_UTILITY_CLASS_NAME 22
-#define IDS_W3DMENU_CATEGORY 23
-#define IDS_W3DMENU_TITLE 24
-#define IDS_SOT 25
-#define IDS_DIFFUSE_COLOR 26
-#define IDS_PARAMETERS 27
-#define IDS_TEXTURE_MAP 28
-#define IDS_ENVIRONMENT_MAP 29
-#define IDS_TEXMAPS 30
-#define IDS_AM 31
-#define IDS_DI 32
-#define IDS_SP 33
-#define IDS_SH 34
-#define IDS_SS 35
-#define IDS_SI 36
-#define IDS_OP 37
-#define IDS_FI 38
-#define IDS_BU 39
-#define IDS_RL 40
-#define IDS_RR 41
-#define IDS_NONE 42
-#define IDS_NOTES 43
-#define IDD_GAMEMTL_PASS_COUNT 101
-#define IDD_VOXEL_DEBUG_DIALOG 103
-#define IDD_W3D_EXPORT_OPTIONS 106
-#define IDD_W3D_UTILITY_DIALOG 107
-#define IDD_BONE_INFLUENCE_PARAMS 108
-#define IDD_SKELETON_PARAMETERS 109
-#define IDD_SKIN_SOT 110
-#define IDD_GAMEMTL_PANEL 111
-#define IDD_GAMEMTL_NOTES_PANEL 112
-#define IDD_GAMEMTL_HINTS_PANEL 114
-#define IDD_GAMEMTL_PSX_PANEL 115
-#define IDD_GAMEMTL_PASS 118
-#define IDD_GAMEMTL_VERTEX_MATERIAL 119
-#define IDD_GAMEMTL_SHADER 120
-#define IDD_GAMEMTL_TEXTURES 121
-#define IDD_GAMEMTL_PASS_COUNT_DIALOG 122
-#define IDD_GENERATE_NAMES_DIALOG 126
-#define IDD_MESH_DEFORM_PANEL 127
-#define IDI_ORIG 127
-#define IDI_DEFORMED 128
-#define IDD_GAMEMTL_SURFACE_TYPE 128
-#define IDD_GAMEMTL_DISPLACEMENT_MAP 129
-#define IDB_NORM 130
-#define IDB_DEFORM 131
-#define IDD_GENERATE_MTL_NAMES_DIALOG 133
-#define IDD_GENERATE_LOD_EXTENSION_DIALOG 135
-#define IDD_EXPORT_ALL 136
-#define IDD_SCENE_SETUP 137
-#define IDD_GAMEMTL_PS2_SHADER 138
-#define IDD_GAMEMTL_PS2_TEXTURES 139
-#define IDD_ALPHA_MODIFIER 140
-#define IDD_W3D_LOG 142
-#define IDD_INPUT_DIALOG 143
-#define IDD_W3DUTILITY_FLOATER_DIALOG 145
-#define IDD_W3DUTILITY_SETTINGS_DIALOG 147
-#define IDD_W3DUTILITY_TOOLS_DIALOG 148
-#define IDD_W3D_EXPORT_OPTIONS1 149
-#define IDD_W3D_PRESET_EXPORT_OPTIONS 149
-#define IDD_EXPORT_PANE_HLOD 150
-#define IDD_EXPORT_PANE_ANIMATED_HLOD 151
-#define IDD_EXPORT_PANE_ANIMATION 152
-#define IDD_EXPORT_PANE_MESH 153
-#define IDD_EXPORT_PANE_SKELETON 154
-#define IDD_EXPORT_PANE_TERRAIN 155
-#define IDD_ANIMATION_COMPRESSION 156
-#define IDI_DISK 157
-#define IDB_WW3D 158
-#define IDD_GRIDSNAP_PARAMS 159
-#define IDC_TRANSLATION_ONLY_CHECK 1000
-#define IDC_TERRAIN_MODE_CHECK 1001
-#define IDC_SETPASSCOUNT 1014
-#define IDC_PASSCOUNT_SPIN 1016
-#define IDC_PASSCOUNT_EDIT 1017
-#define IDC_MAPON_DCT 1018
-#define IDC_MAX_SETS_SPIN 1018
-#define IDC_GAMEMTL_PASSCOUNT_STATIC 1019
-#define IDC_MAX_SETS_EDIT 1019
-#define IDC_MAPON_SCT 1020
-#define IDC_STAGE0_DISPLAY_BUTTON 1020
-#define IDC_VOXEL_VIEWPORT 1021
-#define IDC_MAPON_DIT 1021
-#define IDC_STAGE0_PUBLISH_BUTTON 1021
-#define IDC_MAPON_SIT 1022
-#define IDC_STAGE1_DISPLAY_BUTTON 1022
-#define IDC_WHT_EXPORT_RADIO 1023
-#define IDC_STAGE1_PUBLISH_BUTTON 1023
-#define IDC_WHT_LOAD_RADIO 1024
-#define IDC_STAGE0_RESIZE_BUTTON 1024
-#define IDC_WHA_EXPORT_RADIO 1025
-#define IDC_STAGE0_NO_MIPMAP_BUTTON 1025
-#define IDC_WHT_BROWSE_BUTTON 1026
-#define IDC_STAGE0_CLAMP_U_BUTTON 1026
-#define IDC_WHA_NO_EXPORT_RADIO 1027
-#define IDC_STAGE0_CLAMP_V_BUTTON 1027
-#define IDC_WTM_EXPORT_RADIO 1028
-#define IDC_STAGE1_RESIZE_BUTTON 1028
-#define IDC_WTM_NO_EXPORT_RADIO 1029
-#define IDC_STAGE1_NO_MIPMAP_BUTTON 1029
-#define IDC_STAGE1_CLAMP_U_BUTTON 1030
-#define IDC_WHT_NO_EXPORT_RADIO 1031
-#define IDC_STAGE1_CLAMP_V_BUTTON 1031
-#define IDC_STAGE0_ALPHA_BITMAP_BUTTON 1032
-#define IDC_LAYER_EDIT 1033
-#define IDC_RANGE_LOW_EDIT 1033
-#define IDC_STAGE1_ALPHA_BITMAP_BUTTON 1033
-#define IDC_RANGE_HIGH_EDIT 1034
-#define IDC_NAME_INDEX_EDIT 1034
-#define IDC_STAGE0_NOLOD_BUTTON 1034
-#define IDC_DCT_FRAMES_EDIT 1035
-#define IDC_STAGE1_NOLOD_BUTTON 1035
-#define IDC_DCT_FRAMES_SPIN 1036
-#define IDC_OPACITY_EDIT 1037
-#define IDC_HIERARCHY_CHECK 1038
-#define IDC_OPACITY_SPIN 1038
-#define IDC_UNHIDE_GEOMETRY 1039
-#define IDC_SCT_FRAMES_EDIT 1039
-#define IDC_SELECT_ALPHA_MESHES 1039
-#define IDC_LINK_BY_NAME_BUTTON 1040
-#define IDC_BASE_POSE_EDIT 1040
-#define IDC_UNHIDE_HIERARCHY 1040
-#define IDC_SCT_FRAMES_SPIN 1040
-#define IDC_SELECT_GEOMETRY 1040
-#define IDC_AUTO_LINK_BUTTON 1041
-#define IDC_BASE_POSE_SPIN 1041
-#define IDC_HIDE_ALL 1041
-#define IDC_FOG_EDIT 1041
-#define IDC_SELECT_HIERARCHY 1041
-#define IDC_ADD_BONES_BUTTON 1042
-#define IDC_GEOMETRY_CHECK 1042
-#define IDC_FOG_SPIN 1042
-#define IDC_LINK_BUTTON 1042
-#define IDC_REMOVE_BONES_BUTTON 1043
-#define IDC_TRANSULCENCY_EDIT 1043
-#define IDC_COLLECTION_NAMES_GENERATE 1043
-#define IDC_UNLINK_BUTTON 1043
-#define IDC_BONE_LIST 1044
-#define IDC_TRANSLUCENCY_SPIN 1044
-#define IDC_COLLECTION_NAMES_INCREMENT_LOD 1044
-#define IDC_SELECT_PHYSICAL 1044
-#define IDC_SIT_FRAMES_EDIT 1045
-#define IDC_GEOMETRY_CAMERA_ALIGNED 1045
-#define IDC_SIT_FRAMES_SPIN 1046
-#define IDC_GEOMETRY_CAMERA_ORIENTED 1046
-#define IDC_SHININESS_EDIT 1047
-#define IDC_GEOMETRY_NORMAL 1047
-#define IDC_SHININESS_SPIN 1048
-#define IDC_GEOMETRY_AABOX 1048
-#define IDC_SELECT_PROJECTILE 1049
-#define IDC_COLLISION_PHYSICAL 1050
-#define IDC_DCT_RATE_EDIT 1051
-#define IDC_SELECT_VIS 1051
-#define IDC_DCT_RATE_SPIN 1052
-#define IDC_GEOMETRY_OBBOX 1052
-#define IDC_LAYER_SPIN 1053
-#define IDC_RANGE_LOW_SPIN 1053
-#define IDC_OBJ_NAME 1053
-#define IDC_DIT_FRAMES_EDIT 1053
-#define IDC_RANGE_HIGH_SPIN 1054
-#define IDC_DIT_FRAMES_SPIN 1054
-#define IDC_NAME_INDEX_SPIN 1054
-#define IDC_MATERIAL_NAMES_GENERATE 1054
-#define IDC_DIT_RATE_EDIT 1055
-#define IDC_GEOMETRY_SHADOW 1055
-#define IDC_DIT_RATE_SPIN 1056
-#define IDC_GEOMETRY_NULL 1056
-#define IDC_SCT_RATE_EDIT 1057
-#define IDC_LOD_EXTENSION_GENERATE 1057
-#define IDC_GEOMETRY_AGGREGATE 1057
-#define IDC_DCT_MAPPING_COMBO 1058
-#define IDC_GEOMETRY_LIGHTGLARE 1058
-#define IDC_GEOMETRY_DAZZLE 1058
-#define IDC_DIT_MAPPING_COMBO 1059
-#define IDC_MAPPING_COMBO 1059
-#define IDC_MAPPING0_COMBO 1059
-#define IDC_SCT_MAPPING_COMBO 1060
-#define IDC_MAPPING1_COMBO 1060
-#define IDC_SCT_RATE_SPIN 1061
-#define IDC_USE_ALPHA_CHECK 1062
-#define IDC_SIT_MAPPING_COMBO 1063
-#define IDC_SIT_RATE_EDIT 1064
-#define IDC_SIT_RATE_SPIN 1065
-#define IDC_DIT_OVER_DCT_CHECK 1067
-#define IDC_SIT_OVER_SCT_CHECK 1068
-#define IDC_USE_SORTING_CHECK 1068
-#define IDC_DIT_OVER_DIG_CHECK 1069
-#define IDC_NO_TRANS 1069
-#define IDC_SIT_OVER_SIG_CHECK 1070
-#define IDC_100_TRANS 1070
-#define IDC_FAST_SPECULAR_AFTER_ALPHA_CHECK 1071
-#define IDC_50_TRANS 1071
-#define IDC_25_TRANS 1072
-#define IDC_MINUS_100_TRANS 1073
-#define IDC_NO_RT_LIGHTING 1074
-#define IDC_VIEWPORT_DISPLAY_CHECK 1075
-#define IDC_COLORMASK_CHECK 1081
-#define IDC_DEPTHMASK_CHECK 1082
-#define IDC_ALPHATEST_CHECK 1083
-#define IDC_DEPTHCOMPARE_COMBO 1085
-#define IDC_DESTBLEND_COMBO 1086
-#define IDC_FOG_COMBO 1087
-#define IDC_PRIGRADIENT_COMBO 1088
-#define IDC_SRCBLEND_COMBO 1089
-#define IDC_DETAILCOLOR_COMBO 1090
-#define IDC_DETAILALPHA_COMBO 1091
-#define IDC_STAGE0_HINT_COMBO 1092
-#define IDC_SECGRADIENT_COMBO 1093
-#define IDC_STAGE1_HINT_COMBO 1095
-#define IDC_STAGE0_FRAMES_EDIT 1096
-#define IDC_STAGE0_FRAMES_SPIN 1097
-#define IDC_STAGE0_RATE_EDIT 1098
-#define IDC_STAGE0_RATE_SPIN 1099
-#define IDC_DCT_BUTTON 1100
-#define IDC_GAMEMTL_TAB 1100
-#define IDC_STAGE0_BUTTON 1101
-#define IDC_SCT_BUTTON 1102
-#define IDC_STAGE1_BUTTON 1102
-#define IDC_DIT_BUTTON 1103
-#define IDC_AMBIENT_COLOR 1103
-#define IDC_SIT_BUTTON 1104
-#define IDC_EMISSIVE_COLOR 1104
-#define IDC_SHADEMODEL_COMBO 1105
-#define IDC_STAGE1_FRAMES_EDIT 1106
-#define IDC_STAGE1_FRAMES_SPIN 1107
-#define IDC_STAGE1_RATE_EDIT 1108
-#define IDC_STAGE1_RATE_SPIN 1109
-#define IDC_DITHERMASK_COMBO 1110
-#define IDC_DIFFUSE_COLOR 1113
-#define IDC_STAGE0_ENABLE 1113
-#define IDC_SPECULAR_COLOR 1114
-#define IDC_STAGE1_ENABLE 1114
-#define IDC_AMBIENT_COEFF 1115
-#define IDC_STAGE1_ANIM_COMBO 1115
-#define IDC_DIFFUSE_COEFF 1116
-#define IDC_PRESET_COMBO 1116
-#define IDC_EMISSIVE_COEFF 1117
-#define IDC_STAGE0_ANIM_COMBO 1117
-#define IDC_SPECULAR_COEFF 1118
-#define IDC_GEOMETRY_TWO_SIDED 1119
-#define IDC_COLLISION_VIS 1120
-#define IDC_GEOMETRY_HIDE 1121
-#define IDC_GEOMETRY_ZNORMALS 1122
-#define IDC_GEOMETRY_VERTEX_ALPHA 1123
-#define IDC_BASE_NAME_EDIT 1124
-#define IDC_GEOMETRY_CAST_SHADOW 1124
-#define IDC_PREFIX_EDIT 1125
-#define IDC_COLLISION_CAMERA 1125
-#define IDC_GEOMETRY_SHATTERABLE 1126
-#define IDC_SUFFIX_EDIT 1126
-#define IDC_GEOMETRY_NPATCH 1127
-#define IDC_AFFECT_ALL_RADIO 1131
-#define IDC_AFFECT_SELECTED_RADIO 1132
-#define IDC_LOD_INDEX_EDIT 1133
-#define IDC_LOD_INDEX_SPIN 1134
-#define IDC_ASSIGN_COLLISION_BITS_CHECK 1135
-#define IDC_ASSIGN_NAMES_CHECK 1137
-#define IDC_COLLISION_PROJECTILE 1138
-#define IDC_COPY_SPECULAR_DIFFUSE 1139
-#define IDC_ASSIGN_PREFIX_CHECK 1139
-#define IDC_COLLISION_VEHICLE 1139
-#define IDC_MAPPING_ARGS_EDIT 1140
-#define IDC_ASSIGN_SUFFIX_CHECK 1140
-#define IDC_MAPPING0_ARGS_EDIT 1140
-#define IDC_MAPPING1_ARGS_EDIT 1141
-#define IDC_SHADER_DEFAULTS_BUTTON 1143
-#define IDC_STATE_SLIDER 1145
-#define IDC_CURRENT_SET_SLIDER 1146
-#define IDC_CURRENT_SET_STATIC 1147
-#define IDC_VERTEX_COLOR 1149
-#define IDC_RESTORE_BUTTON 1150
-#define IDC_MANUALAPPLY 1151
-#define IDC_SURFACE_TYPE_COMBO 1152
-#define IDC_EXPORT_MESH_SMOOTH_CHECK 1153
-#define IDC_LOCK_SETS 1154
-#define IDC_EXPORT_MESH_AABTREES 1154
-#define IDC_TEXTURE_BUTTON 1155
-#define IDC_EXPORT_MESH_MAT_TO_TEXTURE 1155
-#define IDC_AMOUNT_EDIT 1156
-#define IDC_EXPORT_MESH_OPTIMIZE 1156
-#define IDC_AMOUNT_SPIN 1157
-#define IDC_DAMREG_INDEX_EDIT 1161
-#define IDC_DAMREG_INDEX_SPIN 1162
-#define IDC_DIRECTORY 1163
-#define IDC_STAGE0UVCHAN_EDIT 1163
-#define IDC_BROWSE 1164
-#define IDC_STAGE0UVCHAN_SPIN 1164
-#define IDC_RECURSIVE 1165
-#define IDC_STAGE1UVCHAN_EDIT 1165
-#define IDC_LOD_COUNT 1166
-#define IDC_STAGE1UVCHAN_SPIN 1166
-#define IDC_LOD_OFFSET 1167
-#define IDC_LOD_AS_COPY 1168
-#define IDC_LOD_AS_INSTANCE 1169
-#define IDC_LOD_AS_REFERENCE 1170
-#define IDC_DAMAGE_COUNT 1171
-#define IDC_DAMAGE_OFFSET 1172
-#define IDC_DAMAGE_AS_COPY 1173
-#define IDC_PS2_PRESET_COMBO 1173
-#define IDC_DAMAGE_AS_INSTANCE 1174
-#define IDC_COMPATIBLE 1174
-#define IDC_DAMAGE_AS_REFERENCE 1175
-#define IDC_ALPHA_EDIT 1175
-#define IDC_A_COMBO 1176
-#define IDC_B_COMBO 1177
-#define IDC_EXPORT_STANDARD_MATERIALS 1177
-#define IDC_C_COMBO 1178
-#define IDC_EXPORT_UTILITIES_GROUP 1178
-#define IDC_D_COMBO 1179
-#define IDC_COMPRESS_ANIMATION_CHECK 1179
-#define IDC_ALPHA_SPIN 1180
-#define IDC_ALPHA_SPIN2 1181
-#define IDC_REDUCE_ANIMATION_CHECK 1188
-#define IDC_REDUCE_ANIMATION_COMBO 1190
-#define IDC_ANIMATION_FPS_STATIC 1191
-#define IDC_COMPRESS_ANIMATION_FLAVOR_COMBO 1192
-#define IDC_MAX_TRANS_ERROR_EDIT 1193
-#define IDC_MAX_ROT_ERROR_EDIT 1194
-#define IDC_ANIM_COMPRESS_PROGRESS 1196
-#define IDC_ANIM_LOG_RICHEDIT 1198
-#define IDC_VIEWLOG_CHECK 1199
-#define IDC_VALUE 1200
-#define IDC_LABEL 1201
-#define IDC_ALPHA_CHECKBOX 1204
-#define IDC_DAZZLE_COMBO 1205
-#define IDC_CREATE_SETTINGS_FLOATER 1208
-#define IDC_RADIO1 1212
-#define IDC_HLOD_RADIO 1212
-#define IDC_RADIO2 1213
-#define IDC_COMPRESSION_SETTINGS 1213
-#define IDC_ANIM_RADIO 1213
-#define IDC_RADIO3 1214
-#define IDC_MESH_RADIO 1214
-#define IDC_RADIO4 1215
-#define IDC_SKELETON_RADIO 1215
-#define IDC_GROUP_BOX 1216
-#define IDC_RADIO5 1217
-#define IDC_TERRAIN_RADIO 1217
-#define IDC_USE_SKELETON_CHECK 1217
-#define IDC_RADIO6 1218
-#define IDC_ANIM_HLOD_RADIO 1218
-#define IDC_REVIEW_LOG 1219
-#define IDC_ENABLE_SORT_LEVEL 1220
-#define IDC_SORT_LEVEL 1221
-#define IDC_SORT_LEVEL_SPIN 1222
-#define IDC_GRIDDIM_EDIT 1223
-#define IDC_GRIDDIM_SPIN 1224
-#define IDS_SKIN_CLASS_NAME 60011
-#define IDS_SKIN_OBJECT_NAME 60012
-#define IDS_SKIN 60013
-#define IDS_SKIN_PARAMETERS 60014
-#define IDS_SKIN_INFO 60015
-#define IDS_BONE_INFLUENCE_PARAMS 60016
-#define IDS_SOT2 60017
-#define IDS_SKELETON_PARAMETERS 60018
-#define IDS_PICK_BONE_DIALOG_TITLE 60019
-#define IDS_PICK_BONE_BUTTON_TEXT 60020
-#define IDS_MULTIPLE_OBJECTS 60021
-#define IDS_NO_OBJECT 60022
-#define IDS_SPECULAR_COLOR 60023
-#define IDS_AMBIENT_COLOR 60024
-#define IDS_EMISSIVE_COLOR 60027
-#define IDS_MATERIAL_HINTS 60028
-#define IDS_PSX_OPTIONS 60029
-#define IDS_UV_MAPPING 60030
-#define IDS_ENVIRONMENT_MAPPING 60031
-#define IDS_PASS_COUNT 60032
-#define IDS_PASS_SETTINGS 60033
-#define IDS_PUBLISH 60034
-#define IDS_DISPLAY 60035
-#define IDS_RESIZE 60036
-#define IDS_NO_MIPMAP 60037
-#define IDS_CLAMP_U 60038
-#define IDS_CLAMP_V 60039
-#define IDS_ALPHA_BITMAP 60040
-#define IDS_SURFACE_TYPE 60041
-#define IDS_DISPLACEMENT_MAP 60042
-#define IDS_ALPHA_MODIFIER_CLASS 60043
-#define IDS_PS2_GAMEMTL 60044
-#define IDS_PC_TO_PS2_MAT_CONVERTER 60045
-#define IDS_NO_LOD 60046
-#define IDS_W3DUTILITY_SETTINGS 60047
-#define IDS_W3DUTILITY_TOOLS 60048
-#define IDS_GRIDSNAPMODIFIER 60049
-#define IDS_GRIDSNAP_TITLE 60050
-#define IDS_GRID_DIMENSION 60051
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 160
-#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1225
-#define _APS_NEXT_SYMED_VALUE 101
-#endif
-#endif
diff --git a/Generals/Code/Tools/WW3D/max2w3d/simpdib.cpp b/Generals/Code/Tools/WW3D/max2w3d/simpdib.cpp
deleted file mode 100644
index 4558c9a9f02..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/simpdib.cpp
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Command & Conquer *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/simpdib.cpp $*
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 10/14/97 3:07p $*
- * *
- * $Revision:: 3 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#include "simpdib.h"
-
-
-SimpleDIBClass::SimpleDIBClass(HWND hwnd,int width,int height,PaletteClass & pal):
- IsZombie(false),
- Info(NULL),
- Handle(0),
- Pixels(NULL),
- Width(width),
- Height(height),
- PixelBase(NULL),
- Pitch(NULL)
-{
- // Allocate a BITMAPINFO structure
- Info = (BITMAPINFO *) new char [sizeof(BITMAPINFO) + 256*sizeof(RGBQUAD)];
-
- if (Info == NULL) {
- IsZombie = true;
- return;
- }
-
- // Describe the type of DIB we want.
- Info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
- Info->bmiHeader.biWidth = width;
- Info->bmiHeader.biHeight = -height; //ask for a top-down dib.
- Info->bmiHeader.biPlanes = 1;
- Info->bmiHeader.biBitCount = 8;
- Info->bmiHeader.biCompression = BI_RGB;
- Info->bmiHeader.biSizeImage = 0;
- Info->bmiHeader.biXPelsPerMeter = 0;
- Info->bmiHeader.biYPelsPerMeter = 0;
- Info->bmiHeader.biClrUsed = 256;
- Info->bmiHeader.biClrImportant = 256;
-
- // Fill in the DIB's palette.
- for (int i=0; i<256; i++) {
- Info->bmiColors[i].rgbBlue = (unsigned char)pal[i].Get_Blue();
- Info->bmiColors[i].rgbGreen = (unsigned char)pal[i].Get_Green();
- Info->bmiColors[i].rgbRed = (unsigned char)pal[i].Get_Red();
- Info->bmiColors[i].rgbReserved = 0;
- }
-
- // Create the DIB.
- HDC hdc = GetDC(hwnd);
- Handle = CreateDIBSection(hdc, Info, DIB_RGB_COLORS,(void**)&Pixels, NULL, 0);
- ReleaseDC(hwnd, hdc);
-
- if (!Handle) {
- IsZombie = true;
- return;
- }
-
- Width = Info->bmiHeader.biWidth;
- Height = abs(Info->bmiHeader.biHeight);
- Pitch = (Width + 3) & 0xfffffffC;
-
- // Check if the DIB is bottom-up or top-down.
- // (it better be top-down, thats what I'm asking for!!!)
- if (Info->bmiHeader.biHeight > 0) {
-
- // bottom-up DIB
- PixelBase = (Pixels + (Height - 1) * Width);
- Pitch = -Pitch;
-
- } else {
-
- // top-down DIB
- PixelBase = Pixels;
- Pitch = Pitch;
- }
-}
-
-SimpleDIBClass::~SimpleDIBClass(void)
-{
- if (Info) delete [] Info;
- if (Handle) DeleteObject(Handle);
-}
-
-
-void SimpleDIBClass::Clear(unsigned char color)
-{
- if (Pixels) {
- memset(Pixels, color, abs(Pitch)*Height);
- }
-}
-
-void SimpleDIBClass::Set_Pixel(int i,int j,unsigned char color)
-{
- if ((i < 0) || (j < 0) || (i >= Width) || (j >= Height)) {
- return;
- }
-
- *(PixelBase + j*Pitch + i) = color;
-}
diff --git a/Generals/Code/Tools/WW3D/max2w3d/simpdib.h b/Generals/Code/Tools/WW3D/max2w3d/simpdib.h
deleted file mode 100644
index ceb44c6e3b2..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/simpdib.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Command & Conquer *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/simpdib.h $*
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 10/14/97 3:07p $*
- * *
- * $Revision:: 3 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#ifndef SIMPDIB_H
-#define SIMPDIB_H
-
-#ifndef ALWAYS_H
-#include "always.h"
-#endif
-
-#include
-
-#ifndef WIN_H
-#include "win.h"
-#endif
-
-#ifndef PALETTE_H
-#include "palette.h"
-#endif
-
-class SimpleDIBClass
-{
-public:
-
- SimpleDIBClass(HWND hwnd,int width, int height,PaletteClass & pal);
- ~SimpleDIBClass(void);
-
- HBITMAP Get_Handle() { return Handle; }
- int Get_Width(void) { return Width; }
- int Get_Height(void) { return Height; }
-
- void Clear(unsigned char color);
- void Set_Pixel(int i,int j,unsigned char color);
-
-private:
-
- bool IsZombie; // object constructor failed, its a living-dead object!
- BITMAPINFO * Info; // info used in creating the dib + the palette.
- HBITMAP Handle; // handle to the actual dib
- unsigned char * Pixels; // address of memory containing the pixel data
- int Width; // width of the dib
- int Height; // height of the dib
- unsigned char * PixelBase; // address of upper left pixel (this and DIBPitch abstract up/down DIBS)
- int Pitch; // offset from DIBPixelBase to next row (can be negative for bottom-up DIBS)
-
-};
-
-
-#endif /*SIMPDIB_H*/
\ No newline at end of file
diff --git a/Generals/Code/Tools/WW3D/max2w3d/skin.cpp b/Generals/Code/Tools/WW3D/max2w3d/skin.cpp
deleted file mode 100644
index 65a1f251aa7..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/skin.cpp
+++ /dev/null
@@ -1,1916 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Commando Tools - WWSkin *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/skin.cpp $*
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 4/24/01 5:15p $*
- * *
- * $Revision:: 13 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#include "skin.h"
-#include "dllmain.h"
-#include "max.h"
-#include "simpmod.h"
-#include "simpobj.h"
-#include "resource.h"
-
-#include "skindata.h"
-#include "bpick.h"
-#include "namedsel.h"
-#include "boneicon.h"
-
-#if defined W3D_MAX4 //defined as in the project (.dsp)
-static GenSubObjType _SubObjectTypeVertex(1);
-#endif
-
-/*
-** Static functions
-*/
-static BOOL CALLBACK _sot_dialog_proc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam);
-static BOOL CALLBACK _skeleton_dialog_thunk(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam);
-static BOOL CALLBACK _bone_influence_dialog_thunk(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam);
-static TriObject * Get_Tri_Object(TimeValue t,ObjectState & os,Interval & valid,BOOL & needsdel);
-static float Bone_Distance(INode * bone,TimeValue time,const Point3 & vertex);
-
-/*
-** Static variables
-*/
-HWND SkinWSMObjectClass::SotHWND = NULL;
-HWND SkinWSMObjectClass::SkeletonHWND = NULL;
-HWND SkinWSMObjectClass::BoneListHWND = NULL;
-IObjParam * SkinWSMObjectClass::InterfacePtr = NULL;
-ICustButton * SkinWSMObjectClass::AddBonesButton = NULL;
-ICustButton * SkinWSMObjectClass::RemoveBonesButton = NULL;
-ISpinnerControl * SkinWSMObjectClass::BasePoseSpin = NULL;
-
-
-/*******************************************************************************
-**
-** Class Descriptor for SkinWSMObjectClass
-**
-*******************************************************************************/
-class SkinWSMObjectClassDesc:public ClassDesc
-{
-public:
-
- int IsPublic() { return 1; }
- void * Create(BOOL loading = FALSE) { return new SkinWSMObjectClass; }
- const TCHAR * ClassName() { return _T("WWSkin"); }
- SClass_ID SuperClassID() { return WSM_OBJECT_CLASS_ID; }
- Class_ID ClassID() { return SKIN_OBJ_CLASS_ID; }
- const TCHAR* Category() { return _T("Westwood Space Warps"); }
-};
-
-static SkinWSMObjectClassDesc _SkinWSMObjectDesc;
-ClassDesc * Get_Skin_Obj_Desc() { return &_SkinWSMObjectDesc; }
-
-
-/*******************************************************************************
-**
-** Class Descriptor for the SkinModifier
-**
-*******************************************************************************/
-class SkinModClassDesc:public ClassDesc
-{
-public:
-
- int IsPublic() { return 0; }
- void * Create(BOOL loading = FALSE) { return new SkinModifierClass; }
- const TCHAR * ClassName() { return _T("WWSkin"); }
- SClass_ID SuperClassID() { return WSM_CLASS_ID; }
- Class_ID ClassID() { return SKIN_MOD_CLASS_ID; }
- const TCHAR * Category() { return _T("Westwood Space Warps"); }
-};
-
-static SkinModClassDesc _SkinModDesc;
-ClassDesc * Get_Skin_Mod_Desc() { return &_SkinModDesc; }
-
-
-
-/*******************************************************************************
-**
-** SkinWSMObjectCreateCallback
-** A class derived from CreateMouseCallBack to handle
-** the user input during the creation phase of the SkinWSMObject.
-**
-*******************************************************************************/
-class SkinWSMObjectCreateCallBack : public CreateMouseCallBack
-{
-public:
- int proc( ViewExp * vpt,int msg, int point, int flags, IPoint2 m, Matrix3 & mat)
- {
- if (msg == MOUSE_POINT) {
- Point3 pos = vpt->GetPointOnCP(m);
- mat.IdentityMatrix();
- mat.SetTrans(pos);
- return CREATE_STOP;
- }
- return TRUE;
- }
-};
-
-static SkinWSMObjectCreateCallBack _SkinCreateCB;
-
-/*******************************************************************************
-**
-** SkinWSMObjectClass
-**
-*******************************************************************************/
-SkinWSMObjectClass::SkinWSMObjectClass()
-{
- /*
- ** Initialize class variables to default state!
- */
- MeshBuilt = FALSE;
- BoneSelectionMode = BONE_SEL_MODE_NONE;
- BoneTab.SetCount(0);
- BasePoseFrame = 0;
-
- pblock = NULL;
-}
-
-SkinWSMObjectClass::~SkinWSMObjectClass(void)
-{
- assert(!((InterfacePtr == NULL) && (SotHWND != NULL)));
- if (SotHWND != NULL) {
- InterfacePtr->UnRegisterDlgWnd(SotHWND);
- InterfacePtr->DeleteRollupPage(SotHWND);
- SotHWND = NULL;
- }
-
- assert(!((InterfacePtr == NULL) && (SkeletonHWND != NULL)));
- if (SkeletonHWND != NULL) {
- InterfacePtr->UnRegisterDlgWnd(SkeletonHWND);
- InterfacePtr->DeleteRollupPage(SkeletonHWND);
- SkeletonHWND = NULL;
- }
-}
-
-void SkinWSMObjectClass::BeginEditParams(IObjParam *ip, ULONG flags,Animatable *prev)
-{
- SimpleWSMObject::BeginEditParams(ip,flags,prev);
-
- /*
- ** save off a copy of the interface pointer
- */
- InterfacePtr = ip;
-
- /*
- ** Install the "supports objects of type" rollup
- */
- if (SotHWND == NULL) {
- SotHWND = ip->AddRollupPage(
- AppInstance,
- MAKEINTRESOURCE(IDD_SKIN_SOT),
- _sot_dialog_proc,
- Get_String(IDS_SOT),
- (LPARAM)InterfacePtr,
- APPENDROLL_CLOSED);
- } else {
- SetWindowLong(SotHWND,GWL_USERDATA,(LPARAM)ip);
- }
-
- /*
- ** Install the skeleton rollup
- */
- if (SkeletonHWND == NULL) {
- SkeletonHWND = InterfacePtr->AddRollupPage(
- AppInstance,
- MAKEINTRESOURCE(IDD_SKELETON_PARAMETERS),
- _skeleton_dialog_thunk,
- Get_String(IDS_SKELETON_PARAMETERS),
- (LPARAM)this,
- 0);
- } else {
- SetWindowLong(SkeletonHWND,GWL_USERDATA,(LPARAM)this);
- }
-
- Update_Bone_List();
-}
-
-void SkinWSMObjectClass::EndEditParams(IObjParam *ip, ULONG flags,Animatable *next)
-{
- SimpleWSMObject::EndEditParams(ip,flags,next);
-
- if (flags & END_EDIT_REMOVEUI) {
- /*
- ** Remove the Sot rollup
- */
- if (SotHWND != NULL) {
- InterfacePtr->UnRegisterDlgWnd(SotHWND);
- InterfacePtr->DeleteRollupPage(SotHWND);
- SotHWND = NULL;
- }
-
- /*
- ** Remove the info rollup
- */
- if (SkeletonHWND != NULL) {
- InterfacePtr->UnRegisterDlgWnd(SkeletonHWND);
- InterfacePtr->DeleteRollupPage(SkeletonHWND);
- SkeletonHWND = NULL;
- }
- }
-
- /*
- ** get rid of our copy of the interface pointer
- */
- InterfacePtr = NULL;
-}
-
-RefTargetHandle SkinWSMObjectClass::Clone(RemapDir & remap)
-{
- /*
- ** create another SkinWSMObject and return it.
- */
- SkinWSMObjectClass * sobj = new SkinWSMObjectClass();
- return(sobj);
-}
-
-RefTargetHandle SkinWSMObjectClass::GetReference(int i)
-{
- /*
- ** return reference "i". If i==0, the reference belongs
- ** to SimpleWSMObject so thunk down to it.
- */
- if (i < SimpleWSMObject::NumRefs()) {
- return SimpleWSMObject::GetReference(i);
- }
-
- /*
- ** The rest of the references are ours.
- */
- int boneidx = To_Bone_Index(i);
- return BoneTab[boneidx];
-}
-
-void SkinWSMObjectClass::SetReference(int i, RefTargetHandle rtarg)
-{
- if (i < SimpleWSMObject::NumRefs()) {
- SimpleWSMObject::SetReference(i,rtarg);
- } else {
- int boneidx = To_Bone_Index(i);
- assert(boneidx >= 0);
- assert(boneidx < BoneTab.Count());
- BoneTab[boneidx] = (INode *)rtarg;
- }
-}
-
-RefResult SkinWSMObjectClass::NotifyRefChanged(Interval changeInt,RefTargetHandle hTarget,PartID& partID, RefMessage message)
-{
- int i;
- switch (message) {
-
- case REFMSG_TARGET_DELETED:
- for (i=0; isetVerts(a, b, c);
- f->setSmGroup(0);
- f->setEdgeVisFlags(1,1,1);
-}
-
-void SkinWSMObjectClass::User_Picked_Bone(INode * node)
-{
- // TODO: Undo/Redo!
- switch (BoneSelectionMode) {
- case BONE_SEL_MODE_ADD:
- Add_Bone(node);
- break;
-
- case BONE_SEL_MODE_REMOVE:
- Remove_Bone(node);
- break;
-
- default:
- assert(0);
- }
-
- Set_Bone_Selection_Mode(BONE_SEL_MODE_NONE);
- Update_Bone_List();
-}
-
-void SkinWSMObjectClass::User_Picked_Bones(INodeTab & nodetab)
-{
- // TODO: Undo/Redo!
- switch (BoneSelectionMode) {
- case BONE_SEL_MODE_ADD_MANY:
- Add_Bones(nodetab);
- break;
-
- case BONE_SEL_MODE_REMOVE_MANY:
- Remove_Bones(nodetab);
- break;
-
- default:
- assert(0);
- }
-
- Set_Bone_Selection_Mode(BONE_SEL_MODE_NONE);
- Update_Bone_List();
-}
-
-void SkinWSMObjectClass::Set_Bone_Selection_Mode(int mode)
-{
- assert(mode >= BONE_SEL_MODE_NONE);
- assert(mode <= BONE_SEL_MODE_REMOVE_MANY);
-
- /*
- ** store the selection mode
- */
- BoneSelectionMode = mode;
-
- /*
- ** update the dialog box buttons
- */
- AddBonesButton->SetCheck(mode == BONE_SEL_MODE_ADD_MANY);
- RemoveBonesButton->SetCheck(mode == BONE_SEL_MODE_REMOVE_MANY);
-}
-
-int SkinWSMObjectClass::Add_Bone(INode * node)
-{
- int refidx;
- int boneidx;
-
- /*
- ** If we already have this bone, just return
- */
- boneidx = Find_Bone(node);
- if (boneidx != -1) {
- return boneidx;
- }
-
- /*
- ** Otherwise, look for a NULL bone and we'll re-use
- ** its slot. This happens when a user removes a bone or
- ** a bone in the scene is deleted.
- */
- boneidx = Find_Bone(NULL);
- if (boneidx != -1) {
- refidx = To_Ref_Index(boneidx);
- MakeRefByID(FOREVER,refidx,node);
- return boneidx;
- }
-
- /*
- ** If we made it here, add the bone to the end of the
- ** reference array.
- */
- BoneTab.Append(1,&node);
- boneidx = BoneTab.Count() - 1;
- refidx = To_Ref_Index(boneidx);
- MakeRefByID(FOREVER,refidx,node);
- return boneidx;
-}
-
-void SkinWSMObjectClass::Add_Bones(INodeTab & nodetab)
-{
- /*
- ** Add each bone individually
- */
- for (int i=0; iGetName());
- }
- }
-}
-
-int SkinWSMObjectClass::Find_Bone(INode * node)
-{
- for (int i=0; i 0) {
- isave->BeginChunk(NUM_BONES_CHUNK);
- isave->Write(&numbones,sizeof(ULONG),&nb);
- isave->EndChunk();
- }
- return IO_OK;
-}
-
-IOResult SkinWSMObjectClass::Load(ILoad * iload)
-{
- SimpleWSMObject::Load(iload);
-
- IOResult res;
- ULONG nb;
- int level = -1;
-
- while (IO_OK==(res=iload->OpenChunk())) {
-
- switch (iload->CurChunkID()) {
-
- case NUM_BONES_CHUNK: {
- ULONG numbones;
- res = iload->Read(&numbones,sizeof(numbones),&nb);
- BoneTab.SetCount(numbones);
- for (int i=0; iCloseChunk();
-
- if (res!=IO_OK) {
- return res;
- }
- }
- return IO_OK;
-}
-
-
-int SkinWSMObjectClass::Find_Closest_Bone(const Point3 & vertex)
-{
- float mindist = 10000.0f;
- int minindex = -1;
- TimeValue basetime = Get_Base_Pose_Time();
-
- for (int boneidx = 0; boneidx < BoneTab.Count(); boneidx++) {
-
- if (BoneTab[boneidx] == NULL) continue;
-
- float bonedist = Bone_Distance(BoneTab[boneidx],basetime,vertex);
- if (bonedist < mindist) {
- mindist = bonedist;
- minindex = boneidx;
- }
- }
-
- return minindex;
-}
-
-
-
-/*******************************************************************************
-**
-** SkinModifierClass
-**
-*******************************************************************************/
-
-SkinModifierClass::SkinModifierClass(void)
-{
- Default_Init();
-}
-
-SkinModifierClass::SkinModifierClass(INode * node,SkinWSMObjectClass * skin_obj)
-{
- Default_Init();
-
- /*
- ** Make the reference to the space warp node.
- */
- MakeRefByID(FOREVER,NODE_REF,node);
-
- /*
- ** Make reference to the WSMObject
- */
- MakeRefByID(FOREVER,OBJ_REF,skin_obj);
-
-}
-
-void SkinModifierClass::Default_Init(void)
-{
- SubObjSelLevel = VERTEX_SEL_LEVEL;
- WSMObjectRef = NULL;
- WSMNodeRef = NULL;
- InterfacePtr = NULL;
-
- BoneInfluenceHWND = NULL;
- LinkButton = NULL;
- LinkByNameButton = NULL;
- AutoLinkButton = NULL;
- UnLinkButton = NULL;
-}
-
-
-RefTargetHandle SkinModifierClass::Clone(RemapDir & remap)
-{
- SkinModifierClass * newmod = new SkinModifierClass(WSMNodeRef,(SkinWSMObjectClass *)WSMObjectRef);
- return newmod;
-}
-
-
-void SkinModifierClass::BeginEditParams(IObjParam * ip, ULONG flags,Animatable * prev)
-{
- static int i=0;
-
- i++;
-
- /*
- ** Grab a copy of the interface pointer
- */
- InterfacePtr = ip;
-
- /*
- ** allocate the selection command mode for use in vertex selection
- */
- SelectMode = new SelectModBoxCMode(this,InterfacePtr);
-
- /*
- ** register the desired sub-object selection types.
- */
- const TCHAR * ptype[] = { "Vertices" };
-#if defined W3D_MAX4 //defined as in the project (.dsp)
- InterfacePtr->SetSubObjectLevel(1);
-#else
- //---This call is obsolete from version 4.
- InterfacePtr->RegisterSubObjectTypes( ptype, 1);
-#endif
- /*
- ** Restore the selection level.
- */
- ip->SetSubObjectLevel(SubObjSelLevel);
-
-}
-
-
-void SkinModifierClass::EndEditParams(IObjParam *ip, ULONG flags,Animatable *next)
-{
- /*
- ** just checking...
- */
- assert(ip == InterfacePtr);
-
- /*
- ** Make sure we clear out the pick mode
- */
- InterfacePtr->ClearPickMode();
-
- /*
- ** remove and deallocate the selection command mode
- */
- InterfacePtr->DeleteMode(SelectMode);
- if (SelectMode ) delete SelectMode;
- SelectMode = NULL;
-
- /*
- ** Remove the rollup window(s) if needed
- */
- if (flags & END_EDIT_REMOVEUI) {
- Remove_Bone_Influence_Dialog();
- }
-
- /*
- ** Make sure we don't hang onto an invalid interface
- */
- InterfacePtr = NULL;
-}
-
-Interval SkinModifierClass::Get_Validity(TimeValue t)
-{
- /*
- ** Start with an infinite interval and chop it down
- ** using the validity intervals of each of the controlling bones
- */
- Interval valid = FOREVER;
-
- /*
- ** Now intersect the validity with the validities of all of
- ** the controlling bones.
- */
- SkinWSMObjectClass * obj = (SkinWSMObjectClass *)Get_WSMObject();
-
-// for (int i=0; iNum_Bones(); i++) {
-// valid &= obj->Get_Bone(i)->tmValid(); //TODO: is this right?
-// }
-
-// return valid;
- return Interval(t,t+1); //KLUDGE - only valid for this frame
-}
-
-RefTargetHandle SkinModifierClass::GetReference(int i)
-{
- switch (i) {
- case OBJ_REF: return WSMObjectRef;
- case NODE_REF: return WSMNodeRef;
- default: return NULL;
- }
-}
-
-void SkinModifierClass::SetReference(int i, RefTargetHandle rtarg)
-{
- switch (i) {
- case OBJ_REF: WSMObjectRef = (SkinWSMObjectClass *)rtarg; break;
- case NODE_REF: WSMNodeRef = (INode *)rtarg; break;
- }
-}
-
-RefResult SkinModifierClass::NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message)
-{
- switch (message) {
-
- case REFMSG_TARGET_DELETED:
-
- /*
- ** This means the WSM node is being deleted. As a result,
- ** we must delete ourselves.
- */
- DeleteMe(); // also deletes all refs and
- // sends REFMSG_TARGET_DELETED to all Dependents
- return REF_STOP;
- }
-
- return(REF_SUCCEED);
-
-}
-
-void SkinModifierClass::ModifyObject(TimeValue t, ModContext & mc, ObjectState * os, INode * node)
-{
- /*
- ** Get a TriObject from the object state
- */
- assert(os->obj->IsSubClassOf(triObjectClassID));
- TriObject *triobj = (TriObject *)os->obj;
-
- /*
- ** Get the skin data from the ModContext.
- */
- SkinDataClass * skindata = (SkinDataClass *)mc.localData;
-
- /*
- ** If there is no skin data, allocate it
- ** Also, do an initial auto attach.
- */
- if (skindata == NULL) {
- mc.localData = skindata = new SkinDataClass(&triobj->mesh);
- }
-
- if (!skindata->IsValid()) {
- skindata->Validate(&triobj->mesh);
- }
-
- /*
- ** If in vertex selection mode, tell the mesh to display the
- ** selected vertices and turn on vertex tick marks. Otherwise
- ** make sure vertex tick marks are off.
- */
- if (SubObjSelLevel == VERTEX_SEL_LEVEL) {
- triobj->mesh.vertSel = skindata->VertSel;
- triobj->mesh.SetDispFlag(DISP_VERTTICKS|DISP_SELVERTS);
-
- if (triobj->mesh.selLevel != MESH_VERTEX) {
- triobj->mesh.selLevel = MESH_VERTEX;
- }
- } else {
- triobj->mesh.selLevel = MESH_OBJECT;
- triobj->mesh.ClearDispFlag(DISP_VERTTICKS|DISP_SELVERTS);
- }
-
- /*
- ** Loop through the points in the deformable object
- */
- for (int vidx = 0; vidx < triobj->NumPoints(); vidx++) {
-
-
- // TODO: Allow multiple bone influences here...
- // issues - UI to set the weights, rebalance weights whenever
- // a bone is deleted, should also then never get NULL bones
- // and remove the need to check for NULL bones in this routine...
-
- /*
- ** Get a pointer to the bone that this vertex is attached to
- */
- InfluenceStruct * inf = &(skindata->VertData[vidx]);
-
- int boneidx = inf->BoneIdx[0];
- if ((boneidx != -1) && (boneidx < WSMObjectRef->Num_Bones())) {
-
- INode * bone = WSMObjectRef->Get_Bone(inf->BoneIdx[0]);
-
- if (bone == NULL) {
- /*
- ** this bone has gone away for some reason so
- ** clear this vert's bone influence index
- */
- inf->BoneIdx[0] = -1;
-
- } else {
-
- /*
- ** Ok, got the bone, now transform the point and
- ** give it back to the mesh
- */
- Point3 pnew;
- Matrix3 tm;
-
- pnew = triobj->GetPoint(vidx);
-
- if (os->GetTM()) {
- tm = *(os->GetTM());
- } else {
- tm.IdentityMatrix();
- }
-
- pnew = tm * pnew;
-
- TimeValue basetime = WSMObjectRef->Get_Base_Pose_Time();
- Matrix3 basetm = bone->GetObjectTM(basetime);
- Matrix3 curtm = bone->GetObjectTM(t);
- pnew = (pnew * Inverse(basetm)) * curtm;
-
- pnew = Inverse(tm) * pnew;
-
- triobj->SetPoint(vidx,pnew);
- }
- }
- }
-
- /*
- ** Tell the object that points were changed
- */
- triobj->PointsWereChanged();
-
- /*
- ** Set the validity of the updated geometry data
- */
- triobj->UpdateValidity(GEOM_CHAN_NUM,Get_Validity(t));
-}
-
-IOResult SkinModifierClass::Save(ISave * isave)
-{
- ULONG nb;
- Modifier::Save(isave);
-
- /*
- ** Save the sub object selection level
- */
- short sl = SubObjSelLevel;
- isave->BeginChunk(SEL_LEVEL_CHUNK);
- isave->Write(&sl,sizeof(short),&nb);
- isave->EndChunk();
-
- return IO_OK;
-}
-
-IOResult SkinModifierClass::Load(ILoad * iload)
-{
- Modifier::Load(iload);
-
- IOResult res;
- ULONG nb;
- int level = -1;
-
- while (IO_OK==(res=iload->OpenChunk())) {
-
- switch (iload->CurChunkID()) {
-
- case SEL_LEVEL_CHUNK: {
- short sl;
- res = iload->Read(&sl,sizeof(short),&nb);
- SubObjSelLevel = sl;
- }
- break;
- }
-
- iload->CloseChunk();
-
- if (res!=IO_OK) {
- return res;
- }
- }
- return IO_OK;
-}
-
-IOResult SkinModifierClass::SaveLocalData(ISave *isave, LocalModData *ld)
-{
- SkinDataClass * skindata = (SkinDataClass *)ld;
-
- return skindata->Save(isave);
-}
-
-IOResult SkinModifierClass::LoadLocalData(ILoad *iload, LocalModData **pld)
-{
- /*
- ** Create a new SkinDataClass
- */
- if (*pld==NULL) {
- *pld = (SkinDataClass *) new SkinDataClass();
- }
- SkinDataClass * newskin = (SkinDataClass *)*pld;
-
- /*
- ** Initialize it from ILoad...
- */
- return newskin->Load(iload);
-}
-
-
-void SkinModifierClass::ActivateSubobjSel(int level, XFormModes & modes)
-{
- /*
- ** Storing the current sub-object selection level
- */
- SubObjSelLevel = level;
-
- /*
- ** Set the appropriate command mode. We only want selection.
- */
- switch (SubObjSelLevel)
- {
- case OBJECT_SEL_LEVEL:
- Remove_Bone_Influence_Dialog();
- break;
-
- case VERTEX_SEL_LEVEL: // Modifying Vertices
- modes = XFormModes(NULL,NULL,NULL,NULL,NULL,SelectMode);
- Install_Bone_Influence_Dialog();
- break;
- }
-
- /*
- ** Put our named subobject selection sets into the drop down list
- */
- Create_Named_Selection_Sets();
-
- /*
- ** Notify our dependents that the subselection type,
- ** and the display have changed
- */
- NotifyDependents(FOREVER, PART_SUBSEL_TYPE|PART_DISPLAY, REFMSG_CHANGE);
-
- /*
- ** Notify the pipeline that the selection level has changed.
- */
- InterfacePtr->PipeSelLevelChanged();
-
- /*
- ** Notify our dependents that the selection channel,
- ** display attributes, and subselection type channels have changed
- */
- NotifyDependents(FOREVER, SELECT_CHANNEL|DISP_ATTRIB_CHANNEL|SUBSEL_TYPE_CHANNEL, REFMSG_CHANGE);
-}
-
-int SkinModifierClass::HitTest
-(
- TimeValue t,
- INode * inode,
- int type,
- int crossing,
- int flags,
- IPoint2 * p,
- ViewExp * vpt,
- ModContext * mc
-)
-{
- Interval valid = FOREVER;
- int needsdel;
- int savedLimits;
- int res = 0;
- HitRegion hr;
- Matrix3 mat;
-
- MakeHitRegion(hr,type, crossing,4,p);
- mat = inode->GetObjectTM(t);
-
- /*
- ** Set up the graphics window to do the hit test
- */
- GraphicsWindow *gw = vpt->getGW();
- gw->setHitRegion(&hr);
- gw->setTransform(mat);
- gw->setRndLimits(((savedLimits = gw->getRndLimits()) | GW_PICK) & ~GW_ILLUM);
-
- if (1 /*IgnoreBackfaces*/) {
- gw->setRndLimits(gw->getRndLimits() | GW_BACKCULL);
- } else {
- gw->setRndLimits(gw->getRndLimits() & ~GW_BACKCULL);
- }
-
- gw->clearHitCode();
-
- /*
- ** Do the hit test!
- */
- SubObjHitList hitlist;
- MeshSubHitRec * rec;
-
- ObjectState os = inode->EvalWorldState(InterfacePtr->GetTime());
- TriObject * tobj = Get_Tri_Object(InterfacePtr->GetTime(),os,valid,needsdel);
- res = tobj->mesh.SubObjectHitTest(gw,gw->getMaterial(),&hr,flags | SUBHIT_VERTS,hitlist);
-
- /*
- ** Record all of the hits
- */
- rec = hitlist.First();
- while (rec)
- {
- /*
- ** rec->index is the index of vertex which was hit!
- ** Remember that we are always turning on vertex hit testing;
- ** if we were testing for edges, index would be the edge index.
- */
- vpt->LogHit(inode,mc,rec->dist,rec->index,NULL);
- rec = rec->Next();
- }
-
- /*
- ** Cleanup
- */
- gw->setRndLimits(savedLimits);
-
- if (needsdel) {
- tobj->DeleteThis();
- }
-
- return res;
-}
-
-void SkinModifierClass::SelectSubComponent(HitRecord *hitRec, BOOL selected, BOOL all, BOOL invert)
-{
- SkinDataClass * skindata = NULL;
- int count = 0;
-
- switch (SubObjSelLevel) {
-
- case VERTEX_SEL_LEVEL:
-
- while (hitRec) {
-
- skindata = (SkinDataClass *)hitRec->modContext->localData;
-
- /*
- ** Undo/Redo functionality
- */
-#if 0
- if (theHold.Holding() && !SelData->held) {
- theHold.Put(new SubSelRestore(this,SelData));
- }
- theHold.Accept(_T("Select Vertex"));
-#endif
-
- BitArray * array = &(skindata->VertSel);
-
- if (all & invert) {
-
- /*
- ** hitRec->hitInfo is the MeshSubHitRec::index that was stored in the
- ** HitTest method through LogHit
- */
- if ((*array)[hitRec->hitInfo]) {
- array->Clear(hitRec->hitInfo);
- } else {
- array->Set(hitRec->hitInfo,selected);
- }
- } else {
- array->Set(hitRec->hitInfo,selected);
- }
-
- if (!all) break;
- hitRec = hitRec->Next();
- }
- break;
- }
-
- NotifyDependents(FOREVER, PART_SELECT, REFMSG_CHANGE);
-}
-
-void SkinModifierClass::ClearSelection(int selLevel)
-{
- int needsdel = 0;
- Interval valid = FOREVER;
- ModContextList mcList;
- INodeTab nodes;
-
- if (!InterfacePtr ) return;
-
- InterfacePtr->GetModContexts(mcList,nodes);
- InterfacePtr->ClearCurNamedSelSet();
-
- for (int i = 0; i < mcList.Count(); i++) {
-
- SkinDataClass * skindata = (SkinDataClass *)mcList[i]->localData;
-
- if (skindata==NULL) continue;
-
- ObjectState os = nodes[i]->EvalWorldState(InterfacePtr->GetTime());
- TriObject * tobj = Get_Tri_Object(InterfacePtr->GetTime(),os,valid,needsdel);
-
- switch (SubObjSelLevel) {
-#if 0
- case OBJECT_SEL_LEVEL:
- assert(0);
- return;
-#endif
-
- case VERTEX_SEL_LEVEL:
-#if 0 // undo/redo
- if (theHold.Holding()) {
- theHold.Put(new VertexSelRestore(meshData,this));
- }
-#endif
- tobj->mesh.vertSel.ClearAll();
- skindata->VertSel.ClearAll();
- break;
- }
-
- if (needsdel) {
- tobj->DeleteThis();
- }
- }
-
- /*
- ** Get rid of the temporary copies of the INodes.
- */
- nodes.DisposeTemporary();
-
- /*
- ** Tell our dependents that the selection set has changed
- */
- NotifyDependents(FOREVER, PART_SELECT, REFMSG_CHANGE);
-
-}
-
-void SkinModifierClass::SelectAll(int selLevel)
-{
- int needsdel = 0;
- Interval valid = FOREVER;
- ModContextList mclist;
- INodeTab nodes;
-
- if (!InterfacePtr) return;
-
- InterfacePtr->GetModContexts(mclist,nodes);
- InterfacePtr->ClearCurNamedSelSet();
-
- for (int i = 0; i < mclist.Count(); i++) {
-
- SkinDataClass * skindata = (SkinDataClass *)mclist[i]->localData;
-
- if (skindata==NULL) continue;
-
- ObjectState os = nodes[i]->EvalWorldState(InterfacePtr->GetTime());
- TriObject * tobj = Get_Tri_Object(InterfacePtr->GetTime(),os,valid,needsdel);
-
- switch (SubObjSelLevel) {
-
- case OBJECT_SEL_LEVEL:
- assert(0);
- return;
-
- case VERTEX_SEL_LEVEL:
-#if 0 // undo/redo
- if (theHold.Holding()) {
- theHold.Put(new VertexSelRestore(meshData,this));
- }
-#endif
- tobj->mesh.vertSel.SetAll();
- skindata->VertSel.SetAll();
- break;
- }
-
- if (needsdel) {
- tobj->DeleteThis();
- }
- }
-
- /*
- ** Get rid of the temporary copies of the INodes.
- */
- nodes.DisposeTemporary();
-
- /*
- ** Tell our dependents that the selection set has changed
- */
- NotifyDependents(FOREVER, PART_SELECT, REFMSG_CHANGE);
-}
-
-void SkinModifierClass::InvertSelection(int selLevel)
-{
- int needsdel = 0;
- Interval valid = FOREVER;
- ModContextList mclist;
- INodeTab nodes;
-
- if (!InterfacePtr) return;
-
- InterfacePtr->GetModContexts(mclist,nodes);
- InterfacePtr->ClearCurNamedSelSet();
-
- for (int i = 0; i < mclist.Count(); i++) {
-
- SkinDataClass * skindata = (SkinDataClass *)mclist[i]->localData;
-
- if (skindata==NULL) continue;
-
- ObjectState os = nodes[i]->EvalWorldState(InterfacePtr->GetTime());
- TriObject * tobj = Get_Tri_Object(InterfacePtr->GetTime(),os,valid,needsdel);
-
- switch (SubObjSelLevel) {
-
- case OBJECT_SEL_LEVEL:
- assert(0);
- return;
-
- case VERTEX_SEL_LEVEL:
-#if 0 // undo/redo
- if (theHold.Holding()) {
- theHold.Put(new VertexSelRestore(meshData,this));
- }
-#endif
- for (int j=0; jmesh.vertSel.GetSize(); j++) {
- if (tobj->mesh.vertSel[j]) tobj->mesh.vertSel.Clear(j);
- else tobj->mesh.vertSel.Set(j);
- }
- skindata->VertSel = tobj->mesh.vertSel;
- break;
- }
-
- if (needsdel) {
- tobj->DeleteThis();
- }
- }
-
- /*
- ** Get rid of the temporary copies of the INodes.
- */
- nodes.DisposeTemporary();
-
- /*
- ** Tell our dependents that the selection set has changed
- */
- NotifyDependents(FOREVER, PART_SELECT, REFMSG_CHANGE);
-
-}
-
-void SkinModifierClass::User_Picked_Bone(INode * node)
-{
- assert(InterfacePtr != NULL);
-
- /*
- ** Get a pointer to the ModContext and SkinData for
- ** the mesh currently being messed with.
- */
- ModContext * mc = NULL;
- ModContextList mclist;
- INodeTab nodelist;
-
- InterfacePtr->GetModContexts(mclist,nodelist);
-
- /*
- ** This seems wrong... But I always get only one ModContext and
- ** it is the one that I want so I'll just use it...
- ** I believe that OS Modifiers can get multiple ones but WS modifiers
- ** don't
- */
- mc = mclist[0];
- assert(mc != NULL);
- SkinDataClass * skindata = (SkinDataClass *)(mc->localData);
-
- /*
- ** Add this bone to the influences of all selected vertices
- */
- int boneidx = WSMObjectRef->Find_Bone(node);
- assert(boneidx != -1);
- skindata->Add_Influence(boneidx);
-
- /*
- ** Recreate all of the named selection sets!
- */
- Create_Named_Selection_Sets();
-
- /*
- ** Update dependents and redraw the views.
- */
- NotifyDependents(FOREVER, PART_ALL, REFMSG_CHANGE);
- InterfacePtr->RedrawViews(InterfacePtr->GetTime());
-}
-
-void SkinModifierClass::User_Picked_Bones(INodeTab & nodetab)
-{
- /*
- ** One by one, add the selected bones to the influences of
- ** all selected vertices.
- */
- for (int i=0; iGetModContexts(mclist,nodes);
-
- for (int i = 0; i < mclist.Count(); i++) {
-
- SkinDataClass * skindata = (SkinDataClass *)mclist[i]->localData;
- if (!skindata) continue;
-
- int index = skindata->VertSelSets.Find_Set(setname);
- if (index < 0) continue;
-
- int needsdel;
- Interval valid;
- ObjectState os = nodes[i]->EvalWorldState(InterfacePtr->GetTime());
- TriObject * tobj = Get_Tri_Object(InterfacePtr->GetTime(),os,valid,needsdel);
- Mesh * mesh = &(tobj->mesh);
-
- // TODO: undo redo
-#if 0
- if (theHold.Holding()) {
- theHold.Put(new VertexSelRestore(meshData,this));
- }
-#endif
-
- if (skindata->VertSelSets[index].GetSize() != mesh->getNumVerts()) {
- skindata->VertSelSets[index].SetSize(mesh->getNumVerts(),TRUE);
- }
- mesh->vertSel = skindata->VertSelSets[index];
- skindata->VertSel = mesh->vertSel;
-
- if (needsdel) {
- tobj->DeleteThis();
- }
- }
-
- nodes.DisposeTemporary();
-
- NotifyDependents(FOREVER, PART_SELECT, REFMSG_CHANGE);
- InterfacePtr->RedrawViews(InterfacePtr->GetTime());
-}
-
-void SkinModifierClass::NewSetFromCurSel(TSTR &setname)
-{
- Install_Named_Selection_Sets();
-}
-
-void SkinModifierClass::RemoveSubSelSet(TSTR &setname)
-{
- Install_Named_Selection_Sets();
-}
-
-void SkinModifierClass::Create_Named_Selection_Sets(void)
-{
- /*
- ** This function creates a named selection set of vertices
- ** for each bone in the skeleton.
- */
- if (InterfacePtr == NULL) return;
-
- SkinWSMObjectClass * skinobj = WSMObjectRef;
- if (skinobj == NULL) return;
-
- ModContextList mclist;
- INodeTab nodes;
- InterfacePtr->GetModContexts(mclist,nodes);
- SkinDataClass * skindata = (SkinDataClass *)mclist[0]->localData;
- if (skindata == NULL) return;
-
- /*
- ** Clear out the old selection sets
- */
- skindata->VertSelSets.Reset();
-
- /*
- ** Create and add a set for each bone
- */
- for (int boneidx = 0; boneidx < skinobj->Num_Bones(); boneidx++) {
-
- if (skinobj->Get_Bone(boneidx) != NULL) {
- BitArray boneverts;
- boneverts.SetSize(skindata->VertData.Count());
-
- for (int vertidx = 0; vertidx < skindata->VertData.Count(); vertidx++) {
- if (skindata->VertData[vertidx].BoneIdx[0] == boneidx) boneverts.Set(vertidx);
- else boneverts.Clear(vertidx);
- }
-
- TSTR bonename = skinobj->Get_Bone(boneidx)->GetName();
-
- skindata->VertSelSets.Append_Set(boneverts,bonename);
- }
- }
-
- Install_Named_Selection_Sets();
-
- nodes.DisposeTemporary();
-}
-
-void SkinModifierClass::Install_Named_Selection_Sets(void)
-{
- /*
- ** If we are in sub-object selection mode add the sets
- ** to the drop down box.
- */
- if ((SubObjSelLevel == VERTEX_SEL_LEVEL) && (InterfacePtr != NULL)) {
-
- ModContextList mclist;
- INodeTab nodes;
- InterfacePtr->GetModContexts(mclist,nodes);
- SkinDataClass * skindata = (SkinDataClass *)mclist[0]->localData;
- if (skindata == NULL) return;
-
- InterfacePtr->ClearSubObjectNamedSelSets();
- for (int i=0; i < skindata->VertSelSets.Count(); i++) {
- InterfacePtr->AppendSubObjectNamedSelSet(*skindata->VertSelSets.Names[i]);
- }
-
- nodes.DisposeTemporary();
- }
-}
-
-void SkinModifierClass::Auto_Attach_Verts(BOOL all)
-{
- assert(InterfacePtr);
-
- /*
- ** Get the skin data.
- */
- ModContextList mclist;
- INodeTab nodes;
- InterfacePtr->GetModContexts(mclist,nodes);
- SkinDataClass * skindata = (SkinDataClass *)mclist[0]->localData;
- if (skindata == NULL) return;
-
- /*
- ** get the skin WSM object.
- */
- SkinWSMObjectClass * skinobj = WSMObjectRef;
- if (skinobj == NULL) return;
-
- /*
- ** Get a triobject representing the object state in the base pose.
- */
- Interval valid;
- BOOL needsdel;
-
- TimeValue basetime = WSMObjectRef->Get_Base_Pose_Time();
- ObjectState os = nodes[0]->EvalWorldState(basetime);
- TriObject * triobj = Get_Tri_Object(basetime,os,valid,needsdel);
-
- /*
- ** Attach each selected vertex (or all of them) to their closest bone.
- */
- for (int vertidx = 0; vertidx < skindata->VertData.Count(); vertidx++){
- if (skindata->VertSel[vertidx] || all) {
-
- Point3 vert = triobj->GetPoint(vertidx);
- if (os.GetTM()) vert = vert * (*os.GetTM());
- int boneidx = skinobj->Find_Closest_Bone(vert);
- skindata->VertData[vertidx].Set_Influence(boneidx);
- }
- }
-
- /*
- ** Re-create the named selection sets
- */
- Create_Named_Selection_Sets();
-
- /*
- ** Update dependents and redraw the views.
- */
- NotifyDependents(FOREVER, PART_ALL, REFMSG_CHANGE);
- InterfacePtr->RedrawViews(InterfacePtr->GetTime());
-
- /*
- ** Cleanup...
- */
- nodes.DisposeTemporary();
-
- if (needsdel) {
- triobj->DeleteThis();
- }
-}
-
-void SkinModifierClass::Unlink_Verts(void)
-{
- assert(InterfacePtr);
-
- /*
- ** Get the skin data.
- */
- ModContextList mclist;
- INodeTab nodes;
- InterfacePtr->GetModContexts(mclist,nodes);
- SkinDataClass * skindata = (SkinDataClass *)mclist[0]->localData;
- if (skindata == NULL) return;
-
- /*
- ** Unlink each selected vertex (give them bone index -1)
- */
- for (int vertidx = 0; vertidx < skindata->VertData.Count(); vertidx++){
- if (skindata->VertSel[vertidx]) {
- skindata->VertData[vertidx].Set_Influence(-1);
- }
- }
-
- /*
- ** Re-create the named selection sets
- */
- Create_Named_Selection_Sets();
-
- /*
- ** Update dependents and redraw the views.
- */
- NotifyDependents(FOREVER, PART_ALL, REFMSG_CHANGE);
- InterfacePtr->RedrawViews(InterfacePtr->GetTime());
-
- /*
- ** Cleanup...
- */
- nodes.DisposeTemporary();
-}
-
-
-/****************************************************************************
-**
-** DIALOG BOX JUNK
-**
-****************************************************************************/
-
-void SkinModifierClass::Install_Bone_Influence_Dialog(void)
-{
- if (BoneInfluenceHWND != NULL) return;
-
- /*
- ** loading resource string for the name of the dialog
- */
- static int loaded = 0;
- static TCHAR string[MAX_STRING_LENGTH];
-
- if (!loaded) {
- LoadString(AppInstance,IDS_BONE_INFLUENCE_PARAMS,string,MAX_STRING_LENGTH);
- loaded = 1;
- }
-
- /*
- ** Put up the UI that is used to assign vertices to bones
- */
- BoneInfluenceHWND = InterfacePtr->AddRollupPage(
- AppInstance,
- MAKEINTRESOURCE(IDD_BONE_INFLUENCE_PARAMS),
- _bone_influence_dialog_thunk,
- string,
- (LPARAM)this,
- 0);
-}
-
-void SkinModifierClass::Remove_Bone_Influence_Dialog(void)
-{
- /*
- ** If it is currently up, remove the bone influences dialog
- */
- if (BoneInfluenceHWND != NULL) {
- InterfacePtr->UnRegisterDlgWnd(BoneInfluenceHWND);
- InterfacePtr->DeleteRollupPage(BoneInfluenceHWND);
- BoneInfluenceHWND = NULL;
- }
-}
-
-/*********************************************************************************
-*
-* _sot_dialog_proc
-*
-*********************************************************************************/
-static BOOL CALLBACK _sot_dialog_proc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam)
-{
- IObjParam *ip = (IObjParam*)GetWindowLong(hWnd,GWL_USERDATA);
-
- switch (message) {
- case WM_INITDIALOG:
- SetWindowLong(hWnd,GWL_USERDATA,lParam);
- break;
-
- case WM_LBUTTONDOWN:
- case WM_LBUTTONUP:
- case WM_MOUSEMOVE:
- if (ip) ip->RollupMouseMessage(hWnd,message,wParam,lParam);
- return FALSE;
-
- default:
- return FALSE;
- }
- return TRUE;
-}
-
-
-/*********************************************************************************
-*
-* _skeleton_dialog_proc
-*
-*********************************************************************************/
-static BOOL CALLBACK _skeleton_dialog_thunk(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam)
-{
- SkinWSMObjectClass * skinobj = (SkinWSMObjectClass *)GetWindowLong(hWnd,GWL_USERDATA);
- if (!skinobj && message != WM_INITDIALOG) return FALSE;
-
- if (message == WM_INITDIALOG) {
- skinobj = (SkinWSMObjectClass *)lParam;
- SetWindowLong(hWnd,GWL_USERDATA,(LONG)skinobj);
- }
-
- return skinobj->Skeleton_Dialog_Proc(hWnd,message,wParam,lParam);
-}
-
-BOOL SkinWSMObjectClass::Skeleton_Dialog_Proc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam)
-{
- switch (message) {
-
- case WM_INITDIALOG:
-
- BoneListHWND = GetDlgItem(hWnd,IDC_BONE_LIST);
-
- /*
- ** Intitialize the add bone and remove bone check buttons
- */
- AddBonesButton = GetICustButton(GetDlgItem(hWnd, IDC_ADD_BONES_BUTTON));
- RemoveBonesButton = GetICustButton(GetDlgItem(hWnd, IDC_REMOVE_BONES_BUTTON));
-
- AddBonesButton->SetType(CBT_CHECK);
- AddBonesButton->SetHighlightColor(GREEN_WASH);
- AddBonesButton->SetTooltip(TRUE, _T("Add bones by name"));
-
- RemoveBonesButton->SetType(CBT_CHECK);
- RemoveBonesButton->SetHighlightColor(GREEN_WASH);
- RemoveBonesButton->SetTooltip(TRUE, _T("Remove bones by name"));
-
- /*
- ** Initialize the "Base Pose Frame" spinner
- */
- BasePoseSpin = GetISpinner(GetDlgItem(hWnd, IDC_BASE_POSE_SPIN));
- BasePoseSpin->SetLimits(0,9999, FALSE);
- BasePoseSpin->SetValue(0,FALSE);
- BasePoseSpin->SetResetValue(0);
- BasePoseSpin->LinkToEdit(GetDlgItem(hWnd,IDC_BASE_POSE_EDIT),EDITTYPE_INT);
- return TRUE;
-
- case WM_DESTROY:
- ReleaseICustButton(AddBonesButton);
- ReleaseICustButton(RemoveBonesButton);
- ReleaseISpinner(BasePoseSpin);
-
- AddBonesButton = NULL;
- RemoveBonesButton = NULL;
- BasePoseSpin = NULL;
- BoneListHWND = NULL;
-
- return FALSE;
-
- case CC_SPINNER_CHANGE:
- switch (LOWORD(wParam))
- {
- case IDC_BASE_POSE_SPIN:
- BasePoseFrame = BasePoseSpin->GetIVal();
- break;
- }
- NotifyDependents(FOREVER, PART_ALL, REFMSG_CHANGE);
- InterfacePtr->RedrawViews(InterfacePtr->GetTime(),REDRAW_INTERACTIVE);
- return TRUE;
-
- case CC_SPINNER_BUTTONUP:
- NotifyDependents(FOREVER, PART_ALL, REFMSG_CHANGE);
- InterfacePtr->RedrawViews(InterfacePtr->GetTime(),REDRAW_END);
- return TRUE;
-
-
- case WM_LBUTTONDOWN:
- case WM_LBUTTONUP:
- case WM_MOUSEMOVE:
- InterfacePtr->RollupMouseMessage(hWnd,message,wParam,lParam);
- return FALSE;
-
- case WM_COMMAND:
- switch (LOWORD(wParam))
- {
-
- case IDC_ADD_BONES_BUTTON:
- TheBonePicker.Set_User(this);
- Set_Bone_Selection_Mode(BONE_SEL_MODE_ADD_MANY);
- InterfacePtr->DoHitByNameDialog(&TheBonePicker);
- Set_Bone_Selection_Mode(BONE_SEL_MODE_NONE);
- break;
-
- case IDC_REMOVE_BONES_BUTTON:
- TheBonePicker.Set_User(this,FALSE,&(BoneTab));
- Set_Bone_Selection_Mode(BONE_SEL_MODE_REMOVE_MANY);
- InterfacePtr->DoHitByNameDialog(&TheBonePicker);
- Set_Bone_Selection_Mode(BONE_SEL_MODE_NONE);
- break;
- }
-
- default:
- return FALSE;
- }
-}
-
-/*********************************************************************************
-*
-* Bone_Influence_Dialog_Proc
-*
-*********************************************************************************/
-static BOOL CALLBACK _bone_influence_dialog_thunk(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam)
-{
- SkinModifierClass * skinmod = (SkinModifierClass *)GetWindowLong(hWnd,GWL_USERDATA);
- if (!skinmod && message != WM_INITDIALOG) return FALSE;
-
- if (message == WM_INITDIALOG) {
- skinmod = (SkinModifierClass *)lParam;
- SetWindowLong(hWnd,GWL_USERDATA,(LONG)skinmod);
- }
-
- return skinmod->Bone_Influence_Dialog_Proc(hWnd,message,wParam,lParam);
-}
-
-
-BOOL SkinModifierClass::Bone_Influence_Dialog_Proc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam)
-{
- switch (message) {
-
- case WM_INITDIALOG:
- /*
- ** Intitialize the bone influence buttons
- */
- LinkButton = GetICustButton(GetDlgItem(hWnd, IDC_LINK_BUTTON));
- LinkByNameButton = GetICustButton(GetDlgItem(hWnd, IDC_LINK_BY_NAME_BUTTON));
- AutoLinkButton = GetICustButton(GetDlgItem(hWnd, IDC_AUTO_LINK_BUTTON));
- UnLinkButton = GetICustButton(GetDlgItem(hWnd, IDC_UNLINK_BUTTON));
-
- LinkButton->SetType(CBT_PUSH);
- LinkButton->SetTooltip(TRUE, _T("Link Vertices to a bone by selecting the bone"));
-
- LinkByNameButton->SetType(CBT_PUSH);
- LinkByNameButton->SetTooltip(TRUE, _T("Link Vertices to a bone by name"));
-
- AutoLinkButton->SetType(CBT_PUSH);
- AutoLinkButton->SetTooltip(TRUE, _T("Link Vertices to nearest bone"));
-
- UnLinkButton->SetType(CBT_PUSH);
- UnLinkButton->SetTooltip(TRUE, _T("Unlink selected vertices"));
-
- return TRUE;
-
- case WM_DESTROY:
- ReleaseICustButton(LinkButton);
- ReleaseICustButton(LinkByNameButton);
- ReleaseICustButton(AutoLinkButton);
- ReleaseICustButton(UnLinkButton);
-
- LinkButton = NULL;
- LinkByNameButton = NULL;
- AutoLinkButton = NULL;
- UnLinkButton = NULL;
- return FALSE;
-
- case WM_LBUTTONDOWN:
- case WM_LBUTTONUP:
- case WM_MOUSEMOVE:
- InterfacePtr->RollupMouseMessage(hWnd,message,wParam,lParam);
- return FALSE;
-
- case WM_COMMAND:
- switch (LOWORD(wParam))
- {
- case IDC_LINK_BUTTON:
- {
- /*
- ** user picks a bone out of the scene to link to.
- */
- assert(WSMObjectRef != NULL);
- INodeTab * bonetab = &(WSMObjectRef->Get_Bone_List());
- TheBonePicker.Set_User(this,TRUE,bonetab);
- InterfacePtr->SetPickMode(&TheBonePicker);
- break;
- }
-
- case IDC_LINK_BY_NAME_BUTTON:
- {
- /*
- ** pop up a bone selection dialog
- */
- assert(WSMObjectRef != NULL);
- INodeTab * bonetab = &(WSMObjectRef->Get_Bone_List());
- TheBonePicker.Set_User(this,TRUE,bonetab);
- InterfacePtr->DoHitByNameDialog(&TheBonePicker);
- break;
- }
-
- case IDC_AUTO_LINK_BUTTON:
- {
- Auto_Attach_Verts();
- break;
- }
-
- case IDC_UNLINK_BUTTON:
- {
- Unlink_Verts();
- break;
- }
- }
-
- default:
- return FALSE;
- }
-}
-
-static TriObject * Get_Tri_Object(TimeValue t,ObjectState & os,Interval & valid,BOOL & needsdel)
-{
- needsdel = FALSE;
- valid &= os.Validity(t);
-
- if (os.obj->IsSubClassOf(triObjectClassID)) {
- return (TriObject *)os.obj;
- } else {
- if (os.obj->CanConvertToType(triObjectClassID)) {
- Object * oldObj = os.obj;
- TriObject * tobj = (TriObject *)os.obj->ConvertToType(t,triObjectClassID);
- needsdel = (tobj != oldObj);
- return tobj;
- }
- }
- return NULL;
-}
-
-
-float Bone_Distance(INode * bone,TimeValue time,const Point3 & vertex)
-{
- /*
- ** Average the pivot point of this bone with the pivot points of
- ** all of its children.
- */
- Point3 icenter = bone->GetObjectTM(time).GetTrans();
-
- for (int ci=0; ciNumberOfChildren(); ci++) {
- icenter += bone->GetChildNode(ci)->GetObjectTM(time).GetTrans();
- }
-
- icenter = icenter / (float)(bone->NumberOfChildren() + 1);
-
- return Length(icenter - vertex);
-}
-
-#if defined W3D_MAX4 //defined as in the project (.dsp)
-
-int SkinModifierClass::NumSubObjTypes()
-{
- return 1;
-}
-////////////////////////////////////////////////////////////////////////////////////////
-ISubObjType *SkinModifierClass::GetSubObjType(int i)
-{
-
- static bool _initialized = false;
- if(!_initialized){
- _initialized = true;
- _SubObjectTypeVertex.SetName("Vertices");
- }
- if(i == -1){
- if(GetSubObjectLevel() > 0){
- return GetSubObjType(GetSubObjectLevel()-1);
- }
- }
- return &_SubObjectTypeVertex;
-}
-#endif
diff --git a/Generals/Code/Tools/WW3D/max2w3d/skin.h b/Generals/Code/Tools/WW3D/max2w3d/skin.h
deleted file mode 100644
index 099881d159f..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/skin.h
+++ /dev/null
@@ -1,405 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Commando Tools - WWSkin *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/skin.h $*
- * *
- * $Author:: Moumine_ballo $*
- * *
- * $Modtime:: 4/18/01 11:31a $*
- * *
- * $Revision:: 8 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#ifndef SKIN_H
-#define SKIN_H
-
-#include
-#include "simpmod.h"
-#include "simpobj.h"
-#include "bpick.h"
-#include "namedsel.h"
-#include "w3d_file.h"
-
-
-#define SKIN_OBJ_CLASS_ID Class_ID(0x32b37e0c, 0x5a9612e4)
-#define SKIN_MOD_CLASS_ID Class_ID(0x6bad4898, 0x0d1d6ced)
-extern ClassDesc * Get_Skin_Obj_Desc();
-extern ClassDesc * Get_Skin_Mod_Desc();
-
-
-/*
-
- Writing a space warp plug-in involves creating instances of two key classes.
- One is derived from class WSMObject. (WSMObject stands for Word Space Modifier Object,
- just another name for Space Warp Object). The other class is subclassed off Modifier.
- These two classes work together. The space warp object handles the display and management
- of its user interface parameters, the display of the space warp node in the scene, and
- provides a world space orientation. The space warp modifier handles the actual deformation
- of the geometry of nodes bound to the space warp. Each node bound to the space warp
- will have a ModContext which we will store data in.
-
- The following class is the WSMObject for the westwood skin modifier.
-
-*/
-class SkinWSMObjectClass : public SimpleWSMObject, BonePickerUserClass
-{
-public:
-
- SkinWSMObjectClass();
- virtual ~SkinWSMObjectClass();
-
- /*
- ** From Animatable
- */
- void DeleteThis() { delete this; }
- void BeginEditParams(IObjParam *ip, ULONG flags,Animatable *prev);
- void EndEditParams(IObjParam *ip, ULONG flags,Animatable *next);
- TCHAR * GetObjectName() { return _T("WWSkin"); }
- Class_ID ClassID() { return SKIN_OBJ_CLASS_ID; }
-
- /*
- ** From ReferenceTarget
- */
- RefTargetHandle Clone(RemapDir& remap = NoRemap());
-
- /*
- ** From Reference Maker. These three functions give access to the "virtual array" of references.
- ** For SkinWSMObjectClass, we have to remember that SimpleWSMObject already has a reference
- ** so we are taking ours on after
- */
- virtual int NumRefs() { return SimpleWSMObject::NumRefs() + Num_Bones();}
- virtual RefTargetHandle GetReference(int i);
- virtual void SetReference(int i, RefTargetHandle rtarg);
- RefResult NotifyRefChanged(Interval changeInt,RefTargetHandle hTarget,PartID& partID, RefMessage message);
-
- /*
- ** From Object
- */
- int DoOwnSelectHilite() { return TRUE; }
- CreateMouseCallBack * GetCreateMouseCallBack();
-
- /*
- ** From WSMObject
- */
- Modifier *CreateWSMMod(INode *node);
-
- /*
- ** From SimpleWSMObject
- */
- void BuildMesh(TimeValue t);
-
- /*
- ** Setup a triangle
- */
- void Build_Tri(Face * f, int a, int b, int c);
-
- /*
- ** Dialog box message processing
- */
- BOOL SkinWSMObjectClass::Skeleton_Dialog_Proc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam);
-
- /*
- ** Bone picking.
- */
- virtual void User_Picked_Bone(INode * node);
- virtual void User_Picked_Bones(INodeTab & nodetab);
- void Set_Bone_Selection_Mode(int mode);
-
- int Add_Bone(INode * node);
- void Add_Bones(INodeTab & nodetab);
- void Remove_Bone(INode * node);
- void Remove_Bones(INodeTab & nodetab);
- void Update_Bone_List(void);
-
- /*
- ** Converting between bone indexes and reference indexes
- ** The bone references are a variable number of references which are
- ** added at the end of the reference array.
- */
- int To_Bone_Index(int refidx) { return refidx - SimpleWSMObject::NumRefs(); }
- int To_Ref_Index(int boneidx) { return SimpleWSMObject::NumRefs() + boneidx; }
-
- /*
- ** External access to the bones
- */
- int Num_Bones(void) { return BoneTab.Count(); }
- INode * Get_Bone(int idx) { return BoneTab[idx]; }
- INodeTab & Get_Bone_List(void) { return BoneTab; }
- int Find_Bone(INode * node);
- int Get_Base_Pose_Frame(void) { return BasePoseFrame; }
- int Get_Base_Pose_Time(void) { return BasePoseFrame * GetTicksPerFrame(); }
- int Find_Closest_Bone(const Point3 & vertex);
-
- /*
- ** Saving and loading.
- */
- IOResult Save(ISave *isave);
- IOResult Load(ILoad *iload);
-
- /*
- ** Static UI variables. These have to be static due to the strange way
- ** that MAX behaves during creation of objects. If you create an object
- ** then delete it, EndEditParams is not called and its destructor isn't called...
- */
- static HWND SotHWND;
- static HWND SkeletonHWND;
- static HWND BoneListHWND;
- static IObjParam * InterfacePtr;
- static ICustButton * AddBonesButton;
- static ICustButton * RemoveBonesButton;
- static ISpinnerControl * BasePoseSpin;
-
- /*
- ** flag for whether we need to build the bones mesh for this object
- */
- BOOL MeshBuilt;
-
- /*
- ** Bone Selection!
- */
- enum {
- BONE_SEL_MODE_NONE = 0,
- BONE_SEL_MODE_ADD,
- BONE_SEL_MODE_REMOVE,
- BONE_SEL_MODE_ADD_MANY,
- BONE_SEL_MODE_REMOVE_MANY
- };
-
- int BoneSelectionMode;
- INodeTab BoneTab;
-
- /*
- ** Dialog controls
- */
- int BasePoseFrame;
-
- /*
- ** Chunk ID's
- */
- enum {
- NUM_BONES_CHUNK = 0x0001
- };
-
- /*
- ** Friend functions
- */
- friend BOOL CALLBACK _skeleton_dialog_thunk(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam);
-};
-
-/*
-** SkinModifierClass
-*/
-class SkinModifierClass : public Modifier, BonePickerUserClass
-{
-
-public:
-
- SkinModifierClass(void);
- SkinModifierClass(INode * node,SkinWSMObjectClass * skin_obj);
-#if defined W3D_MAX4 //defined as in the project (.dsp)
- ISubObjType *GetSubObjType(int i);
- int NumSubObjTypes();
-#endif
- void Default_Init(void);
-
- /*
- ** From Animatable
- */
- void DeleteThis() { delete this; }
- void GetClassName(TSTR& s) { s = TSTR(_T("WWSkin")); }
- TCHAR * GetObjectName() { return _T("WWSkin Binding"); }
- SClass_ID SuperClassID() { return WSM_CLASS_ID; }
- Class_ID ClassID() { return SKIN_MOD_CLASS_ID; }
- RefTargetHandle Clone(RemapDir& remap = NoRemap());
- RefResult NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message);
- void BeginEditParams(IObjParam *ip, ULONG flags,Animatable *prev);
- void EndEditParams(IObjParam *ip, ULONG flags,Animatable *next);
- CreateMouseCallBack * GetCreateMouseCallBack() { return NULL; }
-
- /*
- ** From Reference Maker. These three functions give access to the "virtual array" of references.
- */
- int NumRefs() { return 2; }
- RefTargetHandle GetReference(int i);
- void SetReference(int i, RefTargetHandle rtarg);
-
- /*
- ** Tell MAX what channels we use and what channels we change:
- ** Note that if we do not tell max that we use a channel, that channel is not
- ** guaranteed to be valid.
- */
- virtual ChannelMask ChannelsUsed() { return SELECT_CHANNEL|SUBSEL_TYPE_CHANNEL|GEOM_CHANNEL; }
- virtual ChannelMask ChannelsChanged() { return SELECT_CHANNEL|SUBSEL_TYPE_CHANNEL|GEOM_CHANNEL; }
-
- /*
- ** MAX tells us whenever an input changed. If we cache anything, we can use this
- ** function to dump the cached data and regenerate it.
- */
- virtual void NotifyInputChanged(Interval changeInt, PartID partID, RefMessage message, ModContext *mc) {}
-
- /*
- ** This is where the modifier actually modifies the object!
- */
- virtual void ModifyObject(TimeValue t, ModContext & mc, ObjectState * os, INode * node);
-
- /*
- ** Since our modifier will be storing information based on the vertex indices, whenever
- ** the topology of its input is changed things will no longer work correctly. Therefore,
- ** we tell max that we depend on the topology remaining the same.
- */
- virtual BOOL DependOnTopology(ModContext &mc) { return TRUE; }
-
- /*
- ** What types of objects can we modify: The skin modifier will only work with TRIOBJ's
- */
- virtual Class_ID InputType() { return Class_ID(TRIOBJ_CLASS_ID,0); }
-
- /*
- ** Saving and loading. Remember to call the base class's save and load functions as well.
- */
- IOResult Save(ISave *isave);
- IOResult Load(ILoad *iload);
- virtual IOResult LoadLocalData(ILoad *iload, LocalModData **pld);
- virtual IOResult SaveLocalData(ISave *isave, LocalModData *ld);
-
- /*
- ** For SkinModifierClass, we allow vertex sub-object selection.
- ** This function notifies an object being edited that the current sub object
- ** selection level has changed. level==0 indicates object level selection.
- ** level==1 or greater refer to the types registered by the object in the
- ** order they appeared in the list when registered. If level >= 1, the object
- ** should specify sub-object xform modes in the modes structure (defined in cmdmode.h).
- */
- void ActivateSubobjSel(int level, XFormModes& modes);
-
- int HitTest(TimeValue t, INode* inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt, ModContext* mc);
- void SelectSubComponent(HitRecord *hitRec, BOOL selected, BOOL all, BOOL invert=FALSE);
- void ClearSelection(int selLevel);//
- void SelectAll(int selLevel);
- void InvertSelection(int selLevel);
-
- /*
- ** An object that supports sub-object selection can choose to
- ** support named sub object selection sets. Methods in the the
- ** interface passed to objects allow them to add items to the
- ** sub-object selection set drop down.
- ** The following methods implement named sub-obj selection sets
- */
- virtual BOOL SupportsNamedSubSels() { return TRUE; }
- virtual void ActivateSubSelSet(TSTR &setName);
- virtual void NewSetFromCurSel(TSTR &setName);
- virtual void RemoveSubSelSet(TSTR &setName);
- void Create_Named_Selection_Sets(void);
- void Install_Named_Selection_Sets(void);
-
- WSMObject * Get_WSMObject(void) { return (WSMObject*)GetReference(OBJ_REF); }
- Interval Get_Validity(TimeValue t);
-
- /*
- ** Bone picking
- */
- virtual void User_Picked_Bone(INode * node);
- virtual void User_Picked_Bones(INodeTab & nodetab);
-
- /*
- ** Auto-Attach vertices to nearest bone
- */
- void Auto_Attach_Verts(BOOL all = FALSE);
-
- /*
- ** Unlink selected verts (links them to the root or origin)
- */
- void Unlink_Verts(void);
-
-private:
-
- /*
- ** Windows dialog management and communication functions
- */
- void Install_Bone_Influence_Dialog(void);
- void Remove_Bone_Influence_Dialog(void);
-
- BOOL Bone_Influence_Dialog_Proc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam);
-
-public:
-
- /*
- ** References for SkinModifierClass
- */
- enum {
- OBJ_REF = 0,
- NODE_REF = 1
- };
-
- SkinWSMObjectClass * WSMObjectRef;
- INode * WSMNodeRef;
-
- /*
- ** Sub-Object Selection variables
- */
- enum {
- OBJECT_SEL_LEVEL = 0,
- VERTEX_SEL_LEVEL = 1
- };
-
- int SubObjSelLevel;
-
-
- /*
- ** Bone Influence Dialog panel variables
- */
- HWND BoneInfluenceHWND;
- ICustButton * LinkButton;
- ICustButton * LinkByNameButton;
- ICustButton * AutoLinkButton;
- ICustButton * UnLinkButton;
-
- /*
- ** Cached pointers to some MAX objects
- */
- IObjParam * InterfacePtr;
- SelectModBoxCMode * SelectMode;
-
- /*
- ** Load/Save Chunk ID's
- */
- enum {
- SEL_LEVEL_CHUNK = 0xAA01,
- };
-
- /*
- ** Friend "thunking" functions for the dialog handling.
- */
- friend BOOL CALLBACK _bone_influence_dialog_thunk(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam);
-};
-
-
-
-
-#endif
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/skindata.cpp b/Generals/Code/Tools/WW3D/max2w3d/skindata.cpp
deleted file mode 100644
index 3c690cad082..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/skindata.cpp
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/* $Header: /Commando/Code/Tools/max2w3d/skindata.cpp 7 5/28/98 12:15p Greg_h $ */
-/***********************************************************************************************
- *** Confidential - Westwood Studios ***
- ***********************************************************************************************
- * *
- * Project Name : Commando Tools - WWSkin *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/skindata.cpp $*
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 5/28/98 12:15p $*
- * *
- * $Revision:: 7 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * SkinDataClass::Save -- save the skindata in the MAX file *
- * SkinDataClass::Load -- load the skindata from a MAX file *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#include "skindata.h"
-
-
-/***********************************************************************************************
- * SkinDataClass::Save -- save the skindata in the MAX file *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/26/1997 GH : Created. *
- *=============================================================================================*/
-IOResult SkinDataClass::Save(ISave *isave)
-{
- ULONG nb;
-
- /*
- ** save the flags
- */
- short flags = 0;
- if (Valid) flags |= 0x01;
- if (Held) flags |= 0x02;
-
- isave->BeginChunk(FLAGS_CHUNK);
- isave->Write(&flags,sizeof(flags),&nb);
- isave->EndChunk();
-
- /*
- ** Save the bit array of currently selected vertices
- */
- if (VertSel.NumberSet() > 0) {
- isave->BeginChunk(VERT_SEL_CHUNK);
- VertSel.Save(isave);
- isave->EndChunk();
- }
-
- /*
- ** Save the named selection sets of vertices
- */
-#if 0
- if (VertSelSets.Count() > 0) {
- isave->BeginChunk(INFLUENCE_DATA_CHUNK);
- VertSelSets.Save(isave);
- isave->EndChunk();
- }
-#endif
-
- /*
- ** Save the vertex influence data
- */
- if (VertData.Count() > 0) {
- isave->BeginChunk(INFLUENCE_DATA_CHUNK);
- isave->Write(VertData.Addr(0),VertData.Count() * sizeof(InfluenceStruct), &nb);
- isave->EndChunk();
- }
-
- return IO_OK;
-}
-
-
-/***********************************************************************************************
- * SkinDataClass::Load -- load the skindata from a MAX file *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/26/1997 GH : Created. *
- *=============================================================================================*/
-IOResult SkinDataClass::Load(ILoad *iload)
-{
- ULONG nb;
- short flags;
- int n;
- IOResult res;
-
- while (IO_OK == (res=iload->OpenChunk())) {
-
- switch (iload->CurChunkID()) {
-
- case FLAGS_CHUNK:
- res = iload->Read(&flags,sizeof(flags),&nb);
- Valid = (flags & 0x01);
- Held = (flags & 0x02);
- break;
-
- case VERT_SEL_CHUNK:
- res = VertSel.Load(iload);
- break;
-
- case NAMED_SEL_SETS_CHUNK:
- res = VertSelSets.Load(iload);
- break;
-
- case INFLUENCE_DATA_CHUNK:
- n = iload->CurChunkLength() / sizeof(InfluenceStruct);
- VertData.SetCount(n);
- res = iload->Read(VertData.Addr(0),n*sizeof(InfluenceStruct),&nb);
- break;
- }
-
- iload->CloseChunk();
-
- if (res != IO_OK) {
- return res;
- }
- }
-
- /*
- ** ensure that the arrays are sized correctly
- */
- Invalidate();
-
- return IO_OK;
-}
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/skindata.h b/Generals/Code/Tools/WW3D/max2w3d/skindata.h
deleted file mode 100644
index a7638befc48..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/skindata.h
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/* $Header: /Commando/Code/Tools/max2w3d/skindata.h 6 10/28/97 6:08p Greg_h $ */
-/***********************************************************************************************
- *** Confidential - Westwood Studios ***
- ***********************************************************************************************
- * *
- * Project Name : Commando Tools - WWSkin *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/skindata.h $*
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 10/21/97 2:04p $*
- * *
- * $Revision:: 6 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#ifndef SKINDATA_H
-#define SKINDATA_H
-
-#include "max.h"
-#include "namedsel.h"
-
-/*
-** InfluenceStruct - structure which stores the bone
-** influence information for a single vertex.
-*/
-struct InfluenceStruct
-{
- /*
- ** vertices can be influenced by up to two bones.
- */
- int BoneIdx[2];
- float BoneWeight[2];
-
- InfluenceStruct(void) { BoneIdx[0] = -1; BoneIdx[1] = -1; BoneWeight[0] = 1.0f; BoneWeight[1] = 0.0f; }
-
- void Set_Influence(int boneidx) {
- // TODO: make this actually let you set two bones with
- // weighting values. Need UI to furnish this info...
- BoneIdx[0] = boneidx;
- }
-};
-
-
-/*
-** SkinDataClass - a class which contains the bone influence data
-** for the modifier. One of these will be hung off of the
-** ModContext...
-*/
-class SkinDataClass : public LocalModData
-{
-
-public:
-
- SkinDataClass(void) { Held = FALSE; Valid = FALSE; }
-
- SkinDataClass(Mesh *mesh)
- {
- VertSel = mesh->vertSel;
- VertData.SetCount(mesh->getNumVerts());
- for (int i=0; ivertSel.GetSize(),1);
- VertData.SetCount(mesh->getNumVerts());
- Valid = TRUE;
- }
- }
-
- virtual LocalModData * Clone(void)
- {
- SkinDataClass * newdata = new SkinDataClass();
- newdata->VertSel = VertSel;
- newdata->VertData = VertData;
- return newdata;
- }
-
- void Add_Influence(int boneidx)
- {
- /*
- ** Make this INode influence all currently selected vertices
- */
- for (int i=0; i VertData;
-
- /*
- ** Load/Save chunk ID's
- */
- enum {
- FLAGS_CHUNK = 0x0000,
- VERT_SEL_CHUNK = 0x0010,
- NAMED_SEL_SETS_CHUNK = 0x0020,
- INFLUENCE_DATA_CHUNK = 0x0030
- };
-
-};
-
-
-#endif
diff --git a/Generals/Code/Tools/WW3D/max2w3d/util.cpp b/Generals/Code/Tools/WW3D/max2w3d/util.cpp
deleted file mode 100644
index 18136757739..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/util.cpp
+++ /dev/null
@@ -1,622 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-/* $Header: /Commando/Code/Tools/max2w3d/util.cpp 28 10/27/00 4:12p Greg_h $ */
-/***********************************************************************************************
- *** Confidential - Westwood Studios ***
- ***********************************************************************************************
- * *
- * Project Name : Commando Tools - W3D export *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/util.cpp $*
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 10/27/00 1:13p $*
- * *
- * $Revision:: 28 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * Cleanup_Orthogonal_Matrix -- removes very small numbers from the matrix *
- * Set_W3D_Name -- set a W3D name *
- * Split_Node_Name -- break a node name into the base and extension *
- * Is_Max_Tri_Mesh -- Is this node a triangle mesh? *
- * -- checks if the node is the origin of a model *
- * -- Checks if the node is the origin for the base obect (non-LOD'd). *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#include "util.h"
-#include "w3dutil.h"
-#include "skin.h"
-#include "skindata.h"
-#include "modstack.h"
-
-
-#define MAX_NODE_NAME_LEN 256 // max name size we can handle
-
-const float EPSILON = 0.00001f;
-static char _string[256];
-
-
-
-static int get_geometry_type(INode * node)
-{
- assert(node != NULL);
- return W3DAppData2Struct::Get_App_Data(node)->Get_Geometry_Type();
-
- //return (get_w3d_bits(node) & GEO_TYPE_MASK);
-}
-
-
-/***********************************************************************************************
- * Cleanup_Orthogonal_Matrix -- removes very small numbers from the matrix *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/26/1997 GH : Created. *
- *=============================================================================================*/
-Matrix3 Cleanup_Orthogonal_Matrix(Matrix3 & mat)
-{
- Matrix3 newmat = mat;
-
- for (int j=0; j<3; j++) {
- Point3 row = newmat.GetRow(j);
-
- if (fabs(row.x) < EPSILON) row.x = 0.0f;
- if (fabs(row.y) < EPSILON) row.y = 0.0f;
- if (fabs(row.z) < EPSILON) row.z = 0.0f;
-
- row = Normalize(row);
-
- newmat.SetRow(j,row);
- }
-
- return newmat;
-}
-
-/***********************************************************************************************
- * Set_W3D_Name -- set a W3D name *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/26/1997 GH : Created. *
- * 9/13/1999 AJA : Strip off the trailing ".digits" since this is a convention we've set in *
- * MAX to help artists manage LODs. *
- *=============================================================================================*/
-void Set_W3D_Name(char * set_name,const char * src)
-{
- memset(set_name,0,W3D_NAME_LEN);
- strncpy(set_name,src,W3D_NAME_LEN-1);
- char *dot = strrchr(set_name, '.');
- if (dot)
- {
- // If a number comes after the dot, strip it off
- int value;
- if (sscanf(dot+1, "%d", &value) == 1)
- *dot = 0;
- // If nothing comes after the dot, strip it off
- else if (*(dot+1) == 0)
- *dot = 0;
- }
- strupr(set_name);
-}
-
-/***********************************************************************************************
- * Split_Node_Name -- break a node name into the base and extension *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/26/1997 GH : Created. *
- *=============================================================================================*/
-void Split_Node_Name(const char * name,char * set_base,char * set_exten,int * set_exten_index)
-{
- // Nodes are assumed to be named in the following way:
- // .
- // for example: mesh.d1
-
- char buf[MAX_NODE_NAME_LEN];
- char * ptr;
-
- assert(strlen(name) < MAX_NODE_NAME_LEN);
-
- // Initialize
- if (set_base != NULL) set_base[0] = 0;
- if (set_exten != NULL) set_exten[0] = 0;
- if (set_exten_index != NULL) *set_exten_index = 0;
-
- // Get the base name
- strncpy(buf,name,MAX_NODE_NAME_LEN);
- ptr = buf;
- while ((*ptr != 0) && (*ptr != '.')) {
- ptr++;
- }
-
- if (*ptr == '.') {
-
- // copy what we have so far into set_base
- *ptr = 0;
- if (set_base != NULL) strncpy(set_base,buf,MAX_NODE_NAME_LEN);
-
- // copy the rest back into the extension
- ptr++;
- if (set_exten != NULL) strncpy(set_exten,ptr,MAX_NODE_NAME_LEN);
-
- // now get the extension index
- ptr++;
- if (set_exten_index != NULL) *set_exten_index = atoi(ptr);
-
- } else {
-
- // no extension, just copy the base name
- if (set_base != NULL) strncpy(set_base,buf,MAX_NODE_NAME_LEN);
- return;
- }
-}
-
-
-bool Append_Lod_Character (char *meshname, int lod_level, INodeListClass *origin_list)
-{
- if (meshname == NULL || lod_level < 0)
- return false;
-
- if (!origin_list)
- return false;
-
- int num_lods = origin_list->Num_Nodes();
-
- /*
- ** Search the other LODs to see if there is a mesh with the same name.
- ** If there is, we will append the current LOD level digit to the name.
- ** If there is not, the name will not be modified.
- */
- INode *conflict = NULL, *cur_origin = NULL;
- int i, lod;
- for (i = 0; i < num_lods; i++)
- {
- // Don't bother searching the current LOD.
- lod = Get_Lod_Level((*origin_list)[i]);
- if (lod == lod_level)
- continue;
-
- // Search this lod for a node of the same name.
- conflict = Find_Named_Node(meshname, (*origin_list)[i]);
- if (conflict)
- {
- // Name length is a worry here, because the name plus the number
- // must be less than W3D_NAME_LEN (which is fairly small!).
- int length = strlen(meshname);
- if ( (lod_level < 10) && (length < W3D_NAME_LEN - 1) )
- {
- // Append a number corresponding to the LOD level to the mesh name.
- // Highest-detail LOD is '0' (convention).
- char *insert = meshname + length;
- *insert++ = '0' + lod_level;
- *insert = '\0';
- }
- else if ( (lod_level < 100) && (length < W3D_NAME_LEN - 2) )
- {
- // Append a number corresponding to the LOD level to the mesh name.
- // Highest-detail LOD is '0' (convention).
- char buf[3];
- sprintf(buf, "%d", lod_level);
- strcat(meshname, buf);
- }
- else
- {
- // Replace the last character of the mesh name with the lod character (as above).
- meshname[W3D_NAME_LEN-2] = '0' + lod_level;
- }
-
- // Name mangling finished (conflict with other LODs is solved on their pass).
- break;
- }
- }
-
- return true;
-}
-
-
-
-void Create_Full_Path(char *full_path, const char *curr, const char *rel_path)
-{
- // Copy current dir to full path. If it doesn't end with a slash, add one.
- strcpy(full_path, curr);
- int curr_len = strlen(curr);
- char *full_p = full_path + curr_len; // Point at the terminating NULL
- if (curr_len == 0 ||(*(full_p - 1) != '/' && *(full_p - 1) != '\\')) {
- *full_p = '\\';
- *(++full_p) = '\000'; // Point at the terminating NULL
- }
-
- // Scan "..\"s at the beginning of the rel path, scan backwards on the
- // full path (current dir):
- const char *rel_p;
- for ( rel_p = rel_path;
- *rel_p == '.' && *(rel_p+1) == '.' && ( *(rel_p+2) == '/' || *(rel_p+2) == '\\' );
- rel_p += 3)
- {
- full_p--;
- for (; full_p > full_path && *(full_p-1) != '/' && *(full_p-1) != '\\'; full_p--);
- *full_p = '\000';
- }
-
- // Copy the remainder of the relative path to the full path:
- strcpy(full_p, rel_p);
-}
-
-// This enum is used inside Create_Relative_Path:
-enum PathCharType {
- NULL_CHAR,
- SLASH_CHAR,
- PLAIN_CHAR
-};
-
-void Create_Relative_Path(char *rel_path, const char *curr, const char *full_path)
-{
- // Copy both constant strings and convert them to uppercase:
- int curr_len = strlen(curr);
- char *up_curr = (char *)malloc(curr_len + 1);
- strcpy(up_curr, curr);
- _strupr(up_curr);
-
- int full_len = strlen(full_path);
- char *up_full = (char *)malloc(full_len + 1);
- strcpy(up_full, full_path);
- _strupr(up_full);
-
- char *rel_p = rel_path;
-
- // Find shared prefix of curr and full path
- const char *full_p = up_full;
- const char *curr_p = up_curr;
- for ( ;
- *full_p && *full_p == *curr_p || (*full_p == '/' && *curr_p == '\\') || (*full_p == '\\' && *curr_p == '/');
- full_p++, curr_p++
- );
-
- // If no shared prefix at this point set the relative path to 0
- // This will force the code to use the absolute path.
- if (full_p == up_full) {
- rel_path[0] = 0;
- goto end;
- }
-
- // The first different character for each string can be: a NULL, a slash,
- // or an ordinary character.
- PathCharType full_type, curr_type;
- if (*full_p == '\000') {
- full_type = NULL_CHAR;
- } else {
- if (*full_p == '/' || *full_p == '\\') {
- full_type = SLASH_CHAR;
- } else {
- full_type = PLAIN_CHAR;
- }
- }
- if (*curr_p == '\000') {
- curr_type = NULL_CHAR;
- } else {
- if (*curr_p == '/' || *curr_p == '\\') {
- curr_type = SLASH_CHAR;
- } else {
- curr_type = PLAIN_CHAR;
- }
- }
- // If the last fullpath char is a NULL or both are slashes, we have an
- // error - return full path
- if (full_type == NULL_CHAR || (full_type == SLASH_CHAR && curr_type == SLASH_CHAR)) {
- strcpy(rel_path, up_full);
- goto end;
- }
-
- // If the current path has ended (last char is a NULL) and the full path's
- // last char is a slash, then just copy the remainder of the full path
- // (w/o the slash) to the relative path, and exit.
- if (curr_type == NULL_CHAR && full_type == SLASH_CHAR) {
- full_p++; // skip slash
- strcpy(rel_path, full_p);
- goto end;
- }
-
- // If one of following holds:
- // 1) One of the last chars is a slash and the other is a plain char
- // 2) The current path has ended (last char is NULL) and the last char
- // of the full path is a plain char
- // 3) The last char of both are plain chars and the previous char is not a
- // slash
- // Then we must backtrack both pointers until the characters before them
- // are slashes. If there are no previous slashes, we have an error.
- if ( (full_type == SLASH_CHAR && curr_type == PLAIN_CHAR) ||
- (curr_type == SLASH_CHAR && full_type == PLAIN_CHAR) ||
- (curr_type == NULL_CHAR && full_type == PLAIN_CHAR) ||
- (curr_type == PLAIN_CHAR && full_type == PLAIN_CHAR &&
- *(full_p-1) != '/' && *(full_p-1) != '\\') )
- {
- for (;
- full_p > up_full &&
- ( (*(full_p - 1) != '/' && *(full_p - 1) != '\\') ||
- (*(curr_p - 1) != '/' && *(curr_p - 1) != '\\') );
- full_p--, curr_p--);
- }
-
- // If no shared prefix at this point (not even a drive letter) return the
- // full path
- if (full_p == up_full) {
- strcpy(rel_path, up_full);
- goto end;
- }
-
- // Scan all directories levels in current path from shared point to end -
- // for each one add a "../" to the relative path. Note that at this point
- // we know we have to add at least one.
- *rel_p++ = '.';
- *rel_p++ = '.';
- *rel_p++ = '\\';
- // Go over remaining current path, for each slash we find add one "../" to
- // the relative path
- for (; *curr_p; curr_p++) {
- if (*curr_p == '/' || *curr_p == '\\') {
- *rel_p++ = '.';
- *rel_p++ = '.';
- *rel_p++ = '\\';
- }
- }
-
- // If the last char of the current path is a slash remove a "../" from the
- // relative path.
- if (*(curr_p - 1) == '/' || *(curr_p - 1) == '\\') {
- rel_p -= 3;
- }
-
- // Copy remaining full path (from shared point to end) to relative path
- strcpy(rel_p, full_p);
-
-end:
- free(up_curr);
- free(up_full);
-}
-
-bool Is_Full_Path(char * path)
-{
- // first scan for a drive letter (scan for a colon)
- if (strchr(path,':') != NULL) {
- return true;
- }
-
- // now scan for a "network" path (starts with "//")
- if ((path[0] == '/') && (path[1] == '/')) {
- return true;
- }
- if ((path[0] == '\\') && (path[1] == '\\')) {
- return true;
- }
-
- return false;
-}
-
-
-/***********************************************************************************************
- * Is_Max_Tri_Mesh -- Is this node a triangle mesh? *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 2/2/98 GTH : Created. *
- *=============================================================================================*/
-bool Is_Max_Tri_Mesh(INode * node)
-{
- Object *obj = node->EvalWorldState(0).obj;
-
- if (obj && obj->CanConvertToType(Class_ID(TRIOBJ_CLASS_ID, 0))) {
- return true;
- }
- return false;
-}
-
-
-
-bool Is_Damage_Root(INode *node)
-{
- if (node == NULL)
- return false;
-
- // Is the node's parent the scene root?
- INode *parent = node->GetParentNode();
- if (!parent || !parent->IsRootNode())
- return false;
-
- // Is the node's name in the form "damage.*"?
- char *name = node->GetName();
- if (strnicmp(name, "damage.", strlen("damage.")) != 0)
- return false;
-
-/* This won't pick up references to a dummy object for some reason.
- // Does the node point to a dummy object?
- Object *obj = node->GetObjectRef();
- if (!obj || !obj->CanConvertToType(Class_ID(DUMMY_CLASS_ID, 0)))
- return false;
-*/
-
- return true;
-}
-
-
-/***********************************************************************************************
- * Is_Origin -- checks if the node is the origin of a model *
- * *
- * A node is an origin if its parent is the scene root, it is a dummy object, and its name *
- * is of the form "origin.*" (case insensitive). All descendants of the origin will be *
- * expressed in coordinates relative to the origin object. *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 9/13/99 AJA : Created.
- *=============================================================================================*/
-bool Is_Origin(INode * node)
-{
- if (!node) return false;
- if (node->IsRootNode()) return true;
- if (node->IsHidden()) return false;
-
- // Is the node's parent the scene root?
- INode *parent = node->GetParentNode();
- if (!parent || !parent->IsRootNode())
- return false;
-
- // Is the node's name in the form "origin.*"?
- char *name = node->GetName();
- if (strnicmp(name, "origin.", strlen("origin.")) != 0)
- return false;
-
-/* This won't pick up references to a dummy object for some reason.
- // Does the node point to a dummy object?
- Object *obj = node->GetObjectRef();
- if (!obj || !obj->CanConvertToType(Class_ID(DUMMY_CLASS_ID, 0)))
- return false;
-*/
-
- // This is an origin.
- return true;
-}
-
-
-/***********************************************************************************************
- * Is_Base_Origin -- Checks if the node is the origin for the base obect (non-LOD'd). *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 9/13/1999 AJA : Created. *
- *=============================================================================================*/
-bool Is_Base_Origin(INode * node)
-{
- if (!node) return false;
-
- if (node->IsRootNode()) return true;
-
- if (!Is_Origin(node)) return false;
-
- // An origin is the base object origin if it's name is "origin." or
- // "origin.0" (a numeric value evaluating to zero as scanned by sscanf
- // which would include "origin.00" "origin.000", etc.).
- bool is_base_origin = false;
- char *name = node->GetName();
- if (stricmp(name, "origin.") == 0)
- is_base_origin = true;
- else if (strlen(name) > strlen("origin."))
- {
- // We know the first 7 characters are "origin." because that
- // was tested in Is_Origin(). Is it "origin.0"?
- int idx;
- if ((sscanf(name+strlen("origin."), "%d", &idx) == 1) && (idx == 0))
- is_base_origin = true;
- }
-
- return is_base_origin;
-}
-
-
-int Get_Lod_Level(INode *node)
-{
- if (node->IsRootNode()) return 0;
- if (!Is_Origin(node)) return -1;
-
- char *name = node->GetName();
- char *dot = strrchr(name, '.');
- assert(dot);
- return atoi(dot+1);
-}
-
-int Get_Damage_State(INode *node)
-{
- if (!Is_Damage_Root(node)) return -1;
-
- char *name = node->GetName();
- char *dot = strrchr(name, '.');
- assert(dot);
- return atoi(dot+1);
-}
-
-INode *Find_Named_Node(char *nodename, INode *root)
-{
- if (!root || !nodename)
- return NULL;
-
- // Perform a breadth-first search of the tree for a node
- // of the given name.
- INode *child = NULL;
- int i;
- char cur_name[W3D_NAME_LEN];
-
- // Is this the node we're looking for?
- Set_W3D_Name(cur_name, root->GetName());
- if (strcmp(cur_name, nodename) == 0)
- return root;
-
- // Check the children against the given name.
- for (i = 0; i < root->NumChildren(); i++)
- {
- // Is it this child?
- child = root->GetChildNode(i);
- Set_W3D_Name(cur_name, child->GetName());
- if (strcmp(nodename, cur_name) == 0)
- return child;
- }
-
- // Wasn't any children. Check each child's descendants.
- for (i = 0; i < root->NumChildren(); i++)
- {
- child = root->GetChildNode(i);
- INode *found = Find_Named_Node(nodename, child);
- if (found)
- return found;
- }
-
- // Didn't find the node anywhere.
- return NULL;
-}
-
diff --git a/Generals/Code/Tools/WW3D/max2w3d/util.h b/Generals/Code/Tools/WW3D/max2w3d/util.h
deleted file mode 100644
index b2ddd5e4e52..00000000000
--- a/Generals/Code/Tools/WW3D/max2w3d/util.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** 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 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see