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,121 @@
# Microsoft Developer Studio Project File - Name="morph" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=morph - Win32 Debug
!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 "mor.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 "mor.mak" CFG="morph - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "morph - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "morph - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE "morph - Win32 Retail" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""$/cpa/tempgrp/morph", EEIAAAAA"
# PROP Scc_LocalPath "."
CPP=cl.exe
!IF "$(CFG)" == "morph - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "x:\cpa\lib"
# PROP Intermediate_Dir "Tmp\Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "X:\CPA\Public" /I "T:\dxsdk\sdk\inc" /D "NDEBUG" /D "VISUAL" /D "WIN32" /D "USE_PROFILER" /YX /FD /c
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"X:\CPA\Lib\morp5_vr.lib"
!ELSEIF "$(CFG)" == "morph - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "x:\cpa\lib"
# PROP Intermediate_Dir "tmp\debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /Zi /Od /I "X:\CPA\Public" /I "T:\dxsdk\sdk\inc" /D "_DEBUG" /D "VISUAL" /D "WIN32" /D "USE_PROFILER" /D "MTH_CHECK" /D "CPA_WANTS_EXPORT" /FR /YX /FD /c
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"X:\CPA\Lib\morp5_vd.lib"
!ELSEIF "$(CFG)" == "morph - Win32 Retail"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "morph___"
# PROP BASE Intermediate_Dir "morph___"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "x:/cpa/lib"
# PROP Intermediate_Dir "tmp/retail"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /I "X:\CPA\Public" /I "T:\Dxsdk\sdk\inc" /D "NDEBUG" /D "CPA_WANTS_EXPORT" /D "WIN32" /D "_WINDOWS" /D "VISUAL" /D "WIN95" /D "RAY2EGYPTE" /D "RAYII" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "X:\CPA\Public" /I "T:\dxsdk\sdk\inc" /D "NDEBUG" /D "VISUAL" /D "WIN32" /D "RETAIL" /YX /FD /c
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo /out:"X:\CPA\Lib\morp5_vr.lib"
# ADD LIB32 /nologo /out:"X:\CPA\Lib\morp5_vf.lib"
!ENDIF
# Begin Target
# Name "morph - Win32 Release"
# Name "morph - Win32 Debug"
# Name "morph - Win32 Retail"
# Begin Source File
SOURCE=.\specif\dupobjmp.c
# End Source File
# Begin Source File
SOURCE=..\..\public\Mor.h
# End Source File
# Begin Source File
SOURCE=.\mor.mak
# End Source File
# Begin Source File
SOURCE=.\specif\morph.c
# End Source File
# Begin Source File
SOURCE=..\..\public\mor\specif\MORPH.H
# End Source File
# End Target
# End Project

View File

@@ -0,0 +1,237 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="morph"
ProjectGUID="{12D76371-168F-4AA6-AEF1-2DB8E163EE20}"
SccProjectName="&quot;$/CPA/tempgrp/MOR&quot;, FFNAAAAA"
SccAuxPath=""
SccLocalPath="."
SccProvider="MSSCCI:Microsoft Visual SourceSafe">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="x:\cpa\libd"
IntermediateDirectory=".\tmp\debug"
ConfigurationType="4"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="X:\CPA\Public,T:\dxsdk\sdk\inc"
PreprocessorDefinitions="_DEBUG;VISUAL;WIN32;USE_PROFILER;MTH_CHECK;CPA_WANTS_EXPORT"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\tmp\debug/mor.pch"
AssemblerListingLocation=".\tmp\debug/"
ObjectFile=".\tmp\debug/"
ProgramDataBaseFileName=".\tmp\debug/"
BrowseInformation="1"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="X:\CPA\Libd\morp5_vd.lib"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="x:\cpa\lib"
IntermediateDirectory=".\Tmp\Release"
ConfigurationType="4"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="X:\CPA\Public,T:\dxsdk\sdk\inc"
PreprocessorDefinitions="NDEBUG;VISUAL;WIN32;USE_PROFILER"
StringPooling="TRUE"
RuntimeLibrary="4"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Tmp\Release/mor.pch"
AssemblerListingLocation=".\Tmp\Release/"
ObjectFile=".\Tmp\Release/"
ProgramDataBaseFileName=".\Tmp\Release/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="X:\CPA\Lib\morp5_vr.lib"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Retail|Win32"
OutputDirectory="x:/cpa/lib"
IntermediateDirectory=".\tmp/retail"
ConfigurationType="4"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="X:\CPA\Public,T:\dxsdk\sdk\inc"
PreprocessorDefinitions="NDEBUG;VISUAL;WIN32;RETAIL"
StringPooling="TRUE"
RuntimeLibrary="4"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\tmp/retail/mor.pch"
AssemblerListingLocation=".\tmp/retail/"
ObjectFile=".\tmp/retail/"
ProgramDataBaseFileName=".\tmp/retail/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="X:\CPA\Lib\morp5_vf.lib"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath="specif\dupobjmp.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\public\Mor.h">
</File>
<File
RelativePath="mor.mak">
</File>
<File
RelativePath="specif\morph.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\public\mor\specif\MORPH.H">
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

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

View File

@@ -0,0 +1,213 @@
/**********************************************************
* *
* Morphing *
* *
* This file contains the function to deal with *
* geometric and physical objects *
* *
* Author : Ubi China - Alexis Vaisse *
* *
**********************************************************/
//XB
#define D_3dData_StructureDefine
#define D_ObjsTbls_Define
#define PO_FRIEND
#include "ACP_base.h"
#include "GAM/ToolsCPA.h"
#include "gam.h"
#include "GMT.h"
#include "GEO.h"
#include "GLI.h"
#include "PCS.h"
#include "COL.h"
#include "PO.h"
#define HieFriend
#include "SPO.h"
#include "mec.h"
#include "prt.h"
#include "fil.h"
#include "snd.h"
//#include "fon.h"
#include "ipt.h"
#define ENV_FRIEND
//#include "env.h"
//#include "srf.h"
#include "sct.h"
// ANNECY - MT 08/05/98 {
#include "TMP.h"
// END ANNECY MT }
#include "x:/cpa/tempgrp/gliglou/multidrv/inc/visus_st.h"
#include "mor.h"
/* Macro */
// ANNECY - MT 08/05/98 {
#define GEO_M_DuplicateElement( Elem ) \
MMG_fn_vAddMemoryInfo (MMG_C_lTypeMOR , MMG_C_lSubTypeElement , 0); \
MOR_M_pvMalloc (hObject2 -> d_stListOfElements [hElement] , void * , sizeof( Elem ) ); \
if (hObject2 -> d_stListOfElements [hElement] == NULL) return(NULL); \
hObject2 -> d_xListOfElementsTypes [hElement] = hObject1 -> d_xListOfElementsTypes [hElement]; \
memcpy (hObject2 -> d_stListOfElements [hElement] , hObject1 -> d_stListOfElements [hElement] , sizeof (Elem));
// END ANNECY MT }
/*====================================================================================
Name: MOR_fn_xCopyGeometricObjectForMorph
Goal: Make a copy of an existing geometric object. This copy will be used as morphed object
Code: Qi Zeyu
=====================================================================================*/
ACP_tdxHandleOfObject MOR_fn_xCopyGeometricObjectForMorph (GEO_tdstGeometricObject * hObject1)
{
ACP_tdxIndex xNbPoints;
ACP_tdxIndex xNbElements;
ACP_tdxHandleOfObject hObject2;
ACP_tdxHandleOfElement hElement;
xNbPoints = hObject1 -> xNbPoints;
xNbElements = hObject1 -> xNbElements;
// ANNECY - MT 08/05/98 {
GEO_vCreateTMPGeometricObject (& hObject2 , xNbPoints , xNbElements);
// END ANNECY MT }
if (hObject2 == NULL) return hObject2;
// copy the list of the points.
memcpy(hObject2->d_stListOfPoints, hObject1->d_stListOfPoints, sizeof(MTH3D_tdstVector)*xNbPoints);
// copy the list of the normals.
memcpy(hObject2->d_stListOfPointsNormals, hObject1->d_stListOfPointsNormals, sizeof(MTH3D_tdstVector)*xNbPoints);
// copy the list of element types
memcpy(hObject2->d_xListOfElementsTypes, hObject1->d_xListOfElementsTypes, sizeof(ACP_tdxIndex)* xNbElements);
// copy the elements
for(hElement=0 ; hElement<xNbElements ; hElement++)
{
switch (hObject1 -> d_xListOfElementsTypes [hElement])
{
case GEO_C_xElementNULL: break;
case GEO_C_xElementPoints: GEO_M_DuplicateElement( GEO_tdstElementPoints ) ; break;
case GEO_C_xElementLines: GEO_M_DuplicateElement( GEO_tdstElementLines ) ; break;
case GEO_C_xElementFaceMapDescriptors : GEO_M_DuplicateElement( GEO_tdstElementFaceMapDescriptors); break;
case GEO_C_xElementSprites: GEO_M_DuplicateElement( GEO_tdstElementSprite ) ; break;
case GEO_C_xElementSpheres: GEO_M_DuplicateElement( GEO_tdstElementSpheres ) ; break;
case GEO_C_xElementAlignedBoxes: GEO_M_DuplicateElement( GEO_tdstElementAlignedBoxes ) ; break;
case GEO_C_xElementCones: GEO_M_DuplicateElement( GEO_tdstIndexedCone ) ; break;
case GEO_C_xElementTMeshes: GEO_M_DuplicateElement( GEO_tdstElementTMeshes ) ; break;
case GEO_C_xElementIndexedTriangles : GEO_M_DuplicateElement( GEO_tdstElementIndexedTriangles ) ; break;
}
}
return hObject2;
}
/*====================================================================================
Name: MOR_fn_vDeleteGeometricObject
Goal: Delete a geometric object
=====================================================================================*/
void MOR_fn_vDeleteGeometricObject (ACP_tdxHandleOfObject *p_hObj )
{
long lElementCounter;
GEO_tdstGeometricObject * p_hObject ;
p_hObject= *(GEO_tdstGeometricObject **)p_hObj ;
for (lElementCounter = 0 ; lElementCounter < p_hObject -> xNbElements; lElementCounter ++ )
switch (p_hObject -> d_xListOfElementsTypes [lElementCounter ] )
{
// ANNECY - MT 08/05/98 {
case GEO_C_xElementNULL:
break;
case GEO_C_xElementPoints:
//MOR_M_Free( ((GEO_tdstElementPoints * )(p_hObject -> d_stListOfElements[lElementCounter ])) -> d_xListOfPointIndex);
MOR_M_Free( p_hObject -> d_stListOfElements[lElementCounter ] );
break;
case GEO_C_xElementLines:
//MOR_M_Free( ((GEO_tdstElementLines * )(p_hObject -> d_stListOfElements[lElementCounter ])) -> d_stListOfLineIndex);
//MOR_M_Free( ((GEO_tdstElementLines * )(p_hObject -> d_stListOfElements[lElementCounter ])) -> d_hListOfLinesMaterial);
//MOR_M_Free( ((GEO_tdstElementLines * )(p_hObject -> d_stListOfElements[lElementCounter ])) -> d_stListOfLinesReceivedLightIntensity);
MOR_M_Free( ((GEO_tdstElementLines * )(p_hObject -> d_stListOfElements[lElementCounter ])) );
break;
case GEO_C_xElementFaceMapDescriptors :
//MOR_M_Free( ((GEO_tdstElementFaceMapDescriptors * )(p_hObject -> d_stListOfElements[lElementCounter ])) -> d_stListOfFacesNormals);
//MOR_M_Free( ((GEO_tdstElementFaceMapDescriptors * )(p_hObject -> d_stListOfElements[lElementCounter ])) -> d_stListOfFacesReceivedLightIntensity);
//MOR_M_Free( ((GEO_tdstElementFaceMapDescriptors * )(p_hObject -> d_stListOfElements[lElementCounter ])) -> d_stListOfFacesQuadrupled);
MOR_M_Free( ((GEO_tdstElementFaceMapDescriptors * )(p_hObject -> d_stListOfElements[lElementCounter ])) );
break;
case GEO_C_xElementSprites:
//MOR_M_Free( ((GEO_tdstElementSprite * )(p_hObject -> d_stListOfElements[lElementCounter ])) -> d_stListOfSprites);
MOR_M_Free( ((GEO_tdstElementSprite * )(p_hObject -> d_stListOfElements[lElementCounter ])) );
break;
case GEO_C_xElementSpheres:
//MOR_M_Free( ((GEO_tdstElementSpheres * )(p_hObject -> d_stListOfElements[lElementCounter ])) -> d_stListOfSpheres );
MOR_M_Free( ((GEO_tdstElementSpheres * )(p_hObject -> d_stListOfElements[lElementCounter ])) );
break;
case GEO_C_xElementAlignedBoxes:
//MOR_M_Free( ((GEO_tdstElementAlignedBoxes * )(p_hObject -> d_stListOfElements[lElementCounter ])) -> d_stListOfAlignedBoxes);
MOR_M_Free( ((GEO_tdstElementAlignedBoxes * )(p_hObject -> d_stListOfElements[lElementCounter ])) );
break;
case GEO_C_xElementCones:
//MOR_M_Free( ((GEO_tdstElementCones * )(p_hObject -> d_stListOfElements[lElementCounter ])) -> d_stListOfCones);
MOR_M_Free( ((GEO_tdstElementCones * )(p_hObject -> d_stListOfElements[lElementCounter ])) );
break;
case GEO_C_xElementTMeshes:
//MOR_M_Free( ((GEO_tdstElementTMeshes * )(p_hObject -> d_stListOfElements[lElementCounter ])) -> d_stListOfMeshAtoms);
//MOR_M_Free( ((GEO_tdstElementTMeshes * )(p_hObject -> d_stListOfElements[lElementCounter ])) -> d_stListOfFacesNormals);
//MOR_M_Free( ((GEO_tdstElementTMeshes * )(p_hObject -> d_stListOfElements[lElementCounter ])) -> d_stListOfFacesReceivedLightIntensity);
//MOR_M_Free( ((GEO_tdstElementTMeshes * )(p_hObject -> d_stListOfElements[lElementCounter ])) -> d_stListOfElementUV);
MOR_M_Free( ((GEO_tdstElementTMeshes * )(p_hObject -> d_stListOfElements[lElementCounter ])) );
break;
case GEO_C_xElementIndexedTriangles :
//MOR_M_Free( ((GEO_tdstElementIndexedTriangles * )(p_hObject -> d_stListOfElements[lElementCounter ])) -> d_stListOfFacesTripled);
//MOR_M_Free( ((GEO_tdstElementIndexedTriangles * )(p_hObject -> d_stListOfElements[lElementCounter ])) -> d_stListOfFacesTripledIndexUV);
//MOR_M_Free( ((GEO_tdstElementIndexedTriangles * )(p_hObject -> d_stListOfElements[lElementCounter ])) -> d_stListOfFacesNormals);
//MOR_M_Free( ((GEO_tdstElementIndexedTriangles * )(p_hObject -> d_stListOfElements[lElementCounter ])) -> d_stListOfFacesReceivedLightIntensity);
//MOR_M_Free( ((GEO_tdstElementIndexedTriangles * )(p_hObject -> d_stListOfElements[lElementCounter ])) -> d_stListOfElementUV);
MOR_M_Free( ((GEO_tdstElementIndexedTriangles * )(p_hObject -> d_stListOfElements[lElementCounter ])) );
break;
}
MOR_M_Free( p_hObject -> d_stListOfPoints);
MOR_M_Free( p_hObject -> d_stListOfPointsNormals);
// if (p_hObject -> d_stListOfPointsReceivedLightIntensity != NULL)
// MOR_M_Free( p_hObject -> d_stListOfPointsReceivedLightIntensity);
// MOR_M_Free( p_hObject -> d_hListOfPointsMaterial);
// MOR_M_Free( p_hObject -> d_stListOfEdges);
// MOR_M_Free( p_hObject -> d_hListOfEdgesMaterial);
MOR_M_Free( p_hObject -> d_xListOfElementsTypes);
MOR_M_Free( p_hObject -> d_stListOfElements);
MOR_M_Free( p_hObject );
* p_hObj = NULL;
// END ANNECY MT }
}
/*====================================================================================
Name: MOR_fn_vDeletePhysicalObject
Goal: Delete a physical object
=====================================================================================*/
void MOR_fn_vDeletePhysicalObject (PO_tdstPhysicalObject * _pPhysicalObject)
{
ACP_tdxIndex i;
for(i=0 ; i<_pPhysicalObject->_hVisualSet->xNbLodDefinitions ; i++)
{
MOR_fn_vDeleteGeometricObject (& (_pPhysicalObject->_hVisualSet->d_p_stLodDefinitions [i]));
};
// ANNECY - MT 08/05/98 {
GEO_M_TMPFree(_pPhysicalObject->_hVisualSet->d_xThresholdsTable);
GEO_M_TMPFree(_pPhysicalObject->_hVisualSet->d_p_stLodDefinitions);
GEO_M_TMPFree(_pPhysicalObject->_hVisualSet);
MOR_M_Free(_pPhysicalObject);
// END ANNECY MT }
}

View File

@@ -0,0 +1,642 @@
/**********************************************************
* *
* Morphing *
* *
* This file contains the main functions for the morphing *
* *
* Author : Ubi China - Alexis Vaisse *
* *
**********************************************************/
#ifndef U64 //AR980226 These functions are in u_morph.c for U64
#define HieFriend
#define PO_FRIEND
#define ENV_FRIEND
#define D_3dData_StructureDefine
#define D_ObjsTbls_Define
#include "ACP_base.h"
#include "GAM/ToolsCPA.h"
#include "gam.h"
#include "GMT.h"
#include "GEO.h"
#include "GLI.h"
#include "PCS.h"
#include "COL.h"
#include "SPO.h"
#include "PO.h"
#include "mec.h"
#include "prt.h"
#include "fil.h"
#include "snd.h"
//#include "fon.h"
#include "ipt.h"
//#include "env.h"
//#include "srf.h"
#include "sct.h"
// ANNECY - MT 08/05/98 {
#include "TMP.h"
// END ANNECY MT }
#include "x:/cpa/tempgrp/gliglou/multidrv/inc/visus_st.h"
//End XB
#include "mor.h"
/* Variables */
int MaxMorphTask = -1; // The last morph task used. -1 if none
MOR_tdstMorphStruct MorphList [MAX_MORPH_TASKS]; // List of the objects being morphed
/*-----------------------------------------------------------------------------
* Name : MOR_fn_xPrepareMorph
*-----------------------------------------------------------------------------
* Status : public function
* Description : Launch a morphing task
*-----------------------------------------------------------------------------*/
ACP_tdxIndex MOR_fn_xPrepareMorph (HIE_tdxHandleToSuperObject _hActorSuperObject ,
ACP_tdxIndex _xStartIndexInObjectTable , ACP_tdxIndex _xEndIndexInObjectTable ,
int _iNbMillisecond , int _iStart , int _iEnd ,
unsigned char _ucMorphType , ACP_tdxIndex _xChannelIndex)
{
ACP_tdxIndex xMorphListIndex;
ACP_tdxIndex j;
ACP_tdxIndex xFreePosition=-1;
MOR_tdstMorphStruct * mp;
PO_tdstPhysicalObject* pStartPhysicalObject;
PO_tdstPhysicalObject* pEndPhysicalObject;
PO_tdstPhysicalObject* pNewPhysicalObject;
_xStartIndexInObjectTable --; // The user enters index >= 1
_xEndIndexInObjectTable --; // and internal indexes are >= 0
// Check if there is already a morphing in the given channel of the given actor
xMorphListIndex = fn_hMorphListIndex (_hActorSuperObject->hLinkedObject.p_stCharacter->h_3dData->hMorphChannelList,_xChannelIndex);
if(xMorphListIndex != -1 && MorphList [xMorphListIndex] . bInUse == TRUE) return -1;
// Find an empty position in the list
for(j=0 ; j<MAX_MORPH_TASKS ; j++)
{
if(MorphList[j] . bInUse == FALSE)
{
xFreePosition = j;
break;
}
}
if(xFreePosition == -1) return -1; // The list is full
// Check of the two objects have the same number of points
pStartPhysicalObject = (PO_tdxHandleToPhysicalObject) _hActorSuperObject->hLinkedObject.p_stCharacter->h_3dData->h_CurrentObjectsTable->d_stObjectsTable[_xStartIndexInObjectTable].h_Target;
pEndPhysicalObject = (PO_tdxHandleToPhysicalObject) _hActorSuperObject->hLinkedObject.p_stCharacter->h_3dData->h_CurrentObjectsTable->d_stObjectsTable[_xEndIndexInObjectTable].h_Target;
if (GLI_lGetVisualSetNumbertOfLOD(pStartPhysicalObject->_hVisualSet) != GLI_lGetVisualSetNumbertOfLOD(pEndPhysicalObject->_hVisualSet))
return -1; // The physical objects don't have the same number of geometric objects
for(j=0 ; j<GLI_lGetVisualSetNumbertOfLOD(pStartPhysicalObject->_hVisualSet); j++)
{
if (GLI_hGetVisualSetGeometricForADistance(pStartPhysicalObject->_hVisualSet,j)->xNbPoints !=
GLI_hGetVisualSetGeometricForADistance(pEndPhysicalObject->_hVisualSet,j) -> xNbPoints)
return -1; // The geometric objects don't have the same number of points
}
// Fill the element in the list
mp = MorphList + xFreePosition;
mp -> bInUse = TRUE;
// Copy the parameters
mp -> xChannelIndex = _xChannelIndex;
mp -> hActorSuperObject = _hActorSuperObject;
mp -> xStartIndexInObjectTable = _xStartIndexInObjectTable;
mp -> xEndIndexInObjectTable = _xEndIndexInObjectTable;
mp -> iNbMillisecond = _iNbMillisecond * 10;
mp -> iStart = _iStart * 10;
mp -> iEnd = _iEnd * 10;
mp -> iCurrent = _iStart * 10;
mp -> ucMorphType = _ucMorphType;
mp -> iStep = mp -> iStart <= mp -> iEnd ? 10 : -10;
// Store the original physical object
mp -> pOriginalPhysicalObject = pStartPhysicalObject;
// Create a new physical object
// ANNECY - MT 08/05/98 {
MMG_fn_vAddMemoryInfo (MMG_C_lTypeMOR , MMG_C_lSubTypePO , 0);
MOR_M_pvMalloc (pNewPhysicalObject , PO_tdstPhysicalObject * , sizeof (PO_tdstPhysicalObject));
// END ANNECY MT }
// Store it into the element of the list
mp -> pMorphedPhysicalObject = pNewPhysicalObject;
// Create its visual set
// ANNECY - MT 11/05/98 {
pNewPhysicalObject -> _hVisualSet = GLI_p_stCreateTMPVisualSet (GLI_lGetVisualSetNumbertOfLOD(pStartPhysicalObject->_hVisualSet));
// END ANNECY MT }
pNewPhysicalObject -> _hVisualSet -> xLastDistance = pStartPhysicalObject->_hVisualSet->xLastDistance;
pNewPhysicalObject -> _hVisualSet -> xNbLodDefinitions = (short)GLI_lGetVisualSetNumbertOfLOD(pStartPhysicalObject->_hVisualSet);
// Copy the collision set
pNewPhysicalObject -> _hCollideSet = pStartPhysicalObject->_hCollideSet;
pNewPhysicalObject -> _hBoundingVolume = pStartPhysicalObject->_hBoundingVolume;
// Create the geometric objects
for(j=0 ; j<GLI_lGetVisualSetNumbertOfLOD(pNewPhysicalObject->_hVisualSet) ; j++)
{
pNewPhysicalObject->_hVisualSet->d_xThresholdsTable[j] = mp -> pOriginalPhysicalObject->_hVisualSet->d_xThresholdsTable[j];
pNewPhysicalObject->_hVisualSet->d_p_stLodDefinitions[j] = MOR_fn_xCopyGeometricObjectForMorph (mp->pOriginalPhysicalObject->_hVisualSet->d_p_stLodDefinitions[j]);
}
// Put the morphed object into the list of morphed objects of the actor
fn_vPutMorphElementInChannel (_hActorSuperObject -> hLinkedObject . p_stCharacter -> h_3dData -> hMorphChannelList ,
_xChannelIndex , xFreePosition);
// Update MaxMorphTask (which contains the maximum index of the used elements in the list
if (xFreePosition > MaxMorphTask) MaxMorphTask = xFreePosition;
return xFreePosition;
}
/*-----------------------------------------------------------------------------
* Name : MOR_fn_xStopMorph
*-----------------------------------------------------------------------------
* Status : public function
* Description : Stop a morphing task
*-----------------------------------------------------------------------------*/
ACP_tdxIndex MOR_fn_xStopMorph(HIE_tdxHandleToSuperObject _hActorSuperObject, ACP_tdxIndex _xChannelIndex)
{
ACP_tdxIndex xMorphListIndex;
ACP_tdxIndex j;
MOR_tdstMorphStruct * mp=NULL;
// Check that the given channel of the given actor has a morphed object
xMorphListIndex = fn_hMorphListIndex (_hActorSuperObject->hLinkedObject.p_stCharacter->h_3dData->hMorphChannelList, _xChannelIndex);
if(xMorphListIndex == -1 || MorphList [xMorphListIndex] . bInUse == FALSE)
return -1; // Not found
// Find the element in the list
for(j=0 ; j<=MaxMorphTask ; j++)
{
mp=MorphList+j;
if (mp -> bInUse && mp -> hActorSuperObject == _hActorSuperObject && mp -> xChannelIndex == _xChannelIndex)
break;
else mp = NULL;
}
if (mp == NULL) return -1; // Not found into the list
// Replace the morphed object by the 'end' object in the hierarchy
MOR_fn_bRemoveMorphedObjectFromHierarchy (mp -> hActorSuperObject , mp -> pMorphedPhysicalObject,
(PO_tdxHandleToPhysicalObject) mp -> hActorSuperObject -> hLinkedObject . p_stCharacter -> h_3dData ->
h_CurrentObjectsTable -> d_stObjectsTable [mp -> xEndIndexInObjectTable] . h_Target);
// Delete the created physical object
MOR_fn_vDeletePhysicalObject (mp -> pMorphedPhysicalObject);
mp -> pMorphedPhysicalObject = NULL;
// Remove the element in the list (if we remove the last morph task, we can decreaze MaxMorphTask)
MOR_fn_vCleanMorph (mp);
if (j == MaxMorphTask) MaxMorphTask --;
// Remove the morphed object from the list of morphed objects of the actor
fn_vRemoveChannelFromMorphList (_hActorSuperObject -> hLinkedObject . p_stCharacter -> h_3dData -> hMorphChannelList , _xChannelIndex);
return 0; // No error
}
/*-----------------------------------------------------------------------------
* Name : MOR_fn_xMorphing
*-----------------------------------------------------------------------------
* Status : public function
* Description : Morph an object in a channel
*-----------------------------------------------------------------------------*/
ACP_tdxIndex MOR_fn_xMorphing (HIE_tdxHandleToSuperObject _hActorSuperObject ,
ACP_tdxIndex _xStartIndexInObjectTable , ACP_tdxIndex _xEndIndexInObjectTable ,
int _iRatio , ACP_tdxIndex _xChannelIndex)
{
ACP_tdxIndex xMorphListIndex;
ACP_tdxIndex j;
MOR_tdstMorphStruct * mp;
PO_tdstPhysicalObject* pStartPhysicalObject;
PO_tdstPhysicalObject* pEndPhysicalObject;
PO_tdstPhysicalObject* pNewPhysicalObject;
ACP_tdxBool bCreateObject;
// Check of the two objects have the same number of points
pStartPhysicalObject = (PO_tdxHandleToPhysicalObject) _hActorSuperObject->hLinkedObject.p_stCharacter->h_3dData->h_CurrentObjectsTable->d_stObjectsTable[_xStartIndexInObjectTable].h_Target;
pEndPhysicalObject = (PO_tdxHandleToPhysicalObject) _hActorSuperObject->hLinkedObject.p_stCharacter->h_3dData->h_CurrentObjectsTable->d_stObjectsTable[_xEndIndexInObjectTable].h_Target;
if (GLI_lGetVisualSetNumbertOfLOD(pStartPhysicalObject->_hVisualSet) != GLI_lGetVisualSetNumbertOfLOD(pEndPhysicalObject->_hVisualSet))
return -1; // The physical objects don't have the same number of geometric objects
for(j=0 ; j<GLI_lGetVisualSetNumbertOfLOD(pStartPhysicalObject->_hVisualSet); j++)
{
if (pStartPhysicalObject -> _hVisualSet -> d_p_stLodDefinitions [j] -> xNbPoints !=
pEndPhysicalObject -> _hVisualSet -> d_p_stLodDefinitions [j] -> xNbPoints)
return -1; // The geometric objects don't have the same number of points
}
// Check if there is already a morphing in the given channel of the given actor
xMorphListIndex = fn_hMorphListIndex (_hActorSuperObject->hLinkedObject.p_stCharacter->h_3dData->hMorphChannelList,_xChannelIndex);
// If not, create the morphing task
if (xMorphListIndex == -1 || MorphList [xMorphListIndex] . bInUse == FALSE)
{
xMorphListIndex = -1;
// Find an empty position in the list
for(j=0 ; j<MAX_MORPH_TASKS ; j++)
{
if(MorphList[j] . bInUse == FALSE)
{
xMorphListIndex = j;
break;
}
}
if(xMorphListIndex == -1)
return -1; // The list is full
bCreateObject = TRUE;
}
else bCreateObject = FALSE;
// Fill the element in the list
mp = MorphList + xMorphListIndex;
mp -> bInUse = TRUE;
// Copy the parameters
mp -> xChannelIndex = _xChannelIndex;
mp -> hActorSuperObject = _hActorSuperObject;
mp -> xStartIndexInObjectTable = _xStartIndexInObjectTable;
mp -> xEndIndexInObjectTable = _xEndIndexInObjectTable;
mp -> iNbMillisecond = 100; // 10 milliseconds < 1/60 second
mp -> iEnd = _iRatio;
mp -> iStart = mp -> iEnd - 1;
mp -> iCurrent = mp -> iStart;
mp -> ucMorphType = MORPH_WAITATEND;
mp -> iStep = 10;
// Store the original physical object
mp -> pOriginalPhysicalObject = pStartPhysicalObject;
if (bCreateObject)
{
// Create a new physical object
// ANNECY - MT 08/05/98 {
MMG_fn_vAddMemoryInfo (MMG_C_lTypeMOR , MMG_C_lSubTypePO , 0);
MOR_M_pvMalloc (pNewPhysicalObject , PO_tdstPhysicalObject * , sizeof (PO_tdstPhysicalObject));
// END ANNECY MT }
// Store it into the element of the list
mp -> pMorphedPhysicalObject = pNewPhysicalObject;
// Create its visual set
// ANNECY - MT 11/05/98 {
pNewPhysicalObject -> _hVisualSet = GLI_p_stCreateTMPVisualSet (GLI_lGetVisualSetNumbertOfLOD(pStartPhysicalObject->_hVisualSet));
// END ANNECY MT }
pNewPhysicalObject -> _hVisualSet -> xLastDistance = pStartPhysicalObject->_hVisualSet->xLastDistance;
pNewPhysicalObject -> _hVisualSet -> xNbLodDefinitions = (short)GLI_lGetVisualSetNumbertOfLOD(pStartPhysicalObject->_hVisualSet);
// Copy the collision set
pNewPhysicalObject -> _hCollideSet = pStartPhysicalObject->_hCollideSet;
pNewPhysicalObject -> _hBoundingVolume = pStartPhysicalObject->_hBoundingVolume;
// Create the geometric objects
for(j=0 ; j<GLI_lGetVisualSetNumbertOfLOD(pNewPhysicalObject->_hVisualSet) ; j++)
{
pNewPhysicalObject->_hVisualSet->d_xThresholdsTable[j] = mp -> pOriginalPhysicalObject->_hVisualSet->d_xThresholdsTable[j];
pNewPhysicalObject->_hVisualSet->d_p_stLodDefinitions[j] = MOR_fn_xCopyGeometricObjectForMorph (mp->pOriginalPhysicalObject->_hVisualSet->d_p_stLodDefinitions[j]);
}
// Put the morphed object into the list of morphed objects of the actor
fn_vPutMorphElementInChannel (_hActorSuperObject -> hLinkedObject . p_stCharacter -> h_3dData -> hMorphChannelList ,
_xChannelIndex , xMorphListIndex);
}
// Update MaxMorphTask (which contains the maximum index of the used elements in the list
if (xMorphListIndex > MaxMorphTask) MaxMorphTask = xMorphListIndex;
return xMorphListIndex;
}
/*-----------------------------------------------------------------------------
* Name : MOR_fn_vMorphTo
*-----------------------------------------------------------------------------
* Status : private function
* Description : Compute one frame of a morphed object
*-----------------------------------------------------------------------------*/
void MOR_fn_vMorphTo (MOR_tdstMorphStruct * mp)
{
MTH_tdxReal xRatio;
ACP_tdxIndex i,j;
PO_tdstPhysicalObject * phy1 , * phy2 , * phy3;
GEO_tdstGeometricObject * geo1 , * geo2 , * geo3;
// Compute the ratio (between 0 and 1)
xRatio = MTH_M_xDiv (MTH_M_xLongToReal (mp -> iCurrent) , MTH_M_xLongToReal (mp -> iNbMillisecond));
if (MTH_M_bGreater (xRatio , MTH_C_ONE )) xRatio = MTH_C_ONE;
else
if (MTH_M_bLess (xRatio , MTH_C_ZERO)) xRatio = MTH_C_ZERO;
// Get the physical object : phy1 is the 'start' object, phy2 the 'end' object and phy3 the morphed object
phy1 = (PO_tdxHandleToPhysicalObject) mp -> hActorSuperObject -> hLinkedObject . p_stCharacter -> h_3dData ->
h_CurrentObjectsTable -> d_stObjectsTable [mp -> xStartIndexInObjectTable] . h_Target;
phy2 = (PO_tdxHandleToPhysicalObject) mp -> hActorSuperObject -> hLinkedObject . p_stCharacter -> h_3dData ->
h_CurrentObjectsTable -> d_stObjectsTable [mp -> xEndIndexInObjectTable ] . h_Target;
phy3 = mp -> pMorphedPhysicalObject;
// For each geometric object of the physical object ...
for(i=0 ; i<GLI_lGetVisualSetNumbertOfLOD(phy1->_hVisualSet) ; i++)
{
geo1 = phy1 -> _hVisualSet -> d_p_stLodDefinitions [i];
geo2 = phy2 -> _hVisualSet -> d_p_stLodDefinitions [i];
geo3 = phy3 -> _hVisualSet -> d_p_stLodDefinitions [i];
// For each point of the geometric object ...
for(j=0 ; j<geo3 -> xNbPoints ; j++)
{
MTH3D_M_vLinearInterpolVector (& geo3 -> d_stListOfPoints [j] , & geo1 -> d_stListOfPoints [j] ,
& geo2 -> d_stListOfPoints [j] , xRatio);
/* The calculation of the normals is done by the GEO_vEndModifyObject2 function
MTH3D_M_vLinearInterpolVector (& geo3 -> d_stListOfPointsNormals [j] ,
& geo1 -> d_stListOfPointsNormals [j] ,
& geo2 -> d_stListOfPointsNormals [j] , xRatio);
*/
}
// Recompute the normals
GEO_vEndModifyObject2 (geo3);
}
}
/*-----------------------------------------------------------------------------
* Name : MOR_fn_vCleanMorph
*-----------------------------------------------------------------------------
* Status : private function
* Description : Remove one element in the list of morph elements
*-----------------------------------------------------------------------------*/
void MOR_fn_vCleanMorph (MOR_tdstMorphStruct * mp)
{
if( mp -> bInUse == FALSE) return;
memset(mp , 0 , sizeof (MOR_tdstMorphStruct));
mp -> bInUse = FALSE;
}
/*-----------------------------------------------------------------------------
* Name : MOR_fn_vMorphAddInMainLoop
*-----------------------------------------------------------------------------
* Status : public function
* Description : Call each frame to compute the morphed objects
*-----------------------------------------------------------------------------*/
void GEO_fn_vMorphAddInMainLoop (void)
{
ACP_tdxIndex i;
MOR_tdstMorphStruct * mp;
int iIncrement;
for(i=0 ; i<=MaxMorphTask ; i++)
{
mp = MorphList + i;
if(mp -> bInUse)
{
// Increaze the counter of the duration of the last frame (in millisecond)
iIncrement = g_stEngineStructure.stEngineTimer.ulUsefulDeltaTime * mp -> iStep;
mp -> iCurrent += iIncrement;
switch (mp -> ucMorphType)
{
case MORPH_STOPATEND:
// If we have reached the end of the morphing, we stop the morphing task
if(mp -> iCurrent > mp -> iEnd)
{
// Replace the morphed object by the 'end' object in the hierarchy
MOR_fn_bRemoveMorphedObjectFromHierarchy (mp -> hActorSuperObject, mp -> pMorphedPhysicalObject,
(PO_tdxHandleToPhysicalObject) mp -> hActorSuperObject -> hLinkedObject . p_stCharacter -> h_3dData ->
h_CurrentObjectsTable -> d_stObjectsTable [mp -> xEndIndexInObjectTable] . h_Target);
// Delete the create physical object
MOR_fn_vDeletePhysicalObject (mp -> pMorphedPhysicalObject);
// Remove the morphed object from the list of morphed objects of the actor
fn_vRemoveChannelFromMorphList (mp -> hActorSuperObject -> hLinkedObject . p_stCharacter -> h_3dData -> hMorphChannelList, mp -> xChannelIndex);
// Remove the element in the list (if we remove the last morph task, we can decreaze MaxMorphTask)
MOR_fn_vCleanMorph (mp);
if (i == MaxMorphTask) MaxMorphTask --;
break;
}
// Compute the morphed object
MOR_fn_vMorphTo (mp);
break;
case MORPH_WAITATEND:
// If we have reached the end of the morphing ...
if (mp -> iCurrent > mp -> iEnd)
{
// If the last computed frame was not the 'end' frame, we compute it
if (mp -> iCurrent - iIncrement < mp -> iEnd) mp -> iCurrent = mp -> iEnd;
// Else we do nothing
else break;
}
// Compute the morphed object
MOR_fn_vMorphTo (mp);
break;
case MORPH_ROLLBACKATEND:
// If we have reached the end of the first morph (from 'Start' to 'End')
if(mp -> iCurrent > mp -> iEnd)
{
if ( mp -> iCurrent < mp -> iEnd + (mp -> iEnd - mp -> iStart))
mp -> iCurrent = mp -> iEnd - (mp -> iCurrent - mp -> iEnd);
else mp -> iCurrent = mp -> iEnd;
mp -> iStep = - abs (mp -> iStep);
}
else
// If we have reached the end of the second morph (from 'End' to 'Start')
if (mp -> iCurrent < mp -> iStart)
{
if (mp -> iCurrent > mp -> iStart - (mp -> iEnd - mp -> iStart))
mp -> iCurrent = mp -> iStart + (mp -> iStart - mp -> iCurrent);
else mp -> iCurrent = mp -> iStart;
mp -> iStep = abs (mp -> iStep);
}
// Compute the morphed object
MOR_fn_vMorphTo (mp);
break;
} // end switch
} // end if
} // end for
}
/*-----------------------------------------------------------------------------
* Name : MOR_fn_vFirstInitMorphTaskList
*-----------------------------------------------------------------------------
* Status : public function
* Description : Initialization of the morphing module
*-----------------------------------------------------------------------------*/
void fn_vFirstInitMorphTaskList()
{
memset (MorphList , 0 , sizeof (MOR_tdstMorphStruct) * MAX_MORPH_TASKS);
}
/*-----------------------------------------------------------------------------
* Name : MOR_fn_vLastDeinitMorphTaskList
*-----------------------------------------------------------------------------
* Status : public function
* Description : Desinitialization of the morphing module
*-----------------------------------------------------------------------------*/
void fn_vLastDeinitMorphTaskList()
{
ACP_tdxIndex i;
for(i=0 ; i<=MaxMorphTask ; i++)
{
if(MorphList[i] . bInUse)
{
MOR_fn_vCleanMorph (MorphList + i);
}
}
}
/*-----------------------------------------------------------------------------
* Name : MOR_fn_bIsChannelMorphed
*-----------------------------------------------------------------------------
* Status : public function
* Description : Return TRUE if there is a morphed object in the given channel of the given actor
*-----------------------------------------------------------------------------*/
ACP_tdxBool MOR_fn_bIsChannelMorphed (HIE_tdxHandleToSuperObject _hActorSuperObject, ACP_tdxIndex _xChannelIndex)
{
ACP_tdxIndex i;
MOR_tdstMorphStruct * mp;
for (i = 0 ; i <= MaxMorphTask ; i ++)
{
mp = MorphList + i;
if (mp -> bInUse && mp -> hActorSuperObject == _hActorSuperObject && mp -> xChannelIndex == _xChannelIndex)
{
// With the 'MORPH_WAITATEND' or 'MORPH_STOPATEND' type, the morphing is finished if we have reached the end
if ((mp -> ucMorphType == MORPH_WAITATEND || mp -> ucMorphType == MORPH_STOPATEND) && mp -> iCurrent >= mp -> iEnd)
return FALSE;
else return TRUE;
}
}
return FALSE; // Not found
}
/*-----------------------------------------------------------------------------
* Name : MOR_fn_vRemoveAllMorphedObject
*-----------------------------------------------------------------------------
* Status : public function
* Description : Remove all the morphed objects (used when there is a 'Reinit the map' or when entering the editor)
*-----------------------------------------------------------------------------*/
void MOR_fn_vRemoveAllMorphedObjects (void)
{
ACP_tdxIndex i;
MOR_tdstMorphStruct * mp;
for (i = 0 ; i <= MaxMorphTask ; i ++)
{
mp = MorphList + i;
if (mp -> bInUse)
{
// Replace the morphed object by the original physical object in the hierarchy
MOR_fn_bRemoveMorphedObjectFromHierarchy (mp -> hActorSuperObject , mp -> pMorphedPhysicalObject , mp -> pOriginalPhysicalObject);
// Remove the morphed object from the list of morphed objects of the actor
if (mp->hActorSuperObject->hLinkedObject.p_stCharacter->h_StandardGame)
fn_vRemoveChannelFromMorphList (mp -> hActorSuperObject -> hLinkedObject . p_stCharacter -> h_3dData -> hMorphChannelList, mp -> xChannelIndex);
// Delete the created physical object
MOR_fn_vDeletePhysicalObject (mp->pMorphedPhysicalObject);
// Remove the element in the list
MOR_fn_vCleanMorph (mp);
}
}
MaxMorphTask = -1;
}
/*-----------------------------------------------------------------------------
* Name : MOR_fn_bRemoveMorphedObjectFromHierarchy
*-----------------------------------------------------------------------------
* Status : Private function
* Description : Recursiv function to remove and replace an object in the hierarchy
*-----------------------------------------------------------------------------*/
ACP_tdxBool MOR_fn_bRemoveMorphedObjectFromHierarchy (HIE_tdxHandleToSuperObject hSuperObject ,
PO_tdstPhysicalObject * p_stPhysicalObjectToRemove ,
PO_tdstPhysicalObject * p_stPhysicalObjectToPut)
{
HIE_tdxHandleToSuperObject hChildSuperObject;
ACP_tdxIndex i;
if (HIE_fn_hGetSuperObjectObject (hSuperObject) == p_stPhysicalObjectToRemove)
{
HIE_fn_vSetSuperObjectObjectAndType (hSuperObject , p_stPhysicalObjectToPut , HIE_C_ulPO);
return TRUE;
}
HIE_M_ForEachChildOf (hSuperObject , hChildSuperObject , i)
{
if (MOR_fn_bRemoveMorphedObjectFromHierarchy (hChildSuperObject , p_stPhysicalObjectToRemove , p_stPhysicalObjectToPut))
return TRUE;
}
return FALSE;
}
/*-----------------------------------------------------------------------------
* Name : MOR_fn_hGetMorphedObject
*-----------------------------------------------------------------------------
* Status : Public function
* Description : Return the morphed object of an element in the list
*-----------------------------------------------------------------------------*/
PO_tdxHandleToPhysicalObject MOR_fn_hGetMorphedObject (ACP_tdxIndex _xIndex)
{
return MorphList [_xIndex] . pMorphedPhysicalObject;
}
/*----------------------------------------------------------------------------
-- Description : MOR_fn_vDoMorph
-- Execute the morphing operation corresponding to an index into the morph
-- task list
------------------------------------------------------------------------------
-- Methods : Use the morphto function
------------------------------------------------------------------------------
-- Input : _xIndex : Index of the task
-- Output :
------------------------------------------------------------------------------
-- Creation date : Mar 97 Author: Alain Robin
------------------------------------------------------------------------------
-- Modifications :
-- Modification date : Modification author :
----------------------------------------------------------------------------*/
void MOR_fn_vDoMorph(ACP_tdxIndex _xIndex)
{
MOR_tdstMorphStruct * mp;
mp = MorphList + _xIndex;
MOR_fn_vMorphTo(mp);
}
#endif //U64 AR980226