Add rayman2 source files

This commit is contained in:
2024-09-18 02:33:44 +08:00
parent bcc093f8ed
commit fb036c54fd
14339 changed files with 2596224 additions and 0 deletions

View File

@@ -0,0 +1,408 @@
# Microsoft Developer Studio Project File - Name="OGD" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=OGD - WIN32 DEBUG GLIDE WITH EDITORS
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "Ogd.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "Ogd.mak" CFG="OGD - WIN32 DEBUG GLIDE WITH EDITORS"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "OGD - Win32 Debug Glide with Editors" (based on\
"Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""$/CPA/TempGrp/ogd", RAGAAAAA"
# PROP Scc_LocalPath "."
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug Glide with Editors"
# PROP BASE Intermediate_Dir "Debug Glide with Editors"
# PROP BASE Target_Dir ""
# PROP Use_MFC 2
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "x:\CPA\EXE\main\EDT_Data\Objects"
# PROP Intermediate_Dir "Tmp\OGDDFEvd"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /Z7 /Od /I "X:\CPA\Public" /I ".\inc" /D "WIN32" /D "CPA_WANTS_IMPORT" /D "ACTIVE_EDITOR" /D "_DEBUG" /D "_WINDOWS" /D "CPA_VISUAL" /D "CPA_DEBUG" /D "_WINDLL" /D "_AFXDLL" /D "USE_ALTIMAPS" /YX /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
# ADD BASE RSC /l 0x40c /d "_DEBUG"
# ADD RSC /l 0x40c /d "_DEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo /o"tmp/OGDdvevf/Ogd.bsc"
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 /nologo /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"msvcrtd.lib" /out:"X:\CPA\EXE\main\EDT_Data\Objects\OGDDFEvd.dll"
# SUBTRACT LINK32 /pdb:none
# Begin Target
# Name "OGD - Win32 Debug Glide with Editors"
# Begin Group "Source Files"
# PROP Default_Filter "cpp"
# Begin Source File
SOURCE=.\src\3dgmodif.cpp
# End Source File
# Begin Source File
SOURCE=.\src\3dinterf.cpp
# End Source File
# Begin Source File
SOURCE=.\src\3dobject.cpp
# End Source File
# Begin Source File
SOURCE=.\src\3DObject.cxx
# PROP Exclude_From_Build 1
# End Source File
# Begin Source File
SOURCE=.\src\3dobject.def
# End Source File
# Begin Source File
SOURCE=.\src\Alt3D.cpp
# End Source File
# Begin Source File
SOURCE=.\src\Arrows3D.cpp
# End Source File
# Begin Source File
SOURCE=.\src\BAR3D.CPP
# End Source File
# Begin Source File
SOURCE=.\src\Box3D.cpp
# End Source File
# Begin Source File
SOURCE=.\src\Cone3D.cpp
# End Source File
# Begin Source File
SOURCE=.\src\CTRIEDIT.CPP
# End Source File
# Begin Source File
SOURCE=.\src\DlgAlt3D.cpp
# End Source File
# Begin Source File
SOURCE=.\src\DLGBOX3D.CPP
# End Source File
# Begin Source File
SOURCE=.\src\dlgcarac.cpp
# End Source File
# Begin Source File
SOURCE=.\src\DLGCON3D.CPP
# End Source File
# Begin Source File
SOURCE=.\src\dlgeditpoints.cpp
# End Source File
# Begin Source File
SOURCE=.\src\DLGITBOX.CPP
# End Source File
# Begin Source File
SOURCE=.\src\DLGITCone.CPP
# End Source File
# Begin Source File
SOURCE=.\src\DlgITSphere.cpp
# End Source File
# Begin Source File
SOURCE=.\src\DlgObject.cpp
# End Source File
# Begin Source File
SOURCE=.\src\DLGPNT3D.CPP
# End Source File
# Begin Source File
SOURCE=.\src\DLGSPH3D.CPP
# End Source File
# Begin Source File
SOURCE=.\src\dllcom.cpp
# End Source File
# Begin Source File
SOURCE=.\src\EDTHREAD.CPP
# End Source File
# Begin Source File
SOURCE=.\src\EToolBar.cpp
# End Source File
# Begin Source File
SOURCE=.\src\ITBox3D.cpp
# End Source File
# Begin Source File
SOURCE=.\src\ITCON3D.CPP
# End Source File
# Begin Source File
SOURCE=.\src\ITFrame.cpp
# End Source File
# Begin Source File
SOURCE=.\src\Itobject.cpp
# End Source File
# Begin Source File
SOURCE=.\src\ITSphere3D.cpp
# End Source File
# Begin Source File
SOURCE=.\src\ITView.cpp
# End Source File
# Begin Source File
SOURCE=.\src\Oktaedron3D.cpp
# End Source File
# Begin Source File
SOURCE=.\src\Paramsurface3D.cpp
# End Source File
# Begin Source File
SOURCE=.\src\Plane3D.cpp
# End Source File
# Begin Source File
SOURCE=.\src\Point3D.cpp
# End Source File
# Begin Source File
SOURCE=.\src\Shape3D.cpp
# End Source File
# Begin Source File
SOURCE=.\src\Sphere3D.cpp
# End Source File
# Begin Source File
SOURCE=.\src\StdAfx.cpp
# End Source File
# Begin Source File
SOURCE=.\src\Symbolical3D.cpp
# End Source File
# End Group
# Begin Group "Include Files"
# PROP Default_Filter "hpp,h"
# Begin Source File
SOURCE=.\inc\3dgmodif.hpp
# End Source File
# Begin Source File
SOURCE=.\inc\3dinterf.hpp
# End Source File
# Begin Source File
SOURCE=..\..\Public\OGD\3dobject.hpp
# End Source File
# Begin Source File
SOURCE=.\inc\CTRIEDIT.H
# End Source File
# Begin Source File
SOURCE=.\inc\dlgcarac.hpp
# End Source File
# Begin Source File
SOURCE=.\inc\DLGITBOX.H
# End Source File
# Begin Source File
SOURCE=.\inc\DLGITCone.H
# End Source File
# Begin Source File
SOURCE=.\inc\DlgITSphere.h
# End Source File
# Begin Source File
SOURCE=.\inc\DlgObject.h
# End Source File
# Begin Source File
SOURCE=.\inc\EDTHREAD.H
# End Source File
# Begin Source File
SOURCE=.\inc\EToolBar.h
# End Source File
# Begin Source File
SOURCE=.\inc\ITFrame.h
# End Source File
# Begin Source File
SOURCE=.\inc\ITView.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\OGD.h
# End Source File
# Begin Source File
SOURCE=.\inc\SAVE.H
# End Source File
# Begin Source File
SOURCE=.\inc\StdAfx.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\inc\3dge_res.h
# End Source File
# Begin Source File
SOURCE=.\inc\3dgeom.rc
# End Source File
# Begin Source File
SOURCE=.\inc\RES\bitmap1.bmp
# End Source File
# Begin Source File
SOURCE=.\inc\RES\bmp00001.bmp
# End Source File
# Begin Source File
SOURCE=.\inc\RES\bmp00002.bmp
# End Source File
# Begin Source File
SOURCE=.\inc\RES\bmp00003.bmp
# End Source File
# Begin Source File
SOURCE=.\inc\RES\bmp00004.bmp
# End Source File
# Begin Source File
SOURCE=.\inc\RES\bmp00005.bmp
# End Source File
# Begin Source File
SOURCE=.\inc\RES\CEDIT.BMP
# End Source File
# Begin Source File
SOURCE=.\inc\RES\ICON1.ICO
# End Source File
# Begin Source File
SOURCE=.\inc\RES\left_cle.bmp
# End Source File
# Begin Source File
SOURCE=.\inc\RES\left_set.bmp
# End Source File
# Begin Source File
SOURCE=.\inc\RES\ogd_dlgb.ico
# End Source File
# Begin Source File
SOURCE=.\inc\RES\orientationd.bmp
# End Source File
# Begin Source File
SOURCE=.\inc\RES\orientationu.bmp
# End Source File
# Begin Source File
SOURCE=.\inc\RES\right_cl.bmp
# End Source File
# Begin Source File
SOURCE=.\inc\RES\square_0.bmp
# End Source File
# Begin Source File
SOURCE=.\inc\RES\square_1.bmp
# End Source File
# Begin Source File
SOURCE=.\inc\RES\square_4.bmp
# End Source File
# Begin Source File
SOURCE=.\inc\RES\square_5.bmp
# End Source File
# End Group
# Begin Group "others"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\Exe\Main\EDT_DATA\objects\3dgeom\3dgeom.cnt
# End Source File
# Begin Source File
SOURCE=..\..\Exe\Main\EDT_DATA\objects\3dgeom\3dgeom.hlp
# End Source File
# Begin Source File
SOURCE=..\..\Exe\Main\EDT_DATA\objects\3dgeom\3dgeom.ini
# End Source File
# End Group
# Begin Group "libs debug"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\Exe\Main\EDT_DATA\ErO___vd.lib
# End Source File
# Begin Source File
SOURCE=..\..\Exe\Main\MaiDFE3d.lib
# PROP Exclude_From_Build 1
# End Source File
# Begin Source File
SOURCE=..\..\Exe\Main\MaiDFEvd.lib
# End Source File
# End Group
# Begin Source File
SOURCE=.\Ogd.mak
# End Source File
# End Target
# End Project

View File

@@ -0,0 +1,656 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="OGD"
ProjectGUID="{16E288A9-B48E-4008-97FA-72EF90783645}"
SccProjectName="&quot;$/CPA/TempGrp/ogd&quot;, RAGAAAAA"
SccAuxPath=""
SccLocalPath="."
SccProvider="MSSCCI:NXN alienbrain"
Keyword="MFCProj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug Glide with Editors|Win32"
OutputDirectory="x:\CPA\EXE\main\EDT_Data\Objects"
IntermediateDirectory=".\Tmp\OGDDFEvd"
ConfigurationType="2"
UseOfMFC="2"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="X:\CPA\Public,.\inc"
PreprocessorDefinitions="WIN32;CPA_WANTS_IMPORT;ACTIVE_EDITOR;_DEBUG;_WINDOWS;CPA_VISUAL;CPA_DEBUG;USE_ALTIMAPS"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Tmp\OGDDFEvd/Ogd.pch"
AssemblerListingLocation=".\Tmp\OGDDFEvd/"
ObjectFile=".\Tmp\OGDDFEvd/"
ProgramDataBaseFileName=".\Tmp\OGDDFEvd/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="1"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="ero___vd.lib maidfevd.lib"
OutputFile="X:\CPA\EXE\main\EDT_Data\Objects\OGDDFEvd.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="X:\cpa\exe\main\edt_data;X:\cpa\exe\main;X:\cpa\libd"
IgnoreDefaultLibraryNames=""
ModuleDefinitionFile=".\src\3dobject.def"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="x:\CPA\EXE\main\EDT_Data\Objects/OGDDFEvd.pdb"
SubSystem="2"
ImportLibrary="x:\CPA\EXE\main\EDT_Data\Objects/OGDDFEvd.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName="x:\CPA\EXE\main\EDT_Data\Objects/Ogd.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1036"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp">
<File
RelativePath="src\3dgmodif.cpp">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\3dinterf.cpp">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\3dobject.cpp">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\3DObject.cxx">
<FileConfiguration
Name="Debug Glide with Editors|Win32"
ExcludedFromBuild="TRUE">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\3dobject.def">
</File>
<File
RelativePath="src\Alt3D.cpp">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\Arrows3D.cpp">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\BAR3D.CPP">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\Box3D.cpp">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\Cone3D.cpp">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\CTRIEDIT.CPP">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\DlgAlt3D.cpp">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\DLGBOX3D.CPP">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\dlgcarac.cpp">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\DLGCON3D.CPP">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\dlgeditpoints.cpp">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\DLGITBOX.CPP">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\DLGITCone.CPP">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\DlgITSphere.cpp">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\DlgObject.cpp">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\DLGPNT3D.CPP">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\DLGSPH3D.CPP">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\dllcom.cpp">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\EDTHREAD.CPP">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\EToolBar.cpp">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\ITBox3D.cpp">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\ITCON3D.CPP">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\ITFrame.cpp">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\Itobject.cpp">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\ITSphere3D.cpp">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\ITView.cpp">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\Oktaedron3D.cpp">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\Paramsurface3D.cpp">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\Plane3D.cpp">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\Point3D.cpp">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\Shape3D.cpp">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\Sphere3D.cpp">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\StdAfx.cpp">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\Symbolical3D.cpp">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Include Files"
Filter="hpp,h">
<File
RelativePath="inc\3dgmodif.hpp">
</File>
<File
RelativePath="inc\3dinterf.hpp">
</File>
<File
RelativePath="..\..\Public\OGD\3dobject.hpp">
</File>
<File
RelativePath="inc\CTRIEDIT.H">
</File>
<File
RelativePath="inc\dlgcarac.hpp">
</File>
<File
RelativePath="inc\DLGITBOX.H">
</File>
<File
RelativePath="inc\DLGITCone.H">
</File>
<File
RelativePath="inc\DlgITSphere.h">
</File>
<File
RelativePath="inc\DlgObject.h">
</File>
<File
RelativePath="inc\EDTHREAD.H">
</File>
<File
RelativePath="inc\EToolBar.h">
</File>
<File
RelativePath="inc\ITFrame.h">
</File>
<File
RelativePath="inc\ITView.h">
</File>
<File
RelativePath="..\..\Public\OGD.h">
</File>
<File
RelativePath="inc\SAVE.H">
</File>
<File
RelativePath="inc\StdAfx.h">
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="">
<File
RelativePath="inc\3dge_res.h">
</File>
<File
RelativePath="inc\3dgeom.rc">
<FileConfiguration
Name="Debug Glide with Editors|Win32">
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions=""
AdditionalIncludeDirectories="inc"/>
</FileConfiguration>
</File>
<File
RelativePath="inc\RES\bitmap1.bmp">
</File>
<File
RelativePath="inc\RES\bmp00001.bmp">
</File>
<File
RelativePath="inc\RES\bmp00002.bmp">
</File>
<File
RelativePath="inc\RES\bmp00003.bmp">
</File>
<File
RelativePath="inc\RES\bmp00004.bmp">
</File>
<File
RelativePath="inc\RES\bmp00005.bmp">
</File>
<File
RelativePath="inc\RES\CEDIT.BMP">
</File>
<File
RelativePath="inc\RES\ICON1.ICO">
</File>
<File
RelativePath="inc\RES\left_cle.bmp">
</File>
<File
RelativePath="inc\RES\left_set.bmp">
</File>
<File
RelativePath="inc\RES\ogd_dlgb.ico">
</File>
<File
RelativePath="inc\RES\orientationd.bmp">
</File>
<File
RelativePath="inc\RES\orientationu.bmp">
</File>
<File
RelativePath="inc\RES\right_cl.bmp">
</File>
<File
RelativePath="inc\RES\square_0.bmp">
</File>
<File
RelativePath="inc\RES\square_1.bmp">
</File>
<File
RelativePath="inc\RES\square_4.bmp">
</File>
<File
RelativePath="inc\RES\square_5.bmp">
</File>
</Filter>
<Filter
Name="others"
Filter="">
<File
RelativePath="..\..\Exe\Main\EDT_DATA\objects\3dgeom\3dgeom.cnt">
</File>
<File
RelativePath="..\..\Exe\Main\EDT_DATA\objects\3dgeom\3dgeom.hlp">
</File>
<File
RelativePath="..\..\Exe\Main\EDT_DATA\objects\3dgeom\3dgeom.ini">
</File>
</Filter>
<File
RelativePath="Ogd.mak">
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

Binary file not shown.

View File

@@ -0,0 +1,185 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by 3dgeom.rc
//
#define IDC_STATIC_NAME 129
#define IDR_INDEXED_TRIANGLE 130
#define IDR_INDEXED_TRIANGLE2 131
#define IDR_EDIT_TOOLBAR 132
#define IDC_STATIC_XNB 132
#define IDC_STATIC_YNB 133
#define IDC_EDIT_XNB 135
#define IDC_EDIT_YNB 136
#define IDD_DLGCARACT 153
#define IDD_DIALOGSPHERE 155
#define IDD_DIALOGBOX 156
#define IDD_DIALOGBOX3D 157
#define IDD_DIALOGPOINT3D 158
#define IDD_DIALOGSPHERE3D 159
#define IDD_DIALOGCONE3D 160
#define IDD_DIALOGCONE 161
#define IDD_DIALOGOBJECT 162
#define IDD_POINT_EDIT_DIALOG 163
#define IDD_ALTIMAP3D 164
#define IDI_OGD_DLGBAR_ICON 164
#define IDB_SQUARE_00 167
#define IDB_LEFT_CLEAR_BOTTOM 168
#define IDB_LEFT_CLEAR_TOP 169
#define IDB_LEFT_SET_BOTTOM 170
#define IDB_LEFT_SET_TOP 171
#define IDB_RIGHT_CLEAR_BOTTOM 172
#define IDB_RIGHT_CLEAR_TOP 173
#define IDB_RIGHT_SET_BOTTOM 174
#define IDB_RIGHT_SET_TOP 175
#define IDB_SQUARE_03 176
#define IDB_SQUARE_01 177
#define IDB_SQUARE_02 178
#define IDB_SQUARE_12 179
#define IDB_SQUARE_04 180
#define IDB_SQUARE_08 181
#define IDC_SLIDER 1002
#define IDS_DEFAULT_ITNAME 1003
#define IDC_NEW_OBJECT 1007
#define IDS_LOG_FILENAME 1008
#define IDS_BASE_PATH 1009
#define IDC_STATIC_NBPOINTS 1018
#define IDC_STATIC_NBEDGES 1019
#define IDC_STATIC_NBBDV 1020
#define IDC_Static_Text_Center_X 1021
#define IDC_STATIC_NBINDEXEDTRIANGLE 1022
#define IDC_Static_Text_Center_Y 1022
#define IDC_STATIC_NBFACEMAP 1023
#define IDC_STATIC_NBSPRITES 1024
#define IDC_Static_Text_Center_Z 1024
#define IDC_STATIC_NBTMESHES 1025
#define IDC_Static_Text_Radius 1025
#define IDC_STATIC_NBXLINES 1026
#define IDC_Edition_Zone_Center_X 1026
#define IDC_Static_Text_Angle 1026
#define IDC_STATIC_NBXPOINTS 1027
#define IDC_Edition_Zone_Center_Y 1027
#define IDC_STATIC_NBSPHERES 1028
#define IDC_Edition_Zone_Center_Z 1028
#define IDC_STATIC_NBALIGNEDBOX 1029
#define IDC_Edition_Zone_Length 1029
#define IDC_ELEMENTS 1031
#define IDC_EDIT_NAME 1032
#define IDC_Static_Text_Length 1032
#define IDC_BT_GO 1033
#define IDC_Static_Text_Width 1033
#define IDC_Edition_Zone_Width 1035
#define IDC_EDIT1 1035
#define IDC_EDIT_RADIUS 1035
#define IDC_STATIC_LINE 1035
#define IDC_SLIDER1 1036
#define IDC_SLIDER_RADIUS 1036
#define IDC_LIST_ELEMENTS 1036
#define IDC_EDIT2 1037
#define IDC_Check_Box_Cube 1037
#define IDC_EDIT_CENTER_X 1037
#define IDC_SLIDER_NBY 1037
#define IDC_STATIC_BORDER 1037
#define IDC_EDIT3 1038
#define IDC_Radio_Button_Center 1038
#define IDC_EDIT_CENTER_Y 1038
#define IDC_SLIDER2 1039
#define IDC_Radio_Button_Extrema 1039
#define IDC_EDIT_CENTER_Z 1039
#define IDC_SLIDER3 1040
#define IDC_Static_Text_X_Mini 1040
#define IDC_SIZEX 1040
#define IDC_EDIT4 1041
#define IDC_Static_Text_Y_Mini 1041
#define IDC_STATIC1 1041
#define IDC_EDITSCALEX 1041
#define IDC_SLIDER_SIZEY 1041
#define IDC_SLIDER5 1042
#define IDC_Static_Text_Z_Mini 1042
#define IDC_STATIC2 1042
#define IDC_EDITSCALEY 1042
#define IDC_SIZEY 1042
#define IDC_Edition_Zone_X_Mini 1043
#define IDC_EDITRADIUS 1043
#define IDC_EDITSCALEZ 1043
#define IDC_NBX 1043
#define IDC_Edition_Zone_Y_Mini 1044
#define IDC_EDITHEIGHT 1044
#define IDC_NBY 1044
#define IDC_Edition_Zone_Z_Mini 1045
#define IDC_SLIDERRADIUS 1045
#define IDC_SLIDER_SIZEX 1045
#define IDC_Static_Text_X_Maxi 1046
#define IDC_SLIDERHEIGHT 1046
#define IDC_SLIDER_NBX 1046
#define IDC_Static_Text_Y_Maxi 1047
#define IDC_STATICX 1047
#define IDC_Static_Text_Z_Maxi 1048
#define IDC_EDITX 1048
#define IDC_Edition_Zone_X_Maxi 1049
#define IDC_SLIDERX 1049
#define IDC_Edition_Zone_Y_Maxi 1050
#define IDC_EDITY 1050
#define IDC_SET_ORIENTATION 1050
#define IDC_Edition_Zone_Z_Maxi 1051
#define IDC_SLIDERY 1051
#define IDC_SET_LEFT 1051
#define IDC_Frame_Mini 1052
#define IDC_STATICY 1052
#define IDC_SET_RIGHT 1052
#define IDC_Frame_Center 1053
#define IDC_Frame_Maxi 1054
#define IDC_Static_Text_Height 1055
#define IDC_Edition_Zone_Height 1056
#define IDC_Static_Text_X 1057
#define IDC_Static_Text_Y 1058
#define IDC_Static_Text_Z 1059
#define IDC_Edition_Zone_X 1060
#define IDC_Edition_Zone_Y 1061
#define IDC_Edition_Zone_Z 1062
#define IDC_Edition_Zone_Radius 1073
#define IDC_Edition_Zone_Angle 1074
#define IDC_Frame_Top 1101
#define IDC_Frame_Base 1102
#define IDC_Static_Text_X_Top 1103
#define IDC_Static_Text_Y_Top 1104
#define IDC_Static_Text_Z_Top 1105
#define IDC_Static_Text_X_Base 1106
#define IDC_Static_Text_Y_Base 1107
#define IDC_Static_Text_Z_Base 1108
#define IDC_Edition_Zone_X_Top 1109
#define IDC_Edition_Zone_Y_Top 1110
#define IDC_Edition_Zone_Z_Top 1111
#define IDC_Edition_Zone_X_Base 1112
#define IDC_Edition_Zone_Y_Base 1113
#define IDC_Edition_Zone_Z_Base 1114
#define IDC_Static_Text_0 1121
#define IDC_Static_Text_1 1122
#define IDC_Static_Text_1_5 1123
#define IDC_Button_Init 1124
#define IDC_Slider_Size 1125
#define IDW_TOOLBAR 32775
#define ID_EDIT_SLIDER 61204
#define ID_STATIC_NAME 61205
#define ID_EDIT_NAME 61206
#define ID_STATIC_XNB 61207
#define ID_EDIT_XNB 61208
#define ID_STATIC_YNB 61209
#define ID_EDIT_YNB 61210
#define ID_BT_NEW 61211
#define ID_BT_SAVE 61212
#define ID_BT_UNDO 61213
#define ID_BT_REDO 61214
#define ID_BT_ONTOP 61215
#define ID_BT_EXIT 61216
#define ID_BT_HIDE 61217
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 165
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1038
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@@ -0,0 +1,571 @@
//Microsoft Developer Studio generated resource script.
//
#include "3DGe_res.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_DIALOGBOX DIALOG DISCARDABLE 0, 0, 91, 174
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Dialog"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,7,153,35,14
PUSHBUTTON "Cancel",IDCANCEL,50,153,34,14
LTEXT "Scale X",IDC_STATIC,35,10,26,8
EDITTEXT IDC_EDIT2,21,22,40,12,ES_CENTER | ES_AUTOHSCROLL
CONTROL "Slider2",IDC_SLIDER2,"msctls_trackbar32",TBS_BOTH |
TBS_NOTICKS | WS_TABSTOP,13,40,59,11
LTEXT "Scale Y",IDC_STATIC,36,54,26,8
EDITTEXT IDC_EDIT3,22,68,40,12,ES_CENTER | ES_AUTOHSCROLL
CONTROL "Slider3",IDC_SLIDER3,"msctls_trackbar32",TBS_BOTH |
TBS_NOTICKS | WS_TABSTOP,13,85,60,11
LTEXT "Scale Z",IDC_STATIC,35,100,26,8
EDITTEXT IDC_EDIT4,22,114,40,12,ES_CENTER | ES_AUTOHSCROLL
CONTROL "Slider5",IDC_SLIDER5,"msctls_trackbar32",TBS_BOTH |
TBS_NOTICKS | WS_TABSTOP,16,132,58,12
END
IDD_DIALOGBOX3D DIALOG DISCARDABLE 0, 0, 132, 113
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Edit Box3D"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,7,92,50,14
PUSHBUTTON "Cancel",IDCANCEL,75,92,50,14
CONTROL "Ce&nter",IDC_Radio_Button_Center,"Button",
BS_AUTORADIOBUTTON | WS_GROUP,5,6,35,11
CONTROL "&Extrema",IDC_Radio_Button_Extrema,"Button",
BS_AUTORADIOBUTTON,45,6,43,11
GROUPBOX "Center",IDC_Frame_Center,5,16,55,49
RTEXT "&X :",IDC_Static_Text_Center_X,10,27,10,9
EDITTEXT IDC_Edition_Zone_Center_X,25,27,30,13,ES_AUTOHSCROLL
RTEXT "&Y :",IDC_Static_Text_Center_Y,10,38,10,9
EDITTEXT IDC_Edition_Zone_Center_Y,25,38,30,13,ES_AUTOHSCROLL
RTEXT "&Z :",IDC_Static_Text_Center_Z,10,49,10,9
EDITTEXT IDC_Edition_Zone_Center_Z,25,49,30,13,ES_AUTOHSCROLL
GROUPBOX "Ma&xi",IDC_Frame_Maxi,70,16,55,49
RTEXT "&Length :",IDC_Static_Text_Length,61,27,29,11
RTEXT "X :",IDC_Static_Text_X_Maxi,75,27,10,9
RTEXT "&Width:",IDC_Static_Text_Width,65,38,25,11
RTEXT "Y :",IDC_Static_Text_Y_Maxi,75,38,10,9
RTEXT "&Height :",IDC_Static_Text_Height,65,49,25,11
RTEXT "Z :",IDC_Static_Text_Z_Maxi,75,49,10,9
EDITTEXT IDC_Edition_Zone_X_Maxi,90,27,30,13,ES_AUTOHSCROLL
EDITTEXT IDC_Edition_Zone_Length,95,27,30,13,ES_AUTOHSCROLL
EDITTEXT IDC_Edition_Zone_Y_Maxi,90,38,30,13,ES_AUTOHSCROLL
EDITTEXT IDC_Edition_Zone_Width,95,38,30,13,ES_AUTOHSCROLL
EDITTEXT IDC_Edition_Zone_Z_Maxi,90,49,30,13,ES_AUTOHSCROLL
EDITTEXT IDC_Edition_Zone_Height,95,49,30,13,ES_AUTOHSCROLL
CONTROL "Cu&be",IDC_Check_Box_Cube,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,5,67,31,11
RTEXT "X :",IDC_Static_Text_X_Mini,10,27,10,9
GROUPBOX "&Mini",IDC_Frame_Mini,5,16,55,49
RTEXT "Y :",IDC_Static_Text_Y_Mini,10,38,10,9
RTEXT "Z :",IDC_Static_Text_Z_Mini,10,49,10,9
EDITTEXT IDC_Edition_Zone_X_Mini,25,27,30,13,ES_AUTOHSCROLL
EDITTEXT IDC_Edition_Zone_Y_Mini,25,38,30,13,ES_AUTOHSCROLL
EDITTEXT IDC_Edition_Zone_Z_Mini,25,49,30,13,ES_AUTOHSCROLL
CONTROL "Slider1",IDC_Slider_Size,"msctls_trackbar32",
TBS_AUTOTICKS | WS_TABSTOP,41,65,65,14
CTEXT "0",IDC_Static_Text_0,45,79,8,9
CTEXT "1",IDC_Static_Text_1,79,79,8,9
CTEXT "1.5",IDC_Static_Text_1_5,94,79,11,9
PUSHBUTTON "&Ini",IDC_Button_Init,107,67,16,13
END
IDD_DIALOGCONE DIALOG DISCARDABLE 0, 0, 84, 214
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Cone3D"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,7,193,34,14
PUSHBUTTON "Cancel",IDCANCEL,47,193,30,14
LTEXT "Radius",IDC_STATIC1,28,7,23,8
EDITTEXT IDC_EDITRADIUS,19,17,40,14,ES_CENTER | ES_AUTOHSCROLL
CONTROL "Slider1",IDC_SLIDERRADIUS,"msctls_trackbar32",TBS_BOTH |
TBS_NOTICKS | WS_TABSTOP,7,36,63,12
LTEXT "Height",IDC_STATIC2,27,48,22,8
EDITTEXT IDC_EDITHEIGHT,20,61,40,14,ES_CENTER | ES_AUTOHSCROLL
CONTROL "Slider2",IDC_SLIDERHEIGHT,"msctls_trackbar32",TBS_BOTH |
TBS_NOTICKS | WS_TABSTOP,7,82,62,11
LTEXT "Nb x",IDC_STATICX,29,92,16,8
EDITTEXT IDC_EDITX,19,108,40,14,ES_CENTER | ES_AUTOHSCROLL
CONTROL "Slider1",IDC_SLIDERX,"msctls_trackbar32",TBS_BOTH |
TBS_NOTICKS | WS_TABSTOP,7,124,63,12
CTEXT "Nb y",IDC_STATICY,28,138,16,8
EDITTEXT IDC_EDITY,16,148,40,14,ES_CENTER | ES_AUTOHSCROLL
CONTROL "Slider2",IDC_SLIDERY,"msctls_trackbar32",TBS_BOTH |
TBS_NOTICKS | WS_TABSTOP,7,170,64,12
END
IDD_DIALOGCONE3D DIALOG DISCARDABLE 0, 0, 127, 97
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Edit Cone3D"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,7,76,50,14
PUSHBUTTON "Cancel",IDCANCEL,70,76,50,14
RTEXT "X :",IDC_Static_Text_X_Top,11,11,10,9
GROUPBOX "&Top",IDC_Frame_Top,5,2,55,49
RTEXT "Y :",IDC_Static_Text_Y_Top,11,22,10,9
RTEXT "Z :",IDC_Static_Text_Z_Top,11,33,10,9
EDITTEXT IDC_Edition_Zone_X_Top,25,11,30,12,ES_AUTOHSCROLL
EDITTEXT IDC_Edition_Zone_Y_Top,25,22,30,12,ES_AUTOHSCROLL
EDITTEXT IDC_Edition_Zone_Z_Top,25,33,30,12,ES_AUTOHSCROLL
RTEXT "X :",IDC_Static_Text_X_Base,71,10,10,9
GROUPBOX "&Base",IDC_Frame_Base,65,2,55,49
RTEXT "Y :",IDC_Static_Text_Y_Base,71,21,10,9
RTEXT "Z :",IDC_Static_Text_Z_Base,71,32,10,9
EDITTEXT IDC_Edition_Zone_X_Base,84,10,30,12,ES_AUTOHSCROLL
EDITTEXT IDC_Edition_Zone_Y_Base,84,21,30,12,ES_AUTOHSCROLL
EDITTEXT IDC_Edition_Zone_Z_Base,84,32,30,12,ES_AUTOHSCROLL
LTEXT "&Radius :",IDC_Static_Text_Radius,10,50,30,11
EDITTEXT IDC_Edition_Zone_Radius,40,50,35,12,ES_AUTOHSCROLL
LTEXT "&Angle :",IDC_Static_Text_Angle,10,60,30,11
EDITTEXT IDC_Edition_Zone_Angle,40,60,35,12,ES_AUTOHSCROLL
END
IDD_DIALOGOBJECT DIALOG DISCARDABLE 0, 0, 85, 122
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Dialog ITObject3D"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,7,101,33,14
PUSHBUTTON "Cancel",IDCANCEL,47,101,31,14
LTEXT "Scale X",IDC_STATIC,25,9,26,8
EDITTEXT IDC_EDITSCALEX,24,20,32,12,ES_CENTER | ES_AUTOHSCROLL
CTEXT "Scale Y",IDC_STATIC,24,38,26,8
EDITTEXT IDC_EDITSCALEY,24,51,32,12,ES_CENTER | ES_AUTOHSCROLL
CTEXT "Scale Z",IDC_STATIC,27,68,26,8
EDITTEXT IDC_EDITSCALEZ,25,81,30,12,ES_CENTER | ES_AUTOHSCROLL
END
IDD_DIALOGPOINT3D DIALOG DISCARDABLE 0, 0, 122, 47
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Edit Point3D"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,65,7,50,14
PUSHBUTTON "Cancel",IDCANCEL,65,26,50,14
RTEXT "&X :",IDC_Static_Text_X,5,6,10,9
EDITTEXT IDC_Edition_Zone_X,20,6,40,12,ES_AUTOHSCROLL
RTEXT "&Y :",IDC_Static_Text_Y,5,16,10,9
EDITTEXT IDC_Edition_Zone_Y,20,16,40,12,ES_AUTOHSCROLL
RTEXT "&Z :",IDC_Static_Text_Z,5,27,10,9
EDITTEXT IDC_Edition_Zone_Z,20,27,40,12,ES_AUTOHSCROLL
END
IDD_DIALOGSPHERE DIALOG DISCARDABLE 0, 0, 87, 178
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Sphere"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,7,157,35,14
PUSHBUTTON "Cancel",IDCANCEL,47,157,33,14
CTEXT "Radius",IDC_STATIC,29,7,23,8
EDITTEXT IDC_EDIT1,27,22,31,12,ES_CENTER | ES_AUTOHSCROLL
CONTROL "Slider1",IDC_SLIDER1,"msctls_trackbar32",TBS_BOTH |
TBS_NOTICKS | WS_TABSTOP,13,41,58,11
LTEXT "Nb x",IDC_STATIC,35,56,16,8
LTEXT "Nb y",IDC_STATIC,36,108,16,8
EDITTEXT IDC_EDIT2,29,71,27,12,ES_CENTER | ES_AUTOHSCROLL
EDITTEXT IDC_EDIT3,30,122,27,12,ES_CENTER | ES_AUTOHSCROLL
CONTROL "Slider2",IDC_SLIDER2,"msctls_trackbar32",TBS_BOTH |
TBS_NOTICKS | WS_TABSTOP,12,89,62,11
CONTROL "Slider3",IDC_SLIDER3,"msctls_trackbar32",TBS_BOTH |
TBS_NOTICKS | WS_TABSTOP,14,142,62,11
END
IDD_DIALOGSPHERE3D DIALOG DISCARDABLE 0, 0, 88, 132
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Sphere"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,7,111,30,14
PUSHBUTTON "Cancel",IDCANCEL,48,111,33,14
CTEXT "Radius:",IDC_STATIC,13,67,23,15
EDITTEXT IDC_EDIT_RADIUS,41,67,40,15,ES_CENTER | ES_AUTOHSCROLL
CONTROL "Slider1",IDC_SLIDER_RADIUS,"msctls_trackbar32",TBS_BOTH |
TBS_NOTICKS | WS_TABSTOP,7,79,74,15
GROUPBOX "Center:",IDC_STATIC,7,7,74,56
EDITTEXT IDC_EDIT_CENTER_X,41,15,40,15,ES_CENTER | ES_AUTOHSCROLL
EDITTEXT IDC_EDIT_CENTER_Y,41,30,40,15,ES_CENTER | ES_AUTOHSCROLL
EDITTEXT IDC_EDIT_CENTER_Z,41,46,40,15,ES_CENTER | ES_AUTOHSCROLL
CTEXT "X:",IDC_STATIC,7,15,23,15
CTEXT "Y:",IDC_STATIC,7,30,23,15
CTEXT "Z:",IDC_STATIC,7,46,23,15
LTEXT "0",IDC_STATIC,13,94,11,13
LTEXT "1",IDC_STATIC,51,94,11,13
LTEXT "1.5",IDC_STATIC,70,94,11,13
END
IDD_POINT_EDIT_DIALOG DIALOGEX 0, 0, 105, 124
STYLE DS_3DLOOK | WS_CHILD
EXSTYLE WS_EX_CLIENTEDGE
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
CONTROL "Slider1",IDC_SLIDER1,"msctls_trackbar32",TBS_NOTICKS |
WS_TABSTOP,5,7,93,12
LTEXT "",IDC_STATIC_LINE,7,30,91,45,NOT WS_GROUP
END
IDD_ALTIMAP3D DIALOGEX 0, 0, 123, 161
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Altimap"
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,66,122,50,14
PUSHBUTTON "Cancel",IDCANCEL,66,140,50,14
CONTROL "Slider1",IDC_SLIDER_NBX,"msctls_trackbar32",
TBS_AUTOTICKS | TBS_BOTH | WS_TABSTOP,7,102,50,13,
WS_EX_CLIENTEDGE
EDITTEXT IDC_NBX,7,79,50,14,ES_AUTOHSCROLL
LTEXT "Nb of x divisions",IDC_STATIC,7,66,52,12
CONTROL "Slider1",IDC_SLIDER_NBY,"msctls_trackbar32",
TBS_AUTOTICKS | TBS_BOTH | WS_TABSTOP,66,102,50,13,
WS_EX_CLIENTEDGE
EDITTEXT IDC_NBY,66,79,50,14,ES_AUTOHSCROLL
LTEXT "Nb of y divisions",IDC_STATIC,64,66,52,12
CONTROL "Slider1",IDC_SLIDER_SIZEX,"msctls_trackbar32",
TBS_AUTOTICKS | TBS_BOTH | WS_TABSTOP,7,44,50,13,
WS_EX_CLIENTEDGE
EDITTEXT IDC_SIZEX,7,20,50,14,ES_AUTOHSCROLL
LTEXT "x size",IDC_STATIC,7,7,52,12
CONTROL "Slider1",IDC_SLIDER_SIZEY,"msctls_trackbar32",
TBS_AUTOTICKS | TBS_BOTH | WS_TABSTOP,66,44,50,13,
WS_EX_CLIENTEDGE
EDITTEXT IDC_SIZEY,66,20,50,14,ES_AUTOHSCROLL
LTEXT "y size",IDC_STATIC,64,7,52,12
LTEXT "0",IDC_STATIC,7,35,8,8
LTEXT "15",IDC_STATIC,50,35,8,8
LTEXT "0",IDC_STATIC,65,35,8,8
LTEXT "15",IDC_STATIC,108,35,8,8
LTEXT "2",IDC_STATIC,7,94,8,8
LTEXT "50",IDC_STATIC,50,94,8,8
LTEXT "2",IDC_STATIC,65,94,8,8
LTEXT "50",IDC_STATIC,108,94,8,8
CONTROL "SET_ORIENTATION",IDC_SET_ORIENTATION,"Button",
BS_OWNERDRAW | BS_ICON | WS_TABSTOP,7,121,25,22
CONTROL "SET_LEFT",IDC_SET_LEFT,"Button",BS_OWNERDRAW | BS_ICON |
WS_TABSTOP,7,146,12,8
CONTROL "SET_RIGHT",IDC_SET_RIGHT,"Button",BS_OWNERDRAW |
BS_ICON | WS_TABSTOP,19,146,13,8
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_DIALOGBOX, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 84
TOPMARGIN, 7
BOTTOMMARGIN, 167
END
IDD_DIALOGBOX3D, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 125
TOPMARGIN, 7
BOTTOMMARGIN, 106
END
IDD_DIALOGCONE, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 77
TOPMARGIN, 7
BOTTOMMARGIN, 207
END
IDD_DIALOGCONE3D, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 120
TOPMARGIN, 2
BOTTOMMARGIN, 90
END
IDD_DIALOGOBJECT, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 78
TOPMARGIN, 7
BOTTOMMARGIN, 115
END
IDD_DIALOGPOINT3D, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 115
TOPMARGIN, 7
BOTTOMMARGIN, 40
END
IDD_DIALOGSPHERE, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 80
TOPMARGIN, 7
BOTTOMMARGIN, 171
END
IDD_DIALOGSPHERE3D, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 81
TOPMARGIN, 7
BOTTOMMARGIN, 125
END
IDD_POINT_EDIT_DIALOG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 98
TOPMARGIN, 7
BOTTOMMARGIN, 117
END
IDD_ALTIMAP3D, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 116
TOPMARGIN, 7
BOTTOMMARGIN, 154
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDR_EDIT_TOOLBAR BITMAP DISCARDABLE "res\\cedit.bmp"
IDB_SQUARE_12 BITMAP DISCARDABLE "res\\square_4.bmp"
IDB_SQUARE_08 BITMAP DISCARDABLE "res\\bmp00005.bmp"
IDB_SQUARE_04 BITMAP DISCARDABLE "res\\square_5.bmp"
IDB_SQUARE_03 BITMAP DISCARDABLE "res\\square_0.bmp"
IDB_SQUARE_02 BITMAP DISCARDABLE "res\\bmp00004.bmp"
IDB_SQUARE_01 BITMAP DISCARDABLE "res\\square_1.bmp"
IDB_SQUARE_00 BITMAP DISCARDABLE "res\\bitmap1.bmp"
IDB_RIGHT_SET_TOP BITMAP DISCARDABLE "res\\bmp00001.bmp"
IDB_RIGHT_SET_BOTTOM BITMAP DISCARDABLE "res\\bmp00002.bmp"
IDB_RIGHT_CLEAR_TOP BITMAP DISCARDABLE "res\\bmp00003.bmp"
IDB_RIGHT_CLEAR_BOTTOM BITMAP DISCARDABLE "res\\right_cl.bmp"
IDB_LEFT_SET_TOP BITMAP DISCARDABLE "res\\orientationd.bmp"
IDB_LEFT_SET_BOTTOM BITMAP DISCARDABLE "res\\left_set.bmp"
IDB_LEFT_CLEAR_TOP BITMAP DISCARDABLE "res\\orientationu.bmp"
IDB_LEFT_CLEAR_BOTTOM BITMAP DISCARDABLE "res\\left_cle.bmp"
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDR_INDEXED_TRIANGLE ICON DISCARDABLE "res\\icon1.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDR_INDEXED_TRIANGLE MENU DISCARDABLE
BEGIN
MENUITEM " ", 65535
MENUITEM " ", IDW_TOOLBAR
END
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDC_STATIC_NAME "Name\nName"
IDR_INDEXED_TRIANGLE "IndexedTriangleEditor\n\\"
IDR_INDEXED_TRIANGLE2 "IndexedTriangleEditor\n\\"
IDC_STATIC_XNB "xnb"
IDC_STATIC_YNB "ynb"
134 "name"
IDC_EDIT_XNB "xnb"
IDC_EDIT_YNB "ynb"
END
STRINGTABLE DISCARDABLE
BEGIN
IDC_SLIDER "sl"
IDS_DEFAULT_ITNAME "I_triangle"
IDC_NEW_OBJECT "New object\nNew Object"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_EDIT_SLIDER "Modify filter\nModify filter"
ID_STATIC_NAME "Name of the indexed triangle\nName of the indexed triangle"
ID_EDIT_NAME "Enter name of the indexed triangle\nEnter name of the indexed triangle"
ID_STATIC_XNB "x\nX"
ID_EDIT_XNB "ex"
ID_STATIC_YNB "y"
ID_EDIT_YNB "ey"
ID_BT_NEW "new\nNew indexed triangle"
ID_BT_SAVE "save\nSave"
ID_BT_UNDO "undo\nUndo"
ID_BT_REDO "redo\nRedo"
ID_BT_ONTOP "OnTop\nOnTop"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_BT_EXIT "exit\nExit"
ID_BT_HIDE "Hide the back\nHide the back"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_LOG_FILENAME "\\IT\\GEOMOBJ.LOG"
IDS_BASE_PATH "x:\\cpa\\exe\\main\\"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// French (France) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA)
#ifdef _WIN32
LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_DLGCARACT DIALOGEX 0, 0, 119, 217
STYLE DS_3DLOOK | WS_CHILD
EXSTYLE WS_EX_CLIENTEDGE
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
LTEXT "Points",IDC_STATIC,37,34,21,8
CTEXT "",IDC_STATIC_NBPOINTS,10,32,21,11,WS_BORDER
LTEXT "Edges",IDC_STATIC,37,50,21,8
CTEXT "",IDC_STATIC_NBEDGES,10,47,21,11,WS_BORDER
EDITTEXT IDC_EDIT_NAME,10,14,99,14,ES_AUTOHSCROLL | ES_READONLY |
WS_DISABLED
GROUPBOX "",IDC_STATIC_BORDER,7,7,105,86,0,WS_EX_TRANSPARENT
LTEXT "Elements",IDC_STATIC,37,64,70,8
CTEXT "",IDC_ELEMENTS,10,62,21,11,WS_BORDER
CONTROL "List1",IDC_LIST_ELEMENTS,"SysListView32",LVS_REPORT |
WS_BORDER | WS_TABSTOP,6,109,105,101
LTEXT "List of Elements",IDC_STATIC,7,97,50,8
LTEXT "Bounding Volumes",IDC_STATIC,38,79,70,8
CTEXT "",IDC_STATIC_NBBDV,10,77,21,11,WS_BORDER
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_DLGCARACT, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 112
TOPMARGIN, 7
BOTTOMMARGIN, 210
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_OGD_DLGBAR_ICON ICON DISCARDABLE "res\\ogd_dlgb.ico"
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"3DGe_res.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#endif // French (France) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -0,0 +1,81 @@
//#################################################################################
//
// BASE DEFINITION CLASS OF DLL interface Modification
//
//#################################################################################
//
//
#ifndef __3DGMODIF_HPP__
#define __3DGMODIF_HPP__
class Geometry3D;
//CPA2 Corneliu Babiuc 08-09-98 (duplicated points)
class CPA_PointsList;
//END CPA2 Corneliu Babiuc 08-09-98 (duplicated points)
///////////////////////////////////////////////////////////////////////////////
// class Geometry3D_Modif
class Geometry3D_Modif : public CPA_Modif
{
protected:
//CPA2 Corneliu Babiuc 09-09-98 (duplicated points)
/*
Geometry3D *m_p_xObject;
//-------------------------------------------
//ROMTEAM WorldEditor (Viorel Preoteasa 20/01/98)
// ACP_tdxIndex m_xIndexPoint;
ACP_tdxIndex *m_xIndexPoints;
int m_iNbPoints;
float *m_fDist;
//ENDROMTEAM WorldEditor (Viorel Preoteasa)
*/
CPA_List<CPA_PointsList> m_lstPointsList;
//END CPA2 Corneliu Babiuc 09-09-98 (duplicated points)
//-------------------------------------------
MTH3D_tdstVector m_st3DTranslation;
BOOL m_bFirstTime;
//ROMTEAM WorldEditor (Nicu 05/12/97)
DWORD m_pGeom;
DWORD *m_adrGeom;
public:
//-------------------------------------------
//ROMTEAM WorldEditor (Viorel Preoteasa 20/01/98)
// Geometry3D_Modif(Geometry3D *_p_Object,ACP_tdxIndex _xIndexPoint,MTH3D_tdstVector _st3DTranslation, DWORD *adr = NULL);
//CPA2 Corneliu Babiuc 09-09-98 (duplicated points)
Geometry3D_Modif(CPA_List<CPA_PointsList> *_lstPoints, MTH3D_tdstVector _st3DTranslation, DWORD *adr = NULL, BOOL _bFirstTime = TRUE);
// Geometry3D_Modif(Geometry3D *_p_Object,int NbPoints, ACP_tdxIndex *_xIndexPoints, float *Dist, MTH3D_tdstVector _st3DTranslation, DWORD *adr = NULL);
//END CPA2 Corneliu Babiuc 09-09-98 (duplicated points)
//ENDROMTEAM WorldEditor (Viorel Preoteasa)
//-------------------------------------------
//ENDROMTEAM WorldEditor (Nicu)
~Geometry3D_Modif();
// actions
BOOL Do (void);
BOOL Undo (void);
};
///////////////////////////////////////////////////////////////////////////////
// class Geometry3D_Rename
class Geometry3D_Rename : public CPA_Modif
{
protected:
Geometry3D *m_p_xObject;
CString m_csNewName;
public:
Geometry3D_Rename(Geometry3D *_p_Object,CString _csName);
~Geometry3D_Rename();
// actions
BOOL Do (void);
BOOL Undo (void);
};
#endif //__3DGMODIF_HPP__

View File

@@ -0,0 +1,475 @@
//**************************************
// This is the base class of your DLL interface
// All methods of CPA_ObjectDLLBase are
// present in that class.
//**************************************
#ifndef __3DGINTERF_HPP__
#define __3DGINTERF_HPP__
//#include "ObjDLLb.hpp"
#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
#include "OGD\3DObject.hpp"
#undef CPA_WANTS_EXPORT
#define CPA_WANTS_IMPORT
class CDlgCaract;
class CPA_MainWorld;
class CPA_KeyActionConfiguration;
class CPA_DialogList;
class CPA_SuperObject;
class EDT_Model;
class FRMBase;
class CSplitFrame;
class GeometricFile;
//ROMTEAM WorldEditor (Viorel Preoteasa 20/01/98)
class CDlgEditPoints;
//ENDROMTEAM WorldEditor (Viorel Preoteasa)
//**************************************
// define
//**************************************
#define C_szGenDoorsDataPath "Edt_Data\\Objects\\Actors\\Models\\GenDoors"
#define C_szGeometricType "Geometric"
#define C_szFormModif "Form"
#define C_szMaterialModif "Material"
// BEGIN CPA2 Cristi Petrescu 98-02-
#define C_szFMDModif "FMD"
// END CPA2 Cristi Petrescu 98-02-
#define C_szModifActionName "Modif-Geometric"
#define C_szModifListActionName "Edit-Geometric-Modifications"
#define C_szOGDModuleNameEro "OGD Module"
typedef CList<CString,CString> CListOfString;
// if you want only one instance of your DLL
// activate the next line
#define DLL_ONLY_ONE_INSTANCE
//----------------------------------------------------------
// Object DLL interface class
//----------------------------------------------------------
//ROMTEAM WorldEditor (Nicu 16/01/98)
class CTriEdit;
class CEdThread;
//ENDROMTEAM WorldEditor (Nicu)
// BEGIN CPA2 Cristi Petrescu 98-02-
typedef struct tdstModifFile_
{
CPA_SectionObject *p_oModifSection;
CPA_List<Geometry3D> oListOfModifiedObjects;
}
tdstModifFile;
// END CPA2 Cristi Petrescu 98-02-
//CPA2 Corneliu Babiuc 02-09-98 (duplicated points)
class CPA_PointsList
{
private:
CPA_SuperObject * m_pSelectedSuperObject; //superobject owner of points
Geometry3D * m_pSelectedObject; //object owner of points
public:
int m_iNbSelectedPoints; //number of selected points
ACP_tdxIndex * m_xSelectedPointsIndex; //array of points indices
float * m_fDist;
//constructor
CPA_PointsList(CPA_SuperObject * p_SO, Geometry3D * p_Object)
{ m_iNbSelectedPoints = 0;
m_pSelectedSuperObject = p_SO;
m_pSelectedObject = p_Object;
m_xSelectedPointsIndex = new ACP_tdxIndex[p_Object->GetStruct()->xNbPoints];
m_fDist = new float[p_Object->GetStruct()->xNbPoints];
}
//copy constructor
CPA_PointsList(const CPA_PointsList& Points)
{ m_pSelectedSuperObject = Points.m_pSelectedSuperObject;
m_pSelectedObject = Points.m_pSelectedObject;
m_iNbSelectedPoints = Points.m_iNbSelectedPoints;
m_xSelectedPointsIndex = new ACP_tdxIndex[m_iNbSelectedPoints];
memcpy(m_xSelectedPointsIndex, Points.m_xSelectedPointsIndex, m_iNbSelectedPoints * sizeof(ACP_tdxIndex));
m_fDist = new float[m_iNbSelectedPoints];
memcpy(m_fDist, Points.m_fDist, m_iNbSelectedPoints * sizeof(float));
}
//destructor
~CPA_PointsList() { delete []m_xSelectedPointsIndex; delete []m_fDist;}
//access functions
CPA_SuperObject * GetSuperObject (void) {return m_pSelectedSuperObject;}
Geometry3D * GetObject (void) {return m_pSelectedObject;}
int GetNumberOfSelectedPoints (void) {return m_iNbSelectedPoints;}
void SetDistance (int iIndex, float fDist) { ASSERT (iIndex < m_iNbSelectedPoints); m_fDist[iIndex] = fDist;}
float GetDistance (int iIndex) { ASSERT (iIndex < m_iNbSelectedPoints); return m_fDist[iIndex];}
ACP_tdxIndex GetDeletePoint() {return m_xSelectedPointsIndex[m_iNbSelectedPoints - 1];}
ACP_tdxIndex GetPoint (int iIndex) {return m_xSelectedPointsIndex[iIndex];}
//function to get the index of a selected point (in local list !!!)
//returns the index if the point is in selection list, otherwise a negative value
int GetPointIndexInSelection(ACP_tdxIndex xPointIndex)
{ for (int i=0; i < m_iNbSelectedPoints; i++)
if (m_xSelectedPointsIndex[i] == xPointIndex) return i;
return -1;
}
void AddPointToSelection (ACP_tdxIndex xPointIndex) {m_xSelectedPointsIndex[m_iNbSelectedPoints++] = xPointIndex;}
//function to remove a point from selection
//gets as perameter the index in selection list !!!
void RemovePointFromSelection(int iIndex)
{
ASSERT(iIndex < m_iNbSelectedPoints);
for ( ;iIndex<m_iNbSelectedPoints-1; iIndex++)
m_xSelectedPointsIndex[iIndex] = m_xSelectedPointsIndex[iIndex+1];
m_iNbSelectedPoints--;
}
};
//END CPA2 Corneliu Babiuc 02-09-98 (duplicated points)
class Geometry3D_Interface : public CPA_ObjectDLLBase
{
private:
CPA_SuperObject *m_p_SelectedSprObj;
Geometry3D *m_p_SelectedObject;
//--------------------------------------
//ROMTEAM WorldEditor (Viorel Preoteasa 20/01/98)
CDlgEditPoints *m_p_DlgEditPoints;
//CPA2 Corneliu Babiuc 02-09-98 (duplicated points)
// ACP_tdxIndex *m_xSelectedPointsIndex;
// float *m_fDist;
// int m_iNbSelectedPoints;
CPA_List<CPA_PointsList> m_lstListOfSelectedPoints;
BOOL m_bSelectDuplicatesMode;
// the above boolean tells if the last move was in normal mode (TRUE) or duplicates mode (FALSE)
BOOL m_bLastMoveWasNormal;
//END CPA2 Corneliu Babiuc 02-09-98 (duplicated points)
BOOL m_bLButtonIsDown;
int m_iDeletePoint;
BOOL m_bShiftUsed;
MTH3D_tdstVector m_stTranslatedPoint;
BOOL m_bVolSelection;
//ACP_tdxIndex m_xSelectedPointIndex;
//ENDROMTEAM WorldEditor (Viorel Preoteasa)
//---------------------------------------
BOOL m_bPointSelected;
MTH3D_tdstVector m_st3DTranslation;
BOOL m_bPointTranslated;
CDlgCaract *m_p_DlgCaract;
CPA_KeyActionConfiguration *m_p_oKeyConfiguration;
BOOL m_bCtrlUsed;
CPA_DialogList *m_p_DlgList;
CSplitFrame *m_p_oSplitterLeft;
CString m_csPreviousSelectMode;
CPA_BaseObjectList m_oListOfSuperObjectPO;
BOOL m_bShowWarnings;
BOOL m_bStopWarnings;
//ROMTEAM WorldEditor (Nicu 05/12/97)
void *m_LastGeom; // save GPO geom
//ENDROMTEAM WorldEditor (Nicu)
// ANNECY MT 23/02/98 {
BOOL m_bShowBoundingVolume;
CPA_SuperObject *m_p_oBoundingVolumeSprObj;
Geometry3D *m_p_oBoundingVolumeObject;
// END ANNECY MT }
Geometry3D *m_p_ModifiedObject;
ACP_tdxHandleOfElement m_hModifiedElement;
GMT_tdxHandleToGameMaterial m_hElementMaterial;
public:
// LinkTable for Modif Section
//CListOfString m_oListOfModifSection;
//CListOfString m_oListOfModificationFiles;
// BEGIN CPA2 Cristi Petrescu 98-02-
CPA_List<tdstModifFile> m_oListOfModifiedFiles;
// END CPA2 Cristi Petrescu 98-02-
public:
//----------------------------------------------------------
// Constructor
//----------------------------------------------------------
Geometry3D_Interface();
//CPA2 Corneliu Babiuc 14-09-98 (duplicated points)
~Geometry3D_Interface(void);
//CPA2 Corneliu Babiuc 14-09-98 (duplicated points)
// ACP MEssages Functions overload
// BOOL fn_bPreTranslateMessage (MSG *);
void fn_vJustAfterRegistered (void);
void fn_vConstruct (void);
// void fn_vRefreshDatas (void);
// void fn_vAddObjectsToDraw (GLD_tdstViewportAttributes *, GLI_tdstLight *);
//ROMTEAM WorldEditor (Viorel Preoteasa 20/01/98)
void fn_vAddObjectsToDraw (GLD_tdstViewportAttributes *pViewportAttributes, GLI_tdxHandleToLight p2, DEV_ViewPort* p3);
//ENDROMTEAM WorldEditor (Viorel Preoteasa)
// void fn_vAddObjectsToDraw2 (GLD_tdstViewportAttributes *, GLI_tdstLight *);
// BOOL fn_bAcceptToRunEngine (void);
void fn_vBeforeEngine (void);
void fn_vBeforeEditor (void);
// void fn_vHasLostFocus (void);
// BOOL fn_bHasGainedFocus (void);
// BOOL fn_bAcceptToExit (void);
// void fn_vJustBeforeClosing (void);
void fn_vBeforeSaveAll (void);
// Windows MEssages Functions overload
// BOOL _OnCommand (UINT);
// BOOL _OnUpdateCommandUI (UINT, CCmdUI *);
BOOL _OnKeyDown (UINT, UINT, UINT);
BOOL _OnKeyUp (UINT, UINT, UINT);
BOOL _OnMouseMove (UINT, tdstMousePos *, MTH3D_tdstVector *);
// BOOL _OnLButtonDblClk (UINT, tdstMousePos *, ACP_tdxIndex, HIE_tdstPickInfo *);
// BOOL _OnRButtonDblClk (UINT, tdstMousePos *, ACP_tdxIndex, HIE_tdstPickInfo *);
BOOL _OnLButtonDown (UINT, tdstMousePos *, ACP_tdxIndex, HIE_tdstPickInfo *);
// ANNECY MT 23/02/98 {
BOOL _OnRButtonDown (UINT, tdstMousePos *, ACP_tdxIndex, HIE_tdstPickInfo *);
// END ANNECY MT }
BOOL _OnLButtonUp (UINT, tdstMousePos *);
// BOOL _OnRButtonUp (UINT, tdstMousePos *);
// BOOL _OnDragDropEnd (WPARAM, LPARAM);
// BOOL _OnDragDropMove (WPARAM, LPARAM);
// BOOL _OnDragDropLooseFocus (WPARAM, LPARAM);
// BOOL _OnDragDropGainFocus (WPARAM, LPARAM);
// for changes
void fn_vOnChangeRoot (void);
void fn_vOnChangeWorld (void);
void fn_vOnChangeDevice (void);
// Editor Modifs
void fn_vOnModifDelete (CPA_List<EDT_SaveParents> *pListObjects, tdeTypeModif eType, tdeStatus eStatus);
void fn_vOnModifParent (CPA_List<EDT_SaveParents> *pListObjects, tdeTypeModif eType, tdeStatus eStatus);
void fn_vOnModifCopy (CPA_List<EDT_SaveParents> *pListObjects, tdeTypeModif eType, tdeStatus eStatus);
void fn_vOnModifName (CPA_SuperObject *pEdObj, CString csInitalName, CString csFinalName, tdeTypeModif eType, tdeStatus eStatus);
void fn_vOnSelect (CPA_SuperObject *pEdObj, tdeTypeModif eType, tdeStatus eStatus);
// virtual void fn_vOnModifInsert (CPA_SuperObject *pEdObj, CPA_SuperObject *pParent,
// tdstPosition *p_stPosition, tdeTypeModif eType, tdeStatus eStatus) { }
// moves
// void fn_vOnModifMove (CPA_List<EDT_SavePos> *pListObjects, CPA_List<CPA_SuperObject> *pListConcerned, tdeTypeModif eType, tdeStatus eStatus) { }
// void fn_vOnBeginMove (CPA_List<CPA_SuperObject> *pListObjects, CPA_List<CPA_SuperObject> *pListConcerned, tdeStatus eStatus) { }
// void fn_vOnMoving (CPA_List<CPA_SuperObject> *pListObjects, CPA_List<CPA_SuperObject> *pListConcerned, tdeStatus eStatus) { }
// permission
// virtual BOOL fn_bAcceptModifDelete (CPA_List<CPA_SuperObject> *pListObjects, tdeStatus eStatus) { return TRUE; }
// virtual BOOL fn_bAcceptModifParent (CPA_List<CPA_SuperObject> *pListObjects, tdeStatus eStatus) { return TRUE; }
// virtual BOOL fn_bAcceptModifCopy (CPA_List<CPA_SuperObject> *pListObjects, tdeStatus eStatus) { return TRUE; }
// virtual BOOL fn_bAcceptModifTranslate (CPA_List<CPA_SuperObject> *pListObjects, tdeStatus eStatus) { return TRUE; }
// virtual BOOL fn_bAcceptModifRotate (CPA_List<CPA_SuperObject> *pListObjects, tdeStatus eStatus) { return TRUE; }
// virtual BOOL fn_bAcceptModifInsert (CPA_SuperObject *pEdObj, CPA_SuperObject *pParent, tdeStatus eStatus) { return TRUE; }
// virtual BOOL fn_bAcceptModifScale (CPA_SuperObject *pEdObj, tdeStatus eStatus) { return TRUE; }
// virtual BOOL fn_bAcceptModifName (CPA_SuperObject *pEdObj, tdeStatus eStatus) { return TRUE; }
virtual BOOL fn_bAcceptMultiSelect (void) { return FALSE; }
// to precise selection
// virtual tdeTypeAnswer fn_bAcceptSelect (CPA_SuperObject *pEdObj, ACP_tdxIndex xIndex, HIE_tdstPickInfo *pPicking, tdeStatus eStatus) { return C_Accept; }
// -------------------------------------------------------------
// Dialog List
// -------------------------------------------------------------
CPA_BaseObject * GetDialogSelection (CPA_DialogList *pDialog, CString csTypeName, tdeListDrawMode eDrawMode);
void GetListsForDialog (CPA_DialogList *pDialog);
BOOL fn_bOnSelChangeHierarchyTree (CPA_DialogList *pDialog, CString csTypeName, CPA_BaseObject *pSelectedObject, CPA_BaseObject *pSelectedParent);
BOOL fn_bOnDblClkHierarchyTree (CPA_DialogList *pDialog, CString csTypeName, CPA_BaseObject *pSelectedObject, CPA_BaseObject *pSelectedParent);
BOOL fn_bOnSelChangeListObjects (CPA_DialogList *pDialog, CString csTypeName, CPA_BaseObject *pSelectedObject, BOOL bUnselect);
BOOL fn_bOnDblClkListObjects (CPA_DialogList *pDialog, CString csTypeName, CPA_BaseObject *pSelectedObject);
// BOOL fn_bCanDragItemInHierarchyTree (CPA_DialogList *pDialog, CString csTypeName, CPA_SuperObject *pObjectToDrag) { return FALSE; }
// BOOL fn_bCanDropItemInHierarchyTree (CPA_DialogList *pDialog, CString csTypeName, CPA_SuperObject *pObjectToDrop, CPA_SuperObject *pTarget) { return FALSE; }
// BOOL fn_bOnDragDropInHierarchyTree (CPA_DialogList *pDialog, CString csTypeName, CPA_SuperObject *pObject, CPA_SuperObject *pTarget) { return FALSE; }
// BOOL fn_bOnSelChangeComboList (CPA_DialogList *pDialog, CString csTypeName) { return FALSE; }
// BOOL fn_bOnButtonTest (CPA_DialogList *pDialog, CString csTypeName, tdeDrawMode eDrawMode) { return FALSE; }
void fn_vInitDefaultParameters (CPA_DialogList *pDialog);
// void fn_vSetANewTest (CPA_DialogList *pDialog, CString csCurrentList) { return; }
// BOOL fn_bSetCustomTest (CPA_DialogList *pDialog) { return FALSE; }
//
// BOOL fn_bTestFunction (CString csCurrentType, CString csTestName, CPA_ReachableObject *pEdObj) { return TRUE; }
// BOOL fn_bCustomTestFunction (CString csCurrentType, CString csTestName, CPA_ReachableObject *pEdObj) { return TRUE; }
/*===========================================================================
Dialog Bar - Mircea Dunka 31 Aug. 1998
=========================================================================*/
void fn_vDefineDlgBarBtnIcon (tde_DlgBarCategory wCategory, tds_DlgBarBtn *_pDlgBarBtn);
// -------------------------------------------------------------
// Menus
// -------------------------------------------------------------
BOOL fn_bDefineSubMenu (EDT_SubMenu *_p_oEDTSubMenu);
void _OnSubMenuCommand (EDT_SubMenu *_p_oEDTSubMenu,UINT uiMsgID);
BOOL fn_bDefinePopupMenu(EDT_PopUpMenu *pPopup, CPA_List<CPA_SuperObject> *pSelection, BOOL bIsAlone);
void _OnPopUpMenuCommand(UINT m_IDCmdMsg);
// -------------------------------------------------------------
// Current Editor
// -------------------------------------------------------------
tdePermission fn_eAcceptNewEditor (CPA_EditorBase *pNewDLL) { return C_CloseBefore; }
BOOL fn_bCanActivateEditor (CPA_List<CPA_BaseObject> *pParam);
BOOL fn_bCanCloseEditor (void);
void fn_vOnActivateEditor (CPA_List<CPA_BaseObject> *pParam, BOOL bBackActivated=FALSE);
void fn_vOnCloseEditor (void);
// CString GetCurrentEditorName (void);
// void fn_vBackActiveMe (void *pMyData) {};
// void fn_vEraseWalkDataStructure (void *pMyData) {};
/*===========================================================================
General Purpose
=========================================================================*/
long OnQueryAction (CPA_EditorBase * /*p_oSender*/, WPARAM, LPARAM);
// long OnQueryInfos (CPA_EditorBase * /*p_oSender*/, WPARAM, LPARAM) { return 0; };
// long OnQueryOpen (CPA_EditorBase * /*p_oSender*/, WPARAM, LPARAM) { return 0; };
// long OnQueryClose (CPA_EditorBase * /*p_oSender*/, WPARAM, LPARAM) { return 0; };
/*===========================================================================
Coherence
=========================================================================*/
// BOOL fn_bOnInvalidateLink (CPA_ObjectBase *pOwner, CPA_ObjectBase *pReferencedObject, BOOL bDestroyed) { return FALSE; }
// void fn_vOnRestoreLink (CPA_ObjectBase *pOwner, CPA_ObjectBase *pReferencedObject) { }
//====================================================================================
//====================================================================================
//====================================================================================
//========================= OBJECT DLL FUNCTIONS OVERLOAD ============================
//====================================================================================
//====================================================================================
//====================================================================================
// hierarchy
CPA_SuperObject * GetNewEditorInstance (HIE_tdxHandleToSuperObject pEngineInstance);
// void fn_vUpdateEditorInstance (CPA_SuperObject *pEditorInstance, HIE_tdxHandleToSuperObject pEngineInstance) { }
BOOL fn_bCanHandleThisType (long lEngineType);
// models & instances
void fn_vInitListByType (CPA_World *pWorld);
// void fn_vInitListsOfModels (void);
// void fn_vSaveListModels (CString csListName, CPA_List<EDT_Model> *pListModels) { }
// CString fn_pszLoadListModels (void) { return NULL; }
// EDT_Model * GetNewModel (void) { return NULL; }
// BOOL fn_bCanLoadNewModel (CString csListName) { return FALSE; }
// BOOL fn_bCanSaveListModels (CString csListName) { return FALSE; }
// BOOL fn_bCanLoadListModels (void) { return FALSE; }
// CPA_SuperObject * GetNewInstance (CString csTypeName, CString csModelName, CPA_SuperObject *pParent) { return NULL; }
// tdeTypeSO GetTypeInstance (CString csTypeName, CString csModelName) { return C_NoType; }
// CPA_SuperObject * GetParentForInsertion (CString csTypeName, CString csModelName, tdstPosition *p_stPosition) { return NULL; }
// BOOL fn_bChooseInsertPosition(CPA_SuperObject *pNewInstance, CPA_SuperObject *pParent, tdstPosition *p_stPosition) { return FALSE; }
// objects
// CPA_Object * GetNewObject (CString csObjectFile, CString csObjectName, FILE *p_fFile, CPA_MainWorld *p_oMainWorld) { return NULL; }
CPA_BaseObject * Duplicate (CPA_BaseObject *pObject, CPA_SuperObject *pNewSuperObject);
// CPA_SuperObject * GetCopyOfProtectedChild (CPA_SuperObject *pInitialChild, CPA_SuperObject *pNewOwner) { return NULL; }
// permissions for EvtEditor
// BOOL fn_bAcceptAsParent (CPA_Object *pChild, CPA_Object *pParent) { return TRUE; }
// BOOL fn_bAcceptAsChild (CPA_Object *pParent, CPA_Object *pChild) { return TRUE; }
// when insertion is canceled
// void fn_vOnCancelInsertion (CPA_SuperObject *pInstance);
void fn_vBuildNewEditorInstance (CPA_SuperObject *pEditorInstance, HIE_tdxHandleToSuperObject hEngineInstance);
//====================================================================================
//====================================================================================
// Owner
//====================================================================================
//====================================================================================
void fn_vChangeName (CString _csName);
void fn_vNameChanged (void);
void fn_vComputeBoundingVolume (CPA_BaseObject *pObj);
ACP_tdxHandleOfObject fn_hGetBoundingVolume (CPA_BaseObject *_pObj);
BOOL fn_bModificationFileExist (CPA_BaseObject *_p_oObject);
void fn_vComputeModificationFile (char *_p_cFileName, CPA_SaveObject *_p_oObject);
BOOL fn_bShowWarnings (void);
void fn_vStopWarnings (void);
void mfn_vShowOrHideElement (BOOL _bShow, CPA_SuperObject *_p_oSprObj = NULL, Geometry3D *_p_oObject = NULL, ACP_tdxHandleOfElement hElement = 0);
protected:
void fn_vUnSelect (void);
//void mfn_vAddFileOnModifSectionList (char * _szFileName);
//BOOL mfn_bSectionExistsOnModifSectionList (char *_szSectionName);
void mfn_vUpdateModificationFilesList (CPA_BaseObject *_p_oObject);
void mfn_vSavePreferences (void);
void mfn_vComputeLocalTranslation (CPA_SuperObject *_p_oSprObj, MTH3D_tdstVector *_p_stVector,MTH3D_tdstVector *_p_stResultVector);
void mfn_vFillListWithPO (CPA_BaseObjectList *_p_oList, CPA_SuperObject *_p_oSprObj);
char *mfn_p_cGetOGDTypePath (char *_szSectionName);
// CPA_BaseObject *mfn_p_oGetGeometricFile(char *_szSectionName);
// ANNECY MT 23/02/98 {
void mfn_vShowOrHideBoundingVolume ( BOOL _bShow );
// END ANNECY MT }
// BEGIN CPA2 Cristi Petrescu 98-02-
void mfn_vClearFileModificationsList();
void mfn_vAddFileModification(Geometry3D *p_oObject);
tdstModifFile *mfn_p_stGetFileModification(Geometry3D *p_oObject);
void mfn_vComputeModifSectionName(char *szModifSectionName, Geometry3D *p_oObject);
static void CallBackSaveModifListGeometricObject(SCR_tdst_File_Description *p_stFile, char *p_szSectionName, void *p_vData, SCR_tde_Ntfy_Action eAction);
static SCR_tde_Anl_ReturnValue CallBackLoadModifList(SCR_tdst_File_Description *_p_stFile, char *_pszName, char *_ap_szParams[], SCR_tde_Anl_Action _eAction);
// END CPA2 Cristi Petrescu 98-02-
//ROMTEAM WorldEditor (Cristian Stegaru 11/97)
//CPA2 Corneliu Babiuc 02-09-98 (duplicated points)
POSITION mfn_pGetObjectPositionInSelectedPointsList (CPA_SuperObject * p_SuperObject);
POSITION mfn_pInsertObjectInSelectedPointsList (CPA_SuperObject * p_SuperObject, Geometry3D * p_Object);
POSITION mfn_pInsertPointsElementInHeadPosition (CPA_PointsList * p_Points);
void mfn_vClearListOfSelectedPoints (void);
BOOL mfn_vUpdateSelectedPointsList (CPA_SuperObject * p_SO, ACP_tdxIndex xIndex);
void mfn_vUpdateDuplicatedPointsList (CPA_SuperObject * p_SO, ACP_tdxIndex xIndex, BOOL bInserted, float fDistance = 0.0);
void mfn_vUpdateDuplicatedPointsPositions (void);
//function to obtain the geometric object from SuperObject
Geometry3D * mfn_pGetGeometricObject (CPA_SuperObject * p_SO);
//END CPA2 Corneliu Babiuc 16-09-98 (duplicated points)
public:
// Services
CPA_KeyActionConfiguration *GetKeyActionConfiguration (void) {return m_p_oKeyConfiguration;};
//interface for indexed triangle editor
public:
BOOL mfn_bCreateITObject (CTriEdit *pITEditor, CString csName);
protected:
CPA_EditorBase *m_pCallingDll;
int m_iQueryCt;
CEdThread *m_pITEditor;
BOOL mfn_bStartITEditor ();
BOOL mfn_bEndITEditor ();
CTriEdit *mfn_pGetITEditor ();
CString mfn_csGetGeometricName (CString csBaseName);
//ENDROMTEAM WorldEditor (Cristian Stegaru)
};
extern tdstDLLIdentity g_stGeometry3DIdentity;
//ROMTEAM WorldEditor (Nicu 16/01/98)
// the Keyboard configuration
#define KA_3DG_CTRL 1
#define KA_3DG_SIZE KA_3DG_CTRL
//ENDROMTEAM WorldEditor (Nicu)
#endif // __3DGINTERF_HPP__

View File

@@ -0,0 +1,125 @@
//ROMTEAM WorldEditor
////////////////////////////////////////////////////////////////////////////////////////
// File : Indexed Triangular Mesh editor
// Author : Nicolae Suparatu
// Date :
// Description :
////////////////////////////////////////////////////////////////////////////////////////
#define MAXLIN 40
#define MAXUNDOSTACK 32
typedef float (*pfArr3)[3];
typedef WORD (*pwArr3)[3];
class CVertex
{
friend class CMatrix3;
public:
float x;
float y;
float z;
CVertex(float px, float py, float pz){x=px; y=py; z=pz;}
CVertex(){};
CVertex operator =(CVertex &v){x=v.x; y=v.y; z=v.z; return v;}
CVertex operator *(CMatrix3& m);
CVertex operator /(CMatrix3& m);
float operator -(CVertex &v);
};
class CMatrix3
{
float m[3][3];
public:
CMatrix3();
void SetRot(float ux, float uy);
float operator()(int x, int y){ return m[x][y];}
};
class CMesh
{
public:
static CMesh *s_me;
CVertex *m_v; // vertex list
WORD (*m_edge)[2]; // edges list
pwArr3 m_face; // faces list
char *m_sel; // vertex selection status
int *m_sort; // sorted faces
CVertex *m_prj; // projections list
int m_iDimx, m_iDimy;
int m_iVerts;
int m_iFaces;
int m_iEdges;
CMesh(int x, int y);
CMesh(CMesh &m);
~CMesh();
static int Compare(const void *p1, const void *p2);
void SortZ();
void ComputePrj(RECT &r, CMatrix3 &m);
void Select(int i, BOOL is){ m_sel[i] = (m_sel[i] & ~1) | (is != 0);}
BOOL Selected(int i){ return m_sel[i] & 1;}
void Toggle(int i){ m_sel[i] ^= 1; }
void Or(int i, int is) { m_sel[i] |= is != 0;}
void operator =(CMesh &m);
};
class CTriEdit
{
CMesh *m_mesh; // mesh
HWND m_hwnd; // window handle
float m_ux, m_uy; // rotation angles
CMatrix3 m_mrot; // rotation matrix
RECT m_r; // client rect
int m_iUnderCursor; // vertex index under cursor
int m_iCrtVertex; // current moved vertex index
RECT m_SelRect; // selection rectangle
float m_fLinearity;
BOOL m_bVisibility;
HDC hdcmem; // back buffer HDC
HBITMAP bmp; // back buffer
HPEN m_GreenPen, m_RedPen;
CMesh* m_UndoStack[MAXUNDOSTACK]; // Undo/Redo stack
int m_iUndoSP; // Undo/Redo stack pointer
int m_iUndoCnt; // Undo counter
int m_iRedoCnt; // redo counter
BOOL m_bStackTopOK;
//*******************
protected:
void NormalizeRect(RECT &s, RECT &d);
float Effect(float distance);
void Select(HDC hdc, int x, int y, HPEN pen);
void AddModulo(int &i, int inc, int mod = MAXUNDOSTACK);
void Invalidate(){ InvalidateRect(m_hwnd, NULL, TRUE); }
public:
CTriEdit(); // constructor
~CTriEdit(); // destructor
int OnSetCursor(int x, int y); // WM_SETCURSOR handle
void OnLButtonDown(UINT flags, POINT p); // WM_LBUTTONDOWN handle
void OnLButtonUp(UINT flags, POINT p); // WM_LBUTTONUP handle
void OnMouseMove(POINT p); // WM_MOUSEMOVE handle
void SetHWnd(HWND hwnd);
void Resize(int cx, int cy);
void OnUndo();
void OnRedo();
void OnPaint(HDC hdc);
void InitMesh(int x, int y);
void Rotate(float dux, float duy);
void SetLinearity(float l);
//ANNECY Shaitan Correction 03/03/98 {
void SetVisibility(BOOL b) { m_bVisibility = b; if (m_mesh) m_mesh->SortZ(); Invalidate(); }
//ENDANNECY Shaitan Correction }
int CanUndo(){ return m_iUndoCnt; }
int CanRedo(){ return m_iRedoCnt; }
pfArr3 GetVerts() { return m_mesh ? (pfArr3)m_mesh->m_v : NULL; }
pwArr3 GetFaces(){ return m_mesh ? m_mesh->m_face : NULL; }
int GetXVertsNumber(){ return m_mesh ? m_mesh->m_iDimx + 1 : 0; }
int GetYVertsNumber(){ return m_mesh ? m_mesh->m_iDimy + 1 : 0; }
int GetFacesNumber(){ return m_mesh ? m_mesh->m_iFaces : 0; }
};

View File

@@ -0,0 +1,91 @@
// DlgBox3D.h : header file
//
#ifndef __DLGBOX3D_HPP__
#define __DLGBOX3D_HPP__
#include "3DGe_res.h"
class Box3D;
/////////////////////////////////////////////////////////////////////////////
// CDlgBox3D dialog
class CDlgBox3D : public CDialog
{
// Construction
public:
CDlgBox3D(Box3D *pBox3D, CWnd* pParent = NULL);
// Dialog Data
//{{AFX_DATA(CDlgBox3D)
enum { IDD = IDD_DIALOGBOX3D };
int m_Radio_Button;
BOOL m_Check_Box_Cube;
CString m_Edition_Zone_Center_X;
CString m_Edition_Zone_Center_Y;
CString m_Edition_Zone_Center_Z;
CString m_Edition_Zone_Height;
CString m_Edition_Zone_Length;
CString m_Edition_Zone_Width;
CString m_Edition_Zone_X_Maxi;
CString m_Edition_Zone_X_Mini;
CString m_Edition_Zone_Y_Maxi;
CString m_Edition_Zone_Y_Mini;
CString m_Edition_Zone_Z_Maxi;
CString m_Edition_Zone_Z_Mini;
CSliderCtrl m_Slider_Size;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CZDxBoxInfoWindow)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CDlgBox3D)
virtual BOOL OnInitDialog();
afx_msg void On_Radio_Button_Center();
afx_msg void On_Radio_Button_Extrema();
afx_msg void On_Change_Edition_Zone_X_Mini();
afx_msg void On_Change_Edition_Zone_Y_Mini();
afx_msg void On_Change_Edition_Zone_Z_Mini();
afx_msg void On_Change_Edition_Zone_X_Maxi();
afx_msg void On_Change_Edition_Zone_Y_Maxi();
afx_msg void On_Change_Edition_Zone_Z_Maxi();
afx_msg void On_Change_Edition_Zone_Center_X();
afx_msg void On_Change_Edition_Zone_Center_Y();
afx_msg void On_Change_Edition_Zone_Center_Z();
afx_msg void On_Change_Edition_Zone_Length();
afx_msg void On_Change_Edition_Zone_Width();
afx_msg void On_Change_Edition_Zone_Height();
afx_msg void On_Check_Box_Cube();
afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
afx_msg void On_Button_Init();
virtual void OnCancel();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
// Personal data
private:
Box3D * m_pBox3D;
BOOL m_IsACube; // Indicate if the box is a cube or not
MTH3D_tdstVector m_InitialMini;
MTH3D_tdstVector m_InitialMaxi;
void RefreshSlider ();
void RefreshSizeFromSlider ();
void RefreshData (); // Called when the data need to be refreshed
void RefreshData (BOOL _bKeepCube); // Idem
void RedrawBackground ();
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // __DLGBOX3D_HPP__

View File

@@ -0,0 +1,73 @@
// DlgCon3D.hpp : header file
//
#ifndef __DLGCON3D_HPP__
#define __DLGCON3D_HPP__
#include "3DGe_res.h"
class Cone3D;
/////////////////////////////////////////////////////////////////////////////
// CDlgCone3D dialog
class CDlgCone3D : public CDialog
{
// Construction
public:
CDlgCone3D (Cone3D * pCone3D, CWnd * pParent = NULL);
// Dialog Data
//{{AFX_DATA(CDlgCone3D)
enum { IDD = IDD_DIALOGCONE3D };
CString m_Edition_Zone_Angle;
CString m_Edition_Zone_Radius;
CString m_Edition_Zone_X_Base;
CString m_Edition_Zone_X_Top;
CString m_Edition_Zone_Y_Base;
CString m_Edition_Zone_Y_Top;
CString m_Edition_Zone_Z_Base;
CString m_Edition_Zone_Z_Top;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDlgCone3D)
protected:
virtual void DoDataExchange(CDataExchange* pDX);
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CDlgCone3D)
virtual BOOL OnInitDialog();
afx_msg void On_Change_Edition_Zone_Angle();
afx_msg void On_Change_Edition_Zone_Radius();
afx_msg void On_Change_Edition_Zone_X_Base();
afx_msg void On_Change_Edition_Zone_X_Top();
afx_msg void On_Change_Edition_Zone_Y_Base();
afx_msg void On_Change_Edition_Zone_Y_Top();
afx_msg void On_Change_Edition_Zone_Z_Base();
afx_msg void On_Change_Edition_Zone_Z_Top();
virtual void OnCancel();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
// Personal data
private:
Cone3D * m_pCone3D;
MTH3D_tdstVector m_InitialTop;
MTH3D_tdstVector m_InitialBase;
GLI_tdxValue m_InitialRadius;
GLI_tdxValue m_InitialAngle;
void RefreshData ();
void RedrawBackground ();
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // __DLGCON3D_HPP__

View File

@@ -0,0 +1,71 @@
//ROMTEAM WorldEditor
////////////////////////////////////////////////////////////////////////////////////////
// File : CDlgITBox.hpp: interface for the CDlgITBox class.
// Author : Ionut Grozea
// Date : 97.11
// Description :
////////////////////////////////////////////////////////////////////////////////////////
#ifndef __AFX_DLGITBOX_HPP__
#define __AFX_DLGITBOX_HPP__
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#include "3dge_res.h"
#include "stdafx.h"
class ITBox3D;
/////////////////////////////////////////////////////////////////////////////
// CDlgITBox dialog
class CDlgITBox : public CDialog
{
// Construction
public:
CDlgITBox(float m_Nx , float m_Ny , float m_Nz , ITBox3D*pBox , CWnd* pParent = NULL); // standard constructor
ITBox3D* m_poBox;
int mfn_iGetIntPos(float fVal);
float mfn_fSliderInt2Float(int sliderVal);
// Dialog Data
//{{AFX_DATA(CDlgITBox)
enum { IDD = IDD_DIALOGBOX };
CSliderCtrl m_SliderZ;
CSliderCtrl m_fSliderZ;
CSliderCtrl m_SliderY;
CSliderCtrl m_SliderX;
float m_fScaleY;
float m_fScaleX;
float m_fScaleZ;
//}}AFX_DATA
float m_fScaleYOld;
float m_fScaleXOld;
float m_fScaleZOld;
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDlgITBox)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CDlgITBox)
afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
virtual BOOL OnInitDialog();
afx_msg void OnChangeEdit2();
afx_msg void OnChangeEdit3();
afx_msg void OnChangeEdit4();
virtual void OnCancel();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
#endif // __AFX_DLGITBOX_HPP__

View File

@@ -0,0 +1,75 @@
//ROMTEAM WorldEditor
////////////////////////////////////////////////////////////////////////////////////////
// File : DlgITCone.hpp: interface for the DlgITCone class.
// Author : Ionut Grozea
// Date : 97.11
// Description :
////////////////////////////////////////////////////////////////////////////////////////
#ifndef __AFX_DLGITCONE_HPP__
#define __AFX_DLGITCONE_HPP__
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#include "3dge_res.h"
#include "stdafx.h"
class ITCon3D;
/////////////////////////////////////////////////////////////////////////////
// DlgITCone dialog
class DlgITCone : public CDialog
{
// Construction
public:
DlgITCone(ITCon3D * pCon , float Radius , float Height ,int Nt , int Ns , CWnd* pParent =NULL);
int mfn_iGetIntPos(float fVal);
float mfn_fSliderInt2Float(int sliderVal);
ITCon3D * m_poCon;
float m_fHeightOld;
float m_fRadiusOld;
int m_iNxOld;
int m_iNyOld;
// Dialog Data
//{{AFX_DATA(DlgITCone)
enum { IDD = IDD_DIALOGCONE };
CSliderCtrl m_SliderY;
CSliderCtrl m_SliderX;
CSliderCtrl m_fSliderRadius;
CSliderCtrl m_fSliderHeight;
float m_fHeight;
float m_fRadius;
int m_iNx;
int m_iNy;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(DlgITCone)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(DlgITCone)
afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
virtual BOOL OnInitDialog();
afx_msg void OnChangeEditheight();
afx_msg void OnChangeEditradius();
afx_msg void OnChangeEditx();
afx_msg void OnChangeEdity();
virtual void OnCancel();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // __AFX_DLGITCONE_HPP__

View File

@@ -0,0 +1,57 @@
// DlgPnt3D.hpp : header file
//
#ifndef __DLGPNT3D_HPP__
#define __DLGPNT3D_HPP__
#include "3DGe_res.h"
class Point3D;
/////////////////////////////////////////////////////////////////////////////
// CDlgPoint3D dialog
class CDlgPoint3D : public CDialog
{
// Construction
public:
CDlgPoint3D(Point3D *pPoint3D, CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CDlgPoint3D)
enum { IDD = IDD_DIALOGPOINT3D };
CString m_Edition_Zone_X;
CString m_Edition_Zone_Y;
CString m_Edition_Zone_Z;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDlgPoint3D)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CDlgPoint3D)
afx_msg void On_Change_Edition_Zone_X();
afx_msg void On_Change_Edition_Zone_Y();
afx_msg void On_Change_Edition_Zone_Z();
virtual BOOL OnInitDialog();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
// Personal data
private:
Point3D * m_pPoint3D;
void RefreshData (); // Called when the data need to be refreshed
void RedrawBackground ();
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !__DLGPNT3D_HPP__

View File

@@ -0,0 +1,66 @@
// DSphere.h : header file
//
#ifndef __DLGSPH3D_HPP__
#define __DLGSPH3D_HPP__
#include "3DGe_res.h"
class Sphere3D;
/////////////////////////////////////////////////////////////////////////////
// CDlgSphere3D dialog
class CDlgSphere3D : public CDialog
{
// Construction
public:
CDlgSphere3D(Sphere3D *pSphere, CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CDlgSphere3D)
enum { IDD = IDD_DIALOGSPHERE3D };
CSliderCtrl m_Slider_Radius;
CString m_Center_X;
CString m_Center_Y;
CString m_Center_Z;
CString m_Radius;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDlgSphere3D)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CDlgSphere3D)
afx_msg void OnChangeEditRadius();
virtual void OnCancel();
virtual BOOL OnInitDialog();
afx_msg void OnChangeEditCenterX();
afx_msg void OnChangeEditCenterY();
afx_msg void OnChangeEditCenterZ();
afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
Sphere3D *m_pSphere3D;
GLI_tdxValue m_InitialRadius;
MTH3D_tdstVector m_InitialCenter;
void RefreshSlider ();
void RefreshRadiusFromSlider ();
void RefreshData ();
void RedrawBackground ();
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !__DLGSPH3D_HPP__

View File

@@ -0,0 +1,74 @@
// DlgAltimap3D.h : header file
//
#ifndef __DLGALT3D_HPP__
#define __DLGALT3D_HPP__
#include "3DGe_res.h"
class Altimap3D;
/////////////////////////////////////////////////////////////////////////////
// CDlgAltimap3D dialog
class CDlgAltimap3D : public CDialog
{
// Construction
public:
void RefreshData (void);
void RefreshSquare (void);
CDlgAltimap3D(Altimap3D *pAltimap3D,CWnd* pParent = NULL); // standard constructor
Altimap3D *m_pAltimap3D;
BOOL m_bSquareOrientation;
BOOL m_bSetLeft;
BOOL m_bSetRight;
unsigned char m_ucSquareType;
// Dialog Data
//{{AFX_DATA(CDlgAltimap3D)
enum { IDD = IDD_ALTIMAP3D };
CBitmapButton m_btnSquareOrientation;
CBitmapButton m_btnSetLeft;
CBitmapButton m_btnSetRight;
CSliderCtrl m_Slider_SizeY;
CSliderCtrl m_Slider_SizeX;
CSliderCtrl m_Slider_NbY;
CSliderCtrl m_Slider_NbX;
int m_iNbY;
float m_SizeX;
float m_SizeY;
int m_iNbX;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDlgAltimap3D)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CDlgAltimap3D)
virtual BOOL OnInitDialog();
afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
afx_msg void OnKillfocusNbx();
afx_msg void OnKillfocusNby();
afx_msg void OnKillfocusSizex();
afx_msg void OnKillfocusSizey();
afx_msg void OnSetOrientation();
afx_msg void OnSetLeft();
afx_msg void OnSetRight();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // __DLGALT3D_HPP__

View File

@@ -0,0 +1,66 @@
//ROMTEAM WorldEditor
////////////////////////////////////////////////////////////////////////////////////////
// File : CDlgITSphere.hpp: interface for the CDlgITSphere class.
// Author : Ionut Grozea
// Date : 97.11
// Description :
////////////////////////////////////////////////////////////////////////////////////////
#ifndef __AFX_DLGITSPHERE_HPP__
#define __AFX_DLGITSPHERE_HPP__
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#include "3dge_res.h"
/////////////////////////////////////////////////////////////////////////////
// CDlgITSphere dialog
class ITSphere3D;
class CDlgITSphere : public CDialog
{
// Construction
public:
float mfn_fSliderInt2Float(int);
CSliderCtrl* mfn_poGetSlider1();
CSliderCtrl* mfn_poGetSlider2();
CSliderCtrl* mfn_poGetSlider3();
CDlgITSphere(float radius,int m_Ns,int m_Nt ,ITSphere3D*pSphere, CWnd* pParent = NULL); // standard constructor
ITSphere3D* m_poSphere;
// Dialog Data
//{{AFX_DATA(CDlgITSphere)
enum { IDD = IDD_DIALOGSPHERE };
float m_fRadius;
int m_Nx;
int m_Ny;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDlgITSphere)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
int mfn_iGetIntPos(float);
float m_fRadiusOld ;
int m_NxOld;
int m_NyOld;
// Generated message map functions
//{{AFX_MSG(CDlgITSphere)
virtual BOOL OnInitDialog();
afx_msg void OnChangeEdit1();
afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
afx_msg void OnChangeEdit2();
afx_msg void OnChangeEdit3();
virtual void OnCancel();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // __AFX_DLGITSPHERE_HPP__

View File

@@ -0,0 +1,64 @@
//ROMTEAM WorldEditor
////////////////////////////////////////////////////////////////////////////////////////
// File : CDlgObject.hpp: interface for the CDlgObject class.
// Author : Ionut Grozea
// Date : 97.11
// Description :
////////////////////////////////////////////////////////////////////////////////////////
#ifndef __AFX_DLGOBJECT_HPP__
#define __AFX_DLGOBJECT_HPP__
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// DlgObject.h : header file
//
#include "3dge_res.h"
#include "stdafx.h"
/////////////////////////////////////////////////////////////////////////////
// CDlgObject dialog
class ITObject3D;
class CDlgObject : public CDialog
{
// Construction
public:
CDlgObject(ITObject3D* p_ITObject , CWnd* pParent = NULL); // standard constructor
ITObject3D * m_pITObject ;
int mfn_iGetIntPos(float fVal);
float mfn_fSliderInt2Float(int sliderVal);
// Dialog Data
//{{AFX_DATA(CDlgObject)
enum { IDD = IDD_DIALOGOBJECT };
float m_fscaleX;
float m_fscaleY;
float m_fscaleZ;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDlgObject)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CDlgObject)
afx_msg void OnChangeEditscalex();
afx_msg void OnChangeEditscaley();
afx_msg void OnChangeEditscalez();
virtual BOOL OnInitDialog();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // __AFX_DLGOBJECT_HPP__

View File

@@ -0,0 +1,69 @@
//ROMTEAM WorldEditor
////////////////////////////////////////////////////////////////////////////////////////
// File : EdThread.h: interface for the CEdThread class.
// Author :
// Date :
// Description :
////////////////////////////////////////////////////////////////////////////////////////
#ifndef __AFX_EDTHREAD_HPP__
#define __AFX_EDTHREAD_HPP__
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// EdThread.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CEdThread thread
class CTriEdit;
class CIndexedTriangleFrame;
class CPA_ObjectDLLBase;
class CEdThread : public CWinThread
{
DECLARE_DYNCREATE(CEdThread)
protected:
CEdThread(); // protected constructor used by dynamic creation
Geometry3D_Interface *m_pLinkDll;
// Attributes
public:
static BOOL m_bAlreadyRunning;
private:
CIndexedTriangleFrame *m_pFrame;
CSingleDocTemplate *m_pDocTemplate;
// Operations
//ROMTEAM WorldEditor (Cristian Stegaru 11/97)
public:
void mfn_vLinkToDll (Geometry3D_Interface *pLinkDll) {m_pLinkDll = pLinkDll;}
CTriEdit* mfn_pGetITEditor ();
BOOL mfn_bCreateITObject (CTriEdit *pITEditor, CString csName);
//ENDROMTEAM WorldEditor (Cristian Stegaru)
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CEdThread)
public:
virtual BOOL InitInstance();
virtual int ExitInstance();
//}}AFX_VIRTUAL
// Implementation
protected:
virtual ~CEdThread();
// Generated message map functions
//{{AFX_MSG(CEdThread)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // __AFX_EDTHREAD_HPP__

View File

@@ -0,0 +1,74 @@
//ROMTEAM WorldEditor
////////////////////////////////////////////////////////////////////////////////////////
// File : EToolBar.h
// Author : Cristian S
// Date : 97.11
// Description :
////////////////////////////////////////////////////////////////////////////////////////
#ifndef __AFX_EDITOR_TOOLBAR_HPP__
#define __AFX_EDITOR_TOOLBAR_HPP__
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
class CIndexedTriangleView;
class CEditorToolBar : public CToolBar
{
private:
//attributes
CStatic m_stName,
m_stXNb,
m_stYNb;
CEdit m_edName,
m_edXNb,
m_edYNb;
CSliderCtrl m_Slider;
int m_iXNb;
int m_iYNb;
CString m_csName;
public:
//methods
CEditorToolBar ();
~CEditorToolBar ();
BOOL Init (CWnd *pParent);
CIndexedTriangleView* GetView ();
void UpdateData (BOOL bGet = TRUE);
int SetXNb (int iXNb) { return m_iXNb = iXNb; }
int GetXNb () { return m_iXNb; }
int SetYNb (int iYNb) { return m_iYNb = iYNb; }
int GetYNb () { return m_iYNb; }
CString SetName (CString csName) { return m_csName = csName; }
CString GetName () { return m_csName; }
void SetAttributes (int iXNb, int iYNb, CString csName)
{
m_iXNb = iXNb;
m_iYNb = iYNb;
m_csName = csName;
UpdateData (FALSE);
}
void GetAttributes (int &riXNb, int &riYNb, CString &rcsName)
{
UpdateData ();
riXNb = m_iXNb;
riYNb = m_iYNb;
rcsName = m_csName;
}
protected:
//{{AFX_MSG(CEditorToolBar)
afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif //__AFX_EDITOR_TOOLBAR_HPP__

View File

@@ -0,0 +1,76 @@
//ROMTEAM WorldEditor
////////////////////////////////////////////////////////////////////////////////////////
// File : ITFrame.h: interface for the CIndexedTriangleFrame class.
// Author :
// Date :
// Description :
////////////////////////////////////////////////////////////////////////////////////////
#ifndef __INDEXEDTRIANGLEFRAME_HPP__
#define __INDEXEDTRIANGLEFRAME_HPP__
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// IndexedTriangleFrame.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CIndexedTriangleFrame frame
class CTriEdit;
class CIndexedTriangleFrame : public CFrameWnd
{
DECLARE_DYNCREATE(CIndexedTriangleFrame)
protected:
CIndexedTriangleFrame(); // protected constructor used by dynamic creation
CEditorToolBar m_wndToolBar;
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CIndexedTriangleFrame)
public:
//}}AFX_VIRTUAL
//ROMTEAM WorldEditor (Cristian Stegaru 11/97)
public:
CTriEdit * mfn_pGetITEditor ();
CString mfn_csGetITName ();
//ENDROMTEAM WorldEditor (Cristian Stegaru)
public:
// Implementation
virtual ~CIndexedTriangleFrame();
protected:
CIndexedTriangleView* GetView ();
// Generated message map functions
//{{AFX_MSG(CIndexedTriangleFrame)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnNew ();
afx_msg void OnSave ();
afx_msg void OnHide ();
afx_msg void OnUndo ();
afx_msg void OnRedo ();
afx_msg void OnOnTop ();
afx_msg void OnExit ();
afx_msg void OnUpdateNewObject (CCmdUI* pCmdUI);
afx_msg void OnUpdateSave (CCmdUI* pCmdUI);
afx_msg void OnUpdateHide (CCmdUI* pCmdUI);
afx_msg void OnUpdateUndo (CCmdUI* pCmdUI);
afx_msg void OnUpdateRedo (CCmdUI* pCmdUI);
afx_msg void OnUpdateOnTop (CCmdUI* pCmdUI);
afx_msg void OnUpdateExit (CCmdUI* pCmdUI);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // __INDEXEDTRIANGLEFRAME_HPP__

View File

@@ -0,0 +1,87 @@
//ROMTEAM WorldEditor
////////////////////////////////////////////////////////////////////////////////////////
// File : ITView.h: interface for the CIndexedTriangleView class.
// Author :
// Date :
// Description :
////////////////////////////////////////////////////////////////////////////////////////
#ifndef __INDEXEDTRIANGLEVIEW_HPP__
#define __INDEXEDTRIANGLEVIEW_HPP__
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// IndexedTriangleView.h : header file
//
class CTriEdit;
/////////////////////////////////////////////////////////////////////////////
// CIndexedTriangleView view
class CIndexedTriangleView : public CView
{
friend class CIndexedTriangleFrame;
protected:
CIndexedTriangleView(); // protected constructor used by dynamic creation
DECLARE_DYNCREATE(CIndexedTriangleView)
// Attributes
public:
CTriEdit *m_edit;
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CIndexedTriangleView)
public:
virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
protected:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
//}}AFX_VIRTUAL
// Implementation
protected:
virtual ~CIndexedTriangleView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
// Generated message map functions
public:
//ROMTEAM WorldEditor (Cristian Stegaru 11/97)
CTriEdit * mfn_pGetITEditor () { return m_edit;}
//ENDROMTEAM WorldEditor (Cristian Stegaru)
public:
void SetLinearity(float l);
protected:
void OnUndo();
void OnRedo();
void OnSave ();
void OnHide (BOOL bHide);
void OnExit ();
void OnNewObject (int nX, int nY);
int CanUndo ();
int CanRedo ();
//{{AFX_MSG(CIndexedTriangleView)
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif //__INDEXEDTRIANGLEVIEW_HPP__

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

View File

@@ -0,0 +1,40 @@
#ifndef SAVE_H
#define SAVE_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
// For DLL using these function :
#include <stdio.h>
#include "cpa_expt.h"
//extern char *g_szElementTypeName[];
//void GLI_vSaveElementIndexedTriangle(SCR_tdst_File_Description *p_stFile, GEO_tdstElementIndexedTriangles *p_stElement);
//void GLI_vSaveElementFaceMapDescriptors(SCR_tdst_File_Description *p_stFile, GEO_tdstElementFaceMapDescriptors *p_stElement);
//void GLI_vSaveElementSprites(SCR_tdst_File_Description *p_stFile, GEO_tdstElementSprite *p_stElement);
//void GLI_vSaveElementTMeshes(SCR_tdst_File_Description *p_stFile, GEO_tdstElementTMeshes *p_stElement);
//void GLI_vSaveElementPoints(SCR_tdst_File_Description *p_stFile, GEO_tdstElementPoints *p_stElement);
//void GLI_vSaveElementLines(SCR_tdst_File_Description *p_stFile, GEO_tdstElementLines *p_stElement);
//void GLI_vSaveElementSpheres(SCR_tdst_File_Description *p_stFile, GEO_tdstElementSpheres *p_stElement);
//void GLI_vSaveElementAlignedBox(SCR_tdst_File_Description *p_stFile, GEO_tdstElementAlignedBoxes *p_stElement);
//void GLI_vSaveElementCones(SCR_tdst_File_Description *p_stFile, GEO_tdstElementCones *p_stElement);
void GLI_vSaveVisualMaterial(SCR_tdst_File_Description *p_stFile, ACP_tdxHandleOfMaterial hMaterial);
void GLI_vSaveFaceMapDescriptor(SCR_tdst_File_Description *p_stFile, GEO_tdstFaceMapDescriptor *hFMD);
void GLI_vSaveSprite(SCR_tdst_File_Description *p_stFile, GEO_tdstSprite *hSprite);
//void GLI_vSaveGeometricObject(SCR_tdst_File_Description *p_stFile, GEO_tdstGeometricObject *p_stGeometric, void *pEditorObject);
//void OGD_fn_vSaveGeometricObject( SCR_tdst_File_Description *p_stFile, char *p_szSectionName, void *p_vData, SCR_tde_Ntfy_Action eAction);
//void OGD_fn_vSaveGeometricObjectElement( SCR_tdst_File_Description *p_stFile, char *p_szSectionName, void *p_vData, SCR_tde_Ntfy_Action eAction);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SAVE_H */

View File

@@ -0,0 +1,18 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#ifndef __STDAAFX_H__
#define __STDAAFX_H__
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows 95 Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
#endif //__STDAAFX_H__

View File

@@ -0,0 +1,70 @@
// dlgcaract.h : header file
//
#ifndef __DLGCARACT_HPP__
#define __DLGCARACT_HPP__
#ifdef ACTIVE_EDITOR
#include "3DGe_res.h"
/////////////////////////////////////////////////////////////////////////////
// CDlgCaract dialog
class FRMBase;
class Geometry3D_Interface;
//#include "gli.h"
class Geometry3D;
class CDlgCaract : public CFormView
{
protected:
Geometry3D_Interface *m_p_oParentDLL;
Geometry3D *m_p_oCurrentObject;
CPA_SuperObject *m_p_oSuperObject;
// Construction
public:
CDlgCaract(CWnd* pParent = NULL); // standard constructor
DECLARE_DYNCREATE(CDlgCaract)
void fn_vUpdateInfo (CPA_SuperObject *_p_oSprObj, Geometry3D *_p_oObject);
void fn_vSetParentDLL (Geometry3D_Interface *_p_oParentDLL)
{ m_p_oParentDLL = _p_oParentDLL ; }
// Dialog Data
//{{AFX_DATA(CDlgCaract)
enum { IDD = IDD_DLGCARACT };
//}}AFX_DATA
long m_Data_lNbPoints;
long m_Data_lNbEdges;
long m_Data_lNbBdV;
long m_Data_lNbElements;
CString m_Data_cName;
BOOL m_bFirstInit;
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDlgCaract)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
void fn_vInitValues();
void fn_vShowValue(int _nID, long _lValue);
void fn_vInitList();
void fn_vUpdateList(Geometry3D *_p_oObject);
// Generated message map functions
//{{AFX_MSG(CDlgCaract)
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnChangeList(NMHDR* pNMHDR, LRESULT* pResult);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
#endif //ACTIVE_EDITOR
#endif //__DLGCARACT_HPP__

View File

@@ -0,0 +1,118 @@
//ROMTEAM WorldEditor
////////////////////////////////////////////////////////////////////////////////////////
// File : DlgEditPoints3D.hpp: interface for the CDlgEditPoints class.
// Author : Viorel Preoteasa
// Date : 97.11
// Description :
////////////////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_DLGEDITPOINTS_HPP__BE1AE613_7ADD_11D1_BEE8_00A0244F4D78__INCLUDED_)
#define AFX_DLGEDITPOINTS_HPP__BE1AE613_7ADD_11D1_BEE8_00A0244F4D78__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// dlgeditpoints.hpp : header file
//
#include "3DGe_res.h"
/////////////////////////////////////////////////////////////////////////////
// CDlgEditPoints form view
#ifndef __AFXEXT_H__
#include <afxext.h>
#endif
/////////////////////////////////////////////////////////////////////////////
// CStaticLine window
class CStaticLine : public CStatic
{
// Construction
public:
CStaticLine();
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CStaticLine)
//}}AFX_VIRTUAL
// Implementation
public:
void Init(float *Lin);
virtual ~CStaticLine();
float Effect(float dist);
// Generated message map functions
protected:
//{{AFX_MSG(CStaticLine)
afx_msg void OnPaint();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
float * m_pLin;
};
class CDlgEditPoints : public CFormView
{
protected:
CDlgEditPoints(); // protected constructor used by dynamic creation
DECLARE_DYNCREATE(CDlgEditPoints)
// Form Data
public:
//{{AFX_DATA(CDlgEditPoints)
enum { IDD = IDD_POINT_EDIT_DIALOG };
//}}AFX_DATA
// Attributes
public:
// Operations
public:
void Init();
float Effect(float dist);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDlgEditPoints)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
virtual ~CDlgEditPoints();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
// Generated message map functions
//{{AFX_MSG(CDlgEditPoints)
afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
afx_msg void OnPaint();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
public:
float m_fLinearity;
};
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_DLGEDITPOINTS_HPP__BE1AE613_7ADD_11D1_BEE8_00A0244F4D78__INCLUDED_)

View File

@@ -0,0 +1,5 @@
SCC = This is a source code control file
[Ogd.vcproj]
SCC_Aux_Path = "P4SCC#srvperforce-ma:1666##raymandata##Editor"
SCC_Project_Name = Perforce Project

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,345 @@
/*
*=======================================================================================
* Name : 3dgmodif.cpp
*
* Author : Marc Trabucato Date : ...
*
* Description : implementation of Geometry3D_Modif class use to store a move point
* modification
*=======================================================================================
* Modification -> Author : Vincent Lhullier Date : 24/04/97
* Description : add notification for saving modified object
*=======================================================================================
*/
/*---------------------------------------------*/
#include "stdafx.h"
#include "ACP_Base.h"
#include "incITF.h" // interface
#include "incGAM.h"
//ROMTEAM WorldEditor (Nicu 16/01/98)
#include "OGD.h"
//ENDROMTEAM WorldEditor (Nicu)
#include "3DGModif.hpp"
#include "3DInterf.hpp"
//#include "GLI.h"
//#include "SCR.h"
#define TYPE_MOVE 0
/*---------------------------------------------*/
/*---------------------------------------------*/
#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
#include "OGD.h"
#undef CPA_WANTS_EXPORT
#define CPA_WANTS_IMPORT
/*---------------------------------------------*/
/*
*=======================================================================================
* MACROS
*=======================================================================================
*/
// to redraw world in 3D View
#define M_RedrawWorld() (((DEV_MultiDevice*)g_oFrameGest.ma_p_oWinArray[2][2]->GetActiveView())->DrawObject())
/*
*=======================================================================================
* Geometry3D_Modif
*=======================================================================================
*/
/*
----------------------------------------------------------------------------------------
Description : constructor for Geometr3D_Modif which is the modif object used when a point
of a geometric object is moved
_p_xObject -> editor geometric object that is modified
_xIndexPoint -> moved point
_st3DTranslation -> moving vector
----------------------------------------------------------------------------------------
*/
//Geometry3D_Modif::Geometry3D_Modif(Geometry3D *_p_xObject, ACP_tdxIndex _xIndexPoint, MTH3D_tdstVector _st3DTranslation, DWORD *adr)
//CPA2 Corneliu Babiuc 09-09-98 (duplicated points)
/*
Geometry3D_Modif::Geometry3D_Modif(Geometry3D *_p_xObject,int NbPoints, ACP_tdxIndex *_xIndexPoints, float *Dist, MTH3D_tdstVector _st3DTranslation, DWORD *adr)
:CPA_Modif(TYPE_MOVE, "Move point", FALSE)
{
m_p_xObject = _p_xObject;
//ROMTEAM WorldEditor (Viorel Preoteasa 20/01/98)
// m_xIndexPoint = _xIndexPoint;
m_iNbPoints = NbPoints;
m_xIndexPoints = (ACP_tdxIndex *)malloc(m_iNbPoints * sizeof(ACP_tdxIndex));
memcpy(m_xIndexPoints, _xIndexPoints, m_iNbPoints * sizeof(ACP_tdxIndex));
m_fDist = (float *)malloc(m_iNbPoints * sizeof(float));
memcpy(m_fDist, Dist, m_iNbPoints * sizeof(float));
//ENDROMTEAM WorldEditor (Viorel Preoteasa)
*/
Geometry3D_Modif::Geometry3D_Modif(CPA_List<CPA_PointsList> * _lstPoints, MTH3D_tdstVector _st3DTranslation, DWORD *adr, BOOL _bFirstTime)
:CPA_Modif(TYPE_MOVE, "Move point", FALSE)
{
POSITION pos;
CPA_PointsList * p_oPoints;
for (p_oPoints = _lstPoints->GetHeadElement(pos); p_oPoints; p_oPoints = _lstPoints->GetNextElement(pos))
{
m_lstPointsList.AddTail( new CPA_PointsList(*p_oPoints) );
}
m_bFirstTime = _bFirstTime;
// use in Doing function to indicate that first time the transmlation is already done
m_bFirstTime = _bFirstTime;
// m_bFirstTime = TRUE;
//END CPA2 Corneliu Babiuc 09-09-98 (duplicated points)
memcpy(&m_st3DTranslation,&_st3DTranslation,sizeof(MTH3D_tdstVector));
//ROMTEAM WorldEditor (Nicu 05/12/97)
m_adrGeom = adr;
if(adr) m_pGeom = *adr;
//ROMTEAM WorldEditor (Nicu)
}
/*
----------------------------------------------------------------------------------------
Description : destructor
----------------------------------------------------------------------------------------
*/
Geometry3D_Modif::~Geometry3D_Modif()
{
//ROMTEAM WorldEditor (Viorel Preoteasa 20/01/98)
//CPA2 Corneliu Babiuc 10-09-98 (duplicated points)
/*
free(m_xIndexPoints);
free(m_fDist);
*/
while (!m_lstPointsList.IsEmpty()) delete (m_lstPointsList.RemoveHead());
//END CPA2 Corneliu Babiuc 10-09-98 (duplicated points)
//ENDROMTEAM WorldEditor (Viorel Preoteasa)
}
/*
----------------------------------------------------------------------------------------
Description : do the moving point modification
Returns (BOOL) TRUE if modif is done, FALSE otherwise
----------------------------------------------------------------------------------------
*/
BOOL Geometry3D_Modif::Do (void)
{
// the first time this function is called, the translation is already done
if(!m_bFirstTime)
{
// translate point
//--------------------------------------------------------------
//ROMTEAM WorldEditor (Viorel Preoteasa 20/01/98)
// m_p_xObject->fn_vTranslatePoint(m_xIndexPoint,&m_st3DTranslation);
//CPA2 Corneliu Babiuc 10-09-98 (duplicated points)
/*
int i;
MTH3D_tdstVector st3DTranslation;
GEO_tdstGeometricObject *GeomObj = m_p_xObject->GetStruct();
for(i=0; i<m_iNbPoints; i++)
{
st3DTranslation = m_st3DTranslation;
st3DTranslation.xX *= m_fDist[i];
st3DTranslation.xY *= m_fDist[i];
st3DTranslation.xZ *= m_fDist[i];
if(m_iNbPoints == 1)m_p_xObject->fn_vTranslatePoint(m_xIndexPoints[i],&st3DTranslation);
else
{
(GeomObj->d_stListOfPoints[m_xIndexPoints[i]]).xX += st3DTranslation.xX;
(GeomObj->d_stListOfPoints[m_xIndexPoints[i]]).xY += st3DTranslation.xY;
(GeomObj->d_stListOfPoints[m_xIndexPoints[i]]).xZ += st3DTranslation.xZ;
}
// m_p_xObject->fn_vTranslatePoint(m_xIndexPoints[i],&st3DTranslation);
}
if(m_iNbPoints != 1)
{
m_p_xObject->fn_vEndModification();
m_p_xObject->fn_vSetMustRecomputeBdV();
}
*/
POSITION pos;
MTH3D_tdstVector st3DTranslation;
for( CPA_PointsList * p_oPoints = m_lstPointsList.GetHeadElement(pos);
p_oPoints;
p_oPoints = m_lstPointsList.GetNextElement(pos) )
{
GEO_tdstGeometricObject * GeomObj = p_oPoints->GetObject()->GetStruct();
for( int i=0; i<p_oPoints->GetNumberOfSelectedPoints(); i++)
{
ACP_tdxIndex xPointIndex = p_oPoints->GetPoint(i);
MTH3D_M_vMulScalarVector(&st3DTranslation, p_oPoints->m_fDist[i], &m_st3DTranslation);
if( i == p_oPoints->GetNumberOfSelectedPoints()-1)
p_oPoints->GetObject()->fn_vTranslatePoint(xPointIndex, &st3DTranslation);
else
{
MTH3D_M_vAddVector(&(GeomObj->d_stListOfPoints[xPointIndex]),
&(GeomObj->d_stListOfPoints[xPointIndex]), &st3DTranslation);
}
}
p_oPoints->GetObject()->fn_vSetMustRecomputeBdV();
}
//END CPA2 Corneliu Babiuc 10-09-98 (duplicated points)
//ENDROMTEAM WorldEditor (Viorel Preoteasa)
//--------------------------------------------------------------
// redraw the world
M_RedrawWorld();
}
// indicate that first time is over
m_bFirstTime = FALSE;
//ROMTEAM WorldEditor (Nicu 05/12/97)
if(m_adrGeom) *m_adrGeom = 0;
//ENDROMTEAM WorldEditor (Nicu)
/*
* Notify that object has been modified
*/
//CPA2 Corneliu Babiuc 10-09-98 (duplicated points)
POSITION pos;
for( CPA_PointsList * p_oPoints = m_lstPointsList.GetHeadElement(pos); pos;
m_lstPointsList.GetNextElement(pos) )
p_oPoints->GetObject()->fn_vNotifySaveObject();
// m_p_xObject->fn_vNotifySaveObject();
//END CPA2 Corneliu Babiuc 10-09-98 (duplicated points)
return TRUE;
}
/*
----------------------------------------------------------------------------------------
Description : undo the moving point modification
Returns (BOOL) TRUE when undoing success (always the case)
----------------------------------------------------------------------------------------
*/
BOOL Geometry3D_Modif::Undo (void)
{
//-----------------------------------------------
//ROMTEAM WorldEditor (Viorel Preoteasa 20/01/98)
// calculate the opposite translation
/*
MTH3D_tdstVector st3DOppTranslation;
MTH3D_M_vNullVector(&st3DOppTranslation);
MTH3D_M_vSubVector(&st3DOppTranslation,&st3DOppTranslation,&m_st3DTranslation);
// translate point
m_p_xObject->fn_vTranslatePoint(m_xIndexPoint,&st3DOppTranslation);
*/
//CPA2 Corneliu Babiuc 10-09-98 (duplicated points)
/*
int i;
MTH3D_tdstVector st3DTranslation;
GEO_tdstGeometricObject *GeomObj = m_p_xObject->GetStruct();
for(i=0; i<m_iNbPoints; i++)
{
st3DTranslation = m_st3DTranslation;
st3DTranslation.xX *= -m_fDist[i];
st3DTranslation.xY *= -m_fDist[i];
st3DTranslation.xZ *= -m_fDist[i];
if(m_iNbPoints == 1)m_p_xObject->fn_vTranslatePoint(m_xIndexPoints[i],&st3DTranslation);
else
{
(GeomObj->d_stListOfPoints[m_xIndexPoints[i]]).xX += st3DTranslation.xX;
(GeomObj->d_stListOfPoints[m_xIndexPoints[i]]).xY += st3DTranslation.xY;
(GeomObj->d_stListOfPoints[m_xIndexPoints[i]]).xZ += st3DTranslation.xZ;
}
// m_p_xObject->fn_vTranslatePoint(m_xIndexPoints[i],&st3DTranslation);
}
if(m_iNbPoints != 1)
{
m_p_xObject->fn_vEndModification();
m_p_xObject->fn_vSetMustRecomputeBdV();
}
*/
POSITION pos;
MTH3D_tdstVector st3DTranslation;
for( CPA_PointsList * p_oPoints = m_lstPointsList.GetHeadElement(pos);
p_oPoints;
p_oPoints = m_lstPointsList.GetNextElement(pos) )
{
GEO_tdstGeometricObject * GeomObj = p_oPoints->GetObject()->GetStruct();
for( int i=0; i<p_oPoints->GetNumberOfSelectedPoints(); i++)
{
ACP_tdxIndex xPointIndex = p_oPoints->GetPoint(i);
MTH3D_M_vMulScalarVector(&st3DTranslation, -p_oPoints->m_fDist[i], &m_st3DTranslation);
if( i == p_oPoints->GetNumberOfSelectedPoints()-1)
p_oPoints->GetObject()->fn_vTranslatePoint(xPointIndex, &st3DTranslation);
else
{
MTH3D_M_vAddVector(&(GeomObj->d_stListOfPoints[xPointIndex]),
&(GeomObj->d_stListOfPoints[xPointIndex]), &st3DTranslation);
}
// it is not necesary to call Geometry3D::fn_vEndModification method.
// This is done from fn_vTranslatePoint function !!!
p_oPoints->GetObject()->fn_vSetMustRecomputeBdV();
}
}
//END CPA2 Corneliu Babiuc 10-09-98 (duplicated points)
//ENDROMTEAM WorldEditor (Viorel Preoteasa)
//-----------------------------------------------
//ROMTEAM WorldEditor (Nicu 05/12/97)
if(m_adrGeom) *m_adrGeom = m_pGeom;
//ENDROMTEAM WorldEditor (Nicu)
// redraw the world
M_RedrawWorld();
//CPA2 Corneliu Babiuc 10-09-98 (duplicated points)
for( p_oPoints = m_lstPointsList.GetHeadElement(pos); pos;
m_lstPointsList.GetNextElement(pos) )
p_oPoints->GetObject()->fn_vNotifySaveObject();
// m_p_xObject->fn_vNotifySaveObject();
//END CPA2 Corneliu Babiuc 10-09-98 (duplicated points)
return TRUE;
}
///////////////////////////////////////////////////////////////////////////////
// class Geometry3D_Rename
Geometry3D_Rename::Geometry3D_Rename(Geometry3D *_p_Object,CString _csName)
:CPA_Modif(TYPE_MOVE, "Rename Geometric object", FALSE)
{
m_p_xObject = _p_Object;
m_csNewName = _csName;
}
Geometry3D_Rename::~Geometry3D_Rename()
{
}
BOOL Geometry3D_Rename::Do(void)
{
// update data
CString csTmp = m_p_xObject -> GetName();
if( csTmp == m_csNewName )
return FALSE;
m_p_xObject -> fn_eRename( m_csNewName );
m_p_xObject -> fn_vNotifyRenameObject();
m_csNewName = csTmp;
// update display
if( m_p_xObject -> GetEditor() -> fn_bIsCurrentEditor() )
((Geometry3D_Interface*)m_p_xObject -> GetEditor()) -> fn_vNameChanged();
return TRUE;
}
BOOL Geometry3D_Rename::Undo(void)
{
return Do();
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
LIBRARY
EXPORTS
fn_p_szGetCPAVersion
fn_p_stGetDLLIdentity
fn_p_oGetDLL
fn_vInitDll
SECTIONS
.data READ WRITE

View File

@@ -0,0 +1,76 @@
#include "ldt.h"
// ----------------------------------------------------------------------------
// Description : CallBack from reading 'Edit-ModifGeometric' section
// ----------------------------------------------------------------------------
int Geometry3D::LoadModif( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
Geometry3D *p_oGeom=(Geometry3D *)LDT_GetLinkValue( pLink );
p_oGeom -> m_oListOfModifiedPoints . RemoveAll();
p_oGeom -> m_oListOfGMTModif . RemoveAll();
p_oGeom -> m_oListOfFMDModif . RemoveAll ();
while( result!=ParseResult_EndSection )
{
result=LDT_GetNextEntry();
switch( result )
{
case ParseResult_Entry: /* an entry */
{
char *szEntry=LDT_szGetEntryName();
switch (*(long*)(szEntry+4))
{
case 'ioPd' : /* MovedPoint */
{
ACP_tdxIndex xIndex = atoi( LDT_szGetParam(1) );
if( xIndex < GEO_xGetGeometricObjectNumberOfPoints( p_oGeom -> GetStruct() ) )
{
p_oGeom -> fn_vAddModification( xIndex);
}
}
break;
case 'etaM' : /* GameMaterial */
{
ACP_tdxHandleOfElement hElement = atoi( LDT_szGetParam( 1 ) );
ACP_tdxIndex xIndexInElement = 0;
GMT_tdxHandleToGameMaterial hGM = NULL;
SCR_tdst_Link_Value *p_stValue = SCR_fnp_st_Link_SearchKey (GMT_fn_p_stGetLinkTable(), LDT_szGetParam(3));
if (p_stValue)
hGM = (GMT_tdxHandleToGameMaterial) SCR_M_ul_Link_GetValue (p_stValue);
if (hGM)
p_oGeom -> fn_vAddGMTModification( hElement, xIndexInElement, hGM );
}
break;
case 'caFd' : /* MovedFace */
{
ACP_tdxIndex xElementIT = atoi( LDT_szGetParam( 1 ) );
ACP_tdxIndex xIndexFaceIT = atoi( LDT_szGetParam( 2 ) );
ACP_tdxIndex xElementFMD = atoi( LDT_szGetParam( 3 ) );
ACP_tdxIndex xIndexFaceFMD = atoi( LDT_szGetParam( 4 ) );
p_oGeom -> fn_vAddFMDModification( xElementIT, xIndexFaceIT, xElementFMD, xIndexFaceFMD);
}
break;
}
}
}
}
// form modif
if( !p_oGeom -> m_oListOfModifiedPoints . IsEmpty() )
p_oGeom -> fn_vSetCurrentState( C_szFormModif, FALSE );
// material modif
if( !p_oGeom -> m_oListOfGMTModif . IsEmpty() )
p_oGeom -> fn_vSetCurrentState( C_szMaterialModif,FALSE );
if( !p_oGeom -> m_oListOfFMDModif . IsEmpty() )
p_oGeom -> fn_vSetCurrentState( C_szFMDModif,FALSE );
return 0;
}

View File

@@ -0,0 +1,662 @@
////////////////////////////////////////////////////////////////////////////////////////
// File : Altimap3D.cpp: implementation of the Altimap3D class.
// Author : Cristi Petrescu
// Date : 98.02.05
// Description :
////////////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ACP_Base.h"
#include "ITF.h"
#include "incGAM.h"
#include "GLI.h"
#include "DPT.h"
#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
#include "OGD.h"
#undef CPA_WANTS_EXPORT
#ifndef CPA_WANTS_IMPORT
#define CPA_WANTS_IMPORT
#endif
#include "3dinterf.hpp"
#include "DlgAlt3D.hpp"
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : Altimap3D::Altimap3D
// Date : 98.02
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : constructor to create a new object
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
Altimap3D::Altimap3D (CPA_EditorBase *_p_oEditor, const CString _csName , tdeSaveStatus _eStatus )
:Shape3D (TRUE, _p_oEditor, 121, 1, _csName , _eStatus)
{
CommonAltimap3D (10, 10);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : Altimap3D::Altimap3D
// Date : 98.02
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : constructor to create a new object
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
Altimap3D::Altimap3D (CPA_EditorBase *_p_oEditor, ACP_tdxIndex xWidth, ACP_tdxIndex xDepth, MTH_tdxReal xSquareDimX, MTH_tdxReal xSquareDimY, const CString _csName , tdeSaveStatus _eStatus )
:Shape3D(TRUE, _p_oEditor, (xWidth + 1) * (xDepth + 1), 1, _csName , _eStatus)
{
CommonAltimap3D (xWidth, xDepth, xSquareDimX, xSquareDimY);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : Altimap3D::CommonAltimap3D
// Date : 98.02
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : construct of Altimap3D
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void Altimap3D::CommonAltimap3D (ACP_tdxIndex xWidth /*= 10*/, ACP_tdxIndex xDepth /*= 10*/, MTH_tdxReal xSquareDimX /*= 1*/, MTH_tdxReal xSquareDimY /*= 1*/)
{
ACP_tdxIndex xNbVertices = (xWidth + 1) * (xDepth + 1);
ACP_tdxIndex xNbSquares = xWidth * xDepth;
m_hElement = fn_hCreateElementAltimap(xNbVertices, xNbSquares, xNbSquares * 2, 4, 1);
// set the origin
MTH3D_tdstVector stCenter = {0.0, 0.0, -1.0};
SetOrigin (stCenter);
// set the heights
ACP_tdxIndex xCount;
for (xCount = 0; xCount < xNbVertices; xCount ++)
{
GEO_vSetAltimapVertexHeight (GetStruct (), m_hElement, xCount, 0.1f * (xCount - xNbVertices / 2));
}
// set the square parameters
GEO_vSetAltimapSquarePattern (GetStruct (), m_hElement, xWidth, xSquareDimX, xDepth, xSquareDimY);
// build the rest of it
ACP_tdxIndex xWidthCount, xDepthCount;
GEO_vSetAltimapNbFaces (GetStruct (), m_hElement, xWidth * xDepth * 2);
for (xWidthCount = 0; xWidthCount < xWidth; xWidthCount ++)
{
for (xDepthCount = 0; xDepthCount < xDepth; xDepthCount ++)
{
ACP_tdxIndex xNumSquare = xWidthCount + xDepthCount * xWidth;
// set the squares
GEO_vSetAltimapSquare (GetStruct (), m_hElement, xNumSquare, GEO_C_xAltiSquareBothTRBL, xNumSquare * 2);
// set the faces
// uvs
GEO_vSetAltimapFaceUVIndex (GetStruct (), m_hElement, xNumSquare * 2, 0, 1, 3);
GEO_vSetAltimapFaceUVIndex (GetStruct (), m_hElement, xNumSquare * 2 + 1, 0, 2, 3);
// materials
GEO_vSetAltimapFaceMaterialIndex (GetStruct (), m_hElement, xNumSquare * 2, 0);
GEO_vSetAltimapFaceMaterialIndex (GetStruct (), m_hElement, xNumSquare * 2 + 1, 0);
// and a normals ?!
}
}
// set the uv values
GEO_vSetAltimapNbUVValues (GetStruct (), m_hElement, 4);
ACP_tdst2DUVValues stUV0 = {0.0, 0.0};
GEO_vSetAltimapUVValue (GetStruct (), m_hElement, 0, stUV0);
ACP_tdst2DUVValues stUV1 = {1.0, 0.0};
GEO_vSetAltimapUVValue (GetStruct (), m_hElement, 1, stUV1);
ACP_tdst2DUVValues stUV2 = {0.0, 1.0};
GEO_vSetAltimapUVValue (GetStruct (), m_hElement, 2, stUV2);
ACP_tdst2DUVValues stUV3 = {1.0, 1.0};
GEO_vSetAltimapUVValue (GetStruct (), m_hElement, 3, stUV3);
// set the material
GEO_vSetAltimapNbMaterials (GetStruct (), m_hElement, 1);
GEO_tdstElementAltimap *p_stAltimap = (GEO_tdstElementAltimap *) GetStruct () -> d_stListOfElements [m_hElement];
p_stAltimap -> d_hMaterial [0] = fn_hGetDefaultGameMaterial ();
// set the normals
if(GetStruct()->d_stListOfPointsNormals)
GEO_M_CPAFree(GetStruct()->d_stListOfPointsNormals);
if(GetStruct()->d_hListOfPointsMaterial)
GEO_M_CPAFree(GetStruct()->d_hListOfPointsMaterial);
if(GetStruct()->d_stListOfEdges)
GEO_M_CPAFree(GetStruct()->d_stListOfEdges);
if(GetStruct()->d_stListOfPointsReceivedLightIntensity)
GEO_M_CPAFree(GetStruct()->d_stListOfPointsReceivedLightIntensity);
GEO_xCreateObjectPointNormals (GetStruct());
GEO_vCreateObjectListOfPointsMaterial(GetStruct());
GEO_xCreateObjectListOfEdges(GetStruct());
GEO_xComputeObjectNormals (GetStruct());
GEO_vComputeObjectListOfPointsMaterial(GetStruct());
GEO_xComputeObjectListOfEdges(GetStruct());
// I will use the vertexes for the altimap for selection
GEO_tdstGeometricObject *p_stObject = (GEO_tdstGeometricObject *) GetStruct ();
MTH3D_tdstVector *d_stPoints, stOriginNoZ;
ACP_tdxIndex xI, xJ, xK;
GEO_M_CPAMalloc( d_stPoints,
MTH3D_tdstVector *,
( p_stAltimap->xWidth+1 ) * ( p_stAltimap->xDepth+1 ) * sizeof( MTH3D_tdstVector ),
E_uwGEONotEnoughtMemory );
p_stObject -> d_stListOfPoints = d_stPoints;
//--- xI : Width
//--- xJ : Height
//--- xK : xJ * (Width+1) + xI
MTH3D_M_vSetVectorElements( &stOriginNoZ, p_stAltimap->stOrigin.xX, p_stAltimap->stOrigin.xY, MTH_C_ZERO );
for(xJ = 0, xK = 0; xJ < p_stAltimap->xDepth+1; xJ++)
for(xI = 0 ; xI< p_stAltimap->xWidth+1; xI++, xK ++)
{
//--- For each Vertex, sets the coordinates in its super object axis system
(d_stPoints + xK) -> xX = MTH_M_xRealToLong(xI) * p_stAltimap->xDeltaX;
(d_stPoints + xK) -> xY = MTH_M_xRealToLong(xJ) * p_stAltimap->xDeltaY;
(d_stPoints + xK) -> xZ = p_stAltimap->d_xHeight[xK];
MTH3D_M_vAddVector(d_stPoints + xK, d_stPoints + xK, &stOriginNoZ);
}
// EndCreate ();
m_pAltimapUndo = NULL;
}
Altimap3D::~Altimap3D()
{
}
/*
keep them a little more, maybe may prove useful...
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : Altimap3D::SetNbX
// Date : 98.02
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : change the x sampling rate
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void Altimap3D::SetNbX(int iNbX)
{
// remind the old values...
m_iOldNbX = m_iNbX;
m_iOldNbY = m_iNbY;
m_iNbX = iNbX >= 2 ? iNbX : 2;
if (m_iOldNbX != m_iNbX)
{
// keep the z's
GEO_tdstGeometricObject *pObj = GetStruct ();
MTH3D_tdstVector *aPoint = pObj -> d_stListOfPoints;
m_aZ = (GLI_tdxValue *) malloc (m_iOldNbX * m_iOldNbY * sizeof (GLI_tdxValue));
for (int i = 0; i < m_iOldNbX; i ++)
for (int j = 0; j < m_iOldNbY; j ++)
m_aZ [i * m_iOldNbY + j] = aPoint [i * m_iOldNbY + j] . xZ;
m_bNewAltimap = FALSE;
m_hElement = NewElement (0, m_iNbX, m_iNbY);
free (m_aZ);
m_aZ = NULL;
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : Altimap3D::SetNbY
// Date : 98.02
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : change the Y sampling rate
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void Altimap3D::SetNbY(int iNbY)
{
// remind the old values...
m_iOldNbX = m_iNbX;
m_iOldNbY = m_iNbY;
m_iNbY = iNbY >= 2 ? iNbY : 2;
if (m_iOldNbY != m_iNbY)
{
// keep the z's
GEO_tdstGeometricObject *pObj = GetStruct ();
MTH3D_tdstVector *aPoint = pObj -> d_stListOfPoints;
m_aZ = (GLI_tdxValue *) malloc (m_iOldNbX * m_iOldNbY * sizeof (GLI_tdxValue));
for (int i = 0; i < m_iOldNbX; i ++)
for (int j = 0; j < m_iOldNbY; j ++)
m_aZ [i * m_iOldNbY + j] = aPoint [i * m_iOldNbY + j] . xZ;
m_bNewAltimap = FALSE;
m_hElement = NewElement (0, m_iNbX, m_iNbY);
free (m_aZ);
m_aZ = NULL;
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : Altimap3D::SetSizeX
// Date : 98.02
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : change the x size of the Altimap
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void Altimap3D::SetSizeX(GLI_tdxValue SizeX)
{
if (SizeX >= 0)
{
GEO_tdstGeometricObject *pObj = GetStruct ();
MTH3D_tdstVector *aPoint = pObj -> d_stListOfPoints;
GLI_tdxValue ScaleX = SizeX / (m_iNbX - 1);
for (int i = 0; i < m_iNbX; i ++)
for (int j = 0; j < m_iNbY; j ++)
aPoint [i * m_iNbY + j] . xX = i * ScaleX;
m_SizeX = SizeX;
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : Altimap3D::SetSizeY
// Date : 98.02
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : change the Y size of the Altimap
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void Altimap3D::SetSizeY(GLI_tdxValue SizeY)
{
if (SizeY >= 0)
{
GEO_tdstGeometricObject *pObj = GetStruct ();
MTH3D_tdstVector *aPoint = pObj -> d_stListOfPoints;
GLI_tdxValue ScaleY = SizeY / (m_iNbY - 1);
for (int i = 0; i < m_iNbX; i ++)
for (int j = 0; j < m_iNbY; j ++)
aPoint [i * m_iNbY + j] . xY = j * ScaleY;
m_SizeY = SizeY;
}
}
*/
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : Altimap3D::SetOrigin
// Date : 98.03
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : set the altimap origin
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void Altimap3D::SetOrigin (MTH3D_tdstVector st3DPoint)
{
GEO_vSetAltimapOrigin (GetStruct (), m_hElement, st3DPoint);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : Altimap3D::SetWidth
// Date : 98.03
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : set the width of the altimap
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void Altimap3D::SetWidth (ACP_tdxIndex xWidth)
{
ACP_tdxIndex xOldWidth;
ACP_tdxIndex xOldDepth;
MTH_tdxReal xOldSquareDimX;
MTH_tdxReal xOldSquareDimY;
GEO_vGetAltimapSquarePattern (GetStruct (), m_hElement, &xOldWidth, &xOldSquareDimX, &xOldDepth, &xOldSquareDimY);
GEO_vSetAltimapSquarePattern (GetStruct (), m_hElement, xWidth, xOldSquareDimX, xOldDepth, xOldSquareDimY);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : Altimap3D::SetDepth
// Date : 98.03
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : set the depth of the altimap
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void Altimap3D::SetDepth (ACP_tdxIndex xDepth)
{
ACP_tdxIndex xOldWidth;
ACP_tdxIndex xOldDepth;
MTH_tdxReal xOldSquareDimX;
MTH_tdxReal xOldSquareDimY;
GEO_vGetAltimapSquarePattern (GetStruct (), m_hElement, &xOldWidth, &xOldSquareDimX, &xOldDepth, &xOldSquareDimY);
GEO_vSetAltimapSquarePattern (GetStruct (), m_hElement, xOldWidth, xOldSquareDimX, xDepth, xOldSquareDimY);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : Altimap3D::SetSquareDimX
// Date : 98.03
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : sets the x square size
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void Altimap3D::SetSquareDimX (MTH_tdxReal xSquareDimX)
{
ACP_tdxIndex xOldWidth;
ACP_tdxIndex xOldDepth;
MTH_tdxReal xOldSquareDimX;
MTH_tdxReal xOldSquareDimY;
GEO_vGetAltimapSquarePattern (GetStruct (), m_hElement, &xOldWidth, &xOldSquareDimX, &xOldDepth, &xOldSquareDimY);
GEO_vSetAltimapSquarePattern (GetStruct (), m_hElement, xOldWidth, xSquareDimX, xOldDepth, xOldSquareDimY);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : Altimap3D::SetSquareDimY
// Date : 98.03
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : sets the y square size
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void Altimap3D::SetSquareDimY (MTH_tdxReal xSquareDimY)
{
ACP_tdxIndex xOldWidth;
ACP_tdxIndex xOldDepth;
MTH_tdxReal xOldSquareDimX;
MTH_tdxReal xOldSquareDimY;
GEO_vGetAltimapSquarePattern (GetStruct (), m_hElement, &xOldWidth, &xOldSquareDimX, &xOldDepth, &xOldSquareDimY);
GEO_vSetAltimapSquarePattern (GetStruct (), m_hElement, xOldWidth, xOldSquareDimX, xOldDepth, xSquareDimY);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : Altimap3D::GetOrigin
// Date : 98.03
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : get the altimap origin
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
MTH3D_tdstVector Altimap3D::GetOrigin (void)
{
MTH3D_tdstVector stOrigin;
GEO_vGetAltimapOrigin (GetStruct (), m_hElement, &stOrigin);
return stOrigin;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : Altimap3D::GetWidth
// Date : 98.03
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : get the altimap width
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
ACP_tdxIndex Altimap3D::GetWidth (void)
{
ACP_tdxIndex xWidth;
ACP_tdxIndex xDepth;
MTH_tdxReal xSquareDimX;
MTH_tdxReal xSquareDimY;
GEO_vGetAltimapSquarePattern (GetStruct (), m_hElement, &xWidth, &xSquareDimX, &xDepth, &xSquareDimY);
return xWidth;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : Altimap3D::GetDepth
// Date : 98.03
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : get the altimap depth
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
ACP_tdxIndex Altimap3D::GetDepth (void)
{
ACP_tdxIndex xWidth;
ACP_tdxIndex xDepth;
MTH_tdxReal xSquareDimX;
MTH_tdxReal xSquareDimY;
GEO_vGetAltimapSquarePattern (GetStruct (), m_hElement, &xWidth, &xSquareDimX, &xDepth, &xSquareDimY);
return xDepth;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : Altimap3D::GetSquareDimX
// Date : 98.03
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : get the altimap square x size
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
MTH_tdxReal Altimap3D::GetSquareDimX (void)
{
ACP_tdxIndex xWidth;
ACP_tdxIndex xDepth;
MTH_tdxReal xSquareDimX;
MTH_tdxReal xSquareDimY;
GEO_vGetAltimapSquarePattern (GetStruct (), m_hElement, &xWidth, &xSquareDimX, &xDepth, &xSquareDimY);
return xSquareDimX;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : Altimap3D::GetSquareDimY
// Date : 98.03
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : get the altimap square y size
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
MTH_tdxReal Altimap3D::GetSquareDimY (void)
{
ACP_tdxIndex xWidth;
ACP_tdxIndex xDepth;
MTH_tdxReal xSquareDimX;
MTH_tdxReal xSquareDimY;
GEO_vGetAltimapSquarePattern (GetStruct (), m_hElement, &xWidth, &xSquareDimX, &xDepth, &xSquareDimY);
return xSquareDimY;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Altimap3D::_OnLButtonDblClk
// Date : 98.02
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : launch the modal dialog
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL Altimap3D::_OnLButtonDblClk (UINT nFlags, tdstMousePos *p_stPos, ACP_tdxIndex xIndex, HIE_tdstPickInfo *p_stPickInfo)
{
int iDlgResult;
HINSTANCE hOldInst = AfxGetResourceHandle();
AfxSetResourceHandle ( ((CPA_DLLBase*)(GetEditor()))->GetDLLIdentity()->hModule );
CDlgAltimap3D dlgAltimap3D(this);
iDlgResult = dlgAltimap3D.DoModal();
AfxSetResourceHandle(hOldInst);
if (iDlgResult == IDOK)
{
// ... because the edit manager redoes them
m_pAltimapUndo -> Undo ();
// and the real AskFor is done by the calling editor
// m_pGeometry3DDLL -> GetInterface () -> GetMultiDevice () -> GetEditManager () -> AskFor (pAltimapUndo);
return TRUE;
}
else
{
m_pAltimapUndo -> Undo ();
m_pAltimapUndo = NULL;
return FALSE;
}
}
//------------------------------------------ AltimapUndo ---------------------------------------------
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :AltimapUndo::AltimapUndo
// Date : 98.02
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Init the undo data
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
AltimapUndo::AltimapUndo(Altimap3D *pAltimap3D) : CPA_Modif(0, "Set Altimap Parameters", FALSE)
{
m_pAltimap3D = pAltimap3D;
GEO_tdstElementAltimap *p_stAltimap = (GEO_tdstElementAltimap *) m_pAltimap3D -> GetStruct () -> d_stListOfElements [m_pAltimap3D -> m_hElement];
ACP_tdxIndex xNbVertices = (p_stAltimap -> xWidth + 1) * (p_stAltimap -> xDepth + 1);
ACP_tdxIndex xNbSquares = p_stAltimap -> xWidth * p_stAltimap -> xDepth;
GEO_M_CPAMalloc( m_p_stAltimapUndo,
GEO_tdstElementAltimap *,
sizeof( GEO_tdstElementAltimap ),
E_uwGEONotEnoughtMemory );
memcpy (m_p_stAltimapUndo, p_stAltimap, sizeof (GEO_tdstElementAltimap));
//--- Array of Heights ---
GEO_M_CPAMalloc( m_p_stAltimapUndo -> d_xHeight,
MTH_tdxReal *,
xNbVertices * sizeof( MTH_tdxReal ),
E_uwGEONotEnoughtMemory );
memcpy (m_p_stAltimapUndo -> d_xHeight, p_stAltimap -> d_xHeight, xNbVertices * sizeof (MTH_tdxReal));
/*
// no way
//--- Array of Point Normals ---
*/
//--- Array of Square Descriptors ---
GEO_M_CPAMalloc( m_p_stAltimapUndo->d_stSquare,
GEO_tdstAltimapSquare *,
xNbSquares* sizeof( GEO_tdstAltimapSquare ),
E_uwGEONotEnoughtMemory );
memcpy (m_p_stAltimapUndo -> d_stSquare, p_stAltimap -> d_stSquare, xNbSquares * sizeof (GEO_tdstAltimapSquare));
//--- Array of Face descriptors ---
GEO_M_CPAMalloc( m_p_stAltimapUndo->d_stFaces,
GEO_tdstAltimapFace *,
p_stAltimap -> xNbFaces * sizeof( GEO_tdstAltimapFace ),
E_uwGEONotEnoughtMemory );
memcpy (m_p_stAltimapUndo -> d_stFaces, p_stAltimap -> d_stFaces, p_stAltimap -> xNbFaces * sizeof (GEO_tdstAltimapFace));
//--- Array of UV Values ---
GEO_M_CPAMalloc( m_p_stAltimapUndo->d_stUVValues,
ACP_tdst2DUVValues *,
p_stAltimap -> xNbUVValues * sizeof( ACP_tdst2DUVValues ),
E_uwGEONotEnoughtMemory );
memcpy (m_p_stAltimapUndo -> d_stUVValues, p_stAltimap -> d_stUVValues, p_stAltimap -> xNbUVValues * sizeof (ACP_tdst2DUVValues));
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :AltimapUndo::Undo
// Date : 98.02
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : undo sphere parameters
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL AltimapUndo::Undo (void)
{
GEO_tdstElementAltimap stAltimapSwap;
GEO_tdstElementAltimap *p_stAltimap = (GEO_tdstElementAltimap *) m_pAltimap3D -> GetStruct () -> d_stListOfElements [m_pAltimap3D -> m_hElement];
memcpy (& stAltimapSwap, p_stAltimap, sizeof (GEO_tdstElementAltimap));
memcpy (p_stAltimap, m_p_stAltimapUndo, sizeof (GEO_tdstElementAltimap));
memcpy (m_p_stAltimapUndo, & stAltimapSwap, sizeof (GEO_tdstElementAltimap));
return TRUE;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :AltimapUndo::~AltimapUndo
// Date : 98.02
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : destroy the undo structure
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
AltimapUndo::~AltimapUndo (void)
{
// delete the altimap infos
GEO_M_CPAFree (m_p_stAltimapUndo -> d_xHeight);
//GEO_M_CPAFree (m_p_stAltimapElement -> d_stPointNormals); // never alloc it
GEO_M_CPAFree (m_p_stAltimapUndo -> d_stSquare);
GEO_M_CPAFree (m_p_stAltimapUndo -> d_stFaces);
GEO_M_CPAFree (m_p_stAltimapUndo -> d_stUVValues);
GEO_M_CPAFree (m_p_stAltimapUndo);
}

View File

@@ -0,0 +1,244 @@
//ROMTEAM WorldEditor
////////////////////////////////////////////////////////////////////////////////////////
// File : Arrow3D.cpp: implementation file for the Arrow3D classes
// Author : Viorel Preoteasa
// Date : 97.11
// Description :
////////////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ACP_Base.h"
#include "ITF.h"
#include "incGAM.h"
#include "GLI.h"
#include "DPT.h"
#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
#include "OGD.h"
#undef CPA_WANTS_EXPORT
#define CPA_WANTS_IMPORT
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : Construction/Destruction of Arrow3D
// Date : 97-11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Viorel Preoteasa - CPA2
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
Arrow3D::Arrow3D (BOOL bModifiable, CPA_EditorBase *_p_oEditor, const CString _csName , tdeSaveStatus _eStatus )
: Shape3D (bModifiable, _p_oEditor, 13, 1, _csName , _eStatus)
{
CommonArrow3D();
}
Arrow3D::Arrow3D (BOOL bModifiable, CPA_EditorBase *_p_oEditor, CPA_BaseObject *_p_oOwnerFile, const CString _csName, char *_p_cRefPath, tdeSaveStatus _eStatus )
: Shape3D (bModifiable, _p_oEditor, 13, 1, _p_oOwnerFile, _csName, _p_cRefPath, _eStatus)
{
CommonArrow3D();
}
Arrow3D::Arrow3D (BOOL bModifiable, CPA_EditorBase *_p_oEditor, CPA_BaseObject *_p_oOwnerFile, ACP_tdxHandleOfObject _hObject, const CString _csName, char *_p_cRefPath, tdeSaveStatus _eStatus)
: Shape3D (bModifiable, _p_oEditor, _p_oOwnerFile, _hObject, _csName, _p_cRefPath, _eStatus)
{
CommonArrow3D();
}
Arrow3D::~Arrow3D()
{
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : CommonArrow3D
// Date : 97-11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Common initialisation
// Author : Viorel Preoteasa - CPA2
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void Arrow3D::CommonArrow3D()
{
MTH3D_tdstVector a13_stPoint [13];
MTH3D_M_vSetVectorElements ( a13_stPoint, -0.05f, -0.05f, -0.6f);
MTH3D_M_vSetVectorElements ( a13_stPoint+1, 0.05f,-0.05f,-0.6f);
MTH3D_M_vSetVectorElements ( a13_stPoint+2, 0.05f,0.05f,-0.6f);
MTH3D_M_vSetVectorElements ( a13_stPoint+3, -0.05f,0.05f,-0.6f);
MTH3D_M_vSetVectorElements ( a13_stPoint+4, -0.05f,-0.05f,-0.2f);
MTH3D_M_vSetVectorElements ( a13_stPoint+5, 0.05f,-0.05f,-0.2f);
MTH3D_M_vSetVectorElements ( a13_stPoint+6, 0.05f,0.05f,-0.2f);
MTH3D_M_vSetVectorElements ( a13_stPoint+7, -0.05f,0.05f,-0.2f);
MTH3D_M_vSetVectorElements ( a13_stPoint+8, -0.1f,-0.1f,-0.2f);
MTH3D_M_vSetVectorElements ( a13_stPoint+9, 0.1f,-0.1f,-0.2f);
MTH3D_M_vSetVectorElements ( a13_stPoint+10, 0.1f,0.1f,-0.2f);
MTH3D_M_vSetVectorElements ( a13_stPoint+11, -0.1f,0.1f,-0.2f);
MTH3D_M_vSetVectorElements ( a13_stPoint+12, 0.f,0.f,0.0f);
for ( int i=0; i<13; i++ )
{
MTH3D_M_vMulScalarVector(a13_stPoint+i,2.f, a13_stPoint+i);
}
fn_vSetListOfPoints(13, a13_stPoint);
m_hElement = fn_hCreateElementIndexedTriangle(22,0);
fn_eSetIndexedTriangle ( m_hElement, 0, 0, 1, 3 );
fn_eSetIndexedTriangle ( m_hElement, 1, 1, 2, 3 );
fn_eSetIndexedTriangle ( m_hElement, 2, 4, 5, 1 );
fn_eSetIndexedTriangle ( m_hElement, 3, 1, 0, 4 );
fn_eSetIndexedTriangle ( m_hElement, 4, 1, 5, 6 );
fn_eSetIndexedTriangle ( m_hElement, 5, 1, 6, 2 );
fn_eSetIndexedTriangle ( m_hElement, 6, 3 ,2, 6 );
fn_eSetIndexedTriangle ( m_hElement, 7, 6, 7, 3 );
fn_eSetIndexedTriangle ( m_hElement, 8, 0, 3, 7 );
fn_eSetIndexedTriangle ( m_hElement, 9, 7, 4, 0 );
fn_eSetIndexedTriangle ( m_hElement, 10,8, 9, 4 );
fn_eSetIndexedTriangle ( m_hElement, 11,9, 5, 4 );
fn_eSetIndexedTriangle ( m_hElement, 12,9, 10,5 );
fn_eSetIndexedTriangle ( m_hElement, 13,5, 10,6);
fn_eSetIndexedTriangle ( m_hElement, 14,6, 10,11 );
fn_eSetIndexedTriangle ( m_hElement, 15,6, 11,7 );
fn_eSetIndexedTriangle ( m_hElement, 16,11,8, 7 );
fn_eSetIndexedTriangle ( m_hElement, 17,7, 8, 4);
fn_eSetIndexedTriangle ( m_hElement, 18,9, 12,10);
fn_eSetIndexedTriangle ( m_hElement, 19,10,12,11);
fn_eSetIndexedTriangle ( m_hElement, 20,11,12,8);
fn_eSetIndexedTriangle ( m_hElement, 21,8, 12,9 );
EndCreate();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : Construction/Destruction of DoubleArrow3D
// Date : 98-05
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Ionut Grozea- CPA2
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
DoubleArrow3D::DoubleArrow3D (BOOL bModifiable, CPA_EditorBase *_p_oEditor, const CString _csName , tdeSaveStatus _eStatus )
: Shape3D (bModifiable, _p_oEditor, 18, 1, _csName , _eStatus)
{
CommonDoubleArrow3D();
}
DoubleArrow3D::DoubleArrow3D (BOOL bModifiable, CPA_EditorBase *_p_oEditor, CPA_BaseObject *_p_oOwnerFile, const CString _csName, char *_p_cRefPath, tdeSaveStatus _eStatus )
: Shape3D (bModifiable, _p_oEditor, 18, 1, _p_oOwnerFile, _csName, _p_cRefPath, _eStatus)
{
CommonDoubleArrow3D();
}
DoubleArrow3D::DoubleArrow3D (BOOL bModifiable, CPA_EditorBase *_p_oEditor, CPA_BaseObject *_p_oOwnerFile, ACP_tdxHandleOfObject _hObject, const CString _csName, char *_p_cRefPath, tdeSaveStatus _eStatus)
: Shape3D (bModifiable, _p_oEditor, _p_oOwnerFile, _hObject, _csName, _p_cRefPath, _eStatus)
{
CommonDoubleArrow3D();
}
DoubleArrow3D::~DoubleArrow3D()
{
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : CommonDoubleArrow3d
// Date : 98-05
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Common initialisation
// Author : Ionut Grozea- CPA2
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void DoubleArrow3D::CommonDoubleArrow3D()
{
MTH3D_tdstVector a18_stPoint [18];
MTH3D_M_vSetVectorElements ( a18_stPoint, -0.05f, -0.05f, -0.2f);
MTH3D_M_vSetVectorElements ( a18_stPoint+1, 0.05f,-0.05f,-0.2f);
MTH3D_M_vSetVectorElements ( a18_stPoint+2, 0.05f,0.05f,-0.2f);
MTH3D_M_vSetVectorElements ( a18_stPoint+3, -0.05f,0.05f,-0.2f);
MTH3D_M_vSetVectorElements ( a18_stPoint+4, -0.05f,-0.05f,0.2f);
MTH3D_M_vSetVectorElements ( a18_stPoint+5, 0.05f,-0.05f,0.2f);
MTH3D_M_vSetVectorElements ( a18_stPoint+6, 0.05f,0.05f,0.2f);
MTH3D_M_vSetVectorElements ( a18_stPoint+7, -0.05f,0.05f,0.2f);
MTH3D_M_vSetVectorElements ( a18_stPoint+8, -0.1f,-0.1f,0.2f);
MTH3D_M_vSetVectorElements ( a18_stPoint+9, 0.1f,-0.1f,0.2f);
MTH3D_M_vSetVectorElements ( a18_stPoint+10, 0.1f,0.1f,0.2f);
MTH3D_M_vSetVectorElements ( a18_stPoint+11, -0.1f,0.1f,0.2f);
MTH3D_M_vSetVectorElements ( a18_stPoint+12, 0.f,0.f,0.4f);
MTH3D_M_vSetVectorElements ( a18_stPoint+13, -0.1f,-0.1f,-0.2f);
MTH3D_M_vSetVectorElements ( a18_stPoint+14, 0.1f,-0.1f,-0.2f);
MTH3D_M_vSetVectorElements ( a18_stPoint+15, 0.1f,0.1f,-0.2f);
MTH3D_M_vSetVectorElements ( a18_stPoint+16, -0.1f,0.1f,-0.2f);
MTH3D_M_vSetVectorElements ( a18_stPoint+17, 0.f,0.f,-0.4f);
for ( int i=0; i<18; i++ )
{
MTH3D_M_vMulScalarVector(a18_stPoint+i,2.f,a18_stPoint+i);
}
fn_vSetListOfPoints(18, a18_stPoint);
m_hElement = fn_hCreateElementIndexedTriangle(34,0);
fn_eSetIndexedTriangle ( m_hElement, 0, 0, 1, 3 );
fn_eSetIndexedTriangle ( m_hElement, 1, 1, 2, 3 );
fn_eSetIndexedTriangle ( m_hElement, 2, 4, 5, 1 );
fn_eSetIndexedTriangle ( m_hElement, 3, 1, 0, 4 );
fn_eSetIndexedTriangle ( m_hElement, 4, 1, 5, 6 );
fn_eSetIndexedTriangle ( m_hElement, 5, 1, 6, 2 );
fn_eSetIndexedTriangle ( m_hElement, 6, 3 ,2, 6 );
fn_eSetIndexedTriangle ( m_hElement, 7, 6, 7, 3 );
fn_eSetIndexedTriangle ( m_hElement, 8, 0, 3, 7 );
fn_eSetIndexedTriangle ( m_hElement, 9, 7, 4, 0 );
fn_eSetIndexedTriangle ( m_hElement, 10,8, 9, 4 );
fn_eSetIndexedTriangle ( m_hElement, 11,9, 5, 4 );
fn_eSetIndexedTriangle ( m_hElement, 12,9, 10,5 );
fn_eSetIndexedTriangle ( m_hElement, 13,5, 10,6);
fn_eSetIndexedTriangle ( m_hElement, 14,6, 10,11 );
fn_eSetIndexedTriangle ( m_hElement, 15,6, 11,7 );
fn_eSetIndexedTriangle ( m_hElement, 16,11,8, 7 );
fn_eSetIndexedTriangle ( m_hElement, 17,7, 8, 4);
fn_eSetIndexedTriangle ( m_hElement, 18,9, 12,10);
fn_eSetIndexedTriangle ( m_hElement, 19,10,12,11);
fn_eSetIndexedTriangle ( m_hElement, 20,11,12,8);
fn_eSetIndexedTriangle ( m_hElement, 21,8, 12,9 );
fn_eSetIndexedTriangle ( m_hElement, 22,14, 13, 0 );
fn_eSetIndexedTriangle ( m_hElement, 23,1, 14, 0 );
fn_eSetIndexedTriangle ( m_hElement, 24,15, 14,1 );
fn_eSetIndexedTriangle ( m_hElement, 25,15, 1,2);
fn_eSetIndexedTriangle ( m_hElement, 26,15, 2,16 );
fn_eSetIndexedTriangle ( m_hElement, 27,16, 2,3 );
fn_eSetIndexedTriangle ( m_hElement, 28,13,16, 3 );
fn_eSetIndexedTriangle ( m_hElement, 29,13, 3, 0);
fn_eSetIndexedTriangle ( m_hElement, 30,15, 17,14);
fn_eSetIndexedTriangle ( m_hElement, 31,14,17,13);
fn_eSetIndexedTriangle ( m_hElement, 32,13,17,16);
fn_eSetIndexedTriangle ( m_hElement, 33,16, 17,15 );
EndCreate();
}

View File

@@ -0,0 +1,94 @@
//ROMTEAM WorldEditor
////////////////////////////////////////////////////////////////////////////////////////
// File : Bar3D.cpp: implementation file for the Bar3D classes
// Author : Viorel Preoteasa
// Date : 97.11
// Description :
////////////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ACP_Base.h"
#include "ITF.h"
#include "incGAM.h"
#include "GLI.h"
#include "DPT.h"
#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
#include "OGD.h"
#undef CPA_WANTS_EXPORT
#ifndef CPA_WANTS_IMPORT
#define CPA_WANTS_IMPORT
#endif
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : Construction/Destruction of Bar3D
// Date : 97-11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Viorel Preoteasa - CPA2
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
Bar3D::Bar3D (BOOL bModifiable, CPA_EditorBase *_p_oEditor, const CString _csName , tdeSaveStatus _eStatus )
: Shape3D (bModifiable, _p_oEditor, 8, 1, _csName , _eStatus)
{
CommonBar3D();
}
Bar3D::Bar3D (BOOL bModifiable, CPA_EditorBase *_p_oEditor, CPA_BaseObject *_p_oOwnerFile, const CString _csName, char *_p_cRefPath, tdeSaveStatus _eStatus )
: Shape3D (bModifiable, _p_oEditor, 8, 1, _p_oOwnerFile, _csName, _p_cRefPath, _eStatus)
{
CommonBar3D();
}
Bar3D::Bar3D (BOOL bModifiable, CPA_EditorBase *_p_oEditor, CPA_BaseObject *_p_oOwnerFile, ACP_tdxHandleOfObject _hObject, const CString _csName, char *_p_cRefPath, tdeSaveStatus _eStatus)
: Shape3D (bModifiable, _p_oEditor, _p_oOwnerFile, _hObject, _csName, _p_cRefPath, _eStatus)
{
CommonBar3D();
}
Bar3D::~Bar3D()
{
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : Bar3D
// Date : 97-11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Common initialisation
// Author : Viorel Preoteasa - CPA2
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void Bar3D::CommonBar3D()
{
MTH3D_tdstVector a8_stPoint [8];
for ( int iCounter=0; iCounter<8; iCounter++)
MTH3D_M_vSetVectorElements ( a8_stPoint+iCounter, 0., 0., 0.);
fn_vSetListOfPoints(8, a8_stPoint);
m_hElement = fn_hCreateElementIndexedTriangle(12,0);
fn_eSetIndexedTriangle ( m_hElement, 0, 0, 1, 3 );
fn_eSetIndexedTriangle ( m_hElement, 1, 1, 2, 3 );
fn_eSetIndexedTriangle ( m_hElement, 2, 4, 5, 1 );
fn_eSetIndexedTriangle ( m_hElement, 3, 1, 0, 4 );
fn_eSetIndexedTriangle ( m_hElement, 4, 1, 5, 6 );
fn_eSetIndexedTriangle ( m_hElement, 5, 1, 6, 2 );
fn_eSetIndexedTriangle ( m_hElement, 6, 3, 2, 6 );
fn_eSetIndexedTriangle ( m_hElement, 7, 6, 7, 3 );
fn_eSetIndexedTriangle ( m_hElement, 8, 0, 3, 7 );
fn_eSetIndexedTriangle ( m_hElement, 9, 7, 4, 0 );
fn_eSetIndexedTriangle ( m_hElement, 10, 4, 7, 5 );
fn_eSetIndexedTriangle ( m_hElement, 11, 6, 5, 7 );
EndCreate();
}

View File

@@ -0,0 +1,749 @@
//ROMTEAM WorldEditor
////////////////////////////////////////////////////////////////////////////////////////
// File : Box3D.cpp: implementation of the Box3D class.
// Author : Cristi Petrescu
// Date : 97.11
// Description :
////////////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ACP_Base.h"
#include "ITF.h"
#include "incGAM.h"
#include "GLI.h"
#include "DPT.h"
#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
#include "OGD.h"
#undef CPA_WANTS_EXPORT
#ifndef CPA_WANTS_IMPORT
#define CPA_WANTS_IMPORT
#endif
#include "3dinterf.hpp"
#include "DlgBox3D.hpp"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : Box3D::Box3D
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : constructors to create a new object
// make one for each Geometry3D one. No general constructor :-(
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
Box3D::Box3D (BOOL bModifiable, CPA_EditorBase *_p_oEditor, /*ACP_tdxIndex xNbPoints, ACP_tdxIndex xNbElements,*/ const CString _csName , tdeSaveStatus _eStatus )
: Shape3D (bModifiable, _p_oEditor, 2, 1, _csName , _eStatus)
{
CommonBox3D ();
}
Box3D::Box3D (BOOL bModifiable, CPA_EditorBase *_p_oEditor, /*ACP_tdxIndex xNbPoints, ACP_tdxIndex xNbElements,*/ CPA_BaseObject *_p_oOwnerFile, const CString _csName /*= ""*/, char *_p_cRefPath /*= NULL*/, tdeSaveStatus _eStatus /*= E_ss_Responsible*/)
: Shape3D (bModifiable, _p_oEditor, 2, 1, _p_oOwnerFile, _csName, _p_cRefPath, _eStatus)
{
CommonBox3D ();
}
/****????*****///rezolvat ?? ionut
Box3D::Box3D (BOOL bModifiable, CPA_EditorBase *_p_oEditor, CPA_BaseObject *_p_oOwnerFile, ACP_tdxHandleOfObject _hObject, const CString _csName /*= ""*/, char *_p_cRefPath /*= NULL*/, tdeSaveStatus _eStatus /*= E_ss_Modify*/)
: Shape3D (bModifiable, _p_oEditor, _p_oOwnerFile, _hObject, _csName, _p_cRefPath, _eStatus)
{
// this seems to be used at load time.
// so do not alter the data!
// CommonBox3D ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : Box3D::CommonBox3D( )
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : common implementation for the constructors
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void Box3D::CommonBox3D( )
{
// initialise with dummy data
MTH3D_tdstVector stMinMaxPoints [2] = {{ (float) -0.1 , (float) -0.1 , (float) -0.1 } ,
{ (float) 0.1 , (float) 0.1 , (float) 0.1 }};
fn_vSetListOfPoints (2 , stMinMaxPoints);
m_hElement = fn_hCreateElementAlignedBox (1);
fn_eSetAlignedBox (m_hElement, 0 , 0 , 1);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : Box3D::~Box3D()
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : destructor, do nothing
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
Box3D::~Box3D()
{
}
/*
//-----------------------------------------------------------------------------
// Class Box3D - _OnKeyDown
// Default: we do not use the message
//-----------------------------------------------------------------------------
BOOL Box3D::_OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
return FALSE;
}
//-----------------------------------------------------------------------------
// Class Box3D - _OnKeyUp
// Default: we do not use the message
//-----------------------------------------------------------------------------
BOOL Box3D::_OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
{
return FALSE;
}
*/
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : Box3D::_OnMouseMove
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : adjust the box size according to the mouse input
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL Box3D::_OnMouseMove(UINT nFlags, tdstMousePos * p_stPos, MTH3D_tdstVector * pDeplacement)
{
if (Shape3D::_OnMouseMove (nFlags, p_stPos, pDeplacement))
{
// we make the movement
MTH3D_tdstVector OldSize;
MTH3D_M_vSetVectorElements (& OldSize , GetLength () ,
GetWidth () ,
GetHeight ());
// Calculate the deplacement in the local repere
MTH3D_tdstVector LocalDeplacement;
ConvertVectorGlobalToLocal (& LocalDeplacement ,
HIE_fn_hGetSuperObjectGlobalMatrix (m_pSuperObject -> GetStruct ()) ,
pDeplacement);
MTH3D_tdstVector Point = m_stLocalSelectedPoint;
// Set the new dimensions of the ZDx box object by moving one vertex
if (Point . xX > 0) IncMaxPointX (& LocalDeplacement . xX);
else IncMinPointX (& LocalDeplacement . xX);
if (Point . xY > 0) IncMaxPointY (& LocalDeplacement . xY);
else IncMinPointY (& LocalDeplacement . xY);
if (Point . xZ > 0) IncMaxPointZ (& LocalDeplacement . xZ);
else IncMinPointZ (& LocalDeplacement . xZ);
// Calculate the real move and return it in pDeplacement
MTH3D_tdstVector NewSize;
MTH3D_M_vSetVectorElements (& NewSize , GetLength () ,
GetWidth () ,
GetHeight ());
MTH3D_tdstVector DeltaSize;
MTH3D_M_vSubVector (& DeltaSize , & NewSize , & OldSize);
if (Point . xX < 0) DeltaSize . xX = - DeltaSize.xX;
if (Point . xY < 0) DeltaSize . xY = - DeltaSize.xY;
if (Point . xZ < 0) DeltaSize . xZ = - DeltaSize.xZ;
ConvertVectorLocalToGlobal (pDeplacement ,
HIE_fn_hGetSuperObjectGlobalMatrix (m_pSuperObject -> GetStruct ()) ,
& DeltaSize);
return TRUE;
}
else
return FALSE;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : BBox3D::_OnLButtonDown
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : initialise the resizing
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL Box3D::_OnLButtonDown(UINT nFlags, tdstMousePos * p_stPos, ACP_tdxIndex xIndex, HIE_tdstPickInfo * p_stObject)
{
if (Shape3D::_OnLButtonDown(nFlags, p_stPos, xIndex, p_stObject))
{
// resizing is allowed
ConvertPointGlobalToLocal (& m_stLocalSelectedPoint ,
HIE_fn_hGetSuperObjectGlobalMatrix (m_pSuperObject -> GetStruct ()) ,
& m_stGlobalSelectedPoint);
MTH3D_M_vSubVector (& m_stLocalSelectedPoint , & m_stLocalSelectedPoint ,
& GetCenter ());
m_stLocalSelectedPoint . xX /= GetLength ();
m_stLocalSelectedPoint . xY /= GetWidth ();
m_stLocalSelectedPoint . xZ /= GetHeight ();
return TRUE;
}
else
return FALSE;
}
/*
//-----------------------------------------------------------------------------
// Class Box3D - _OnLButtonUp
// Default: we do not use the message
//-----------------------------------------------------------------------------
BOOL Box3D::_OnLButtonUp(UINT nFlags, tdstMousePos * p_stPos)
{
return FALSE;
}
*/
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : Box3D::_OnLButtonDblClk
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : launch the modal dialog for keyboard editing
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL Box3D::_OnLButtonDblClk (UINT nFlags, tdstMousePos *p_stPos, ACP_tdxIndex xIndex, HIE_tdstPickInfo *p_stPickInfo)
{
int iDlgResult;
HINSTANCE hOldInst = AfxGetResourceHandle();
AfxSetResourceHandle ( ((CPA_DLLBase*)(GetEditor()))->GetDLLIdentity()->hModule );
CDlgBox3D dlgBox3D(this);
iDlgResult = dlgBox3D.DoModal();
AfxSetResourceHandle(hOldInst);
if (iDlgResult == IDOK)
return TRUE;
else
return FALSE;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Box3D : GetMinPoint
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : return the 3D coordinates of the point with the min coordinates of the box
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
MTH3D_tdstVector Box3D::GetMinPoint ()
{
MTH3D_tdstVector stMinPoint;
fn_eGetMinPoint (& stMinPoint , m_hElement);
return stMinPoint;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Box3D : SetMinPoint
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : set the 3D coordinates of the point with the min coordinates of the box
// if the given value is not correct, return FALSE
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL Box3D::SetMinPoint (MTH3D_tdstVector * _MinPoint)
{
return fn_eSetMinPoint (_MinPoint , m_hElement) == C_Ok;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Box3D : SetMinPointX
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : set the X coordinate of the point with the min coordinates of the box
// if the given value is not correct, return FALSE
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL Box3D::SetMinPointX (GLI_tdxValue * _MinPointX)
{
return fn_eSetMinPointX (_MinPointX , m_hElement) == C_Ok;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Box3D : SetMinPointY
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : set the Y coordinate of the point with the min coordinates of the box
// if the given value is not correct, return FALSE
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL Box3D::SetMinPointY (GLI_tdxValue * _MinPointY)
{
return fn_eSetMinPointY (_MinPointY , m_hElement) == C_Ok;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Box3D : SetMinPointZ
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : set the Z coordinate of the point with the min coordinates of the box
// if the given value is not correct, return FALSE
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL Box3D::SetMinPointZ (GLI_tdxValue * _MinPointZ)
{
return fn_eSetMinPointZ (_MinPointZ , m_hElement) == C_Ok;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Box3D : IncMinPointX
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : incremente the X coordinate of the point with the min coordinates of the box
// with a given value
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL Box3D::IncMinPointX (GLI_tdxValue * _IncX)
{
return fn_eIncMinPointX (_IncX , m_hElement) == C_Ok;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Box3D : IncMinPointY
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : incremente the Y coordinate of the point with the min coordinates of the box
// with a given value
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL Box3D::IncMinPointY (GLI_tdxValue * _IncY)
{
return fn_eIncMinPointY (_IncY , m_hElement) == C_Ok;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Box3D : IncMinPointZ
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : incremente the Z coordinate of the point with the min coordinates of the box
// with a given value
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL Box3D::IncMinPointZ (GLI_tdxValue * _IncZ)
{
return fn_eIncMinPointZ (_IncZ , m_hElement) == C_Ok;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Box3D : GetMaxPoint
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : return the 3D coordinates of the point with the max coordinates of the box
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
MTH3D_tdstVector Box3D::GetMaxPoint ()
{
MTH3D_tdstVector stMaxPoint;
fn_eGetMaxPoint (& stMaxPoint , m_hElement);
return stMaxPoint;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Box3D : SetMaxPoint
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : set the 3D coordinates of the point with the max coordinates of the box
// if the given value is not correct, return FALSE
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL Box3D::SetMaxPoint (MTH3D_tdstVector * _MaxPoint)
{
return fn_eSetMaxPoint (_MaxPoint , m_hElement) == C_Ok;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Box3D : SetMaxPointX
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : set the X coordinate of the point with the max coordinates of the box
// if the given value is not correct, return FALSE
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL Box3D::SetMaxPointX (GLI_tdxValue * _MaxPointX)
{
return fn_eSetMaxPointX (_MaxPointX , m_hElement) == C_Ok;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Box3D : SetMaxPointY
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : set the Y coordinate of the point with the max coordinates of the box
// if the given value is not correct, return FALSE
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL Box3D::SetMaxPointY (GLI_tdxValue * _MaxPointY)
{
return fn_eSetMaxPointY (_MaxPointY , m_hElement) == C_Ok;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Box3D : SetMaxPointZ
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : set the Z coordinate of the point with the max coordinates of the box
// if the given value is not correct, return FALSE
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL Box3D::SetMaxPointZ (GLI_tdxValue * _MaxPointZ)
{
return fn_eSetMaxPointZ (_MaxPointZ , m_hElement) == C_Ok;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Box3D : IncMaxPointX
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : incremente the X coordinate of the point with the Max coordinates of the box
// with a given value
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL Box3D::IncMaxPointX (GLI_tdxValue * _IncX)
{
return fn_eIncMaxPointX (_IncX , m_hElement) == C_Ok;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Box3D : IncMaxPointY
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : incremente the Y coordinate of the point with the Max coordinates of the box
// with a given value
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL Box3D::IncMaxPointY (GLI_tdxValue * _IncY)
{
return fn_eIncMaxPointY (_IncY , m_hElement) == C_Ok;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Box3D : IncMaxPointZ
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : incremente the Z coordinate of the point with the Max coordinates of the box
// with a given value
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL Box3D::IncMaxPointZ (GLI_tdxValue * _IncZ)
{
return fn_eIncMaxPointZ (_IncZ , m_hElement) == C_Ok;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Box3D : GetCenter
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : return the 3D coordinates of the center of the box
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
MTH3D_tdstVector Box3D::GetCenter ()
{
MTH3D_tdstVector stMinPoint = GetMinPoint ();
MTH3D_tdstVector stMaxPoint = GetMaxPoint ();
MTH3D_tdstVector stCenter;
MTH3D_M_vAddVector (& stCenter , & stMinPoint , & stMaxPoint);
MTH3D_M_vMulScalarVector (& stCenter , MTH_M_xFloatToReal ((float) 0.5) , & stCenter);
return stCenter;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Box3D : SetCenter
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : set the center of the box (in fact, the middle of the min point and the max point)
// dimensions are unchanged
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void Box3D::SetCenter (MTH3D_tdstVector * _Vertex)
{
SetCenterX (MTH3D_M_xGetXofVector (_Vertex));
SetCenterY (MTH3D_M_xGetYofVector (_Vertex));
SetCenterZ (MTH3D_M_xGetZofVector (_Vertex));
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Box3D : SetCenterX
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : set the X coordinate of the center of the box (in fact, the middle of the min point and the max point)
// dimensions are unchanged
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void Box3D::SetCenterX (GLI_tdxValue _X)
{
GLI_tdxValue MinPointX = _X - GetLength () / 2;
GLI_tdxValue MaxPointX = _X + GetLength () / 2;
fn_eSetMinPointX (& MinPointX , m_hElement);
fn_eSetMaxPointX (& MaxPointX , m_hElement);
fn_eSetMinPointX (& MinPointX , m_hElement); // To be sure (because we must have Min <= Max)
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Box3D : SetCenterY
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : set the Y coordinate of the center of the box (in fact, the middle of the min point and the max point)
// dimensions are unchanged
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void Box3D::SetCenterY (GLI_tdxValue _Y)
{
GLI_tdxValue MinPointY = _Y - GetWidth () / 2;
GLI_tdxValue MaxPointY = _Y + GetWidth () / 2;
fn_eSetMinPointY (& MinPointY , m_hElement);
fn_eSetMaxPointY (& MaxPointY , m_hElement);
fn_eSetMinPointY (& MinPointY , m_hElement); // To be sure (because we must have Min <= Max)
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Box3D : SetCenterZ
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : set the Z coordinate of the center of the box (in fact, the middle of the min point and the max point)
// dimensions are unchanged
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void Box3D::SetCenterZ (GLI_tdxValue _Z)
{
GLI_tdxValue MinPointZ = _Z - GetHeight () / 2;
GLI_tdxValue MaxPointZ = _Z + GetHeight () / 2;
fn_eSetMinPointZ (& MinPointZ , m_hElement);
fn_eSetMaxPointZ (& MaxPointZ , m_hElement);
fn_eSetMinPointZ (& MinPointZ , m_hElement); // To be sure (because we must have Min <= Max)
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Box3D : GetLength
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : return the length of the box
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
GLI_tdxValue Box3D::GetLength ()
{
return MTH3D_M_xGetXofVector (& GetMaxPoint ()) - MTH3D_M_xGetXofVector (& GetMinPoint ());
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Box3D : GetWidth
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : return the width of the box
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
GLI_tdxValue Box3D::GetWidth ()
{
return MTH3D_M_xGetYofVector (& GetMaxPoint ()) - MTH3D_M_xGetYofVector (& GetMinPoint ());
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Box3D : GetHeight
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : return the height of the box
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
GLI_tdxValue Box3D::GetHeight ()
{
return MTH3D_M_xGetZofVector (& GetMaxPoint ()) - MTH3D_M_xGetZofVector (& GetMinPoint ());
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Box3D : SetLength
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : set the length of the box
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL Box3D::SetLength (GLI_tdxValue * _Length)
{
BOOL Correct;
if (! (Correct = (* _Length >= 0.))) * _Length = 0.;
GLI_tdxValue MinPointX = MTH3D_M_xGetXofVector (& GetCenter ()) - * _Length / 2;
GLI_tdxValue MaxPointX = MTH3D_M_xGetXofVector (& GetCenter ()) + * _Length / 2;
SetMinPointX (& MinPointX);
SetMaxPointX (& MaxPointX);
return Correct;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Box3D : SetWidth
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : set the width of the box
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL Box3D::SetWidth (GLI_tdxValue * _Width)
{
BOOL Correct;
if (! (Correct = (* _Width >= 0.))) * _Width = 0.;
GLI_tdxValue MinPointY = MTH3D_M_xGetYofVector (& GetCenter ()) - * _Width / 2;
GLI_tdxValue MaxPointY = MTH3D_M_xGetYofVector (& GetCenter ()) + * _Width / 2;
SetMinPointY (& MinPointY);
SetMaxPointY (& MaxPointY);
return Correct;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Box3D : SetHeight
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : set the height of the box
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL Box3D::SetHeight (GLI_tdxValue * _Height)
{
BOOL Correct;
if (! (Correct = (* _Height >= 0.))) * _Height = 0.;
GLI_tdxValue MinPointZ = MTH3D_M_xGetZofVector (& GetCenter ()) - * _Height / 2;
GLI_tdxValue MaxPointZ = MTH3D_M_xGetZofVector (& GetCenter ()) + * _Height / 2;
SetMinPointZ (& MinPointZ);
SetMaxPointZ (& MaxPointZ);
return Correct;
}

View File

@@ -0,0 +1,595 @@
//ROMTEAM WorldEditor
////////////////////////////////////////////////////////////////////////////////////////
// File : Indexed Triangular Mesh editor
// Author : Nicolae Suparatu
// Date :
// Description :
////////////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ctriedit.h"
#include <math.h>
#define PI 3.1415926
static float distance(float dx, float dy){ return dx*dx + dy*dy;}
//**************************************** Class CTriEdit ********************************************
//-----------------------------------------------------------------------------------
CTriEdit::CTriEdit()
{
m_mesh = NULL;
m_bStackTopOK = TRUE;
m_ux = m_uy = 0;
m_iUnderCursor = m_iCrtVertex = -1;
m_SelRect.left = -1; // no selection rectangle
m_fLinearity = 1.f;
m_bVisibility = 0;
hdcmem = NULL;
bmp = NULL;
m_GreenPen = CreatePen(PS_SOLID, 1, PALETTERGB(160, 255, 160));
m_RedPen = CreatePen(PS_SOLID, 1, PALETTERGB(255, 20, 20));
m_iUndoCnt = m_iRedoCnt = m_iUndoSP = 0;
ZeroMemory(m_UndoStack, sizeof(m_UndoStack));
}
//------------------------------------------------------------------------------------
CTriEdit::~CTriEdit()
{
if(m_mesh) delete m_mesh;
if(bmp) DeleteObject(SelectObject(hdcmem, bmp));
if(hdcmem) DeleteDC(hdcmem);
DeleteObject(m_GreenPen);
DeleteObject(m_RedPen);
for(int i=0; i<MAXUNDOSTACK; i++)
if(m_UndoStack[i]) delete m_UndoStack[i];
}
//------------------------------------------------------------------------------------
// Set the editor window
void CTriEdit::SetHWnd(HWND hwnd)
{
m_hwnd = hwnd;
if(bmp) DeleteObject(SelectObject(hdcmem, bmp)), bmp = NULL;
if(hdcmem) DeleteDC(hdcmem);
HDC hdc = GetDC(hwnd);
hdcmem = CreateCompatibleDC(hdc);
ReleaseDC(hwnd, hdc);
Invalidate();
}
//------------------------------------------------------------------------------------
// Paint the scene (Double buffering method, to avoid image flashing)
void CTriEdit::OnPaint(HDC hdc)
{
int i, j, k;
if(!m_hwnd) return;
HPEN oldpen = (HPEN)SelectObject(hdcmem, m_GreenPen);
HBRUSH holdbrush = (HBRUSH)SelectObject(hdcmem, GetStockObject(BLACK_BRUSH));
PatBlt(hdcmem, 0, 0, m_r.right, m_r.bottom, BLACKNESS);
if(m_mesh)
{
if(m_bVisibility)
{
// Draw with hidden faces
POINT p[3];
char *sel = new char[m_mesh->m_iVerts];
for(i=0; i<m_mesh->m_iVerts; i++) sel[i] = m_mesh->m_sel[i];
for(i=0; i<m_mesh->m_iFaces; i++)
{
WORD *face = (WORD*)(m_mesh->m_face + m_mesh->m_sort[i]);
for(k=0; k<3; k++)
{
p[k].x = (int)m_mesh->m_prj[face[k]].x;
p[k].y = (int)m_mesh->m_prj[face[k]].y;
}
Polygon(hdcmem, p, 3);
for(k=0; k<3; k++) if((sel[face[k]]-=2) == 1) Select(hdcmem, p[k].x, p[k].y, m_RedPen);
}
delete []sel;
}
else
{
// Draw all edges, without hidden faces
for(int i=0; i<m_mesh->m_iEdges; i++)
{
CVertex *p = m_mesh->m_prj + m_mesh->m_edge[i][0];
MoveToEx(hdcmem, (int)p->x, (int)p->y, NULL);
p = m_mesh->m_prj + m_mesh->m_edge[i][1];
LineTo(hdcmem, (int)p->x, (int)p->y);
}
// Draw selected vertices, as small red rectangles.
if(m_mesh->m_iVerts > 1)
for(i=0; i<m_mesh->m_iVerts; i++)
if(m_mesh->Selected(i)) Select(hdcmem, (int)m_mesh->m_prj[i].x, (int)m_mesh->m_prj[i].y, m_RedPen);
}
}
SelectObject(hdcmem, oldpen);
SelectObject(hdcmem, holdbrush);
// Draw the selection rectangle
if(m_SelRect.left != -1)
{
RECT r;
NormalizeRect(m_SelRect, r);
DrawFocusRect(hdcmem, &r);
}
// draw the deformation filter
oldpen = (HPEN)SelectObject(hdcmem, GetStockObject(WHITE_PEN));
int dx = (m_r.right - m_r.left)/6;
int dy = (m_r.bottom - m_r.top)/6;
MoveToEx(hdcmem, 0, dy, NULL);
for(i=0; i<=20; i++)
{
j = (int)((Effect((float)(i-10.f)*(i-10.f)/400)*dy));
LineTo(hdcmem, i*dx/20, dy - j);
}
LineTo(hdcmem, dx, dy);
SelectObject(hdcmem, oldpen);
// Copy the BackBuffer to the FrameBuffer
BitBlt(hdc, 0, 0, m_r.right, m_r.bottom, hdcmem, 0, 0, SRCCOPY);
}
//------------------------------------------------------------------------------------
// Select specified point
void CTriEdit::Select(HDC hdc, int x, int y, HPEN pen)
{
HPEN oldpen = (HPEN)SelectObject(hdc, pen);
Rectangle(hdc, x-2, y-2, x+2, y+2);
SelectObject(hdc, oldpen);
}
//------------------------------------------------------------------------------------
// Create the mesh (vertex list + edge list)
void CTriEdit::InitMesh(int x, int y)
{
// Create a new mesh
if(m_mesh) delete m_mesh;
m_mesh = new CMesh(x, y);
// set the initial rotation and create the screen projections list
m_ux = 20;
m_uy = 20;
Rotate(0, 0);
m_mesh->SortZ();
m_iUndoCnt = m_iRedoCnt = m_iUndoSP = 0;
Invalidate();
}
//------------------------------------------------------------------------------------
// Rotate the scene and create a new projection list
void CTriEdit::Rotate(float dux, float duy)
{
if(!m_mesh || m_iCrtVertex != -1) return; // if not mesh or a vertex is just in move, no rotation done
m_ux += dux;
m_uy += duy;
m_mrot.SetRot(m_ux, m_uy);
m_mesh->ComputePrj(m_r, m_mrot);
if(m_bVisibility) m_mesh->SortZ();
Invalidate();
}
//------------------------------------------------------------------------------------
// Called when the window is resized
void CTriEdit::Resize(int cx, int cy)
{
SetRect(&m_r, 0, 0, cx, cy);
if(bmp) DeleteObject(SelectObject(hdcmem, bmp));
if(cx)
{ HDC hdc = GetDC(m_hwnd);
bmp = CreateCompatibleBitmap(hdc, m_r.right, m_r.bottom);
ReleaseDC(m_hwnd, hdc);
bmp = (HBITMAP)SelectObject(hdcmem, bmp);
}
if(m_mesh) m_mesh->ComputePrj(m_r, m_mrot);
}
//------------------------------------------------------------------------------------
// Set the cursor shape
int CTriEdit::OnSetCursor(int x, int y)
{
if(!m_mesh) return 0;
float dist = 10000;
m_iUnderCursor = -1;
for(int i=0; i<m_mesh->m_iVerts; i++)
{
float d = distance(x - m_mesh->m_prj[i].x, y - m_mesh->m_prj[i].y);
if(d <= dist && d < 26)
{
dist = d;
m_iUnderCursor = i;
}
}
return m_iUnderCursor >= 0;
}
//------------------------------------------------------------------------------------
// Manage all mouse actions (vertex or group moving + draw selection rectangle)
void CTriEdit::OnMouseMove(POINT p)
{
m_SelRect.right = p.x;
m_SelRect.bottom = p.y;
if(m_SelRect.left != -1) Invalidate();
if(m_iCrtVertex == -1) return;
int i = m_iUndoSP;
AddModulo(i, -1);
CMesh *tmpMesh = m_UndoStack[i];
float sx = p.x - tmpMesh->m_prj[m_iCrtVertex].x;
float sy = p.y - tmpMesh->m_prj[m_iCrtVertex].y;
for(i=0; i<m_mesh->m_iVerts; i++)
{
if(m_mesh->Selected(i))
{
float eff = Effect(tmpMesh->m_v[i] - tmpMesh->m_v[m_iCrtVertex]);
float dx = (tmpMesh->m_prj[i].x + sx*eff)/(m_r.right - m_r.left) - 0.5f;
float dy = (m_r.bottom - tmpMesh->m_prj[i].y - sy*eff)/(m_r.bottom - m_r.top) - 0.5f;
CVertex v(dx, dy, tmpMesh->m_prj[i].z);
m_mesh->m_v[i] = v / m_mrot;
}
}
m_bStackTopOK = TRUE; // validate the stack top for Undo/Redo
m_mesh->ComputePrj(m_r, m_mrot);
Invalidate();
}
//------------------------------------------------------------------------------------
// Manage the mouse LBDown message
void CTriEdit::OnLButtonDown(UINT flags, POINT p)
{
int i;
SetCapture(m_hwnd);
m_iCrtVertex = m_iUnderCursor;
if(m_iCrtVertex != -1)
{
if(flags & MK_CONTROL) m_mesh->Toggle(m_iCrtVertex);
else
if(!m_mesh->Selected(m_iCrtVertex))
for(i =0; i < m_mesh->m_iVerts; i++) m_mesh->Select(i, m_iCrtVertex == i);
else;
if(m_UndoStack[m_iUndoSP]) delete m_UndoStack[m_iUndoSP];
m_UndoStack[m_iUndoSP] = new CMesh(*m_mesh);
AddModulo(m_iUndoSP, 1);
if(++m_iUndoCnt >= MAXUNDOSTACK) m_iUndoCnt = MAXUNDOSTACK - 1;
m_bStackTopOK = FALSE; // the stack top is not yet valid
m_iRedoCnt = 0;
m_SelRect.left = -1; // no selection rectangle
}
else if(m_mesh)
{
if(!(flags & MK_CONTROL))
for(i =0; i < m_mesh->m_iVerts; i++) m_mesh->Select(i, 0);
SetRect(&m_SelRect, p.x, p.y, p.x, p.y);
}
Invalidate();
}
//------------------------------------------------------------------------------------
// Manage the mouse LBUp message
void CTriEdit::OnLButtonUp(UINT flags, POINT p)
{
ReleaseCapture();
m_iCrtVertex = -1;
if(!m_bStackTopOK) // if the stack top is not valid
{
AddModulo(m_iUndoSP, -1); // clean the stack top
m_iUndoCnt--;
}
if(m_SelRect.left == -1) return;
int i;
RECT r;
NormalizeRect(m_SelRect, r);
for(i=0; i<m_mesh->m_iVerts; i++)
{
POINT pt = {(int)m_mesh->m_prj[i].x, (int)m_mesh->m_prj[i].y};
if(flags & MK_CONTROL) m_mesh->Or(i, PtInRect(&r, pt));
else m_mesh->Select(i, PtInRect(&r, pt));
}
m_SelRect.left = -1; // hide the selection rectangle
Invalidate();
}
//------------------------------------------------------------------------------------
// Transform a source rectangle in a normalized one (left<right and top<bottom)
void CTriEdit::NormalizeRect(RECT &s, RECT &d)
{
SetRect(&d, min(s.left, s.right), min(s.bottom, s.top),max(s.left, s.right), max(s.bottom, s.top));
}
void CTriEdit::SetLinearity(float l)
{
m_fLinearity = 1 - l;
Invalidate();
}
float CTriEdit::Effect(float dist)
{
return (float)exp(-m_fLinearity*MAXLIN*dist);
}
void CTriEdit::OnUndo()
{
if(!m_iUndoCnt) return;
if(!m_iRedoCnt)
{
if(m_UndoStack[m_iUndoSP]) delete m_UndoStack[m_iUndoSP];
m_UndoStack[m_iUndoSP] = new CMesh(*m_mesh);
}
AddModulo(m_iUndoSP, -1);
*m_mesh = *m_UndoStack[m_iUndoSP];
m_mesh->ComputePrj(m_r, m_mrot);
m_iRedoCnt++;
m_iUndoCnt--;
Invalidate();
}
void CTriEdit::OnRedo()
{
if(!m_iRedoCnt) return;
AddModulo(m_iUndoSP, 1);
*m_mesh = *m_UndoStack[m_iUndoSP];
m_mesh->ComputePrj(m_r, m_mrot);
m_iRedoCnt--;
m_iUndoCnt++;
Invalidate();
}
void CTriEdit::AddModulo(int &i, int inc, int mod)
{
i = (i + inc) % mod;
if(i < 0) i += mod;
}
//*****************************************************************************************************
//******************************************** Class CMatrix ******************************************
//------------------------------------------------------------------------------------
CMatrix3::CMatrix3()
{
for(int i=0; i<3; i++)
for(int j=0; j<3; j++)
m[i][j] = (float)(i == j);
}
//------------------------------------------------------------------------------------
// Initialize a linear rotation matrix from 2 angles: around Y axis and around X axis, in this order
void CMatrix3::SetRot(float ux, float uy)
{
float s1 = (float)sin(ux*PI/180.0);
float c1 = (float)cos(ux*PI/180.0);
float s2 = (float)sin(uy*PI/180.0);
float c2 = (float)cos(uy*PI/180.0);
m[0][0] = c1;
m[0][1] = 0;
m[0][2] = s1;
m[1][0] = s1*s2;
m[1][1] = c2;
m[1][2] = -s2*c1;
m[2][0] = -s1*c2;
m[2][1] = s2;
m[2][2] = c1*c2;
}
//*****************************************************************************************************
//******************************************** Class CVertex ******************************************
//------------------------------------------------------------------------------------
// Multiply a CVertex with a 3X3 matrix
CVertex CVertex::operator *(CMatrix3& m)
{
CVertex v;
for(int i=0; i<3; i++)
(&v.x)[i] = m(i, 0)*x + m(i, 1)*y + m(i, 2)*z;
return v;
}
//------------------------------------------------------------------------------------
// Multiply a CVertex with a orthogonal 3X3 matrix inverse
CVertex CVertex::operator /(CMatrix3& m)
{
CVertex v;
for(int i=0; i<3; i++)
(&v.x)[i] = m(0, i)*x + m(1, i)*y + m(2, i)*z;
return v;
}
//------------------------------------------------------------------------------------
float CVertex::operator-(CVertex &v)
{
return distance(x - v.x, z - v.z) + (y - v.y)*(y - v.y);
}
//*****************************************************************************************************
//******************************************** Class CMesh ******************************************
CMesh *CMesh::s_me;
//------------------------------------------------------------------------------------
// CMesh constructor
CMesh::CMesh(int x, int y)
{
int i, j, k, l;
m_iDimx = x;
m_iDimy = y;
m_iVerts = (x + 1) * (y + 1);
m_iFaces = x * y * 2;
m_iEdges = 3 * x * y + x + y;
// create the vertex list
m_v = new CVertex[m_iVerts];
m_sel = new char[m_iVerts];
ZeroMemory(m_sel, m_iVerts);
for(j=k=0; j<=y; j++)
for(i=0; i<=x; i++, k++)
m_v[k] = CVertex((float)i/x - 0.5f, 0, (float)j/y - 0.5f);
// create the edge list
m_edge = (WORD(*)[2])malloc(2*sizeof(WORD)*m_iEdges);
for(j=k=l=0; j<=y; j++)
for(i=0; i<=x; i++, l++)
{
if(i < x)
{
m_edge[k][0] = l;
m_edge[k++][1] = l + 1;
if(j < y)
{
m_edge[k][0] = l;
m_edge[k++][1] = l + x + 2;
}
}
if(j < y)
{
m_edge[k][0] = l;
m_edge[k++][1] = l + x + 1;
}
}
// create the faces list
m_face = (WORD(*)[3])malloc(3*sizeof(WORD)*m_iFaces);
for(j=k=l=0; j<y; j++, l++)
for(i=0; i<x; i++, k+=2, l++)
{
m_face[k][0] = l;
m_face[k][1] = l + 1;
m_face[k][2] = l + x + 2;
m_face[k+1][0] = l + x + 1;
m_face[k+1][1] = l;
m_face[k+1][2] = l + x + 2;
m_sel[l] += 2;
m_sel[l+1] += 4;
m_sel[l+x+1] += 4;
m_sel[l+x+2] += 2;
}
// create the projections list
m_prj = new CVertex [m_iVerts];
// create a sorted faces list
m_sort = new int[m_iFaces];
for(i=0; i<m_iFaces; i++) m_sort[i] = i;
}
//------------------------------------------------------------------------------------
// CMesh constructor
CMesh::CMesh(CMesh &m)
{
m_iDimx = m.m_iDimx;
m_iDimy = m.m_iDimy;
m_iVerts = m.m_iVerts;
m_iFaces = m.m_iFaces;
m_iEdges = m.m_iEdges;
m_sort = NULL;
m_sel = NULL;
m_edge = NULL;
m_face = NULL;
m_v = new CVertex[m_iVerts];
// m_sel = new char[m_iVerts];
// m_edge = (WORD(*)[2])malloc(2*sizeof(WORD)*m_iEdges);
// m_face = (WORD(*)[3])malloc(3*sizeof(WORD)*m_iFaces);
m_prj = new CVertex[m_iVerts];
*this = m;
}
//------------------------------------------------------------------------------------
// CMesh destructor
CMesh::~CMesh()
{
if(m_v) delete []m_v;
if(m_edge) free(m_edge);
if(m_sel) delete []m_sel;
if(m_prj) delete []m_prj;
if(m_face) free(m_face);
if(m_sort) delete []m_sort;
}
//------------------------------------------------------------------------------------
// CMesh ZSort function
void CMesh::SortZ()
{
s_me = this;
qsort(m_sort, m_iFaces, sizeof(int), Compare);
}
//------------------------------------------------------------------------------------
// Compute the scene projection. All vertices are parallel projected on the XY plane, and values
// are stored in m_prj CVertex array
void CMesh::ComputePrj(RECT &r, CMatrix3 &m)
{
// compute the vertex screen projections
for(int i=0; i<m_iVerts; i++)
{
CVertex v = m_v[i] * m;
m_prj[i].x = (v.x + 0.5f)*(r.right - r.left);
m_prj[i].y = r.bottom - (v.y + 0.5f)*(r.bottom - r.top);
m_prj[i].z = v.z;
}
}
//------------------------------------------------------------------------------------
// CMesh compare function
int CMesh::Compare(const void *p1, const void *p2)
{
WORD *f1 = s_me->m_face[*(int*)p1];
WORD *f2 = s_me->m_face[*(int*)p2];
CVertex *prj = s_me->m_prj;
float a = max(max(prj[f1[0]].z, prj[f1[1]].z), prj[f1[2]].z);
float b = max(max(prj[f2[0]].z, prj[f2[1]].z), prj[f2[2]].z);
return a < b ? -1 : 1;
}
void CMesh::operator = (CMesh &m)
{
CopyMemory(m_v, m.m_v, m_iVerts*sizeof(CVertex));
CopyMemory(m_prj, m.m_prj, m_iVerts*sizeof(CVertex));
// CopyMemory(m_sel, m.m_sel, m_iVerts);
// CopyMemory(m_edge, m.m_edge, 2*sizeof(WORD)*m_iEdges);
// CopyMemory(m_face, m.m_face, 3*sizeof(WORD)*m_iFaces);
}
//*****************************************************************************************************

View File

@@ -0,0 +1,592 @@
//ROMTEAM WorldEditor
////////////////////////////////////////////////////////////////////////////////////////
// File : Cone3D.cpp: implementation of the Cone3D class.
// Author : Cristi Petrescu
// Date : 97.11
// Description :
////////////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ACP_Base.h"
#include "ITF.h"
#include "incGAM.h"
#include "GLI.h"
#include "DPT.h"
#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
#include "OGD.h"
#undef CPA_WANTS_EXPORT
#ifndef CPA_WANTS_IMPORT
#define CPA_WANTS_IMPORT
#endif
#include "3dinterf.hpp"
#include "DlgCon3D.hpp"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : Cone3D::Cone3D
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : constructors to create a new object
// make one for each Geometry3D one. No general constructor :-(
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
Cone3D::Cone3D (BOOL bModifiable, CPA_EditorBase *_p_oEditor, /*ACP_tdxIndex xNbPoints, ACP_tdxIndex xNbElements,*/ const CString _csName , tdeSaveStatus _eStatus )
: Shape3D (bModifiable, _p_oEditor, 2, 1, _csName , _eStatus)
{
CommonCone3D ();
}
Cone3D::Cone3D (BOOL bModifiable, CPA_EditorBase *_p_oEditor, /*ACP_tdxIndex xNbPoints, ACP_tdxIndex xNbElements,*/ CPA_BaseObject *_p_oOwnerFile, const CString _csName /*= ""*/, char *_p_cRefPath /*= NULL*/, tdeSaveStatus _eStatus /*= E_ss_Responsible*/)
: Shape3D (bModifiable, _p_oEditor, 2, 1, _p_oOwnerFile, _csName, _p_cRefPath, _eStatus)
{
CommonCone3D ();
}
/****????*****///rezolvat ?? ionut
Cone3D::Cone3D (BOOL bModifiable, CPA_EditorBase *_p_oEditor, CPA_BaseObject *_p_oOwnerFile, ACP_tdxHandleOfObject _hObject, const CString _csName /*= ""*/, char *_p_cRefPath /*= NULL*/, tdeSaveStatus _eStatus /*= E_ss_Modify*/)
: Shape3D (bModifiable, _p_oEditor, _p_oOwnerFile, _hObject, _csName, _p_cRefPath, _eStatus)
{
// this seems to be used at load time.
// so do not alter the data!
// CommonCone3D ();
}
// ----------------------------------------------------------------------------
// Description : common implementation for the constructors
// ----------------------------------------------------------------------------
void Cone3D::CommonCone3D( )
{
// initialise with dummy data
MTH3D_tdstVector stPoints [2] = {{ 0 , 0 , 0 } , { 0 , 0 , 1 }};
fn_vSetListOfPoints (2 , stPoints);
m_hElement = fn_hCreateElementCone (1);
fn_eSetCone (m_hElement, 0 , 0 , 1 , (float) 0.1);
fn_vEndCreation ();
}
Cone3D::~Cone3D()
{
}
/*
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method Cone3D - _OnKeyDown
// Date 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Default: we do not use the message
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL Cone3D::_OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
return FALSE;
}
//-----------------------------------------------------------------------------
// Class Cone3D - _OnKeyUp
// Default: we do not use the message
//-----------------------------------------------------------------------------
BOOL Cone3D::_OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
{
return FALSE;
}
*/
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Cone3D - _OnMouseMove
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : adjust the box size according to the mouse input
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL Cone3D::_OnMouseMove(UINT nFlags, tdstMousePos * p_stPos, MTH3D_tdstVector * pDeplacement)
{
if (Shape3D::_OnMouseMove (nFlags, p_stPos, pDeplacement))
{
MTH3D_tdstVector LocalDeplacement;
ConvertVectorGlobalToLocal (& LocalDeplacement ,
HIE_fn_hGetSuperObjectGlobalMatrix (m_pSuperObject->GetStruct ()) ,
pDeplacement);
if (m_bChangeTopPointOfCone) // We change the top point
{
MTH3D_tdstVector TopPoint = GetTopPoint ();
MTH3D_M_vAddVector (& TopPoint , & TopPoint , & LocalDeplacement);
SetTopPoint (& TopPoint);
}
else // We change the radius and the base point
{
MTH3D_tdstVector BasePoint = GetBasePoint ();
MTH3D_tdstVector TopPoint = GetTopPoint ();
// We splt the deplacement into radius change and base point change
MTH3D_tdstVector BaseTopVector;
MTH3D_M_vSubVector (& BaseTopVector , & TopPoint , & BasePoint);
MTH_tdxReal DotProduct = MTH3D_M_xDotProductVector (& BaseTopVector , & LocalDeplacement);
MTH3D_tdstVector ProjectedVector; // Projected into the axe
MTH3D_M_vMulScalarVector (& ProjectedVector , DotProduct , & BaseTopVector);
MTH3D_M_vDivScalarVector (& ProjectedVector , & ProjectedVector , MTH3D_M_xSqrVector (& BaseTopVector));
// We change the base point
MTH3D_M_vAddVector (& BasePoint , & BasePoint , & ProjectedVector);
SetBasePoint (& BasePoint);
// We change the radius
MTH3D_M_vAddVector (& m_stLocalSelectedPoint ,
& m_stLocalSelectedPoint , & LocalDeplacement);
MTH3D_M_vSubVector (& m_stLocalSelectedPoint ,
& m_stLocalSelectedPoint , & ProjectedVector);
MTH_tdxReal NewRadius = MTH3D_M_xVectorGap (& m_stLocalSelectedPoint , & BasePoint);
SetRadius (& NewRadius);
}
return TRUE;
}
else
return FALSE;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Cone3D - _OnLButtonDown
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Init the resizing
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL Cone3D::_OnLButtonDown(UINT nFlags, tdstMousePos * p_stPos, ACP_tdxIndex xIndex, HIE_tdstPickInfo * p_stObject)
{
if (Shape3D::_OnLButtonDown(nFlags, p_stPos, xIndex, p_stObject))
{
// resizing is allowed
ConvertPointGlobalToLocal (& m_stLocalSelectedPoint ,
HIE_fn_hGetSuperObjectGlobalMatrix (m_pSuperObject -> GetStruct ()) ,
& m_stGlobalSelectedPoint);
// We see if we must change the top point or the radius of the cone
MTH3D_tdstVector TopPoint = GetTopPoint ();
MTH3D_tdstVector BasePoint = GetBasePoint ();
MTH_tdxReal SquareDistanceToTopPoint = MTH3D_M_xVectorGapSqr (& m_stLocalSelectedPoint , & TopPoint);
MTH_tdxReal SquareDistanceToBasePoint = MTH3D_M_xVectorGapSqr (& m_stLocalSelectedPoint , & BasePoint);
if (SquareDistanceToTopPoint < SquareDistanceToBasePoint)
{
m_bChangeTopPointOfCone = TRUE;
}
else
{
m_bChangeTopPointOfCone = FALSE;
// We project the picked point into the base plane
MTH3D_tdstVector BaseTopVector;
MTH3D_M_vSubVector (& BaseTopVector , & TopPoint , & BasePoint);
MTH3D_tdstVector BasePointVector;
MTH3D_M_vSubVector (& BasePointVector , & m_stLocalSelectedPoint , & BasePoint);
MTH_tdxReal DotProduct = MTH3D_M_xDotProductVector (& BaseTopVector , & BasePointVector);
MTH3D_tdstVector ProjectedVector;
MTH3D_M_vMulScalarVector (& ProjectedVector , DotProduct , & BaseTopVector);
MTH3D_M_vDivScalarVector (& ProjectedVector , & ProjectedVector , MTH3D_M_xSqrVector (& BaseTopVector));
MTH3D_M_vAddVector (& m_stLocalSelectedPoint ,
& m_stLocalSelectedPoint , & ProjectedVector);
}
return TRUE;
}
else
return FALSE;
}
/*
//-----------------------------------------------------------------------------
// Class Cone3D - _OnLButtonUp
// Default: we do not use the message
//-----------------------------------------------------------------------------
BOOL Cone3D::_OnLButtonUp(UINT nFlags, tdstMousePos * p_stPos)
{
return FALSE;
}
*/
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Cone3D - _OnLButtonDblClk
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : launch the modal dialog
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL Cone3D::_OnLButtonDblClk (UINT nFlags, tdstMousePos *p_stPos, ACP_tdxIndex xIndex, HIE_tdstPickInfo *p_stPickInfo)
{
int iDlgResult;
HINSTANCE hOldInst = AfxGetResourceHandle();
AfxSetResourceHandle ( ((CPA_DLLBase*)(GetEditor()))->GetDLLIdentity()->hModule );
CDlgCone3D dlgCone3D(this);
iDlgResult = dlgCone3D.DoModal();
AfxSetResourceHandle(hOldInst);
if (iDlgResult == IDOK)
return TRUE;
else
return FALSE;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Cone3D : GetBasePoint
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Return the 3D coordinates of the base point
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
MTH3D_tdstVector Cone3D::GetBasePoint ()
{
ACP_tdxIndex IndexOfTopPoint , IndexOfBasePoint;
MTH3D_tdstVector BasePoint;
fn_eGetConePoints (m_hElement , 0 , & IndexOfTopPoint , & IndexOfBasePoint);
fn_vGetPoint (IndexOfBasePoint , & BasePoint);
return BasePoint;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Cone3D : GetTopPoint
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Return the 3D coordinates of the top point
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
MTH3D_tdstVector Cone3D::GetTopPoint ()
{
ACP_tdxIndex IndexOfTopPoint , IndexOfBasePoint;
MTH3D_tdstVector TopPoint;
fn_eGetConePoints (m_hElement , 0 , & IndexOfTopPoint , & IndexOfBasePoint);
fn_vGetPoint (IndexOfTopPoint , & TopPoint);
return TopPoint;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Cone3D : SetBasePoint
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Set the 3D coordinates of the base point
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void Cone3D::SetBasePoint (MTH3D_tdstVector * _pBasePoint)
{
ACP_tdxIndex IndexOfTopPoint , IndexOfBasePoint;
fn_eGetConePoints (m_hElement , 0 , & IndexOfTopPoint , & IndexOfBasePoint);
fn_vSetPoint (IndexOfBasePoint , _pBasePoint);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Cone3D : SetTopPoint
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Set the 3D coordinates of the top point
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void Cone3D::SetTopPoint (MTH3D_tdstVector * _pTopPoint)
{
ACP_tdxIndex IndexOfTopPoint , IndexOfBasePoint;
fn_eGetConePoints (m_hElement , 0 , & IndexOfTopPoint , & IndexOfBasePoint);
fn_vSetPoint (IndexOfTopPoint , _pTopPoint);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Cone3D : SetBasePointX
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Set the X coordinate of the base point
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void Cone3D::SetBasePointX (GLI_tdxValue _X)
{
MTH3D_tdstVector BasePoint = GetBasePoint ();
MTH3D_M_vSetXofVector (& BasePoint , _X);
SetBasePoint (& BasePoint);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Cone3D : SetBasePointY
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Set the Y coordinate of the base point
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void Cone3D::SetBasePointY (GLI_tdxValue _Y)
{
MTH3D_tdstVector BasePoint = GetBasePoint ();
MTH3D_M_vSetYofVector (& BasePoint , _Y);
SetBasePoint (& BasePoint);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Cone3D : SetBasePointZ
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Set the Z coordinate of the base point
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void Cone3D::SetBasePointZ (GLI_tdxValue _Z)
{
MTH3D_tdstVector BasePoint = GetBasePoint ();
MTH3D_M_vSetZofVector (& BasePoint , _Z);
SetBasePoint (& BasePoint);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Cone3D : SetTopPointX
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Set the X coordinate of the top point
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void Cone3D::SetTopPointX (GLI_tdxValue _X)
{
MTH3D_tdstVector TopPoint = GetTopPoint ();
MTH3D_M_vSetXofVector (& TopPoint , _X);
SetTopPoint (& TopPoint);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Cone3D : SetTopPointY
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Set the Y coordinate of the top point
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void Cone3D::SetTopPointY (GLI_tdxValue _Y)
{
MTH3D_tdstVector TopPoint = GetTopPoint ();
MTH3D_M_vSetYofVector (& TopPoint , _Y);
SetTopPoint (& TopPoint);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Cone3D : SetTopPointZ
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Set the Z coordinate of the top point
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
void Cone3D::SetTopPointZ (GLI_tdxValue _Z)
{
MTH3D_tdstVector TopPoint = GetTopPoint ();
MTH3D_M_vSetZofVector (& TopPoint , _Z);
SetTopPoint (& TopPoint);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Cone3D : GetCenter
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : return the 3D coordinates of the center of the cone (in fact, the middle of BasePoint and TopPoint)
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
MTH3D_tdstVector Cone3D::GetCenter ()
{
MTH3D_tdstVector stBasePoint = GetBasePoint ();
MTH3D_tdstVector stTopPoint = GetTopPoint ();
MTH3D_tdstVector stCenter;
MTH3D_M_vAddVector (& stCenter , & stBasePoint , & stTopPoint);
MTH3D_M_vMulScalarVector (& stCenter , MTH_M_xFloatToReal ((float) 0.5) , & stCenter);
return stCenter;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Cone3D : SetCenter
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : set the 3D coordinates of the center of the cone (in fact, the middle of BasePoint and TopPoint)
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void Cone3D::SetCenter (MTH3D_tdstVector * _pCenter)
{
MTH3D_tdstVector stOldCenter = GetCenter ();
MTH3D_tdstVector stTranslation;
MTH3D_M_vSubVector (& stTranslation , _pCenter , & stOldCenter);
MTH3D_tdstVector stOldBasePoint = GetBasePoint ();
MTH3D_tdstVector stNewBasePoint;
MTH3D_M_vAddVector (& stNewBasePoint , & stOldBasePoint , & stTranslation);
SetBasePoint (& stNewBasePoint);
MTH3D_tdstVector stOldTopPoint = GetTopPoint ();
MTH3D_tdstVector stNewTopPoint;
MTH3D_M_vAddVector (& stNewTopPoint , & stOldTopPoint , & stTranslation);
SetTopPoint ( & stNewTopPoint);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Cone3D : GetRadius
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Return the radius of the cone
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
GLI_tdxValue Cone3D::GetRadius ()
{
return fn_xGetConeBaseRadius (m_hElement , 0);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Cone3D : SetRadius
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Set the radius of the cone
// If the value is not correct (negative), return FALSE and set the value to 0
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL Cone3D::SetRadius (GLI_tdxValue * _pRadius)
{
BOOL Correct = * _pRadius >= 0;
if (! Correct) _pRadius = 0;
fn_eSetConeBaseRadius (m_hElement , 0 , * _pRadius);
return Correct;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Cone3D : GetAngle
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Return the angle of the cone
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
GLI_tdxValue Cone3D::GetAngle ()
{
MTH3D_tdstVector BasePoint = GetBasePoint ();
MTH3D_tdstVector TopPoint = GetTopPoint ();
double Length = MTH3D_M_xVectorGap (& BasePoint , & TopPoint);
return (GLI_tdxValue) atan2 ((double)GetRadius () , Length) * MTH_C_180ByPi;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Cone3D : SetAngle
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Set the angle of the cone
// If the value is not correct, return FALSE and set a correct value
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL Cone3D::SetAngle (GLI_tdxValue * _pAngle)
{
BOOL bCorrect;
if (* _pAngle < 0.)
{
* _pAngle = 0.;
bCorrect = FALSE;
}
else
if (* _pAngle > 90.)
{
* _pAngle = 90.;
bCorrect = FALSE;
}
else bCorrect = TRUE;
MTH3D_tdstVector BasePoint = GetBasePoint ();
MTH3D_tdstVector TopPoint = GetTopPoint ();
float Length = MTH3D_M_xVectorGap (& BasePoint , & TopPoint);
float Radius = (float) (Length * tan (* _pAngle * MTH_C_PiBy180));
SetRadius (& Radius);
return bCorrect;
}

View File

@@ -0,0 +1,792 @@
//ROMTEAM WorldEditor
////////////////////////////////////////////////////////////////////////////////////////
// File : DlgBox3D.cpp : implementation file
// Author : Cristi Petrescu
// Date : 97.11
// Description :
////////////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ACP_Base.h"
#include "incITF.h"
#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
#include "OGD.h"
#undef CPA_WANTS_EXPORT
#define CPA_WANTS_IMPORT
#include "3Dinterf.hpp"
#include "DlgBox3D.hpp"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDlgBox3D dialog
CDlgBox3D::CDlgBox3D (Box3D *pBox3D, CWnd * _pParent /*= NULL*/)
:CDialog (CDlgBox3D::IDD, _pParent)
{
m_pBox3D = pBox3D;
//{{AFX_DATA_INIT(CDlgBox3D)
m_Radio_Button = -1;
m_Check_Box_Cube = FALSE;
m_Edition_Zone_Center_X = _T("");
m_Edition_Zone_Center_Y = _T("");
m_Edition_Zone_Center_Z = _T("");
m_Edition_Zone_Height = _T("");
m_Edition_Zone_Length = _T("");
m_Edition_Zone_Width = _T("");
m_Edition_Zone_X_Maxi = _T("");
m_Edition_Zone_X_Mini = _T("");
m_Edition_Zone_Y_Maxi = _T("");
m_Edition_Zone_Y_Mini = _T("");
m_Edition_Zone_Z_Maxi = _T("");
m_Edition_Zone_Z_Mini = _T("");
//}}AFX_DATA_INIT
}
void CDlgBox3D::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgBox3D)
DDX_Radio(pDX, IDC_Radio_Button_Center, m_Radio_Button);
DDX_Check(pDX, IDC_Check_Box_Cube, m_Check_Box_Cube);
DDX_Text(pDX, IDC_Edition_Zone_Center_X, m_Edition_Zone_Center_X);
DDX_Text(pDX, IDC_Edition_Zone_Center_Y, m_Edition_Zone_Center_Y);
DDX_Text(pDX, IDC_Edition_Zone_Center_Z, m_Edition_Zone_Center_Z);
DDX_Text(pDX, IDC_Edition_Zone_Height, m_Edition_Zone_Height);
DDX_Text(pDX, IDC_Edition_Zone_Length, m_Edition_Zone_Length);
DDX_Text(pDX, IDC_Edition_Zone_Width, m_Edition_Zone_Width);
DDX_Text(pDX, IDC_Edition_Zone_X_Maxi, m_Edition_Zone_X_Maxi);
DDX_Text(pDX, IDC_Edition_Zone_X_Mini, m_Edition_Zone_X_Mini);
DDX_Text(pDX, IDC_Edition_Zone_Y_Maxi, m_Edition_Zone_Y_Maxi);
DDX_Text(pDX, IDC_Edition_Zone_Y_Mini, m_Edition_Zone_Y_Mini);
DDX_Text(pDX, IDC_Edition_Zone_Z_Maxi, m_Edition_Zone_Z_Maxi);
DDX_Text(pDX, IDC_Edition_Zone_Z_Mini, m_Edition_Zone_Z_Mini);
DDX_Control(pDX, IDC_Slider_Size, m_Slider_Size);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlgBox3D, CDialog)
//{{AFX_MSG_MAP(CDlgBox3D)
ON_BN_CLICKED(IDC_Radio_Button_Center, On_Radio_Button_Center)
ON_BN_CLICKED(IDC_Radio_Button_Extrema, On_Radio_Button_Extrema)
ON_EN_CHANGE(IDC_Edition_Zone_X_Mini, On_Change_Edition_Zone_X_Mini)
ON_EN_CHANGE(IDC_Edition_Zone_Y_Mini, On_Change_Edition_Zone_Y_Mini)
ON_EN_CHANGE(IDC_Edition_Zone_Z_Mini, On_Change_Edition_Zone_Z_Mini)
ON_EN_CHANGE(IDC_Edition_Zone_X_Maxi, On_Change_Edition_Zone_X_Maxi)
ON_EN_CHANGE(IDC_Edition_Zone_Y_Maxi, On_Change_Edition_Zone_Y_Maxi)
ON_EN_CHANGE(IDC_Edition_Zone_Z_Maxi, On_Change_Edition_Zone_Z_Maxi)
ON_EN_CHANGE(IDC_Edition_Zone_Center_X, On_Change_Edition_Zone_Center_X)
ON_EN_CHANGE(IDC_Edition_Zone_Center_Y, On_Change_Edition_Zone_Center_Y)
ON_EN_CHANGE(IDC_Edition_Zone_Center_Z, On_Change_Edition_Zone_Center_Z)
ON_EN_CHANGE(IDC_Edition_Zone_Length, On_Change_Edition_Zone_Length)
ON_EN_CHANGE(IDC_Edition_Zone_Width, On_Change_Edition_Zone_Width)
ON_EN_CHANGE(IDC_Edition_Zone_Height, On_Change_Edition_Zone_Height)
ON_BN_CLICKED(IDC_Check_Box_Cube, On_Check_Box_Cube)
ON_WM_HSCROLL()
ON_BN_CLICKED(IDC_Button_Init, On_Button_Init)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgBox3D - OnInitDialog
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : initialisation of the window
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL CDlgBox3D::OnInitDialog()
{
CDialog::OnInitDialog();
m_Radio_Button = 0; // we show the Center screen
m_InitialMini = m_pBox3D -> GetMinPoint (); //save the initial dimensions
m_InitialMaxi = m_pBox3D -> GetMaxPoint ();
RefreshData (); // Init the other variables
return TRUE;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgBox3D - On_Radio_Button_Center
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : clic on the radio button Center : we show the fields for the center
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgBox3D::On_Radio_Button_Center ()
{
m_Radio_Button = 0;
// Fill the variables for the screen
MTH3D_tdstVector Center = m_pBox3D->GetCenter ();
m_Edition_Zone_Center_X . Format ("%.4g" , Center . xX);
m_Edition_Zone_Center_Y . Format ("%.4g" , Center . xY);
m_Edition_Zone_Center_Z . Format ("%.4g" , Center . xZ);
m_Edition_Zone_Length . Format ("%.4g" , m_pBox3D->GetLength ());
m_Edition_Zone_Width . Format ("%.4g" , m_pBox3D->GetWidth ());
m_Edition_Zone_Height . Format ("%.4g" , m_pBox3D->GetHeight ());
UpdateData (FALSE); // Update the screen
// Hide the items for the extrema screen
GetDlgItem (IDC_Frame_Mini) -> ShowWindow (SW_HIDE);
GetDlgItem (IDC_Static_Text_X_Mini) -> ShowWindow (SW_HIDE);
GetDlgItem (IDC_Static_Text_Y_Mini) -> ShowWindow (SW_HIDE);
GetDlgItem (IDC_Static_Text_Z_Mini) -> ShowWindow (SW_HIDE);
GetDlgItem (IDC_Edition_Zone_X_Mini) -> ShowWindow (SW_HIDE);
GetDlgItem (IDC_Edition_Zone_Y_Mini) -> ShowWindow (SW_HIDE);
GetDlgItem (IDC_Edition_Zone_Z_Mini) -> ShowWindow (SW_HIDE);
GetDlgItem (IDC_Frame_Maxi) -> ShowWindow (SW_HIDE);
GetDlgItem (IDC_Static_Text_X_Maxi) -> ShowWindow (SW_HIDE);
GetDlgItem (IDC_Static_Text_Y_Maxi) -> ShowWindow (SW_HIDE);
GetDlgItem (IDC_Static_Text_Z_Maxi) -> ShowWindow (SW_HIDE);
GetDlgItem (IDC_Edition_Zone_X_Maxi) -> ShowWindow (SW_HIDE);
GetDlgItem (IDC_Edition_Zone_Y_Maxi) -> ShowWindow (SW_HIDE);
GetDlgItem (IDC_Edition_Zone_Z_Maxi) -> ShowWindow (SW_HIDE);
// Show the items for the Center screen
GetDlgItem (IDC_Frame_Center) -> ShowWindow (SW_SHOW);
GetDlgItem (IDC_Static_Text_Center_X) -> ShowWindow (SW_SHOW);
GetDlgItem (IDC_Static_Text_Center_Y) -> ShowWindow (SW_SHOW);
GetDlgItem (IDC_Static_Text_Center_Z) -> ShowWindow (SW_SHOW);
GetDlgItem (IDC_Static_Text_Length) -> ShowWindow (SW_SHOW);
GetDlgItem (IDC_Static_Text_Width) -> ShowWindow (SW_SHOW);
GetDlgItem (IDC_Static_Text_Height) -> ShowWindow (SW_SHOW);
GetDlgItem (IDC_Edition_Zone_Center_X) -> ShowWindow (SW_SHOW);
GetDlgItem (IDC_Edition_Zone_Center_Y) -> ShowWindow (SW_SHOW);
GetDlgItem (IDC_Edition_Zone_Center_Z) -> ShowWindow (SW_SHOW);
GetDlgItem (IDC_Edition_Zone_Length) -> ShowWindow (SW_SHOW);
GetDlgItem (IDC_Edition_Zone_Width) -> ShowWindow (SW_SHOW);
GetDlgItem (IDC_Edition_Zone_Height) -> ShowWindow (SW_SHOW);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgBox3D - On_Radio_Button_Extrema
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : clic on the radio button Center : we show the fields for the extrema
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgBox3D::On_Radio_Button_Extrema ()
{
m_Radio_Button = 1;
// Fill the variables for the screen
MTH3D_tdstVector MinPoint = m_pBox3D->GetMinPoint ();
m_Edition_Zone_X_Mini . Format ("%.4g" , MinPoint . xX);
m_Edition_Zone_Y_Mini . Format ("%.4g" , MinPoint . xY);
m_Edition_Zone_Z_Mini . Format ("%.4g" , MinPoint . xZ);
MTH3D_tdstVector MaxPoint = m_pBox3D->GetMaxPoint ();
m_Edition_Zone_X_Maxi . Format ("%.4g" , MaxPoint . xX);
m_Edition_Zone_Y_Maxi . Format ("%.4g" , MaxPoint . xY);
m_Edition_Zone_Z_Maxi . Format ("%.4g" , MaxPoint . xZ);
UpdateData (FALSE); // Update the screen
// Hide the items for the Center screen
GetDlgItem (IDC_Frame_Center) -> ShowWindow (SW_HIDE);
GetDlgItem (IDC_Static_Text_Center_X) -> ShowWindow (SW_HIDE);
GetDlgItem (IDC_Static_Text_Center_Y) -> ShowWindow (SW_HIDE);
GetDlgItem (IDC_Static_Text_Center_Z) -> ShowWindow (SW_HIDE);
GetDlgItem (IDC_Static_Text_Length) -> ShowWindow (SW_HIDE);
GetDlgItem (IDC_Static_Text_Width) -> ShowWindow (SW_HIDE);
GetDlgItem (IDC_Static_Text_Height) -> ShowWindow (SW_HIDE);
GetDlgItem (IDC_Edition_Zone_Center_X) -> ShowWindow (SW_HIDE);
GetDlgItem (IDC_Edition_Zone_Center_Y) -> ShowWindow (SW_HIDE);
GetDlgItem (IDC_Edition_Zone_Center_Z) -> ShowWindow (SW_HIDE);
GetDlgItem (IDC_Edition_Zone_Length) -> ShowWindow (SW_HIDE);
GetDlgItem (IDC_Edition_Zone_Width) -> ShowWindow (SW_HIDE);
GetDlgItem (IDC_Edition_Zone_Height) -> ShowWindow (SW_HIDE);
// Show the items for the extrema screen
GetDlgItem (IDC_Frame_Mini) -> ShowWindow (SW_SHOW);
GetDlgItem (IDC_Static_Text_X_Mini) -> ShowWindow (SW_SHOW);
GetDlgItem (IDC_Static_Text_Y_Mini) -> ShowWindow (SW_SHOW);
GetDlgItem (IDC_Static_Text_Z_Mini) -> ShowWindow (SW_SHOW);
GetDlgItem (IDC_Edition_Zone_X_Mini) -> ShowWindow (SW_SHOW);
GetDlgItem (IDC_Edition_Zone_Y_Mini) -> ShowWindow (SW_SHOW);
GetDlgItem (IDC_Edition_Zone_Z_Mini) -> ShowWindow (SW_SHOW);
GetDlgItem (IDC_Frame_Maxi) -> ShowWindow (SW_SHOW);
GetDlgItem (IDC_Static_Text_X_Maxi) -> ShowWindow (SW_SHOW);
GetDlgItem (IDC_Static_Text_Y_Maxi) -> ShowWindow (SW_SHOW);
GetDlgItem (IDC_Static_Text_Z_Maxi) -> ShowWindow (SW_SHOW);
GetDlgItem (IDC_Edition_Zone_X_Maxi) -> ShowWindow (SW_SHOW);
GetDlgItem (IDC_Edition_Zone_Y_Maxi) -> ShowWindow (SW_SHOW);
GetDlgItem (IDC_Edition_Zone_Z_Maxi) -> ShowWindow (SW_SHOW);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgBox3D - On_Change_Edition_Zone_Center_X
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : this function is called when the user changes the X coordinate of the center :
// we update the variable
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgBox3D::On_Change_Edition_Zone_Center_X ()
{
UpdateData (TRUE); // Update variables from screen
m_pBox3D -> SetCenterX ((float) atof (m_Edition_Zone_Center_X));
RedrawBackground ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgBox3D - On_Change_Edition_Zone_Center_Y
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : this function is called when the user changes the X coordinate of the center :
// we update the variable
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgBox3D::On_Change_Edition_Zone_Center_Y ()
{
UpdateData (TRUE); // Update variables from screen
m_pBox3D -> SetCenterY ((float) atof (m_Edition_Zone_Center_Y));
RedrawBackground ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgBox3D - On_Change_Edition_Zone_Center_Z
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : this function is called when the user changes the Z coordinate of the center :
// we update the variable
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgBox3D::On_Change_Edition_Zone_Center_Z ()
{
UpdateData (TRUE); // Update variables from screen
m_pBox3D -> SetCenterZ ((float) atof (m_Edition_Zone_Center_Z));
RedrawBackground ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgBox3D - On_Change_Edition_Zone_Length
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : this function is called when the user changes the length of the box : we update the variables
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgBox3D::On_Change_Edition_Zone_Length ()
{
UpdateData (TRUE); // Update variables from screen
float Length = (float) atof (m_Edition_Zone_Length);
BOOL CorrectValue = m_pBox3D -> SetLength (& Length);
if (m_IsACube) // If it is a cube, we must change width and height
{
m_Edition_Zone_Width = m_Edition_Zone_Height = m_Edition_Zone_Length;
CorrectValue &= m_pBox3D -> SetWidth (& Length);
CorrectValue &= m_pBox3D -> SetHeight (& Length);
UpdateData (FALSE); // Update the screen
}
// If one of the given value is not correct (negative), we refresh the display
if (! CorrectValue) RefreshData (TRUE);
RefreshSlider ();
RedrawBackground ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgBox3D - On_Change_Edition_Zone_Width
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : this function is called when the user changes the width of the box : we update the variables
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgBox3D::On_Change_Edition_Zone_Width ()
{
UpdateData (TRUE); // Update variables from screen
float Width = (float) atof (m_Edition_Zone_Width);
BOOL CorrectValue = m_pBox3D -> SetWidth (& Width);
if (m_IsACube) // If it is a cube, we must change length and height
{
m_Edition_Zone_Length = m_Edition_Zone_Height = m_Edition_Zone_Width;
CorrectValue &= m_pBox3D -> SetLength (& Width);
CorrectValue &= m_pBox3D -> SetHeight (& Width);
UpdateData (FALSE); // Update the screen
}
// If one of the given value is not correct (negative), we refresh the display
if (! CorrectValue) RefreshData (TRUE);
RefreshSlider ();
RedrawBackground ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgBox3D - On_Change_Edition_Zone_Height
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : this function is called when the user changes the height of the box : we update the variables
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgBox3D::On_Change_Edition_Zone_Height ()
{
UpdateData (TRUE); // Update variables from screen
float Height = (float) atof (m_Edition_Zone_Height);
BOOL CorrectValue = m_pBox3D -> SetHeight (& Height);
if (m_IsACube) // If it is a cube, we must change length and width
{
m_Edition_Zone_Length = m_Edition_Zone_Width = m_Edition_Zone_Height;
CorrectValue &= m_pBox3D -> SetLength (& Height);
CorrectValue &= m_pBox3D -> SetWidth (& Height);
UpdateData (FALSE); // Update the screen
}
// If one of the given value is not correct (negative), we refresh the display
if (! CorrectValue) RefreshData (TRUE);
RefreshSlider ();
RedrawBackground ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgBox3D - On_Change_Edition_Zone_X_Mini
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : this function is called when the user changes the X coordinate of the min point
// we update the variable
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgBox3D::On_Change_Edition_Zone_X_Mini()
{
UpdateData (TRUE); // Update variables from screen
float X_Mini = (float) atof (m_Edition_Zone_X_Mini);
BOOL CorrectValue = m_pBox3D -> SetMinPointX (& X_Mini);
if (m_IsACube) // If it is a cube, we must change Y_Mini and Z_Mini too
{
float Y_Mini = (float) (atof (m_Edition_Zone_Y_Maxi) - atof (m_Edition_Zone_X_Maxi) + X_Mini);
float Z_Mini = (float) (atof (m_Edition_Zone_Z_Maxi) - atof (m_Edition_Zone_X_Maxi) + X_Mini);
m_pBox3D -> SetMinPointY (& Y_Mini);
m_pBox3D -> SetMinPointZ (& Z_Mini);
RefreshData (TRUE);
UpdateData (FALSE); // Update the screen
}
else if (! CorrectValue) RefreshData (TRUE);
RefreshSlider ();
RedrawBackground ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgBox3D - On_Change_Edition_Zone_Y_Mini
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : this function is called when the user changes the Y coordinate of the min point
// we update the variable
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgBox3D::On_Change_Edition_Zone_Y_Mini()
{
UpdateData (TRUE); // Update variables from screen
float Y_Mini = (float) atof (m_Edition_Zone_Y_Mini);
BOOL CorrectValue = m_pBox3D -> SetMinPointY (& Y_Mini);
if (m_IsACube) // If it is a cube, we must change X_Mini and Z_Mini too
{
float X_Mini = (float) (atof (m_Edition_Zone_X_Maxi) - atof (m_Edition_Zone_Y_Maxi) + Y_Mini);
float Z_Mini = (float) (atof (m_Edition_Zone_Z_Maxi) - atof (m_Edition_Zone_Y_Maxi) + Y_Mini);
m_pBox3D -> SetMinPointX (& X_Mini);
m_pBox3D -> SetMinPointZ (& Z_Mini);
RefreshData (TRUE);
UpdateData (FALSE); // Update the screen
}
else if (! CorrectValue) RefreshData (TRUE);
RefreshSlider ();
RedrawBackground ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgBox3D - On_Change_Edition_Zone_Z_Mini
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : this function is called when the user changes the Z coordinate of the min point
// we update the variable
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgBox3D::On_Change_Edition_Zone_Z_Mini()
{
UpdateData (TRUE); // Update variables from screen
float Z_Mini = (float) atof (m_Edition_Zone_Z_Mini);
BOOL CorrectValue = m_pBox3D -> SetMinPointZ (& Z_Mini);
if (m_IsACube) // If it is a cube, we must change X_Mini and Y_Mini too
{
float X_Mini = (float) (atof (m_Edition_Zone_X_Maxi) - atof (m_Edition_Zone_Z_Maxi) + Z_Mini);
float Y_Mini = (float) (atof (m_Edition_Zone_Y_Maxi) - atof (m_Edition_Zone_Z_Maxi) + Z_Mini);
m_pBox3D -> SetMinPointX (& X_Mini);
m_pBox3D -> SetMinPointY (& Y_Mini);
RefreshData (TRUE);
UpdateData (FALSE); // Update the screen
}
else if (! CorrectValue) RefreshData (TRUE);
RefreshSlider ();
RedrawBackground ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgBox3D - On_Change_Edition_Zone_X_Maxi
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : this function is called when the user changes the X coordinate of the max point
// we update the variable
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgBox3D::On_Change_Edition_Zone_X_Maxi()
{
UpdateData (TRUE); // Update variables from screen
float X_Maxi = (float) atof (m_Edition_Zone_X_Maxi);
BOOL CorrectValue = m_pBox3D -> SetMaxPointX (& X_Maxi);
if (m_IsACube) // If it is a cube, we must change Y_Maxi and Z_Maxi too
{
float Y_Maxi = (float) (atof (m_Edition_Zone_Y_Mini) + X_Maxi - atof (m_Edition_Zone_X_Mini));
float Z_Maxi = (float) (atof (m_Edition_Zone_Z_Mini) + X_Maxi - atof (m_Edition_Zone_X_Mini));
m_pBox3D -> SetMaxPointY (& Y_Maxi);
m_pBox3D -> SetMaxPointZ (& Z_Maxi);
RefreshData (TRUE);
UpdateData (FALSE); // Update the screen
}
else if (! CorrectValue) RefreshData (TRUE);
RefreshSlider ();
RedrawBackground ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgBox3D - On_Change_Edition_Zone_Y_Maxi
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : this function is called when the user changes the Y coordinate of the max point
// we update the variable
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgBox3D::On_Change_Edition_Zone_Y_Maxi()
{
UpdateData (TRUE); // Update variables from screen
float Y_Maxi = (float) atof (m_Edition_Zone_Y_Maxi);
BOOL CorrectValue = m_pBox3D -> SetMaxPointY (& Y_Maxi);
if (m_IsACube) // If it is a cube, we must change X_Maxi and Z_Maxi too
{
float X_Maxi = (float) (atof (m_Edition_Zone_X_Mini) + Y_Maxi - atof (m_Edition_Zone_Y_Mini));
float Z_Maxi = (float) (atof (m_Edition_Zone_Z_Mini) + Y_Maxi - atof (m_Edition_Zone_Y_Mini));
m_pBox3D -> SetMaxPointX (& X_Maxi);
m_pBox3D -> SetMaxPointZ (& Z_Maxi);
RefreshData (TRUE);
UpdateData (FALSE); // Update the screen
}
else if (! CorrectValue) RefreshData (TRUE);
RefreshSlider ();
RedrawBackground ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgBox3D - On_Change_Edition_Zone_Z_Maxi
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : this function is called when the user changes the Z coordinate of the max point
// we update the variable
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgBox3D::On_Change_Edition_Zone_Z_Maxi()
{
UpdateData (TRUE); // Update variables from screen
float Z_Maxi = (float) atof (m_Edition_Zone_Z_Maxi);
BOOL CorrectValue = m_pBox3D -> SetMaxPointZ (& Z_Maxi);
if (m_IsACube) // If it is a cube, we must change X_Maxi and Y_Maxi too
{
float X_Maxi = (float) (atof (m_Edition_Zone_X_Mini) + Z_Maxi - atof (m_Edition_Zone_Z_Mini));
float Y_Maxi = (float) (atof (m_Edition_Zone_Y_Mini) + Z_Maxi - atof (m_Edition_Zone_Z_Mini));
m_pBox3D -> SetMaxPointX (& X_Maxi);
m_pBox3D -> SetMaxPointY (& Y_Maxi);
RefreshData (TRUE);
UpdateData (FALSE); // Update the screen
}
else if (! CorrectValue) RefreshData (TRUE);
RefreshSlider ();
RedrawBackground ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgBox3D - On_Check_Box_Cube
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : this function is called when the user clic on the check box Cube
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgBox3D::On_Check_Box_Cube()
{
UpdateData (TRUE); // Update variables from screen
m_IsACube = m_Check_Box_Cube;
if (m_IsACube) // if the check box Cube is selected, then length, width and height must be equal
{
//Box3D * p = m_pBox3D; // pointer to the ZDx box object
GLI_tdxValue L = (m_pBox3D->GetLength () + m_pBox3D->GetWidth () + m_pBox3D->GetHeight ()) / 3;
m_pBox3D->SetLength (& L);
m_pBox3D->SetWidth (& L);
m_pBox3D->SetHeight (& L);
// update the screen
if (m_Radio_Button == 0) On_Radio_Button_Center ();
else On_Radio_Button_Extrema ();
RefreshSlider ();
RedrawBackground ();
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgBox3D - RefreshSlider
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Refresh the position of the slider
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgBox3D::RefreshSlider ()
{
double BoxAverageSize = (m_pBox3D -> GetLength () + m_pBox3D -> GetWidth () + m_pBox3D -> GetHeight ()) / 3.0;
m_Slider_Size . SetOwner (this);
m_Slider_Size . SetRange (0 , 150 , TRUE);
m_Slider_Size . SetPos ((long) (BoxAverageSize * 100));
m_Slider_Size . SetTicFreq (50);
UpdateData (FALSE);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgBox3D - RefreshSizeFromSlider
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Refresh the size of the box when the position of the slider has changed
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgBox3D::RefreshSizeFromSlider ()
{
UpdateData (TRUE);
float OldBoxAverageSize = (float) ((m_pBox3D -> GetLength () + m_pBox3D -> GetWidth () + m_pBox3D -> GetHeight ()) / 3.0);
float NewBoxAverageSize = (float) (m_Slider_Size . GetPos () / 100.0);
float Coef = NewBoxAverageSize / OldBoxAverageSize;
float NewLength = m_pBox3D -> GetLength () * Coef;
float NewWidth = m_pBox3D -> GetWidth () * Coef;
float NewHeight = m_pBox3D -> GetHeight () * Coef;
m_pBox3D -> SetLength (& NewLength);
m_pBox3D -> SetWidth (& NewWidth);
m_pBox3D -> SetHeight (& NewHeight);
RefreshData (TRUE);
RedrawBackground ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgBox3D - RefreshData
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : this function is called when the data need to be refreshed (because of a Undo, for instance)
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgBox3D::RefreshData (BOOL _bKeepCube)
{
// Init the variables
if (! _bKeepCube) m_Check_Box_Cube = m_IsACube = FALSE;
// Init the variables on the screen
if (m_Radio_Button == 0) On_Radio_Button_Center ();
else On_Radio_Button_Extrema ();
RefreshSlider ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgBox3D - RefreshData
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : this function is called when the data need to be refreshed (because of a Undo, for instance)
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgBox3D::RefreshData ()
{
RefreshData (FALSE);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgBox3D - OnHScroll
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Call when the slider is changed
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgBox3D::OnHScroll(UINT nSBCode , UINT nPos , CScrollBar * pScrollBar)
{
if (pScrollBar == (void *) & m_Slider_Size) RefreshSizeFromSlider ();
else CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgBox3D - On_Button_Init
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Call when the user clics on the Init button : we reinit the position and the size of the box
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgBox3D::On_Button_Init ()
{
m_pBox3D -> SetMinPoint (& m_InitialMini);
m_pBox3D -> SetMaxPoint (& m_InitialMaxi);
//m_pBox3D -> SetMinPoint (& m_FatherMinPoint);
RefreshData ();
RedrawBackground ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : void CDlgCone3D::RedrawBackground
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : redraws the main view.
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgBox3D::RedrawBackground (void)
{
(((DEV_MultiDevice*)g_oFrameGest.ma_p_oWinArray[2][2]->GetActiveView())->DrawObject());
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgBox3D - OnCancel
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : set the initial radius value
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgBox3D::OnCancel()
{
m_pBox3D -> SetMinPoint (& m_InitialMini);
m_pBox3D -> SetMaxPoint (& m_InitialMaxi);
//m_pBox3D -> SetMinPoint (& m_FatherMinPoint);
CDialog::OnCancel();
}

View File

@@ -0,0 +1,353 @@
//ROMTEAM WorldEditor
////////////////////////////////////////////////////////////////////////////////////////
// File : DlgCone3D.cpp : implementation file
// Author : Cristi Petrescu
// Date : 97.11
// Description :
////////////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ACP_Base.h"
#include "incITF.h"
#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
#include "OGD.h"
#undef CPA_WANTS_EXPORT
#define CPA_WANTS_IMPORT
#include "3Dinterf.hpp"
#include "DlgCon3D.hpp"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDlgCone3D dialog
CDlgCone3D::CDlgCone3D(Cone3D *pCone3D, CWnd* pParent /*= NULL*/)
:CDialog(CDlgCone3D::IDD, pParent)
{
m_pCone3D = pCone3D;
//{{AFX_DATA_INIT(CDlgCone3D)
m_Edition_Zone_Angle = _T("");
m_Edition_Zone_Radius = _T("");
m_Edition_Zone_X_Base = _T("");
m_Edition_Zone_X_Top = _T("");
m_Edition_Zone_Y_Base = _T("");
m_Edition_Zone_Y_Top = _T("");
m_Edition_Zone_Z_Base = _T("");
m_Edition_Zone_Z_Top = _T("");
//}}AFX_DATA_INIT
}
void CDlgCone3D::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgCone3D)
DDX_Text(pDX, IDC_Edition_Zone_Angle, m_Edition_Zone_Angle);
DDX_Text(pDX, IDC_Edition_Zone_Radius, m_Edition_Zone_Radius);
DDX_Text(pDX, IDC_Edition_Zone_X_Base, m_Edition_Zone_X_Base);
DDX_Text(pDX, IDC_Edition_Zone_X_Top, m_Edition_Zone_X_Top);
DDX_Text(pDX, IDC_Edition_Zone_Y_Base, m_Edition_Zone_Y_Base);
DDX_Text(pDX, IDC_Edition_Zone_Y_Top, m_Edition_Zone_Y_Top);
DDX_Text(pDX, IDC_Edition_Zone_Z_Base, m_Edition_Zone_Z_Base);
DDX_Text(pDX, IDC_Edition_Zone_Z_Top, m_Edition_Zone_Z_Top);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlgCone3D, CDialog)
//{{AFX_MSG_MAP(CDlgCone3D)
ON_EN_CHANGE(IDC_Edition_Zone_Angle, On_Change_Edition_Zone_Angle)
ON_EN_CHANGE(IDC_Edition_Zone_Radius, On_Change_Edition_Zone_Radius)
ON_EN_CHANGE(IDC_Edition_Zone_X_Base, On_Change_Edition_Zone_X_Base)
ON_EN_CHANGE(IDC_Edition_Zone_X_Top, On_Change_Edition_Zone_X_Top)
ON_EN_CHANGE(IDC_Edition_Zone_Y_Base, On_Change_Edition_Zone_Y_Base)
ON_EN_CHANGE(IDC_Edition_Zone_Y_Top, On_Change_Edition_Zone_Y_Top)
ON_EN_CHANGE(IDC_Edition_Zone_Z_Base, On_Change_Edition_Zone_Z_Base)
ON_EN_CHANGE(IDC_Edition_Zone_Z_Top, On_Change_Edition_Zone_Z_Top)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgCone3D - OnInitDialog
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : initialisation of the window
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL CDlgCone3D::OnInitDialog()
{
CDialog::OnInitDialog();
m_InitialTop = m_pCone3D -> GetTopPoint ();
m_InitialBase = m_pCone3D -> GetBasePoint ();
m_InitialRadius = m_pCone3D -> GetRadius ();
m_InitialAngle = m_pCone3D -> GetAngle ();
RefreshData ();
return TRUE;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgCone3D - On_Change_Edition_Zone_X_Base
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : this function is called when the user changes the X coordinate of the base point
// we update the variable
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgCone3D::On_Change_Edition_Zone_X_Base ()
{
UpdateData (TRUE); // Update variables from screen
m_pCone3D -> SetBasePointX ((float) atof (m_Edition_Zone_X_Base));
m_Edition_Zone_Angle . Format ("%.4g" , m_pCone3D -> GetAngle ()); // The angle changes too
UpdateData (FALSE); // Update the screen
RedrawBackground ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgCone3D - On_Change_Edition_Zone_Y_Base
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : this function is called when the user changes the Y coordinate of the base point
// we update the variable
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgCone3D::On_Change_Edition_Zone_Y_Base ()
{
UpdateData (TRUE); // Update variables from screen
m_pCone3D -> SetBasePointY ((float) atof (m_Edition_Zone_Y_Base));
m_Edition_Zone_Angle . Format ("%.4g" , m_pCone3D -> GetAngle ()); // The angle changes too
UpdateData (FALSE); // Update the screen
RedrawBackground ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgCone3D - On_Change_Edition_Zone_Z_Base
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : this function is called when the user changes the Z coordinate of the base point
// we update the variable
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgCone3D::On_Change_Edition_Zone_Z_Base ()
{
UpdateData (TRUE); // Update variables from screen
m_pCone3D -> SetBasePointZ ((float) atof (m_Edition_Zone_Z_Base));
m_Edition_Zone_Angle . Format ("%.4g" , m_pCone3D -> GetAngle ()); // The angle changes too
UpdateData (FALSE); // Update the screen
RedrawBackground ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgCone3D - On_Change_Edition_Zone_X_Top
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : this function is called when the user changes the X coordinate of the top point
// we update the variable
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgCone3D::On_Change_Edition_Zone_X_Top ()
{
UpdateData (TRUE); // Update variables from screen
m_pCone3D -> SetTopPointX ((float) atof (m_Edition_Zone_X_Top));
m_Edition_Zone_Angle . Format ("%.4g" , m_pCone3D -> GetAngle ()); // The angle changes too
UpdateData (FALSE); // Update the screen
RedrawBackground ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgCone3D - On_Change_Edition_Zone_Y_Top
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : this function is called when the user changes the Y coordinate of the top point
// we update the variable
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgCone3D::On_Change_Edition_Zone_Y_Top ()
{
UpdateData (TRUE); // Update variables from screen
m_pCone3D -> SetTopPointY ((float) atof (m_Edition_Zone_Y_Top));
m_Edition_Zone_Angle . Format ("%.4g" , m_pCone3D -> GetAngle ()); // The angle changes too
UpdateData (FALSE); // Update the screen
RedrawBackground ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgCone3D - On_Change_Edition_Zone_Z_Top
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : this function is called when the user changes the Z coordinate of the top point
// we update the variable
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgCone3D::On_Change_Edition_Zone_Z_Top ()
{
UpdateData (TRUE); // Update variables from screen
m_pCone3D -> SetTopPointZ ((float) atof (m_Edition_Zone_Z_Top));
m_Edition_Zone_Angle . Format ("%.4g" , m_pCone3D -> GetAngle ()); // The angle changes too
UpdateData (FALSE); // Update the screen
RedrawBackground ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgCone3D - On_Change_Edition_Zone_Radius
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : this function is called when the user changes the radius of the cone
// we update the variable
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgCone3D::On_Change_Edition_Zone_Radius ()
{
UpdateData (TRUE); // Update variables from screen
float Radius = (float) atof (m_Edition_Zone_Radius);
m_pCone3D -> SetRadius (& Radius);
m_Edition_Zone_Angle . Format ("%.4g" , m_pCone3D -> GetAngle ()); // When one changes the radius, the angle changes too
UpdateData (FALSE); // Update the screen
RedrawBackground ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgCone3D - On_Change_Edition_Zone_Angle
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : this function is called when the user changes the angle of the cone
// we update the variable
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgCone3D::On_Change_Edition_Zone_Angle ()
{
UpdateData (TRUE); // Update variables from screen
float Angle = (float) atof (m_Edition_Zone_Angle);
m_pCone3D -> SetAngle (& Angle);
m_Edition_Zone_Radius . Format ("%.4g" , m_pCone3D -> GetRadius ()); // When one changes the angle, the radius changes too
UpdateData (FALSE); // Update the screen
RedrawBackground ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgCone3D - RefreshData
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : this function is called when the data need to be refreshed (because of a Undo, for instance)
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgCone3D::RefreshData ()
{
// Init the variables on the screen
MTH3D_tdstVector BasePoint = m_pCone3D -> GetBasePoint ();
m_Edition_Zone_X_Base . Format ("%.4g" , BasePoint . xX);
m_Edition_Zone_Y_Base . Format ("%.4g" , BasePoint . xY);
m_Edition_Zone_Z_Base . Format ("%.4g" , BasePoint . xZ);
MTH3D_tdstVector TopPoint = m_pCone3D -> GetTopPoint ();
m_Edition_Zone_X_Top . Format ("%.4g" , TopPoint . xX);
m_Edition_Zone_Y_Top . Format ("%.4g" , TopPoint . xY);
m_Edition_Zone_Z_Top . Format ("%.4g" , TopPoint . xZ);
m_Edition_Zone_Radius . Format ("%.4g" , m_pCone3D -> GetRadius ());
m_Edition_Zone_Angle . Format ("%.4g" , m_pCone3D -> GetAngle ());
UpdateData (FALSE); // Update the screen
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgCone3D - OnCancel
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : set the initial radius value
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgCone3D::OnCancel()
{
m_pCone3D -> SetTopPoint (& m_InitialTop);
m_pCone3D -> SetBasePoint (& m_InitialBase);
m_pCone3D -> SetRadius (& m_InitialRadius);
m_pCone3D -> SetAngle (& m_InitialAngle);
CDialog::OnCancel();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : void CDlgCone3D::RedrawBackground
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : redraws the main view.
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgCone3D::RedrawBackground (void)
{
(((DEV_MultiDevice*)g_oFrameGest.ma_p_oWinArray[2][2]->GetActiveView())->DrawObject());
}

View File

@@ -0,0 +1,185 @@
//ROMTEAM WorldEditor
////////////////////////////////////////////////////////////////////////////////////////
// File : CDlgITBox.cpp: implementation of the CDlgITBox class.
// Author : Ionut Grozea
// Date : 97.11
// Description :
////////////////////////////////////////////////////////////////////////////////////////
#include "DlgITBox.h"
#include "stdafx.h"
#include "ACP_Base.h"
#include "ITF.h"
#include "incGAM.h"
#include "GLI.h"
#include "DPT.h"
#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
#include "OGD.h"
#undef CPA_WANTS_EXPORT
#define CPA_WANTS_IMPORT
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
class ITBox3D;
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : CDlgITBox::CDlgITBox
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : constructor to create a new dialog
// Author : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
CDlgITBox::CDlgITBox(float m_Nx , float m_Ny , float m_Nz , ITBox3D*pBox , CWnd* pParent /*= NULL*/) // standard constructor
: CDialog(CDlgITBox::IDD, pParent)
{
//{{AFX_DATA_INIT(CDlgITBox)
m_fScaleY = 0.0f;
m_fScaleX = 0.0f;
m_fScaleZ = 0.0f;
//}}AFX_DATA_INIT
m_fScaleXOld = m_Nx;
m_fScaleYOld = m_Ny;
m_fScaleZOld = m_Nz;
m_poBox = pBox;
}
void CDlgITBox::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgITBox)
DDX_Control(pDX, IDC_SLIDER5, m_SliderZ);
DDX_Control(pDX, IDC_SLIDER3, m_SliderY);
DDX_Control(pDX, IDC_SLIDER2, m_SliderX);
DDX_Text(pDX, IDC_EDIT3, m_fScaleY);
DDV_MinMaxFloat(pDX, m_fScaleY, 0.f, 10.f);
DDX_Text(pDX, IDC_EDIT2, m_fScaleX);
DDV_MinMaxFloat(pDX, m_fScaleX, 0.f, 10.f);
DDX_Text(pDX, IDC_EDIT4, m_fScaleZ);
DDV_MinMaxFloat(pDX, m_fScaleZ, 0.f, 10.f);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlgITBox, CDialog)
//{{AFX_MSG_MAP(CDlgITBox)
ON_WM_HSCROLL()
ON_EN_CHANGE(IDC_EDIT2, OnChangeEdit2)
ON_EN_CHANGE(IDC_EDIT3, OnChangeEdit3)
ON_EN_CHANGE(IDC_EDIT4, OnChangeEdit4)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlgITBox message handlers
int CDlgITBox::mfn_iGetIntPos(float fVal)
{
return (int) ( fVal* 10);
}
float CDlgITBox::mfn_fSliderInt2Float(int sliderVal)
{
return sliderVal/10.0f;
}
void CDlgITBox::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
CWnd *m_Slider3 , *m_Slider2 , *m_Slider5;
m_Slider2 = GetDlgItem(IDC_SLIDER2);
m_Slider3 = GetDlgItem(IDC_SLIDER3);
m_Slider5 = GetDlgItem(IDC_SLIDER5);
if (m_Slider2 == pScrollBar)
{
m_fScaleX=mfn_fSliderInt2Float(m_SliderX.GetPos());
UpdateData(FALSE);
m_poBox->SetScaleX(m_fScaleX);
}
if (m_Slider3 == pScrollBar)
{
m_fScaleY=mfn_fSliderInt2Float(m_SliderY.GetPos());
UpdateData(FALSE);
m_poBox->SetScaleY(m_fScaleY);
}
if (m_Slider5 == pScrollBar)
{
m_fScaleZ=mfn_fSliderInt2Float(m_SliderZ.GetPos());
UpdateData(FALSE);
m_poBox->SetScaleZ(m_fScaleZ);
}
(((DEV_MultiDevice*)g_oFrameGest.ma_p_oWinArray[2][2]->GetActiveView())->DrawObject());
}
BOOL CDlgITBox::OnInitDialog()
{
CDialog::OnInitDialog();
m_fScaleX = m_poBox->m_fX;
m_fScaleY = m_poBox->m_fY;
m_fScaleZ = m_poBox->m_fZ;
m_SliderX.SetPos(mfn_iGetIntPos(m_poBox->m_fX));
m_SliderY.SetPos(mfn_iGetIntPos(m_poBox->m_fY));
m_SliderZ.SetPos(mfn_iGetIntPos(m_poBox->m_fZ));
UpdateData(FALSE);
return TRUE;
}
void CDlgITBox::OnChangeEdit2()
{
UpdateData();
m_SliderX.SetPos(mfn_iGetIntPos(m_fScaleX));
m_poBox->SetScaleX(m_fScaleX);
(((DEV_MultiDevice*)g_oFrameGest.ma_p_oWinArray[2][2]->GetActiveView())->DrawObject());
}
void CDlgITBox::OnChangeEdit3()
{
UpdateData();
m_SliderY.SetPos(mfn_iGetIntPos(m_fScaleY));
m_poBox->SetScaleY(m_fScaleY);
(((DEV_MultiDevice*)g_oFrameGest.ma_p_oWinArray[2][2]->GetActiveView())->DrawObject());
}
void CDlgITBox::OnChangeEdit4()
{
UpdateData();
m_SliderZ.SetPos(mfn_iGetIntPos(m_fScaleZ));
m_poBox->SetScaleZ(m_fScaleZ);
(((DEV_MultiDevice*)g_oFrameGest.ma_p_oWinArray[2][2]->GetActiveView())->DrawObject());
}
void CDlgITBox::OnCancel()
{
m_fScaleX=m_fScaleXOld;
m_fScaleY=m_fScaleYOld;
m_fScaleZ=m_fScaleZOld;
m_poBox->SetScaleX(m_fScaleX);
m_poBox->SetScaleY(m_fScaleY);
m_poBox->SetScaleZ(m_fScaleZ);
CDialog::OnCancel();
}

View File

@@ -0,0 +1,205 @@
//ROMTEAM WorldEditor
////////////////////////////////////////////////////////////////////////////////////////
// File : ITcon3D.cpp: implementation of the DlgITCone class.
// Author : Ionut Grozea
// Date : 97.11
// Description :
////////////////////////////////////////////////////////////////////////////////////////
#include "DlgITCone.h"
#include "stdafx.h"
#include "ACP_Base.h"
#include "ITF.h"
#include "incGAM.h"
#include "GLI.h"
#include "DPT.h"
#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
#include "OGD.h"
#undef CPA_WANTS_EXPORT
#define CPA_WANTS_IMPORT
class ITCon3D;
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : DlgITCone::DlgITCone
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : constructor to create a new dialog
// Author : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
DlgITCone::DlgITCone(ITCon3D * pCon , float Radius , float Height ,int Nt , int Ns , CWnd* pParent /*=NULL*/)
: CDialog(DlgITCone::IDD, pParent)
{
m_poCon = pCon;
m_fHeightOld = Height;
m_fRadiusOld = Radius;
m_iNxOld = Nt;
m_iNyOld = Ns;
//{{AFX_DATA_INIT(DlgITCone)
m_fHeight = Height;
m_fRadius = Radius;
m_iNx = Nt;
m_iNy = Ns;
//}}AFX_DATA_INIT
}
void DlgITCone::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(DlgITCone)
DDX_Control(pDX, IDC_SLIDERY, m_SliderY);
DDX_Control(pDX, IDC_SLIDERX, m_SliderX);
DDX_Control(pDX, IDC_SLIDERRADIUS, m_fSliderRadius);
DDX_Control(pDX, IDC_SLIDERHEIGHT, m_fSliderHeight);
DDX_Text(pDX, IDC_EDITHEIGHT, m_fHeight);
DDX_Text(pDX, IDC_EDITRADIUS, m_fRadius);
DDX_Text(pDX, IDC_EDITX, m_iNx);
DDV_MinMaxInt(pDX, m_iNx, 3, 20);
DDX_Text(pDX, IDC_EDITY, m_iNy);
DDV_MinMaxInt(pDX, m_iNy, 3, 20);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(DlgITCone, CDialog)
//{{AFX_MSG_MAP(DlgITCone)
ON_WM_HSCROLL()
ON_EN_CHANGE(IDC_EDITHEIGHT, OnChangeEditheight)
ON_EN_CHANGE(IDC_EDITRADIUS, OnChangeEditradius)
ON_EN_CHANGE(IDC_EDITX, OnChangeEditx)
ON_EN_CHANGE(IDC_EDITY, OnChangeEdity)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// DlgITCone message handlers
void DlgITCone::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
CWnd *m_Slider1 , *m_Slider2 ,*m_Slider3 , *m_Slider4 ;
m_Slider1 = GetDlgItem(IDC_SLIDERRADIUS);
m_Slider2 = GetDlgItem(IDC_SLIDERHEIGHT);
m_Slider3 = GetDlgItem(IDC_SLIDERX);
m_Slider4 = GetDlgItem(IDC_SLIDERY);
if (m_Slider1 == pScrollBar)
{
m_fRadius=mfn_fSliderInt2Float(m_fSliderRadius.GetPos());
UpdateData(FALSE);
m_poCon->SetRadius(m_fRadius);
}
if (m_Slider2 == pScrollBar)
{
m_fHeight=mfn_fSliderInt2Float(m_fSliderHeight.GetPos());
UpdateData(FALSE);
m_poCon->SetHeight(m_fHeight);
}
if (m_Slider3 == pScrollBar)
{
m_iNx= m_SliderX.GetPos();
UpdateData(FALSE);
m_poCon->SetSamplingRate(m_iNx , m_iNy);
}
if (m_Slider4 == pScrollBar)
{
m_iNy= m_SliderY.GetPos();
UpdateData(FALSE);
m_poCon->SetSamplingRate(m_iNx , m_iNy+1);
}
(((DEV_MultiDevice*)g_oFrameGest.ma_p_oWinArray[2][2]->GetActiveView())->DrawObject());
}
int DlgITCone::mfn_iGetIntPos(float fVal)
{
return (int) ( fVal* 10);
}
float DlgITCone::mfn_fSliderInt2Float(int sliderVal)
{
return sliderVal/10.0f;
}
BOOL DlgITCone::OnInitDialog()
{
CDialog::OnInitDialog();
m_SliderX.SetRange(4,20);
m_SliderY.SetRange(3,20);
m_fSliderRadius.SetPos(mfn_iGetIntPos(m_fRadius));
m_fSliderHeight.SetPos(mfn_iGetIntPos(m_fHeight));
m_SliderX.SetPos(m_iNx);
m_SliderY.SetPos(m_iNy);
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void DlgITCone::OnChangeEditheight()
{
UpdateData();
m_fSliderHeight.SetPos(mfn_iGetIntPos(m_fHeight));
m_poCon->SetHeight(m_fHeight);
(((DEV_MultiDevice*)g_oFrameGest.ma_p_oWinArray[2][2]->GetActiveView())->DrawObject());
}
void DlgITCone::OnChangeEditradius()
{
UpdateData();
m_fSliderRadius.SetPos(mfn_iGetIntPos(m_fRadius));
m_poCon->SetRadius(m_fRadius);
(((DEV_MultiDevice*)g_oFrameGest.ma_p_oWinArray[2][2]->GetActiveView())->DrawObject());
}
void DlgITCone::OnChangeEditx()
{
UpdateData();
m_SliderX.SetPos(m_iNx);
m_poCon->SetSamplingRate(m_iNx , m_iNy);
(((DEV_MultiDevice*)g_oFrameGest.ma_p_oWinArray[2][2]->GetActiveView())->DrawObject());
}
void DlgITCone::OnChangeEdity()
{
UpdateData();
m_SliderY.SetPos(m_iNy);
m_poCon->SetSamplingRate(m_iNx , m_iNy+1);
(((DEV_MultiDevice*)g_oFrameGest.ma_p_oWinArray[2][2]->GetActiveView())->DrawObject());
}
void DlgITCone::OnCancel()
{
m_iNx = m_iNxOld;
m_iNy = m_iNyOld;
m_fRadius = m_fRadiusOld;
m_fHeight= m_fHeightOld;
m_poCon->SetSamplingRate(m_iNx , m_iNy);
m_poCon->SetRadius(m_fRadius);
m_poCon->SetHeight(m_fHeight);
CDialog::OnCancel();
CDialog::OnCancel();
}

View File

@@ -0,0 +1,174 @@
//ROMTEAM WorldEditor
////////////////////////////////////////////////////////////////////////////////////////
// File : DlgPoint3D.cpp : implementation file
// Author : Cristi Petrescu
// Date : 97.11
// Description :
////////////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ACP_Base.h"
#include "incITF.h"
#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
#include "OGD.h"
#undef CPA_WANTS_EXPORT
#define CPA_WANTS_IMPORT
#include "3Dinterf.hpp"
#include "DlgPnt3D.hpp"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDlgPoint3D dialog
CDlgPoint3D::CDlgPoint3D(Point3D *pPoint3D, CWnd* pParent /*=NULL*/)
: CDialog(CDlgPoint3D::IDD, pParent)
{
m_pPoint3D = pPoint3D;
//{{AFX_DATA_INIT(CDlgPoint3D)
m_Edition_Zone_X = _T("");
m_Edition_Zone_Y = _T("");
m_Edition_Zone_Z = _T("");
//}}AFX_DATA_INIT
}
void CDlgPoint3D::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgPoint3D)
DDX_Text(pDX, IDC_Edition_Zone_X, m_Edition_Zone_X);
DDX_Text(pDX, IDC_Edition_Zone_Y, m_Edition_Zone_Y);
DDX_Text(pDX, IDC_Edition_Zone_Z, m_Edition_Zone_Z);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlgPoint3D, CDialog)
//{{AFX_MSG_MAP(CDlgPoint3D)
ON_EN_CHANGE(IDC_Edition_Zone_X, On_Change_Edition_Zone_X)
ON_EN_CHANGE(IDC_Edition_Zone_Y, On_Change_Edition_Zone_Y)
ON_EN_CHANGE(IDC_Edition_Zone_Z, On_Change_Edition_Zone_Z)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgPoint3D - OnInitDialog
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : initialisation of the window
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL CDlgPoint3D::OnInitDialog()
{
CDialog::OnInitDialog();
RefreshData (); // Init the variables
return TRUE;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgPoint3D - On_Change_Edition_Zone_X
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : this function is called when the user changes the X coordinate of the point
// we update the variable
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgPoint3D::On_Change_Edition_Zone_X ()
{
UpdateData (TRUE); // Update variables from screen
m_pPoint3D -> SetPointX ((float) atof (m_Edition_Zone_X));
RedrawBackground ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgPoint3D - On_Change_Edition_Zone_Y
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : this function is called when the user changes the Y coordinate of the point
// we update the variable
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgPoint3D::On_Change_Edition_Zone_Y ()
{
UpdateData (TRUE); // Update variables from screen
m_pPoint3D -> SetPointY ((float) atof (m_Edition_Zone_Y));
RedrawBackground ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgPoint3D - On_Change_Edition_Zone_Z
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : this function is called when the user changes the Z coordinate of the point
// we update the variable
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgPoint3D::On_Change_Edition_Zone_Z ()
{
UpdateData (TRUE); // Update variables from screen
m_pPoint3D -> SetPointZ ((float) atof (m_Edition_Zone_Z));
RedrawBackground ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgPoint3D - RefreshData
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : this function is called when the data need to be refreshed (because of a Undo, for instance)
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgPoint3D::RefreshData ()
{
// Init the variables on the screen
MTH3D_tdstVector Point = m_pPoint3D -> GetPoint ();
m_Edition_Zone_X . Format ("%.4g" , Point . xX);
m_Edition_Zone_Y . Format ("%.4g" , Point . xY);
m_Edition_Zone_Z . Format ("%.4g" , Point . xZ);
UpdateData (FALSE); // Update the screen
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : void CDlgCone3D::RedrawBackground
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : redraws the main view.
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgPoint3D::RedrawBackground (void)
{
(((DEV_MultiDevice*)g_oFrameGest.ma_p_oWinArray[2][2]->GetActiveView())->DrawObject());
}

View File

@@ -0,0 +1,301 @@
//ROMTEAM WorldEditor
////////////////////////////////////////////////////////////////////////////////////////
// File : DlgSphere3D.cpp : implementation file
// Author : Cristi Petrescu
// Date : 97.11
// Description :
////////////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ACP_Base.h"
#include "incITF.h"
#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
#include "OGD.h"
#undef CPA_WANTS_EXPORT
#ifndef CPA_WANTS_IMPORT
#define CPA_WANTS_IMPORT
#endif
#include "3Dinterf.hpp"
#include "DlgSph3D.hpp"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDlgSphere3D dialog
CDlgSphere3D::CDlgSphere3D(Sphere3D *pSphere, CWnd* pParent /*=NULL*/)
: CDialog(CDlgSphere3D::IDD, pParent)
{
m_pSphere3D = pSphere;
//{{AFX_DATA_INIT(CDlgSphere3D)
m_Center_X = _T("");
m_Center_Y = _T("");
m_Center_Z = _T("");
m_Radius = _T("");
//}}AFX_DATA_INIT
}
void CDlgSphere3D::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgSphere3D)
DDX_Control(pDX, IDC_SLIDER_RADIUS, m_Slider_Radius);
DDX_Text(pDX, IDC_EDIT_CENTER_X, m_Center_X);
DDX_Text(pDX, IDC_EDIT_CENTER_Y, m_Center_Y);
DDX_Text(pDX, IDC_EDIT_CENTER_Z, m_Center_Z);
DDX_Text(pDX, IDC_EDIT_RADIUS, m_Radius);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlgSphere3D, CDialog)
//{{AFX_MSG_MAP(CDlgSphere3D)
ON_EN_CHANGE(IDC_EDIT_RADIUS, OnChangeEditRadius)
ON_EN_CHANGE(IDC_EDIT_CENTER_X, OnChangeEditCenterX)
ON_EN_CHANGE(IDC_EDIT_CENTER_Y, OnChangeEditCenterY)
ON_EN_CHANGE(IDC_EDIT_CENTER_Z, OnChangeEditCenterZ)
ON_WM_HSCROLL()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlgSphere3D message handlers
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgSphere3D - OnCancel
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : set the initial radius value
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgSphere3D::OnCancel()
{
// TODO: Add extra cleanup here
m_pSphere3D -> SetRadius (& m_InitialRadius);
m_pSphere3D -> SetCenter (& m_InitialCenter);
CDialog::OnCancel();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgSphere3D - RefreshSlider
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Refresh the position of the slider
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgSphere3D::RefreshSlider ()
{
m_Slider_Radius . SetOwner (this);
m_Slider_Radius . SetRange (0 , 150 , TRUE);
m_Slider_Radius . SetPos ((long) (m_pSphere3D -> GetRadius () * 100));
m_Slider_Radius . SetTicFreq (50);
UpdateData (FALSE);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgSphere3D - RefreshRadiusFromSlider
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Refresh the radius of the sphere when the position of the slider has changed
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgSphere3D::RefreshRadiusFromSlider ()
{
UpdateData (TRUE);
MTH_tdxReal NewRadius = (float) (m_Slider_Radius . GetPos () / 100.0);
m_pSphere3D -> SetRadius (& NewRadius);
m_Radius . Format ("%.4g" , NewRadius);
UpdateData (FALSE);
RedrawBackground ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgSphere3D - RefreshData
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : this function is called when the data need to be refreshed
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgSphere3D::RefreshData ()
{
// Init the variables on the screen
MTH3D_tdstVector Center = m_pSphere3D -> GetCenter ();
m_Center_X . Format ("%.4g" , Center . xX);
m_Center_Y . Format ("%.4g" , Center . xY);
m_Center_Z . Format ("%.4g" , Center . xZ);
m_Radius . Format ("%.4g" , m_pSphere3D -> GetRadius ());
RefreshSlider ();
UpdateData (FALSE); // Update the screen
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : CDlgSphere3D::RedrawBackground
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : redraw the main view
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgSphere3D::RedrawBackground (void)
{
(((DEV_MultiDevice*)g_oFrameGest.ma_p_oWinArray[2][2]->GetActiveView())->DrawObject());
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgSphere3D - OnInitDialog
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : this function is called when the dialog is created
// we get the initial values
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL CDlgSphere3D::OnInitDialog()
{
CDialog::OnInitDialog();
m_InitialRadius = m_pSphere3D -> GetRadius ();
m_InitialCenter = m_pSphere3D -> GetCenter ();
RefreshData ();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgSphere3D - OnChangeEditCenterX
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : this function is called when the user changes the X coordinate of the center
// we update the variable
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgSphere3D::OnChangeEditCenterX ()
{
UpdateData (TRUE); // Update variables from screen
m_pSphere3D -> SetCenterX ((float) atof (m_Center_X));
RedrawBackground ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgSphere3D - OnChangeEditCenterY
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : this function is called when the user changes the Y coordinate of the center
// we update the variable
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgSphere3D::OnChangeEditCenterY ()
{
UpdateData (TRUE); // Update variables from screen
m_pSphere3D -> SetCenterY ((float) atof (m_Center_Y));
RedrawBackground ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgSphere3D - OnChangeEditCenterZ
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : this function is called when the user changes the Z coordinate of the center
// we update the variable
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgSphere3D::OnChangeEditCenterZ ()
{
UpdateData (TRUE); // Update variables from screen
m_pSphere3D -> SetCenterZ ((float) atof (m_Center_Z));
RedrawBackground ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgSphere3D - OnChangeEditCenterZ
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : this function is called when the user changes the Z coordinate of the center
// we update the variable
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgSphere3D::OnChangeEditRadius ()
{
UpdateData (TRUE); // Update variables from screen
GLI_tdxValue Radius = (float) atof (m_Radius);
m_pSphere3D -> SetRadius (& Radius);
RedrawBackground ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :CDlgSphere3D - OnHScroll
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Call when the slider is changed
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgSphere3D::OnHScroll(UINT nSBCode , UINT nPos , CScrollBar * pScrollBar)
{
if (pScrollBar == (void *) & m_Slider_Radius)
RefreshRadiusFromSlider ();
else
CDialog::OnHScroll (nSBCode , nPos , pScrollBar);
}

View File

@@ -0,0 +1,454 @@
////////////////////////////////////////////////////////////////////////////////////////
// File : DlgAlt3D.cpp : implementation file
// Author : Cristi Petrescu
// Date : 98.02
// Description :
////////////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ACP_Base.h"
#include "incITF.h"
#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
#include "OGD.h"
#undef CPA_WANTS_EXPORT
#ifndef CPA_WANTS_IMPORT
#define CPA_WANTS_IMPORT
#endif
#include "3Dinterf.hpp"
#include "DlgAlt3D.hpp"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDlgAltimap3D dialog
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : CDlgAltimap3D::CDlgAltimap3D
// Date : 98.03
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Constuctor for the dialog
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
CDlgAltimap3D::CDlgAltimap3D(Altimap3D *pAltimap3D,CWnd* pParent /*=NULL*/)
: CDialog(CDlgAltimap3D::IDD, pParent)
{
m_pAltimap3D = pAltimap3D;
m_bSquareOrientation = FALSE;
m_bSetLeft = FALSE;
m_bSetRight = FALSE;
//{{AFX_DATA_INIT(CDlgAltimap3D)
m_iNbY = 0;
m_SizeX = 0.0f;
m_SizeY = 0.0f;
m_iNbX = 0;
//}}AFX_DATA_INIT
}
void CDlgAltimap3D::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgAltimap3D)
DDX_Control(pDX, IDC_SET_ORIENTATION, m_btnSquareOrientation);
DDX_Control(pDX, IDC_SET_LEFT, m_btnSetLeft);
DDX_Control(pDX, IDC_SET_RIGHT, m_btnSetRight);
DDX_Control(pDX, IDC_SLIDER_SIZEY, m_Slider_SizeY);
DDX_Control(pDX, IDC_SLIDER_SIZEX, m_Slider_SizeX);
DDX_Control(pDX, IDC_SLIDER_NBY, m_Slider_NbY);
DDX_Control(pDX, IDC_SLIDER_NBX, m_Slider_NbX);
DDX_Text(pDX, IDC_NBY, m_iNbY);
DDV_MinMaxInt(pDX, m_iNbY, 2, 50);
DDX_Text(pDX, IDC_SIZEX, m_SizeX);
DDV_MinMaxFloat(pDX, m_SizeX, 1.e-002f, 15.f);
DDX_Text(pDX, IDC_SIZEY, m_SizeY);
DDV_MinMaxFloat(pDX, m_SizeY, 1.e-002f, 15.f);
DDX_Text(pDX, IDC_NBX, m_iNbX);
DDV_MinMaxInt(pDX, m_iNbX, 2, 50);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlgAltimap3D, CDialog)
//{{AFX_MSG_MAP(CDlgAltimap3D)
ON_WM_HSCROLL()
ON_EN_KILLFOCUS(IDC_NBX, OnKillfocusNbx)
ON_EN_KILLFOCUS(IDC_NBY, OnKillfocusNby)
ON_EN_KILLFOCUS(IDC_SIZEX, OnKillfocusSizex)
ON_EN_KILLFOCUS(IDC_SIZEY, OnKillfocusSizey)
ON_BN_CLICKED(IDC_SET_ORIENTATION, OnSetOrientation)
ON_BN_CLICKED(IDC_SET_LEFT, OnSetLeft)
ON_BN_CLICKED(IDC_SET_RIGHT, OnSetRight)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlgAltimap3D message handlers
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : CDlgAltimap3D::OnInitDialog
// Date : 98.03
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Initialize the dialog
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL CDlgAltimap3D::OnInitDialog()
{
CDialog::OnInitDialog();
m_iNbX = m_pAltimap3D -> GetWidth ();
m_iNbY = m_pAltimap3D -> GetDepth ();
m_SizeX = m_pAltimap3D -> GetSquareDimX () * m_iNbX;
m_SizeY = m_pAltimap3D -> GetSquareDimY () * m_iNbY;
RefreshSquare ();
RefreshData ();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : CDlgAltimap3D::OnKillfocusNbx
// Date : 98.03
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : accept the nbx change
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgAltimap3D::OnKillfocusNbx()
{
UpdateData (TRUE);
RefreshData ();
m_pAltimap3D -> SetWidth (m_iNbX);
m_pAltimap3D -> SetSquareDimX (m_SizeX / m_iNbX);
M_GetMainDevice3D () -> DrawObject ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : CDlgAltimap3D::OnKillfocusNby
// Date : 98.03
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : accept the nby change
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgAltimap3D::OnKillfocusNby()
{
UpdateData (TRUE);
RefreshData ();
m_pAltimap3D -> SetDepth (m_iNbY);
m_pAltimap3D -> SetSquareDimY (m_SizeY / m_iNbY);
M_GetMainDevice3D () -> DrawObject ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : CDlgAltimap3D::OnKillfocusSizex
// Date : 98.03
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : accept the sizex change
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgAltimap3D::OnKillfocusSizex()
{
UpdateData (TRUE);
RefreshData ();
m_pAltimap3D -> SetSquareDimX (m_SizeX / m_iNbX);
M_GetMainDevice3D () -> DrawObject ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : CDlgAltimap3D::OnKillfocusSizey
// Date : 98.03
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : accept the sizey change
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgAltimap3D::OnKillfocusSizey()
{
UpdateData (TRUE);
RefreshData ();
m_pAltimap3D -> SetSquareDimY (m_SizeY / m_iNbY);
M_GetMainDevice3D () -> DrawObject ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : CDlgAltimap3D::OnHScroll
// Date : 98.03
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Handle the scrollbars usage
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgAltimap3D::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
if (pScrollBar == (void *) & m_Slider_NbX)
{
UpdateData (TRUE);
m_iNbX = m_Slider_NbX . GetPos ();
UpdateData (FALSE);
m_pAltimap3D -> SetWidth (m_iNbX);
m_pAltimap3D -> SetSquareDimX (m_SizeX / m_iNbX);
M_GetMainDevice3D () -> DrawObject ();
}
else if (pScrollBar == (void *) & m_Slider_NbY)
{
UpdateData (TRUE);
m_iNbY = m_Slider_NbY . GetPos ();
UpdateData (FALSE);
m_pAltimap3D -> SetDepth (m_iNbY);
m_pAltimap3D -> SetSquareDimY (m_SizeY / m_iNbY);
M_GetMainDevice3D () -> DrawObject ();
}
else if (pScrollBar == (void *) & m_Slider_SizeX)
{
UpdateData (TRUE);
m_SizeX = (float) (m_Slider_SizeX . GetPos ()) / 100;
UpdateData (FALSE);
m_pAltimap3D -> SetSquareDimX (m_SizeX / m_iNbX);
M_GetMainDevice3D () -> DrawObject ();
}
else if (pScrollBar == (void *) & m_Slider_SizeY)
{
UpdateData (TRUE);
m_SizeY = (float) (m_Slider_SizeY . GetPos ()) / 100;
UpdateData (FALSE);
m_pAltimap3D -> SetSquareDimY (m_SizeY / m_iNbY);
M_GetMainDevice3D () -> DrawObject ();
}
else
CDialog::OnHScroll (nSBCode , nPos , pScrollBar);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : CDlgAltimap3D::RefreshData
// Date : 98.03
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : sets the fields and the corresponding scrollbars from the member variables
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgAltimap3D::RefreshData()
{
m_Slider_NbX . SetOwner (this);
m_Slider_NbX . SetRange (2 , 50 , TRUE);
m_Slider_NbX . SetPos (m_iNbX);
m_Slider_NbX . SetTicFreq (1);
m_Slider_NbY . SetOwner (this);
m_Slider_NbY . SetRange (2 , 50 , TRUE);
m_Slider_NbY . SetPos (m_iNbY);
m_Slider_NbY . SetTicFreq (1);
m_Slider_SizeX . SetOwner (this);
m_Slider_SizeX . SetRange (1 , 1500 , TRUE);
m_Slider_SizeX . SetPos ((int) (m_SizeX * 100));
m_Slider_SizeX . SetTicFreq (50);
m_Slider_SizeY . SetOwner (this);
m_Slider_SizeY . SetRange (1 , 1500 , TRUE);
m_Slider_SizeY . SetPos ((int) (m_SizeY * 100));
m_Slider_SizeY . SetTicFreq (50);
UpdateData (FALSE);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : CDlgAltimap3D::OnSetOrientation
// Date : 98.03
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Square shape button pressed
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgAltimap3D::OnSetOrientation()
{
m_bSquareOrientation = !m_bSquareOrientation;
RefreshSquare ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : CDlgAltimap3D::OnSetLeft
// Date : 98.03
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : left triangle of the square pressed
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgAltimap3D::OnSetLeft()
{
m_bSetLeft = !m_bSetLeft;
RefreshSquare ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : CDlgAltimap3D::OnSetRight
// Date : 98.03
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : right triangle of the square pressed
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgAltimap3D::OnSetRight()
{
m_bSetRight = !m_bSetRight;
RefreshSquare ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : CDlgAltimap3D::RefreshSquare
// Date : 98.03
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : draw the three square buttons
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgAltimap3D::RefreshSquare (void)
{
m_ucSquareType = 0;
if (m_bSquareOrientation)
{
if (m_bSetLeft)
{
m_ucSquareType |= 2;
// draw the left button, confusing names!
m_btnSetLeft . LoadBitmaps (IDB_LEFT_CLEAR_BOTTOM);
}
else
{
// draw the left button
m_btnSetLeft . LoadBitmaps (IDB_LEFT_SET_BOTTOM);
}
if (m_bSetRight)
{
m_ucSquareType |= 1;
// draw the right button
m_btnSetRight . LoadBitmaps (IDB_RIGHT_CLEAR_BOTTOM);
}
else
{
// draw the right button
m_btnSetRight . LoadBitmaps (IDB_RIGHT_SET_BOTTOM);
}
}
else
{
if (m_bSetLeft)
{
m_ucSquareType |= 4;
// draw the left button
m_btnSetLeft . LoadBitmaps (IDB_LEFT_CLEAR_TOP);
}
else
{
// draw the left button
m_btnSetLeft . LoadBitmaps (IDB_LEFT_SET_TOP);
}
if (m_bSetRight)
{
m_ucSquareType |= 8;
// draw the right button
m_btnSetRight . LoadBitmaps (IDB_RIGHT_CLEAR_TOP);
}
else
{
// draw the right button
m_btnSetRight . LoadBitmaps (IDB_RIGHT_SET_TOP);
}
}
// draw the main button
UINT uiBitmapID = 0;
switch (m_ucSquareType)
{
case 0:
uiBitmapID = IDB_SQUARE_00;
break;
case 1:
uiBitmapID = IDB_SQUARE_01;
break;
case 2:
uiBitmapID = IDB_SQUARE_02;
break;
case 3:
uiBitmapID = IDB_SQUARE_03;
break;
case 4:
uiBitmapID = IDB_SQUARE_04;
break;
case 8:
uiBitmapID = IDB_SQUARE_08;
break;
case 12:
uiBitmapID = IDB_SQUARE_12;
break;
default:
ASSERT (FALSE);
}
m_btnSquareOrientation . LoadBitmaps (uiBitmapID);
m_btnSetLeft . SizeToContent ();
m_btnSetRight . SizeToContent ();
m_btnSquareOrientation . SizeToContent ();
m_btnSetLeft . RedrawWindow ();
m_btnSetRight . RedrawWindow ();
m_btnSquareOrientation . RedrawWindow ();
//m_pAltimap3D -> SetSelectedAltimapSquare (m_ucSquareType);
}

View File

@@ -0,0 +1,218 @@
//ROMTEAM WorldEditor
////////////////////////////////////////////////////////////////////////////////////////
// File : CDlgITSphere.cpp: implementation of the CDlgITSphere class.
// Author : Ionut Grozea
// Date : 97.11
// Description :
////////////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ACP_Base.h"
#include "ITF.h"
#include "incGAM.h"
#include "GLI.h"
#include "DPT.h"
#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
#include "OGD.h"
#undef CPA_WANTS_EXPORT
#define CPA_WANTS_IMPORT
#include "3dinterf.hpp"
#include "DlgITSphere.h"
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : CDlgITSphere::CDlgITSphere
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : constructor to create a new dialog
// Author : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
CDlgITSphere::CDlgITSphere(float radius,int m_Ns,int m_Nt , ITSphere3D*pSphere, CWnd* pParent /*=NULL*/)
: CDialog(CDlgITSphere::IDD, pParent)
{
//{{AFX_DATA_INIT(CDlgITSphere)
m_fRadius = 0.0f;
m_Nx = 0;
m_Ny = 0;
//}}AFX_DATA_INIT
m_Nx = m_Ns;
m_Ny = m_Nt;
m_fRadius = radius;
m_NxOld = m_Ns;
m_NyOld = m_Nt;
m_fRadiusOld = radius;
m_poSphere=pSphere;
}
void CDlgITSphere::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgITSphere)
//}}AFX_DATA_MAP
if (!pDX->m_bSaveAndValidate)
{
mfn_poGetSlider1()->SetPos(mfn_iGetIntPos(m_fRadius));
mfn_poGetSlider2()->SetPos(m_Nx);
mfn_poGetSlider3()->SetPos(m_Ny);
}
if (!pDX->m_bSaveAndValidate)
{
DDX_Text(pDX, IDC_EDIT1, m_fRadius);
DDX_Text(pDX, IDC_EDIT2, m_Nx);
DDX_Text(pDX, IDC_EDIT3, m_Ny);
}
else
{
CString csText1;
GetDlgItem(IDC_EDIT1)->GetWindowText(csText1);
m_fRadius=(float)atof(csText1);
CString csText2;
GetDlgItem(IDC_EDIT2)->GetWindowText(csText2);
m_Nx= atoi(csText2);
CString csText3;
GetDlgItem(IDC_EDIT3)->GetWindowText(csText3);
m_Ny= atoi(csText3);
}
DDV_MinMaxFloat(pDX, m_fRadius, 0.f, 10.f);
//show the effect
}
BEGIN_MESSAGE_MAP(CDlgITSphere, CDialog)
//{{AFX_MSG_MAP(CDlgITSphere)
ON_EN_CHANGE(IDC_EDIT1, OnChangeEdit1)
ON_WM_HSCROLL()
ON_EN_CHANGE(IDC_EDIT2, OnChangeEdit2)
ON_EN_CHANGE(IDC_EDIT3, OnChangeEdit3)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlgITSphere message handlers
BOOL CDlgITSphere::OnInitDialog()
{
mfn_poGetSlider1()->SetRange(0,100);
mfn_poGetSlider2()->SetRange(4,20);
mfn_poGetSlider3()->SetRange(4,20);
CDialog::OnInitDialog();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
int CDlgITSphere::mfn_iGetIntPos(float radius)
{
return (int) ( radius * 10);
}
float CDlgITSphere::mfn_fSliderInt2Float(int sliderVal)
{
return sliderVal/10.0f;
}
CSliderCtrl* CDlgITSphere::mfn_poGetSlider1()
{
return (CSliderCtrl* )GetDlgItem(IDC_SLIDER1);
}
CSliderCtrl* CDlgITSphere::mfn_poGetSlider2()
{
return (CSliderCtrl* )GetDlgItem(IDC_SLIDER2);
}
CSliderCtrl* CDlgITSphere::mfn_poGetSlider3()
{
return (CSliderCtrl* )GetDlgItem(IDC_SLIDER3);
}
void CDlgITSphere::OnChangeEdit1()
{
UpdateData();
mfn_poGetSlider1()->SetPos(mfn_iGetIntPos(m_fRadius));
m_poSphere->SetRadius(m_fRadius);
(((DEV_MultiDevice*)g_oFrameGest.ma_p_oWinArray[2][2]->GetActiveView())->DrawObject());
}
void CDlgITSphere::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
CWnd *m_Slider1 ,*m_Slider3 , *m_Slider2;
m_Slider1 = GetDlgItem(IDC_SLIDER1);
m_Slider2 = GetDlgItem(IDC_SLIDER2);
m_Slider3 = GetDlgItem(IDC_SLIDER3);
if (m_Slider1 == pScrollBar)
{
m_fRadius=mfn_fSliderInt2Float(mfn_poGetSlider1()->GetPos());
if ( !m_fRadius) m_fRadius+=0.1f;
UpdateData(FALSE);
m_poSphere->SetRadius(m_fRadius);
}
if (m_Slider2 == pScrollBar)
{
m_Nx= (mfn_poGetSlider2()->GetPos());
UpdateData(FALSE);
m_poSphere->SetSamplingRate(m_Nx,m_Ny);
}
if (m_Slider3 == pScrollBar)
{
m_Ny= (mfn_poGetSlider3()->GetPos());
UpdateData(FALSE);
m_poSphere->SetSamplingRate(m_Nx,m_Ny);
}
(((DEV_MultiDevice*)g_oFrameGest.ma_p_oWinArray[2][2]->GetActiveView())->DrawObject());
}
void CDlgITSphere::OnChangeEdit2()
{
UpdateData();
mfn_poGetSlider2()->SetPos(m_Nx);
m_poSphere->SetSamplingRate(m_Nx,m_Ny);
(((DEV_MultiDevice*)g_oFrameGest.ma_p_oWinArray[2][2]->GetActiveView())->DrawObject());
}
void CDlgITSphere::OnChangeEdit3()
{
UpdateData();
mfn_poGetSlider3()->SetPos(m_Ny);
m_poSphere->SetSamplingRate(m_Nx,m_Ny);
(((DEV_MultiDevice*)g_oFrameGest.ma_p_oWinArray[2][2]->GetActiveView())->DrawObject());
}
void CDlgITSphere::OnCancel()
{
m_Nx = m_NxOld;
m_Ny = m_NyOld;
m_fRadius = m_fRadiusOld;
m_poSphere->SetSamplingRate(m_Nx,m_Ny);
m_poSphere->SetRadius(m_fRadius);
CDialog::OnCancel();
}

View File

@@ -0,0 +1,118 @@
//ROMTEAM WorldEditor
////////////////////////////////////////////////////////////////////////////////////////
// File : DlgObject.cpp: implementation of the CDlgObject class.
// Author : Ionut Grozea
// Date : 97.11
// Description :
////////////////////////////////////////////////////////////////////////////////////////
#ifndef __DLGOBJECT_HPP__
#define __DLGOBJECT_HPP__
#ifdef ACTIVE_EDITOR
#include "DlgObject.h"
#include "stdafx.h"
#include "ACP_Base.h"
#include "ITF.h"
#include "incGAM.h"
#include "GLI.h"
#include "DPT.h"
#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
#include "OGD.h"
#undef CPA_WANTS_EXPORT
#define CPA_WANTS_IMPORT
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : CDlgObject::CDlgObject
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : constructor to create a new dialog
// Author : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
CDlgObject::CDlgObject(ITObject3D * p_ITObject ,CWnd* pParent /*=NULL*/)
: CDialog(CDlgObject::IDD, pParent)
{
m_pITObject = p_ITObject;
//{{AFX_DATA_INIT(CDlgObject)
m_fscaleX = 0.0f;
m_fscaleY = 0.0f;
m_fscaleZ = 0.0f;
//}}AFX_DATA_INIT
}
void CDlgObject::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgObject)
DDX_Text(pDX, IDC_EDITSCALEX, m_fscaleX);
DDX_Text(pDX, IDC_EDITSCALEY, m_fscaleY);
DDX_Text(pDX, IDC_EDITSCALEZ, m_fscaleZ);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlgObject, CDialog)
//{{AFX_MSG_MAP(CDlgObject)
ON_EN_CHANGE(IDC_EDITSCALEX, OnChangeEditscalex)
ON_EN_CHANGE(IDC_EDITSCALEY, OnChangeEditscaley)
ON_EN_CHANGE(IDC_EDITSCALEZ, OnChangeEditscalez)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlgObject message handlers
int CDlgObject::mfn_iGetIntPos(float radius)
{
return (int) ( radius * 10);
}
float CDlgObject::mfn_fSliderInt2Float(int sliderVal)
{
return sliderVal/10.0f;
}
void CDlgObject::OnChangeEditscalex()
{
UpdateData(TRUE);
m_pITObject->SetScaleX(m_fscaleX);
(((DEV_MultiDevice*)g_oFrameGest.ma_p_oWinArray[2][2]->GetActiveView())->DrawObject());
}
void CDlgObject::OnChangeEditscaley()
{
UpdateData(TRUE);
m_pITObject->SetScaleY(m_fscaleY);
(((DEV_MultiDevice*)g_oFrameGest.ma_p_oWinArray[2][2]->GetActiveView())->DrawObject());
}
void CDlgObject::OnChangeEditscalez()
{
UpdateData(TRUE);
m_pITObject->SetScaleZ(m_fscaleZ);
(((DEV_MultiDevice*)g_oFrameGest.ma_p_oWinArray[2][2]->GetActiveView())->DrawObject());
}
BOOL CDlgObject::OnInitDialog()
{
CDialog::OnInitDialog();
m_fscaleX = 1.f;
m_fscaleY = 1.f;
m_fscaleZ = 1.f;
UpdateData(FALSE);
return TRUE;
}
#endif //ACTIVE_EDITOR
#endif //__DLGOBJECT_HPP__

View File

@@ -0,0 +1,156 @@
//ROMTEAM WorldEditor
////////////////////////////////////////////////////////////////////////////////////////
// File : EdThread.cpp : implementation file
// Author :
// Date :
// Description :
////////////////////////////////////////////////////////////////////////////////////////
//ROMTEAM WorldEditor (Cristian Stegaru 11/97)
#include "stdafx.h"
#include "3DGe_res.h" // main symbols
#include "ACP_Base.h"
#include "incITF.h" // interface
#include "incGAM.h"
#include "3DInterf.hpp"
//ENDROMTEAM WorldEditor (Cristian Stegaru)
#include "EdThread.h"
//#include "MyDocument.h"
#include "ITView.h"
#include "EToolBar.h"
#include "ITFrame.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CEdThread
IMPLEMENT_DYNCREATE(CEdThread, CWinThread)
BOOL CEdThread::m_bAlreadyRunning = FALSE;
CEdThread::CEdThread()
{
m_pFrame = NULL;
m_pDocTemplate = NULL;
m_pLinkDll = NULL;
}
CEdThread::~CEdThread()
{
if (m_pFrame)
delete m_pFrame;
if (m_pDocTemplate)
delete m_pDocTemplate;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : InitInstance
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Cristian Stegaru
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL CEdThread::InitInstance()
{
if (m_bAlreadyRunning)
return FALSE;
m_bAlreadyRunning = TRUE;
m_pDocTemplate = new CSingleDocTemplate(
IDR_INDEXED_TRIANGLE,
RUNTIME_CLASS(CDocument),
RUNTIME_CLASS(CIndexedTriangleFrame), // main SDI frame window
RUNTIME_CLASS(CIndexedTriangleView));
// if (NULL != pDocTemplate)
// pDocTemplate->OpenDocumentFile(NULL);
if (NULL != m_pDocTemplate)
{
CFrameWnd *pFrame = m_pDocTemplate->CreateNewFrame(NULL, NULL);
ASSERT(pFrame->IsKindOf (RUNTIME_CLASS (CIndexedTriangleFrame)));
m_pFrame = (CIndexedTriangleFrame *)pFrame;
ASSERT (m_pFrame);
m_pFrame->InitialUpdateFrame(NULL, TRUE);
}
return TRUE;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : ExitInstance
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Cristian Stegaru
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
int CEdThread::ExitInstance()
{
m_bAlreadyRunning = FALSE;
return CWinThread::ExitInstance();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : mfn_pGetITEditor ()
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Cristian Stegaru
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
CTriEdit* CEdThread::mfn_pGetITEditor ()
{
if (m_pFrame)
return m_pFrame->mfn_pGetITEditor ();
return NULL;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : mfn_bCreateITObject
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Cristian Stegaru
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL CEdThread::mfn_bCreateITObject (CTriEdit *pITEditor, CString csName)
{
if (m_pLinkDll)
{
m_pLinkDll->mfn_bCreateITObject (pITEditor, csName);
return TRUE;
}
return FALSE;
}
BEGIN_MESSAGE_MAP(CEdThread, CWinThread)
//{{AFX_MSG_MAP(CEdThread)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CEdThread message handlers

View File

@@ -0,0 +1,357 @@
//ROMTEAM WorldEditor
////////////////////////////////////////////////////////////////////////////////////////
// File : EToolBar.cpp
// Author : Cristian S
// Date : 97.11
// Description :
////////////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
//ROMTEAM WorldEditor (Cristian Stegaru 11/97)
#include "3DGe_res.h" // main symbols
//ENDROMTEAM WorldEditor (Cristian Stegaru)
#include "EToolBar.h"
#include "ITView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
static UINT BASED_CODE ToolBarButtons[] =
{
// same order as in the bitmap 'IDR_EDIT_TOOLBAR'
ID_EDIT_SLIDER,
ID_SEPARATOR,
ID_STATIC_NAME,
ID_EDIT_NAME,
ID_STATIC_XNB,
ID_EDIT_XNB,
ID_STATIC_YNB,
ID_EDIT_YNB,
ID_SEPARATOR,
ID_BT_NEW,
ID_BT_SAVE,
ID_BT_HIDE,
ID_BT_UNDO,
ID_BT_REDO,
ID_BT_ONTOP,
ID_BT_EXIT
};
#define SLIDER_INDEX 0
#define SLIDER_BITMAP 0
#define SLIDER_WIDTH 100
#define SLIDER_HEIGHT 150
#define STATIC_NAME_INDEX 2
#define STATIC_NAME_BITMAP 1
#define STATIC_NAME_WIDTH 50
#define STATIC_NAME_HEIGHT 20
#define EDIT_NAME_INDEX 3
#define EDIT_NAME_BITMAP 2
#define EDIT_NAME_WIDTH 80
#define EDIT_NAME_HEIGHT 20
#define STATIC_XNB_INDEX 4
#define STATIC_XNB_BITMAP 3
#define STATIC_XNB_WIDTH 40
#define STATIC_XNB_HEIGHT 20
#define EDIT_XNB_INDEX 5
#define EDIT_XNB_BITMAP 4
#define EDIT_XNB_WIDTH 40
#define EDIT_XNB_HEIGHT 20
#define STATIC_YNB_INDEX 6
#define STATIC_YNB_BITMAP 5
#define STATIC_YNB_WIDTH 40
#define STATIC_YNB_HEIGHT 20
#define EDIT_YNB_INDEX 7
#define EDIT_YNB_BITMAP 6
#define EDIT_YNB_WIDTH 40
#define EDIT_YNB_HEIGHT 20
#define EDIT_ONTOP_INDEX 14
#define EDIT_HIDE_INDEX 11
BEGIN_MESSAGE_MAP(CEditorToolBar, CToolBar)
//{{AFX_MSG_MAP(CEditorToolBar)
ON_WM_HSCROLL()
ON_WM_LBUTTONDBLCLK()
ON_WM_LBUTTONDOWN()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
#define DEFAULT_X 15
#define DEFAULT_Y 15
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : CEditorToolBar constructor
// Date : November 1997
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
CEditorToolBar::CEditorToolBar ()
{
m_iXNb = DEFAULT_X;
m_iYNb = DEFAULT_Y;
m_csName.LoadString (IDS_DEFAULT_ITNAME);
}
CEditorToolBar::~CEditorToolBar ()
{
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : Init
// Date : November 1997
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL CEditorToolBar::Init (CWnd *pParent)
{
DWORD dwStyle = WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_SIZE_DYNAMIC | CBRS_TOOLTIPS | CBRS_FLYBY;
if (!Create (pParent, dwStyle, IDW_TOOLBAR) || !LoadBitmap(IDR_EDIT_TOOLBAR))
return FALSE;
if(!SetButtons(ToolBarButtons, sizeof(ToolBarButtons)/sizeof(UINT)))
return FALSE;
CRect sliderRect (-SLIDER_WIDTH, -SLIDER_HEIGHT, 0, 0);
CRect staticNameRect (-STATIC_NAME_WIDTH, -STATIC_NAME_HEIGHT, 0, 0);
CRect editNameRect (-EDIT_NAME_WIDTH, -EDIT_NAME_HEIGHT, 0, 0);
CRect xnbRect (-STATIC_XNB_WIDTH, -STATIC_XNB_HEIGHT, 0, 0);
CRect ynbRect (-STATIC_YNB_WIDTH, -STATIC_YNB_HEIGHT, 0, 0);
DWORD dwStaticStyle = WS_CHILD | SS_CENTER;
DWORD dwEditStyle = WS_CHILD | ES_LEFT | ES_AUTOHSCROLL | WS_TABSTOP | WS_BORDER;
DWORD dwSliderStyle = WS_CHILD | TBS_HORZ | TBS_NOTICKS;
if (!m_stName.Create ("Name:", dwStaticStyle, staticNameRect, this, IDC_STATIC_NAME) ||
!m_stXNb.Create ("XNb:", dwStaticStyle, xnbRect, this, IDC_STATIC_XNB) ||
!m_stYNb.Create ("YNb:", dwStaticStyle, ynbRect, this, IDC_STATIC_YNB) ||
!m_edName.Create (dwEditStyle, editNameRect, this, IDC_EDIT_NAME) ||
!m_edXNb.Create (dwEditStyle, xnbRect, this, IDC_EDIT_XNB) ||
!m_edYNb.Create (dwEditStyle, ynbRect, this, IDC_EDIT_YNB) ||
!m_Slider.Create (dwSliderStyle, sliderRect, this, IDC_SLIDER))
return FALSE;
SetButtonInfo(STATIC_NAME_INDEX, IDC_STATIC_NAME, TBBS_SEPARATOR, STATIC_NAME_WIDTH);
SetButtonInfo(STATIC_XNB_INDEX, IDC_STATIC_XNB, TBBS_SEPARATOR, STATIC_XNB_WIDTH);
SetButtonInfo(STATIC_YNB_INDEX, IDC_STATIC_YNB, TBBS_SEPARATOR, STATIC_YNB_WIDTH);
SetButtonInfo(EDIT_NAME_INDEX, IDC_EDIT_NAME, TBBS_SEPARATOR, EDIT_NAME_WIDTH);
SetButtonInfo(EDIT_XNB_INDEX, IDC_EDIT_XNB, TBBS_SEPARATOR, EDIT_XNB_WIDTH);
SetButtonInfo(EDIT_YNB_INDEX, IDC_EDIT_YNB, TBBS_SEPARATOR, EDIT_YNB_WIDTH);
SetButtonInfo(SLIDER_INDEX, IDC_SLIDER, TBBS_SEPARATOR, SLIDER_WIDTH);
UINT uID = 0, uStyle = 0;
int iImage = 0;
GetButtonInfo (EDIT_ONTOP_INDEX, uID, uStyle, iImage);
SetButtonInfo (EDIT_ONTOP_INDEX, uID, uStyle | TBBS_CHECKBOX, iImage);
GetButtonInfo (EDIT_HIDE_INDEX, uID, uStyle, iImage);
SetButtonInfo (EDIT_HIDE_INDEX, uID, uStyle | TBBS_CHECKBOX, iImage);
if (NULL != m_stName.m_hWnd)
{
CRect rect;
GetItemRect(STATIC_NAME_INDEX, rect);
m_stName.SetWindowPos(NULL, rect.left, rect.top, 0, 0, SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOCOPYBITS);
m_stName.ShowWindow(SW_SHOW);
}
if (NULL != m_stXNb.m_hWnd)
{
CRect rect;
GetItemRect(STATIC_XNB_INDEX, rect);
m_stXNb.SetWindowPos(NULL, rect.left, rect.top, 0, 0, SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOCOPYBITS);
m_stXNb.ShowWindow(SW_SHOW);
}
if (NULL != m_stYNb.m_hWnd)
{
CRect rect;
GetItemRect(STATIC_YNB_INDEX, rect);
m_stYNb.SetWindowPos(NULL, rect.left, rect.top, 0, 0, SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOCOPYBITS);
m_stYNb.ShowWindow(SW_SHOW);
}
if (NULL != m_edName.m_hWnd)
{
CRect rect;
GetItemRect(EDIT_NAME_INDEX, rect);
m_edName.SetWindowPos(NULL, rect.left, rect.top, 0, 0, SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOCOPYBITS);
m_edName.ShowWindow(SW_SHOW);
}
if (NULL != m_edXNb.m_hWnd)
{
CRect rect;
GetItemRect(EDIT_XNB_INDEX, rect);
m_edXNb.SetWindowPos(NULL, rect.left, rect.top, 0, 0, SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOCOPYBITS);
m_edXNb.ShowWindow(SW_SHOW);
}
if (NULL != m_edYNb.m_hWnd)
{
CRect rect;
GetItemRect(EDIT_YNB_INDEX, rect);
m_edYNb.SetWindowPos(NULL, rect.left, rect.top, 0, 0, SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOCOPYBITS);
m_edYNb.ShowWindow(SW_SHOW);
}
if (NULL != m_Slider.m_hWnd)
{
CRect rect;
GetItemRect(SLIDER_INDEX, rect);
m_Slider.SetWindowPos(NULL, rect.left, rect.top, 0, 0, SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOCOPYBITS);
m_Slider.ShowWindow(SW_SHOW);
}
UpdateData (FALSE);
return TRUE;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : OnHScroll
// Date : November 1997
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CEditorToolBar::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
int min, max;
CSliderCtrl *sl = (CSliderCtrl*)pScrollBar;
sl->GetRange(min, max);
GetView ()->SetLinearity((float)sl->GetPos()/(max-min));
CToolBar::OnHScroll(nSBCode, nPos, pScrollBar);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : GetView
// Date : November 1997
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
CIndexedTriangleView* CEditorToolBar::GetView ()
{
CWnd *pDockBar = GetParent ();
ASSERT (pDockBar);
CFrameWnd *pFrameWnd = (CFrameWnd*)pDockBar->GetParent ();
ASSERT (pFrameWnd);
return (CIndexedTriangleView*)pFrameWnd->GetActiveView();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : OnLButtonDblClk
// Date : November 1997
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CEditorToolBar::OnLButtonDblClk(UINT nFlags, CPoint point)
{
//don't allow floating toolbar
CWnd::OnLButtonDblClk(nFlags, point);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : OnLButtonDown
// Date : November 1997
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CEditorToolBar::OnLButtonDown(UINT nFlags, CPoint point)
{
//don't allow floating toolbar
CWnd::OnLButtonDown(nFlags, point);
}
#define MAX_CHARS 30
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : UpdateData
// Date : November 1997
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CEditorToolBar::UpdateData (BOOL bGet/* = TRUE*/)
{
CString csXNb, csYNb;
if (bGet)
{
GetDlgItem (IDC_EDIT_XNB)->GetWindowText (csXNb);
m_iXNb = atoi (csXNb);
GetDlgItem (IDC_EDIT_YNB)->GetWindowText (csYNb);
m_iYNb = atoi (csYNb);
GetDlgItem (IDC_EDIT_NAME)->GetWindowText (m_csName);
//ANNECY Shaitan Correction 03/03/98 {
while (((m_iXNb + 1)*(m_iYNb +1)) >= 2500)
{
if (m_iXNb > m_iYNb)
m_iXNb--;
else
m_iYNb--;
}
UpdateData(FALSE);
//ENDANNECY Shaitan Correction }
}
else
{
itoa (m_iXNb, csXNb.GetBuffer (MAX_CHARS), 10);
GetDlgItem (IDC_EDIT_XNB)->SetWindowText (csXNb);
itoa (m_iYNb, csYNb.GetBuffer (MAX_CHARS), 10);
GetDlgItem (IDC_EDIT_YNB)->SetWindowText (csYNb);
GetDlgItem (IDC_EDIT_NAME)->SetWindowText (m_csName);
}
}

View File

@@ -0,0 +1,413 @@
//ROMTEAM WorldEditor
////////////////////////////////////////////////////////////////////////////////////////
// File : ITBox3D.cpp: implementation of the ITBox3D class.
// Author : Ionut Grozea
// Date : 97.11
// Description :
////////////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ACP_Base.h"
#include "ITF.h"
#include "incGAM.h"
#include "GLI.h"
#include "DPT.h"
#include "3dinterf.hpp"
#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
#include "OGD.h"
#undef CPA_WANTS_EXPORT
#define CPA_WANTS_IMPORT
#include "DlgITBox.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : ITBox3D::ITBox3D
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : constructor to create a new object
// Author : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
ITBox3D::ITBox3D (CPA_EditorBase *_p_oEditor, float scale ,const CString _csName , tdeSaveStatus _eStatus )
: Shape3D (TRUE, _p_oEditor, 8, 1, _csName , _eStatus)
{
m_fX = scale;
m_fY = scale;
m_fZ = scale;
CommonITBox3D ();
}
ITBox3D::~ITBox3D()
{
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : ITBox3D::CreateITBox3D()
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : set vertices of ITBox3D
// Author : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void ITBox3D::CreateITBox3D()
{
MTH3D_tdstVector a8_stPoint [8];
MTH3D_M_vSetVectorElements ( a8_stPoint, m_fX/2.f , -m_fY/2.f ,-m_fZ/2.f );
MTH3D_M_vSetVectorElements ( a8_stPoint+1, m_fX/2.f , m_fY/2.f , -m_fZ/2.f );
MTH3D_M_vSetVectorElements ( a8_stPoint+2, m_fX/2.f , m_fY/2.f , m_fZ/2.f );
MTH3D_M_vSetVectorElements ( a8_stPoint+3, m_fX/2.f , -m_fY/2.f , m_fZ/2.f );
MTH3D_M_vSetVectorElements ( a8_stPoint+4, -m_fX/2.f , -m_fY/2.f , -m_fZ/2.f );
MTH3D_M_vSetVectorElements ( a8_stPoint+5, -m_fX/2.f , m_fY/2.f , -m_fZ/2.f );
MTH3D_M_vSetVectorElements ( a8_stPoint+6, -m_fX/2.f , m_fY/2.f , m_fZ/2.f );
MTH3D_M_vSetVectorElements ( a8_stPoint+7, -m_fX/2.f , -m_fY/2.f , m_fZ/2.f );
fn_vSetListOfPoints(8,a8_stPoint);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : ITBox3D::CommonITBox3D()
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : set texture vertices of ITBox3D
// Author : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void ITBox3D::CommonITBox3D()
{
CreateITBox3D();
ACP_tdxHandleOfElement hElement = fn_hCreateElementIndexedTriangle(12,4);
/////////////////////
ACP_tdst2DUVValues q1 = { 0.f, 0.f};
ACP_tdst2DUVValues q2 = { 1.f, 0.f};
ACP_tdst2DUVValues q3 = { 0.f, 1.f};
ACP_tdst2DUVValues q4 = { 1.f, 1.f};
GEO_vSetUVOfIndexedTriangles(GetStruct(), hElement, 0, &q1);
GEO_vSetUVOfIndexedTriangles(GetStruct(), hElement, 1, &q2);
GEO_vSetUVOfIndexedTriangles(GetStruct(), hElement, 2, &q3);
GEO_vSetUVOfIndexedTriangles(GetStruct(), hElement, 3, &q4);
//
fn_eSetIndexedTriangle ( hElement, 0, 0, 1, 3);
GEO_vSetIndexedUVOfFaceOfIndexedTriangles( GetStruct(), hElement, 0, 0, 1, 2);
//
fn_eSetIndexedTriangle ( hElement, 1, 1, 2, 3);
GEO_vSetIndexedUVOfFaceOfIndexedTriangles( GetStruct(), hElement, 1, 1, 3, 2);
//
fn_eSetIndexedTriangle ( hElement, 2, 4, 5, 1);
GEO_vSetIndexedUVOfFaceOfIndexedTriangles( GetStruct(), hElement, 2, 0, 2, 1);
//
fn_eSetIndexedTriangle ( hElement, 3, 1, 0, 4);
GEO_vSetIndexedUVOfFaceOfIndexedTriangles( GetStruct(), hElement, 3, 3, 0, 1);
//
fn_eSetIndexedTriangle ( hElement, 4, 1, 5, 6);
GEO_vSetIndexedUVOfFaceOfIndexedTriangles( GetStruct(), hElement, 4, 1 ,0, 2);
//
fn_eSetIndexedTriangle ( hElement, 5, 1, 6, 2);
GEO_vSetIndexedUVOfFaceOfIndexedTriangles( GetStruct(), hElement, 5, 1, 2, 3);
//
fn_eSetIndexedTriangle ( hElement, 6, 3, 2, 6);
GEO_vSetIndexedUVOfFaceOfIndexedTriangles( GetStruct(), hElement, 6, 1, 3, 2);
//
fn_eSetIndexedTriangle ( hElement, 7, 6, 7, 3);
GEO_vSetIndexedUVOfFaceOfIndexedTriangles( GetStruct(), hElement, 7, 2, 0, 1);
//
fn_eSetIndexedTriangle ( hElement, 8, 0, 3, 7);
GEO_vSetIndexedUVOfFaceOfIndexedTriangles( GetStruct(), hElement, 8, 1, 3, 2);
//
fn_eSetIndexedTriangle ( hElement, 9, 7, 4, 0);
GEO_vSetIndexedUVOfFaceOfIndexedTriangles( GetStruct(), hElement, 9, 2, 0, 1);
//
fn_eSetIndexedTriangle ( hElement, 10, 4, 7, 5);
GEO_vSetIndexedUVOfFaceOfIndexedTriangles( GetStruct(), hElement, 10, 1, 3, 0);
//
fn_eSetIndexedTriangle ( hElement, 11, 6, 5, 7);
GEO_vSetIndexedUVOfFaceOfIndexedTriangles( GetStruct(), hElement, 11, 2, 0, 3);
//
///////////////////////
EndCreate();
}
ACP_tdxHandleOfElement ITBox3D::GetHElement()
{
return m_hElement;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :ITBox3D::_OnLButtonDblClk
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : launch the modal dialog
// Author : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL ITBox3D::_OnLButtonDblClk (UINT nFlags, tdstMousePos *p_stPos, ACP_tdxIndex xIndex, HIE_tdstPickInfo *p_stPickInfo)
{
HINSTANCE hOldInst = AfxGetResourceHandle();
AfxSetResourceHandle ( ((CPA_DLLBase*)(GetEditor()))->GetDLLIdentity()->hModule );
CDlgITBox dlg(m_fX , m_fY , m_fZ , this);
BOOL retval = dlg.DoModal() == IDOK;
AfxSetResourceHandle(hOldInst);
return retval;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :ITBox3D::_OnMouseMove
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : adjust the box size according to the mouse input
// Author : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL ITBox3D::_OnMouseMove(UINT nFlags, tdstMousePos * p_stPos, MTH3D_tdstVector * pDeplacement)
{
if (Shape3D::_OnMouseMove (nFlags, p_stPos, pDeplacement))
{
// we make the movement
MTH3D_M_vAddVector (& m_stGlobalSelectedPoint ,
& m_stGlobalSelectedPoint , pDeplacement);
MTH3D_tdstVector RadiusVertex;
MTH3D_M_vSubVector (& RadiusVertex , & m_stGlobalSelectedPoint ,
& m_stCenterInMousePlane);
GLI_tdxValue NewRadius = MTH3D_M_xNormVector (& RadiusVertex);
if (!m_Flag)
{
SetScaleX (m_fXold*NewRadius/m_fGlobal);
SetScaleY (m_fYold*NewRadius/m_fGlobal);
SetScaleZ (m_fZold*NewRadius/m_fGlobal);
}
else
{
m_fGlobal = NewRadius;
m_Flag = FALSE;
}
return TRUE;
}
else
return FALSE;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :ITBox3D::_OnLButtonDown
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Init the resizing
// Author : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL ITBox3D::_OnLButtonDown(UINT nFlags, tdstMousePos * p_stPos, ACP_tdxIndex xIndex, HIE_tdstPickInfo * p_stObject)
{
if (Shape3D::_OnLButtonDown(nFlags, p_stPos, xIndex, p_stObject))
{
// resizing is allowed
MTH3D_tdstVector SphereCenter;
// Compute coordinates in the global repere
ConvertPointLocalToGlobal (& SphereCenter, HIE_fn_hGetSuperObjectGlobalMatrix (m_pSuperObject->GetStruct ()) , & GetCenter ());
// Get the matrix of the camera
GLI_tdxHandleToCamera hHandleToCamera = m_pGeometry3DDLL->GetInterface () -> GetMultiDevice () -> GetFocusDevice () -> GetCamera ();
POS_tdstCompletePosition CameraMatrix , InvMatrix;
GLI_xGetCameraMatrix (hHandleToCamera , & CameraMatrix);
POS_fn_vInvertIsoMatrix(& InvMatrix , & CameraMatrix);
// Get the coordinates of the Z axe
MTH3D_tdstVector ZAxe , DummyVector;
POS_fn_vGetRotationMatrix(& InvMatrix , & DummyVector , & DummyVector , & ZAxe);
// Compute the sphere center, projected into the plane where the mouse moves into
MTH3D_M_vSubVector (& SphereCenter , & SphereCenter , & m_stGlobalSelectedPoint);
GLI_tdxValue DotProduct = MTH3D_M_xDotProductVector (& ZAxe , & SphereCenter);
MTH3D_M_vMulScalarVector (& ZAxe , DotProduct , & ZAxe);
MTH3D_M_vSubVector (& SphereCenter , & SphereCenter , & ZAxe);
MTH3D_M_vAddVector (& m_stCenterInMousePlane ,
& SphereCenter , & m_stGlobalSelectedPoint);
m_Flag = TRUE;
m_fXold = m_fX;
m_fYold = m_fY;
m_fZold = m_fZ;
return TRUE;
}
else
{
m_Flag = TRUE;
return FALSE;
}
}
void ITBox3D::SetScaleX(float fScale)
{
m_fX = fScale;
CreateITBox3D();
}
void ITBox3D::SetScaleY(float fScale)
{
m_fY = fScale;
CreateITBox3D();
}
void ITBox3D::SetScaleZ(float fScale)
{
m_fZ = fScale;
CreateITBox3D();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : SetScaleXYZ
// Date : 98- 01
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Cristian Stegaru - CPA2
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void ITBox3D::SetScaleXYZ (float fXScale, float fYScale, float fZScale)
{
m_fX = fXScale;
m_fY = fYScale;
m_fZ = fZScale;
CreateITBox3D();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : mfn_vLoad
// Date : 98-01
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Cristian Stegaru - CPA2
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void ITBox3D::mfn_vLoad (CString csEPOFile, CString csEPOName)
{
Shape3D::mfn_vLoad (csEPOFile, csEPOName);
char szX [NB_LENGTH], szY [NB_LENGTH], szZ [NB_LENGTH];
BOOL bReadOK = GetPrivateProfileString (csEPOName, "X", NULL, szX, NB_LENGTH, csEPOFile);
float fXScale = (float)atof (szX);
bReadOK = bReadOK && GetPrivateProfileString (csEPOName, "Y", NULL, szY, NB_LENGTH, csEPOFile);
float fYScale = (float)atof (szY);
bReadOK = bReadOK && GetPrivateProfileString (csEPOName, "Z", NULL, szZ, NB_LENGTH, csEPOFile);
float fZScale = (float)atof (szZ);
ASSERT (bReadOK);
SetScaleXYZ (fXScale, fYScale, fZScale);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : mfn_vSave
// Date : 98-01
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Cristian Stegaru - CPA2
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void ITBox3D::mfn_vSave (CString csEPOFile, CString csEPOName, int iIdx)
{
Shape3D::mfn_vSave (csEPOFile, csEPOName, iIdx);
char szX [NB_LENGTH], szY [NB_LENGTH], szZ [NB_LENGTH];
_gcvt (m_fX, 4, szX);
BOOL bWriteOK = WritePrivateProfileString (csEPOName, "X", szX, csEPOFile);
_gcvt (m_fY, 4, szY);
bWriteOK = bWriteOK && WritePrivateProfileString (csEPOName, "Y", szY, csEPOFile);
_gcvt (m_fZ, 4, szZ);
bWriteOK = bWriteOK && WritePrivateProfileString (csEPOName, "Z", szZ, csEPOFile);
ASSERT (bWriteOK);
}
//------------------------------------------ ITBoxUndo ---------------------------------------------
#define M_RedrawWorld() (((DEV_MultiDevice*)g_oFrameGest.ma_p_oWinArray[2][2]->GetActiveView())->DrawObject())
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :ITBoxUndo::ITBoxUndo
// Date : 98.01
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Init the undo data
// Author : N Suparatu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
ITBoxUndo::ITBoxUndo(ITBox3D *box) : CPA_Modif(0, "Set Box Parameters", FALSE)
{
m_pBox = box;
m_fX = box->m_fX;
m_fY = box->m_fY;
m_fZ = box->m_fZ;
m_bFirst = TRUE;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :ITBoxUndo::Undo
// Date : 98.01
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Undo box parameters
// Author : N Suparatu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL ITBoxUndo::Undo()
{
m_bFirst = FALSE;
float x = m_pBox->m_fX;
float y = m_pBox->m_fY;
float z = m_pBox->m_fZ;
m_pBox->SetScaleX(m_fX);
m_pBox->SetScaleY(m_fY);
m_pBox->SetScaleZ(m_fZ);
m_fX = x;
m_fY = y;
m_fZ = z;
m_pBox->fn_vNotifySaveObject();
M_RedrawWorld();
return TRUE;
}

View File

@@ -0,0 +1,565 @@
//ROMTEAM WorldEditor
////////////////////////////////////////////////////////////////////////////////////////
// File : ITcon3D.cpp: implementation of the ITcon3D class.
// Author : Ionut Grozea
// Date : 97.11
// Description :
////////////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ACP_Base.h"
#include "ITF.h"
#include "incGAM.h"
#include "GLI.h"
#include "DPT.h"
#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
#include "OGD.h"
#undef CPA_WANTS_EXPORT
#define CPA_WANTS_IMPORT
#include "3dinterf.hpp"
#include "DlgITCone.h"
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : ITCon3D::ITCon3D
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : constructor to create a new object
// Author : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
ITCon3D::ITCon3D (CPA_EditorBase *_p_oEditor,float radius /* = 1.f */ , float height /* = 1.f */ , const CString _csName , tdeSaveStatus _eStatus )
:ParamSurface3D(TRUE, _p_oEditor, 1, 1, _csName , _eStatus)
{
CommonITCon3D (radius , height, 10, 10);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : ITCon3D::ITCon3D
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : constructor to create a new object
// Author : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
ITCon3D::ITCon3D (CPA_EditorBase *_p_oEditor,float radius /* = 1.f */ , float height /* = 1.f */, int ns, int nt, const CString _csName , tdeSaveStatus _eStatus )
:ParamSurface3D(TRUE, _p_oEditor, 1, 1, _csName , _eStatus)
{
CommonITCon3D (radius , height, ns, nt);
}
#define PI 3.14159265359f
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : ITCon3D::x
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : set x coordonates of ITBox3D
// Author : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
float ITCon3D::x(float s, float t)
{
float result;
float s0 = (1-s)*m_fHeight;
float t0 = 2*PI-t*2*PI;
if (s0!=m_fHeight)
{
if (s0 == resultold || m_Flag2<2)
{
resultold = s0;
result = m_fRadius*(float) cos(t0);
m_Flag2++;
}
else
{
result =(s0/m_fHeight)*m_fRadius*(float) cos(t0);
}
}
else
{
result = 0;
}
return result;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : ITCon3D::y
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : set y coordonates of ITBox3D
// Author : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
float ITCon3D::y(float s, float t)
{
float result;
float s0 = (1-s)*m_fHeight;
float t0 = 2*PI-t*2*PI;
if (s0!=m_fHeight)
{
if (s0 == resultold || m_Flag3<2)
{
resultold = s0;
result = m_fRadius*(float)sin(t0);
m_Flag3++;
}
else
{
result = (s0 / m_fHeight)*m_fRadius*(float)sin(t0);
}
}
else
{
result = 0;
}
return result;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : ITCon3D::z
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : set z coordonates of ITBox3D
// Author : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
float ITCon3D::z(float s, float t)
{
float result;
float s0 = (1-s)*m_fHeight;
float t0 = 2*PI-t*2*PI;
if (s0!=m_fHeight)
{
if (s0 == resultold || m_Flag1<2)
{
resultold = s0;
result = 0;
m_Flag1++;
}
else
{
result = m_fHeight - s0;
}
}
else
{
result = 0;
}
return result;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : ITCon3D::CommonITCon3D
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : construct of ITcon3D
// Author : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void ITCon3D::CommonITCon3D( float radius , float height, int ns, int nt)
{
m_fHeight = height;
m_fRadius = radius;
m_Ns = ns;
m_Nt = nt;
GEO_tdstGeometricObject *x = GetStruct();
m_Flag1=0;
m_Flag2=0;
m_Flag3=0;
resultold=-1;
m_hElement = NewElement(0, m_Ns, m_Nt);
}
ITCon3D::~ITCon3D()
{
}
ACP_tdxHandleOfElement ITCon3D::GetHElement()
{
return m_hElement;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : ITCon3D::SetRadius
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : SetRadius of ITcon3D
// Author : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL ITCon3D::SetRadius(GLI_tdxValue Radius)
{
i=0;
if(Radius<0.1) Radius = (float)0.1;
m_fRadius = Radius;
m_Flag1=0;
m_Flag2=0;
m_Flag3=0;
resultold=-1;
NewElement(m_hElement, m_Ns, m_Nt);
return TRUE;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : ITCon3D::SetHeight
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : SetHeight of ITcon3D
// Author : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL ITCon3D::SetHeight(GLI_tdxValue Height)
{
i=0;
if(Height<0.1) Height = (float)0.1;
m_fHeight = Height;
m_Flag1=0;
m_Flag2=0;
m_Flag3=0;
resultold=-1;
NewElement(m_hElement, m_Ns, m_Nt);
return TRUE;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : ITCon3D::GetRadius()
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : return radius of ITCon3D
// Author : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
GLI_tdxValue ITCon3D::GetRadius()
{
return m_fRadius;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : ITCon3D::GetHeight()
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : return height of ITCon3D
// Author : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
GLI_tdxValue ITCon3D::GetHeight()
{
return m_fHeight;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : ITCon3D::SetSamplingRate
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : set sampling rate of ITCon3D
// Author : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void ITCon3D::SetSamplingRate(int Ns, int Nt)
{
i=0;
if(Ns < 4) Ns = 4;
if(Nt < 4) Nt = 4;
if(Ns > 20) Ns = 20;
if(Nt > 20) Nt = 20;
m_Nt = Nt;
m_Ns = Ns;
m_Flag1=0;
m_Flag2=0;
m_Flag3=0;
resultold=-1;
NewElement(m_hElement, m_Ns, m_Nt);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : ITCon3D::GetSamplingRate
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : return sampling rate of ITCon3D
// Author : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void ITCon3D::GetSamplingRate(int &Ns, int &Nt)
{
Nt = m_Nt;
Ns = m_Ns;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :ITCon3D::_OnLButtonDblClk
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : launch the modal dialog
// Author : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL ITCon3D::_OnLButtonDblClk (UINT nFlags, tdstMousePos *p_stPos, ACP_tdxIndex xIndex, HIE_tdstPickInfo *p_stPickInfo)
{
HINSTANCE hOldInst = AfxGetResourceHandle();
AfxSetResourceHandle ( ((CPA_DLLBase*)(GetEditor()))->GetDLLIdentity()->hModule );
DlgITCone dlg(this ,m_fRadius , m_fHeight ,m_Ns , m_Nt );
BOOL retval = dlg.DoModal() == IDOK;
AfxSetResourceHandle(hOldInst);
return retval;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :ITCon3D::_OnMouseMove
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : adjust the box size according to the mouse input
// Author : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL ITCon3D::_OnMouseMove(UINT nFlags, tdstMousePos * p_stPos, MTH3D_tdstVector * pDeplacement)
{
if (Shape3D::_OnMouseMove (nFlags, p_stPos, pDeplacement))
{
// we make the movement
MTH3D_M_vAddVector (& m_stGlobalSelectedPoint ,
& m_stGlobalSelectedPoint , pDeplacement);
MTH3D_tdstVector RadiusVertex;
MTH3D_M_vSubVector (& RadiusVertex , & m_stGlobalSelectedPoint ,
& m_stCenterInMousePlane);
GLI_tdxValue NewRadius = MTH3D_M_xNormVector (& RadiusVertex);
if (!m_Flag)
{
SetRadius (m_fRadiusold*NewRadius/m_fGlobal);
SetHeight (m_fHeightold*NewRadius/m_fGlobal);
}
else
{
m_fGlobal = NewRadius;
m_Flag = FALSE;
}
return TRUE;
}
else
return FALSE;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :ITCon3D::_OnLButtonDown
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Init the resizing
// Author : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL ITCon3D::_OnLButtonDown(UINT nFlags, tdstMousePos * p_stPos, ACP_tdxIndex xIndex, HIE_tdstPickInfo * p_stObject)
{
if (Shape3D::_OnLButtonDown(nFlags, p_stPos, xIndex, p_stObject))
{
// resizing is allowed
MTH3D_tdstVector SphereCenter;
// Compute coordinates in the global repere
ConvertPointLocalToGlobal (& SphereCenter, HIE_fn_hGetSuperObjectGlobalMatrix (m_pSuperObject->GetStruct ()) , & GetCenter ());
// Get the matrix of the camera
GLI_tdxHandleToCamera hHandleToCamera = m_pGeometry3DDLL->GetInterface () -> GetMultiDevice () -> GetFocusDevice () -> GetCamera ();
POS_tdstCompletePosition CameraMatrix , InvMatrix;
GLI_xGetCameraMatrix (hHandleToCamera , & CameraMatrix);
POS_fn_vInvertIsoMatrix(& InvMatrix , & CameraMatrix);
// Get the coordinates of the Z axe
MTH3D_tdstVector ZAxe , DummyVector;
POS_fn_vGetRotationMatrix(& InvMatrix , & DummyVector , & DummyVector , & ZAxe);
// Compute the sphere center, projected into the plane where the mouse moves into
MTH3D_M_vSubVector (& SphereCenter , & SphereCenter , & m_stGlobalSelectedPoint);
GLI_tdxValue DotProduct = MTH3D_M_xDotProductVector (& ZAxe , & SphereCenter);
MTH3D_M_vMulScalarVector (& ZAxe , DotProduct , & ZAxe);
MTH3D_M_vSubVector (& SphereCenter , & SphereCenter , & ZAxe);
MTH3D_M_vAddVector (& m_stCenterInMousePlane ,
& SphereCenter , & m_stGlobalSelectedPoint);
m_Flag = TRUE;
m_fRadiusold = m_fRadius;
m_fHeightold = m_fHeight;
return TRUE;
}
else
return FALSE;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : mfn_vLoad
// Date : 98-01
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Cristian Stegaru CPA2
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void ITCon3D::mfn_vLoad (CString csEPOFile, CString csEPOName)
{
Shape3D::mfn_vLoad (csEPOFile, csEPOName);
char szRadius [NB_LENGTH], szHeight [NB_LENGTH], szNs [NB_LENGTH], szNt [NB_LENGTH];
BOOL bReadOK = GetPrivateProfileString (csEPOName, "RADIUS", NULL, szRadius, NB_LENGTH, csEPOFile);
float fRadius = (float)atof (szRadius);
bReadOK = bReadOK && GetPrivateProfileString (csEPOName, "HEIGHT", NULL, szHeight, NB_LENGTH, csEPOFile);
float fHeight = (float)atof (szHeight);
bReadOK = bReadOK && GetPrivateProfileString (csEPOName, "NS", NULL, szNs, NB_LENGTH, csEPOFile);
int iNs = atoi (szNs);
bReadOK = bReadOK && GetPrivateProfileString (csEPOName, "NT", NULL, szNt, NB_LENGTH, csEPOFile);
int iNt = atoi (szNt);
ASSERT (bReadOK);
SetRadius(fRadius);
SetHeight(fHeight);
SetSamplingRate(iNs, iNt);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : mfn_vSave
// Date : 98-01
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Cristian Stegaru CPA2
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void ITCon3D::mfn_vSave (CString csEPOFile, CString csEPOName, int iIdx)
{
Shape3D::mfn_vSave (csEPOFile, csEPOName, iIdx);
char szRadius [NB_LENGTH], szHeight [NB_LENGTH], szNs [NB_LENGTH], szNt [NB_LENGTH];
_gcvt (m_fRadius, 4, szRadius);
BOOL bWriteOK = WritePrivateProfileString (csEPOName, "RADIUS", szRadius, csEPOFile);
_gcvt (m_fHeight, 4, szHeight);
bWriteOK = bWriteOK && WritePrivateProfileString (csEPOName, "HEIGHT", szHeight, csEPOFile);
itoa (m_Ns, szNs, 10);
bWriteOK = bWriteOK && WritePrivateProfileString (csEPOName, "NS", szNs, csEPOFile);
itoa (m_Nt, szNt, 10);
bWriteOK = bWriteOK && WritePrivateProfileString (csEPOName, "NT", szNt, csEPOFile);
ASSERT (bWriteOK);
}
//------------------------------------------ ITConUndo ---------------------------------------------
#define M_RedrawWorld() (((DEV_MultiDevice*)g_oFrameGest.ma_p_oWinArray[2][2]->GetActiveView())->DrawObject())
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :ITConUndo::ITConUndo
// Date : 98.01
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Init the undo data
// Author : N Suparatu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
ITConUndo::ITConUndo(ITCon3D *con) : CPA_Modif(0, "Set Cone Parameters", FALSE)
{
m_pCon = con;
con->GetSamplingRate(m_Ns, m_Nt);
m_fRadius = con->GetRadius();
m_fHeight = con->GetHeight();
m_bFirst = TRUE;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :ITConUndo::Undo
// Date : 98.01
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Undo con parameters
// Author : N Suparatu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL ITConUndo::Undo()
{
m_bFirst = FALSE;
int s, t;
m_pCon->GetSamplingRate(s, t);
float r = m_pCon->GetRadius();
float h = m_pCon->GetHeight();
m_pCon->SetRadius(m_fRadius);
m_pCon->SetHeight(m_fHeight);
m_pCon->SetSamplingRate(m_Ns, m_Nt);
m_fRadius = r;
m_fHeight = h;
m_Ns = s;
m_Nt = t;
m_pCon->fn_vNotifySaveObject();
M_RedrawWorld();
return TRUE;
}

View File

@@ -0,0 +1,372 @@
//ROMTEAM WorldEditor
////////////////////////////////////////////////////////////////////////////////////////
// File : IndexedTriangleFrame.cpp : implementation file
// Author :
// Date :
// Description :
////////////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
//ROMTEAM WorldEditor (Cristian Stegaru 11/97)
#include "3DGe_res.h" // main symbols
//ENDROMTEAM WorldEditor (Cristian Stegaru)
#include "EToolBar.h"
#include "ITFrame.h"
#include "ITView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CIndexedTriangleFrame
IMPLEMENT_DYNCREATE(CIndexedTriangleFrame, CFrameWnd)
CIndexedTriangleFrame::CIndexedTriangleFrame()
{
}
CIndexedTriangleFrame::~CIndexedTriangleFrame()
{
}
BEGIN_MESSAGE_MAP(CIndexedTriangleFrame, CFrameWnd)
//{{AFX_MSG_MAP(CIndexedTriangleFrame)
ON_WM_CREATE()
ON_COMMAND(ID_BT_NEW, OnNew)
ON_COMMAND(ID_BT_SAVE, OnSave)
ON_COMMAND(ID_BT_HIDE, OnHide)
ON_COMMAND(ID_BT_UNDO, OnUndo)
ON_COMMAND(ID_BT_REDO, OnRedo)
ON_COMMAND(ID_BT_ONTOP, OnOnTop)
ON_COMMAND(ID_BT_EXIT, OnExit)
ON_UPDATE_COMMAND_UI(ID_BT_NEW, OnUpdateNewObject)
ON_UPDATE_COMMAND_UI(ID_BT_SAVE, OnUpdateSave)
ON_UPDATE_COMMAND_UI(ID_BT_HIDE, OnUpdateHide)
ON_UPDATE_COMMAND_UI(ID_BT_UNDO, OnUpdateUndo)
ON_UPDATE_COMMAND_UI(ID_BT_REDO, OnUpdateRedo)
ON_UPDATE_COMMAND_UI(ID_BT_ONTOP, OnUpdateOnTop)
ON_UPDATE_COMMAND_UI(ID_BT_EXIT, OnUpdateExit)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CIndexedTriangleFrame message handlers
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : OnCreate
// Date : November 1997
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
int CIndexedTriangleFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
m_wndToolBar.Init (this);
m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
CBRS_TOOLTIPS | CBRS_FLYBY /*| CBRS_SIZE_DYNAMIC*/);
m_wndToolBar.EnableDocking(CBRS_ALIGN_TOP);
EnableDocking(CBRS_ALIGN_TOP);
DockControlBar(&m_wndToolBar, AFX_IDW_DOCKBAR_TOP);
return 0;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : OnNew
// Date : November 1997
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CIndexedTriangleFrame::OnNew ()
{
int iXNb = 0, iYNb = 0;
CString csName;
((CEditorToolBar *)GetControlBar (IDW_TOOLBAR))->GetAttributes (iXNb, iYNb, csName);
GetView ()->OnNewObject (iXNb, iYNb);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : OnSave
// Date : November 1997
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CIndexedTriangleFrame::OnSave ()
{
GetView ()->OnSave ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : OnHide
// Date : November 1997
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CIndexedTriangleFrame::OnHide ()
{
CToolBarCtrl &rToolBarCtrl = ((CEditorToolBar *)GetControlBar (IDW_TOOLBAR))->GetToolBarCtrl ();
BOOL bHide = rToolBarCtrl.IsButtonChecked (ID_BT_HIDE);
GetView ()->OnHide (bHide);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : OnUndo
// Date : November 1997
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CIndexedTriangleFrame::OnUndo ()
{
GetView ()->OnUndo ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : OnRedo
// Date : November 1997
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CIndexedTriangleFrame::OnRedo ()
{
GetView ()->OnRedo ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : OnOnTop
// Date : November 1997
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CIndexedTriangleFrame::OnOnTop ()
{
CToolBarCtrl &rToolBarCtrl = ((CEditorToolBar *)GetControlBar (IDW_TOOLBAR))->GetToolBarCtrl ();
BOOL bTopMost = rToolBarCtrl.IsButtonChecked (ID_BT_ONTOP);
const CWnd* pWndAfter = bTopMost? &wndTopMost : &wndNoTopMost;
SetWindowPos (pWndAfter, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : OnExit
// Date : November 1997
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CIndexedTriangleFrame::OnExit ()
{
GetView ()->OnExit ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : OnUpdateNewObject
// Date : November 1997
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CIndexedTriangleFrame::OnUpdateNewObject (CCmdUI* pCmdUI)
{
pCmdUI->Enable ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : OnUpdateSave
// Date : November 1997
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CIndexedTriangleFrame::OnUpdateSave (CCmdUI* pCmdUI)
{
pCmdUI->Enable ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : OnUpdateHide
// Date : November 1997
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CIndexedTriangleFrame::OnUpdateHide (CCmdUI* pCmdUI)
{
pCmdUI->Enable ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : OnUpdateUndo
// Date : November 1997
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CIndexedTriangleFrame::OnUpdateUndo (CCmdUI* pCmdUI)
{
pCmdUI->Enable (0 < GetView ()->CanUndo ());
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : OnUpdateRedo
// Date : November 1997
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CIndexedTriangleFrame::OnUpdateRedo (CCmdUI* pCmdUI)
{
pCmdUI->Enable (0 < GetView ()->CanRedo ());
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : OnUpdateOnTop
// Date : November 1997
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CIndexedTriangleFrame::OnUpdateOnTop (CCmdUI* pCmdUI)
{
pCmdUI->Enable ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : OnUpdateExit
// Date : November 1997
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CIndexedTriangleFrame::OnUpdateExit (CCmdUI* pCmdUI)
{
pCmdUI->Enable ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : GetView
// Date : November 1997
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
CIndexedTriangleView* CIndexedTriangleFrame::GetView ()
{
return (CIndexedTriangleView*)GetActiveView ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : mfn_pGetITEditor ()
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Cristian Stegaru
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
CTriEdit * CIndexedTriangleFrame::mfn_pGetITEditor ()
{
CIndexedTriangleView* pView = GetView ();
if (pView)
return pView->mfn_pGetITEditor ();
return NULL;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : mfn_csGetITName ()
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Cristian Stegaru
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
CString CIndexedTriangleFrame::mfn_csGetITName ()
{
m_wndToolBar.UpdateData ();
return m_wndToolBar.GetName ();
}

View File

@@ -0,0 +1,427 @@
//ROMTEAM WorldEditor
////////////////////////////////////////////////////////////////////////////////////////
// File : ITSphere3D.cpp: implementation of the ITSphere3D class.
// Author : Ionut Grozea
// Date : 97.11
// Description :
////////////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ACP_Base.h"
#include "ITF.h"
#include "incGAM.h"
#include "GLI.h"
#include "DPT.h"
#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
#include "OGD.h"
#undef CPA_WANTS_EXPORT
#ifndef CPA_WANTS_IMPORT
#define CPA_WANTS_IMPORT
#endif
#include "3dinterf.hpp"
#include "DlgITSphere.h"
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : ITSphere3D::ITSphere3D
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : constructor to create a new object
// Author : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
ITSphere3D::ITSphere3D (CPA_EditorBase *_p_oEditor,float radius /* = 1.f */ , const CString _csName , tdeSaveStatus _eStatus )
:ParamSurface3D(TRUE, _p_oEditor, 1, 1, _csName , _eStatus)
{
CommonITSphere3D (radius , 10, 10);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : ITSphere3D::ITSphere3D
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : constructor to create a new object
// Author : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
ITSphere3D::ITSphere3D (CPA_EditorBase *_p_oEditor,float radius /* = 1.f */, int ns, int nt, const CString _csName , tdeSaveStatus _eStatus )
:ParamSurface3D(TRUE, _p_oEditor, 1, 1, _csName , _eStatus)
{
CommonITSphere3D (radius , ns, nt);
}
//Sphere parametrisation
#define PI 3.14159265359f
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : ITSphere3D::x
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : set x coordonates of ITSphere3D
// Author : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
float ITSphere3D::x(float s, float t)
{
float s0 = -PI/2 + s*PI;
float t0 = t*2*PI;
return (float)(m_fRadius*cos(s0)*cos(t0));
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : ITSphere3D::y
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : set y coordonates of ITSphere3D
// Author : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
float ITSphere3D::y(float s, float t)
{
float s0 = -PI/2 + s*PI;
float t0 = t*2*PI;
return (float)(m_fRadius*cos(s0)*sin(t0));
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : ITSphere3D::z
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : set z coordonates of ITSphere3D
// Author : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
float ITSphere3D::z(float s, float t)
{
float s0 = -PI/2 + s*PI;
return (float)(-m_fRadius*sin(s0));
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : ITSphere3D::CommonITSphere3D
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : construct of ITSphere3D
// Author : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void ITSphere3D::CommonITSphere3D( float radius, int ns, int nt)
{
m_fRadius = radius;
m_Ns = ns;
m_Nt = nt;
m_hElement = NewElement(0, m_Ns, m_Nt);
}
ITSphere3D::~ITSphere3D()
{
}
ACP_tdxHandleOfElement ITSphere3D::GetHElement()
{
return m_hElement;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : ITSphere3D::SetRadius
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : SetRadius of ITSphere3D
// Author : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL ITSphere3D::SetRadius(GLI_tdxValue Radius)
{
if(Radius<0.1) Radius = (float)0.1;
m_fRadius = Radius;
NewElement(m_hElement, m_Ns, m_Nt);
return TRUE;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : ITSphere3D::GetRadius()
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : return radius of ITSphere3D
// Author : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
GLI_tdxValue ITSphere3D::GetRadius()
{
return m_fRadius;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : ITSphere3D::SetSamplingRate
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : set sampling rate of ITSphere3D
// Author : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void ITSphere3D::SetSamplingRate(int Ns, int Nt)
{
if(Ns < 4) Ns = 4;
if(Nt < 4) Nt = 4;
if(Ns > 20) Ns = 20;
if(Nt > 20) Nt = 20;
m_Nt = Nt;
m_Ns = Ns;
NewElement(m_hElement, m_Ns, m_Nt);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : ITSphere3D::GetSamplingRate
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : return sampling rate of ITSphere3D
// Author : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void ITSphere3D::GetSamplingRate(int &Ns, int &Nt)
{
Nt = m_Nt;
Ns = m_Ns;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :ITSphere3D::_OnLButtonDblClk
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : launch the modal dialog
// Author : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL ITSphere3D::_OnLButtonDblClk (UINT nFlags, tdstMousePos *p_stPos, ACP_tdxIndex xIndex, HIE_tdstPickInfo *p_stPickInfo)
{
HINSTANCE hOldInst = AfxGetResourceHandle();
AfxSetResourceHandle ( ((CPA_DLLBase*)(GetEditor()))->GetDLLIdentity()->hModule );
CDlgITSphere dlg(m_fRadius,m_Ns, m_Nt, this);
BOOL retval = dlg.DoModal() == IDOK;
AfxSetResourceHandle(hOldInst);
return retval;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :ITSphere3D::_OnMouseMove
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : adjust the sphere size according to the mouse input
// Author : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL ITSphere3D::_OnMouseMove(UINT nFlags, tdstMousePos * p_stPos, MTH3D_tdstVector * pDeplacement)
{
if (Shape3D::_OnMouseMove (nFlags, p_stPos, pDeplacement))
{
// we make the movement
MTH3D_M_vAddVector (& m_stGlobalSelectedPoint ,
& m_stGlobalSelectedPoint , pDeplacement);
MTH3D_tdstVector RadiusVertex;
MTH3D_M_vSubVector (& RadiusVertex , & m_stGlobalSelectedPoint ,
& m_stCenterInMousePlane);
GLI_tdxValue NewRadius = MTH3D_M_xNormVector (& RadiusVertex);
SetRadius (NewRadius);
return TRUE;
}
else
return FALSE;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :ITSphere3D::_OnLButtonDown
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Init the resizing
// Author : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL ITSphere3D::_OnLButtonDown(UINT nFlags, tdstMousePos * p_stPos, ACP_tdxIndex xIndex, HIE_tdstPickInfo * p_stObject)
{
if (Shape3D::_OnLButtonDown(nFlags, p_stPos, xIndex, p_stObject))
{
// resizing is allowed
MTH3D_tdstVector SphereCenter;
// Compute coordinates in the global repere
ConvertPointLocalToGlobal (& SphereCenter, HIE_fn_hGetSuperObjectGlobalMatrix (m_pSuperObject->GetStruct ()) , & GetCenter ());
// Get the matrix of the camera
GLI_tdxHandleToCamera hHandleToCamera = m_pGeometry3DDLL->GetInterface () -> GetMultiDevice () -> GetFocusDevice () -> GetCamera ();
POS_tdstCompletePosition CameraMatrix , InvMatrix;
GLI_xGetCameraMatrix (hHandleToCamera , & CameraMatrix);
POS_fn_vInvertIsoMatrix(& InvMatrix , & CameraMatrix);
// Get the coordinates of the Z axe
MTH3D_tdstVector ZAxe , DummyVector;
POS_fn_vGetRotationMatrix(& InvMatrix , & DummyVector , & DummyVector , & ZAxe);
// Compute the sphere center, projected into the plane where the mouse moves into
MTH3D_M_vSubVector (& SphereCenter , & SphereCenter , & m_stGlobalSelectedPoint);
GLI_tdxValue DotProduct = MTH3D_M_xDotProductVector (& ZAxe , & SphereCenter);
MTH3D_M_vMulScalarVector (& ZAxe , DotProduct , & ZAxe);
MTH3D_M_vSubVector (& SphereCenter , & SphereCenter , & ZAxe);
MTH3D_M_vAddVector (& m_stCenterInMousePlane ,
& SphereCenter , & m_stGlobalSelectedPoint);
return TRUE;
}
else
return FALSE;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : mfn_vLoad
// Date : 98-01
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Cristian Stegaru - CPA2
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void ITSphere3D::mfn_vLoad (CString csEPOFile, CString csEPOName)
{
Shape3D::mfn_vLoad (csEPOFile, csEPOName);
char szRadius [NB_LENGTH], szNs [NB_LENGTH], szNt [NB_LENGTH];
BOOL bReadOK = GetPrivateProfileString (csEPOName, "RADIUS", NULL, szRadius, NB_LENGTH, csEPOFile);
float fRadius = (float)atof (szRadius);
SetRadius (fRadius);
bReadOK = bReadOK && GetPrivateProfileString (csEPOName, "NS", NULL, szNs, NB_LENGTH, csEPOFile);
int iNs = atoi (szNs);
bReadOK = bReadOK && GetPrivateProfileString (csEPOName, "NT", NULL, szNt, NB_LENGTH, csEPOFile);
int iNt = atoi (szNt);
SetSamplingRate (iNs, iNt);
ASSERT (bReadOK);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : mfn_vSave
// Date : 98-01
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Cristian Stegaru - CPA2
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void ITSphere3D::mfn_vSave (CString csEPOFile, CString csEPOName, int iIdx)
{
Shape3D::mfn_vSave (csEPOFile, csEPOName, iIdx);
char szRadius [NB_LENGTH], szNs [NB_LENGTH], szNt [NB_LENGTH];
itoa (m_Ns, szNs, 10);
BOOL bWriteOK = WritePrivateProfileString (csEPOName, "NS", szNs, csEPOFile);
itoa (m_Nt, szNt, 10);
bWriteOK = bWriteOK && WritePrivateProfileString (csEPOName, "NT", szNt, csEPOFile);
_gcvt (m_fRadius, 4, szRadius);
bWriteOK = bWriteOK && WritePrivateProfileString (csEPOName, "RADIUS", szRadius, csEPOFile);
ASSERT (bWriteOK);
}
//------------------------------------------ ITSphereUndo ---------------------------------------------
#define M_RedrawWorld() (((DEV_MultiDevice*)g_oFrameGest.ma_p_oWinArray[2][2]->GetActiveView())->DrawObject())
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :ITSphereUndo::ITSphereUndo
// Date : 98.01
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Init the undo data
// Author : N Suparatu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
ITSphereUndo::ITSphereUndo(ITSphere3D *sphere) : CPA_Modif(0, "Set Sphere Parameters", FALSE)
{
m_pSphere = sphere;
m_fRadius = m_pSphere->GetRadius();
m_pSphere->GetSamplingRate(m_Ns, m_Nt);
m_bFirst = TRUE;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :ITSphereUndo::Undo
// Date : 98.01
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : undo sphere parameters
// Author : N Suparatu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL ITSphereUndo::Undo()
{
m_bFirst = FALSE;
float r = m_pSphere->GetRadius();
int s, t;
m_pSphere->GetSamplingRate(s, t);
m_pSphere->SetRadius(m_fRadius);
m_pSphere->SetSamplingRate(m_Ns, m_Nt);
m_fRadius = r;
m_Ns = s;
m_Nt = t;
m_pSphere->fn_vNotifySaveObject();
M_RedrawWorld();
return TRUE;
}

View File

@@ -0,0 +1,303 @@
//ROMTEAM WorldEditor
////////////////////////////////////////////////////////////////////////////////////////
// File : IndexedTriangleView.cpp : implementation file
// Author :
// Date :
// Description :
////////////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ctriedit.h"
#include "ITView.h"
//ROMTEAM WorldEditor (Cristian Stegaru 11/97)
#include "ACP_Base.h"
#include "incITF.h" // interface
#include "incGAM.h"
#include "3DInterf.hpp"
#include "EdThread.h"
#include "EToolBar.h"
#include "ITFrame.h"
//ENDROMTEAM WorldEditor (Cristian Stegaru)
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CIndexedTriangleView
IMPLEMENT_DYNCREATE(CIndexedTriangleView, CView)
CIndexedTriangleView::CIndexedTriangleView()
{
m_edit = new CTriEdit;
}
CIndexedTriangleView::~CIndexedTriangleView()
{
delete m_edit;
}
BEGIN_MESSAGE_MAP(CIndexedTriangleView, CView)
//{{AFX_MSG_MAP(CIndexedTriangleView)
ON_WM_KEYDOWN()
ON_WM_SIZE()
ON_WM_ERASEBKGND()
ON_WM_SETCURSOR()
ON_WM_LBUTTONDOWN()
ON_WM_MOUSEMOVE()
ON_WM_LBUTTONUP()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CIndexedTriangleView drawing
void CIndexedTriangleView::OnDraw(CDC* pDC)
{
CDocument* pDoc = GetDocument();
// TODO: add draw code here
if(m_edit) m_edit->OnPaint(pDC->m_hDC);
}
/////////////////////////////////////////////////////////////////////////////
// CIndexedTriangleView diagnostics
#ifdef _DEBUG
void CIndexedTriangleView::AssertValid() const
{
CView::AssertValid();
}
void CIndexedTriangleView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CIndexedTriangleView message handlers
BOOL CIndexedTriangleView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Add your specialized code here and/or call the base class
return CView::PreCreateWindow(cs);
}
//Stegaru Cristian(SC)/November/97
void CIndexedTriangleView::SetLinearity(float l)
{
ASSERT (m_edit);
m_edit->SetLinearity (l);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : OnUndo()
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Cristian Stegaru
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CIndexedTriangleView::OnUndo()
{
ASSERT (m_edit);
m_edit->OnUndo();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : OnRedo()
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Cristian Stegaru
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CIndexedTriangleView::OnRedo()
{
ASSERT (m_edit);
m_edit->OnRedo();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : OnSave
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Cristian Stegaru
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CIndexedTriangleView::OnSave ()
{
ASSERT (m_edit);
CWinThread *pCurrentThread = AfxGetThread ();
ASSERT (pCurrentThread);
CIndexedTriangleFrame *pFrame = (CIndexedTriangleFrame*)GetParentFrame ();
ASSERT (pFrame);
((CEdThread*)pCurrentThread)->mfn_bCreateITObject (m_edit, pFrame->mfn_csGetITName ());
PostQuitMessage (0);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : OnHide
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Cristian Stegaru
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CIndexedTriangleView::OnHide (BOOL bHide)
{
ASSERT (m_edit);
m_edit->SetVisibility (bHide);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : OnExit
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Cristian Stegaru
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CIndexedTriangleView::OnExit ()
{
AfxEndThread (0);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : OnNewObject
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Cristian Stegaru
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CIndexedTriangleView::OnNewObject (int nX, int nY)
{
ASSERT (m_edit);
m_edit->InitMesh(nX, nY);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : CanUndo
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Cristian Stegaru
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
int CIndexedTriangleView::CanUndo ()
{
ASSERT (m_edit);
return m_edit->CanUndo ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : CanRedo
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Cristian Stegaru
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
int CIndexedTriangleView::CanRedo ()
{
ASSERT (m_edit);
return m_edit->CanRedo ();
}
BOOL CIndexedTriangleView::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
{
BOOL retval = CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
m_edit->SetHWnd(m_hWnd);
return retval;
}
void CIndexedTriangleView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
switch(nChar)
{ case VK_LEFT: m_edit->Rotate(-3, 0); break;
case VK_RIGHT: m_edit->Rotate(3, 0); break;
case VK_UP: m_edit->Rotate(0, -3); break;
case VK_DOWN: m_edit->Rotate(0, 3); break;
}
Invalidate();
CView::OnKeyDown(nChar, nRepCnt, nFlags);
}
void CIndexedTriangleView::OnSize(UINT nType, int cx, int cy)
{
CView::OnSize(nType, cx, cy);
m_edit->Resize(cx, cy);
}
BOOL CIndexedTriangleView::OnEraseBkgnd(CDC* pDC)
{
return TRUE;
return CView::OnEraseBkgnd(pDC);
}
BOOL CIndexedTriangleView::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
POINT p;
GetCursorPos(&p);
ScreenToClient(&p);
if(m_edit && m_edit->OnSetCursor(p.x, p.y))
{ SetCursor(AfxGetApp()->LoadStandardCursor(IDC_UPARROW));
return 1;
}
else return CView::OnSetCursor(pWnd, nHitTest, message);
}
void CIndexedTriangleView::OnLButtonDown(UINT nFlags, CPoint point)
{
m_edit->OnLButtonDown(nFlags, (POINT)point);
CView::OnLButtonDown(nFlags, point);
}
void CIndexedTriangleView::OnMouseMove(UINT nFlags, CPoint point)
{
if(m_edit && nFlags & MK_LBUTTON) m_edit->OnMouseMove(point);
CView::OnMouseMove(nFlags, point);
}
void CIndexedTriangleView::OnLButtonUp(UINT nFlags, CPoint point)
{
m_edit->OnLButtonUp(nFlags, point);
CView::OnLButtonUp(nFlags, point);
}

View File

@@ -0,0 +1,228 @@
//ROMTEAM WorldEditor
////////////////////////////////////////////////////////////////////////////////////////
// File : ITObject.cpp: implementation of the ITObject class.
// Author : Ionut Grozea
// Date : 97.11
// Description :
////////////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ACP_Base.h"
#include "ITF.h"
#include "incGAM.h"
#include "GLI.h"
#include "DPT.h"
#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
#include "OGD.h"
#undef CPA_WANTS_EXPORT
#ifndef CPA_WANTS_IMPORT
#define CPA_WANTS_IMPORT
#endif
#include "3dinterf.hpp"
#include "DlgObject.h"
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : ITObject3D::ITObject3D
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : constructor to create a new object
// Author : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification : add _csName in constructor
// Date : 97.12
// By : Cristian Stegaru
//////////////////////////////////////////////////////////////////////////////////////////////////////
ITObject3D::ITObject3D (CPA_EditorBase *_p_oEditor ,int vi_x ,int vi_y , float(* vf_Ver )[3] , WORD (*vf_IT)[3] , const CString _csName, tdeSaveStatus _eStatus)
: Shape3D (TRUE , _p_oEditor, vi_x*vi_y ,1 , _csName, _eStatus)
{
m_vi_x = vi_x ;
m_vi_y = vi_y;
CommonITObject3D ( vi_x , vi_y, vf_Ver , vf_IT);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : ITObject3D::CreateITObject3D
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : set vertices of ITObject3D
// Author : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void ITObject3D::CreateITObject3D(int vi_x ,int vi_y, float(* vf_Ver )[3] , WORD (*vf_IT)[3])
{
int i;
MTH3D_tdstVector *pa13_stPoint = new MTH3D_tdstVector[vi_x*vi_y];
for (i = 0 ; i<vi_x*vi_y; i++)
MTH3D_M_vSetVectorElements ( pa13_stPoint+i, vf_Ver[i][0]*10, vf_Ver[i][2]*10, vf_Ver[i][1]*10);
fn_vSetListOfPoints(vi_y*vi_x , pa13_stPoint);
delete[] pa13_stPoint;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : ITObject3D::CommonITObject3D
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : set texture vertices of ITObject3D
// Author : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void ITObject3D::CommonITObject3D(int vi_x ,int vi_y, float(* vf_Ver )[3] , WORD (*vf_IT)[3] )
{
int i,k,j;
CreateITObject3D( vi_x , vi_y, vf_Ver , vf_IT);
ACP_tdxHandleOfElement hElement = fn_hCreateElementIndexedTriangle((vi_x-1)*(vi_y-1)*2 , vi_x*vi_y);
for(i=k=0; i<vi_x; i++)
{
for(j=0; j<vi_y; j++ , k++)
{
ACP_tdst2DUVValues q = { (float)i/(vi_x-1),(float)j/(vi_y-1) };
GEO_vSetUVOfIndexedTriangles(GetStruct(), hElement, k, &q);
}
}
for (i = 0 ; i<(vi_x-1)*(vi_y-1)*2 ; i++)
{
fn_eSetIndexedTriangle ( hElement, i, vf_IT[i][0], vf_IT[i][1], vf_IT[i][2]);
GEO_vSetIndexedUVOfFaceOfIndexedTriangles( GetStruct(), hElement , i, vf_IT[i][0], vf_IT[i][1], vf_IT[i][2]);
}
fn_vInitElementSection( m_hElement );
GEO_vEndCreateObject ( GetStruct() );
GEO_vCreateObjectListOfPointsMaterial(GetStruct());
GEO_xCreateObjectListOfEdges(GetStruct());
}
ITObject3D::~ITObject3D()
{
}
ACP_tdxHandleOfElement ITObject3D::GetHElement()
{
return m_hElement;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :ITObject3D::_OnLButtonDblClk
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : launch the modal dialog
// Author : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL ITObject3D::_OnLButtonDblClk (UINT nFlags, tdstMousePos *p_stPos, ACP_tdxIndex xIndex, HIE_tdstPickInfo *p_stPickInfo)
{
HINSTANCE hOldInst = AfxGetResourceHandle();
AfxSetResourceHandle ( ((CPA_DLLBase*)(GetEditor()))->GetDLLIdentity()->hModule );
//problems
// CDlgObject dlg(this) ;
// if ( dlg.DoModal()==IDOK)
// {
// SetRadius(dlg.m_fRadius);
// SetSamplingRate(dlg.m_Nx, dlg.m_Ny);
// }
AfxSetResourceHandle(hOldInst);
return TRUE;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :ITObject3D::SetScaleX
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : set scale x of ITObject3D
// Author : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void ITObject3D::SetScaleX(float fScale)
{
int i;
MTH3D_tdstVector* p_stPoint = new MTH3D_tdstVector;
for ( i=0 ; i<m_vi_x*m_vi_y ; i++)
{
fn_vGetPoint( i, p_stPoint);
p_stPoint->xX = (p_stPoint->xX)*fScale;
fn_vSetPoint (i , p_stPoint);
}
delete[] p_stPoint;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :ITObject3D::SetScaleY
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : set scale y of ITObject3D
// Author : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void ITObject3D::SetScaleY(float fScale)
{
int i;
MTH3D_tdstVector* p_stPoint = new MTH3D_tdstVector;
for ( i=0 ; i<m_vi_x*m_vi_y ; i++)
{
fn_vGetPoint( i, p_stPoint);
p_stPoint->xY = (p_stPoint->xY)*fScale;
fn_vSetPoint (i , p_stPoint);
}
delete[] p_stPoint;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :ITObject3D::SetScaleY
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : set scale y of ITObject3D
// Author : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void ITObject3D::SetScaleZ(float fScale)
{
int i;
MTH3D_tdstVector* p_stPoint = new MTH3D_tdstVector;
for ( i=0 ; i<m_vi_x*m_vi_y ; i++)
{
MTH3D_tdstVector* p_stPoint = new MTH3D_tdstVector;
fn_vGetPoint( i, p_stPoint);
p_stPoint->xZ = (p_stPoint->xZ)*fScale;
fn_vSetPoint (i , p_stPoint);
}
delete[] p_stPoint;
}

View File

@@ -0,0 +1,110 @@
//ROMTEAM WorldEditor
////////////////////////////////////////////////////////////////////////////////////////
// File : Line3D.cpp: implementation file for the Line3D, Arc3D and Bezier3D classes
// Author : Viorel Preoteasa
// Date : 97.11
// Description :
////////////////////////////////////////////////////////////////////////////////////////
//
// The code for this classes come from the files Edi_Bez.cpp and Edi_Arc.cpp (OWP project)
// which implement global functions on structures which contain Bezier and Arc lines. I
// have writen 3 classes. The Line3D class implements the common things for Bezier
// Arc courves.
//
////////////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ACP_Base.h"
#include "ITF.h"
#include "incGAM.h"
#include "GLI.h"
#include "DPT.h"
#include "geo.h"
#include "gli.h"
#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
#include "OGD.h"
#undef CPA_WANTS_EXPORT
#define CPA_WANTS_IMPORT
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
Line3D::Line3D ()
{
}
Line3D::~Line3D()
{
if(m_dstListOfPoints)
{
free(*m_dstListOfPoints);
m_dstListOfPoints = NULL;
}
/* I disagree with following line, but since it was in the previous version :*/
if(m_pstDynaParams)
{
free(m_pstDynaParams);
m_pstDynaParams = NULL;
}
}
MTH3D_tdstVector *Line3D::GetListOfPoints()
{
if(m_ucObjectMode==EDWAY_C_ucModeNoObject)
return *m_dstListOfPoints;
else
return m_hGeometricObject->d_stListOfPoints;
}
void Line3D::Draw()
{
POS_tdstCompletePosition stMatrix;
GEO_tdstColor ColBidon;
MTH3D_tdstVector *p_stPointList;
MTH3D_tdstVector *p_stPointListEnd;
unsigned char ucSamplingRate;
POS_fn_vSetIdentityMatrix(&stMatrix);
/* unsigned long color; */
ColBidon.xR=(float)0.5;
ColBidon.xG=(float)0.5;
ColBidon.xB=(float)0.5;
ColBidon.xA=(float)0.5;
p_stPointList = GetListOfPoints();
if (!p_stPointList) return;
GLI_xGetCameraMatrix(((GLI_tdstSpecificAttributesFor3D*)(m_pstViewPortAttributes->p_vSpecificToXD))->p_stCam,&stMatrix);
ucSamplingRate = GetSamplingRate();
GLI_xLoadMatrix(&stMatrix);
GLI_vSetFog(100,100,200,&ColBidon);
p_stPointListEnd=p_stPointList+ucSamplingRate;
for (;p_stPointList<p_stPointListEnd;p_stPointList++)
{
GLI_xDraw3DLine16
(
(struct GLD_tdstViewportAttributes_*)(m_pstViewPortAttributes),
p_stPointList,
p_stPointList+1,
m_lColor
);
}
GLI_xPopMatrix();
}
void Line3D::GetPoint(unsigned char _ucSamplingNumber, MTH3D_tdstVector*_pstSampledPoint)
{
MTH3D_tdstVector *p_stPointList;
if(_pstSampledPoint == NULL ) return;
if(_ucSamplingNumber>GetSamplingRate())_ucSamplingNumber = GetSamplingRate();
p_stPointList = GetListOfPoints();
if(p_stPointList) *_pstSampledPoint = p_stPointList[_ucSamplingNumber];
}

View File

@@ -0,0 +1,89 @@
//ROMTEAM WorldEditor
////////////////////////////////////////////////////////////////////////////////////////
// File : Oktaedron3D.cpp: implementation of the Oktaedron3D class.
// Author : Ionut Grozea
// Date : 97.11
// Description :
////////////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ACP_Base.h"
#include "ITF.h"
#include "incGAM.h"
#include "GLI.h"
#include "DPT.h"
#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
#include "OGD.h"
#undef CPA_WANTS_EXPORT
#define CPA_WANTS_IMPORT
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : Oktaedron3D::Oktaedron3D
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : constructors to create a new object
// Author : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
Oktaedron3D::Oktaedron3D(BOOL bModifiable, CPA_EditorBase *_p_oEditor, ACP_tdxIndex xNbPoints, ACP_tdxIndex xNbElements, const CString _csName , tdeSaveStatus _eStatus )
: Shape3D (bModifiable, _p_oEditor, xNbPoints, xNbElements ,_csName , _eStatus)
{
CommonOktaedron3D();
}
Oktaedron3D::Oktaedron3D(BOOL bModifiable, CPA_EditorBase *_p_oEditor, ACP_tdxIndex xNbPoints, ACP_tdxIndex xNbElements, CPA_BaseObject *_p_oOwnerFile, const CString _csName /*= ""*/, char *_p_cRefPath /*= NULL*/, tdeSaveStatus _eStatus /*= E_ss_Responsible*/)
: Shape3D (bModifiable, _p_oEditor, xNbPoints, xNbElements, _p_oOwnerFile, _csName, _p_cRefPath, _eStatus)
{
CommonOktaedron3D();
}
Oktaedron3D::Oktaedron3D(BOOL bModifiable, CPA_EditorBase *_p_oEditor, CPA_BaseObject *_p_oOwnerFile, ACP_tdxHandleOfObject _hObject, const CString _csName /*= ""*/, char *_p_cRefPath /*= NULL*/, tdeSaveStatus _eStatus /*= E_ss_Modify*/)
: Shape3D (bModifiable, _p_oEditor, _p_oOwnerFile, _hObject, _csName, _p_cRefPath, _eStatus)
{
CommonOktaedron3D();
}
void Oktaedron3D::CommonOktaedron3D()
{
MTH3D_tdstVector a6_stPoint [6];
MTH3D_M_vSetVectorElements ( a6_stPoint, -0.4f, 0.f, -0.4f);
MTH3D_M_vSetVectorElements ( a6_stPoint+1, 0.4f, 0.f, -0.4f);
MTH3D_M_vSetVectorElements ( a6_stPoint+2, 0.4f, 0.f, 0.4f);
MTH3D_M_vSetVectorElements ( a6_stPoint+3, -0.4f, 0.f, 0.4f);
MTH3D_M_vSetVectorElements ( a6_stPoint+4, 0.f, -0.4f, 0.f);
MTH3D_M_vSetVectorElements ( a6_stPoint+5, 0.f, 0.4f, 0.f);
this->fn_vSetListOfPoints(6, a6_stPoint);
ACP_tdxHandleOfElement hElement = this->fn_hCreateElementIndexedTriangle(8,0);
this->fn_eSetIndexedTriangle ( hElement, 0, 0, 1, 4 );
this->fn_eSetIndexedTriangle ( hElement, 1, 1, 2, 4 );
this->fn_eSetIndexedTriangle ( hElement, 2, 2, 3, 4 );
this->fn_eSetIndexedTriangle ( hElement, 3, 3, 0, 4 );
this->fn_eSetIndexedTriangle ( hElement, 4, 1, 0, 5 );
this->fn_eSetIndexedTriangle ( hElement, 5, 2, 1, 5 );
this->fn_eSetIndexedTriangle ( hElement, 6, 3, 2, 5 );
this->fn_eSetIndexedTriangle ( hElement, 7, 0, 3, 5 );
fn_vInitElementSection( m_hElement );
EndCreate();
}
Oktaedron3D::~Oktaedron3D()
{
}

View File

@@ -0,0 +1,217 @@
//ROMTEAM WorldEditor
////////////////////////////////////////////////////////////////////////////////////////
// File : ParamSurface3D.cpp: implementation of the ParamSurface3Dclass.
// Author : Viorel Preoteasa
// Date : 97.11
// Description :
////////////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ACP_Base.h"
#include "ITF.h"
#include "incGAM.h"
#include "GLI.h"
#include "DPT.h"
#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
#include "OGD.h"
#undef CPA_WANTS_EXPORT
#ifndef CPA_WANTS_IMPORT
#define CPA_WANTS_IMPORT
#endif
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : Construction/Destruction of ParamSurface3D
// Date : 97-11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Viorel Preoteasa - CPA2
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
ParamSurface3D::ParamSurface3D (BOOL bModifiable, CPA_EditorBase *_p_oEditor, ACP_tdxIndex xNbPoints, ACP_tdxIndex xNbElements, const CString _csName, tdeSaveStatus _eStatus)
: Shape3D (bModifiable, _p_oEditor, xNbPoints, xNbElements, _csName, _eStatus)
{
CommonParamSurface3D();
}
ParamSurface3D::ParamSurface3D (BOOL bModifiable, CPA_EditorBase *_p_oEditor, ACP_tdxIndex xNbPoints, ACP_tdxIndex xNbElements, CPA_BaseObject *_p_oOwnerFile, const CString _csName, char *_p_cRefPath, tdeSaveStatus _eStatus)
: Shape3D(bModifiable, _p_oEditor, xNbPoints, xNbElements, _p_oOwnerFile, _csName, _p_cRefPath, _eStatus)
{
CommonParamSurface3D();
}
ParamSurface3D::ParamSurface3D (BOOL bModifiable, CPA_EditorBase *_p_oEditor, CPA_BaseObject *_p_oOwnerFile, ACP_tdxHandleOfObject _hObject, const CString _csName, char *_p_cRefPath, tdeSaveStatus _eStatus)
: Shape3D (bModifiable, _p_oEditor, _p_oOwnerFile, _hObject, _csName, _p_cRefPath, _eStatus)
{
CommonParamSurface3D();
}
ParamSurface3D::~ParamSurface3D()
{
if(GetStruct()->d_stListOfPoints) free(GetStruct()->d_stListOfPoints);
if(GetStruct()->d_stListOfPointsNormals) free(GetStruct()->d_stListOfPointsNormals);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : ParamSurface3D
// Date : 97-11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Common initialisation
// Author : Viorel Preoteasa - CPA2
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void ParamSurface3D::CommonParamSurface3D()
{
m_IndexTriangleNb = 0;
GetStruct()->xNbPoints = 0;
GetStruct()->d_stListOfPoints = NULL;
GetStruct()->d_stListOfPointsNormals = NULL;
//ROMTEAM WorldEditor (Cristian Stegaru 12/97)
m_bFirstInit = TRUE;
//ENDROMTEAM WorldEditor (Cristian Stegaru)
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : Dist
// Date : 97-11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : the distance between two points.
// Author : Viorel Preoteasa - CPA2
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
float ParamSurface3D::Dist(MTH3D_tdstVector &a, MTH3D_tdstVector &b)
{
return (float)(fabs(a.xX-b.xX)+fabs(a.xY-b.xY)+fabs(a.xZ-b.xZ));
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : NewElement
// Date : 97-11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : calculation of object points and triangles from parametrisation.
// Author : Viorel Preoteasa - CPA2
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
ACP_tdxHandleOfElement ParamSurface3D::NewElement(ACP_tdxHandleOfElement hElement, int ns, int nt)
{
int i,j,k,l,m, Nb_T;
float t, s, ds, dt;
float s0=0, s1=1, t0=0, t1=1;
GEO_tdstGeometricObject *U = GetStruct();
GMT_tdxHandleToGameMaterial hMaterial=NULL;
MTH3D_tdstVector *stPoint = (MTH3D_tdstVector *)malloc(ns*nt*sizeof(MTH3D_tdstVector));
int *Pos = (int *)malloc(ns*nt*sizeof(int));
int *New_Point = (int *)malloc(ns*nt*sizeof(int));
ds = (s1-s0)/(ns-1);
dt = (t1-t0)/(nt-1);
s = s0;
for(i=0, k=0, m=0; i<ns; i++)
{
t = t0;
for(j=0; j<nt; j++)
{
MTH3D_M_vSetVectorElements ( stPoint+k, x(s, t), y(s, t), z(s, t));
for(l=0; Dist(stPoint[l], stPoint[k])>0.00001; l++);
if(l==k)
{
New_Point[m] = k;
Pos[k] = m;
m++;
}
else
Pos[k] = Pos[l];
t += dt;
k++;
}
s += ds;
}
for(i=0, k=0, Nb_T=0; i<ns-1; i++)
for(j=0; j<nt-1; j++)
{
if((Pos[i*nt+j+1]!=Pos[i*nt+j]) && (Pos[i*nt+j]!=Pos[(i+1)*nt+j]) && (Pos[(i+1)*nt+j]!=Pos[i*nt+j+1]))Nb_T++;
if((Pos[(i+1)*nt+j+1]!=Pos[i*nt+j+1]) && (Pos[i*nt+j+1]!=Pos[(i+1)*nt+j]) && (Pos[(i+1)*nt+j]!=Pos[(i+1)*nt+j+1]))Nb_T++;
}
if(m != U->xNbPoints)
{
if(U->d_stListOfPoints) free(U->d_stListOfPoints);
U->d_stListOfPoints = (MTH3D_tdstVector *)malloc(m*sizeof(MTH3D_tdstVector));
memset(U->d_stListOfPoints, 0, m*sizeof(MTH3D_tdstVector));
}
if(U->d_xListOfElementsTypes[0])
GEO_vGetGameMaterialOfIndexedTriangles (GetStruct(), hElement , &hMaterial);
if((m != U->xNbPoints) || (m_IndexTriangleNb!=Nb_T))
{
U->d_stListOfElements[0] = NULL;
U->d_xListOfElementsTypes[0] = NULL;
//ROMTEAM WorldEditor (Cristian Stegaru 12/97)
if (m_bFirstInit)
{
m_bFirstInit = FALSE;
hElement = fn_hCreateElementIndexedTriangle(Nb_T, m);
}
else
{
GEO_vCreateElementIndexedTriangles (GetStruct(), &hElement, Nb_T, m);
// default mat<61>rial
fn_vSetEngineGameMaterial(hElement,0, fn_hGetDefaultGameMaterial() );
}
//ENDROMTEAM WorldEditor (Cristian Stegaru)
U->xNbPoints = m;
m_IndexTriangleNb = Nb_T;
}
for(i=0; i<m; i++)
{
MTH3D_M_vSetVectorElements (stPoint+i, stPoint[New_Point[i]].xX, stPoint[New_Point[i]].xY, stPoint[New_Point[i]].xZ);
ACP_tdst2DUVValues q = { ds*(New_Point[i]/nt), dt*(New_Point[i]%nt) };
GEO_vSetUVOfIndexedTriangles(GetStruct(), hElement, i, &q);
}
fn_vSetListOfPoints(m, stPoint);
for(i=0, k=0; i<ns-1; i++)
for(j=0; j<nt-1; j++)
{
if((Pos[i*nt+j+1]!=Pos[i*nt+j]) && (Pos[i*nt+j]!=Pos[(i+1)*nt+j]) && (Pos[(i+1)*nt+j]!=Pos[i*nt+j+1]))
{
fn_eSetIndexedTriangle ( hElement, k, Pos[i*nt+j+1], Pos[i*nt+j], Pos[(i+1)*nt+j]);
GEO_vSetIndexedUVOfFaceOfIndexedTriangles( GetStruct(), hElement, k, Pos[i*nt+j+1], Pos[i*nt+j], Pos[(i+1)*nt+j]);
k++;
}
if((Pos[(i+1)*nt+j+1]!=Pos[i*nt+j+1]) && (Pos[i*nt+j+1]!=Pos[(i+1)*nt+j]) && (Pos[(i+1)*nt+j]!=Pos[(i+1)*nt+j+1]))
{
fn_eSetIndexedTriangle ( hElement, k, Pos[(i+1)*nt+j+1], Pos[i*nt+j+1], Pos[(i+1)*nt+j]);
GEO_vSetIndexedUVOfFaceOfIndexedTriangles( GetStruct(), hElement, k, Pos[(i+1)*nt+j+1], Pos[i*nt+j+1], Pos[(i+1)*nt+j]);
k++;
}
}
free(stPoint);
free(Pos);
free(New_Point);
if(hMaterial)
GEO_vSetGameMaterialOfIndexedTriangles (GetStruct(), hElement , hMaterial);
EndCreate();
return hElement;
}

View File

@@ -0,0 +1,121 @@
//ROMTEAM WorldEditor
////////////////////////////////////////////////////////////////////////////////////////
// File : Plane3D.cpp: implementation of the Plane3D class.
// Author : Viorel Preoteasa
// Date : 97.11
// Description :
////////////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ACP_Base.h"
#include "ITF.h"
#include "incGAM.h"
#include "GLI.h"
#include "DPT.h"
#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
#include "OGD.h"
#undef CPA_WANTS_EXPORT
#ifndef CPA_WANTS_IMPORT
#define CPA_WANTS_IMPORT
#endif
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : Construction/Destruction of Plane3D
// Date : 97-11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Viorel Preoteasa - CPA2
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
Plane3D::Plane3D (BOOL bModifiable, CPA_EditorBase *_p_oEditor, /*ACP_tdxIndex xNbPoints, ACP_tdxIndex xNbElements,*/ const CString _csName , tdeSaveStatus _eStatus )
: Shape3D (bModifiable, _p_oEditor, 24, 3, _csName , _eStatus)
{
CommonPlane3D ();
}
Plane3D::Plane3D (BOOL bModifiable, CPA_EditorBase *_p_oEditor, /*ACP_tdxIndex xNbPoints, ACP_tdxIndex xNbElements,*/ CPA_BaseObject *_p_oOwnerFile, const CString _csName /*= ""*/, char *_p_cRefPath /*= NULL*/, tdeSaveStatus _eStatus /*= E_ss_Responsible*/)
: Shape3D (bModifiable, _p_oEditor, 24, 3, _p_oOwnerFile, _csName, _p_cRefPath, _eStatus)
{
CommonPlane3D ();
}
Plane3D::Plane3D (BOOL bModifiable, CPA_EditorBase *_p_oEditor, CPA_BaseObject *_p_oOwnerFile, ACP_tdxHandleOfObject _hObject, const CString _csName /*= ""*/, char *_p_cRefPath /*= NULL*/, tdeSaveStatus _eStatus /*= E_ss_Modify*/)
: Shape3D (bModifiable, _p_oEditor, _p_oOwnerFile, _hObject, _csName, _p_cRefPath, _eStatus)
{
CommonPlane3D ();
}
Plane3D::~Plane3D()
{
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : Plane3D
// Date : 97-11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Common initialisation
// Author : Viorel Preoteasa - CPA2
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void Plane3D::CommonPlane3D()
{
MTH3D_tdstVector a8_stPoint [24];
for ( int iCounter=0; iCounter<24; iCounter++ )
MTH3D_M_vSetVectorElements ( a8_stPoint+iCounter, 0.0, 0.0, 0.0 );
fn_vSetListOfPoints(24, a8_stPoint);
m_hElement[0] = fn_hCreateElementIndexedTriangle(4,0);
fn_eSetIndexedTriangle ( m_hElement[0], 0, 0, 1, 3 );
fn_eSetIndexedTriangle ( m_hElement[0], 1, 1, 2, 3 );
fn_eSetIndexedTriangle ( m_hElement[0], 2, 4, 7, 5 );
fn_eSetIndexedTriangle ( m_hElement[0], 3, 6, 5, 7 );
m_hElement[1] = fn_hCreateElementIndexedTriangle(12,0);
fn_eSetIndexedTriangle ( m_hElement[1], 0, 0, 4, 11 );
fn_eSetIndexedTriangle ( m_hElement[1], 1, 4, 15, 11 );
fn_eSetIndexedTriangle ( m_hElement[1], 2, 14, 5, 1 );
fn_eSetIndexedTriangle ( m_hElement[1], 3, 10, 14, 1 );
fn_eSetIndexedTriangle ( m_hElement[1], 4, 1, 5, 6 );
fn_eSetIndexedTriangle ( m_hElement[1], 5, 1, 6, 2 );
fn_eSetIndexedTriangle ( m_hElement[1], 6, 3, 20, 7 );
fn_eSetIndexedTriangle ( m_hElement[1], 7, 3, 16, 20 );
fn_eSetIndexedTriangle ( m_hElement[1], 8, 17, 6, 21 );
fn_eSetIndexedTriangle ( m_hElement[1], 9, 17, 2, 6 );
fn_eSetIndexedTriangle ( m_hElement[1], 10, 0, 3, 7 );
fn_eSetIndexedTriangle ( m_hElement[1], 11, 7, 4, 0 );
m_hElement[2] = fn_hCreateElementIndexedTriangle(20,0);
fn_eSetIndexedTriangle ( m_hElement[2], 0, 8, 9, 11 );
fn_eSetIndexedTriangle ( m_hElement[2], 1, 9, 10, 11 );
fn_eSetIndexedTriangle ( m_hElement[2], 2, 12, 13, 9 );
fn_eSetIndexedTriangle ( m_hElement[2], 3, 9, 8, 12 );
fn_eSetIndexedTriangle ( m_hElement[2], 4, 9, 13, 14 );
fn_eSetIndexedTriangle ( m_hElement[2], 5, 9, 14, 10 );
fn_eSetIndexedTriangle ( m_hElement[2], 6, 13, 12, 15 );
fn_eSetIndexedTriangle ( m_hElement[2], 7, 13, 15, 14 );
fn_eSetIndexedTriangle ( m_hElement[2], 8, 8, 11, 15 );
fn_eSetIndexedTriangle ( m_hElement[2], 9, 15, 12, 8 );
fn_eSetIndexedTriangle ( m_hElement[2], 10, 16, 17, 19 );
fn_eSetIndexedTriangle ( m_hElement[2], 11, 17, 18, 19 );
fn_eSetIndexedTriangle ( m_hElement[2], 12, 20, 23, 21 );
fn_eSetIndexedTriangle ( m_hElement[2], 13, 21, 23, 22 );
fn_eSetIndexedTriangle ( m_hElement[2], 14, 17, 22, 18 );
fn_eSetIndexedTriangle ( m_hElement[2], 15, 17, 21, 22 );
fn_eSetIndexedTriangle ( m_hElement[2], 16, 16, 19, 23 );
fn_eSetIndexedTriangle ( m_hElement[2], 17, 16, 23, 20 );
fn_eSetIndexedTriangle ( m_hElement[2], 18, 19, 18, 23 );
fn_eSetIndexedTriangle ( m_hElement[2], 19, 18, 22, 23 );
EndCreate();
}

View File

@@ -0,0 +1,238 @@
//ROMTEAM WorldEditor
////////////////////////////////////////////////////////////////////////////////////////
// File : Point3D.cpp: implementation of the Point3D class.
// Author : Cristi Petrescu
// Date : 97.11
// Description :
////////////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ACP_Base.h"
#include "ITF.h"
#include "incGAM.h"
#include "GLI.h"
#include "DPT.h"
#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
#include "OGD.h"
#undef CPA_WANTS_EXPORT
#ifndef CPA_WANTS_IMPORT
#define CPA_WANTS_IMPORT
#endif
#include "3dinterf.hpp"
#include "DlgPnt3D.hpp"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : Point3D::Point3D
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : constructors to create a new object
// make one for each Geometry3D one. No general constructor :-(
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
Point3D::Point3D (CPA_EditorBase *_p_oEditor, /*ACP_tdxIndex xNbPoints, ACP_tdxIndex xNbElements,*/ const CString _csName , tdeSaveStatus _eStatus )
: Shape3D (FALSE, _p_oEditor, 1, 1, _csName , _eStatus)
{
CommonPoint3D ();
}
Point3D::Point3D (CPA_EditorBase *_p_oEditor, /*ACP_tdxIndex xNbPoints, ACP_tdxIndex xNbElements,*/ CPA_BaseObject *_p_oOwnerFile, const CString _csName /*= ""*/, char *_p_cRefPath /*= NULL*/, tdeSaveStatus _eStatus /*= E_ss_Responsible*/)
: Shape3D (FALSE, _p_oEditor, 1, 1, _p_oOwnerFile, _csName, _p_cRefPath, _eStatus)
{
CommonPoint3D ();
}
/****????*****///rezolvat ?? ionut
Point3D::Point3D (CPA_EditorBase *_p_oEditor, CPA_BaseObject *_p_oOwnerFile, ACP_tdxHandleOfObject _hObject, const CString _csName /*= ""*/, char *_p_cRefPath /*= NULL*/, tdeSaveStatus _eStatus /*= E_ss_Modify*/)
: Shape3D (FALSE, _p_oEditor, _p_oOwnerFile, _hObject, _csName, _p_cRefPath, _eStatus)
{
// this seems to be used at load time.
// so do not alter the data!
// CommonPoint3D ();
}
// ----------------------------------------------------------------------------
// Description : common implementation for the constructors
// ----------------------------------------------------------------------------
void Point3D::CommonPoint3D( )
{
// initialise with dummy data
MTH3D_tdstVector stPoint = { 0 , 0 , 0 };
fn_vSetListOfPoints (1 , & stPoint);
m_hElement = fn_hCreateElementPoints (1);
fn_eSetIndexedPoint (m_hElement , 0 , 0);
fn_eSetFatnessOfElementPoint (m_hElement , (float) 8.0);
fn_vEndCreation ();
}
Point3D::~Point3D()
{
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Point3D : GetPoint
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : return the 3D coordinates of the point
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
MTH3D_tdstVector Point3D::GetPoint ()
{
MTH3D_tdstVector stPoint;
fn_vGetPoint (0 , & stPoint);
return stPoint;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Point3D : SetPoint
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : set the 3D coordinates of the point
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void Point3D::SetPoint (MTH3D_tdstVector * _pPoint)
{
fn_vSetPoint (0 , _pPoint);
//UpdateTestPointPosition ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Point3D : SetPointX
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : set the X coordinate of the point
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void Point3D::SetPointX (GLI_tdxValue _X)
{
MTH3D_tdstVector stPoint = GetPoint ();
MTH3D_M_vSetXofVector (& stPoint , _X);
SetPoint (& stPoint);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Point3D : SetPointY
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : set the Y coordinate of the point
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void Point3D::SetPointY (GLI_tdxValue _Y)
{
MTH3D_tdstVector stPoint = GetPoint ();
MTH3D_M_vSetYofVector (& stPoint , _Y);
SetPoint (& stPoint);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Point3D : SetPointZ
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : set the Z coordinate of the point
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void Point3D::SetPointZ (GLI_tdxValue _Z)
{
MTH3D_tdstVector stPoint = GetPoint ();
MTH3D_M_vSetZofVector (& stPoint , _Z);
SetPoint (& stPoint);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Point3D - SetColorOfPoint
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Set the color of the point : selected or not selected
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void Point3D::SetColorOfPoint (BOOL _bSelected)
{
GMT_tdxHandleToGameMaterial hGameMaterial = GEO_xGetGameMaterialOfElementPoints
((ACP_tdxHandleOfObject) GetData () , m_hElement);
ACP_tdxHandleOfMaterial hVisualMaterial = GMT_fn_hGetVisualMaterial (hGameMaterial);
GEO_tdstColor stColor;
if (_bSelected) // selected -> pink
{
stColor . xR = 1.0;
stColor . xG = 0.5;
stColor . xB = 1.0;
}
else // not selected -> white
{
stColor . xR = 1.0;
stColor . xG = 1.0;
stColor . xB = 1.0;
}
stColor . xA = 1.0;
GLI_xSetMaterialColor (hVisualMaterial , & stColor);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Point3D - _OnLButtonDblClk
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : launch the modal dialog
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL Point3D::_OnLButtonDblClk (UINT nFlags, tdstMousePos *p_stPos, ACP_tdxIndex xIndex, HIE_tdstPickInfo *p_stPickInfo)
{
int iDlgResult;
HINSTANCE hOldInst = AfxGetResourceHandle();
AfxSetResourceHandle ( ((CPA_DLLBase*)(GetEditor()))->GetDLLIdentity()->hModule );
CDlgPoint3D dlgPoint3D(this);
iDlgResult = dlgPoint3D.DoModal();
AfxSetResourceHandle(hOldInst);
if (iDlgResult == IDOK)
return TRUE;
else
return FALSE;
}

View File

@@ -0,0 +1,944 @@
/*
*=======================================================================================
* Name :Save.c
*
* Author : Date :25/04/97
*
* Description :
*=======================================================================================
* Modification -> Author : Date :
* Description :
*=======================================================================================
*/
/*---------------------------------------------*/
#include "stdafx.h"
#include "ACP_Base.h"
#include "ITF.h"
#include "GMT.h"
#include "GEO.h"
#include "GLI.h"
#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
#include "OGD.h"
#undef CPA_WANTS_EXPORT
#define CPA_WANTS_IMPORT
#include "save.h"
/*---------------------------------------------*/
/*
*=======================================================================================
* GLOBALS
*=======================================================================================
*/
/*
char *g_szElementTypeName[] =
{
"",
"IndexedTriangles",
"FaceMapDescriptors",
"Sprites",
"TMeshes",
"Points",
"Lines",
"Spheres",
"AlignedBoxes",
"Cones"
};
*/
/*
*=======================================================================================
* TYPEDEF
*=======================================================================================
*/
typedef char xString[256];
/*
*=======================================================================================
* FUNCTIONS
*=======================================================================================
*/
/*
double GLI_dGetUnitInFile( SCR_tdst_File_Description *p_stFile )
{
double dUnit = 1;
SCR_M_RdL0_GetFileDouble( 0, 1,dUnit );
if (dUnit == 0)
dUnit = 1.0;
// return unit found
return dUnit;
}
*/
/*
----------------------------------------------------------------------------------------
Description : save a geometric object description
p_stFile -> Script file description
p_stGeometric -> pointer on geometric object that is to be saved
----------------------------------------------------------------------------------------
*/
/*
void GLI_vSaveGeometricObject(SCR_tdst_File_Description *p_stFile, GEO_tdstGeometricObject *p_stGeometric, void *pEditorObject)
{
Geometry3D *pObject = (Geometry3D *)pEditorObject;
CString csSectionName;
xString mes, sFile, sAction, sIdent, sSection;
char *p_cName;
long i;
double dUnit;
// Get unit from script file
dUnit = GLI_dGetUnitInFile( p_stFile );
// get section name of object
// p_cName = GLI_p_cSearchValueInLinkTableOfGeometric((unsigned long)p_stGeometric);
// if(p_cName == NULL)
// return;
// SCR_fn_v_RdL0_SplitSectionName(p_cName, sFile, sAction, sIdent);
// sprintf(sSection, "%s:%s", sAction, sIdent);
csSectionName = pObject->GetCompleteSectionName();
SCR_fn_v_RdL0_SplitSectionName((char*)(LPCSTR) csSectionName, sFile, sAction, sIdent);
SCR_fn_v_RdL0_ComputeSectionName(sSection, NULL, sAction, sIdent);
// write beginning of section
sprintf
(
mes,
"%d,%d,%d",
p_stGeometric->xNbPoints,
0, //p_stGeometric->xNbEdges,
p_stGeometric->xNbElements
);
SCR_M_SvL0_SaveBeginSection(p_stFile, sSection, SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1, mes);
// write list of points
for(i=0; i<p_stGeometric->xNbPoints; i++)
{
sprintf
(
mes,
"%d,%.6f,%.6f,%.6f,%.6f,%.6f,%.6f,%.1f,%.1f,%.1f",
i,
p_stGeometric->d_stListOfPoints[i].xX / dUnit,
p_stGeometric->d_stListOfPoints[i].xY / dUnit,
p_stGeometric->d_stListOfPoints[i].xZ / dUnit,
p_stGeometric->d_stListOfPointsNormals[i].xX,
p_stGeometric->d_stListOfPointsNormals[i].xY,
p_stGeometric->d_stListOfPointsNormals[i].xZ,
p_stGeometric->d_stListOfPointsReceivedLightIntensity[i].xR,
p_stGeometric->d_stListOfPointsReceivedLightIntensity[i].xG,
p_stGeometric->d_stListOfPointsReceivedLightIntensity[i].xB
);
SCR_M_SvL0_SaveEntry(p_stFile, "AddVertex", SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1, mes);
}
// write list of elements
for(i=0; i<p_stGeometric->xNbElements; i++)
{
p_cName = GLI_p_cSearchValueInLinkTableOfGeometric((unsigned long)p_stGeometric->d_stListOfElements[i]);
if(p_cName == NULL)
return;
sprintf( mes, "%d,%s,%s", i, g_szElementTypeName[ p_stGeometric->d_xListOfElementsTypes[i] ], p_cName );
SCR_M_SvL0_SaveEntry(p_stFile, "AddElement", SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1, mes);
}
// write end section
SCR_M_SvL0_SaveEndSection(p_stFile, SCR_CC_C_Cfg_EOL);
}
*/
/*
----------------------------------------------------------------------------------------
Description : save visual material section
p_stFile -> script file descriptor
p_stMaterial -> pointer on material to save
----------------------------------------------------------------------------------------
*/
void GLI_vSaveVisualMaterial(SCR_tdst_File_Description *p_stFile, ACP_tdxHandleOfMaterial hMaterial)
{
xString mes,sAction, sIdent, sSection, sFile;
ACP_tdxIndex xType;
char *p_cName;
GEO_tdstColor stColor;
long lSpecularExponent;
GLI_tdstTexture *p_stTexture;
p_cName = GLI_p_cSearchValueInLinkTableOfGeometric((unsigned long) hMaterial);
if(p_cName == NULL)
return;
/*
* save beginning of section
*/
SCR_fn_v_RdL0_SplitSectionName(p_cName, sFile, sAction, sIdent);
sprintf(sSection, "%s:%s", sAction, sIdent);
SCR_M_SvL0_SaveBeginSection(p_stFile, sSection, SCR_CC_C_Cfg_EOL);
/*
* save type entry
*/
GLI_xGetMaterialType(hMaterial, &xType);
if(xType == C_lGouraudElement)
sprintf(mes, "Gouraud");
else if(xType == C_lGouraudElement - GLI_C_lIsGouraud)
sprintf(mes, "Flat");
else
sprintf(mes, "Gouraud");
SCR_M_SvL0_SaveEntry(p_stFile, "Type", SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1, mes);
/*
* save ambient color
*/
GLI_xGetMaterialAmbientCoef ( hMaterial , &stColor );
sprintf
(
mes,
"%.6f,%.6f,%.6f",
stColor.xR,
stColor.xG,
stColor.xB
);
SCR_M_SvL0_SaveEntry(p_stFile, "AmbientColor", SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1, mes);
/*
* save diffuse color
*/
GLI_xGetMaterialDiffuseCoef( hMaterial , &stColor );
sprintf
(
mes,
"%.6f,%.6f,%.6f",
stColor.xR,
stColor.xG,
stColor.xB
);
SCR_M_SvL0_SaveEntry(p_stFile, "DiffuseColor", SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1, mes);
/*
* save specular color
*/
GLI_xGetMaterialSpecularCoef( hMaterial, &lSpecularExponent, &stColor );
sprintf
(
mes,
"%.6f,%.6f,%.6f,%.6f",
stColor.xR,
stColor.xG,
stColor.xB,
lSpecularExponent
);
SCR_M_SvL0_SaveEntry(p_stFile, "SpecularColor", SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1, mes);
/*
* save texture entry
*/
GLI_xGetMaterialTexture( hMaterial, &p_stTexture );
p_cName = GLI_p_cSearchValueInLinkTableOfGeometric((unsigned long) p_stTexture);
if(p_cName != NULL)
{
SCR_M_SvL0_SaveEntry(p_stFile, "Texture", SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1, p_cName);
}
/*
* save end of section
*/
SCR_M_SvL0_SaveEndSection(p_stFile, SCR_CC_C_Cfg_EOL);
}
/*
----------------------------------------------------------------------------------------
Description : save an element indexed triangles section
p_stFile -> script file descriptor
p_stElement -> pointer on element
----------------------------------------------------------------------------------------
*/
/*
void GLI_vSaveElementIndexedTriangle(SCR_tdst_File_Description *p_stFile, GEO_tdstElementIndexedTriangles *p_stElement)
{
xString mes, sFile, sAction, sIdent, sSection;
char *p_cName;
long i;
p_cName = GLI_p_cSearchValueInLinkTableOfGeometric((unsigned long)p_stElement);
if(p_cName == NULL)
return;
// write section beginning
SCR_fn_v_RdL0_SplitSectionName(p_cName, sFile, sAction, sIdent);
sprintf(sSection, "%s:%s", sAction, sIdent);
sprintf(mes, "%d,%d", p_stElement->xNbFaces,p_stElement->xNbElementUV);
SCR_M_SvL0_SaveBeginSection(p_stFile, sSection, SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1, mes);
// saving material entry
SCR_tdst_Link_Table *p_stTable = GMT_fn_p_stGetLinkTable();
p_cName = SCR_M_p_sz_Link_GetKey(SCR_fnp_st_Link_SearchValue(p_stTable, (unsigned long) p_stElement->hMaterial));
if(p_cName != NULL)
{
SCR_M_SvL0_SaveEntry(p_stFile, "Material", SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1, p_cName);
}
// saving faces
for(i=0; i<p_stElement->xNbFaces; i++)
{
sprintf
(
mes,
"%d,%d,%d,%d,%.6f,%.6f,%.6f,%d,%d,%d",
i,
p_stElement->d_stListOfFacesTripled[i].a3_xIndex[0],
p_stElement->d_stListOfFacesTripled[i].a3_xIndex[1],
p_stElement->d_stListOfFacesTripled[i].a3_xIndex[2],
p_stElement->d_stListOfFacesNormals[i].xX,
p_stElement->d_stListOfFacesNormals[i].xY,
p_stElement->d_stListOfFacesNormals[i].xZ,
p_stElement->d_stListOfFacesTripledIndexUV[i].a3_xIndex[0],
p_stElement->d_stListOfFacesTripledIndexUV[i].a3_xIndex[1],
p_stElement->d_stListOfFacesTripledIndexUV[i].a3_xIndex[2]
);
SCR_M_SvL0_SaveEntry(p_stFile, "AddFaceUV", SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1, mes);
}
// saving list of uv
for(i=0; i<p_stElement->xNbElementUV; i++)
{
sprintf
(
mes,
"%d,%.6f,%.6f",
i,
p_stElement->d_stListOfElementUV[i].xU,
p_stElement->d_stListOfElementUV[i].xV
);
SCR_M_SvL0_SaveEntry(p_stFile, "AddUV", SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1, mes);
}
// end of section
SCR_M_SvL0_SaveEndSection(p_stFile, SCR_CC_C_Cfg_EOL);
}
*/
/*
----------------------------------------------------------------------------------------
Description : save a face map descriptor section
p_stFile -> script file description
hFMD -> pointer on face face descriptor
----------------------------------------------------------------------------------------
*/
void GLI_vSaveFaceMapDescriptor(SCR_tdst_File_Description *p_stFile, GEO_tdstFaceMapDescriptor *hFMD)
{
xString mes, sFile, sAction, sIdent, sSection;
char *p_cName;
p_cName = GLI_p_cSearchValueInLinkTableOfGeometric((unsigned long)hFMD);
if(p_cName == NULL)
return;
/*
* save beginning of section
*/
SCR_fn_v_RdL0_SplitSectionName(p_cName, sFile, sAction, sIdent);
sprintf(sSection, "%s:%s", sAction, sIdent);
SCR_M_SvL0_SaveBeginSection(p_stFile, sSection, SCR_CC_C_Cfg_EOL);
/*
* save pointedSector or material entry
*/
p_cName = GLI_p_cSearchValueInLinkTableOfGeometric((unsigned long)hFMD->hMaterial);
if(p_cName != NULL)
{
SCR_fn_v_RdL0_SplitSectionName(p_cName, sFile, sAction, NULL);
if(strcmp(sAction, "Sector") == 0)
{
SCR_M_SvL0_SaveEntry(p_stFile, "PointedSector", SCR_CC_C_Cfg_NoChar);
}
else
{
SCR_M_SvL0_SaveEntry(p_stFile, "Material", SCR_CC_C_Cfg_NoChar);
}
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1, p_cName);
}
/*
* save triplde index entry
*/
sprintf
(
mes,
"%.6f,%.6f,%.6f,%.6f,%.6f,%.6f",
hFMD->stUVValues[0].xU,
hFMD->stUVValues[0].xV,
hFMD->stUVValues[1].xU,
hFMD->stUVValues[1].xV,
hFMD->stUVValues[2].xU,
hFMD->stUVValues[2].xV
);
SCR_M_SvL0_SaveEntry(p_stFile, "TripledUV", SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1, mes);
/*
* save end of section
*/
SCR_M_SvL0_SaveEndSection(p_stFile, SCR_CC_C_Cfg_EOL);
}
/*
----------------------------------------------------------------------------------------
Description : saving face map descriptors element
p_stFile -> script file descriptor
p_stElement -> pointer on element
----------------------------------------------------------------------------------------
*/
/*
void GLI_vSaveElementFaceMapDescriptors(SCR_tdst_File_Description *p_stFile, GEO_tdstElementFaceMapDescriptors *p_stElement)
{
xString mes, sSection, sAction, sIdent, sFile;
char *p_cName;
long i;
p_cName = GLI_p_cSearchValueInLinkTableOfGeometric((unsigned long)p_stElement);
if(p_cName == NULL)
return;
// save section beginning
SCR_fn_v_RdL0_SplitSectionName(p_cName, sFile, sAction, sIdent);
sprintf(sSection, "%s:%s", sAction, sIdent);
sprintf(mes, "%d", p_stElement->xNbFaces);
SCR_M_SvL0_SaveBeginSection(p_stFile, sSection, SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1, mes);
// save each face
for(i=0; i<p_stElement->xNbFaces; i++)
{
p_cName = GLI_p_cSearchValueInLinkTableOfGeometric((unsigned long)p_stElement->d_stListOfFacesQuadrupled[i].hFaceMapDescriptor);
if(p_cName == NULL)
return;
sprintf
(
mes,
"%d,%d,%d,%d,%.6f,%.6f,%.6f,%s",
i,
p_stElement->d_stListOfFacesQuadrupled[i].stFaceTripled.a3_xIndex[0],
p_stElement->d_stListOfFacesQuadrupled[i].stFaceTripled.a3_xIndex[1],
p_stElement->d_stListOfFacesQuadrupled[i].stFaceTripled.a3_xIndex[2],
p_stElement->d_stListOfFacesNormals[i].xX,
p_stElement->d_stListOfFacesNormals[i].xY,
p_stElement->d_stListOfFacesNormals[i].xZ,
p_cName
);
SCR_M_SvL0_SaveEntry(p_stFile, "AddFaceFMD", SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1, mes);
}
// save end of section
SCR_M_SvL0_SaveEndSection(p_stFile, SCR_CC_C_Cfg_EOL);
}
*/
/*
----------------------------------------------------------------------------------------
Description : saving a sprite section
p_hFile -> script file descriptor
hSprite -> pointer on sprite to save
----------------------------------------------------------------------------------------
*/
void GLI_vSaveSprite(SCR_tdst_File_Description *p_stFile, GEO_tdstSprite *hSprite)
{
xString sFile, sAction, sIdent, sSection, sType, mes;
long i;
char *p_cName;
p_cName = GLI_p_cSearchValueInLinkTableOfGeometric((unsigned long)hSprite);
if(p_cName == NULL)
return;
/*
* save section beginning
*/
SCR_fn_v_RdL0_SplitSectionName(p_cName, sFile, sAction, sIdent);
sprintf(sSection, "%s:%s", sAction, sIdent);
SCR_M_SvL0_SaveBeginSection(p_stFile, sSection, SCR_CC_C_Cfg_EOL);
/*
* save each sprite
*/
for(i=0; i< hSprite->xNbSprites; i++)
{
/*
* save material entry
*/
p_cName = GLI_p_cSearchValueInLinkTableOfGeometric((unsigned long)hSprite->d_hMaterial[i]);
if(p_cName != NULL)
{
SCR_M_SvL0_SaveEntry(p_stFile, "AddMaterial", SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1, p_cName);
}
/*
* get 2DScale type
*/
if( hSprite->d_xSpriteDrawMode[i] == (GEO_C_lSpriteDrawMode2DScaled | GEO_C_lSpriteDrawMode2DRotativ) )
sprintf(sType,"2DScaled");
else
sprintf(sType,"2DNonScaled");
/*
* save add info entry
*/
sprintf
(
mes,
"%d,%s,%.6f,%.6f,%.6f,%.6f,%.6f",
i,
sType,
hSprite->d_xThresholds[i],
hSprite->d_xSizeOfSprite[i].xX,
hSprite->d_xSizeOfSprite[i].xY,
hSprite->d_xDisplacementOfSprite[i].xX,
hSprite->d_xDisplacementOfSprite[i].xY
);
SCR_M_SvL0_SaveEntry(p_stFile, "AddInfo", SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1, mes);
}
/*
* save end of section
*/
SCR_M_SvL0_SaveEndSection(p_stFile, SCR_CC_C_Cfg_EOL);
}
/*
----------------------------------------------------------------------------------------
Description : saving element sprites section
p_stFile -> script file descriptor
p_stElement -> pointer on sprites element
----------------------------------------------------------------------------------------
*/
/*
void GLI_vSaveElementSprites(SCR_tdst_File_Description *p_stFile, GEO_tdstElementSprite *p_stElement)
{
xString mes, sAction, sIdent, sSection, sFile;
char *p_cName;
long i;
p_cName = GLI_p_cSearchValueInLinkTableOfGeometric((unsigned long)p_stElement);
if(p_cName == NULL)
return;
// save section beginning
SCR_fn_v_RdL0_SplitSectionName(p_cName, sFile, sAction, sIdent);
sprintf(sSection, "%s:%s", sAction, sIdent);
sprintf(mes, "%d", p_stElement->xNbSprites);
SCR_M_SvL0_SaveBeginSection(p_stFile, sSection, SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1, mes);
// save each sprites
for(i=0; i<p_stElement->xNbSprites; i++)
{
p_cName = GLI_p_cSearchValueInLinkTableOfGeometric((unsigned long)p_stElement->d_stListOfSprites[i].hSprite);
if(p_cName == NULL)
return;
sprintf
(
mes,
"%d,%d,%.6f,%.6f,%s",
i,
p_stElement->d_stListOfSprites[i].xCenterPoint,
p_stElement->d_stListOfSprites[i].stSize.xX,
p_stElement->d_stListOfSprites[i].stSize.xY,
p_cName
);
SCR_M_SvL0_SaveEntry(p_stFile, "AddSprite", SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1, mes);
}
// save end of section
SCR_M_SvL0_SaveEndSection(p_stFile, SCR_CC_C_Cfg_EOL);
}
*/
/*
----------------------------------------------------------------------------------------
Description : save a TMeshes element section
p_stFile -> script file descriptor
p_stElement -> pointer on TMeshes element
----------------------------------------------------------------------------------------
*/
/*
void GLI_vSaveElementTMeshes(SCR_tdst_File_Description *p_stFile, GEO_tdstElementTMeshes *p_stElement)
{
}
*/
/*
----------------------------------------------------------------------------------------
Description : save a point element section
p_stFile -> script file descriptor
p_stElement -> pointer on a Points Element
----------------------------------------------------------------------------------------
*/
/*
void GLI_vSaveElementPoints(SCR_tdst_File_Description *p_stFile, GEO_tdstElementPoints *p_stElement)
{
xString mes, sAction, sIdent, sSection, sFile;
char *p_cName;
long i;
p_cName = GLI_p_cSearchValueInLinkTableOfGeometric((unsigned long)p_stElement);
if(p_cName == NULL)
return;
// save section beginning
SCR_fn_v_RdL0_SplitSectionName(p_cName, sFile, sAction, sIdent);
sprintf(sSection, "%s:%s", sAction, sIdent);
sprintf(mes, "%d", p_stElement->xNbPoints);
SCR_M_SvL0_SaveBeginSection(p_stFile, sSection, SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1, mes);
// save fatness entry
sprintf(mes, "%.6f", p_stElement->xFatness);
SCR_M_SvL0_SaveEntry(p_stFile, "Fatness", SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1, mes);
// save list of points
for(i=0; i<p_stElement->xNbPoints; i++)
{
sprintf(mes, "%d,%d", i, p_stElement->d_xListOfPointIndex[i]);
SCR_M_SvL0_SaveEntry(p_stFile, "AddPoint", SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1, mes);
}
// save end of section
SCR_M_SvL0_SaveEndSection(p_stFile, SCR_CC_C_Cfg_EOL);
}
*/
/*
----------------------------------------------------------------------------------------
Description : save an element lines section
p_stFile -> script file descriptor
p_stElement -> pointer on lines element
----------------------------------------------------------------------------------------
*/
/*
void GLI_vSaveElementLines(SCR_tdst_File_Description *p_stFile, GEO_tdstElementLines *p_stElement)
{
xString mes, sAction, sIdent, sSection, sFile;
char *p_cName;
long i;
p_cName = GLI_p_cSearchValueInLinkTableOfGeometric((unsigned long)p_stElement);
if(p_cName == NULL)
return;
// save section beginning
SCR_fn_v_RdL0_SplitSectionName(p_cName, sFile, sAction, sIdent);
sprintf(sSection, "%s:%s", sAction, sIdent);
sprintf(mes, "%d", p_stElement->xNbLines);
SCR_M_SvL0_SaveBeginSection(p_stFile, sSection, SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1, mes);
// save thickness entry
sprintf(mes, "%.6f", p_stElement->xThickness);
SCR_M_SvL0_SaveEntry(p_stFile, "Thickness", SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1, mes);
// save list of lines
for(i=0; i<p_stElement->xNbLines; i++)
{
sprintf
(
mes,
"%d,%d,%d",
i,
p_stElement->d_stListOfLineIndex[i].a2_xIndex[0],
p_stElement->d_stListOfLineIndex[i].a2_xIndex[1]
);
SCR_M_SvL0_SaveEntry(p_stFile, "AddLine", SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1, mes);
}
// Save end of section
SCR_M_SvL0_SaveEndSection(p_stFile, SCR_CC_C_Cfg_EOL);
}
*/
/*
----------------------------------------------------------------------------------------
Description : save spheres element section
p_stFile -> script file descriptor
p_stElement -> pointer on spheres element
----------------------------------------------------------------------------------------
*/
/*
void GLI_vSaveElementSpheres(SCR_tdst_File_Description *p_stFile, GEO_tdstElementSpheres *p_stElement)
{
xString mes, sFile, sAction, sIdent, sSection;
char *p_cName;
char szDefaultMaterial[] = "DefaultMaterial";
long i;
p_cName = GLI_p_cSearchValueInLinkTableOfGeometric((unsigned long)p_stElement);
if(p_cName == NULL)
return;
// save section beginning
SCR_fn_v_RdL0_SplitSectionName(p_cName, sFile, sAction, sIdent);
sprintf(sSection, "%s:%s", sAction, sIdent);
sprintf(mes, "%d", p_stElement->xNbSpheres);
SCR_M_SvL0_SaveBeginSection(p_stFile, sSection, SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1, mes);
// save list of spheres
for(i=0; i<p_stElement->xNbSpheres; i++)
{
p_cName = GLI_p_cSearchValueInLinkTableOfGeometric((unsigned long)p_stElement->d_stListOfSpheres[i].hMaterial);
if(p_cName == NULL)
p_cName = szDefaultMaterial;
sprintf
(
mes,
"%d,%d,%.6f,%s",
i,
p_stElement->d_stListOfSpheres[i].xCenterPoint,
p_stElement->d_stListOfSpheres[i].xRadius,
p_cName
);
SCR_M_SvL0_SaveEntry(p_stFile, "AddSphere", SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1, mes);
}
// save end of section
SCR_M_SvL0_SaveEndSection(p_stFile, SCR_CC_C_Cfg_EOL);
}
*/
/*
----------------------------------------------------------------------------------------
Description : save an aligned boxes element section
p_stFile -> script file descriptor
p_stElement -> pointer on element
----------------------------------------------------------------------------------------
*/
/*
void GLI_vSaveElementAlignedBox(SCR_tdst_File_Description *p_stFile, GEO_tdstElementAlignedBoxes *p_stElement)
{
xString mes, sFile, sAction, sIdent, sSection;
char *p_cName;
char szDefaultMaterial[] = "DefaultMaterial";
long i;
p_cName = GLI_p_cSearchValueInLinkTableOfGeometric((unsigned long)p_stElement);
if(p_cName == NULL)
return;
// save section beginning
SCR_fn_v_RdL0_SplitSectionName(p_cName, sFile, sAction, sIdent);
sprintf(sSection, "%s:%s", sAction, sIdent);
sprintf(mes, "%d", p_stElement->xNbAlignedBoxes);
SCR_M_SvL0_SaveBeginSection(p_stFile, sSection, SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1, mes);
// save list of aligned boxes
for(i=0; i<p_stElement->xNbAlignedBoxes; i++)
{
p_cName = GLI_p_cSearchValueInLinkTableOfGeometric((unsigned long)p_stElement->d_stListOfAlignedBoxes[i].hMaterial);
if(p_cName == NULL)
p_cName = szDefaultMaterial;
sprintf
(
mes,
"%d,%d,%d,%s",
i,
p_stElement->d_stListOfAlignedBoxes[i].xMinPoint,
p_stElement->d_stListOfAlignedBoxes[i].xMaxPoint,
p_cName
);
SCR_M_SvL0_SaveEntry(p_stFile, "AddAlignedBox", SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1, mes);
}
// save end of section
SCR_M_SvL0_SaveEndSection(p_stFile, SCR_CC_C_Cfg_EOL);
}
*/
/*
----------------------------------------------------------------------------------------
Description : save cone element section
p_stFile -> script file descriptor
p_stElement -> pointer on cones element
----------------------------------------------------------------------------------------
*/
/*
void GLI_vSaveElementCones(SCR_tdst_File_Description *p_stFile, GEO_tdstElementCones *p_stElement)
{
xString mes, sFile, sAction, sIdent, sSection;
char *p_cName;
long i;
p_cName = GLI_p_cSearchValueInLinkTableOfGeometric((unsigned long)p_stElement);
if(p_cName == NULL)
return;
// save section beginning
SCR_fn_v_RdL0_SplitSectionName(p_cName, sFile, sAction, sIdent);
sprintf(sSection, "%s:%s", sAction, sIdent);
sprintf(mes, "%d", p_stElement->xNbCones);
SCR_M_SvL0_SaveBeginSection(p_stFile, sSection, SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1, mes);
// save list of cones
for(i=0; i<p_stElement->xNbCones; i++)
{
sprintf
(
mes,
"%d,%d,%d,%d",
i,
p_stElement->d_stListOfCones[i].xTopPoint,
p_stElement->d_stListOfCones[i].xBasePoint,
p_stElement->d_stListOfCones[i].xBaseRadius
);
SCR_M_SvL0_SaveEntry(p_stFile, "AddCone", SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1, mes);
}
// save end of section
SCR_M_SvL0_SaveEndSection(p_stFile, SCR_CC_C_Cfg_EOL);
}
*/
/*
*=======================================================================================
* CALL BACK for NOTIFICATION
*=======================================================================================
*/
/*
----------------------------------------------------------------------------------------
Description : call back for Geometric object notification
----------------------------------------------------------------------------------------
*/
/*
void OGD_fn_vSaveGeometricObject( SCR_tdst_File_Description *p_stFile, char *p_szSectionName, void *p_vData, SCR_tde_Ntfy_Action eAction)
{
Geometry3D *p_oObject = (Geometry3D *) p_vData;
ACP_tdxHandleOfObject hObject = (ACP_tdxHandleOfObject) p_oObject->GetEngineStruct();
if (eAction == SCR_EA_Ntfy_AddSection)
{
// go to end of file (we need all file directive to load this section)
SCR_fn_v_SvL1_ToEndSection(p_stFile);
SCR_M_SvL0_SaveBlankLine (p_stFile);
}
if ( (eAction == SCR_EA_Ntfy_RebuildSection) || (eAction == SCR_EA_Ntfy_AddSection) )
{
GLI_vSaveGeometricObject( p_stFile, hObject, p_vData );
}
}
*/
/*
----------------------------------------------------------------------------------------
Description : call back for Geometric object element notification
----------------------------------------------------------------------------------------
*/
/*
void OGD_fn_vSaveGeometricObjectElement( SCR_tdst_File_Description *p_stFile, char *p_szSectionName, void *p_vData, SCR_tde_Ntfy_Action eAction)
{
char *p_szActionName = strchr( p_szSectionName, '^' );
char *p_szName = strchr( p_szSectionName, ':' );
ACP_tdxIndex xElementType;
if (eAction == SCR_EA_Ntfy_AddSection)
{
// go to end of file (we need all file directive to load this section)
SCR_fn_v_SvL1_ToEndSection(p_stFile);
SCR_M_SvL0_SaveBlankLine (p_stFile);
}
//assert( p_szActionName != NULL );
//assert( p_szName != NULL );
p_szActionName+= strlen( "^Element" );
*p_szName = 0;
// finding element type from action name
for (xElementType = 0; xElementType < 10; xElementType ++)
{
if (strcmp( p_szActionName, g_szElementTypeName[xElementType]) == 0)
break;
}
//assert( xElementType < 10 );
switch (xElementType)
{
case GEO_C_xElementIndexedTriangles:
GLI_vSaveElementIndexedTriangle(p_stFile, (GEO_tdstElementIndexedTriangles *) p_vData);
break;
case GEO_C_xElementFaceMapDescriptors:
GLI_vSaveElementFaceMapDescriptors(p_stFile, (GEO_tdstElementFaceMapDescriptors *) p_vData);
break;
case GEO_C_xElementSprites:
GLI_vSaveElementSprites(p_stFile, (GEO_tdstElementSprite *) p_vData);
break;
case GEO_C_xElementTMeshes:
GLI_vSaveElementTMeshes(p_stFile, (GEO_tdstElementTMeshes *) p_vData);
break;
case GEO_C_xElementPoints:
GLI_vSaveElementPoints(p_stFile, (GEO_tdstElementPoints *) p_vData);
break;
case GEO_C_xElementLines:
GLI_vSaveElementLines(p_stFile, (GEO_tdstElementLines *) p_vData);
break;
case GEO_C_xElementSpheres:
GLI_vSaveElementSpheres(p_stFile, (GEO_tdstElementSpheres *) p_vData);
break;
case GEO_C_xElementAlignedBoxes:
GLI_vSaveElementAlignedBox(p_stFile, (GEO_tdstElementAlignedBoxes *) p_vData);
break;
case GEO_C_xElementCones:
GLI_vSaveElementCones(p_stFile, (GEO_tdstElementCones *) p_vData);
break;
}
}
*/

View File

@@ -0,0 +1,372 @@
//ROMTEAM WorldEditor
////////////////////////////////////////////////////////////////////////////////////////
// File : Shape3D.cpp: implementation of the Shape3D class.
// Author : Cristi Petrescu
// Date : 97.11
// Description :
////////////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ACP_Base.h"
#include "ITF.h"
#include "incGAM.h"
#include "GLI.h"
#include "DPT.h"
#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
#include "OGD.h"
#undef CPA_WANTS_EXPORT
#ifndef CPA_WANTS_IMPORT
#define CPA_WANTS_IMPORT
#endif
#include "3dinterf.hpp"
BOOL Shape3D::m_bSizeKeyPressed = FALSE;
Geometry3D_Interface *Shape3D::m_pGeometry3DDLL = NULL;
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : Shape3D::Shape3D
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : constructors to create a new object
// make one for each Geometry3D one. No general constructor :-(
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
Shape3D::Shape3D (BOOL bModifiable, CPA_EditorBase *_p_oEditor, ACP_tdxIndex xNbPoints, ACP_tdxIndex xNbElements, const CString _csName, tdeSaveStatus _eStatus)
: Geometry3D (_p_oEditor, xNbPoints, xNbElements, _csName , _eStatus)
{
m_bModifiable = bModifiable;
CommonShape3D ();
}
Shape3D::Shape3D (BOOL bModifiable, CPA_EditorBase *_p_oEditor, ACP_tdxIndex xNbPoints, ACP_tdxIndex xNbElements, CPA_BaseObject *_p_oOwnerFile, const CString _csName, char *_p_cRefPath, tdeSaveStatus _eStatus)
: Geometry3D (_p_oEditor, xNbPoints, xNbElements, _p_oOwnerFile, _csName, _p_cRefPath, _eStatus)
{
m_bModifiable = bModifiable;
CommonShape3D ();
}
Shape3D::Shape3D (BOOL bModifiable, CPA_EditorBase *_p_oEditor, CPA_BaseObject *_p_oOwnerFile, ACP_tdxHandleOfObject _hObject, const CString _csName, char *_p_cRefPath, tdeSaveStatus _eStatus)
: Geometry3D (_p_oEditor, _p_oOwnerFile, _hObject, _csName, _p_cRefPath, _eStatus)
{
m_bModifiable = bModifiable;
CommonShape3D ();
}
Shape3D::~Shape3D()
{
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Shape3D - _OnKeyDown
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : check for size key pressed
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL Shape3D::_OnKeyDown(UINT nChar, UINT nRepCnt /* = 0 */, UINT nFlags /* = 0 */)
{
ASSERT (m_pGeometry3DDLL);
if(m_pGeometry3DDLL->GetKeyActionConfiguration ()->mfn_uwKeyToAction(nChar) == KA_3DG_SIZE)
m_bSizeKeyPressed = TRUE;
return FALSE;
}
//ionut
BOOL Shape3D::_OnLButtonDblClk (UINT nFlags, tdstMousePos *p_stPos, ACP_tdxIndex xIndex, HIE_tdstPickInfo *p_stPickInfo)
{
return FALSE;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Shape3D - _OnKeyUp
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : check for size key pressed
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL Shape3D::_OnKeyUp(UINT nChar, UINT nRepCnt /* = 0 */, UINT nFlags /* = 0 */)
{
ASSERT (m_pGeometry3DDLL);
if(m_pGeometry3DDLL->GetKeyActionConfiguration ()->mfn_uwKeyToAction(nChar) == KA_3DG_SIZE)
m_bSizeKeyPressed = FALSE;
return FALSE;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Shape3D - _OnMouseMove
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : are we ready ?!
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL Shape3D::_OnMouseMove(UINT nFlags, tdstMousePos * p_stPos, MTH3D_tdstVector * pDeplacement)
{
if (m_bModifiable && m_bSizeKeyPressed & m_bActiveMode)
return TRUE;
else
return FALSE;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Shape3D - _OnLButtonDown
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Init mouse move structures
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL Shape3D::_OnLButtonDown(UINT nFlags, tdstMousePos * p_stPos, ACP_tdxIndex xIndex, HIE_tdstPickInfo * p_stObject)
{
if (m_bModifiable && m_bSizeKeyPressed)
{
m_bActiveMode = TRUE;
m_stGlobalSelectedPoint = p_stObject->stPickedObject.aDEF_stDataOfElement->stHit;
return TRUE;
}
else
return FALSE;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Shape3D - _OnLButtonUp
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Default: we do not use the message
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL Shape3D::_OnLButtonUp(UINT nFlags, tdstMousePos * p_stPos)
{
m_bActiveMode = FALSE;
return FALSE;
}
// ----------------------------------------------------------------------------
// Description : common implementation for the constructors
// ----------------------------------------------------------------------------
void Shape3D::CommonShape3D()
{
m_bSizeKeyPressed = FALSE;
m_bActiveMode = FALSE;
m_hElement = 0;
m_pSuperObject = NULL;
//ROMTEAM WorldEditor (Cristian Stegaru 12/97)
SetCallBackSave (Geometry3D::CallBackSaveGeometricObject);
SetSectionData (this);
//ENDROMTEAM WorldEditor (Cristian Stegaru)
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Shape3D - ConvertPointGlobalToLocal
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Temporary function to convert a point from the global repere to a local repere
// pSource and pDest must be different
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void Shape3D::ConvertPointGlobalToLocal (MTH3D_tdstVector * pDest , POS_tdstCompletePosition * pAbsoluteMatrix , MTH3D_tdstVector * pSource)
{
// Compute the invert matrix
POS_tdstCompletePosition InvMatrix;
POS_fn_vInvertIsoMatrix(& InvMatrix , pAbsoluteMatrix);
POS_fn_vMulMatrixVertex(pDest , & InvMatrix , pSource);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Shape3D - ConvertPointLocalToGlobal
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Temporary function to convert a point from a local repere to the global repere
// pSource and pDest must be different
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void Shape3D::ConvertPointLocalToGlobal (MTH3D_tdstVector * pDest , POS_tdstCompletePosition * pAbsoluteMatrix , MTH3D_tdstVector * pSource)
{
POS_fn_vMulMatrixVertex(pDest , pAbsoluteMatrix , pSource);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Shape3D - ConvertVectorGlobalToLocal
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Temporary function to convert a vector from the global repere to a local repere
// pSource and pDest must be different
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void Shape3D::ConvertVectorGlobalToLocal (MTH3D_tdstVector * pDest , POS_tdstCompletePosition * pAbsoluteMatrix , MTH3D_tdstVector * pSource)
{
// Compute the invert matrix
POS_tdstCompletePosition InvMatrix;
POS_fn_vInvertIsoMatrix(& InvMatrix , pAbsoluteMatrix);
// Put the translation to 0
MTH3D_tdstVector NullVector;
MTH3D_M_vNullVector (& NullVector);
POS_fn_vSetTranslationVector(& InvMatrix , & NullVector);
POS_fn_vMulMatrixVertex(pDest , & InvMatrix , pSource);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Shape3D - ConvertVectorLocalToGlobal
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Temporary function to convert a vector from a local repere to the global repere
// pSource and pDest must be different
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void Shape3D::ConvertVectorLocalToGlobal (MTH3D_tdstVector * pDest , POS_tdstCompletePosition * pAbsoluteMatrix , MTH3D_tdstVector * pSource)
{
// Keep a copy of the translation vector
MTH3D_tdstVector BackupTranslation;
POS_fn_vGetTranslationVector (pAbsoluteMatrix , & BackupTranslation);
// Put the translation to 0
MTH3D_tdstVector NullVector;
MTH3D_M_vNullVector (& NullVector);
POS_fn_vSetTranslationVector(pAbsoluteMatrix , & NullVector);
POS_fn_vMulMatrixVertex(pDest , pAbsoluteMatrix , pSource);
POS_fn_vSetTranslationVector(pAbsoluteMatrix , & BackupTranslation);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : mfn_vLoad
// Date : 98-01
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Cristian Stegaru - CPA2
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void Shape3D::mfn_vLoad (CString csEPOFile, CString csEPOName)
{
char *szName = new char[STR_LENGTH], *szReferencedSectionName = new char[STR_LENGTH], *szDataPath = new char[STR_LENGTH],
*szElementReferencedSectionName = new char[STR_LENGTH], *szElementDataPath = new char[STR_LENGTH];
BOOL bReadOK = GetPrivateProfileString (csEPOName, "REFERENCED_SECTION_NAME", NULL, szReferencedSectionName, STR_LENGTH, csEPOFile);
bReadOK = bReadOK && GetPrivateProfileString (csEPOName, "DATA_PATH", NULL, szDataPath, STR_LENGTH, csEPOFile);
bReadOK = bReadOK && GetPrivateProfileString (csEPOName, "ELEMENT_REFERENCED_SECTION_NAME", NULL, szElementReferencedSectionName, STR_LENGTH, csEPOFile);
bReadOK = bReadOK && GetPrivateProfileString (csEPOName, "ELEMENT_DATA_PATH", NULL, szElementDataPath, STR_LENGTH, csEPOFile);
ASSERT (bReadOK);
SetReferencedSectionName (szReferencedSectionName);
fn_vUpdateSectionName ();
SetDataPath (szDataPath);
mfn_vInitElement (szElementReferencedSectionName, szElementDataPath, TRUE);
fn_vNotifySave ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : mfn_vSave
// Date : 98-01
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Cristian Stegaru - CPA2
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void Shape3D::mfn_vSave (CString csEPOFile, CString csEPOName, int iIdx)
{
BOOL bWriteOK = WritePrivateProfileString (csEPOName, "NAME", GetName (), csEPOFile);
char szIdx [NB_LENGTH];
itoa (iIdx, szIdx, 10);
bWriteOK = bWriteOK && WritePrivateProfileString (csEPOName, "IDX", szIdx, csEPOFile);
bWriteOK = bWriteOK && WritePrivateProfileString (csEPOName, "REFERENCED_SECTION_NAME", GetReferencedSectionName (), csEPOFile);
bWriteOK = bWriteOK && WritePrivateProfileString (csEPOName, "DATA_PATH", GetDataPath (), csEPOFile);
SectionElement *pSectionElement = m_oListOfElementSections.GetHead ();
ASSERT (pSectionElement);
bWriteOK = bWriteOK && WritePrivateProfileString (csEPOName, "ELEMENT_REFERENCED_SECTION_NAME", pSectionElement->GetReferencedSectionName (), csEPOFile);
bWriteOK = bWriteOK && WritePrivateProfileString (csEPOName, "ELEMENT_DATA_PATH", pSectionElement->GetDataPath (), csEPOFile);
ASSERT (bWriteOK);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : EndCreate()
// Date : 98-01-20
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : N Suparatu - CPA2
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void Shape3D::EndCreate()
{
if(GetStruct()->d_stListOfPointsNormals) GEO_M_CPAFree(GetStruct()->d_stListOfPointsNormals);
if(GetStruct()->d_hListOfPointsMaterial) GEO_M_CPAFree(GetStruct()->d_hListOfPointsMaterial);
if(GetStruct()->d_stListOfEdges) GEO_M_CPAFree(GetStruct()->d_stListOfEdges);
GetStruct()->d_hListOfPointsMaterial = NULL;
GetStruct()->d_stListOfEdges = NULL;
GetStruct()->d_stListOfPointsNormals = NULL;
GEO_xCreateObjectPointNormals (GetStruct());
GEO_vCreateObjectListOfPointsMaterial(GetStruct());
GEO_xCreateObjectListOfEdges(GetStruct());
GEO_xComputeObjectNormals2(GetStruct());
GEO_vComputeObjectListOfPointsMaterial(GetStruct());
GEO_xComputeObjectListOfEdges(GetStruct());
}

View File

@@ -0,0 +1,369 @@
//ROMTEAM WorldEditor
////////////////////////////////////////////////////////////////////////////////////////
// File : Sphere3D.cpp: implementation of the Sphere3D class.
// Author : Cristi Petrescu
// Date : 97.11
// Description :
////////////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ACP_Base.h"
#include "ITF.h"
#include "incGAM.h"
#include "GLI.h"
#include "DPT.h"
#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
#include "OGD.h"
#undef CPA_WANTS_EXPORT
#ifndef CPA_WANTS_IMPORT
#define CPA_WANTS_IMPORT
#endif
#include "3dinterf.hpp"
#include "DlgSph3D.hpp"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : Sphere3D::Sphere3D
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : constructors to create a new object
// make one for each Geometry3D one. No general constructor :-(
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
Sphere3D::Sphere3D (BOOL bModifiable, CPA_EditorBase *_p_oEditor, /*ACP_tdxIndex xNbPoints, ACP_tdxIndex xNbElements,*/ const CString _csName , tdeSaveStatus _eStatus )
: Shape3D (bModifiable, _p_oEditor, 1, 1, _csName , _eStatus)
{
CommonSphere3D ();
}
Sphere3D::Sphere3D (BOOL bModifiable, CPA_EditorBase *_p_oEditor, /*ACP_tdxIndex xNbPoints, ACP_tdxIndex xNbElements,*/ CPA_BaseObject *_p_oOwnerFile, const CString _csName /*= ""*/, char *_p_cRefPath /*= NULL*/, tdeSaveStatus _eStatus /*= E_ss_Responsible*/)
: Shape3D (bModifiable, _p_oEditor, 1, 1, _p_oOwnerFile, _csName, _p_cRefPath, _eStatus)
{
CommonSphere3D ();
}
/****????*****///rezolvat ?? ionut
Sphere3D::Sphere3D (BOOL bModifiable, CPA_EditorBase *_p_oEditor, CPA_BaseObject *_p_oOwnerFile, ACP_tdxHandleOfObject _hObject, const CString _csName /*= ""*/, char *_p_cRefPath /*= NULL*/, tdeSaveStatus _eStatus /*= E_ss_Modify*/)
: Shape3D (bModifiable, _p_oEditor, _p_oOwnerFile, _hObject, _csName, _p_cRefPath, _eStatus)
{
// this seems to be used at load time.
// so do not alter the data!
// CommonSphere3D ();
}
// ----------------------------------------------------------------------------
// Description : common implementation for the constructors
// ----------------------------------------------------------------------------
void Sphere3D::CommonSphere3D( )
{
// initialise with dummy data
MTH3D_tdstVector stCenterPoint = { 0 , 0 , 0 };
fn_vSetListOfPoints (1 , & stCenterPoint);
m_hElement = fn_hCreateElementSpheres (1); /****!!!!****/
fn_eSetIndexedSphere (m_hElement , 0 , 0 , (float) 0.1);
fn_vEndCreation ();
}
Sphere3D::~Sphere3D()
{
}
/*
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Sphere3D - _OnKeyDown
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Default: we do not use the message
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL Sphere3D::_OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
return FALSE;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Sphere3D - _OnKeyUp
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Default: we do not use the message
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL Sphere3D::_OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
{
return FALSE;
}
*/
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Sphere3D - _OnMouseMove
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Change the size of the sphere if CTRL key is pressed
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL Sphere3D::_OnMouseMove(UINT nFlags, tdstMousePos * p_stPos, MTH3D_tdstVector * pDeplacement)
{
if (Shape3D::_OnMouseMove (nFlags, p_stPos, pDeplacement))
{
//CPA2 Corneliu Babiuc 11-04-98
//reactualize global selected point to fit on sphere contour
MTH3D_tdstVector stTempVertex;
MTH3D_tdstVector stCopyGlobalSelectedPoint = m_stGlobalSelectedPoint;
//compute the new norme
MTH3D_M_vSubVector(&stTempVertex, &m_stGlobalSelectedPoint, &m_stCenterInMousePlane );
GLI_tdxValue ScaleNorme = GetRadius()/MTH3D_M_xNormVector(&stTempVertex);
MTH3D_M_vMulScalarVector(&stTempVertex, ScaleNorme, &stTempVertex);
MTH3D_M_vAddVector(&m_stGlobalSelectedPoint, &stTempVertex, &m_stCenterInMousePlane );
//END CPA2 Corneliu Babiuc 11-04-98
// we make the movement
MTH3D_M_vAddVector (& m_stGlobalSelectedPoint ,
& m_stGlobalSelectedPoint , pDeplacement);
MTH3D_tdstVector RadiusVertex;
MTH3D_M_vSubVector (& RadiusVertex , & m_stGlobalSelectedPoint ,
& m_stCenterInMousePlane);
GLI_tdxValue NewRadius = MTH3D_M_xNormVector(& RadiusVertex);
SetRadius (& NewRadius);
//CPA2 Corneliu Babiuc 11-04-98
//restore the original global position
MTH3D_M_vAddVector (& m_stGlobalSelectedPoint ,
& stCopyGlobalSelectedPoint , pDeplacement);
//END CPA2 Corneliu Babiuc 11-04-98
return TRUE;
}
else
return FALSE;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Sphere3D - _OnLButtonDown
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : initialize the size changing procedure if the CTRL key is pressed
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL Sphere3D::_OnLButtonDown(UINT nFlags, tdstMousePos * p_stPos, ACP_tdxIndex xIndex, HIE_tdstPickInfo * p_stObject)
{
if (Shape3D::_OnLButtonDown(nFlags, p_stPos, xIndex, p_stObject))
{
// resizing is allowed
MTH3D_tdstVector SphereCenter;
// Compute coordinates in the global repere
ConvertPointLocalToGlobal (& SphereCenter, HIE_fn_hGetSuperObjectGlobalMatrix (m_pSuperObject->GetStruct ()) , & GetCenter ());
// Get the matrix of the camera
GLI_tdxHandleToCamera hHandleToCamera = m_pGeometry3DDLL->GetInterface () -> GetMultiDevice () -> GetFocusDevice () -> GetCamera ();
POS_tdstCompletePosition CameraMatrix , InvMatrix;
GLI_xGetCameraMatrix (hHandleToCamera , & CameraMatrix);
POS_fn_vInvertIsoMatrix(& InvMatrix , & CameraMatrix);
// Get the coordinates of the Z axe
MTH3D_tdstVector ZAxe , DummyVector;
POS_fn_vGetRotationMatrix(& InvMatrix , & DummyVector , & DummyVector , & ZAxe);
// Compute the sphere center, projected into the plane where the mouse moves into
MTH3D_M_vSubVector (& SphereCenter , & SphereCenter , & m_stGlobalSelectedPoint);
GLI_tdxValue DotProduct = MTH3D_M_xDotProductVector (& ZAxe , & SphereCenter);
MTH3D_M_vMulScalarVector (& ZAxe , DotProduct , & ZAxe);
MTH3D_M_vSubVector (& SphereCenter , & SphereCenter , & ZAxe);
MTH3D_M_vAddVector (& m_stCenterInMousePlane ,
& SphereCenter , & m_stGlobalSelectedPoint);
return TRUE;
}
else
return FALSE;
}
/*
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Sphere3D - _OnLButtonUp
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Default: we do not use the message
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL Sphere3D::_OnLButtonUp(UINT nFlags, tdstMousePos * p_stPos)
{
return FALSE;
}
*/
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Sphere3D - _OnLButtonDblClk
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : launch the modal dialog
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL Sphere3D::_OnLButtonDblClk (UINT nFlags, tdstMousePos *p_stPos, ACP_tdxIndex xIndex, HIE_tdstPickInfo *p_stPickInfo)
{
int iDlgResult;
HINSTANCE hOldInst = AfxGetResourceHandle();
AfxSetResourceHandle ( ((CPA_DLLBase*)(GetEditor()))->GetDLLIdentity()->hModule );
CDlgSphere3D dlgSphere3D(this);
iDlgResult = dlgSphere3D.DoModal();
AfxSetResourceHandle(hOldInst);
if (iDlgResult == IDOK)
return TRUE;
else
return FALSE;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Sphere3D : GetCenter
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : return the 3D coordinates of the center of the sphere
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
MTH3D_tdstVector Sphere3D::GetCenter ()
{
MTH3D_tdstVector stCenter;
fn_eGetCenter (& stCenter , m_hElement);
return stCenter;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Sphere3D : SetCenter
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : set the 3D coordinates of the center of the sphere
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void Sphere3D::SetCenter (MTH3D_tdstVector * _pCenter)
{
fn_eSetCenter (_pCenter , m_hElement);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Sphere3D : SetCenterX
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : set the X coordinate of the center of the sphere
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void Sphere3D::SetCenterX (GLI_tdxValue _X)
{
fn_eSetCenterX (& _X , m_hElement);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Sphere3D : SetCenterY
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : set the Y coordinate of the center of the sphere
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void Sphere3D::SetCenterY (GLI_tdxValue _Y)
{
fn_eSetCenterY (& _Y , m_hElement);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Sphere3D : SetCenterZ
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : set the Z coordinate of the center of the sphere
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void Sphere3D::SetCenterZ (GLI_tdxValue _Z)
{
fn_eSetCenterZ (& _Z , m_hElement);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Sphere3D : GetRadius
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : return the radius of the sphere
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
GLI_tdxValue Sphere3D::GetRadius ()
{
GLI_tdxValue Radius;
fn_eGetRadius (& Radius , m_hElement);
return Radius;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method :Sphere3D : SetRadius
// Date : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : set the radius of the sphere
// return FALSE if the given radius is not correct (negative). In this case, radius is set to 0
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL Sphere3D::SetRadius (GLI_tdxValue * _Radius)
{
return fn_eSetRadius (_Radius , m_hElement) == C_Ok;
}

View File

@@ -0,0 +1,6 @@
// stdafx.cpp : source file that includes just the standard includes
// ACPProject.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"

View File

@@ -0,0 +1,87 @@
//ROMTEAM WorldEditor
////////////////////////////////////////////////////////////////////////////////////////
// File : Symbolical3D.cpp: implementation file for the Symbolical3D class
// Author : Viorel Preoteasa
// Date : 97.11
// Description :
////////////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ACP_Base.h"
#include "ITF.h"
#include "incGAM.h"
#include "GLI.h"
#include "DPT.h"
#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
#include "OGD.h"
#undef CPA_WANTS_EXPORT
#define CPA_WANTS_IMPORT
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : Construction/Destruction of Plane3D
// Date : 97-11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Viorel Preoteasa - CPA2
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
Symbolical3D::Symbolical3D (BOOL bModifiable, CPA_EditorBase *_p_oEditor, /*ACP_tdxIndex xNbPoints, ACP_tdxIndex xNbElements,*/ const CString _csName , tdeSaveStatus _eStatus )
: Shape3D (bModifiable, _p_oEditor, 4, 1, _csName , _eStatus)
{
CommonSymbolical3D ();
}
Symbolical3D::Symbolical3D (BOOL bModifiable, CPA_EditorBase *_p_oEditor, /*ACP_tdxIndex xNbPoints, ACP_tdxIndex xNbElements,*/ CPA_BaseObject *_p_oOwnerFile, const CString _csName /*= ""*/, char *_p_cRefPath /*= NULL*/, tdeSaveStatus _eStatus /*= E_ss_Responsible*/)
: Shape3D (bModifiable, _p_oEditor, 4, 1, _p_oOwnerFile, _csName, _p_cRefPath, _eStatus)
{
CommonSymbolical3D ();
}
Symbolical3D::Symbolical3D (BOOL bModifiable, CPA_EditorBase *_p_oEditor, CPA_BaseObject *_p_oOwnerFile, ACP_tdxHandleOfObject _hObject, const CString _csName /*= ""*/, char *_p_cRefPath /*= NULL*/, tdeSaveStatus _eStatus /*= E_ss_Modify*/)
: Shape3D (bModifiable, _p_oEditor, _p_oOwnerFile, _hObject, _csName, _p_cRefPath, _eStatus)
{
CommonSymbolical3D ();
}
Symbolical3D::~Symbolical3D()
{
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : Symbolical3D
// Date : 97-11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Common initialisation
// Author : Viorel Preoteasa - CPA2
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void Symbolical3D::CommonSymbolical3D()
{
MTH3D_tdstVector a4_stPoint [4];
MTH3D_M_vSetVectorElements ( a4_stPoint, -0.30516f, 0.f, -0.15258f);
MTH3D_M_vSetVectorElements ( a4_stPoint+1, 0.30516f, 0.f, -0.15258f);
MTH3D_M_vSetVectorElements ( a4_stPoint+2, 0.f, 0.f, 0.30516f);
MTH3D_M_vSetVectorElements ( a4_stPoint+3, 0.f, -0.45776f, 0.f);
fn_vSetListOfPoints(4, a4_stPoint);
m_hElement = fn_hCreateElementIndexedTriangle(4,0);
fn_eSetIndexedTriangle ( m_hElement, 0, 0, 1, 3 );
fn_eSetIndexedTriangle ( m_hElement, 1, 1, 2, 3 );
fn_eSetIndexedTriangle ( m_hElement, 2, 0, 3, 2 );
fn_eSetIndexedTriangle ( m_hElement, 3, 0, 2, 1 );
EndCreate();
}

View File

@@ -0,0 +1,237 @@
// dlgcaract.cpp : implementation file
//
#ifdef ACTIVE_EDITOR
#include "stdafx.h"
#include "ACP_Base.h"
#include "incITF.h"
#include "dlgcarac.hpp"
#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
#include "OGD.h"
#undef CPA_WANTS_EXPORT
#define CPA_WANTS_IMPORT
#include "3Dinterf.hpp"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
extern char *g_szElementTypeName[];
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
#define C_iBorderSize 5
#define M_CtrlList() ((CListCtrl*) GetDlgItem(IDC_LIST_ELEMENTS))
#define M_GetClientRect( pWnd, poRect ) (pWnd) -> GetWindowRect( poRect );ScreenToClient( poRect )
#define M_GetClientRectId( Id, poRect ) M_GetClientRect( GetDlgItem( Id ), poRect )
#define M_SetClientRect( pWnd, poRect ) (pWnd) -> MoveWindow( poRect )
#define M_SetClientRectId( Id, poRect ) M_SetClientRect( GetDlgItem( Id ), poRect )
#define M_GetElementType(_szName,_Type) for( (_Type) = 0 ; strcmpi(g_szElementTypeName[_Type],"END") && strcmpi(g_szElementTypeName[_Type],_szName) ; (_Type)++);
#define M_ForEachElement( oList, oElement, Pos )\
for( oElement = (oList) . GetHeadElement( Pos ) ; \
oElement ; \
oElement = (oList) . GetNextElement( Pos ) )
/////////////////////////////////////////////////////////////////////////////
// CDlgCaract dialog
IMPLEMENT_DYNCREATE(CDlgCaract,CFormView)
CDlgCaract::CDlgCaract(CWnd* pParent /*=NULL*/)
:CFormView(CDlgCaract::IDD)
{
m_p_oParentDLL = NULL;
m_bFirstInit = TRUE;
m_p_oCurrentObject = NULL;
m_p_oSuperObject = NULL;
}
void CDlgCaract::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CDlgCaract, CFormView)
//{{AFX_MSG_MAP(CDlgCaract)
ON_WM_SIZE()
ON_NOTIFY( LVN_ITEMCHANGED , IDC_LIST_ELEMENTS, OnChangeList )
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlgCaract message handlers
void CDlgCaract::fn_vUpdateInfo(CPA_SuperObject *_p_oSprObj, Geometry3D *_p_oObject)
{
if( m_bFirstInit )
{
m_bFirstInit = FALSE;
fn_vInitList();
}
if(_p_oObject && (m_p_oCurrentObject != _p_oObject))
{
ACP_tdxHandleOfObject p_tdstGeom = _p_oObject -> GetStruct();
m_Data_cName.Format("%s",_p_oObject->GetName());
m_Data_lNbPoints = (long)GEO_xGetGeometricObjectNumberOfPoints(p_tdstGeom);
m_Data_lNbEdges = (long)GEO_xGetGeometricObjectNumberOfEdges(p_tdstGeom);
m_Data_lNbBdV = (long)GEO_xGetGeometricObjectNumberOfParallelBox(p_tdstGeom);
m_Data_lNbElements = (long)GEO_xGetGeometricObjectNumberOfElements(p_tdstGeom);
// elements
fn_vUpdateList( _p_oObject );
}
else if( ! _p_oObject )
{
m_Data_cName = "No Object";
fn_vUpdateList( NULL );
}
m_p_oSuperObject = _p_oSprObj;
m_p_oCurrentObject = _p_oObject;
//
fn_vShowValue( IDC_STATIC_NBPOINTS, m_Data_lNbPoints );
fn_vShowValue( IDC_STATIC_NBEDGES, m_Data_lNbEdges );
fn_vShowValue( IDC_STATIC_NBBDV, m_Data_lNbBdV );
fn_vShowValue( IDC_ELEMENTS, m_Data_lNbElements );
if(GetDlgItem(IDC_EDIT_NAME))
GetDlgItem(IDC_EDIT_NAME)->SetWindowText( m_Data_cName );
GetDlgItem(IDC_EDIT_NAME)->EnableWindow(m_p_oCurrentObject != NULL);
//
UpdateData(FALSE);
}
void CDlgCaract::fn_vShowValue(int _nID, long _lValue)
{
CString oCst;
CWnd *p_oWnd = GetDlgItem(_nID) ;
if(p_oWnd)
{
oCst.Format("%ld",_lValue);
p_oWnd->SetWindowText(oCst);
}
}
void CDlgCaract::fn_vInitList()
{
int iTaille = M_CtrlList()->GetStringWidth("m");
CString csNum;
M_CtrlList()->InsertColumn(0,"Element",LVCFMT_LEFT,iTaille*15);
M_CtrlList()->InsertColumn(1,"Type",LVCFMT_CENTER,iTaille*4);
M_CtrlList()->InsertColumn(2,"Size",LVCFMT_RIGHT,iTaille*4);
M_CtrlList()->InsertColumn(3,"BdV",LVCFMT_RIGHT,iTaille*4);
}
void CDlgCaract::fn_vUpdateList(Geometry3D *_p_oObject)
{
M_CtrlList()->DeleteAllItems();
if( _p_oObject )
{
long iInd;
POSITION xPos;
SectionElement *p_oElementSection;
char szShortSectionName[SCR_CV_ui_Cfg_MaxLenName];
iInd = 0;
M_ForEachElement( _p_oObject -> m_oListOfElementSections, p_oElementSection, xPos )
{
ACP_tdxHandleOfObject p_tdstGeom = _p_oObject -> GetStruct();
ACP_tdxIndex xElementType;
char *p_cElement, *p_cName;
CString oCst;
strcpy( szShortSectionName, (const char*)p_oElementSection -> GetReferencedSectionName() );
p_cElement = strstr( szShortSectionName, "Element" ) + strlen("Element");
p_cName = strchr( p_cElement, ':' );
*p_cName++ = 0;
M_GetElementType( p_cElement , xElementType );
M_CtrlList()->InsertItem(iInd, p_cName,0);
switch(xElementType)
{
case GEO_C_xElementIndexedTriangles: M_CtrlList()->SetItemText( iInd, 1, "ITr" ); break;
case GEO_C_xElementFaceMapDescriptors: M_CtrlList()->SetItemText( iInd, 1, "FMD" ); break;
case GEO_C_xElementSprites: M_CtrlList()->SetItemText( iInd, 1, "Spr" ); break;
case GEO_C_xElementTMeshes: M_CtrlList()->SetItemText( iInd, 1, "TMs" ); break;
case GEO_C_xElementPoints: M_CtrlList()->SetItemText( iInd, 1, "Pts" ); break;
case GEO_C_xElementLines: M_CtrlList()->SetItemText( iInd, 1, "Lin" ); break;
case GEO_C_xElementSpheres: M_CtrlList()->SetItemText( iInd, 1, "Sph" ); break;
case GEO_C_xElementAlignedBoxes: M_CtrlList()->SetItemText( iInd, 1, "Box" ); break;
case GEO_C_xElementAltimap: M_CtrlList()->SetItemText( iInd, 1, "Atm" ); break;
}
oCst.Format("%d",_p_oObject->fn_xGetNbIndexedElements(iInd));
M_CtrlList()->SetItemText(iInd,2,oCst);
if( GEO_xGetParallelBoxIndexOfElement( p_tdstGeom, iInd ) != GEO_C_xNoParallelBox )
oCst.Format("%d",GEO_xGetParallelBoxIndexOfElement( p_tdstGeom, iInd ));
else
oCst = " ";
M_CtrlList()->SetItemText(iInd,3,oCst);
iInd++;
}
}
}
void CDlgCaract::OnSize(UINT nType, int cx, int cy)
{
if(GetDlgItem(IDC_EDIT_NAME))
{
CRect oRectDlg, oRectList, oRectBorder, oRectName;
M_GetClientRect( this, &oRectDlg );
M_GetClientRectId( IDC_LIST_ELEMENTS, &oRectList );
M_GetClientRectId( IDC_STATIC_BORDER, &oRectBorder );
M_GetClientRectId( IDC_EDIT_NAME, &oRectName );
// recompute pos
oRectBorder . left = oRectList . left = oRectDlg . left + C_iBorderSize;
oRectBorder . right = oRectList . right = oRectDlg . right - C_iBorderSize;
oRectList . bottom = max( oRectList . top + 20 , oRectDlg . bottom - C_iBorderSize );
oRectName . left = oRectBorder . left + C_iBorderSize;
oRectName . right = oRectBorder . right - C_iBorderSize;
// set pos
M_SetClientRectId( IDC_LIST_ELEMENTS, &oRectList );
M_SetClientRectId( IDC_STATIC_BORDER, &oRectBorder );
M_SetClientRectId( IDC_EDIT_NAME, &oRectName );
}
}
void CDlgCaract::OnChangeList(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_LISTVIEW* pnmv = (NM_LISTVIEW *)pNMHDR;
if( (pnmv->uOldState & LVIS_SELECTED) && !(pnmv->uNewState & LVIS_SELECTED) )
{
// unselect
m_p_oParentDLL -> mfn_vShowOrHideElement( FALSE );
}
else if( pnmv->uNewState & LVIS_SELECTED )
{
// select
m_p_oParentDLL -> mfn_vShowOrHideElement( TRUE, m_p_oSuperObject, m_p_oCurrentObject, pnmv -> iItem );
}
*pResult = 0;
}
#endif //ACTIVE_EDITOR

View File

@@ -0,0 +1,277 @@
//ROMTEAM WorldEditor
////////////////////////////////////////////////////////////////////////////////////////
// File : DlgEditPoints.cpp: implementation file for the CDlgEditPoints class
// Author : Viorel Preoteasa
// Date : 97.11
// Description :
////////////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "dlgeditpoints.hpp"
#include "math.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDlgEditPoints
IMPLEMENT_DYNCREATE(CDlgEditPoints, CFormView)
CDlgEditPoints::CDlgEditPoints()
: CFormView(CDlgEditPoints::IDD)
{
//{{AFX_DATA_INIT(CDlgEditPoints)
//}}AFX_DATA_INIT
}
CDlgEditPoints::~CDlgEditPoints()
{
}
void CDlgEditPoints::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgEditPoints)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlgEditPoints, CFormView)
//{{AFX_MSG_MAP(CDlgEditPoints)
ON_WM_HSCROLL()
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlgEditPoints diagnostics
#ifdef _DEBUG
void CDlgEditPoints::AssertValid() const
{
CFormView::AssertValid();
}
void CDlgEditPoints::Dump(CDumpContext& dc) const
{
CFormView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CDlgEditPoints message handlers
void CDlgEditPoints::OnPaint()
{
CPaintDC dc1(this); // device context for painting
// TODO: Add your message handler code here
CWnd *wnd = GetDlgItem(IDC_STATIC_LINE);
CPaintDC dc(wnd);
RECT r;
wnd->RedrawWindow();
wnd->GetClientRect(&r);
int dx = (r.right - r.left - 1);
int dy = (r.bottom - r.top - 1);
int i,j,ii;
j = (int)(dy * Effect(1));
MoveToEx(dc, 0, dy - j, NULL);
for(i=-20; i<=20; i++)
{
//j = (int)((Effect((float)(i-10.f)*(i-10.f)/400)*dy));
//LineTo(dc, i*dx/20, dy - j);
ii = i>0 ? i : -i;
j = (int)(dy * Effect(((float)ii)/20));
LineTo(dc, (20+i)*dx/40, dy - j);
}
// Do not call CFormView::OnPaint() for painting messages
}
#define MAXLIN 40
/*
float CDlgEditPoints::Effect(float dist)
{
return (float)exp(-m_fLinearity*MAXLIN*dist);
//return (float)exp(-0.5*MAXLIN*dist);
}
*/
/*
float CDlgEditPoints::Effect(float x)
{
double t = 0.1 + m_fLinearity * 0.8;
double t2 = t * t;
double t3 = t2 * t;
double t4 = t3 * t;
double t5 = t4 * t;
double b = (2*t4 + 5*t3 - 4*t2 - 3*t +2)/(t5 - 2*t4 + t3);
double a = (-b*(t3-t2) + t2 + t - 1)/(t4 - t2);
double c = -a - b - 1;
float y = (float)(x*x*x*x*a + x*x*x*b + x*x*c + 1);
return y;
}
*/
/*
float CDlgEditPoints::Effect(float x)
{
double t = 0.05 + m_fLinearity * 0.90;
float y = (float)(x<t ? (t-x+x*t)/t : (t-t*x)/(1-t));
return y;
}
*/
/*
float Graphic[9][2] = {{0,30}, {1,17}, {2,10}, {3,6}, {4,4}, {6,3}, {10,2}, {17,1}, {30,0}};
float Graphic2[9][2] = {{0,30}, {13,29}, {20,28}, {24,27}, {26,26}, {27,24}, {28,20}, {29,13}, {30,0}};
float CDlgEditPoints::Effect(float x)
{
int i;
for(i=1; (i<9) && (x>Graphic[i][0]/30); i++);
float y = Graphic[i-1][1]/30 + (Graphic[i][1]-Graphic[i-1][1])*(x-Graphic[i-1][0]/30)/(Graphic[i][0]-Graphic[i-1][0]);
for(i=1; (i<9) && (x>Graphic2[i][0]/30); i++);
float y2 = Graphic2[i-1][1]/30 + (Graphic2[i][1]-Graphic2[i-1][1])*(x-Graphic2[i-1][0]/30)/(Graphic2[i][0]-Graphic2[i-1][0]);
y = (1-m_fLinearity) * y + m_fLinearity * y2;
return y;
}
*/
float g0[10][2] = {{0,36}, {1,36}, {2,35}, {3,27}, {4,8}, {5,5}, {7,3}, {10,2}, {19,1}, {36,0}};
float g1[10][2] = {{0,36}, {1,36}, {3,36}, {12,36}, {31,35}, {33.5,33.5}, {35,31}, {36,28}, {36,18}, {36,0}};
float CDlgEditPoints::Effect(float x)
{
int i;
float a,x0,y0,x1,y1,y;
x = x * 36;
a = m_fLinearity;
x0 = (1-a)*g0[0][0] + a*g1[0][0];
y0 = (1-a)*g0[0][1] + a*g1[0][1];
x1 = (1-a)*g0[1][0] + a*g1[1][0];
y1 = (1-a)*g0[1][1] + a*g1[1][1];
for(i=2; (i<10) && (x>x1); i++)
{
x0 = x1; y0 = y1;
x1 = (1-a)*g0[i][0] + a*g1[i][0];
y1 = (1-a)*g0[i][1] + a*g1[i][1];
}
y = y0+(y1-y0)*(x-x0)/(x1-x0);
return y/36;
}
void CDlgEditPoints::Init()
{
CSliderCtrl *Slider = (CSliderCtrl*)GetDlgItem(IDC_SLIDER1);
Slider->SetRange(0, 400, TRUE);
m_fLinearity = ((float)Slider->GetPos()/400);
CStaticLine *Static = (CStaticLine*)GetDlgItem(IDC_STATIC_LINE);
//m_StaticLine.Init(&m_fLinearity);
//Static->Init(&m_fLinearity);
//Static->SendMessage(WM_PAINT);
RedrawWindow();
}
void CDlgEditPoints::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
// TODO: Add your message handler code here and/or call default
CFormView::OnHScroll(nSBCode, nPos, pScrollBar);
CSliderCtrl *Slider = (CSliderCtrl*)GetDlgItem(IDC_SLIDER1);
m_fLinearity = ((float)Slider->GetPos()/400);
// RedrawWindow();
RedrawWindow( NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);
/*
CStaticLine *Static = (CStaticLine*)GetDlgItem(IDC_STATIC_LINE);
//CPaintDC dc(Static); // device context for painting
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
RECT r;
Static->GetClientRect(&r);
int dx = (r.right - r.left);
int dy = (r.bottom - r.top);
MoveToEx(dc, 0, 0, NULL);
int i,j;
for(i=0; i<=20; i++)
{
j = (int)((Static->Effect((float)(i-10.f)*(i-10.f)/400)*dy));
LineTo(dc, i*dx/20, dy - j);
}
LineTo(dc, dx, dy);
*/
}
/////////////////////////////////////////////////////////////////////////////
// CStaticLine
CStaticLine::CStaticLine()
{
}
CStaticLine::~CStaticLine()
{
}
BEGIN_MESSAGE_MAP(CStaticLine, CStatic)
//{{AFX_MSG_MAP(CStaticLine)
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CStaticLine message handlers
void CStaticLine::Init(float * Lin)
{
m_pLin = Lin;
}
float CStaticLine::Effect(float dist)
{
return (float)exp(-*m_pLin*MAXLIN*dist);
//return (float)exp(-0.5*MAXLIN*dist);
}
void CStaticLine::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
RECT r;
GetClientRect(&r);
int dx = (r.right - r.left);
int dy = (r.bottom - r.top);
MoveToEx(dc, 0, 0, NULL);
int i,j;
for(i=0; i<=20; i++)
{
//j = (int)((Effect((float)(i-10.f)*(i-10.f)/400)*dy));
j = (int)(dy * Effect(((float)i)/20));
LineTo(dc, i*dx/20, j);
}
LineTo(dc, dx, dy);
// Do not call CStatic::OnPaint() for painting messages
}

View File

@@ -0,0 +1,113 @@
//
// Common functions for Object DLL capabilities
// C. Beaudet
//
#include "stdafx.h"
#include "afxdllx.h"
#include "ACP_Base.h"
#include "ITF.h"
#include "3Dinterf.hpp"
//------------------------------------------------------------------------
// Global vars
static char *gs_p_szCPAVersion = C_szCPAVersion;
static AFX_EXTENSION_MODULE NEAR extensionDLL = { NULL, NULL };
#ifdef DLL_ONLY_ONE_INSTANCE
static Geometry3D_Interface *gs_p_oGeometry3DInterface;
#endif
static CList<CPA_DLLBase*,CPA_DLLBase*> g_oListOfInstances; //private internal
//------------------------------------------------------------------------
// functions that are present in all DLL :
//------------------------------------------------------------------------
//========================================================================
// Get current CPA version
//========================================================================
extern "C" char __declspec(dllexport) *fn_p_szGetCPAVersion(void)
{
return gs_p_szCPAVersion;
}
//========================================================================
// Get type of this DLL
//========================================================================
extern "C" tdstDLLIdentity __declspec(dllexport) *fn_p_stGetDLLIdentity(void)
{
g_stGeometry3DIdentity . eType = OBJECT_DLL;
g_stGeometry3DIdentity . csName = C_szDLLGeometryName;
g_stGeometry3DIdentity . hModule = NULL;
g_stGeometry3DIdentity . p_oListOfInstances = &g_oListOfInstances;
return &g_stGeometry3DIdentity;
}
//========================================================================
// DLL int function
//========================================================================
extern "C" void __declspec(dllexport) fn_vInitDll(void)
{
new CDynLinkLibrary(extensionDLL);
}
//========================================================================
// DLL entry point
//========================================================================
extern "C" int __stdcall DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
if (dwReason == DLL_PROCESS_ATTACH)
{
if (!AfxInitExtensionModule(extensionDLL, hInstance))
return 0;
}
return 1;
}
//========================================================================
// Get the DLL
//========================================================================
CPA_DLLBase __declspec(dllexport) *fn_p_oGetDLL(long lKey)
{
#ifdef DLL_ONLY_ONE_INSTANCE
switch(lKey)
{
case 0: // the game world
if (gs_p_oGeometry3DInterface == NULL)
{
gs_p_oGeometry3DInterface = new Geometry3D_Interface();
ASSERT(gs_p_oGeometry3DInterface != NULL);
}
return gs_p_oGeometry3DInterface;
break;
default:
return NULL;
}
#else //DLL_ONLY_ONE_INSTANCE
switch(lKey)
{
case 0: // the game world
return new Geometry3D_Interface();
break;
default:
return NULL;
}
#endif //DLL_ONLY_ONE_INSTANCE
}
//------------------------------------------------------------------------
// functions that are present in this type of DLL only :
//------------------------------------------------------------------------
#undef DLL_ONLY_ONE_INSTANCE