diff options
Diffstat (limited to 'intern')
135 files changed, 14863 insertions, 794 deletions
diff --git a/intern/SConscript b/intern/SConscript index 2d68969c783..82c7739bf42 100644 --- a/intern/SConscript +++ b/intern/SConscript @@ -2,17 +2,17 @@ Import ('env') SConscript(['SoundSystem/SConscript', - 'string/SConscript', - 'ghost/SConscript', - 'guardedalloc/SConscript', - 'bmfont/SConscript', - 'moto/SConscript', - 'container/SConscript', - 'memutil/SConscript/', - 'decimation/SConscript', - 'iksolver/SConscript', - 'boolop/SConscript', - 'opennl/SConscript']) + 'string/SConscript', + 'ghost/SConscript', + 'guardedalloc/SConscript', + 'bmfont/SConscript', + 'moto/SConscript', + 'container/SConscript', + 'memutil/SConscript/', + 'decimation/SConscript', + 'iksolver/SConscript', + 'boolop/SConscript', + 'opennl/SConscript']) # NEW_CSG was intended for intern/csg, but # getting it to compile is difficult @@ -20,10 +20,10 @@ SConscript(['SoundSystem/SConscript', # perhaps get rid of intern/csg? NEW_CSG='false' -if env['BF_NO_ELBEEM'] == 0: - SConscript(['elbeem/SConscript']) +if not env['BF_NO_ELBEEM']: + SConscript(['elbeem/SConscript']) if NEW_CSG=='false': - SConscript(['bsp/SConscript']) + SConscript(['bsp/SConscript']) else: - SConscript(['csg/SConscript']) + SConscript(['csg/SConscript']) diff --git a/intern/SoundSystem/SConscript b/intern/SoundSystem/SConscript index 54fc13293eb..2be20a24042 100644 --- a/intern/SoundSystem/SConscript +++ b/intern/SoundSystem/SConscript @@ -10,7 +10,11 @@ if env['WITH_BF_OPENAL']: sources += env.Glob('openal/*.cpp') + env.Glob('sdl/*.cpp') incs += ' ' + env['BF_OPENAL_INC'] incs += ' ' + env['BF_SDL_INC'] + defs = 'USE_OPENAL' else: defs = 'NO_SOUND' +if not env['WITH_BF_SDL']: + defs += ' DISABLE_SDL' + env.BlenderLib ('bf_soundsystem', sources, Split(incs), Split(defs), libtype=['core','player'], priority = [25,135] ) diff --git a/intern/SoundSystem/SND_Utils.h b/intern/SoundSystem/SND_Utils.h index c54aa434eec..26cf1bda11c 100644 --- a/intern/SoundSystem/SND_Utils.h +++ b/intern/SoundSystem/SND_Utils.h @@ -97,8 +97,8 @@ extern unsigned int SND_GetSampleFormat(void* sample); extern unsigned int SND_GetNumberOfChannels(void* sample); extern unsigned int SND_GetSampleRate(void* sample); extern unsigned int SND_GetBitRate(void* sample); -extern unsigned int SND_GetNumberOfSamples(void* sample); -extern unsigned int SND_GetHeaderSize(void* sample); +extern unsigned int SND_GetNumberOfSamples(void* sample, int sample_length); +extern unsigned int SND_GetHeaderSize(void* sample, int sample_length); extern unsigned int SND_GetExtraChunk(void* sample); extern void SND_GetSampleInfo(signed char* sample, SND_WaveSlot* waveslot); diff --git a/intern/SoundSystem/SoundDefines.h b/intern/SoundSystem/SoundDefines.h index 5d425a8dc94..450fde187b5 100644 --- a/intern/SoundSystem/SoundDefines.h +++ b/intern/SoundSystem/SoundDefines.h @@ -44,7 +44,7 @@ enum /* general stuff */ #define NUM_BUFFERS 128 -#define NUM_SOURCES 16 +#define NUM_SOURCES 24 /* 24 is the limit for openal on windows, was 16 in 2.47 and previous */ /* openal related stuff */ #define AL_LOOPING 0x1007 diff --git a/intern/SoundSystem/fmod/SND_FmodDevice.cpp b/intern/SoundSystem/fmod/SND_FmodDevice.cpp index cc252954fea..3ba0802a5b0 100644 --- a/intern/SoundSystem/fmod/SND_FmodDevice.cpp +++ b/intern/SoundSystem/fmod/SND_FmodDevice.cpp @@ -162,7 +162,7 @@ SND_WaveSlot* SND_FmodDevice::LoadSample(const STR_String& name, int numberofchannels = SND_GetNumberOfChannels(memlocation); int samplerate = SND_GetSampleRate(memlocation); int bitrate = SND_GetBitRate(memlocation); - int numberofsamples = SND_GetNumberOfSamples(memlocation); + int numberofsamples = SND_GetNumberOfSamples(memlocation, size); waveslot->SetFileSize(size); waveslot->SetData(memlocation); diff --git a/intern/SoundSystem/intern/SND_Scene.cpp b/intern/SoundSystem/intern/SND_Scene.cpp index bbf971ddc87..9d050a81161 100644 --- a/intern/SoundSystem/intern/SND_Scene.cpp +++ b/intern/SoundSystem/intern/SND_Scene.cpp @@ -388,11 +388,18 @@ void SND_Scene::UpdateActiveObects() #endif #ifdef USE_OPENAL // ok, properties Set. now see if it must play - if (pObject->GetPlaystate() == SND_MUST_PLAY) - { + switch (pObject->GetPlaystate()){ + case SND_MUST_PLAY: m_audiodevice->PlayObject(id); pObject->SetPlaystate(SND_PLAYING); - //break; + break; + case SND_MUST_STOP: + RemoveActiveObject(pObject); + break; + case SND_MUST_PAUSE: + m_audiodevice->PauseObject(id); + pObject->SetPlaystate(SND_PAUSED); + break; } #endif diff --git a/intern/SoundSystem/intern/SND_SoundObject.cpp b/intern/SoundSystem/intern/SND_SoundObject.cpp index e514a186e5e..7a244b5090d 100644 --- a/intern/SoundSystem/intern/SND_SoundObject.cpp +++ b/intern/SoundSystem/intern/SND_SoundObject.cpp @@ -91,21 +91,24 @@ SND_SoundObject::~SND_SoundObject() void SND_SoundObject::StartSound() { - m_playstate = SND_MUST_PLAY; + if (m_id >= 0) + m_playstate = SND_MUST_PLAY; } void SND_SoundObject::StopSound() { - m_playstate = SND_MUST_STOP; + if (m_id >= 0) + m_playstate = SND_MUST_STOP; } void SND_SoundObject::PauseSound() { - m_playstate = SND_MUST_PAUSE; + if (m_id >= 0) + m_playstate = SND_MUST_PAUSE; } diff --git a/intern/SoundSystem/intern/SND_Utils.cpp b/intern/SoundSystem/intern/SND_Utils.cpp index 7d441964b24..26ce106a24e 100644 --- a/intern/SoundSystem/intern/SND_Utils.cpp +++ b/intern/SoundSystem/intern/SND_Utils.cpp @@ -34,19 +34,19 @@ #include "SND_Utils.h" #include "SoundDefines.h" #include "SND_DependKludge.h" -/* -extern "C" { -#include "license_key.h" -} -*/ #include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <math.h> #include <string.h> -#if defined(WIN32) +#if defined(_WIN32) #include <io.h> +#define open _open +#define read _read +#define close _close +#define write _write +#define lseek _lseek #else #include <unistd.h> #endif @@ -204,7 +204,7 @@ bool SND_IsSampleValid(const STR_String& name, void* memlocation) /* checks if the passed pointer is a valid sample */ -bool CheckSample(void* sample) +static bool CheckSample(void* sample) { bool valid = false; char buffer[32]; @@ -290,26 +290,32 @@ unsigned int SND_GetBitRate(void* sample) /* gets the length of the actual sample data (without the header) */ -unsigned int SND_GetNumberOfSamples(void* sample) +unsigned int SND_GetNumberOfSamples(void* sample, int sample_length) { - unsigned int chunklength, length = 0, offset = 16; - char data[4]; - + unsigned int chunklength, length = 0, offset; + unsigned short block_align; if (CheckSample(sample)) { - memcpy(&chunklength, ((char*)sample) + offset, 4); + memcpy(&chunklength, ((char*)sample) + 16, 4); + memcpy(&block_align, ((char*)sample) + 32, 2); /* always 2 or 4 it seems */ + /* This was endian unsafe. See top of the file for the define. */ - if (SND_fEndian == SND_endianBig) SWITCH_INT(chunklength); - - offset = offset + chunklength + 4; - memcpy(data, ((char*)sample) + offset, 4); + if (SND_fEndian == SND_endianBig) + { + SWITCH_INT(chunklength); + SWITCH_SHORT(block_align); + } + + offset = 16 + chunklength + 4; /* This seems very unsafe, what if data is never found (f.i. corrupt file)... */ // lets find "data" - while (memcmp(data, "data", 4)) + while (memcmp(((char*)sample) + offset, "data", 4)) { - offset += 4; - memcpy(data, ((char*)sample) + offset, 4); + offset += block_align; + + if (offset+block_align > sample_length) /* save us from crashing */ + return 0; } offset += 4; memcpy(&length, ((char*)sample) + offset, 4); @@ -324,34 +330,38 @@ unsigned int SND_GetNumberOfSamples(void* sample) /* gets the size of the entire header (file - sampledata) */ -unsigned int SND_GetHeaderSize(void* sample) +unsigned int SND_GetHeaderSize(void* sample, int sample_length) { unsigned int chunklength, headersize = 0, offset = 16; - char data[4]; - + unsigned short block_align; if (CheckSample(sample)) { memcpy(&chunklength, ((char*)sample) + offset, 4); + memcpy(&block_align, ((char*)sample) + 32, 2); /* always 2 or 4 it seems */ + /* This was endian unsafe. See top of the file for the define. */ - if (SND_fEndian == SND_endianBig) SWITCH_INT(chunklength); + if (SND_fEndian == SND_endianBig) + { + SWITCH_INT(chunklength); + SWITCH_SHORT(block_align); + } offset = offset + chunklength + 4; - memcpy(data, ((char*)sample) + offset, 4); // lets find "data" - while (memcmp(data, "data", 4)) + while (memcmp(((char*)sample) + offset, "data", 4)) { - offset += 4; - memcpy(data, ((char*)sample) + offset, 4); + offset += block_align; + + if (offset+block_align > sample_length) /* save us from crashing */ + return 0; } headersize = offset + 8; } - return headersize; } - unsigned int SND_GetExtraChunk(void* sample) { unsigned int extrachunk = 0, chunklength, offset = 16; @@ -387,58 +397,60 @@ void SND_GetSampleInfo(signed char* sample, SND_WaveSlot* waveslot) if (CheckSample(sample)) { memcpy(&fileheader, sample, sizeof(WavFileHeader)); - fileheader.size = SND_GetHeaderSize(sample); - sample += sizeof(WavFileHeader); - fileheader.size = ((fileheader.size+1) & ~1) - 4; + fileheader.size = SND_GetHeaderSize(sample, waveslot->GetFileSize()); + if (fileheader.size) { /* this may fail for corrupt files */ + sample += sizeof(WavFileHeader); + fileheader.size = ((fileheader.size+1) & ~1) - 4; - while ((fileheader.size > 0) && (memcpy(&chunkheader, sample, sizeof(WavChunkHeader)))) - { - sample += sizeof(WavChunkHeader); - if (!memcmp(chunkheader.id, "fmt ", 4)) + while ((fileheader.size > 0) && (memcpy(&chunkheader, sample, sizeof(WavChunkHeader)))) { - memcpy(&fmtheader, sample, sizeof(WavFmtHeader)); - waveslot->SetSampleFormat(fmtheader.format); - - if (fmtheader.format == 0x0001) + sample += sizeof(WavChunkHeader); + if (!memcmp(chunkheader.id, "fmt ", 4)) { - waveslot->SetNumberOfChannels(fmtheader.numberofchannels); - waveslot->SetBitRate(fmtheader.bitrate); - waveslot->SetSampleRate(fmtheader.samplerate); - sample += chunkheader.size; - } - else - { - memcpy(&fmtexheader, sample, sizeof(WavFmtExHeader)); - sample += chunkheader.size; - } - } - else if (!memcmp(chunkheader.id, "data", 4)) - { - if (fmtheader.format == 0x0001) - { - waveslot->SetNumberOfSamples(chunkheader.size); - sample += chunkheader.size; + memcpy(&fmtheader, sample, sizeof(WavFmtHeader)); + waveslot->SetSampleFormat(fmtheader.format); + + if (fmtheader.format == 0x0001) + { + waveslot->SetNumberOfChannels(fmtheader.numberofchannels); + waveslot->SetBitRate(fmtheader.bitrate); + waveslot->SetSampleRate(fmtheader.samplerate); + sample += chunkheader.size; + } + else + { + memcpy(&fmtexheader, sample, sizeof(WavFmtExHeader)); + sample += chunkheader.size; + } } - else if (fmtheader.format == 0x0011) + else if (!memcmp(chunkheader.id, "data", 4)) { - //IMA ADPCM + if (fmtheader.format == 0x0001) + { + waveslot->SetNumberOfSamples(chunkheader.size); + sample += chunkheader.size; + } + else if (fmtheader.format == 0x0011) + { + //IMA ADPCM + } + else if (fmtheader.format == 0x0055) + { + //MP3 WAVE + } } - else if (fmtheader.format == 0x0055) + else if (!memcmp(chunkheader.id, "smpl", 4)) { - //MP3 WAVE + memcpy(&sampleheader, sample, sizeof(WavSampleHeader)); + //loop = sampleheader.loops; + sample += chunkheader.size; } - } - else if (!memcmp(chunkheader.id, "smpl", 4)) - { - memcpy(&sampleheader, sample, sizeof(WavSampleHeader)); - //loop = sampleheader.loops; - sample += chunkheader.size; - } - else - sample += chunkheader.size; + else + sample += chunkheader.size; - sample += chunkheader.size & 1; - fileheader.size -= (((chunkheader.size + 1) & ~1) + 8); + sample += chunkheader.size & 1; + fileheader.size -= (((chunkheader.size + 1) & ~1) + 8); + } } } } diff --git a/intern/SoundSystem/make/msvc_9_0/SoundSystem.vcproj b/intern/SoundSystem/make/msvc_9_0/SoundSystem.vcproj new file mode 100644 index 00000000000..bd75fe88d43 --- /dev/null +++ b/intern/SoundSystem/make/msvc_9_0/SoundSystem.vcproj @@ -0,0 +1,447 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9,00"
+ Name="INT_SoundSystem"
+ ProjectGUID="{98330220-47A6-42E0-9DE4-AD0FF5D204D6}"
+ RootNamespace="SoundSystem"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Blender Debug|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\soundsystem\debug"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\soundsystem\debug"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..;..\..\dummy;..\..\openal;..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\build\msvc_9\intern\moto\include"
+ PreprocessorDefinitions="_DEBUG,WIN32,_LIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ DefaultCharIsUnsigned="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\soundsystem\debug\SoundSystem.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\soundsystem\debug\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\soundsystem\debug\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\soundsystem\debug\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="3"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\debug\libSoundSystem.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying SND SoundSystem files library (debug target) to lib tree."
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\SoundSystem\include MKDIR ..\..\..\..\..\build\msvc_9\intern\SoundSystem\include
XCOPY /Y ..\..\*.h ..\..\..\..\..\build\msvc_9\intern\SoundSystem\include
ECHO Done
"
+ />
+ </Configuration>
+ <Configuration
+ Name="Blender Release|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\soundsystem"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\soundsystem"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="..\..;..\..\dummy;..\..\openal;..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\build\msvc_9\intern\moto\include"
+ PreprocessorDefinitions="NDEBUG,WIN32,_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ DefaultCharIsUnsigned="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\soundsystem\SoundSystem.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\soundsystem\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\soundsystem\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\soundsystem\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\libSoundSystem.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying SND SoundSystem files library to lib tree."
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\SoundSystem\include MKDIR ..\..\..\..\..\build\msvc_9\intern\SoundSystem\include
XCOPY /Y ..\..\*.h ..\..\..\..\..\build\msvc_9\intern\SoundSystem\include
ECHO Done
"
+ />
+ </Configuration>
+ <Configuration
+ Name="3DPlugin Release|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\soundsystem\mtdll"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\soundsystem\mtdll"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="..\..;..\..\dummy;..\..\openal;..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\build\msvc_9\intern\moto\include"
+ PreprocessorDefinitions="NDEBUG,WIN32,_LIB"
+ StringPooling="true"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ DefaultCharIsUnsigned="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\soundsystem\mtdll\SoundSystem.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\soundsystem\mtdll\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\soundsystem\mtdll\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\soundsystem\mtdll\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\mtdll\libSoundSystem.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying SND SoundSystem files library to lib tree."
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\SoundSystem\include MKDIR ..\..\..\..\..\build\msvc_9\intern\SoundSystem\include
XCOPY /Y ..\..\*.h ..\..\..\..\..\build\msvc_9\intern\SoundSystem\include
ECHO Done
"
+ />
+ </Configuration>
+ <Configuration
+ Name="3DPlugin Debug|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\soundsystem\mtdll\debug"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\soundsystem\mtdll\debug"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..;..\..\dummy;..\..\openal;..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\build\msvc_9\intern\moto\include"
+ PreprocessorDefinitions="_DEBUG,WIN32,_LIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ DefaultCharIsUnsigned="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\soundsystem\mtdll\debug\SoundSystem.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\soundsystem\mtdll\debug\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\soundsystem\mtdll\debug\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\soundsystem\mtdll\debug\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="3"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\mtdll\debug\libSoundSystem.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying SND SoundSystem files library (debug target) to lib tree."
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\SoundSystem\include MKDIR ..\..\..\..\..\build\msvc_9\intern\SoundSystem\include
XCOPY /Y ..\..\*.h ..\..\..\..\..\build\msvc_9\intern\SoundSystem\include
ECHO Done
"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath="..\..\intern\SND_AudioDevice.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\SND_C-api.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\SND_CDObject.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\SND_DeviceManager.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\SND_IdObject.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\SND_Scene.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\SND_SoundListener.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\SND_SoundObject.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\SND_Utils.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\SND_WaveCache.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\SND_WaveSlot.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ <File
+ RelativePath="..\..\intern\SND_AudioDevice.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\SND_C-api.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\SND_CDObject.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\SND_DependKludge.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\SND_DeviceManager.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\SND_IAudioDevice.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\SND_IdObject.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\SND_Object.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\SND_Scene.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\SND_SoundListener.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\SND_SoundObject.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\SND_Utils.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\SND_WaveCache.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\SND_WaveSlot.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\SoundDefines.h"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/intern/SoundSystem/make/msvc_9_0/dummy/DummySoundSystem.vcproj b/intern/SoundSystem/make/msvc_9_0/dummy/DummySoundSystem.vcproj new file mode 100644 index 00000000000..2109d92d430 --- /dev/null +++ b/intern/SoundSystem/make/msvc_9_0/dummy/DummySoundSystem.vcproj @@ -0,0 +1,343 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9,00"
+ Name="INT_DummySoundSystem"
+ ProjectGUID="{FAF46346-65CC-4DB2-85C4-B99826F79D0C}"
+ RootNamespace="DummySoundSystem"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Blender Release|Win32"
+ OutputDirectory="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy"
+ IntermediateDirectory="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="..\..\..\intern;..\..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\..\build\msvc_9\intern\soundsystem\include;..\..\..\..\..\..\build\msvc_9\intern\moto\include"
+ PreprocessorDefinitions="WIN32,NDEBUG,_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ DefaultCharIsUnsigned="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy\DummySoundSystem.pch"
+ AssemblerListingLocation="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy\"
+ ObjectFile="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy\"
+ ProgramDataBaseFileName="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\..\build\msvc_9\libs\intern\libDummySoundSystem.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Blender Debug|Win32"
+ OutputDirectory="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy\debug"
+ IntermediateDirectory="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy\debug"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\..\intern;..\..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\..\build\msvc_9\intern\soundsystem\include;..\..\..\..\..\..\build\msvc_9\intern\moto\include"
+ PreprocessorDefinitions="WIN32,_DEBUG,_LIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ DefaultCharIsUnsigned="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy\debug\DummySoundSystem.pch"
+ AssemblerListingLocation="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy\debug\"
+ ObjectFile="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy\debug\"
+ ProgramDataBaseFileName="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy\debug\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="3"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\..\build\msvc_9\libs\intern\debug\libDummySoundSystem.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="3DPlugin Release|Win32"
+ OutputDirectory="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy\mtdll"
+ IntermediateDirectory="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy\mtdll"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="..\..\..\intern;..\..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\..\build\msvc_9\intern\soundsystem\include;..\..\..\..\..\..\build\msvc_9\intern\moto\include"
+ PreprocessorDefinitions="WIN32,NDEBUG,_LIB"
+ StringPooling="true"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ DefaultCharIsUnsigned="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy\mtdll\DummySoundSystem.pch"
+ AssemblerListingLocation="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy\mtdll\"
+ ObjectFile="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy\mtdll\"
+ ProgramDataBaseFileName="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy\mtdll\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\..\build\msvc_9\libs\intern\mtdll\libDummySoundSystem.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="3DPlugin Debug|Win32"
+ OutputDirectory="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy\mtdll\debug"
+ IntermediateDirectory="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy\mtdll\debug"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\..\intern;..\..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\..\build\msvc_9\intern\soundsystem\include;..\..\..\..\..\..\build\msvc_9\intern\moto\include"
+ PreprocessorDefinitions="WIN32,_DEBUG,_LIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ DefaultCharIsUnsigned="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy\mtdll\debug\DummySoundSystem.pch"
+ AssemblerListingLocation="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy\mtdll\debug\"
+ ObjectFile="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy\mtdll\debug\"
+ ProgramDataBaseFileName="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\dummy\mtdll\debug\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="3"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\..\build\msvc_9\libs\intern\mtdll\debug\libDummySoundSystem.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath="..\..\..\dummy\SND_DummyDevice.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ <File
+ RelativePath="..\..\..\dummy\SND_DummyDevice.h"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/intern/SoundSystem/make/msvc_9_0/openal/OpenALSoundSystem.vcproj b/intern/SoundSystem/make/msvc_9_0/openal/OpenALSoundSystem.vcproj new file mode 100644 index 00000000000..5593f00cb2b --- /dev/null +++ b/intern/SoundSystem/make/msvc_9_0/openal/OpenALSoundSystem.vcproj @@ -0,0 +1,351 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9,00"
+ Name="INT_OpenALSoundSystem"
+ ProjectGUID="{213356A9-3A1F-41DA-9819-1297BCD17DEE}"
+ RootNamespace="OpenALSoundSystem"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Blender Debug|Win32"
+ OutputDirectory="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal\debug"
+ IntermediateDirectory="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal\debug"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\..\sdl;..\..\..\intern;..\..\..\..\..\..\lib\windows\sdl\include;..\..\..\..\..\..\lib\windows\openal\include;..\..\..\..\..\..\build\msvc_9\intern\soundsystem\include;..\..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\..\build\msvc_9\intern\string\include"
+ PreprocessorDefinitions="_DEBUG,WIN32,_LIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ DefaultCharIsUnsigned="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal\debug\OpenALSoundSystem.pch"
+ AssemblerListingLocation="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal\debug\"
+ ObjectFile="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal\debug\"
+ ProgramDataBaseFileName="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal\debug\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="3"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\..\build\msvc_9\libs\intern\debug\libOpenALSoundSystem.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Blender Release|Win32"
+ OutputDirectory="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal"
+ IntermediateDirectory="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="..\..\..\sdl;..\..\..\intern;..\..\..\..\..\..\lib\windows\sdl\include;..\..\..\..\..\..\lib\windows\openal\include;..\..\..\..\..\..\build\msvc_9\intern\soundsystem\include;..\..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\..\build\msvc_9\intern\string\include"
+ PreprocessorDefinitions="NDEBUG,WIN32,_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ DefaultCharIsUnsigned="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal\OpenALSoundSystem.pch"
+ AssemblerListingLocation="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal\"
+ ObjectFile="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal\"
+ ProgramDataBaseFileName="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\..\build\msvc_9\libs\intern\libOpenALSoundSystem.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="3DPlugin Release|Win32"
+ OutputDirectory="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal\mtdll"
+ IntermediateDirectory="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal\mtdll"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="..\..\..\sdl;..\..\..\intern;..\..\..\..\..\..\lib\windows\sdl\include;..\..\..\..\..\..\lib\windows\openal\include;..\..\..\..\..\..\build\msvc_9\intern\soundsystem\include;..\..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\..\build\msvc_9\intern\string\include"
+ PreprocessorDefinitions="NDEBUG,WIN32,_LIB"
+ StringPooling="true"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ DefaultCharIsUnsigned="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal\mtdll\OpenALSoundSystem.pch"
+ AssemblerListingLocation="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal\mtdll\"
+ ObjectFile="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal\mtdll\"
+ ProgramDataBaseFileName="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal\mtdll\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\..\build\msvc_9\libs\intern\mtdll\libOpenALSoundSystem.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="3DPlugin Debug|Win32"
+ OutputDirectory="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal\mtdll\debug"
+ IntermediateDirectory="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal\mtdll\debug"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\..\sdl;..\..\..\intern;..\..\..\..\..\..\lib\windows\sdl\include;..\..\..\..\..\..\lib\windows\openal\include;..\..\..\..\..\..\build\msvc_9\intern\soundsystem\include;..\..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\..\build\msvc_9\intern\string\include"
+ PreprocessorDefinitions="_DEBUG,WIN32,_LIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ DefaultCharIsUnsigned="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal\mtdll\debug\OpenALSoundSystem.pch"
+ AssemblerListingLocation="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal\mtdll\debug\"
+ ObjectFile="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal\mtdll\debug\"
+ ProgramDataBaseFileName="..\..\..\..\..\..\build\msvc_9\intern\soundsystem\openal\mtdll\debug\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="3"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\..\build\msvc_9\libs\intern\mtdll\debug\libOpenALSoundSystem.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath="..\..\..\openal\SND_OpenALDevice.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\sdl\SND_SDLCDDevice.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ <File
+ RelativePath="..\..\..\openal\SND_OpenALDevice.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\sdl\SND_SDLCDDevice.h"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/intern/SoundSystem/openal/SND_OpenALDevice.cpp b/intern/SoundSystem/openal/SND_OpenALDevice.cpp index ebcd0e4aea4..c660e9aecba 100644 --- a/intern/SoundSystem/openal/SND_OpenALDevice.cpp +++ b/intern/SoundSystem/openal/SND_OpenALDevice.cpp @@ -294,6 +294,10 @@ SND_OpenALDevice::SND_OpenALDevice() // let openal generate its sources if (alc_error == ALC_NO_ERROR) { + int i; + + for (i=0;i<NUM_SOURCES;i++) + m_sources[i] = 0; alGenSources(NUM_SOURCES, m_sources); m_sourcesinitialized = true; } @@ -329,12 +333,6 @@ SND_OpenALDevice::~SND_OpenALDevice() { MakeCurrent(); - if (m_buffersinitialized) - { - alDeleteBuffers(NUM_BUFFERS, m_buffers); - m_buffersinitialized = false; - } - if (m_sourcesinitialized) { for (int i = 0; i < NUM_SOURCES; i++) @@ -344,6 +342,12 @@ SND_OpenALDevice::~SND_OpenALDevice() m_sourcesinitialized = false; } + if (m_buffersinitialized) + { + alDeleteBuffers(NUM_BUFFERS, m_buffers); + m_buffersinitialized = false; + } + if (m_context) { MakeCurrent(); #ifdef AL_VERSION_1_1 diff --git a/intern/SoundSystem/sdl/SND_SDLCDDevice.cpp b/intern/SoundSystem/sdl/SND_SDLCDDevice.cpp index 8bb6c642b11..b1bac964c61 100644 --- a/intern/SoundSystem/sdl/SND_SDLCDDevice.cpp +++ b/intern/SoundSystem/sdl/SND_SDLCDDevice.cpp @@ -41,7 +41,9 @@ #include "SND_SDLCDDevice.h" #include "SoundDefines.h" +#ifndef DISABLE_SDL #include <SDL.h> +#endif SND_SDLCDDevice::SND_SDLCDDevice() : m_cdrom(NULL), @@ -55,6 +57,10 @@ SND_SDLCDDevice::SND_SDLCDDevice() : void SND_SDLCDDevice::init() { +#ifdef DISABLE_SDL + fprintf(stderr, "Blender compiled without SDL, no CDROM support\n"); + return; +#else if (SDL_InitSubSystem(SDL_INIT_CDROM)) { fprintf(stderr, "Error initializing CDROM\n"); @@ -75,19 +81,23 @@ void SND_SDLCDDevice::init() /* Did if open? Check if cdrom is NULL */ if(!m_cdrom) { - fprintf(stderr, "Couldn't open drive: %s", SDL_GetError()); + fprintf(stderr, "Couldn't open drive: %s\n", SDL_GetError()); return; } +#endif } SND_SDLCDDevice::~SND_SDLCDDevice() { +#ifndef DISABLE_SDL StopCD(); SDL_CDClose(m_cdrom); +#endif } void SND_SDLCDDevice::NextFrame() { +#ifndef DISABLE_SDL m_frame++; m_frame &= 127; @@ -111,20 +121,24 @@ void SND_SDLCDDevice::NextFrame() } } +#endif } void SND_SDLCDDevice::PlayCD(int track) { +#ifndef DISABLE_SDL if ( m_cdrom && CD_INDRIVE(SDL_CDStatus(m_cdrom)) ) { SDL_CDPlayTracks(m_cdrom, track-1, 0, track, 0); m_cdplaying = true; m_cdtrack = track; } +#endif } void SND_SDLCDDevice::PauseCD(bool pause) { +#ifndef DISABLE_SDL if (!m_cdrom) return; @@ -132,13 +146,16 @@ void SND_SDLCDDevice::PauseCD(bool pause) SDL_CDPause(m_cdrom); else SDL_CDResume(m_cdrom); +#endif } void SND_SDLCDDevice::StopCD() { +#ifndef DISABLE_SDL if (m_cdrom) SDL_CDStop(m_cdrom); m_cdplaying = false; +#endif } void SND_SDLCDDevice::SetCDPlaymode(int playmode) diff --git a/intern/bmfont/BMF_Api.h b/intern/bmfont/BMF_Api.h index 67918ff6496..252f60623a7 100644 --- a/intern/bmfont/BMF_Api.h +++ b/intern/bmfont/BMF_Api.h @@ -149,8 +149,9 @@ void BMF_DrawStringTexture(BMF_Font* font, char* string, float x, float y, float * @param fbuf float image buffer, when NULL to not operate on it. * @param w image buffer width. * @param h image buffer height. + * @param channels number of channels in the image (3 or 4 - currently) */ -void BMF_DrawStringBuf(BMF_Font* font, char *str, int posx, int posy, float *col, unsigned char *buf, float *fbuf, int w, int h); +void BMF_DrawStringBuf(BMF_Font* font, char *str, int posx, int posy, float *col, unsigned char *buf, float *fbuf, int w, int h, int channels); #ifdef __cplusplus diff --git a/intern/bmfont/intern/BDF2BMF.py b/intern/bmfont/intern/BDF2BMF.py new file mode 100644 index 00000000000..15b9e5b8eb4 --- /dev/null +++ b/intern/bmfont/intern/BDF2BMF.py @@ -0,0 +1,177 @@ +#!/usr/bin/python + +# ***** BEGIN GPL LICENSE BLOCK ***** +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# ***** END GPL LICENCE BLOCK ***** +# -------------------------------------------------------------------------- + +HELP_TXT = \ +''' +Convert BDF pixmap fonts into C++ files Blender can read. +Use to replace bitmap fonts or add new ones. + +Usage + python bdf2bmf.py -name=SomeName myfile.bdf + +Blender currently supports fonts with a maximum width of 8 pixels. +''' + +# -------- Simple BDF parser +import sys +def parse_bdf(f, MAX_CHARS=256): + lines = [l.strip().upper().split() for l in f.readlines()] + + is_bitmap = False + dummy = {'BITMAP':[]} + char_data = [dummy.copy() for i in xrange(MAX_CHARS)] + context_bitmap = [] + + for l in lines: + if l[0]=='ENCODING': enc = int(l[1]) + elif l[0]=='BBX': bbx = [int(c) for c in l[1:]] + elif l[0]=='DWIDTH': dwidth = int(l[1]) + elif l[0]=='BITMAP': is_bitmap = True + elif l[0]=='ENDCHAR': + if enc < MAX_CHARS: + char_data[enc]['BBX'] = bbx + char_data[enc]['DWIDTH'] = dwidth + char_data[enc]['BITMAP'] = context_bitmap + + context_bitmap = [] + enc = bbx = None + is_bitmap = False + else: + # None of the above, Ok, were reading a bitmap + if is_bitmap and enc < MAX_CHARS: + context_bitmap.append( int(l[0], 16) ) + + return char_data +# -------- end simple BDF parser + +def bdf2cpp_name(path): + return path.split('.')[0] + '.cpp' + +def convert_to_blender(bdf_dict, font_name, origfilename, MAX_CHARS=256): + + # first get a global width/height, also set the offsets + xmin = ymin = 10000000 + xmax = ymax = -10000000 + + bitmap_offsets = [-1] * MAX_CHARS + bitmap_tot = 0 + for i, c in enumerate(bdf_dict): + if c.has_key('BBX'): + bbx = c['BBX'] + xmax = max(bbx[0], xmax) + ymax = max(bbx[1], ymax) + xmin = min(bbx[2], xmin) + ymin = min(bbx[3], ymin) + + bitmap_offsets[i] = bitmap_tot + bitmap_tot += len(c['BITMAP']) + + c['BITMAP'].reverse() + + # Now we can write. Ok if we have no .'s in the path. + f = open(bdf2cpp_name(origfilename), 'w') + + f.write(''' +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "BMF_FontData.h" + +#include "BMF_Settings.h" +''') + + f.write('#if BMF_INCLUDE_%s\n\n' % font_name.upper()) + f.write('static unsigned char bitmap_data[]= {') + newline = 8 + + for i, c in enumerate(bdf_dict): + + for cdata in c['BITMAP']: + # Just formatting + newline+=1 + if newline >= 8: + newline = 0 + f.write('\n\t') + # End formatting + + f.write('0x%.2hx,' % cdata) # 0x80 <- format + + f.write("\n};\n") + + f.write("BMF_FontData BMF_font_%s = {\n" % font_name) + f.write('\t%d, %d,\n' % (xmin, ymin)) + f.write('\t%d, %d,\n' % (xmax, ymax)) + + f.write('\t{\n') + + + for i, c in enumerate(bdf_dict): + if bitmap_offsets[i] == -1 or c.has_key('BBX') == False: + f.write('\t\t{0,0,0,0,0, -1},\n') + else: + bbx = c['BBX'] + f.write('\t\t{%d,%d,%d,%d,%d, %d},\n' % (bbx[0], bbx[1], -bbx[2], -bbx[3], c['DWIDTH'], bitmap_offsets[i])) + + f.write(''' + }, + bitmap_data +}; + +#endif +''') + +def main(): + # replace "[-name=foo]" with "[-name] [foo]" + args = [] + for arg in sys.argv: + for a in arg.replace('=', ' ').split(): + args.append(a) + + name = 'untitled' + done_anything = False + for i, arg in enumerate(args): + if arg == '-name': + if i==len(args)-1: + print 'no arg given for -name, aborting' + return + else: + name = args[i+1] + + elif arg.lower().endswith('.bdf'): + try: + f = open(arg) + print '...Writing to:', bdf2cpp_name(arg) + except: + print 'could not open "%s", aborting' % arg + + + bdf_dict = parse_bdf(f) + convert_to_blender(bdf_dict, name, arg) + done_anything = True + + if not done_anything: + print HELP_TXT + print '...nothing to do' + +if __name__ == '__main__': + main() + diff --git a/intern/bmfont/intern/BMF_Api.cpp b/intern/bmfont/intern/BMF_Api.cpp index 4b74cf70136..1699393e53d 100644 --- a/intern/bmfont/intern/BMF_Api.cpp +++ b/intern/bmfont/intern/BMF_Api.cpp @@ -177,7 +177,7 @@ void BMF_DrawStringTexture(BMF_Font* font, char *string, float x, float y, float ((BMF_BitmapFont*)font)->DrawStringTexture(string, x, y, z); } -void BMF_DrawStringBuf(BMF_Font* font, char *str, int posx, int posy, float *col, unsigned char *buf, float *fbuf, int w, int h) { +void BMF_DrawStringBuf(BMF_Font* font, char *str, int posx, int posy, float *col, unsigned char *buf, float *fbuf, int w, int h, int channels) { if (!font) return; - ((BMF_BitmapFont*)font)->DrawStringBuf(str, posx, posy, col, buf, fbuf, w, h); + ((BMF_BitmapFont*)font)->DrawStringBuf(str, posx, posy, col, buf, fbuf, w, h, channels); } diff --git a/intern/bmfont/intern/BMF_BitmapFont.cpp b/intern/bmfont/intern/BMF_BitmapFont.cpp index b9e463261ab..0111e9c3f93 100644 --- a/intern/bmfont/intern/BMF_BitmapFont.cpp +++ b/intern/bmfont/intern/BMF_BitmapFont.cpp @@ -238,7 +238,7 @@ void BMF_BitmapFont::DrawStringTexture(char *str, float x, float y, float z) } #define FTOCHAR(val) val<=0.0f?0: (val>=1.0f?255: (char)(255.0f*val)) -void BMF_BitmapFont::DrawStringBuf(char *str, int posx, int posy, float *col, unsigned char *buf, float *fbuf, int w, int h) +void BMF_BitmapFont::DrawStringBuf(char *str, int posx, int posy, float *col, unsigned char *buf, float *fbuf, int w, int h, int channels) { int x, y; @@ -274,7 +274,9 @@ void BMF_BitmapFont::DrawStringBuf(char *str, int posx, int posy, float *col, un pixel[0] = colch[0]; pixel[1] = colch[1]; pixel[2] = colch[2]; - pixel[4] = 1; /*colch[3];*/ + if (channels==4) { + pixel[4] = 1; /*colch[3];*/ + } } } @@ -307,7 +309,9 @@ void BMF_BitmapFont::DrawStringBuf(char *str, int posx, int posy, float *col, un pixel[0] = col[0]; pixel[1] = col[1]; pixel[2] = col[2]; - pixel[3] = 1; /*col[3];*/ + if (channels==4) { + pixel[3] = 1; /*col[3];*/ + } } } } diff --git a/intern/bmfont/intern/BMF_BitmapFont.h b/intern/bmfont/intern/BMF_BitmapFont.h index 6b052f0e046..ed060818f71 100644 --- a/intern/bmfont/intern/BMF_BitmapFont.h +++ b/intern/bmfont/intern/BMF_BitmapFont.h @@ -127,8 +127,9 @@ public: * @param fbuf float image buffer, when NULL to not operate on it. * @param w image buffer width. * @param h image buffer height. + * @param channels number of channels in the image (3 or 4 - currently) */ - void DrawStringBuf(char *str, int posx, int posy, float *col, unsigned char *buf, float *fbuf, int w, int h); + void DrawStringBuf(char *str, int posx, int posy, float *col, unsigned char *buf, float *fbuf, int w, int h, int channels); protected: /** Pointer to the font data. */ diff --git a/intern/bmfont/make/msvc_9_0/bmfont.vcproj b/intern/bmfont/make/msvc_9_0/bmfont.vcproj new file mode 100644 index 00000000000..91d6e6afc1a --- /dev/null +++ b/intern/bmfont/make/msvc_9_0/bmfont.vcproj @@ -0,0 +1,413 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9,00"
+ Name="INT_bmfont"
+ ProjectGUID="{E784098D-3ED8-433A-9353-9679415DDDC5}"
+ RootNamespace="bmfont"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Blender Release|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\bmfont"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\bmfont"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="..\..;..\..\intern"
+ PreprocessorDefinitions="WIN32,NDEBUG,_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\bmfont\bmfont.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\bmfont\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\bmfont\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\bmfont\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\libbmfont.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying BMFONT files library to lib tree"
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\bmfont\include MKDIR ..\..\..\..\..\build\msvc_9\intern\bmfont\include
XCOPY /Y ..\..\*.h ..\..\..\..\..\build\msvc_9\intern\bmfont\include
ECHO Done
"
+ />
+ </Configuration>
+ <Configuration
+ Name="Blender Debug|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\bmfont\debug"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\bmfont\debug"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..;..\..\intern"
+ PreprocessorDefinitions="WIN32,_DEBUG,_LIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ BufferSecurityCheck="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\bmfont\debug\bmfont.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\bmfont\debug\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\bmfont\debug\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\bmfont\debug\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="3"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\debug\libbmfont.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying BMFONT files library (debug target) to lib tree"
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\bmfont\include MKDIR ..\..\..\..\..\build\msvc_9\intern\bmfont\include
XCOPY /Y ..\..\*.h ..\..\..\..\..\build\msvc_9\intern\bmfont\include
ECHO Done
"
+ />
+ </Configuration>
+ <Configuration
+ Name="3DPlugin Release|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\bmfont\mtdll"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\bmfont\mtdll"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="..\..;..\..\intern"
+ PreprocessorDefinitions="WIN32,NDEBUG,_LIB"
+ StringPooling="true"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\bmfont\mtdll\bmfont.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\bmfont\mtdll\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\bmfont\mtdll\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\bmfont\mtdll\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\mtdll\libbmfont.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying BMFONT files library to lib tree"
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\bmfont\include MKDIR ..\..\..\..\..\build\msvc_9\intern\bmfont\include
XCOPY /Y ..\..\*.h ..\..\..\..\..\build\msvc_9\intern\bmfont\include
ECHO Done
"
+ />
+ </Configuration>
+ <Configuration
+ Name="3DPlugin Debug|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\bmfont\mtdll\debug"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\bmfont\mtdll\debug"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..;..\..\intern"
+ PreprocessorDefinitions="WIN32,_DEBUG,_LIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ BufferSecurityCheck="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\bmfont\mtdll\debug\bmfont.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\bmfont\mtdll\debug\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\bmfont\mtdll\debug\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\bmfont\mtdll\debug\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="3"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\mtdll\debug\libbmfont.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying BMFONT files library (debug target) to lib tree"
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\bmfont\include MKDIR ..\..\..\..\..\build\msvc_9\intern\bmfont\include
XCOPY /Y ..\..\*.h ..\..\..\..\..\build\msvc_9\intern\bmfont\include
ECHO Done
"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath="..\..\intern\BMF_Api.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BMF_BitmapFont.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BMF_font_helv10.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BMF_font_helv12.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BMF_font_helvb10.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BMF_font_helvb12.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BMF_font_helvb14.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BMF_font_helvb8.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BMF_font_scr12.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BMF_font_scr14.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BMF_font_scr15.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ <Filter
+ Name="intern"
+ >
+ <File
+ RelativePath="..\..\intern\BMF_BitmapFont.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BMF_FontData.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="extern"
+ >
+ <File
+ RelativePath="..\..\BMF_Api.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\BMF_Fonts.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\BMF_Settings.h"
+ >
+ </File>
+ </Filter>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/intern/boolop/SConscript b/intern/boolop/SConscript index 6bd0842f3e5..a3f3c0b6433 100644 --- a/intern/boolop/SConscript +++ b/intern/boolop/SConscript @@ -8,7 +8,7 @@ incs += ' ../../source/blender/makesdna ../../intern/guardedalloc' incs += ' ../../source/blender/blenlib' if (env['OURPLATFORM'] == 'win32-mingw'): - env.BlenderLib ('bf_bop', sources, Split(incs) , [], libtype=['common','intern'], priority = [5,50] ) + env.BlenderLib ('blender_bop', sources, Split(incs) , [], libtype=['common','intern'], priority = [5,50] ) else: - env.BlenderLib ('bf_bop', sources, Split(incs) , [], libtype='common', priority = 5 ) + env.BlenderLib ('blender_bop', sources, Split(incs) , [], libtype='common', priority = 5 ) diff --git a/intern/boolop/intern/BOP_Edge.cpp b/intern/boolop/intern/BOP_Edge.cpp index ac302b530df..44e7d5cb567 100644 --- a/intern/boolop/intern/BOP_Edge.cpp +++ b/intern/boolop/intern/BOP_Edge.cpp @@ -75,4 +75,47 @@ void BOP_Edge::replaceVertexIndex(BOP_Index oldIndex, BOP_Index newIndex) else if (m_vertexs[1] == oldIndex) m_vertexs[1] = newIndex; } +#ifdef BOP_NEW_MERGE + +/** + * Returns if this edge contains the specified face index. + * @param i face index + * @return true if this edge contains the specified face index, false otherwise + */ +bool BOP_Edge::removeFace(BOP_Index i) +{ + int pos=0; + for(BOP_IT_Indexs it = m_faces.begin();it!=m_faces.end();pos++,it++) { + if ((*it) == i) { + m_faces.erase(it); + return true; + } + } + + return false; +} + +#endif + +#ifdef BOP_DEBUG + +#include <iostream> +using namespace std; + +/** + * Implements operator <<. + */ +ostream &operator<<(ostream &stream, BOP_Edge *e) +{ + stream << "Edge[" << e->getVertex1() << "," << e->getVertex2(); +#ifdef BOP_NEW_MERGE + if(e->m_used) + stream << "] (used)"; + else + stream << "] (unused)"; +#endif + return stream; +} +#endif + diff --git a/intern/boolop/intern/BOP_Edge.h b/intern/boolop/intern/BOP_Edge.h index 13426f6e63c..a817b3d624f 100644 --- a/intern/boolop/intern/BOP_Edge.h +++ b/intern/boolop/intern/BOP_Edge.h @@ -29,12 +29,16 @@ #define BOP_EDGE_H #include "BOP_Indexs.h" +#include "BOP_Misc.h" class BOP_Edge { private: BOP_Index m_vertexs[2]; BOP_Indexs m_faces; +#ifdef BOP_NEW_MERGE + bool m_used; +#endif bool containsFace(BOP_Index i); @@ -47,6 +51,15 @@ public: inline unsigned int getNumFaces(){return m_faces.size();}; inline BOP_Indexs &getFaces(){return m_faces;}; void addFace(BOP_Index face); +#ifdef BOP_NEW_MERGE + bool removeFace(BOP_Index i); + bool getUsed() { return m_used;}; + void setUsed(bool setting) { m_used=setting;}; +#endif +#ifdef BOP_DEBUG + friend ostream &operator<<(ostream &stream, BOP_Edge *e); +#endif + }; #endif diff --git a/intern/boolop/intern/BOP_Face.cpp b/intern/boolop/intern/BOP_Face.cpp index 12c94624517..01308de3e5d 100644 --- a/intern/boolop/intern/BOP_Face.cpp +++ b/intern/boolop/intern/BOP_Face.cpp @@ -402,6 +402,7 @@ bool BOP_Face4::getEdgeIndex(BOP_Index v1, BOP_Index v2, unsigned int &e) return true; } +#ifdef BOP_DEBUG /** * Implements operator <<. */ @@ -421,3 +422,4 @@ ostream &operator<<(ostream &stream, BOP_Face *f) return stream; } +#endif diff --git a/intern/boolop/intern/BOP_Face.h b/intern/boolop/intern/BOP_Face.h index e16425f78b3..965882db732 100644 --- a/intern/boolop/intern/BOP_Face.h +++ b/intern/boolop/intern/BOP_Face.h @@ -32,6 +32,7 @@ #include "MT_Plane3.h" #include "BOP_Indexs.h" #include "BOP_BBox.h" +#include "BOP_Misc.h" #include <iostream> #include <vector> using namespace std; @@ -80,7 +81,9 @@ public: virtual void replaceVertexIndex(BOP_Index oldIndex, BOP_Index newIndex) = 0; virtual bool containsVertex(BOP_Index v) = 0; +#ifdef BOP_DEBUG friend ostream &operator<<(ostream &stream, BOP_Face *f); +#endif }; class BOP_Face3: public BOP_Face diff --git a/intern/boolop/intern/BOP_Interface.cpp b/intern/boolop/intern/BOP_Interface.cpp index 2a198103931..c6bcb4a74ce 100644 --- a/intern/boolop/intern/BOP_Interface.cpp +++ b/intern/boolop/intern/BOP_Interface.cpp @@ -33,9 +33,12 @@ #include "BOP_Mesh.h" #include "BOP_Face2Face.h" #include "BOP_Merge.h" +#include "BOP_Merge2.h" #include "BOP_Chrono.h" -//#define DEBUG +#if defined(BOP_ORIG_MERGE) && defined(BOP_NEW_MERGE) +#include "../../../source/blender/blenkernel/BKE_global.h" +#endif BoolOpState BOP_intersectionBoolOp(BOP_Mesh* meshC, BOP_Faces* facesA, @@ -208,7 +211,32 @@ BoolOpState BOP_intersectionBoolOp(BOP_Mesh* meshC, #endif // Merge faces +#ifdef BOP_ORIG_MERGE +#ifndef BOP_NEW_MERGE BOP_Merge::getInstance().mergeFaces(meshC,numVertices); +#endif +#endif + +#ifdef BOP_NEW_MERGE +#ifndef BOP_ORIG_MERGE + BOP_Merge2::getInstance().mergeFaces(meshC,numVertices); +#else + static int state = -1; + if (G.rt == 100) { + if( state != 1 ) { + cout << "Boolean code using old merge technique." << endl; + state = 1; + } + BOP_Merge::getInstance().mergeFaces(meshC,numVertices); + } else { + if( state != 0 ) { + cout << "Boolean code using new merge technique." << endl; + state = 0; + } + BOP_Merge2::getInstance().mergeFaces(meshC,numVertices); + } +#endif +#endif #ifdef DEBUG c = chrono.stamp(); t += c; diff --git a/intern/boolop/intern/BOP_Merge.cpp b/intern/boolop/intern/BOP_Merge.cpp index 1e4139ab971..012d3409187 100644 --- a/intern/boolop/intern/BOP_Merge.cpp +++ b/intern/boolop/intern/BOP_Merge.cpp @@ -30,6 +30,7 @@ #include "BOP_Merge.h" +#ifdef BOP_ORIG_MERGE #ifdef _MSC_VER #if _MSC_VER < 1300 @@ -802,3 +803,5 @@ void BOP_Merge::getFaces(BOP_LFaces &facesByOriginalFace, BOP_Indexs vertices, B } } } + +#endif /* BOP_ORIG_MERGE */ diff --git a/intern/boolop/intern/BOP_Merge.h b/intern/boolop/intern/BOP_Merge.h index 88999b2e734..ceb8ec10690 100644 --- a/intern/boolop/intern/BOP_Merge.h +++ b/intern/boolop/intern/BOP_Merge.h @@ -28,6 +28,9 @@ #ifndef BOP_MERGE_H #define BOP_MERGE_H +#include "BOP_Misc.h" + +#ifdef BOP_ORIG_MERGE #include "BOP_Mesh.h" #include "BOP_Tag.h" #include "BOP_MathUtils.h" @@ -68,4 +71,6 @@ class BOP_Merge { void mergeFaces(BOP_Mesh *m, BOP_Index v); }; +#endif /* BOP_ORIG_MERGE */ + #endif diff --git a/intern/boolop/intern/BOP_Merge2.cpp b/intern/boolop/intern/BOP_Merge2.cpp new file mode 100644 index 00000000000..bbf3f8ba702 --- /dev/null +++ b/intern/boolop/intern/BOP_Merge2.cpp @@ -0,0 +1,944 @@ +/** + * + * $Id: BOP_Merge22.cpp 14444 2008-04-16 22:40:48Z hos $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): Marc Freixas, Ken Hughes + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "BOP_Merge2.h" + +#ifdef BOP_NEW_MERGE + +static void deleteFace(BOP_Mesh *m, BOP_Face *face); + +/** + * SINGLETON (use method BOP_Merge2.getInstance). + */ +BOP_Merge2 BOP_Merge2::SINGLETON; + +#ifdef BOP_DEBUG +void dumpmesh ( BOP_Mesh *m, bool force ) +{ + unsigned int nonmanifold = 0; + { + BOP_Edges edges = m->getEdges(); + int count = 0; + for (BOP_IT_Edges edge = edges.begin(); edge != edges.end(); + ++count, ++edge) { + if (!(*edge)->getUsed() && (*edge)->getFaces().size() == 0 ) continue; + BOP_Vertex * v1 = m->getVertex((*edge)->getVertex1()); + BOP_Vertex * v2 = m->getVertex((*edge)->getVertex2()); + + if(v1->getTAG()!= BROKEN || v2->getTAG()!= BROKEN ) { + int fcount = 0; + BOP_Indexs faces = (*edge)->getFaces(); + for (BOP_IT_Indexs face = faces.begin(); face != faces.end(); face++) { + BOP_Face *f = m->getFace(*face); + if(f->getTAG()== UNCLASSIFIED) ++fcount; + } + + + if(fcount !=0 && fcount !=2 ) { + ++nonmanifold; + } + } + } + if (!force && nonmanifold == 0) return; + } + if( nonmanifold ) + cout << nonmanifold << " edges detected" << endl; +#ifdef DEBUG + cout << "---------------------------" << endl; + + BOP_Edges edges = m->getEdges(); + int count = 0; + for (BOP_IT_Edges edge = edges.begin(); edge != edges.end(); + ++count, ++edge) { + BOP_Vertex * v1 = m->getVertex((*edge)->getVertex1()); + BOP_Vertex * v2 = m->getVertex((*edge)->getVertex2()); + + if(v1->getTAG()!= BROKEN || v2->getTAG()!= BROKEN ) { + int fcount = 0; + BOP_Indexs faces = (*edge)->getFaces(); + cout << count << ", " << (*edge) << ", " << faces.size() << endl; + for (BOP_IT_Indexs face = faces.begin(); face != faces.end(); face++) { + BOP_Face *f = m->getFace(*face); + if(f->getTAG()== UNCLASSIFIED) ++fcount; + cout << " face " << f << endl; + } + + + if(fcount !=0 && fcount !=2 ) + cout << " NON-MANIFOLD" << endl; + } + } + + BOP_Faces faces = m->getFaces(); + count = 0; + for (BOP_IT_Faces face = faces.begin(); face != faces.end(); face++) { + if( count < 12*2 || (*face)->getTAG() != BROKEN ) { + cout << count << ", " << *face << endl; + } + ++count; + } + + BOP_Vertexs verts = m->getVertexs(); + count = 0; + for (BOP_IT_Vertexs vert = verts.begin(); vert != verts.end(); vert++) { + cout << count++ << ", " << *vert << " " << (*vert)->getNumEdges() << endl; + BOP_Indexs edges = (*vert)->getEdges(); + for( BOP_IT_Indexs it = edges.begin(); it != edges.end(); ++it) { + BOP_Edge *edge = m->getEdge(*it); + cout << " " << edge << endl; + } + } + cout << "===========================" << endl; +#endif +} +#endif + +/** + * Simplifies a mesh, merging its faces. + * @param m mesh + * @param v index of the first mergeable vertex (can be removed by merge) + */ + +void BOP_Merge2::mergeFaces(BOP_Mesh *m, BOP_Index v) +{ + m_mesh = m; + +#ifdef DEBUG + cout << "##############################" << endl; +#endif + cleanup( ); + + m_firstVertex = v; + bool cont = false; + + // Merge faces + mergeFaces(); + + do { + // Add quads ... + cont = createQuads(); + // ... and merge new faces + if( cont ) cont = mergeFaces(); + +#ifdef DEBUG + cout << "called mergeFaces " << cont << endl; +#endif + // ... until the merge is not succesful + } while(cont); +} + +void clean_nonmanifold( BOP_Mesh *m ) +{ + return; + + BOP_Edges nme; + BOP_Edges e = m->getEdges(); + for( BOP_IT_Edges it = e.begin(); it != e.end(); ++it ) { + BOP_Indexs faces = (*it)->getFaces(); + if( faces.size() & ~2 ) + nme.push_back(*it); + } + if (nme.size() == 0) return; + for( BOP_IT_Edges it = nme.begin(); it != nme.end(); ++it ) { + if( (*it)->getFaces().size() > 1 ) { + BOP_Indexs faces = (*it)->getFaces(); + for( BOP_IT_Indexs face = faces.begin(); face != faces.end(); ++face ) { + MT_Point3 vertex1 = m->getVertex(m->getFace(*face)->getVertex(0))->getPoint(); + MT_Point3 vertex2 = m->getVertex(m->getFace(*face)->getVertex(1))->getPoint(); + MT_Point3 vertex3 = m->getVertex(m->getFace(*face)->getVertex(2))->getPoint(); + if (BOP_collinear(vertex1,vertex2,vertex3)) // collinear triangle + deleteFace(m,m->getFace(*face)); + } + continue; + } + BOP_Face *oface1 = m->getFace((*it)->getFaces().front()); + BOP_Face *oface2, *tmpface; + BOP_Index first =(*it)->getVertex1(); + BOP_Index next =(*it)->getVertex2(); + BOP_Index last = first; + unsigned short facecount = 0; + bool found = false; + BOP_Indexs vertList; +#ifdef DEBUG + cout << " first edge is " << (*it) << endl; +#endif + vertList.push_back(first); + BOP_Edge *edge; + while(true) { + BOP_Vertex *vert = m->getVertex(next); + BOP_Indexs edges = vert->getEdges(); + edge = NULL; + for( BOP_IT_Indexs eit = edges.begin(); eit != edges.end(); ++eit) { + edge = m->getEdge(*eit); + if( edge->getFaces().size() > 1) { + edge = NULL; + continue; + } + if( edge->getVertex1() == next && edge->getVertex2() != last ) { + last = next; + next = edge->getVertex2(); + break; + } + if( edge->getVertex2() == next && edge->getVertex1() != last ) { + last = next; + next = edge->getVertex1(); + break; + } + edge = NULL; + } + if( !edge ) break; +#ifdef DEBUG + cout << " next edge is " << edge << endl; +#endif + tmpface = m->getFace(edge->getFaces().front()); + if( oface1->getOriginalFace() != tmpface->getOriginalFace() ) + oface2 = tmpface; + else + ++facecount; + vertList.push_back(last); + if( vertList.size() > 3 ) break; + if( next == first ) { + found = true; + break; + } + } + if(found) { + edge = *it; +#ifdef DEBUG + cout << " --> found a loop" << endl; +#endif + if( vertList.size() == 3 ) { + BOP_Face3 *face = (BOP_Face3 *)m->getFace(edge->getFaces().front()); + face->getNeighbours(first,last,next); + } else if( vertList.size() == 4 ) { + BOP_Face4 *face = (BOP_Face4 *)m->getFace(edge->getFaces().front()); + face->getNeighbours(first,last,next,last); + } else { +#ifdef DEBUG + cout << "loop has " << vertList.size() << "verts"; +#endif + continue; + } + if(facecount == 1) oface1 = oface2; + next = vertList[1]; + last = vertList[2]; + if( edge->getVertex2() == next ) { + BOP_Face3 *f = new BOP_Face3(next,first,last, + oface1->getPlane(),oface1->getOriginalFace()); + m->addFace( f ); +#ifdef DEBUG + cout << " face is backward: " << f << endl; +#endif + + } else { + BOP_Face3 *f = new BOP_Face3(last,first,next, + oface1->getPlane(),oface1->getOriginalFace()); + m->addFace( f ); +#ifdef DEBUG + cout << " face is forward: " << f << endl; +#endif + } + } + } +} + +/** + * Runs through mesh and makes sure vert/face/edge data is consistent. Most + * importantly: + * (1) mark edges which are no longer used + * (2) remove broken faces from edges + * (3) remove faces from mesh which have a single edge belonging to no other + * face (non-manifold edges) + */ + +void BOP_Merge2::cleanup( void ) +{ + BOP_Edges edges = m_mesh->getEdges(); + for (BOP_IT_Edges edge = edges.begin(); edge != edges.end(); ++edge) { + BOP_Indexs faces = (*edge)->getFaces(); + for (BOP_IT_Indexs face = faces.begin(); face != faces.end(); ++face) { + BOP_Face *f = m_mesh->getFace(*face); + if(f->getTAG()== UNCLASSIFIED) ; + else (*edge)->removeFace(*face); + } + if( (*edge)->getFaces().size() == 0) (*edge)->setUsed(false); + } + + BOP_Vertexs v = m_mesh->getVertexs(); + for( BOP_IT_Vertexs it = v.begin(); it != v.end(); ++it ) { + if( (*it)->getTAG() != BROKEN) { + BOP_Indexs edges = (*it)->getEdges(); + for(BOP_IT_Indexs i = edges.begin();i!=edges.end();i++) + if( m_mesh->getEdge((*i))->getUsed( ) == false) (*it)->removeEdge( *i ); + if( (*it)->getEdges().size() == 0 ) (*it)->setTAG(BROKEN); + } + } + // clean_nonmanifold( m_mesh ); +} + +/** + * Simplifies a mesh, merging its faces. + */ +bool BOP_Merge2::mergeFaces() +{ + BOP_Indexs mergeVertices; + BOP_Vertexs vertices = m_mesh->getVertexs(); + BOP_IT_Vertexs v = vertices.begin(); + const BOP_IT_Vertexs verticesEnd = vertices.end(); + + // Advance to first mergeable vertex + advance(v,m_firstVertex); + BOP_Index pos = m_firstVertex; + + // Add unbroken vertices to the list + while(v!=verticesEnd) { + if ((*v)->getTAG() != BROKEN) { + mergeVertices.push_back(pos); + } + + v++; + pos++; + } + + // Merge faces with that vertices + return mergeFaces(mergeVertices); +} + +/** + * remove edges from vertices when the vertex is removed + */ +void BOP_Merge2::freeVerts(BOP_Index v, BOP_Vertex *vert) +{ + BOP_Indexs edges = vert->getEdges(); + BOP_Vertex *other; + + for( BOP_IT_Indexs it = edges.begin(); it != edges.end(); ++it) { + BOP_Edge *edge = m_mesh->getEdge(*it); + BOP_Indexs edges2; + if( edge->getVertex1() != v ) + other = m_mesh->getVertex( edge->getVertex1() ); + else + other = m_mesh->getVertex( edge->getVertex2() ); + other->removeEdge(*it); + vert->removeEdge(*it); + } +} + +/** + * Simplifies a mesh, merging the faces with the specified vertices. + * @param mergeVertices vertices to test + * @return true if a face merge was performed + */ +bool BOP_Merge2::mergeFaces(BOP_Indexs &mergeVertices) +{ + // Check size > 0! + if (mergeVertices.size() == 0) return false; + bool didMerge = false; + + for( BOP_Index i = 0; i < mergeVertices.size(); ++i ) { + BOP_LFaces facesByOriginalFace; + BOP_Index v = mergeVertices[i]; + BOP_Vertex *vert = m_mesh->getVertex(v); +#ifdef DEBUG + cout << "i = " << i << ", v = " << v << ", vert = " << vert << endl; + if (v==48) + cout << "found vert 48" << endl; +#endif + if ( vert->getTAG() != BROKEN ) { + getFaces(facesByOriginalFace,v); + + switch (facesByOriginalFace.size()) { + case 0: + // v has no unbroken faces (so it's a new BROKEN vertex) + freeVerts( v, vert ); + vert->setTAG(BROKEN); + break; + case 2: { +#ifdef DEBUG + cout << "size of fBOF = " << facesByOriginalFace.size() << endl; +#endif + BOP_Faces ff = facesByOriginalFace.front(); + BOP_Faces fb = facesByOriginalFace.back(); + BOP_Index eindexs[2]; + int ecount = 0; + + // look for two edges adjacent to v which contain both ofaces + BOP_Indexs edges = vert->getEdges(); +#ifdef DEBUG + cout << " ff has " << ff.size() << " faces" << endl; + cout << " fb has " << fb.size() << " faces" << endl; + cout << " v has " << edges.size() << " edges" << endl; +#endif + for(BOP_IT_Indexs it = edges.begin(); it != edges.end(); + ++it ) { + BOP_Edge *edge = m_mesh->getEdge(*it); + BOP_Indexs faces = edge->getFaces(); +#ifdef DEBUG + cout << " " << edge << " has " << edge->getFaces().size() << " faces" << endl; +#endif + if( faces.size() == 2 ) { + BOP_Face *f0 = m_mesh->getFace(faces[0]); + BOP_Face *f1 = m_mesh->getFace(faces[1]); + if( f0->getOriginalFace() != f1->getOriginalFace() ) { +#ifdef DEBUG + cout << " " << f0 << endl; + cout << " " << f1 << endl; +#endif + eindexs[ecount++] = (*it); + } + } + } + if(ecount == 2) { +#ifdef DEBUG + cout << " edge indexes are " << eindexs[0]; + cout << " and " << eindexs[1] << endl; +#endif + BOP_Edge *edge = m_mesh->getEdge(eindexs[0]); + BOP_Index N = edge->getVertex1(); + if(N == v) N = edge->getVertex2(); +#ifdef DEBUG + cout << " ## OK, replace "<<v<<" with "<<N << endl; +#endif + mergeVertex(ff , v, N ); + mergeVertex(fb , v, N ); +// now remove v and its edges + vert->setTAG(BROKEN); + for(BOP_IT_Indexs it = edges.begin(); it != edges.end(); + ++it ) { + BOP_Edge *edge = m_mesh->getEdge(*it); + edge->setUsed(false); + } + didMerge = true; + } +#ifdef DEBUG + else { + cout << " HUH: ecount was " << ecount << endl; + } +#endif + } + break; + default: + break; + } + } + } + + return didMerge; +} + +void BOP_Merge2::mergeVertex(BOP_Faces &faces, BOP_Index v1, BOP_Index v2) +{ + for(BOP_IT_Faces face=faces.begin();face!=faces.end();face++) { + if( (*face)->size() == 3) + mergeVertex((BOP_Face3 *) *face, v1, v2); + else + mergeVertex((BOP_Face4 *) *face, v1, v2); + (*face)->setTAG(BROKEN); +#ifdef DEBUG + cout << " breaking " << (*face) << endl; +#endif + } +} + +/* + * Remove a face from the mesh and from each edges's face list + */ + +static void deleteFace(BOP_Mesh *m, BOP_Face *face) +{ + BOP_Index l2 = face->getVertex(0); + BOP_Faces faces = m->getFaces(); + for(int i = face->size(); i-- ; ) { + BOP_Indexs edges = m->getVertex(l2)->getEdges(); + BOP_Index l1 = face->getVertex(i); + for(BOP_IT_Indexs it1 = edges.begin(); it1 != edges.end(); ++it1 ) { + BOP_Edge *edge = m->getEdge(*it1); + if( ( edge->getVertex1() == l1 && edge->getVertex2() == l2 ) || + ( edge->getVertex1() == l2 && edge->getVertex2() == l1 ) ) { + BOP_Indexs ef = edge->getFaces(); + for(BOP_IT_Indexs it = ef.begin(); it != ef.end(); ++it ) { + if( m->getFace(*it) == face) { + edge->removeFace(*it); + break; + } + } + break; + } + } + l2 = l1; + } + face->setTAG(BROKEN); +} + +void BOP_Merge2::mergeVertex(BOP_Face3 *face, BOP_Index v1, BOP_Index v2) +{ + BOP_Index next, prev; + face->getNeighbours(v1,prev,next); + + // if new vertex is not already in the tri, make a new tri + if( prev != v2 && next != v2 ) { + m_mesh->addFace( new BOP_Face3(prev,v2,next, + face->getPlane(),face->getOriginalFace()) ); +#ifdef DEBUG + cout << "mv3: add " << prev << "," << v2 << "," << next << endl; + } else { + cout << "mv3: vertex already in tri: doing nothing" << endl; +#endif + } + deleteFace(m_mesh, face); +} + +void BOP_Merge2::mergeVertex(BOP_Face4 *face, BOP_Index v1, BOP_Index v2) +{ + BOP_Index next, prev, opp; + face->getNeighbours(v1,prev,next,opp); + + // if new vertex is already in the quad, replace quad with new tri + if( prev == v2 || next == v2 ) { + m_mesh->addFace( new BOP_Face3(prev,next,opp, + face->getPlane(),face->getOriginalFace()) ); +#ifdef DEBUG + cout << "mv4a: add " << prev << "," << next << "," << opp << endl; +#endif + } + // otherwise make a new quad + else { + m_mesh->addFace( new BOP_Face4(prev,v2,next,opp, + face->getPlane(),face->getOriginalFace()) ); +#ifdef DEBUG + cout << "mv4b: add "<<prev<<","<<v2<<","<<next<<","<<opp<<endl; +#endif + } + deleteFace(m_mesh, face); +} + +// #define OLD_QUAD + +/** + * Simplifies the mesh, merging the pairs of triangles that come frome the + * same original face and define a quad. + * @return true if a quad was added, false otherwise + */ +bool BOP_Merge2::createQuads() +{ + + BOP_Faces quads; + + // Get mesh faces + BOP_Faces faces = m_mesh->getFaces(); + + // Merge mesh triangles + const BOP_IT_Faces facesIEnd = (faces.end()-1); + const BOP_IT_Faces facesJEnd = faces.end(); + for(BOP_IT_Faces faceI=faces.begin();faceI!=facesIEnd;faceI++) { +#ifdef OLD_QUAD + if ((*faceI)->getTAG() == BROKEN || (*faceI)->size() != 3) continue; + for(BOP_IT_Faces faceJ=(faceI+1);faceJ!=facesJEnd;faceJ++) { + if ((*faceJ)->getTAG() == BROKEN || (*faceJ)->size() != 3 || + (*faceJ)->getOriginalFace() != (*faceI)->getOriginalFace()) continue; + + + BOP_Face *faceK = createQuad((BOP_Face3*)*faceI,(BOP_Face3*)*faceJ); + if (faceK != NULL) { + // Set triangles to BROKEN + deleteFace(m_mesh, *faceI); + deleteFace(m_mesh, *faceJ); +#ifdef DEBUG + cout << "createQuad: del " << *faceI << endl; + cout << "createQuad: del " << *faceJ << endl; + cout << "createQuad: add " << faceK << endl; +#endif + quads.push_back(faceK); + break; + } + } +#else + if ((*faceI)->getTAG() == BROKEN ) continue; + for(BOP_IT_Faces faceJ=(faceI+1);faceJ!=facesJEnd;faceJ++) { + if ((*faceJ)->getTAG() == BROKEN || + (*faceJ)->getOriginalFace() != (*faceI)->getOriginalFace()) continue; + + BOP_Face *faceK = NULL; + if((*faceI)->size() == 3) { + if((*faceJ)->size() == 3) + faceK = createQuad((BOP_Face3*)*faceI,(BOP_Face3*)*faceJ); + else + faceK = createQuad((BOP_Face3*)*faceI,(BOP_Face4*)*faceJ); + } else { + if((*faceJ)->size() == 3) + faceK = createQuad((BOP_Face3*)*faceJ,(BOP_Face4*)*faceI); + else + faceK = createQuad((BOP_Face4*)*faceI,(BOP_Face4*)*faceJ); + } + + if (faceK != NULL) { + // Set triangles to BROKEN + deleteFace(m_mesh, *faceI); + deleteFace(m_mesh, *faceJ); +#ifdef DEBUG + cout << "createQuad: del " << *faceI << endl; + cout << "createQuad: del " << *faceJ << endl; + cout << "createQuad: add " << faceK << endl; +#endif + quads.push_back(faceK); + break; + } + } +#endif + } + + // Add quads to mesh + const BOP_IT_Faces quadsEnd = quads.end(); + for(BOP_IT_Faces quad=quads.begin();quad!=quadsEnd;quad++) m_mesh->addFace(*quad); + return (quads.size() > 0); +} + +/** + * Returns a new quad (convex) from the merge of two triangles that share the + * vertex index v. + * @param faceI mesh triangle + * @param faceJ mesh triangle + * @param v vertex index shared by both triangles + * @return a new convex quad if the merge is possible + */ +BOP_Face* BOP_Merge2::createQuad(BOP_Face3 *faceI, BOP_Face3 *faceJ) +{ + // Test if both triangles share a vertex index + BOP_Index v; + unsigned int i; + for(i=0;i<3 ;i++) { + v = faceI->getVertex(i); + if( faceJ->containsVertex(v) ) break; + } + if (i == 3) return NULL; + + BOP_Face *faceK = NULL; + + // Get faces data + BOP_Index prevI, nextI, prevJ, nextJ; + faceI->getNeighbours(v,prevI,nextI); + faceJ->getNeighbours(v,prevJ,nextJ); + MT_Point3 vertex = m_mesh->getVertex(v)->getPoint(); + MT_Point3 vPrevI = m_mesh->getVertex(prevI)->getPoint(); + MT_Point3 vNextI = m_mesh->getVertex(nextI)->getPoint(); + MT_Point3 vPrevJ = m_mesh->getVertex(prevJ)->getPoint(); + MT_Point3 vNextJ = m_mesh->getVertex(nextJ)->getPoint(); + + // Quad test + if (prevI == nextJ) { + if (!BOP_collinear(vNextI,vertex,vPrevJ) && !BOP_collinear(vNextI,vPrevI,vPrevJ) && + BOP_convex(vertex,vNextI,vPrevI,vPrevJ)) { + faceK = new BOP_Face4(v,nextI,prevI,prevJ,faceI->getPlane(),faceI->getOriginalFace()); + faceK->setTAG(faceI->getTAG()); + BOP_Index edge; + m_mesh->getIndexEdge(v,prevI,edge); + m_mesh->getVertex(v)->removeEdge(edge); + m_mesh->getVertex(prevI)->removeEdge(edge); + } + } + else if (nextI == prevJ) { + if (!BOP_collinear(vPrevI,vertex,vNextJ) && !BOP_collinear(vPrevI,vNextI,vNextJ) && + BOP_convex(vertex,vNextJ,vNextI,vPrevI)) { + faceK = new BOP_Face4(v,nextJ,nextI,prevI,faceI->getPlane(),faceI->getOriginalFace()); + faceK->setTAG(faceI->getTAG()); + BOP_Index edge; + m_mesh->getIndexEdge(v,nextI,edge); + m_mesh->getVertex(v)->removeEdge(edge); + m_mesh->getVertex(nextI)->removeEdge(edge); + } + } + return faceK; +} + +/** + * Returns a new quad (convex) from the merge of two triangles that share the + * vertex index v. + * @param faceI mesh triangle + * @param faceJ mesh triangle + * @param v vertex index shared by both triangles + * @return a new convex quad if the merge is possible + */ +BOP_Face* BOP_Merge2::createQuad(BOP_Face3 *faceI, BOP_Face4 *faceJ) +{ + // Test if triangle and quad share a vertex index + BOP_Index v; + unsigned int i; + for(i=0;i<3 ;i++) { + v = faceI->getVertex(i); + if( faceJ->containsVertex(v) ) break; + } + if (i == 3) return NULL; + + BOP_Face *faceK = NULL; + + // Get faces data + BOP_Index prevI, nextI, prevJ, nextJ, oppJ; + faceI->getNeighbours(v,prevI,nextI); + faceJ->getNeighbours(v,prevJ,nextJ,oppJ); + + // Quad test + BOP_Index edge; + if (nextI == prevJ) { + if (prevI == nextJ) { // v is in center + faceK = new BOP_Face3(nextJ,oppJ,prevJ,faceI->getPlane(),faceI->getOriginalFace()); + faceK->setTAG(faceI->getTAG()); + m_mesh->getIndexEdge(v,prevI,edge); + m_mesh->getVertex(v)->removeEdge(edge); + m_mesh->getVertex(prevI)->removeEdge(edge); + m_mesh->getIndexEdge(v,nextI,edge); + m_mesh->getVertex(v)->removeEdge(edge); + m_mesh->getVertex(nextI)->removeEdge(edge); + freeVerts(v, m_mesh->getVertex(v)); + } else if (prevI == oppJ) { // nextI is in center + faceK = new BOP_Face3(v,nextJ,oppJ,faceI->getPlane(),faceI->getOriginalFace()); + faceK->setTAG(faceI->getTAG()); + m_mesh->getIndexEdge(v,nextI,edge); + m_mesh->getVertex(v)->removeEdge(edge); + m_mesh->getVertex(nextI)->removeEdge(edge); + m_mesh->getIndexEdge(prevI,nextI,edge); + m_mesh->getVertex(prevI)->removeEdge(edge); + m_mesh->getVertex(nextI)->removeEdge(edge); + freeVerts(nextI, m_mesh->getVertex(nextI)); + } + } else if (nextI == oppJ && prevI == nextJ ) { // prevI is in center + faceK = new BOP_Face3(prevJ,v,oppJ,faceI->getPlane(),faceI->getOriginalFace()); + faceK->setTAG(faceI->getTAG()); + m_mesh->getIndexEdge(v,prevI,edge); + m_mesh->getVertex(v)->removeEdge(edge); + m_mesh->getVertex(prevI)->removeEdge(edge); + m_mesh->getIndexEdge(nextI,prevI,edge); + m_mesh->getVertex(nextI)->removeEdge(edge); + m_mesh->getVertex(prevI)->removeEdge(edge); + freeVerts(prevI, m_mesh->getVertex(prevI)); + } + return faceK; +} + +/** + * Returns a new quad (convex) from the merge of two triangles that share the + * vertex index v. + * @param faceI mesh triangle + * @param faceJ mesh triangle + * @param v vertex index shared by both triangles + * @return a new convex quad if the merge is possible + */ +BOP_Face* BOP_Merge2::createQuad(BOP_Face4 *faceI, BOP_Face4 *faceJ) +{ + BOP_Face *faceK = NULL; + // + // Test if both quads share a vertex index + // + BOP_Index v; + unsigned int i; + for(i=0;i<4 ;i++) { + v = faceI->getVertex(i); + if( faceJ->containsVertex(v) ) break; + } + if (i == 3) return NULL; + + + // Get faces data + BOP_Index prevI, nextI, oppI, prevJ, nextJ, oppJ; + faceI->getNeighbours(v,prevI,nextI,oppI); + faceJ->getNeighbours(v,prevJ,nextJ,oppJ); + + // Quad test + BOP_Index edge; + if (nextI == prevJ) { + if (prevI == nextJ) { // v is in center + faceK = new BOP_Face4(nextI,oppI,nextJ,oppJ,faceI->getPlane(),faceI->getOriginalFace()); + faceK->setTAG(faceI->getTAG()); + m_mesh->getIndexEdge(v,prevI,edge); + m_mesh->getVertex(v)->removeEdge(edge); + m_mesh->getVertex(prevI)->removeEdge(edge); + m_mesh->getIndexEdge(v,nextI,edge); + m_mesh->getVertex(v)->removeEdge(edge); + m_mesh->getVertex(nextI)->removeEdge(edge); + freeVerts(v, m_mesh->getVertex(v)); + } else if (oppI == oppJ) { // nextI is in center + faceK = new BOP_Face4(v,nextJ,oppJ,prevI,faceI->getPlane(),faceI->getOriginalFace()); + faceK->setTAG(faceI->getTAG()); + m_mesh->getIndexEdge(v,nextI,edge); + m_mesh->getVertex(v)->removeEdge(edge); + m_mesh->getVertex(nextI)->removeEdge(edge); + m_mesh->getIndexEdge(prevI,nextI,edge); + m_mesh->getVertex(prevI)->removeEdge(edge); + m_mesh->getVertex(nextI)->removeEdge(edge); + freeVerts(nextI, m_mesh->getVertex(nextI)); + } + } else if (prevI == nextJ && oppI == oppJ) { // prevI is in center + faceK = new BOP_Face4(v,nextI,oppJ,prevJ,faceI->getPlane(),faceI->getOriginalFace()); + faceK->setTAG(faceI->getTAG()); + m_mesh->getIndexEdge(v,prevI,edge); + m_mesh->getVertex(v)->removeEdge(edge); + m_mesh->getVertex(prevI)->removeEdge(edge); + m_mesh->getIndexEdge(nextI,prevI,edge); + m_mesh->getVertex(nextI)->removeEdge(edge); + m_mesh->getVertex(prevI)->removeEdge(edge); + freeVerts(prevI, m_mesh->getVertex(prevI)); + } + return faceK; +} + +/** + * Returns if a index is inside a set of indexs. + * @param indexs set of indexs + * @param i index + * @return true if the index is inside the set, false otherwise + */ +bool BOP_Merge2::containsIndex(BOP_Indexs indexs, BOP_Index i) +{ + const BOP_IT_Indexs indexsEnd = indexs.end(); + for(BOP_IT_Indexs it=indexs.begin();it!=indexsEnd;it++) { + if (*it == i) return true; + } + return false; +} + +/** + * Creates a list of lists L1, L2, ... LN where + * LX = mesh faces with vertex v that come from the same original face + * @param facesByOriginalFace list of faces lists + * @param v vertex index + */ +void BOP_Merge2::getFaces(BOP_LFaces &facesByOriginalFace, BOP_Index v) +{ + // Get edges with vertex v + + BOP_Indexs edgeIndexs = m_mesh->getVertex(v)->getEdges(); + const BOP_IT_Indexs edgeEnd = edgeIndexs.end(); + for(BOP_IT_Indexs edgeIndex = edgeIndexs.begin();edgeIndex != edgeEnd;edgeIndex++) { + // For each edge, add its no broken faces to the output list + BOP_Edge* edge = m_mesh->getEdge(*edgeIndex); + BOP_Indexs faceIndexs = edge->getFaces(); + const BOP_IT_Indexs faceEnd = faceIndexs.end(); + for(BOP_IT_Indexs faceIndex=faceIndexs.begin();faceIndex!=faceEnd;faceIndex++) { + BOP_Face* face = m_mesh->getFace(*faceIndex); + if (face->getTAG() != BROKEN) { + bool found = false; + // Search if we already have created a list for the + // faces that come from the same original face + const BOP_IT_LFaces lfEnd = facesByOriginalFace.end(); + for(BOP_IT_LFaces facesByOriginalFaceX=facesByOriginalFace.begin(); + facesByOriginalFaceX!=lfEnd; facesByOriginalFaceX++) { + if (((*facesByOriginalFaceX)[0])->getOriginalFace() == face->getOriginalFace()) { + // Search that the face has not been added to the list before + for(unsigned int i = 0;i<(*facesByOriginalFaceX).size();i++) { + if ((*facesByOriginalFaceX)[i] == face) { + found = true; + break; + } + } + if (!found) { + // Add the face to the list + if (face->getTAG()==OVERLAPPED) facesByOriginalFaceX->insert(facesByOriginalFaceX->begin(),face); + else facesByOriginalFaceX->push_back(face); + found = true; + } + break; + } + } + if (!found) { + // Create a new list and add the current face + BOP_Faces facesByOriginalFaceX; + facesByOriginalFaceX.push_back(face); + facesByOriginalFace.push_back(facesByOriginalFaceX); + } + } + } + } +} + +/** + * Creates a list of lists L1, L2, ... LN where + * LX = mesh faces with vertex v that come from the same original face + * and without any of the vertices that appear before v in vertices + * @param facesByOriginalFace list of faces lists + * @param vertices vector with vertices indexs that contains v + * @param v vertex index + */ +void BOP_Merge2::getFaces(BOP_LFaces &facesByOriginalFace, BOP_Indexs vertices, BOP_Index v) +{ + // Get edges with vertex v + BOP_Indexs edgeIndexs = m_mesh->getVertex(v)->getEdges(); + const BOP_IT_Indexs edgeEnd = edgeIndexs.end(); + for(BOP_IT_Indexs edgeIndex = edgeIndexs.begin();edgeIndex != edgeEnd;edgeIndex++) { + // Foreach edge, add its no broken faces to the output list + BOP_Edge* edge = m_mesh->getEdge(*edgeIndex); + BOP_Indexs faceIndexs = edge->getFaces(); + const BOP_IT_Indexs faceEnd = faceIndexs.end(); + for(BOP_IT_Indexs faceIndex=faceIndexs.begin();faceIndex!=faceEnd;faceIndex++) { + BOP_Face* face = m_mesh->getFace(*faceIndex); + if (face->getTAG() != BROKEN) { + // Search if the face contains any of the forbidden vertices + bool found = false; + for(BOP_IT_Indexs vertex = vertices.begin();*vertex!= v;vertex++) { + if (face->containsVertex(*vertex)) { + // face contains a forbidden vertex! + found = true; + break; + } + } + if (!found) { + // Search if we already have created a list with the + // faces that come from the same original face + const BOP_IT_LFaces lfEnd = facesByOriginalFace.end(); + for(BOP_IT_LFaces facesByOriginalFaceX=facesByOriginalFace.begin(); + facesByOriginalFaceX!=lfEnd; facesByOriginalFaceX++) { + if (((*facesByOriginalFaceX)[0])->getOriginalFace() == face->getOriginalFace()) { + // Search that the face has not been added to the list before + for(unsigned int i = 0;i<(*facesByOriginalFaceX).size();i++) { + if ((*facesByOriginalFaceX)[i] == face) { + found = true; + break; + } + } + if (!found) { + // Add face to the list + if (face->getTAG()==OVERLAPPED) facesByOriginalFaceX->insert(facesByOriginalFaceX->begin(),face); + else facesByOriginalFaceX->push_back(face); + found = true; + } + break; + } + } + if (!found) { + // Create a new list and add the current face + BOP_Faces facesByOriginalFaceX; + facesByOriginalFaceX.push_back(face); + facesByOriginalFace.push_back(facesByOriginalFaceX); + } + } + } + } + } +} + +#endif /* BOP_NEW_MERGE */ diff --git a/intern/boolop/intern/BOP_Merge2.h b/intern/boolop/intern/BOP_Merge2.h new file mode 100644 index 00000000000..1e5945a889f --- /dev/null +++ b/intern/boolop/intern/BOP_Merge2.h @@ -0,0 +1,99 @@ +/** + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef BOP_MERGE2_H +#define BOP_MERGE2_H + +#include "BOP_Misc.h" + +#ifdef BOP_NEW_MERGE + +#include "BOP_Mesh.h" +#include "BOP_Tag.h" +#include "BOP_MathUtils.h" +#include "MEM_SmartPtr.h" + +typedef vector< BOP_Faces > BOP_LFaces; +typedef vector< BOP_Faces >::iterator BOP_IT_LFaces; + +class BOP_Merge2 { + private: + BOP_Mesh* m_mesh; + BOP_Index m_firstVertex; + static BOP_Merge2 SINGLETON; + + BOP_Merge2() {}; + bool mergeFaces(); + bool mergeFaces(BOP_Indexs &mergeVertices); + bool mergeFaces(BOP_Faces &oldFaces, BOP_Faces &newFaces, BOP_Indexs &vertices, BOP_Index v); + bool mergeFaces(BOP_Faces &faces, BOP_Faces &oldFaces, BOP_Faces &newFaces, BOP_Indexs &vertices, BOP_Index v); + BOP_Face *mergeFaces(BOP_Face *faceI, BOP_Face *faceJ, BOP_Index v); + BOP_Face *mergeFaces(BOP_Face *faceI, BOP_Face *faceJ, BOP_Indexs &pending, BOP_Index v); + BOP_Face *mergeFaces(BOP_Face3 *faceI, BOP_Face3 *faceJ, BOP_Index v); + BOP_Face *mergeFaces(BOP_Face4 *faceI, BOP_Face3 *faceJ, BOP_Index v); + BOP_Face *mergeFaces(BOP_Face4 *faceI, BOP_Face3 *faceJ, BOP_Indexs &pending, BOP_Index v); + BOP_Face *mergeFaces(BOP_Face4 *faceI, BOP_Face4 *faceJ, BOP_Indexs &pending, BOP_Index v); + bool createQuads(); + bool containsIndex(BOP_Indexs indexs, BOP_Index index); + void getFaces(BOP_LFaces &facesByOriginalFace, BOP_Index v); + void getFaces(BOP_LFaces &facesByOriginalFace, BOP_Indexs vertices, BOP_Index v); + BOP_Face *createQuad(BOP_Face3 *faceI, BOP_Face3 *faceJ); + BOP_Face *createQuad(BOP_Face3 *faceI, BOP_Face4 *faceJ); + BOP_Face *createQuad(BOP_Face4 *faceI, BOP_Face4 *faceJ); + + bool mergeVertex(BOP_Face *faceI, BOP_Face *faceJ, BOP_Index v, + BOP_Indexs &mergeVertices); + bool mergeVertex(BOP_Face *faceI, BOP_Face *faceJ, BOP_Index v, + BOP_Indexs &pending, BOP_Faces &oldFaces, BOP_Faces &newFaces ); + BOP_Face *find3Neighbor(BOP_Face *faceI, BOP_Face *faceJ, + BOP_Index X, BOP_Index I, BOP_Index P, BOP_Index N ); + BOP_Face *find4Neighbor(BOP_Face *faceI, BOP_Face *faceJ, + BOP_Index X, BOP_Index I, BOP_Index P, BOP_Index N, + BOP_Face **faceL, BOP_Index &O); + BOP_Face3 *collapse(BOP_Face4 *faceC, BOP_Index X); + void mergeFaces(BOP_Face *A, BOP_Face *B, BOP_Index X, + BOP_Index I, BOP_Index N, BOP_Index P, BOP_Faces &newFaces ); + void freeVerts(BOP_Index v, BOP_Vertex *vert); + + void mergeVertex(BOP_Faces&, BOP_Index, BOP_Index); + void mergeVertex(BOP_Face3 *, BOP_Index, BOP_Index); + void mergeVertex(BOP_Face4 *, BOP_Index, BOP_Index); + void cleanup( void ); + + public: + + static BOP_Merge2 &getInstance() { + return SINGLETON; + } + + void mergeFaces(BOP_Mesh *m, BOP_Index v); +}; + +void dumpmesh(BOP_Mesh *, bool); + +#endif /* BOP_NEW_MERGE2 */ +#endif diff --git a/intern/boolop/intern/BOP_Mesh.cpp b/intern/boolop/intern/BOP_Mesh.cpp index 5659cd62a3f..075884a1920 100644 --- a/intern/boolop/intern/BOP_Mesh.cpp +++ b/intern/boolop/intern/BOP_Mesh.cpp @@ -449,6 +449,13 @@ bool BOP_Mesh::getIndexEdge(BOP_Index v1, BOP_Index v2, BOP_Index &e) printf ("found edge (%d %d)\n",v1,v2); #endif e = edge->index; +#ifdef BOP_NEW_MERGE + if( m_edges[e]->getUsed() == false ) { + m_edges[e]->setUsed(true); + m_vertexs[v1]->addEdge(e); + m_vertexs[v2]->addEdge(e); + } +#endif return true; } #ifdef HASH_PRINTF_DEBUG @@ -794,7 +801,8 @@ bool BOP_Mesh::isClosedMesh() } -/** *************************************************************************** +#ifdef BOP_DEBUG +/****************************************************************************** * DEBUG METHODS * * This functions are used to test the mesh state and debug program errors. * ******************************************************************************/ @@ -1075,3 +1083,4 @@ void BOP_Mesh::updatePlanes() } } +#endif diff --git a/intern/boolop/intern/BOP_Mesh.h b/intern/boolop/intern/BOP_Mesh.h index 9abff52545f..46c8fa53d20 100644 --- a/intern/boolop/intern/BOP_Mesh.h +++ b/intern/boolop/intern/BOP_Mesh.h @@ -1,10 +1,3 @@ -/* - * TEMPORARY defines to enable hashing support - */ - -#define HASH(x) ((x) >> 5) /* each "hash" covers 32 indices */ -// #define HASH_PRINTF_DEBUG /* uncomment to enable debug output */ - /** * * $Id$ diff --git a/intern/boolop/intern/BOP_Misc.h b/intern/boolop/intern/BOP_Misc.h new file mode 100644 index 00000000000..d021579d161 --- /dev/null +++ b/intern/boolop/intern/BOP_Misc.h @@ -0,0 +1,54 @@ +/** + * + * $Id: BOP_Misc.h 14444 2008-04-16 22:40:48Z khughes $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): Ken Hughes + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/* + * This file contains various definitions used across the modules + */ + +/* + * define operator>> for faces, edges and vertices, and also add some + * debugging functions for displaying various internal data structures + */ + +// #define BOP_DEBUG + +#define HASH(x) ((x) >> 5) /* each "hash" covers 32 indices */ +// #define HASH_PRINTF_DEBUG /* uncomment to enable debug output */ + +/* + * temporary: control which method is used to merge final triangles and + * quads back together after an operation. If both methods are included, + * the "rt" debugging button on the Scene panel (F10) is used to control + * which is active. Setting it to 100 enables the original method, any + * other value enables the new method. + */ + +#define BOP_ORIG_MERGE /* include original merge code */ +#define BOP_NEW_MERGE /* include new merge code */ diff --git a/intern/boolop/intern/BOP_Tag.h b/intern/boolop/intern/BOP_Tag.h index 705f4885866..ead10fa6040 100644 --- a/intern/boolop/intern/BOP_Tag.h +++ b/intern/boolop/intern/BOP_Tag.h @@ -39,7 +39,7 @@ #define OUTON_TAG 0x11 // Above and on the plane #define UNCLASSIFIED_TAG 0x0F // Expecting to be classified -#define PHANTOM_TAG 0x0C // Phantom face +#define PHANTOM_TAG 0x0C // Phantom face: verts form collinear triangle #define OVERLAPPED_TAG 0x0D // Overlapped face #define BROKEN_TAG 0x0B // Splitted and unused ... diff --git a/intern/boolop/intern/BOP_Vertex.cpp b/intern/boolop/intern/BOP_Vertex.cpp index a429c26d204..edb53ea6a59 100644 --- a/intern/boolop/intern/BOP_Vertex.cpp +++ b/intern/boolop/intern/BOP_Vertex.cpp @@ -89,3 +89,22 @@ bool BOP_Vertex::containsEdge(BOP_Index i) return false; } + +#ifdef BOP_DEBUG +/** + * Implements operator <<. + */ +#include <iomanip> + +ostream &operator<<(ostream &stream, BOP_Vertex *v) +{ + char aux[20]; + BOP_stringTAG(v->m_tag,aux); + MT_Point3 point = v->getPoint(); + stream << setprecision(6) << showpoint << fixed; + stream << "Vertex[" << point[0] << "," << point[1] << ","; + stream << point[2] << "] (" << aux << ")"; + return stream; +} +#endif + diff --git a/intern/boolop/intern/BOP_Vertex.h b/intern/boolop/intern/BOP_Vertex.h index 3a9895df6d3..18b2f168f8c 100644 --- a/intern/boolop/intern/BOP_Vertex.h +++ b/intern/boolop/intern/BOP_Vertex.h @@ -31,6 +31,7 @@ #include "BOP_Tag.h" #include "BOP_Indexs.h" #include "MT_Point3.h" +#include "BOP_Misc.h" class BOP_Vertex { @@ -52,6 +53,10 @@ public: inline MT_Point3 getPoint() const { return m_point;}; inline BOP_TAG getTAG() { return m_tag;}; inline void setTAG(BOP_TAG t) { m_tag = t;}; +#ifdef BOP_DEBUG + friend ostream &operator<<(ostream &stream, BOP_Vertex *v); +#endif + }; #endif diff --git a/intern/boolop/make/msvc_7_0/boolop.vcproj b/intern/boolop/make/msvc_7_0/boolop.vcproj index 7ae417e42d5..6e6d6abeb43 100644 --- a/intern/boolop/make/msvc_7_0/boolop.vcproj +++ b/intern/boolop/make/msvc_7_0/boolop.vcproj @@ -279,6 +279,9 @@ ECHO Done RelativePath="..\..\intern\BOP_Merge.cpp"> </File> <File + RelativePath="..\..\intern\BOP_Merge2.cpp"> + </File> + <File RelativePath="..\..\intern\BOP_Mesh.cpp"> </File> <File @@ -331,9 +334,15 @@ ECHO Done RelativePath="..\..\intern\BOP_Merge.h"> </File> <File + RelativePath="..\..\intern\BOP_Merge2.h"> + </File> + <File RelativePath="..\..\intern\BOP_Mesh.h"> </File> <File + RelativePath="..\..\intern\BOP_Misc.h"> + </File> + <File RelativePath="..\..\intern\BOP_Segment.h"> </File> <File diff --git a/intern/boolop/make/msvc_9_0/boolop.vcproj b/intern/boolop/make/msvc_9_0/boolop.vcproj new file mode 100644 index 00000000000..7fe83962695 --- /dev/null +++ b/intern/boolop/make/msvc_9_0/boolop.vcproj @@ -0,0 +1,487 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9,00"
+ Name="INT_boolop"
+ ProjectGUID="{EB75F4D6-2970-4A3A-8D99-2BAD7201C0E9}"
+ RootNamespace="boolop"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Blender Debug|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\boolop\debug"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\boolop\debug"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\extern;..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\build\msvc_9\intern\memutil\include;..\..\..\..\..\build\msvc_9\intern\container\include;..\..\..\..\..\build\msvc_9\intern\guardedalloc\include;..\..\..\..\source\blender\blenlib;..\..\..\..\source\blender\makesdna;$(NOINHERIT)"
+ PreprocessorDefinitions="WIN32,_DEBUG,_LIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ BufferSecurityCheck="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\boolop\debug\bsplib.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\boolop\debug\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\boolop\debug\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\boolop\debug\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="3"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1043"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\debug\libboolop.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying BOOLOP files library (debug target) to lib tree"
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\boolop\include MKDIR ..\..\..\..\..\build\msvc_9\intern\boolop\include
XCOPY /Y ..\..\extern\*.h ..\..\..\..\..\build\msvc_9\intern\boolop\include
ECHO Done
"
+ />
+ </Configuration>
+ <Configuration
+ Name="Blender Release|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\boolop"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\boolop"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="2"
+ AdditionalIncludeDirectories="..\..\extern;..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\build\msvc_9\intern\memutil\include;..\..\..\..\..\build\msvc_9\intern\container\include;..\..\..\..\..\build\msvc_9\intern\guardedalloc\include;..\..\..\..\source\blender\blenlib;..\..\..\..\source\blender\makesdna;$(NOINHERIT)"
+ PreprocessorDefinitions="WIN32,NDEBUG,_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\boolop\bsplib.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\boolop\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\boolop\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\boolop\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1043"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\libboolop.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying BOOLOP files library to lib tree"
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\boolop\include MKDIR ..\..\..\..\..\build\msvc_9\intern\boolop\include
XCOPY /Y ..\..\extern\*.h ..\..\..\..\..\build\msvc_9\intern\boolop\include
ECHO Done
"
+ />
+ </Configuration>
+ <Configuration
+ Name="3DPlugin Release|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\boolop\mtdll"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\boolop\mtdll"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="2"
+ AdditionalIncludeDirectories="..\..\extern;..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\build\msvc_9\intern\memutil\include;..\..\..\..\..\build\msvc_9\intern\container\include;..\..\..\..\..\build\msvc_9\intern\guardedalloc\include;..\..\..\..\source\blender\blenlib;..\..\..\..\source\blender\makesdna;$(NOINHERIT)"
+ PreprocessorDefinitions="WIN32,NDEBUG,_LIB"
+ StringPooling="true"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\boolop\mtdll\bsplib.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\boolop\mtdll\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\boolop\mtdll\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\boolop\mtdll\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1043"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\mtdll\libboolop.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying BOOLOP files library to lib tree"
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\boolop\include MKDIR ..\..\..\..\..\build\msvc_9\intern\boolop\include
XCOPY /Y ..\..\extern\*.h ..\..\..\..\..\build\msvc_9\intern\boolop\include
ECHO Done
"
+ />
+ </Configuration>
+ <Configuration
+ Name="3DPlugin Debug|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\boolop\mtdll\debug"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\boolop\mtdll\debug"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\extern;..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\build\msvc_9\intern\memutil\include;..\..\..\..\..\build\msvc_9\intern\container\include;..\..\..\..\..\build\msvc_9\intern\guardedalloc\include;..\..\..\..\source\blender\blenlib;..\..\..\..\source\blender\makesdna;$(NOINHERIT)"
+ PreprocessorDefinitions="WIN32,_DEBUG,_LIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ BufferSecurityCheck="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\boolop\mtdll\debug\bsplib.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\boolop\mtdll\debug\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\boolop\mtdll\debug\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\boolop\mtdll\debug\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="3"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1043"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\mtdll\debug\libboolop.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying BOOLOP files library (debug target) to lib tree"
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\boolop\include MKDIR ..\..\..\..\..\build\msvc_9\intern\boolop\include
XCOPY /Y ..\..\extern\*.h ..\..\..\..\..\build\msvc_9\intern\boolop\include
ECHO Done
"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="intern"
+ >
+ <Filter
+ Name="Source Files"
+ >
+ <File
+ RelativePath="..\..\intern\BOP_BBox.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BOP_BSPNode.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BOP_BSPTree.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BOP_Edge.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BOP_Face.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BOP_Face2Face.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BOP_Interface.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BOP_MathUtils.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BOP_Merge.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BOP_Merge2.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BOP_Mesh.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BOP_Segment.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BOP_Splitter.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BOP_Tag.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BOP_Triangulator.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BOP_Vertex.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ >
+ <File
+ RelativePath="..\..\intern\BOP_BBox.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BOP_BSPNode.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BOP_BSPTree.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BOP_Chrono.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BOP_Edge.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BOP_Face.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BOP_Face2Face.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BOP_Indexs.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BOP_MathUtils.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BOP_Merge.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BOP_Merge2.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BOP_Mesh.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BOP_Misc.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BOP_Segment.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BOP_Splitter.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BOP_Tag.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BOP_Triangulator.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BOP_Vertex.h"
+ >
+ </File>
+ </Filter>
+ </Filter>
+ <Filter
+ Name="extern"
+ >
+ <File
+ RelativePath="..\..\extern\BOP_Interface.h"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/intern/bsp/SConscript b/intern/bsp/SConscript index 10dc29e675a..0d1b74ea2ca 100644 --- a/intern/bsp/SConscript +++ b/intern/bsp/SConscript @@ -6,7 +6,7 @@ sources = env.Glob('intern/*.cpp') incs = 'intern ../container ../moto/include ../memutil' if (env['OURPLATFORM'] == 'win32-mingw'): - env.BlenderLib ('bf_BSP', sources, Split(incs), [], libtype=['common','intern'], priority=[26,26] ) + env.BlenderLib ('blender_BSP', sources, Split(incs), [], libtype=['common','intern'], priority=[26,26] ) else: - env.BlenderLib ('bf_BSP', sources, Split(incs), [], libtype='core', priority=20 ) + env.BlenderLib ('blender_BSP', sources, Split(incs), [], libtype='core', priority=20 ) diff --git a/intern/bsp/intern/BSP_CSGMesh.cpp b/intern/bsp/intern/BSP_CSGMesh.cpp index 553f39a4642..ca7795b3cf5 100644 --- a/intern/bsp/intern/BSP_CSGMesh.cpp +++ b/intern/bsp/intern/BSP_CSGMesh.cpp @@ -197,7 +197,7 @@ BuildEdges( for (int vert = 0; vert < vertex_num; ++vert) { - BSP_FaceInd fi(f_it - f_it_begin); + BSP_FaceInd fi(size_t (f_it - f_it_begin)); InsertEdge(prev_vi,face.m_verts[vert],fi,dummy); prev_vi = face.m_verts[vert]; } diff --git a/intern/bsp/make/msvc_9_0/bsplib.vcproj b/intern/bsp/make/msvc_9_0/bsplib.vcproj new file mode 100644 index 00000000000..a1b16d5b93f --- /dev/null +++ b/intern/bsp/make/msvc_9_0/bsplib.vcproj @@ -0,0 +1,371 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9,00"
+ Name="INT_bsplib"
+ ProjectGUID="{B093415D-C0F6-4E76-8F5A-6BC1917BCE9E}"
+ RootNamespace="bsplib"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Blender Debug|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\bsp\debug"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\bsp\debug"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..;..\..\..\..\..\build\msvc_9\intern\memutil\include;..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\build\msvc_9\intern\container\include"
+ PreprocessorDefinitions="WIN32,_DEBUG,_LIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ BufferSecurityCheck="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\bsp\debug\bsplib.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\bsp\debug\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\bsp\debug\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\bsp\debug\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="3"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1043"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\debug\libbsp.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying BSP files library (debug target) to lib tree"
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\bsp\include MKDIR ..\..\..\..\..\build\msvc_9\intern\bsp\include
XCOPY /Y ..\..\extern\*.h ..\..\..\..\..\build\msvc_9\intern\bsp\include
ECHO Done
"
+ />
+ </Configuration>
+ <Configuration
+ Name="Blender Release|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\bsp"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\bsp"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="2"
+ AdditionalIncludeDirectories="..\..;..\..\..\..\..\build\msvc_9\intern\memutil\include;..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\build\msvc_9\intern\container\include"
+ PreprocessorDefinitions="WIN32,NDEBUG,_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\bsp\bsplib.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\bsp\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\bsp\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\bsp\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1043"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\libbsp.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying BSP files library to lib tree"
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\bsp\include MKDIR ..\..\..\..\..\build\msvc_9\intern\bsp\include
XCOPY /Y ..\..\extern\*.h ..\..\..\..\..\build\msvc_9\intern\bsp\include
ECHO Done
"
+ />
+ </Configuration>
+ <Configuration
+ Name="3DPlugin Release|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\bsp\mtdll"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\bsp\mtdll"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="2"
+ AdditionalIncludeDirectories="..\..;..\..\..\..\..\build\msvc_9\intern\memutil\include;..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\build\msvc_9\intern\container\include"
+ PreprocessorDefinitions="WIN32,NDEBUG,_LIB"
+ StringPooling="true"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\bsp\mtdll\bsplib.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\bsp\mtdll\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\bsp\mtdll\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\bsp\mtdll\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1043"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\mtdll\libbsp.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying BSP files library to lib tree"
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\bsp\include MKDIR ..\..\..\..\..\build\msvc_9\intern\bsp\include
XCOPY /Y ..\..\extern\*.h ..\..\..\..\..\build\msvc_9\intern\bsp\include
ECHO Done
"
+ />
+ </Configuration>
+ <Configuration
+ Name="3DPlugin Debug|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\bsp\mtdll\debug"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\bsp\mtdll\debug"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..;..\..\..\..\..\build\msvc_9\intern\memutil\include;..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\build\msvc_9\intern\container\include"
+ PreprocessorDefinitions="WIN32,_DEBUG,_LIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ BufferSecurityCheck="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\bsp\mtdll\debug\bsplib.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\bsp\mtdll\debug\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\bsp\mtdll\debug\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\bsp\mtdll\debug\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="3"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1043"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\mtdll\debug\libbsp.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying BSP files library (debug target) to lib tree"
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\bsp\include MKDIR ..\..\..\..\..\build\msvc_9\intern\bsp\include
XCOPY /Y ..\..\extern\*.h ..\..\..\..\..\build\msvc_9\intern\bsp\include
ECHO Done
"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="intern"
+ >
+ <File
+ RelativePath="..\..\intern\BSP_CSGException.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BSP_CSGMesh.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BSP_CSGMesh.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BSP_CSGMesh_CFIterator.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BSP_MeshPrimitives.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\BSP_MeshPrimitives.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\CSG_BooleanOps.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="extern"
+ >
+ <File
+ RelativePath="..\..\extern\CSG_BooleanOps.h"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/intern/container/CTR_List.h b/intern/container/CTR_List.h index 7dce265dcb2..8d62daf2139 100644 --- a/intern/container/CTR_List.h +++ b/intern/container/CTR_List.h @@ -26,34 +26,6 @@ * ***** END GPL LICENSE BLOCK ***** */ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - #ifndef CTR_LIST_H #define CTR_LIST_H diff --git a/intern/container/CTR_TaggedIndex.h b/intern/container/CTR_TaggedIndex.h index 7a7bd85e890..68d2536c879 100644 --- a/intern/container/CTR_TaggedIndex.h +++ b/intern/container/CTR_TaggedIndex.h @@ -93,6 +93,16 @@ public: } +#if defined(_WIN64) + CTR_TaggedIndex( + const unsigned __int64 val + ) : + m_val ( ((unsigned __int64)val & index_mask) + | ( (empty_tag << tag_shift) + & (~index_mask) ) ) { + } +#endif + CTR_TaggedIndex( const CTR_TaggedIndex &my_index ): @@ -124,6 +134,12 @@ public: return (long int)(m_val & index_mask); } +#if defined(_WIN64) + operator unsigned __int64 () const { + return (unsigned __int64)(m_val & index_mask); + } +#endif + bool IsEmpty( ) const { diff --git a/intern/container/SConscript b/intern/container/SConscript index 18f078b57f6..d05104da562 100644 --- a/intern/container/SConscript +++ b/intern/container/SConscript @@ -4,4 +4,4 @@ Import ('env') sources = env.Glob('intern/*.cpp') incs = '.' -env.BlenderLib ('bf_CTR', sources, Split(incs) , [], libtype='intern', priority = 10 ) +env.BlenderLib ('blender_CTR', sources, Split(incs) , [], libtype='intern', priority = 10 ) diff --git a/intern/container/make/msvc_9_0/container.vcproj b/intern/container/make/msvc_9_0/container.vcproj new file mode 100644 index 00000000000..2b40571672d --- /dev/null +++ b/intern/container/make/msvc_9_0/container.vcproj @@ -0,0 +1,387 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9,00"
+ Name="INT_container"
+ ProjectGUID="{51A348C1-8684-4D67-B980-97B1FC74159B}"
+ RootNamespace="container"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Blender Release|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\container"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\container"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="2"
+ PreprocessorDefinitions="WIN32,NDEBUG,_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\container\container.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\container\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\container\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\container\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1043"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\libcontainer.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying CTR files library to lib tree"
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\container\include MKDIR ..\..\..\..\..\build\msvc_9\intern\container\include
XCOPY /Y ..\..\*.h ..\..\..\..\..\build\msvc_9\intern\container\include
ECHO Done
"
+ />
+ </Configuration>
+ <Configuration
+ Name="Blender Debug|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\container\debug"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\container\debug"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32,_DEBUG,_LIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ BufferSecurityCheck="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\container\debug\container.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\container\debug\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\container\debug\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\container\debug\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1043"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\debug\libcontainer.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying CTR files library (debug target) to lib tree"
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\container\include MKDIR ..\..\..\..\..\build\msvc_9\intern\container\include
XCOPY /Y ..\..\*.h ..\..\..\..\..\build\msvc_9\intern\container\include
ECHO Done
"
+ />
+ </Configuration>
+ <Configuration
+ Name="3DPlugin Release|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\container\mtdll"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\container\mtdll"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="2"
+ PreprocessorDefinitions="WIN32,NDEBUG,_LIB"
+ StringPooling="true"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\container\mtdll\container.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\container\mtdll\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\container\mtdll\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\container\mtdll\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1043"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\mtdll\libcontainer.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying CTR files library to lib tree"
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\container\include MKDIR ..\..\..\..\..\build\msvc_9\intern\container\include
XCOPY /Y ..\..\*.h ..\..\..\..\..\build\msvc_9\intern\container\include
ECHO Done
"
+ />
+ </Configuration>
+ <Configuration
+ Name="3DPlugin Debug|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\container\mtdll\debug"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\container\mtdll\debug"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32,_DEBUG,_LIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ BufferSecurityCheck="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\container\mtdll\debug\container.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\container\mtdll\debug\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\container\mtdll\debug\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\container\mtdll\debug\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1043"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\mtdll\debug\libcontainer.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying CTR files library (debug target) to lib tree"
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\container\include MKDIR ..\..\..\..\..\build\msvc_9\intern\container\include
XCOPY /Y ..\..\*.h ..\..\..\..\..\build\msvc_9\intern\container\include
ECHO Done
"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="intern"
+ >
+ <File
+ RelativePath="..\..\intern\CTR_List.cpp"
+ >
+ <FileConfiguration
+ Name="Blender Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../extern,../../;$(NoInherit)"
+ CompileAs="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Blender Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../;$(NoInherit)"
+ CompileAs="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="3DPlugin Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../extern,../../;$(NoInherit)"
+ CompileAs="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="3DPlugin Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../;$(NoInherit)"
+ CompileAs="0"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <File
+ RelativePath="..\..\CTR_List.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\CTR_Map.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\CTR_TaggedIndex.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\CTR_TaggedSetOps.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\CTR_UHeap.h"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/intern/decimation/intern/LOD_ManMesh2.cpp b/intern/decimation/intern/LOD_ManMesh2.cpp index eeb497bb09e..2fe49b36583 100644 --- a/intern/decimation/intern/LOD_ManMesh2.cpp +++ b/intern/decimation/intern/LOD_ManMesh2.cpp @@ -477,7 +477,7 @@ DeleteVertex( return; } - LOD_VertexInd last = LOD_VertexInd(verts.end() - verts.begin() - 1); + LOD_VertexInd last = LOD_VertexInd(size_t(verts.end() - verts.begin() - 1)); if (!(last == v)) { @@ -533,7 +533,7 @@ DeleteEdge( return; } - LOD_EdgeInd last = LOD_EdgeInd(edges.end() - edges.begin() - 1); + LOD_EdgeInd last = LOD_EdgeInd(size_t(edges.end() - edges.begin() - 1)); if (!(last == e)) { vector<LOD_EdgeInd> e_verts; @@ -573,7 +573,7 @@ DeleteFace( return; } - LOD_FaceInd last = LOD_FaceInd(faces.end() - faces.begin() - 1); + LOD_FaceInd last = LOD_FaceInd(size_t (faces.end() - faces.begin() - 1)); if (!(last == f)) { diff --git a/intern/decimation/make/msvc_9_0/decimation.vcproj b/intern/decimation/make/msvc_9_0/decimation.vcproj new file mode 100644 index 00000000000..7d58bf1f4c6 --- /dev/null +++ b/intern/decimation/make/msvc_9_0/decimation.vcproj @@ -0,0 +1,423 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9,00"
+ Name="INT_decimation"
+ ProjectGUID="{C66F722C-46BE-40C9-ABAE-2EAC7A697EB8}"
+ RootNamespace="decimation"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Blender Debug|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\decimation\debug"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\decimation\debug"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\..\..\..\build\msvc_9\intern\memutil\include;..\..\..\..\..\build\msvc_9\intern\container\include;..\..\..\..\..\build\msvc_9\intern\moto\include"
+ PreprocessorDefinitions="WIN32,_DEBUG,_LIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ BufferSecurityCheck="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\decimation\debug\decimation.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\decimation\debug\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\decimation\debug\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\decimation\debug\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="3"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1043"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\debug\libdecimation.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying LOD files library (debug target) to lib tree"
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\decimation\include MKDIR ..\..\..\..\..\build\msvc_9\intern\decimation\include
XCOPY /Y ..\..\extern\*.h ..\..\..\..\..\build\msvc_9\intern\decimation\include
ECHO Done
"
+ />
+ </Configuration>
+ <Configuration
+ Name="Blender Release|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\decimation"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\decimation"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="2"
+ AdditionalIncludeDirectories="..\..\..\..\..\build\msvc_9\intern\memutil\include;..\..\..\..\..\build\msvc_9\intern\container\include;..\..\..\..\..\build\msvc_9\intern\moto\include"
+ PreprocessorDefinitions="WIN32,NDEBUG,_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\decimation\decimation.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\decimation\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\decimation\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\decimation\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1043"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\libdecimation.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying LOD files library to lib tree"
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\decimation\include MKDIR ..\..\..\..\..\build\msvc_9\intern\decimation\include
XCOPY /Y ..\..\extern\*.h ..\..\..\..\..\build\msvc_9\intern\decimation\include
ECHO Done
"
+ />
+ </Configuration>
+ <Configuration
+ Name="3DPlugin Release|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\decimation\mtdll"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\decimation\mtdll"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="2"
+ AdditionalIncludeDirectories="..\..\..\..\..\build\msvc_9\intern\memutil\include;..\..\..\..\..\build\msvc_9\intern\container\include;..\..\..\..\..\build\msvc_9\intern\moto\include"
+ PreprocessorDefinitions="WIN32,NDEBUG,_LIB"
+ StringPooling="true"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\decimation\mtdll\decimation.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\decimation\mtdll\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\decimation\mtdll\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\decimation\mtdll\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1043"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\mtdll\libdecimation.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying LOD files library to lib tree"
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\decimation\include MKDIR ..\..\..\..\..\build\msvc_9\intern\decimation\include
XCOPY /Y ..\..\extern\*.h ..\..\..\..\..\build\msvc_9\intern\decimation\include
ECHO Done
"
+ />
+ </Configuration>
+ <Configuration
+ Name="3DPlugin Debug|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\decimation\mtdll\debug"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\decimation\mtdll\debug"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\..\..\..\build\msvc_9\intern\memutil\include;..\..\..\..\..\build\msvc_9\intern\container\include;..\..\..\..\..\build\msvc_9\intern\moto\include"
+ PreprocessorDefinitions="WIN32,_DEBUG,_LIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ BufferSecurityCheck="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\decimation\mtdll\debug\decimation.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\decimation\mtdll\debug\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\decimation\mtdll\debug\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\decimation\mtdll\debug\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="3"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1043"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\mtdll\debug\libdecimation.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying LOD files library (debug target) to lib tree"
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\decimation\include MKDIR ..\..\..\..\..\build\msvc_9\intern\decimation\include
XCOPY /Y ..\..\extern\*.h ..\..\..\..\..\build\msvc_9\intern\decimation\include
ECHO Done
"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="intern"
+ >
+ <File
+ RelativePath="..\..\intern\LOD_decimation.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\LOD_DecimationClass.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\LOD_EdgeCollapser.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\LOD_EdgeCollapser.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\LOD_ExternBufferEditor.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\LOD_ExternNormalEditor.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\LOD_ExternNormalEditor.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\LOD_FaceNormalEditor.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\LOD_FaceNormalEditor.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\LOD_ManMesh2.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\LOD_ManMesh2.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\LOD_MeshBounds.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\LOD_MeshException.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\LOD_MeshPrimitives.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\LOD_MeshPrimitives.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\LOD_QSDecimator.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\LOD_QSDecimator.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\LOD_Quadric.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\LOD_QuadricEditor.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\LOD_QuadricEditor.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="extern"
+ >
+ <File
+ RelativePath="..\..\extern\LOD_decimation.h"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/intern/elbeem/CMakeLists.txt b/intern/elbeem/CMakeLists.txt index 1c1a870049c..03fd4a3fefc 100644 --- a/intern/elbeem/CMakeLists.txt +++ b/intern/elbeem/CMakeLists.txt @@ -24,7 +24,7 @@ # # ***** END GPL LICENSE BLOCK ***** -SET(INC ${PNG_INC} ${ZLIB_INC} ${SDL_INC}) +SET(INC ${PNG_INC} ${ZLIB_INC} ${SDL_INC} extern) FILE(GLOB SRC intern/*.cpp) @@ -33,5 +33,9 @@ IF(WINDOWS) ADD_DEFINITIONS(-DUSE_MSVC6FIXES) ENDIF(WINDOWS) +IF(WITH_OPENMP) + ADD_DEFINITIONS(-DPARALLEL=1) +ENDIF(WITH_OPENMP) + BLENDERLIB_NOLIST(bf_elbeem "${SRC}" "${INC}") #, libtype='blender', priority=0 ) diff --git a/intern/elbeem/SConscript b/intern/elbeem/SConscript index 0c0365d0311..dc8d84ef5a0 100644 --- a/intern/elbeem/SConscript +++ b/intern/elbeem/SConscript @@ -6,8 +6,13 @@ Import('env') sources = env.Glob('intern/*.cpp') defs = 'NOGUI ELBEEM_BLENDER=1' + +if env['WITH_BF_OPENMP']: + defs += ' PARALLEL' + if env['OURPLATFORM']=='win32-vc': - defs += ' USE_MSVC6FIXES' -incs = env['BF_PNG_INC'] + ' ' + env['BF_ZLIB_INC'] + ' ' +env['BF_SDL_INC'] + defs += ' USE_MSVC6FIXES' +incs = env['BF_PNG_INC'] + ' ' + env['BF_ZLIB_INC'] +incs += ' extern ' env.BlenderLib ('bf_elbeem', sources, Split(incs), Split(defs), libtype='blender', priority=0 ) diff --git a/intern/elbeem/extern/LBM_fluidsim.h b/intern/elbeem/extern/LBM_fluidsim.h index 6e7fc86213c..dd8c63d0d39 100644 --- a/intern/elbeem/extern/LBM_fluidsim.h +++ b/intern/elbeem/extern/LBM_fluidsim.h @@ -63,11 +63,6 @@ void loadFluidsimMesh(struct Object *srcob, int useRenderParams); // WARNING - implemented in intern/elbeem/blendercall.cpp int performElbeemSimulation(char *cfgfilename); -/* init axis aligned BB for mesh object */ -// implemented in source/blender/blenkernel/intern/DerivedMesh.c -void fluidsimGetAxisAlignedBB(struct Mesh *mesh, float obmat[][4], - /*RET*/ float start[3], /*RET*/ float size[3], /*RET*/ struct Mesh **bbmesh ); - #endif diff --git a/intern/elbeem/extern/elbeem.h b/intern/elbeem/extern/elbeem.h index 2a594dd07e6..e29890aba44 100644 --- a/intern/elbeem/extern/elbeem.h +++ b/intern/elbeem/extern/elbeem.h @@ -32,7 +32,7 @@ typedef struct elbeemSimulationSettings { short version; /* id number of simulation domain, needed if more than a * single domain should be simulated */ - short domainId; + short domainId; // unused within blender /* geometrical extent */ float geoStart[3], geoSize[3]; @@ -97,10 +97,13 @@ typedef struct elbeemSimulationSettings { // defines for elbeemMesh->type below +/* please keep in sync with DNA_object_fluidsim.h */ #define OB_FLUIDSIM_FLUID 4 #define OB_FLUIDSIM_OBSTACLE 8 #define OB_FLUIDSIM_INFLOW 16 #define OB_FLUIDSIM_OUTFLOW 32 +#define OB_FLUIDSIM_PARTICLE 64 +#define OB_FLUIDSIM_CONTROL 128 // defines for elbeemMesh->obstacleType below #define FLUIDSIM_OBSTACLE_NOSLIP 1 @@ -113,7 +116,7 @@ typedef struct elbeemSimulationSettings { // a single mesh object typedef struct elbeemMesh { - /* obstacle,fluid or inflow... */ + /* obstacle,fluid or inflow or control ... */ short type; /* id of simulation domain it belongs to */ short parentDomainId; @@ -155,6 +158,20 @@ typedef struct elbeemMesh { /* name of the mesh, mostly for debugging */ const char *name; + + /* fluid control settings */ + float cpsTimeStart; + float cpsTimeEnd; + float cpsQuality; + + int channelSizeAttractforceStrength; + float *channelAttractforceStrength; + int channelSizeAttractforceRadius; + float *channelAttractforceRadius; + int channelSizeVelocityforceStrength; + float *channelVelocityforceStrength; + int channelSizeVelocityforceRadius; + float *channelVelocityforceRadius; } elbeemMesh; // API functions @@ -170,6 +187,9 @@ void elbeemResetSettings(struct elbeemSimulationSettings*); // start fluidsim init (returns !=0 upon failure) int elbeemInit(void); +// frees fluidsim +int elbeemFree(void); + // start fluidsim init (returns !=0 upon failure) int elbeemAddDomain(struct elbeemSimulationSettings*); @@ -223,6 +243,7 @@ double elbeemEstimateMemreq(int res, // structs, for these use OB_xxx defines above /*! fluid geometry init types */ +// type "int" used, so max is 8 #define FGI_FLAGSTART 16 #define FGI_FLUID (1<<(FGI_FLAGSTART+ 0)) #define FGI_NO_FLUID (1<<(FGI_FLAGSTART+ 1)) @@ -232,6 +253,7 @@ double elbeemEstimateMemreq(int res, #define FGI_NO_BND (1<<(FGI_FLAGSTART+ 5)) #define FGI_MBNDINFLOW (1<<(FGI_FLAGSTART+ 6)) #define FGI_MBNDOUTFLOW (1<<(FGI_FLAGSTART+ 7)) +#define FGI_CONTROL (1<<(FGI_FLAGSTART+ 8)) // all boundary types at once #define FGI_ALLBOUNDS ( FGI_BNDNO | FGI_BNDFREE | FGI_BNDPART | FGI_MBNDINFLOW | FGI_MBNDOUTFLOW ) diff --git a/intern/elbeem/intern/Makefile b/intern/elbeem/intern/Makefile index c03b8678186..ec92a5dd5a8 100644 --- a/intern/elbeem/intern/Makefile +++ b/intern/elbeem/intern/Makefile @@ -37,6 +37,10 @@ unexport NAN_QUIET CCFLAGS += $(LEVEL_2_CPP_WARNINGS) +ifeq ($(WITH_BF_OPENMP),true) + CPPFLAGS += -DPARALLEL +endif + CPPFLAGS += -DNOGUI -DELBEEM_BLENDER CPPFLAGS += -I. CPPFLAGS += -I../extern diff --git a/intern/elbeem/intern/controlparticles.cpp b/intern/elbeem/intern/controlparticles.cpp new file mode 100644 index 00000000000..4b496e4a3a2 --- /dev/null +++ b/intern/elbeem/intern/controlparticles.cpp @@ -0,0 +1,1461 @@ +// -------------------------------------------------------------------------- +// +// El'Beem - the visual lattice boltzmann freesurface simulator +// All code distributed as part of El'Beem is covered by the version 2 of the +// GNU General Public License. See the file COPYING for details. +// +// Copyright 2008 Nils Thuerey , Richard Keiser, Mark Pauly, Ulrich Ruede +// +// implementation of control particle handling +// +// -------------------------------------------------------------------------- + +// indicator for LBM inclusion +#include "ntl_geometrymodel.h" +#include "ntl_world.h" +#include "solver_class.h" +#include "controlparticles.h" +#include "mvmcoords.h" +#include <zlib.h> + +#ifndef sqrtf +#define sqrtf sqrt +#endif + +// brute force circle test init in initTimeArray +// replaced by mDebugInit +//#define CP_FORCECIRCLEINIT 0 + + +void ControlParticles::initBlenderTest() { + mPartSets.clear(); + + ControlParticleSet cps; + mPartSets.push_back(cps); + int setCnt = mPartSets.size()-1; + ControlParticle p; + + // set for time zero + mPartSets[setCnt].time = 0.; + + // add single particle + p.reset(); + p.pos = LbmVec(0.5, 0.5, -0.5); + mPartSets[setCnt].particles.push_back(p); + + // add second set for animation + mPartSets.push_back(cps); + setCnt = mPartSets.size()-1; + mPartSets[setCnt].time = 0.15; + + // insert new position + p.reset(); + p.pos = LbmVec(-0.5, -0.5, 0.5); + mPartSets[setCnt].particles.push_back(p); + + // applyTrafos(); + initTime(0. , 1.); +} + +// blender control object gets converted to mvm flui control object +int ControlParticles::initFromObject(ntlGeometryObjModel *model) { + vector<ntlTriangle> triangles; + vector<ntlVec3Gfx> vertices; + vector<ntlVec3Gfx> normals; + + /* + model->loadBobjModel(string(infile)); + + model->setLoaded(true); + + model->setGeoInitId(gid); + + + printf("a animated? %d\n", model->getIsAnimated()); + printf("b animated? %d\n", model->getMeshAnimated()); + */ + + model->setGeoInitType(FGI_FLUID); + + model->getTriangles(mCPSTimeStart, &triangles, &vertices, &normals, 1 ); + // model->applyTransformation(mCPSTimeStart, &vertices, &normals, 0, vertices.size(), true); + + // valid mesh? + if(triangles.size() <= 0) { + return 0; + } + + ntlRenderGlobals *glob = new ntlRenderGlobals; + ntlScene *genscene = new ntlScene( glob, false ); + genscene->addGeoClass(model); + genscene->addGeoObject(model); + genscene->buildScene(0., false); + char treeFlag = (1<<(4+model->getGeoInitId())); + + ntlTree *tree = new ntlTree( + 15, 8, // TREEwarning - fixed values for depth & maxtriangles here... + genscene, treeFlag ); + + // TODO? use params + ntlVec3Gfx start,end; + model->getExtends(start,end); + /* + printf("start - x: %f, y: %f, z: %f\n", start[0], start[1], start[2]); + printf("end - x: %f, y: %f, z: %f\n", end[0], end[1], end[2]); + printf("mCPSWidth: %f\n"); +*/ + LbmFloat width = mCPSWidth; + if(width<=LBM_EPSILON) { errMsg("ControlParticles::initFromMVMCMesh","Invalid mCPSWidth! "<<mCPSWidth); width=mCPSWidth=0.1; } + ntlVec3Gfx org = start+ntlVec3Gfx(width*0.5); + gfxReal distance = -1.; + vector<ntlVec3Gfx> inspos; + + // printf("distance: %f, width: %f\n", distance, width); + + while(org[2]<end[2]) { + while(org[1]<end[1]) { + while(org[0]<end[0]) { + if(checkPointInside(tree, org, distance)) { + inspos.push_back(org); + } + // TODO optimize, use distance + org[0] += width; + } + org[1] += width; + org[0] = start[0]; + } + org[2] += width; + org[1] = start[1]; + } + + // printf("inspos.size(): %d\n", inspos.size()); + + MeanValueMeshCoords mvm; + mvm.calculateMVMCs(vertices,triangles, inspos, mCPSWeightFac); + vector<ntlVec3Gfx> ninspos; + mvm.transfer(vertices, ninspos); + + // init first set, check dist + ControlParticleSet firstcps; //T + mPartSets.push_back(firstcps); + mPartSets[mPartSets.size()-1].time = mCPSTimeStart; + vector<bool> useCP; + + for(int i=0; i<(int)inspos.size(); i++) { + ControlParticle p; p.reset(); + p.pos = vec2L(inspos[i]); + + bool usecpv = true; + + mPartSets[mPartSets.size()-1].particles.push_back(p); + useCP.push_back(usecpv); + } + + // init further sets, temporal mesh sampling + double tsampling = mCPSTimestep; + // printf("tsampling: %f, ninspos.size(): %d, mCPSTimeEnd: %f\n", tsampling, ninspos.size(), mCPSTimeEnd); + + int tcnt=0; + for(double t=mCPSTimeStart+tsampling; ((t<mCPSTimeEnd) && (ninspos.size()>0.)); t+=tsampling) { + ControlParticleSet nextcps; //T + mPartSets.push_back(nextcps); + mPartSets[mPartSets.size()-1].time = (gfxReal)t; + + vertices.clear(); triangles.clear(); normals.clear(); + model->getTriangles(t, &triangles, &vertices, &normals, 1 ); + mvm.transfer(vertices, ninspos); + + tcnt++; + for(size_t i=0; i < ninspos.size(); i++) { + + if(useCP[i]) { + ControlParticle p; p.reset(); + p.pos = vec2L(ninspos[i]); + mPartSets[mPartSets.size()-1].particles.push_back(p); + } + } + } + + model->setGeoInitType(FGI_CONTROL); + + delete tree; + delete genscene; + delete glob; + + // do reverse here + if(model->getGeoPartSlipValue()) + { + mirrorTime(); + } + + return 1; +} + + +// init all zero / defaults for a single particle +void ControlParticle::reset() { + pos = LbmVec(0.,0.,0.); + vel = LbmVec(0.,0.,0.); + influence = 1.; + size = 1.; +#ifndef LBMDIM +#ifdef MAIN_2D + rotaxis = LbmVec(0.,1.,0.); // SPH xz +#else // MAIN_2D + // 3d - roate in xy plane, vortex + rotaxis = LbmVec(0.,0.,1.); + // 3d - rotate for wave + //rotaxis = LbmVec(0.,1.,0.); +#endif // MAIN_2D +#else // LBMDIM + rotaxis = LbmVec(0.,1.,0.); // LBM xy , is swapped afterwards +#endif // LBMDIM + + density = 0.; + densityWeight = 0.; + avgVelAcc = avgVel = LbmVec(0.); + avgVelWeight = 0.; +} + + +// default preset/empty init +ControlParticles::ControlParticles() : + _influenceTangential(0.f), + _influenceAttraction(0.f), + _influenceVelocity(0.f), + _influenceMaxdist(0.f), + _radiusAtt(1.0f), + _radiusVel(1.0f), + _radiusMinMaxd(2.0f), + _radiusMaxd(3.0f), + _currTime(-1.0), _currTimestep(1.), + _initTimeScale(1.), + _initPartOffset(0.), _initPartScale(1.), + _initLastPartOffset(0.), _initLastPartScale(1.), + _initMirror(""), + _fluidSpacing(1.), _kernelWeight(-1.), + _charLength(1.), _charLengthInv(1.), + mvCPSStart(-10000.), mvCPSEnd(10000.), + mCPSWidth(0.1), mCPSTimestep(0.02), // was 0.05 + mCPSTimeStart(0.), mCPSTimeEnd(0.5), mCPSWeightFac(1.), + mDebugInit(0) +{ + _radiusAtt = 0.15f; + _radiusVel = 0.15f; + _radiusMinMaxd = 0.16f; + _radiusMaxd = 0.3; + + _influenceAttraction = 0.f; + _influenceTangential = 0.f; + _influenceVelocity = 0.f; + // 3d tests */ +} + + + +ControlParticles::~ControlParticles() { + // nothing to do... +} + +LbmFloat ControlParticles::getControlTimStart() { + if(mPartSets.size()>0) { return mPartSets[0].time; } + return -1000.; +} +LbmFloat ControlParticles::getControlTimEnd() { + if(mPartSets.size()>0) { return mPartSets[mPartSets.size()-1].time; } + return -1000.; +} + +// calculate for delta t +void ControlParticles::setInfluenceVelocity(LbmFloat set, LbmFloat dt) { + const LbmFloat dtInter = 0.01; + LbmFloat facFv = 1.-set; //cparts->getInfluenceVelocity(); + // mLevel[mMaxRefine].timestep + LbmFloat facNv = (LbmFloat)( 1.-pow( (double)facFv, (double)(dt/dtInter)) ); + //errMsg("vwcalc","ts:"<<dt<< " its:"<<(dt/dtInter) <<" fv"<<facFv<<" nv"<<facNv<<" test:"<< pow( (double)(1.-facNv),(double)(dtInter/dt)) ); + _influenceVelocity = facNv; +} + +int ControlParticles::initExampleSet() +{ + // unused + return 0; +} + +int ControlParticles::getTotalSize() +{ + int s=0; + for(int i=0; i<(int)mPartSets.size(); i++) { + s+= mPartSets[i].particles.size(); + } + return s; +} + +// -------------------------------------------------------------------------- +// load positions & timing from text file +// WARNING - make sure file has unix format, no win/dos linefeeds... +#define LINE_LEN 100 +int ControlParticles::initFromTextFile(string filename) +{ + /* + const bool debugRead = false; + char line[LINE_LEN]; + line[LINE_LEN-1] = '\0'; + mPartSets.clear(); + if(filename.size()<2) return 0; + + // HACK , use "cparts" suffix as old + // e.g. "cpart2" as new + if(filename[ filename.size()-1 ]=='s') { + return initFromTextFileOld(filename); + } + + FILE *infile = fopen(filename.c_str(), "r"); + if(!infile) { + errMsg("ControlParticles::initFromTextFile","unable to open '"<<filename<<"' " ); + // try to open as gz sequence + if(initFromBinaryFile(filename)) { return 1; } + // try mesh MVCM generation + if(initFromMVCMesh(filename)) { return 1; } + // failed... + return 0; + } + + int haveNo = false; + int haveScale = false; + int haveTime = false; + int noParts = -1; + int partCnt = 0; + int setCnt = 0; + //ControlParticle p; p.reset(); + // scale times by constant factor while reading + LbmFloat timeScale= 1.0; + int lineCnt = 0; + bool abortParse = false; +#define LASTCP mPartSets[setCnt].particles[ mPartSets[setCnt].particles.size()-1 ] + + while( (!feof(infile)) && (!abortParse)) { + lineCnt++; + fgets(line, LINE_LEN, infile); + + //if(debugRead) printf("\nDEBUG%d r '%s'\n",lineCnt, line); + if(!line) continue; + size_t len = strlen(line); + + // skip empty lines and comments (#,//) + if(len<1) continue; + if( (line[0]=='#') || (line[0]=='\n') ) continue; + if((len>1) && (line[0]=='/' && line[1]=='/')) continue; + + // debug remove newline + if((len>=1)&&(line[len-1]=='\n')) line[len-1]='\0'; + + switch(line[0]) { + + case 'N': { // total number of particles, more for debugging... + noParts = atoi(line+2); + if(noParts<=0) { + errMsg("ControlParticles::initFromTextFile","file '"<<filename<<"' - invalid no of particles "<<noParts); + mPartSets.clear(); fclose(infile); return 0; + } + if(debugRead) printf("CPDEBUG%d no parts '%d'\n",lineCnt, noParts ); + haveNo = true; + } break; + + case 'T': { // global time scale + timeScale *= (LbmFloat)atof(line+2); + if(debugRead) printf("ControlParticles::initFromTextFile - line %d , set timescale '%f', org %f\n",lineCnt, timeScale , _initTimeScale); + if(timeScale==0.) { fprintf(stdout,"ControlParticles::initFromTextFile - line %d ,error: timescale = 0.! reseting to 1 ...\n",lineCnt); timeScale=1.; } + haveScale = true; + } break; + + case 'I': { // influence settings, overrides others as of now... + float val = (LbmFloat)atof(line+3); + const char *setvar = "[invalid]"; + switch(line[1]) { + //case 'f': { _influenceFalloff = val; setvar = "falloff"; } break; + case 't': { _influenceTangential = val; setvar = "tangential"; } break; + case 'a': { _influenceAttraction = val; setvar = "attraction"; } break; + case 'v': { _influenceVelocity = val; setvar = "velocity"; } break; + case 'm': { _influenceMaxdist = val; setvar = "maxdist"; } break; + default: + fprintf(stdout,"ControlParticles::initFromTextFile (%s) - line %d , invalid influence setting %c, %f\n",filename.c_str() ,lineCnt, line[1], val); + } + if(debugRead) printf("CPDEBUG%d set influence '%s'=%f \n",lineCnt, setvar, val); + } break; + + case 'R': { // radius settings, overrides others as of now... + float val = (LbmFloat)atof(line+3); + const char *setvar = "[invalid]"; + switch(line[1]) { + case 'a': { _radiusAtt = val; setvar = "r_attraction"; } break; + case 'v': { _radiusVel = val; setvar = "r_velocity"; } break; + case 'm': { _radiusMaxd = val; setvar = "r_maxdist"; } break; + default: + fprintf(stdout,"ControlParticles::initFromTextFile (%s) - line %d , invalid influence setting %c, %f\n",filename.c_str() ,lineCnt, line[1], val); + } + if(debugRead) printf("CPDEBUG%d set influence '%s'=%f \n",lineCnt, setvar, val); + } break; + + case 'S': { // new particle set at time T + ControlParticleSet cps; + mPartSets.push_back(cps); + setCnt = (int)mPartSets.size()-1; + + LbmFloat val = (LbmFloat)atof(line+2); + mPartSets[setCnt].time = val * timeScale; + if(debugRead) printf("CPDEBUG%d new set, time '%f', %d\n",lineCnt, mPartSets[setCnt].time, setCnt ); + haveTime = true; + partCnt = -1; + } break; + + case 'P': // new particle with pos + case 'n': { // new particle without pos + if((!haveTime)||(setCnt<0)) { fprintf(stdout,"ControlParticles::initFromTextFile - line %d ,error: set missing!\n",lineCnt); abortParse=true; break; } + partCnt++; + if(partCnt>=noParts) { + if(debugRead) printf("CPDEBUG%d partset done \n",lineCnt); + haveTime = false; + } else { + ControlParticle p; p.reset(); + mPartSets[setCnt].particles.push_back(p); + } + } + // only new part, or new with pos? + if(line[0] == 'n') break; + + // particle properties + + case 'p': { // new particle set at time T + if((!haveTime)||(setCnt<0)||(mPartSets[setCnt].particles.size()<1)) { fprintf(stdout,"ControlParticles::initFromTextFile - line %d ,error|p: particle missing!\n",lineCnt); abortParse=true; break; } + float px=0.,py=0.,pz=0.; + if( sscanf(line+2,"%f %f %f",&px,&py,&pz) != 3) { + fprintf(stdout,"CPDEBUG%d, unable to parse position!\n",lineCnt); abortParse=true; break; + } + if(!(finite(px)&&finite(py)&&finite(pz))) { px=py=pz=0.; } + LASTCP.pos[0] = px; + LASTCP.pos[1] = py; + LASTCP.pos[2] = pz; + if(debugRead) printf("CPDEBUG%d part%d,%d: position %f,%f,%f \n",lineCnt,setCnt,partCnt, px,py,pz); + } break; + + case 's': { // particle size + if((!haveTime)||(setCnt<0)||(mPartSets[setCnt].particles.size()<1)) { fprintf(stdout,"ControlParticles::initFromTextFile - line %d ,error|s: particle missing!\n",lineCnt); abortParse=true; break; } + float ps=1.; + if( sscanf(line+2,"%f",&ps) != 1) { + fprintf(stdout,"CPDEBUG%d, unable to parse size!\n",lineCnt); abortParse=true; break; + } + if(!(finite(ps))) { ps=0.; } + LASTCP.size = ps; + if(debugRead) printf("CPDEBUG%d part%d,%d: size %f \n",lineCnt,setCnt,partCnt, ps); + } break; + + case 'i': { // particle influence + if((!haveTime)||(setCnt<0)||(mPartSets[setCnt].particles.size()<1)) { fprintf(stdout,"ControlParticles::initFromTextFile - line %d ,error|i: particle missing!\n",lineCnt); abortParse=true; break; } + float pinf=1.; + if( sscanf(line+2,"%f",&pinf) != 1) { + fprintf(stdout,"CPDEBUG%d, unable to parse size!\n",lineCnt); abortParse=true; break; + } + if(!(finite(pinf))) { pinf=0.; } + LASTCP.influence = pinf; + if(debugRead) printf("CPDEBUG%d part%d,%d: influence %f \n",lineCnt,setCnt,partCnt, pinf); + } break; + + case 'a': { // rotation axis + if((!haveTime)||(setCnt<0)||(mPartSets[setCnt].particles.size()<1)) { fprintf(stdout,"ControlParticles::initFromTextFile - line %d ,error|a: particle missing!\n",lineCnt); abortParse=true; break; } + float px=0.,py=0.,pz=0.; + if( sscanf(line+2,"%f %f %f",&px,&py,&pz) != 3) { + fprintf(stdout,"CPDEBUG%d, unable to parse rotaxis!\n",lineCnt); abortParse=true; break; + } + if(!(finite(px)&&finite(py)&&finite(pz))) { px=py=pz=0.; } + LASTCP.rotaxis[0] = px; + LASTCP.rotaxis[1] = py; + LASTCP.rotaxis[2] = pz; + if(debugRead) printf("CPDEBUG%d part%d,%d: rotaxis %f,%f,%f \n",lineCnt,setCnt,partCnt, px,py,pz); + } break; + + + default: + if(debugRead) printf("CPDEBUG%d ignored: '%s'\n",lineCnt, line ); + break; + } + } + if(debugRead && abortParse) printf("CPDEBUG aborted parsing after set... %d\n",(int)mPartSets.size() ); + + // sanity check + for(int i=0; i<(int)mPartSets.size(); i++) { + if( (int)mPartSets[i].particles.size()!=noParts) { + fprintf(stdout,"ControlParticles::initFromTextFile (%s) - invalid no of particles in set %d, is:%d, shouldbe:%d \n",filename.c_str() ,i,(int)mPartSets[i].particles.size(), noParts); + mPartSets.clear(); + fclose(infile); + return 0; + } + } + + // print stats + printf("ControlParticles::initFromTextFile (%s): Read %d sets, each %d particles\n",filename.c_str() , + (int)mPartSets.size(), noParts ); + if(mPartSets.size()>0) { + printf("ControlParticles::initFromTextFile (%s): Time: %f,%f\n",filename.c_str() ,mPartSets[0].time, mPartSets[mPartSets.size()-1].time ); + } + + // done... + fclose(infile); + applyTrafos(); + */ + return 1; +} + + +int ControlParticles::initFromTextFileOld(string filename) +{ + /* + const bool debugRead = false; + char line[LINE_LEN]; + line[LINE_LEN-1] = '\0'; + mPartSets.clear(); + if(filename.size()<1) return 0; + + FILE *infile = fopen(filename.c_str(), "r"); + if(!infile) { + fprintf(stdout,"ControlParticles::initFromTextFileOld - unable to open '%s'\n",filename.c_str() ); + return 0; + } + + int haveNo = false; + int haveScale = false; + int haveTime = false; + int noParts = -1; + int coordCnt = 0; + int partCnt = 0; + int setCnt = 0; + ControlParticle p; p.reset(); + // scale times by constant factor while reading + LbmFloat timeScale= 1.0; + int lineCnt = 0; + + while(!feof(infile)) { + lineCnt++; + fgets(line, LINE_LEN, infile); + + if(debugRead) printf("\nDEBUG%d r '%s'\n",lineCnt, line); + + if(!line) continue; + size_t len = strlen(line); + + // skip empty lines and comments (#,//) + if(len<1) continue; + if( (line[0]=='#') || (line[0]=='\n') ) continue; + if((len>1) && (line[0]=='/' && line[1]=='/')) continue; + + // debug remove newline + if((len>=1)&&(line[len-1]=='\n')) line[len-1]='\0'; + + // first read no. of particles + if(!haveNo) { + noParts = atoi(line); + if(noParts<=0) { + fprintf(stdout,"ControlParticles::initFromTextFileOld - invalid no of particles %d\n",noParts); + mPartSets.clear(); + fclose(infile); + return 0; + } + if(debugRead) printf("DEBUG%d noparts '%d'\n",lineCnt, noParts ); + haveNo = true; + } + + // then read time scale + else if(!haveScale) { + timeScale *= (LbmFloat)atof(line); + if(debugRead) printf("DEBUG%d tsc '%f', org %f\n",lineCnt, timeScale , _initTimeScale); + haveScale = true; + } + + // then get set time + else if(!haveTime) { + ControlParticleSet cps; + mPartSets.push_back(cps); + setCnt = (int)mPartSets.size()-1; + + LbmFloat val = (LbmFloat)atof(line); + mPartSets[setCnt].time = val * timeScale; + if(debugRead) printf("DEBUG%d time '%f', %d\n",lineCnt, mPartSets[setCnt].time, setCnt ); + haveTime = true; + } + + // default read all parts + else { + LbmFloat val = (LbmFloat)atof(line); + if(debugRead) printf("DEBUG: l%d s%d,particle%d '%f' %d,%d/%d\n",lineCnt,(int)mPartSets.size(),(int)mPartSets[setCnt].particles.size(), val ,coordCnt,partCnt,noParts); + p.pos[coordCnt] = val; + coordCnt++; + if(coordCnt>=3) { + mPartSets[setCnt].particles.push_back(p); + p.reset(); + coordCnt=0; + partCnt++; + } + if(partCnt>=noParts) { + partCnt = 0; + haveTime = false; + } + //if(debugRead) printf("DEBUG%d par2 %d,%d/%d\n",lineCnt, coordCnt,partCnt,noParts); + } + //read pos, vel ... + } + + // sanity check + for(int i=0; i<(int)mPartSets.size(); i++) { + if( (int)mPartSets[i].particles.size()!=noParts) { + fprintf(stdout,"ControlParticles::initFromTextFileOld - invalid no of particles in set %d, is:%d, shouldbe:%d \n",i,(int)mPartSets[i].particles.size(), noParts); + mPartSets.clear(); + fclose(infile); + return 0; + } + } + // print stats + printf("ControlParticles::initFromTextFileOld: Read %d sets, each %d particles\n", + (int)mPartSets.size(), noParts ); + if(mPartSets.size()>0) { + printf("ControlParticles::initFromTextFileOld: Time: %f,%f\n",mPartSets[0].time, mPartSets[mPartSets.size()-1].time ); + } + + // done... + fclose(infile); + applyTrafos(); + */ + return 1; +} + +// load positions & timing from gzipped binary file +int ControlParticles::initFromBinaryFile(string filename) { + mPartSets.clear(); + if(filename.size()<1) return 0; + int fileNotFound=0; + int fileFound=0; + char ofile[256]; + + for(int set=0; ((set<10000)&&(fileNotFound<10)); set++) { + snprintf(ofile,256,"%s%04d.gz",filename.c_str(),set); + //errMsg("ControlParticle::initFromBinaryFile","set"<<set<<" notf"<<fileNotFound<<" ff"<<fileFound); + + gzFile gzf; + gzf = gzopen(ofile, "rb"); + if (!gzf) { + //errMsg("ControlParticles::initFromBinaryFile","Unable to open file for reading '"<<ofile<<"' "); + fileNotFound++; + continue; + } + fileNotFound=0; + fileFound++; + + ControlParticleSet cps; + mPartSets.push_back(cps); + int setCnt = (int)mPartSets.size()-1; + //LbmFloat val = (LbmFloat)atof(line+2); + mPartSets[setCnt].time = (gfxReal)set; + + int totpart = 0; + gzread(gzf, &totpart, sizeof(totpart)); + + for(int a=0; a<totpart; a++) { + int ptype=0; + float psize=0.0; + ntlVec3Gfx ppos,pvel; + gzread(gzf, &ptype, sizeof( ptype )); + gzread(gzf, &psize, sizeof( float )); + + for(int j=0; j<3; j++) { gzread(gzf, &ppos[j], sizeof( float )); } + for(int j=0; j<3; j++) { gzread(gzf, &pvel[j], sizeof( float )); } + + ControlParticle p; + p.reset(); + p.pos = vec2L(ppos); + mPartSets[setCnt].particles.push_back(p); + } + + gzclose(gzf); + //errMsg("ControlParticle::initFromBinaryFile","Read set "<<ofile<<", #"<<mPartSets[setCnt].particles.size() ); // DEBUG + } // sets + + if(fileFound==0) return 0; + applyTrafos(); + return 1; +} + +int globCPIProblems =0; +bool ControlParticles::checkPointInside(ntlTree *tree, ntlVec3Gfx org, gfxReal &distance) { + // warning - stripped down version of geoInitCheckPointInside + const int globGeoInitDebug = 0; + const int flags = FGI_FLUID; + org += ntlVec3Gfx(0.0001); + ntlVec3Gfx dir = ntlVec3Gfx(1.0, 0.0, 0.0); + int OId = -1; + ntlRay ray(org, dir, 0, 1.0, NULL); + bool done = false; + bool inside = false; + int mGiObjInside = 0; + LbmFloat mGiObjDistance = -1.0; + LbmFloat giObjFirstHistSide = 0; + + // if not inside, return distance to first hit + gfxReal firstHit=-1.0; + int firstOId = -1; + if(globGeoInitDebug) errMsg("IIIstart"," isect "<<org); + + while(!done) { + // find first inside intersection + ntlTriangle *triIns = NULL; + distance = -1.0; + ntlVec3Gfx normal(0.0); + tree->intersectX(ray,distance,normal, triIns, flags, true); + if(triIns) { + ntlVec3Gfx norg = ray.getOrigin() + ray.getDirection()*distance; + LbmFloat orientation = dot(normal, dir); + OId = triIns->getObjectId(); + if(orientation<=0.0) { + // outside hit + normal *= -1.0; + mGiObjInside++; + if(giObjFirstHistSide==0) giObjFirstHistSide = 1; + if(globGeoInitDebug) errMsg("IIO"," oid:"<<OId<<" org"<<org<<" norg"<<norg<<" orient:"<<orientation); + } else { + // inside hit + mGiObjInside++; + if(mGiObjDistance<0.0) mGiObjDistance = distance; + if(globGeoInitDebug) errMsg("III"," oid:"<<OId<<" org"<<org<<" norg"<<norg<<" orient:"<<orientation); + if(giObjFirstHistSide==0) giObjFirstHistSide = -1; + } + norg += normal * getVecEpsilon(); + ray = ntlRay(norg, dir, 0, 1.0, NULL); + // remember first hit distance, in case we're not + // inside anything + if(firstHit<0.0) { + firstHit = distance; + firstOId = OId; + } + } else { + // no more intersections... return false + done = true; + } + } + + distance = -1.0; + if(mGiObjInside>0) { + bool mess = false; + if((mGiObjInside%2)==1) { + if(giObjFirstHistSide != -1) mess=true; + } else { + if(giObjFirstHistSide != 1) mess=true; + } + if(mess) { + // ? + //errMsg("IIIproblem","At "<<org<<" obj inside:"<<mGiObjInside<<" firstside:"<<giObjFirstHistSide ); + globCPIProblems++; + mGiObjInside++; // believe first hit side... + } + } + + if(globGeoInitDebug) errMsg("CHIII"," ins="<<mGiObjInside<<" t"<<mGiObjDistance<<" d"<<distance); + if(((mGiObjInside%2)==1)&&(mGiObjDistance>0.0)) { + if( (distance<0.0) || // first intersection -> good + ((distance>0.0)&&(distance>mGiObjDistance)) // more than one intersection -> use closest one + ) { + distance = mGiObjDistance; + OId = 0; + inside = true; + } + } + + if(!inside) { + distance = firstHit; + OId = firstOId; + } + if(globGeoInitDebug) errMsg("CHIII","ins"<<inside<<" fh"<<firstHit<<" fo"<<firstOId<<" - h"<<distance<<" o"<<OId); + + return inside; +} +int ControlParticles::initFromMVCMesh(string filename) { + myTime_t mvmstart = getTime(); + ntlGeometryObjModel *model = new ntlGeometryObjModel(); + int gid=1; + char infile[256]; + vector<ntlTriangle> triangles; + vector<ntlVec3Gfx> vertices; + vector<ntlVec3Gfx> normals; + snprintf(infile,256,"%s.bobj.gz", filename.c_str() ); + model->loadBobjModel(string(infile)); + model->setLoaded(true); + model->setGeoInitId(gid); + model->setGeoInitType(FGI_FLUID); + debMsgStd("ControlParticles::initFromMVMCMesh",DM_MSG,"infile:"<<string(infile) ,4); + + //getTriangles(double t, vector<ntlTriangle> *triangles, vector<ntlVec3Gfx> *vertices, vector<ntlVec3Gfx> *normals, int objectId ); + model->getTriangles(mCPSTimeStart, &triangles, &vertices, &normals, 1 ); + debMsgStd("ControlParticles::initFromMVMCMesh",DM_MSG," tris:"<<triangles.size()<<" verts:"<<vertices.size()<<" norms:"<<normals.size() , 2); + + // valid mesh? + if(triangles.size() <= 0) { + return 0; + } + + ntlRenderGlobals *glob = new ntlRenderGlobals; + ntlScene *genscene = new ntlScene( glob, false ); + genscene->addGeoClass(model); + genscene->addGeoObject(model); + genscene->buildScene(0., false); + char treeFlag = (1<<(4+gid)); + + ntlTree *tree = new ntlTree( + 15, 8, // TREEwarning - fixed values for depth & maxtriangles here... + genscene, treeFlag ); + + // TODO? use params + ntlVec3Gfx start,end; + model->getExtends(start,end); + + LbmFloat width = mCPSWidth; + if(width<=LBM_EPSILON) { errMsg("ControlParticles::initFromMVMCMesh","Invalid mCPSWidth! "<<mCPSWidth); width=mCPSWidth=0.1; } + ntlVec3Gfx org = start+ntlVec3Gfx(width*0.5); + gfxReal distance = -1.; + vector<ntlVec3Gfx> inspos; + int approxmax = (int)( ((end[0]-start[0])/width)*((end[1]-start[1])/width)*((end[2]-start[2])/width) ); + + debMsgStd("ControlParticles::initFromMVMCMesh",DM_MSG,"start"<<start<<" end"<<end<<" w="<<width<<" maxp:"<<approxmax, 5); + while(org[2]<end[2]) { + while(org[1]<end[1]) { + while(org[0]<end[0]) { + if(checkPointInside(tree, org, distance)) { + inspos.push_back(org); + //inspos.push_back(org+ntlVec3Gfx(width)); + //inspos.push_back(start+end*0.5); + } + // TODO optimize, use distance + org[0] += width; + } + org[1] += width; + org[0] = start[0]; + } + org[2] += width; + org[1] = start[1]; + } + debMsgStd("ControlParticles::initFromMVMCMesh",DM_MSG,"points: "<<inspos.size()<<" initproblems: "<<globCPIProblems,5 ); + + MeanValueMeshCoords mvm; + mvm.calculateMVMCs(vertices,triangles, inspos, mCPSWeightFac); + vector<ntlVec3Gfx> ninspos; + mvm.transfer(vertices, ninspos); + + // init first set, check dist + ControlParticleSet firstcps; //T + mPartSets.push_back(firstcps); + mPartSets[mPartSets.size()-1].time = (gfxReal)0.; + vector<bool> useCP; + bool debugPos=false; + + for(int i=0; i<(int)inspos.size(); i++) { + ControlParticle p; p.reset(); + p.pos = vec2L(inspos[i]); + //errMsg("COMP "," "<<inspos[i]<<" vs "<<ninspos[i] ); + double cpdist = norm(inspos[i]-ninspos[i]); + bool usecpv = true; + if(debugPos) errMsg("COMP "," "<<cpdist<<usecpv); + + mPartSets[mPartSets.size()-1].particles.push_back(p); + useCP.push_back(usecpv); + } + + // init further sets, temporal mesh sampling + double tsampling = mCPSTimestep; + int totcnt = (int)( (mCPSTimeEnd-mCPSTimeStart)/tsampling ), tcnt=0; + for(double t=mCPSTimeStart+tsampling; ((t<mCPSTimeEnd) && (ninspos.size()>0.)); t+=tsampling) { + ControlParticleSet nextcps; //T + mPartSets.push_back(nextcps); + mPartSets[mPartSets.size()-1].time = (gfxReal)t; + + vertices.clear(); triangles.clear(); normals.clear(); + model->getTriangles(t, &triangles, &vertices, &normals, 1 ); + mvm.transfer(vertices, ninspos); + if(tcnt%(totcnt/10)==1) debMsgStd("MeanValueMeshCoords::calculateMVMCs",DM_MSG,"Transferring animation, frame: "<<tcnt<<"/"<<totcnt,5 ); + tcnt++; + for(int i=0; i<(int)ninspos.size(); i++) { + if(debugPos) errMsg("COMP "," "<<norm(inspos[i]-ninspos[i]) ); + if(useCP[i]) { + ControlParticle p; p.reset(); + p.pos = vec2L(ninspos[i]); + mPartSets[mPartSets.size()-1].particles.push_back(p); + } + } + } + + applyTrafos(); + + myTime_t mvmend = getTime(); + debMsgStd("ControlParticle::initFromMVMCMesh",DM_MSG,"t:"<<getTimeString(mvmend-mvmstart)<<" ",7 ); + delete tree; + delete genscene; + delete glob; +//exit(1); // DEBUG + return 1; +} + +#define TRISWAP(v,a,b) { LbmFloat tmp = (v)[b]; (v)[b]=(v)[a]; (v)[a]=tmp; } +#define TRISWAPALL(v,a,b) { \ + TRISWAP( (v).pos ,a,b ); \ + TRISWAP( (v).vel ,a,b ); \ + TRISWAP( (v).rotaxis ,a,b ); } + +// helper function for LBM 2D -> swap Y and Z components everywhere +void ControlParticles::swapCoords(int a, int b) { + //return; + for(int i=0; i<(int)mPartSets.size(); i++) { + for(int j=0; j<(int)mPartSets[i].particles.size(); j++) { + TRISWAPALL( mPartSets[i].particles[j],a,b ); + } + } +} + +// helper function for LBM 2D -> mirror time +void ControlParticles::mirrorTime() { + LbmFloat maxtime = mPartSets[mPartSets.size()-1].time; + const bool debugTimeswap = false; + + for(int i=0; i<(int)mPartSets.size(); i++) { + mPartSets[i].time = maxtime - mPartSets[i].time; + } + + for(int i=0; i<(int)mPartSets.size()/2; i++) { + ControlParticleSet cps = mPartSets[i]; + if(debugTimeswap) errMsg("TIMESWAP", " s"<<i<<","<<mPartSets[i].time<<" and s"<<(mPartSets.size()-1-i)<<","<< mPartSets[mPartSets.size()-1-i].time <<" mt:"<<maxtime ); + mPartSets[i] = mPartSets[mPartSets.size()-1-i]; + mPartSets[mPartSets.size()-1-i] = cps; + } + + for(int i=0; i<(int)mPartSets.size(); i++) { + if(debugTimeswap) errMsg("TIMESWAP", "done: s"<<i<<","<<mPartSets[i].time<<" "<<mPartSets[i].particles.size() ); + } +} + +// apply init transformations +void ControlParticles::applyTrafos() { + // apply trafos + for(int i=0; i<(int)mPartSets.size(); i++) { + mPartSets[i].time *= _initTimeScale; + /*for(int j=0; j<(int)mPartSets[i].particles.size(); j++) { + for(int k=0; k<3; k++) { + mPartSets[i].particles[j].pos[k] *= _initPartScale[k]; + mPartSets[i].particles[j].pos[k] += _initPartOffset[k]; + } + } now done in initarray */ + } + + // mirror coords... + for(int l=0; l<(int)_initMirror.length(); l++) { + switch(_initMirror[l]) { + case 'X': + case 'x': + //printf("ControlParticles::applyTrafos - mirror x\n"); + swapCoords(1,2); + break; + case 'Y': + case 'y': + //printf("ControlParticles::applyTrafos - mirror y\n"); + swapCoords(0,2); + break; + case 'Z': + case 'z': + //printf("ControlParticles::applyTrafos - mirror z\n"); + swapCoords(0,1); + break; + case 'T': + case 't': + //printf("ControlParticles::applyTrafos - mirror time\n"); + mirrorTime(); + break; + case ' ': + case '-': + case '\n': + break; + default: + //printf("ControlParticles::applyTrafos - mirror unknown %c !?\n", _initMirror[l] ); + break; + } + } + + // reset 2d positions +#if (CP_PROJECT2D==1) && ( defined(MAIN_2D) || LBMDIM==2 ) + for(size_t j=0; j<mPartSets.size(); j++) + for(size_t i=0; i<mPartSets[j].particles.size(); i++) { + // DEBUG + mPartSets[j].particles[i].pos[1] = 0.f; + } +#endif + +#if defined(LBMDIM) + //? if( (getenv("ELBEEM_CPINFILE")) || (getenv("ELBEEM_CPOUTFILE")) ){ + // gui control test, don swap... + //? } else { + //? swapCoords(1,2); // LBM 2D -> swap Y and Z components everywhere + //? } +#endif + + initTime(0.f, 0.f); +} + +#undef TRISWAP + +// -------------------------------------------------------------------------- +// init for a given time +void ControlParticles::initTime(LbmFloat t, LbmFloat dt) +{ + //fprintf(stdout, "CPINITTIME init %f\n",t); + _currTime = t; + if(mPartSets.size()<1) return; + + // init zero velocities + initTimeArray(t, _particles); + + // calculate velocities from prev. timestep? + if(dt>0.) { + _currTimestep = dt; + std::vector<ControlParticle> prevparts; + initTimeArray(t-dt, prevparts); + LbmFloat invdt = 1.0/dt; + for(size_t j=0; j<_particles.size(); j++) { + ControlParticle &p = _particles[j]; + ControlParticle &prevp = prevparts[j]; + for(int k=0; k<3; k++) { + p.pos[k] *= _initPartScale[k]; + p.pos[k] += _initPartOffset[k]; + prevp.pos[k] *= _initLastPartScale[k]; + prevp.pos[k] += _initLastPartOffset[k]; + } + p.vel = (p.pos - prevp.pos)*invdt; + } + + if(0) { + LbmVec avgvel(0.); + for(size_t j=0; j<_particles.size(); j++) { + avgvel += _particles[j].vel; + } + avgvel /= (LbmFloat)_particles.size(); + //fprintf(stdout," AVGVEL %f,%f,%f \n",avgvel[0],avgvel[1],avgvel[2]); // DEBUG + } + } +} + +// helper, init given array +void ControlParticles::initTimeArray(LbmFloat t, std::vector<ControlParticle> &parts) { + if(mPartSets.size()<1) return; + + if(parts.size()!=mPartSets[0].particles.size()) { + //fprintf(stdout,"PRES \n"); + parts.resize(mPartSets[0].particles.size()); + // TODO reset all? + for(size_t j=0; j<parts.size(); j++) { + parts[j].reset(); + } + } + if(parts.size()<1) return; + + // debug inits + if(mDebugInit==1) { + // hard coded circle init + for(size_t j=0; j<mPartSets[0].particles.size(); j++) { + ControlParticle p = mPartSets[0].particles[j]; + // remember old + p.density = parts[j].density; + p.densityWeight = parts[j].densityWeight; + p.avgVel = parts[j].avgVel; + p.avgVelAcc = parts[j].avgVelAcc; + p.avgVelWeight = parts[j].avgVelWeight; + LbmVec ppos(0.); { // DEBUG + const float tscale=10.; + const float tprevo = 0.33; + const LbmVec toff(50,50,0); + const LbmVec oscale(30,30,0); + ppos[0] = cos(tscale* t - tprevo*(float)j + M_PI -0.1) * oscale[0] + toff[0]; + ppos[1] = -sin(tscale* t - tprevo*(float)j + M_PI -0.1) * oscale[1] + toff[1]; + ppos[2] = toff[2]; } // DEBUG + p.pos = ppos; + parts[j] = p; + //errMsg("ControlParticle::initTimeArray","j:"<<j<<" p:"<<parts[j].pos ); + } + return; + } + else if(mDebugInit==2) { + // hard coded spiral init + const float tscale=-10.; + const float tprevo = 0.33; + LbmVec toff(50,0,-50); + const LbmVec oscale(20,20,0); + toff[2] += 30. * t +30.; + for(size_t j=0; j<mPartSets[0].particles.size(); j++) { + ControlParticle p = mPartSets[0].particles[j]; + // remember old + p.density = parts[j].density; + p.densityWeight = parts[j].densityWeight; + p.avgVel = parts[j].avgVel; + p.avgVelAcc = parts[j].avgVelAcc; + p.avgVelWeight = parts[j].avgVelWeight; + LbmVec ppos(0.); + ppos[1] = toff[2]; + LbmFloat zscal = (ppos[1]+100.)/200.; + ppos[0] = cos(tscale* t - tprevo*(float)j + M_PI -0.1) * oscale[0]*zscal + toff[0]; + ppos[2] = -sin(tscale* t - tprevo*(float)j + M_PI -0.1) * oscale[1]*zscal + toff[1]; + p.pos = ppos; + parts[j] = p; + + toff[2] += 0.25; + } + return; + } + + // use first set + if((t<=mPartSets[0].time)||(mPartSets.size()==1)) { + //fprintf(stdout,"PINI %f \n", t); + //parts = mPartSets[0].particles; + const int i=0; + for(size_t j=0; j<mPartSets[i].particles.size(); j++) { + ControlParticle p = mPartSets[i].particles[j]; + // remember old + p.density = parts[j].density; + p.densityWeight = parts[j].densityWeight; + p.avgVel = parts[j].avgVel; + p.avgVelAcc = parts[j].avgVelAcc; + p.avgVelWeight = parts[j].avgVelWeight; + parts[j] = p; + } + return; + } + + for(int i=0; i<(int)mPartSets.size()-1; i++) { + if((mPartSets[i].time<=t) && (mPartSets[i+1].time>t)) { + LbmFloat d = mPartSets[i+1].time-mPartSets[i].time; + LbmFloat f = (t-mPartSets[i].time)/d; + LbmFloat omf = 1.0f - f; + + for(size_t j=0; j<mPartSets[i].particles.size(); j++) { + ControlParticle *src1=&mPartSets[i ].particles[j]; + ControlParticle *src2=&mPartSets[i+1].particles[j]; + ControlParticle &p = parts[j]; + // do linear interpolation + p.pos = src1->pos * omf + src2->pos *f; + p.vel = LbmVec(0.); // reset, calculated later on src1->vel * omf + src2->vel *f; + p.rotaxis = src1->rotaxis * omf + src2->rotaxis *f; + p.influence = src1->influence * omf + src2->influence *f; + p.size = src1->size * omf + src2->size *f; + // dont modify: density, densityWeight + } + } + } + + // after last? + if(t>=mPartSets[ mPartSets.size() -1 ].time) { + //parts = mPartSets[ mPartSets.size() -1 ].particles; + const int i= (int)mPartSets.size() -1; + for(size_t j=0; j<mPartSets[i].particles.size(); j++) { + ControlParticle p = mPartSets[i].particles[j]; + // restore + p.density = parts[j].density; + p.densityWeight = parts[j].densityWeight; + p.avgVel = parts[j].avgVel; + p.avgVelAcc = parts[j].avgVelAcc; + p.avgVelWeight = parts[j].avgVelWeight; + parts[j] = p; + } + } +} + + + + +// -------------------------------------------------------------------------- + +#define DEBUG_MODVEL 0 + +// recalculate +void ControlParticles::calculateKernelWeight() { + const bool debugKernel = true; + + // calculate kernel area with respect to particlesize/cellsize + LbmFloat kernelw = -1.; + LbmFloat kernelnorm = -1.; + LbmFloat krad = (_radiusAtt*0.75); // FIXME use real cone approximation...? + //krad = (_influenceFalloff*1.); +#if (CP_PROJECT2D==1) && (defined(MAIN_2D) || LBMDIM==2) + kernelw = CP_PI*krad*krad; + kernelnorm = 1.0 / (_fluidSpacing * _fluidSpacing); +#else // 2D + kernelw = CP_PI*krad*krad*krad* (4./3.); + kernelnorm = 1.0 / (_fluidSpacing * _fluidSpacing * _fluidSpacing); +#endif // MAIN_2D + + if(debugKernel) debMsgStd("ControlParticles::calculateKernelWeight",DM_MSG,"kw"<<kernelw<<", norm"<< + kernelnorm<<", w*n="<<(kernelw*kernelnorm)<<", rad"<<krad<<", sp"<<_fluidSpacing<<" ", 7); + LbmFloat kernelws = kernelw*kernelnorm; + _kernelWeight = kernelws; + if(debugKernel) debMsgStd("ControlParticles::calculateKernelWeight",DM_MSG,"influence f="<<_radiusAtt<<" t="<< + _influenceTangential<<" a="<<_influenceAttraction<<" v="<<_influenceVelocity<<" kweight="<<_kernelWeight, 7); + if(_kernelWeight<=0.) { + errMsg("ControlParticles::calculateKernelWeight", "invalid kernel! "<<_kernelWeight<<", resetting"); + _kernelWeight = 1.; + } +} + +void +ControlParticles::prepareControl(LbmFloat simtime, LbmFloat dt, ControlParticles *motion) { + debMsgStd("ControlParticle::prepareControl",DM_MSG," simtime="<<simtime<<" dt="<<dt<<" ", 5); + + //fprintf(stdout,"PREPARE \n"); + LbmFloat avgdw = 0.; + for(size_t i=0; i<_particles.size(); i++) { + ControlParticle *cp = &_particles[i]; + + if(this->getInfluenceAttraction()<0.) { + cp->density= + cp->densityWeight = 1.0; + continue; + } + + // normalize by kernel + //cp->densityWeight = (1.0 - (cp->density / _kernelWeight)); // store last +#if (CP_PROJECT2D==1) && (defined(MAIN_2D) || LBMDIM==2) + cp->densityWeight = (1.0 - (cp->density / (_kernelWeight*cp->size*cp->size) )); // store last +#else // 2D + cp->densityWeight = (1.0 - (cp->density / (_kernelWeight*cp->size*cp->size*cp->size) )); // store last +#endif // MAIN_2D + + if(i<10) debMsgStd("ControlParticle::prepareControl",DM_MSG,"kernelDebug i="<<i<<" densWei="<<cp->densityWeight<<" 1/kw"<<(1.0/_kernelWeight)<<" cpdensity="<<cp->density, 9 ); + if(cp->densityWeight<0.) cp->densityWeight=0.; + if(cp->densityWeight>1.) cp->densityWeight=1.; + + avgdw += cp->densityWeight; + // reset for next step + cp->density = 0.; + + if(cp->avgVelWeight>0.) { + cp->avgVel = cp->avgVelAcc/cp->avgVelWeight; + cp->avgVelWeight = 0.; + cp->avgVelAcc = LbmVec(0.,0.,0.); + } + } + //if(debugKernel) for(size_t i=0; i<_particles.size(); i++) { ControlParticle *cp = &_particles[i]; fprintf(stdout,"A %f,%f \n",cp->density,cp->densityWeight); } + avgdw /= (LbmFloat)(_particles.size()); + //if(motion) { printf("ControlParticle::kernel: avgdw:%f, kw%f, sp%f \n", avgdw, _kernelWeight, _fluidSpacing); } + + //if((simtime>=0.) && (simtime != _currTime)) + initTime(simtime, dt); + + if((motion) && (motion->getSize()>0)){ + ControlParticle *motionp = motion->getParticle(0); + //printf("ControlParticle::prepareControl motion: pos[%f,%f,%f] vel[%f,%f,%f] \n", motionp->pos[0], motionp->pos[1], motionp->pos[2], motionp->vel[0], motionp->vel[1], motionp->vel[2] ); + for(size_t i=0; i<_particles.size(); i++) { + ControlParticle *cp = &_particles[i]; + cp->pos = cp->pos + motionp->pos; + cp->vel = cp->vel + motionp->vel; + cp->size = cp->size * motionp->size; + cp->influence = cp->size * motionp->influence; + } + } + + // reset to radiusAtt by default + if(_radiusVel==0.) _radiusVel = _radiusAtt; + if(_radiusMinMaxd==0.) _radiusMinMaxd = _radiusAtt; + if(_radiusMaxd==0.) _radiusMaxd = 2.*_radiusAtt; + // has to be radiusVel<radiusAtt<radiusMinMaxd<radiusMaxd + if(_radiusVel>_radiusAtt) _radiusVel = _radiusAtt; + if(_radiusAtt>_radiusMinMaxd) _radiusAtt = _radiusMinMaxd; + if(_radiusMinMaxd>_radiusMaxd) _radiusMinMaxd = _radiusMaxd; + + //printf("ControlParticle::radii vel:%f att:%f min:%f max:%f \n", _radiusVel,_radiusAtt,_radiusMinMaxd,_radiusMaxd); + // prepareControl done +} + +void ControlParticles::finishControl(std::vector<ControlForces> &forces, LbmFloat iatt, LbmFloat ivel, LbmFloat imaxd) { + + //const LbmFloat iatt = this->getInfluenceAttraction() * this->getCurrTimestep(); + //const LbmFloat ivel = this->getInfluenceVelocity(); + //const LbmFloat imaxd = this->getInfluenceMaxdist() * this->getCurrTimestep(); + // prepare for usage + iatt *= this->getCurrTimestep(); + ivel *= 1.; // not necessary! + imaxd *= this->getCurrTimestep(); + + // skip when size=0 + for(int i=0; i<(int)forces.size(); i++) { + if(DEBUG_MODVEL) fprintf(stdout, "CPFORGF %d , wf:%f,f:%f,%f,%f , v:%f,%f,%f \n",i, forces[i].weightAtt, forces[i].forceAtt[0],forces[i].forceAtt[1],forces[i].forceAtt[2], forces[i].forceVel[0], forces[i].forceVel[1], forces[i].forceVel[2] ); + LbmFloat cfweight = forces[i].weightAtt; // always normalize + if((cfweight!=0.)&&(iatt!=0.)) { + // multiple kernels, normalize - note this does not normalize in d>r/2 region + if(ABS(cfweight)>1.) { cfweight = 1.0/cfweight; } + // multiply iatt afterwards to allow stronger force + cfweight *= iatt; + forces[i].forceAtt *= cfweight; + } else { + forces[i].weightAtt = 0.; + forces[i].forceAtt = LbmVec(0.); + } + + if( (cfweight==0.) && (imaxd>0.) && (forces[i].maxDistance>0.) ) { + forces[i].forceMaxd *= imaxd; + } else { + forces[i].maxDistance= 0.; + forces[i].forceMaxd = LbmVec(0.); + } + + LbmFloat cvweight = forces[i].weightVel; // always normalize + if(cvweight>0.) { + forces[i].forceVel /= cvweight; + forces[i].compAv /= cvweight; + // now modify cvweight, and write back + // important, cut at 1 - otherwise strong vel. influences... + if(cvweight>1.) { cvweight = 1.; } + // thus cvweight is in the range of 0..influenceVelocity, currently not normalized by numCParts + cvweight *= ivel; + if(cvweight<0.) cvweight=0.; if(cvweight>1.) cvweight=1.; + // LBM, FIXME todo use relaxation factor + //pvel = (cvel*0.5 * cvweight) + (pvel * (1.0-cvweight)); + forces[i].weightVel = cvweight; + + //errMsg("COMPAV","i"<<i<<" compav"<<forces[i].compAv<<" forcevel"<<forces[i].forceVel<<" "); + } else { + forces[i].weightVel = 0.; + if(forces[i].maxDistance==0.) forces[i].forceVel = LbmVec(0.); + forces[i].compAvWeight = 0.; + forces[i].compAv = LbmVec(0.); + } + if(DEBUG_MODVEL) fprintf(stdout, "CPFINIF %d , wf:%f,f:%f,%f,%f , v:%f,%f,%f \n",i, forces[i].weightAtt, forces[i].forceAtt[0],forces[i].forceAtt[1],forces[i].forceAtt[2], forces[i].forceVel[0],forces[i].forceVel[1],forces[i].forceVel[2] ); + } + + // unused... + if(DEBUG_MODVEL) fprintf(stdout,"MFC iatt:%f,%f ivel:%f,%f ifmd:%f,%f \n", iatt,_radiusAtt, ivel,_radiusVel, imaxd, _radiusMaxd); + //for(size_t i=0; i<_particles.size(); i++) { ControlParticle *cp = &_particles[i]; fprintf(stdout," %f,%f,%f ",cp->density,cp->densityWeight, (1.0 - (12.0*cp->densityWeight))); } + //fprintf(stdout,"\n\nCP DONE \n\n\n"); +} + + +// -------------------------------------------------------------------------- +// calculate forces at given position, and modify velocity +// according to timestep +void ControlParticles::calculateCpInfluenceOpt(ControlParticle *cp, LbmVec fluidpos, LbmVec fluidvel, ControlForces *force, LbmFloat fillFactor) { + // dont reset, only add... + // test distance, simple squared distance reject + const LbmFloat cpfo = _radiusAtt*cp->size; + + LbmVec posDelta; + if(DEBUG_MODVEL) fprintf(stdout, "CP at %f,%f,%f bef fw:%f, f:%f,%f,%f , vw:%f, v:%f,%f,%f \n",fluidpos[0],fluidpos[1],fluidpos[2], force->weightAtt, force->forceAtt[0], force->forceAtt[1], force->forceAtt[2], force->weightVel, force->forceVel[0], force->forceVel[1], force->forceVel[2]); + posDelta = cp->pos - fluidpos; +#if LBMDIM==2 && (CP_PROJECT2D==1) + posDelta[2] = 0.; // project to xy plane, z-velocity should already be gone... +#endif + + const LbmFloat distsqr = posDelta[0]*posDelta[0]+posDelta[1]*posDelta[1]+posDelta[2]*posDelta[2]; + if(DEBUG_MODVEL) fprintf(stdout, " Pd at %f,%f,%f d%f \n",posDelta[0],posDelta[1],posDelta[2], distsqr); + // cut at influence=0.5 , scaling not really makes sense + if(cpfo*cpfo < distsqr) { + /*if(cp->influence>0.5) { + if(force->weightAtt == 0.) { + if(force->maxDistance*force->maxDistance > distsqr) { + const LbmFloat dis = sqrtf((float)distsqr); + const LbmFloat sc = dis-cpfo; + force->maxDistance = dis; + force->forceMaxd = (posDelta)*(sc/dis); + } + } } */ + return; + } + force->weightAtt += 1e-6; // for distance + force->maxDistance = 0.; // necessary for SPH? + + const LbmFloat pdistance = MAGNITUDE(posDelta); + LbmFloat pdistinv = 0.; + if(ABS(pdistance)>0.) pdistinv = 1./pdistance; + posDelta *= pdistinv; + + LbmFloat falloffAtt = 0.; //CPKernel::kernel(cpfo * 1.0, pdistance); + const LbmFloat qac = pdistance / cpfo ; + if (qac < 1.0){ // return 0.; + if(qac < 0.5) falloffAtt = 1.0f; + else falloffAtt = (1.0f - qac) * 2.0f; + } + + // vorticity force: + // - //LbmVec forceVort; + // - //CROSS(forceVort, posDelta, cp->rotaxis); + // - //NORMALIZE(forceVort); + // - if(falloffAtt>1.0) falloffAtt=1.0; + +#if (CP_PROJECT2D==1) && (defined(MAIN_2D) || LBMDIM==2) + // fillFactor *= 2.0 *0.75 * pdistance; // 2d>3d sampling +#endif // (CP_PROJECT2D==1) && (defined(MAIN_2D) || LBMDIM==2) + + LbmFloat signum = getInfluenceAttraction() > 0.0 ? 1.0 : -1.0; + cp->density += falloffAtt * fillFactor; + force->forceAtt += posDelta *cp->densityWeight *cp->influence *signum; + force->weightAtt += falloffAtt*cp->densityWeight *cp->influence; + + LbmFloat falloffVel = 0.; //CPKernel::kernel(cpfo * 1.0, pdistance); + const LbmFloat cpfv = _radiusVel*cp->size; + if(cpfv*cpfv < distsqr) { return; } + const LbmFloat qvc = pdistance / cpfo ; + //if (qvc < 1.0){ + //if(qvc < 0.5) falloffVel = 1.0f; + //else falloffVel = (1.0f - qvc) * 2.0f; + //} + falloffVel = 1.-qvc; + + LbmFloat pvWeight; // = (1.0-cp->densityWeight) * _currTimestep * falloffVel; + pvWeight = falloffVel *cp->influence; // std, without density influence + //pvWeight *= (1.0-cp->densityWeight); // use inverse density weight + //pvWeight *= cp->densityWeight; // test, use density weight + LbmVec modvel(0.); + modvel += cp->vel * pvWeight; + //pvWeight = 1.; modvel = partVel; // DEBUG!? + + if(pvWeight>0.) { + force->forceVel += modvel; + force->weightVel += pvWeight; + + cp->avgVelWeight += falloffVel; + cp->avgVel += fluidvel; + } + if(DEBUG_MODVEL) fprintf(stdout, "CP at %f,%f,%f aft fw:%f, f:%f,%f,%f , vw:%f, v:%f,%f,%f \n",fluidpos[0],fluidpos[1],fluidpos[2], force->weightAtt, force->forceAtt[0], force->forceAtt[1], force->forceAtt[2], force->weightVel, force->forceVel[0], force->forceVel[1], force->forceVel[2]); + return; +} + +void ControlParticles::calculateMaxdForce(ControlParticle *cp, LbmVec fluidpos, ControlForces *force) { + if(force->weightAtt != 0.) return; // maxd force off + if(cp->influence <= 0.5) return; // ignore + + LbmVec posDelta; + //if(DEBUG_MODVEL) fprintf(stdout, "CP at %f,%f,%f bef fw:%f, f:%f,%f,%f , vw:%f, v:%f,%f,%f \n",fluidpos[0],fluidpos[1],fluidpos[2], force->weightAtt, force->forceAtt[0], force->forceAtt[1], force->forceAtt[2], force->weightVel, force->forceVel[0], force->forceVel[1], force->forceVel[2]); + posDelta = cp->pos - fluidpos; +#if LBMDIM==2 && (CP_PROJECT2D==1) + posDelta[2] = 0.; // project to xy plane, z-velocity should already be gone... +#endif + + // dont reset, only add... + // test distance, simple squared distance reject + const LbmFloat distsqr = posDelta[0]*posDelta[0]+posDelta[1]*posDelta[1]+posDelta[2]*posDelta[2]; + + // closer cp found + if(force->maxDistance*force->maxDistance < distsqr) return; + + const LbmFloat dmin = _radiusMinMaxd*cp->size; + if(distsqr<dmin*dmin) return; // inside min + const LbmFloat dmax = _radiusMaxd*cp->size; + if(distsqr>dmax*dmax) return; // outside + + + if(DEBUG_MODVEL) fprintf(stdout, " Pd at %f,%f,%f d%f \n",posDelta[0],posDelta[1],posDelta[2], distsqr); + // cut at influence=0.5 , scaling not really makes sense + const LbmFloat dis = sqrtf((float)distsqr); + //const LbmFloat sc = dis - dmin; + const LbmFloat sc = (dis-dmin)/(dmax-dmin); // scale from 0-1 + force->maxDistance = dis; + force->forceMaxd = (posDelta/dis) * sc; + //debug errMsg("calculateMaxdForce","pos"<<fluidpos<<" dis"<<dis<<" sc"<<sc<<" dmin"<<dmin<<" maxd"<< force->maxDistance <<" fmd"<<force->forceMaxd ); + return; +} + diff --git a/intern/elbeem/intern/controlparticles.h b/intern/elbeem/intern/controlparticles.h new file mode 100644 index 00000000000..712dfc40273 --- /dev/null +++ b/intern/elbeem/intern/controlparticles.h @@ -0,0 +1,301 @@ +// -------------------------------------------------------------------------- +// +// El'Beem - the visual lattice boltzmann freesurface simulator +// All code distributed as part of El'Beem is covered by the version 2 of the +// GNU General Public License. See the file COPYING for details. +// +// Copyright 2008 Nils Thuerey , Richard Keiser, Mark Pauly, Ulrich Ruede +// +// control particle classes +// +// -------------------------------------------------------------------------- + +#ifndef CONTROLPARTICLES_H +#define CONTROLPARTICLES_H + +#include "ntl_geometrymodel.h" + +// indicator for LBM inclusion +//#ifndef LBMDIM + +//#include <NxFoundation.h> +//#include <vector> +//class MultisphGUI; +//#define NORMALIZE(a) a.normalize() +//#define MAGNITUDE(a) a.magnitude() +//#define CROSS(a,b,c) a.cross(b,c) +//#define ABS(a) (a>0. ? (a) : -(a)) +//#include "cpdefines.h" + +//#else // LBMDIM + +// use compatibility defines +//#define NORMALIZE(a) normalize(a) +//#define MAGNITUDE(a) norm(a) +//#define CROSS(a,b,c) a=cross(b,c) + +//#endif // LBMDIM + +#define MAGNITUDE(a) norm(a) + +// math.h compatibility +#define CP_PI ((LbmFloat)3.14159265358979323846) + +// project 2d test cases onto plane? +// if not, 3d distance is used for 2d sim as well +#define CP_PROJECT2D 1 + + +// default init for mincpdist, ControlForces::maxDistance +#define CPF_MAXDINIT 10000. + +// storage of influence for a fluid cell/particle in lbm/sph +class ControlForces +{ +public: + ControlForces() { }; + ~ControlForces() {}; + + // attraction force + LbmFloat weightAtt; + LbmVec forceAtt; + // velocity influence + LbmFloat weightVel; + LbmVec forceVel; + // maximal distance influence, + // first is max. distance to first control particle + // second attraction strength + LbmFloat maxDistance; + LbmVec forceMaxd; + + LbmFloat compAvWeight; + LbmVec compAv; + + void resetForces() { + weightAtt = weightVel = 0.; + maxDistance = CPF_MAXDINIT; + forceAtt = forceVel = forceMaxd = LbmVec(0.,0.,0.); + compAvWeight=0.; compAv=LbmVec(0.); + }; +}; + + +// single control particle +class ControlParticle +{ +public: + ControlParticle() { reset(); }; + ~ControlParticle() {}; + + // control parameters + + // position + LbmVec pos; + // size (influences influence radius) + LbmFloat size; + // overall strength of influence + LbmFloat influence; + // rotation axis + LbmVec rotaxis; + + // computed values + + // velocity + LbmVec vel; + // computed density + LbmFloat density; + LbmFloat densityWeight; + + LbmVec avgVel; + LbmVec avgVelAcc; + LbmFloat avgVelWeight; + + // init all zero / defaults + void reset(); +}; + + +// container for a particle configuration at time t +class ControlParticleSet +{ +public: + + // time of particle set + LbmFloat time; + // particle positions + std::vector<ControlParticle> particles; + +}; + + +// container & management of control particles +class ControlParticles +{ +public: + ControlParticles(); + ~ControlParticles(); + + // reset datastructures for next influence step + // if motion object is given, particle 1 of second system is used for overall + // position and speed offset + void prepareControl(LbmFloat simtime, LbmFloat dt, ControlParticles *motion); + // post control operations + void finishControl(std::vector<ControlForces> &forces, LbmFloat iatt, LbmFloat ivel, LbmFloat imaxd); + // recalculate + void calculateKernelWeight(); + + // calculate forces at given position, and modify velocity + // according to timestep (from initControl) + void calculateCpInfluenceOpt (ControlParticle *cp, LbmVec fluidpos, LbmVec fluidvel, ControlForces *force, LbmFloat fillFactor); + void calculateMaxdForce (ControlParticle *cp, LbmVec fluidpos, ControlForces *force); + + // no. of particles + inline int getSize() { return (int)_particles.size(); } + int getTotalSize(); + // get particle [i] + inline ControlParticle* getParticle(int i){ return &_particles[i]; } + + // set influence parameters + void setInfluenceTangential(LbmFloat set) { _influenceTangential=set; } + void setInfluenceAttraction(LbmFloat set) { _influenceAttraction=set; } + void setInfluenceMaxdist(LbmFloat set) { _influenceMaxdist=set; } + // calculate for delta t + void setInfluenceVelocity(LbmFloat set, LbmFloat dt); + // get influence parameters + inline LbmFloat getInfluenceAttraction() { return _influenceAttraction; } + inline LbmFloat getInfluenceTangential() { return _influenceTangential; } + inline LbmFloat getInfluenceVelocity() { return _influenceVelocity; } + inline LbmFloat getInfluenceMaxdist() { return _influenceMaxdist; } + inline LbmFloat getCurrTimestep() { return _currTimestep; } + + void setRadiusAtt(LbmFloat set) { _radiusAtt=set; } + inline LbmFloat getRadiusAtt() { return _radiusAtt; } + void setRadiusVel(LbmFloat set) { _radiusVel=set; } + inline LbmFloat getRadiusVel() { return _radiusVel; } + void setRadiusMaxd(LbmFloat set) { _radiusMaxd=set; } + inline LbmFloat getRadiusMaxd() { return _radiusMaxd; } + void setRadiusMinMaxd(LbmFloat set) { _radiusMinMaxd=set; } + inline LbmFloat getRadiusMinMaxd() { return _radiusMinMaxd; } + + LbmFloat getControlTimStart(); + LbmFloat getControlTimEnd(); + + // set/get characteristic length (and inverse) + void setCharLength(LbmFloat set) { _charLength=set; _charLengthInv=1./_charLength; } + inline LbmFloat getCharLength() { return _charLength;} + inline LbmFloat getCharLengthInv() { return _charLengthInv;} + + // set init parameters + void setInitTimeScale(LbmFloat set) { _initTimeScale = set; }; + void setInitMirror(string set) { _initMirror = set; }; + string getInitMirror() { return _initMirror; }; + + void setLastOffset(LbmVec set) { _initLastPartOffset = set; }; + void setLastScale(LbmVec set) { _initLastPartScale = set; }; + void setOffset(LbmVec set) { _initPartOffset = set; }; + void setScale(LbmVec set) { _initPartScale = set; }; + + // set/get cps params + void setCPSWith(LbmFloat set) { mCPSWidth = set; }; + void setCPSTimestep(LbmFloat set) { mCPSTimestep = set; }; + void setCPSTimeStart(LbmFloat set) { mCPSTimeStart = set; }; + void setCPSTimeEnd(LbmFloat set) { mCPSTimeEnd = set; }; + void setCPSMvmWeightFac(LbmFloat set) { mCPSWeightFac = set; }; + + LbmFloat getCPSWith() { return mCPSWidth; }; + LbmFloat getCPSTimestep() { return mCPSTimestep; }; + LbmFloat getCPSTimeStart() { return mCPSTimeStart; }; + LbmFloat getCPSTimeEnd() { return mCPSTimeEnd; }; + LbmFloat getCPSMvmWeightFac() { return mCPSWeightFac; }; + + void setDebugInit(int set) { mDebugInit = set; }; + + // set init parameters + void setFluidSpacing(LbmFloat set) { _fluidSpacing = set; }; + + // load positions & timing from text file + int initFromTextFile(string filename); + int initFromTextFileOld(string filename); + // load positions & timing from gzipped binary file + int initFromBinaryFile(string filename); + int initFromMVCMesh(string filename); + // init an example test case + int initExampleSet(); + + // init for a given time + void initTime(LbmFloat t, LbmFloat dt); + + // blender test init + void initBlenderTest(); + + int initFromObject(ntlGeometryObjModel *model); + +protected: + // sets influence params + friend class MultisphGUI; + + // tangential and attraction influence + LbmFloat _influenceTangential, _influenceAttraction; + // direct velocity influence + LbmFloat _influenceVelocity; + // maximal distance influence + LbmFloat _influenceMaxdist; + + // influence radii + LbmFloat _radiusAtt, _radiusVel, _radiusMinMaxd, _radiusMaxd; + + // currently valid time & timestep + LbmFloat _currTime, _currTimestep; + // all particles + std::vector<ControlParticle> _particles; + + // particle sets + std::vector<ControlParticleSet> mPartSets; + + // additional parameters for initing particles + LbmFloat _initTimeScale; + LbmVec _initPartOffset; + LbmVec _initPartScale; + LbmVec _initLastPartOffset; + LbmVec _initLastPartScale; + // mirror particles for loading? + string _initMirror; + + // row spacing paramter, e.g. use for approximation of kernel area/volume + LbmFloat _fluidSpacing; + // save current kernel weight + LbmFloat _kernelWeight; + // charateristic length in world coordinates for normalizatioon of forces + LbmFloat _charLength, _charLengthInv; + + + /*! do ani mesh CPS */ + void calculateCPS(string filename); + //! ani mesh cps params + ntlVec3Gfx mvCPSStart, mvCPSEnd; + gfxReal mCPSWidth, mCPSTimestep; + gfxReal mCPSTimeStart, mCPSTimeEnd; + gfxReal mCPSWeightFac; + + int mDebugInit; + + +protected: + // apply init transformations + void applyTrafos(); + + // helper function for init -> swap components everywhere + void swapCoords(int a,int b); + // helper function for init -> mirror time + void mirrorTime(); + + // helper, init given array + void initTimeArray(LbmFloat t, std::vector<ControlParticle> &parts); + + bool checkPointInside(ntlTree *tree, ntlVec3Gfx org, gfxReal &distance); +}; + + + +#endif + diff --git a/intern/elbeem/intern/elbeem.cpp b/intern/elbeem/intern/elbeem.cpp index b2779f51c3b..179e103e326 100644 --- a/intern/elbeem/intern/elbeem.cpp +++ b/intern/elbeem/intern/elbeem.cpp @@ -30,6 +30,7 @@ int guiRoiMaxLev=6, guiRoiMinLev=0; ntlWorld *gpWorld = NULL; + // API // reset elbeemSimulationSettings struct with defaults @@ -95,6 +96,13 @@ int elbeemInit() { return 0; } +// fluidsim end +extern "C" +int elbeemFree() { + + return 0; +} + // start fluidsim init extern "C" int elbeemAddDomain(elbeemSimulationSettings *settings) { @@ -158,13 +166,27 @@ void elbeemResetMesh(elbeemMesh *mesh) { /* name of the mesh, mostly for debugging */ mesh->name = "[unnamed]"; + + /* fluid control settings */ + mesh->cpsTimeStart = 0; + mesh->cpsTimeEnd = 0; + mesh->cpsQuality = 0; + + mesh->channelSizeAttractforceStrength = 0; + mesh->channelAttractforceStrength = NULL; + mesh->channelSizeAttractforceRadius = 0; + mesh->channelAttractforceRadius = NULL; + mesh->channelSizeVelocityforceStrength = 0; + mesh->channelVelocityforceStrength = NULL; + mesh->channelSizeVelocityforceRadius = 0; + mesh->channelVelocityforceRadius = NULL; } int globalMeshCounter = 1; // add mesh as fluidsim object extern "C" int elbeemAddMesh(elbeemMesh *mesh) { - int initType = -1; + int initType; if(getElbeemState() != SIMWORLD_INITIALIZING) { errFatal("elbeemAddMesh","World and domain not initialized, call elbeemInit and elbeemAddDomain before...", SIMWORLD_INITERROR); } switch(mesh->type) { @@ -176,12 +198,13 @@ int elbeemAddMesh(elbeemMesh *mesh) { case OB_FLUIDSIM_FLUID: initType = FGI_FLUID; break; case OB_FLUIDSIM_INFLOW: initType = FGI_MBNDINFLOW; break; case OB_FLUIDSIM_OUTFLOW: initType = FGI_MBNDOUTFLOW; break; + case OB_FLUIDSIM_CONTROL: initType = FGI_CONTROL; break; + default: return 1; // invalid type } - // invalid type? - if(initType<0) return 1; ntlGeometryObjModel *obj = new ntlGeometryObjModel( ); gpWorld->getRenderGlobals()->getSimScene()->addGeoClass( obj ); + gpWorld->getRenderGlobals()->getRenderScene()->addGeoClass(obj); obj->initModel( mesh->numVertices, mesh->vertices, mesh->numTriangles, mesh->triangles, mesh->channelSizeVertices, mesh->channelVertices ); @@ -195,17 +218,34 @@ int elbeemAddMesh(elbeemMesh *mesh) { obj->setGeoInitId( mesh->parentDomainId+1 ); obj->setGeoInitIntersect(true); obj->setGeoInitType(initType); - obj->setGeoPartSlipValue(mesh->obstaclePartslip); + + // abuse partslip value for control fluid: reverse control keys or not + if(initType == FGI_CONTROL) + obj->setGeoPartSlipValue(mesh->obstacleType); + else + obj->setGeoPartSlipValue(mesh->obstaclePartslip); + obj->setGeoImpactFactor(mesh->obstacleImpactFactor); + + /* fluid control features */ + obj->setCpsTimeStart(mesh->cpsTimeStart); + obj->setCpsTimeEnd(mesh->cpsTimeEnd); + obj->setCpsQuality(mesh->cpsQuality); + if((mesh->volumeInitType<VOLUMEINIT_VOLUME)||(mesh->volumeInitType>VOLUMEINIT_BOTH)) mesh->volumeInitType = VOLUMEINIT_VOLUME; obj->setVolumeInit(mesh->volumeInitType); // use channel instead, obj->setInitialVelocity( ntlVec3Gfx(mesh->iniVelocity[0], mesh->iniVelocity[1], mesh->iniVelocity[2]) ); + obj->initChannels( mesh->channelSizeTranslation, mesh->channelTranslation, mesh->channelSizeRotation, mesh->channelRotation, mesh->channelSizeScale, mesh->channelScale, mesh->channelSizeActive, mesh->channelActive, - mesh->channelSizeInitialVel, mesh->channelInitialVel + mesh->channelSizeInitialVel, mesh->channelInitialVel, + mesh->channelSizeAttractforceStrength, mesh->channelAttractforceStrength, + mesh->channelSizeAttractforceRadius, mesh->channelAttractforceRadius, + mesh->channelSizeVelocityforceStrength, mesh->channelVelocityforceStrength, + mesh->channelSizeVelocityforceRadius, mesh->channelVelocityforceRadius ); obj->setLocalCoordInivel( mesh->localInivelCoords ); @@ -227,6 +267,7 @@ int elbeemSimulate(void) { if(getElbeemState() != SIMWORLD_STOP) { // ok, we're done... delete gpWorld; + gpWorld = NULL; debMsgStd("elbeemSimulate",DM_NOTIFY, "El'Beem simulation done, time: "<<getTimeString(timeend-timestart)<<".\n", 2 ); } else { diff --git a/intern/elbeem/intern/elbeem.h b/intern/elbeem/intern/elbeem.h deleted file mode 100644 index 2a594dd07e6..00000000000 --- a/intern/elbeem/intern/elbeem.h +++ /dev/null @@ -1,240 +0,0 @@ -/****************************************************************************** - * - * El'Beem - Free Surface Fluid Simulation with the Lattice Boltzmann Method - * All code distributed as part of El'Beem is covered by the version 2 of the - * GNU General Public License. See the file COPYING for details. - * Copyright 2003-2006 Nils Thuerey - * - * API header - */ -#ifndef ELBEEM_API_H -#define ELBEEM_API_H - - -// simulation run callback function type (elbeemSimulationSettings->runsimCallback) -// best use with FLUIDSIM_CBxxx defines below. -// >parameters -// return values: 0=continue, 1=stop, 2=abort -// data pointer: user data pointer from elbeemSimulationSettings->runsimUserData -// status integer: 1=running simulation, 2=new frame saved -// frame integer: if status is 1, contains current frame number -typedef int (*elbeemRunSimulationCallback)(void *data, int status, int frame); -#define FLUIDSIM_CBRET_CONTINUE 0 -#define FLUIDSIM_CBRET_STOP 1 -#define FLUIDSIM_CBRET_ABORT 2 -#define FLUIDSIM_CBSTATUS_STEP 1 -#define FLUIDSIM_CBSTATUS_NEWFRAME 2 - - -// global settings for the simulation -typedef struct elbeemSimulationSettings { - /* version number */ - short version; - /* id number of simulation domain, needed if more than a - * single domain should be simulated */ - short domainId; - - /* geometrical extent */ - float geoStart[3], geoSize[3]; - - /* resolutions */ - short resolutionxyz; - short previewresxyz; - /* size of the domain in real units (meters along largest resolution x,y,z extent) */ - float realsize; - - /* fluid properties */ - double viscosity; - /* gravity strength */ - float gravity[3]; - /* anim start end time */ - float animStart, aniFrameTime; - /* no. of frames to simulate & output */ - short noOfFrames; - /* g star param (LBM compressibility) */ - float gstar; - /* activate refinement? */ - short maxRefine; - /* probability for surface particle generation (0.0=off) */ - float generateParticles; - /* amount of tracer particles to generate (0=off) */ - int numTracerParticles; - - /* store output path, and file prefix for baked fluid surface */ - char outputPath[160+80]; - - /* channel for frame time, visc & gravity animations */ - int channelSizeFrameTime; - float *channelFrameTime; - int channelSizeViscosity; - float *channelViscosity; - int channelSizeGravity; - float *channelGravity; // vector - - /* boundary types and settings for domain walls */ - short domainobsType; - float domainobsPartslip; - /* generate speed vectors for vertices (e.g. for image based motion blur)*/ - short generateVertexVectors; - /* strength of surface smoothing */ - float surfaceSmoothing; - /* no. of surface subdivisions */ - int surfaceSubdivs; - - /* global transformation to apply to fluidsim mesh */ - float surfaceTrafo[4*4]; - - /* development variables, testing for upcoming releases...*/ - float farFieldSize; - - /* callback function to notify calling program of performed simulation steps - * or newly available frame data, if NULL it is ignored */ - elbeemRunSimulationCallback runsimCallback; - /* pointer passed to runsimCallback for user data storage */ - void* runsimUserData; - -} elbeemSimulationSettings; - - -// defines for elbeemMesh->type below -#define OB_FLUIDSIM_FLUID 4 -#define OB_FLUIDSIM_OBSTACLE 8 -#define OB_FLUIDSIM_INFLOW 16 -#define OB_FLUIDSIM_OUTFLOW 32 - -// defines for elbeemMesh->obstacleType below -#define FLUIDSIM_OBSTACLE_NOSLIP 1 -#define FLUIDSIM_OBSTACLE_PARTSLIP 2 -#define FLUIDSIM_OBSTACLE_FREESLIP 3 - -#define OB_VOLUMEINIT_VOLUME 1 -#define OB_VOLUMEINIT_SHELL 2 -#define OB_VOLUMEINIT_BOTH (OB_VOLUMEINIT_SHELL|OB_VOLUMEINIT_VOLUME) - -// a single mesh object -typedef struct elbeemMesh { - /* obstacle,fluid or inflow... */ - short type; - /* id of simulation domain it belongs to */ - short parentDomainId; - - /* vertices */ - int numVertices; - float *vertices; // = float[n][3]; - /* animated vertices */ - int channelSizeVertices; - float *channelVertices; // = float[channelSizeVertices* (n*3+1) ]; - - /* triangles */ - int numTriangles; - int *triangles; // = int[][3]; - - /* animation channels */ - int channelSizeTranslation; - float *channelTranslation; - int channelSizeRotation; - float *channelRotation; - int channelSizeScale; - float *channelScale; - - /* active channel */ - int channelSizeActive; - float *channelActive; - /* initial velocity channel (e.g. for inflow) */ - int channelSizeInitialVel; - float *channelInitialVel; // vector - /* use initial velocity in object coordinates? (e.g. for rotation) */ - short localInivelCoords; - /* boundary types and settings */ - short obstacleType; - float obstaclePartslip; - /* amount of force transfer from fluid to obj, 0=off, 1=normal */ - float obstacleImpactFactor; - /* init volume, shell or both? use OB_VOLUMEINIT_xxx defines above */ - short volumeInitType; - - /* name of the mesh, mostly for debugging */ - const char *name; -} elbeemMesh; - -// API functions - -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - - -// reset elbeemSimulationSettings struct with defaults -void elbeemResetSettings(struct elbeemSimulationSettings*); - -// start fluidsim init (returns !=0 upon failure) -int elbeemInit(void); - -// start fluidsim init (returns !=0 upon failure) -int elbeemAddDomain(struct elbeemSimulationSettings*); - -// get failure message during simulation or init -// if an error occured (the string is copied into buffer, -// max. length = 256 chars ) -void elbeemGetErrorString(char *buffer); - -// reset elbeemMesh struct with zeroes -void elbeemResetMesh(struct elbeemMesh*); - -// add mesh as fluidsim object -int elbeemAddMesh(struct elbeemMesh*); - -// do the actual simulation -int elbeemSimulate(void); - -// continue a previously stopped simulation -int elbeemContinueSimulation(void); - - -// helper functions - -// simplify animation channels -// returns if the channel and its size changed -int elbeemSimplifyChannelFloat(float *channel, int *size); -int elbeemSimplifyChannelVec3(float *channel, int *size); - -// helper functions implemented in utilities.cpp - -/* set elbeem debug output level (0=off to 10=full on) */ -void elbeemSetDebugLevel(int level); -/* elbeem debug output function, prints if debug level >0 */ -void elbeemDebugOut(char *msg); - -/* estimate how much memory a given setup will require */ -double elbeemEstimateMemreq(int res, - float sx, float sy, float sz, - int refine, char *retstr); - - - -#ifdef __cplusplus -} -#endif // __cplusplus - - - -/******************************************************************************/ -// internal defines, do not use for initializing elbeemMesh -// structs, for these use OB_xxx defines above - -/*! fluid geometry init types */ -#define FGI_FLAGSTART 16 -#define FGI_FLUID (1<<(FGI_FLAGSTART+ 0)) -#define FGI_NO_FLUID (1<<(FGI_FLAGSTART+ 1)) -#define FGI_BNDNO (1<<(FGI_FLAGSTART+ 2)) -#define FGI_BNDFREE (1<<(FGI_FLAGSTART+ 3)) -#define FGI_BNDPART (1<<(FGI_FLAGSTART+ 4)) -#define FGI_NO_BND (1<<(FGI_FLAGSTART+ 5)) -#define FGI_MBNDINFLOW (1<<(FGI_FLAGSTART+ 6)) -#define FGI_MBNDOUTFLOW (1<<(FGI_FLAGSTART+ 7)) - -// all boundary types at once -#define FGI_ALLBOUNDS ( FGI_BNDNO | FGI_BNDFREE | FGI_BNDPART | FGI_MBNDINFLOW | FGI_MBNDOUTFLOW ) - - -#endif // ELBEEM_API_H diff --git a/intern/elbeem/intern/elbeem_control.cpp b/intern/elbeem/intern/elbeem_control.cpp new file mode 100644 index 00000000000..800167baf73 --- /dev/null +++ b/intern/elbeem/intern/elbeem_control.cpp @@ -0,0 +1,25 @@ +/****************************************************************************** + * + * El'Beem - Free Surface Fluid Simulation with the Lattice Boltzmann Method + * All code distributed as part of El'Beem is covered by the version 2 of the + * GNU General Public License. See the file COPYING for details. + * Copyright 2003-2006 Nils Thuerey + * + * Control API header + */ + +#include "elbeem.h" +#include "elbeem_control.h" + +// add mesh as fluidsim object +int elbeemControlAddSet(struct elbeemControl*) { + + return 0; +} + +int elbeemControlComputeMesh(struct elbeemMesh*) { + + + return 0; +} + diff --git a/intern/elbeem/intern/elbeem_control.h b/intern/elbeem/intern/elbeem_control.h new file mode 100644 index 00000000000..70a58feda89 --- /dev/null +++ b/intern/elbeem/intern/elbeem_control.h @@ -0,0 +1,62 @@ +/****************************************************************************** + * + * El'Beem - Free Surface Fluid Simulation with the Lattice Boltzmann Method + * All code distributed as part of El'Beem is covered by the version 2 of the + * GNU General Public License. See the file COPYING for details. + * Copyright 2003-2006 Nils Thuerey + * + * Control API header + */ +#ifndef ELBEEMCONTROL_API_H +#define ELBEEMCONTROL_API_H + +// a single control particle set +typedef struct elbeemControl { + /* influence forces */ + float influenceAttraction; + float *channelInfluenceAttraction; + float channelSizeInfluenceAttraction; + + float influenceVelocity; + float *channelInfluenceVelocity; + float channelSizeInfluenceVelocity; + + float influenceMaxdist; + float *channelInfluenceMaxdist; + float channelSizeInfluenceMaxdist; + + /* influence force radii */ + float radiusAttraction; + float *channelRadiusAttraction; + float channelSizeRadiusAttraction; + + float radiusVelocity; + float *channelRadiusVelocity; + float channelSizeRadiusVelocity; + + float radiusMindist; + float *channelRadiusMindist; + float channelSizeRadiusMindist; + float radiusMaxdist; + float *channelRadiusMaxdist; + float channelSizeRadiusMaxdist; + + /* control particle positions/scale */ + float offset[3]; + float *channelOffset; + float channelSizeOffset; + + float scale[3]; + float *channelScale; + float channelSizeScale; + +} elbeemControl; + + +// add mesh as fluidsim object +int elbeemControlAddSet(struct elbeemControl*); + +// sample & track mesh control particles, TODO add return type... +int elbeemControlComputeMesh(struct elbeemMesh*); + +#endif // ELBEEMCONTROL_API_H diff --git a/intern/elbeem/intern/isosurface.cpp b/intern/elbeem/intern/isosurface.cpp index 1b0ba13c707..751a48cebba 100644 --- a/intern/elbeem/intern/isosurface.cpp +++ b/intern/elbeem/intern/isosurface.cpp @@ -13,8 +13,8 @@ #include <algorithm> #include <stdio.h> -#if (defined (__sun__) || defined (__sun)) || (!defined(linux) && (defined (__sparc) || defined (__sparc__))) -#include <ieeefp.h> +#ifdef sun +#include "ieeefp.h" #endif // just use default rounding for platforms where its not available diff --git a/intern/elbeem/intern/mvmcoords.cpp b/intern/elbeem/intern/mvmcoords.cpp new file mode 100644 index 00000000000..03f6482ae84 --- /dev/null +++ b/intern/elbeem/intern/mvmcoords.cpp @@ -0,0 +1,193 @@ +/****************************************************************************** + * +// El'Beem - the visual lattice boltzmann freesurface simulator +// All code distributed as part of El'Beem is covered by the version 2 of the +// GNU General Public License. See the file COPYING for details. +// +// Copyright 2008 Nils Thuerey , Richard Keiser, Mark Pauly, Ulrich Ruede +// + * + * Mean Value Mesh Coords class + * + *****************************************************************************/ + +#include "mvmcoords.h" +#include <algorithm> +using std::vector; + +void MeanValueMeshCoords::clear() +{ + mVertices.resize(0); + mNumVerts = 0; +} + +void MeanValueMeshCoords::calculateMVMCs(vector<ntlVec3Gfx> &reference_vertices, vector<ntlTriangle> &tris, + vector<ntlVec3Gfx> &points, gfxReal numweights) +{ + clear(); + mvmTransferPoint tds; + int mem = 0; + int i = 0; + + mNumVerts = (int)reference_vertices.size(); + + for (vector<ntlVec3Gfx>::iterator iter = points.begin(); iter != points.end(); ++iter, ++i) { + /* + if(i%(points.size()/10)==1) debMsgStd("MeanValueMeshCoords::calculateMVMCs",DM_MSG,"Computing weights, points: "<<i<<"/"<<points.size(),5 ); + */ + tds.lastpos = *iter; + tds.weights.resize(0); // clear + computeWeights(reference_vertices, tris, tds, numweights); + mem += (int)tds.weights.size(); + mVertices.push_back(tds); + } + int mbmem = mem * sizeof(mvmFloat) / (1024*1024); + debMsgStd("MeanValueMeshCoords::calculateMVMCs",DM_MSG,"vertices:"<<mNumVerts<<" points:"<<points.size()<<" weights:"<<mem<<", wmem:"<<mbmem<<"MB ",7 ); +} + +// from: mean value coordinates for closed triangular meshes +// attention: fails if a point is exactly (or very close) to a vertex +void MeanValueMeshCoords::computeWeights(vector<ntlVec3Gfx> &reference_vertices, vector<ntlTriangle>& tris, + mvmTransferPoint& tds, gfxReal numweights) +{ + const bool mvmFullDebug=false; + //const ntlVec3Gfx cEPS = 1.0e-6; + const mvmFloat cEPS = 1.0e-14; + + //mvmFloat d[3], s[3], phi[3],c[3]; + ntlVec3d u[3],c,d,s,phi; + int indices[3]; + + for (int i = 0; i < (int)reference_vertices.size(); ++i) { + tds.weights.push_back(mvmIndexWeight(i, 0.0)); + } + + // for each triangle + //for (vector<ntlTriangle>::iterator iter = tris.begin(); iter != tris.end();) { + for(int t=0; t<(int)tris.size(); t++) { + + for (int i = 0; i < 3; ++i) { //, ++iter) { + indices[i] = tris[t].getPoints()[i]; + u[i] = vec2D(reference_vertices[ indices[i] ]-tds.lastpos); + d[i] = normalize(u[i]); //.normalize(); + //assert(d[i] != 0.); + if(mvmFullDebug) errMsg("MeanValueMeshCoords::computeWeights","t"<<t<<" i"<<indices[i] //<<" lp"<<tds.lastpos + <<" v"<<reference_vertices[indices[i]]<<" u"<<u[i]<<" "); + // on vertex! + //? if(d[i]<=0.) continue; + } + //for (int i = 0; i < 3; ++i) { errMsg("III"," "<<i <<" i"<<indices[i]<<reference_vertices[ indices[i] ] ); } + + // arcsin is not needed, see paper + phi[0] = 2.*asin( (mvmFloat)(0.5* norm(u[1]-u[2]) ) ); + phi[1] = 2.*asin( (mvmFloat)(0.5* norm(u[0]-u[2]) ) ); + phi[2] = 2.*asin( (mvmFloat)(0.5* norm(u[0]-u[1]) ) ); + mvmFloat h = (phi[0] + phi[1] + phi[2])*0.5; + if (M_PI-h < cEPS) { + if(mvmFullDebug) errMsg("MeanValueMeshCoords::computeWeights","point on triangle"); + tds.weights.resize(0); + tds.weights.push_back( mvmIndexWeight(indices[0], sin(phi[0])*d[1]*d[2])); + tds.weights.push_back( mvmIndexWeight(indices[1], sin(phi[1])*d[0]*d[2])); + tds.weights.push_back( mvmIndexWeight(indices[2], sin(phi[2])*d[1]*d[0])); + break; + } + mvmFloat sinh = 2.*sin(h); + c[0] = (sinh*sin(h-phi[0]))/(sin(phi[1])*sin(phi[2]))-1.; + c[1] = (sinh*sin(h-phi[1]))/(sin(phi[0])*sin(phi[2]))-1.; + c[2] = (sinh*sin(h-phi[2]))/(sin(phi[0])*sin(phi[1]))-1.; + if(mvmFullDebug) errMsg("MeanValueMeshCoords::computeWeights","c="<<c<<" phi="<<phi<<" d="<<d); + //if (c[0] > 1. || c[0] < 0. || c[1] > 1. || c[1] < 0. || c[2] > 1. || c[2] < 0.) continue; + + s[0] = sqrt((float)(1.-c[0]*c[0])); + s[1] = sqrt((float)(1.-c[1]*c[1])); + s[2] = sqrt((float)(1.-c[2]*c[2])); + + if(mvmFullDebug) errMsg("MeanValueMeshCoords::computeWeights","s"); + if (s[0] <= cEPS || s[1] <= cEPS || s[2] <= cEPS) { + //MSG("position lies outside the triangle on the same plane -> ignore it"); + continue; + } + const mvmFloat u0x = u[0][0]; + const mvmFloat u0y = u[0][1]; + const mvmFloat u0z = u[0][2]; + const mvmFloat u1x = u[1][0]; + const mvmFloat u1y = u[1][1]; + const mvmFloat u1z = u[1][2]; + const mvmFloat u2x = u[2][0]; + const mvmFloat u2y = u[2][1]; + const mvmFloat u2z = u[2][2]; + mvmFloat det = u0x*u1y*u2z - u0x*u1z*u2y + u0y*u1z*u2x - u0y*u1x*u2z + u0z*u1x*u2y - u0z*u1y*u2x; + //assert(det != 0.); + if (det < 0.) { + s[0] = -s[0]; + s[1] = -s[1]; + s[2] = -s[2]; + } + + tds.weights[indices[0]].weight += (phi[0]-c[1]*phi[2]-c[2]*phi[1])/(d[0]*sin(phi[1])*s[2]); + tds.weights[indices[1]].weight += (phi[1]-c[2]*phi[0]-c[0]*phi[2])/(d[1]*sin(phi[2])*s[0]); + tds.weights[indices[2]].weight += (phi[2]-c[0]*phi[1]-c[1]*phi[0])/(d[2]*sin(phi[0])*s[1]); + if(mvmFullDebug) { errMsg("MeanValueMeshCoords::computeWeights","i"<<indices[0]<<" o"<<tds.weights[indices[0]].weight); + errMsg("MeanValueMeshCoords::computeWeights","i"<<indices[1]<<" o"<<tds.weights[indices[1]].weight); + errMsg("MeanValueMeshCoords::computeWeights","i"<<indices[2]<<" o"<<tds.weights[indices[2]].weight); + errMsg("MeanValueMeshCoords::computeWeights","\n\n\n"); } + } + + //sort weights + if((numweights>0.)&& (numweights<1.) ) { + //if( ((int)tds.weights.size() > maxNumWeights) && (maxNumWeights > 0) ) { + int maxNumWeights = (int)(tds.weights.size()*numweights); + if(maxNumWeights<=0) maxNumWeights = 1; + std::sort(tds.weights.begin(), tds.weights.end(), std::greater<mvmIndexWeight>()); + // only use maxNumWeights-th largest weights + tds.weights.resize(maxNumWeights); + } + + // normalize weights + mvmFloat totalWeight = 0.; + for (vector<mvmIndexWeight>::const_iterator witer = tds.weights.begin(); + witer != tds.weights.end(); ++witer) { + totalWeight += witer->weight; + } + mvmFloat invTotalWeight; + if (totalWeight == 0.) { + if(mvmFullDebug) errMsg("MeanValueMeshCoords::computeWeights","totalWeight == 0"); + invTotalWeight = 0.0; + } else { + invTotalWeight = 1.0/totalWeight; + } + + for (vector<mvmIndexWeight>::iterator viter = tds.weights.begin(); + viter != tds.weights.end(); ++viter) { + viter->weight *= invTotalWeight; + //assert(finite(viter->weight) != 0); + if(!finite(viter->weight)) viter->weight=0.; + } +} + +void MeanValueMeshCoords::transfer(vector<ntlVec3Gfx> &vertices, vector<ntlVec3Gfx>& displacements) +{ + displacements.resize(0); + + //debMsgStd("MeanValueMeshCoords::transfer",DM_MSG,"vertices:"<<mNumVerts<<" curr_verts:"<<vertices.size()<<" ",7 ); + if((int)vertices.size() != mNumVerts) { + errMsg("MeanValueMeshCoords::transfer","Different no of verts: "<<vertices.size()<<" vs "<<mNumVerts); + return; + } + + for (vector<mvmTransferPoint>::iterator titer = mVertices.begin(); titer != mVertices.end(); ++titer) { + mvmTransferPoint &tds = *titer; + ntlVec3Gfx newpos(0.0); + + for (vector<mvmIndexWeight>::iterator witer = tds.weights.begin(); + witer != tds.weights.end(); ++witer) { + newpos += vertices[witer->index] * witer->weight; + //errMsg("transfer","np"<<newpos<<" v"<<vertices[witer->index]<<" w"<< witer->weight); + } + + displacements.push_back(newpos); + //displacements.push_back(newpos - tds.lastpos); + //tds.lastpos = newpos; + } +} + diff --git a/intern/elbeem/intern/mvmcoords.h b/intern/elbeem/intern/mvmcoords.h new file mode 100644 index 00000000000..889f5058a09 --- /dev/null +++ b/intern/elbeem/intern/mvmcoords.h @@ -0,0 +1,89 @@ +/****************************************************************************** + * +// El'Beem - the visual lattice boltzmann freesurface simulator +// All code distributed as part of El'Beem is covered by the version 2 of the +// GNU General Public License. See the file COPYING for details. +// +// Copyright 2008 Nils Thuerey , Richard Keiser, Mark Pauly, Ulrich Ruede +// + * + * Mean Value Mesh Coords class + * + *****************************************************************************/ + +#ifndef MVMCOORDS_H +#define MVMCOORDS_H + +#include "utilities.h" +#include "ntl_ray.h" +#include <vector> +#define mvmFloat double + +#ifdef WIN32 +#ifndef FREE_WINDOWS +#include "float.h" +#define isnan(n) _isnan(n) +#define finite _finite +#endif +#endif + +#ifdef sun +#include "ieeefp.h" +#endif + +// weight and triangle index +class mvmIndexWeight { + public: + + mvmIndexWeight() : weight(0.0) {} + + mvmIndexWeight(int const& i, mvmFloat const& w) : + weight(w), index(i) {} + + // for sorting + bool operator> (mvmIndexWeight const& w) const { return this->weight > w.weight; } + bool operator< (mvmIndexWeight const& w) const { return this->weight < w.weight; } + + mvmFloat weight; + int index; +}; + +// transfer point with weights +class mvmTransferPoint { + public: + //! position of transfer point + ntlVec3Gfx lastpos; + //! triangle weights + std::vector<mvmIndexWeight> weights; +}; + + +//! compute mvmcs +class MeanValueMeshCoords { + + public: + + MeanValueMeshCoords() {} + ~MeanValueMeshCoords() { + clear(); + } + + void clear(); + + void calculateMVMCs(std::vector<ntlVec3Gfx> &reference_vertices, + std::vector<ntlTriangle> &tris, std::vector<ntlVec3Gfx> &points, gfxReal numweights); + + void transfer(std::vector<ntlVec3Gfx> &vertices, std::vector<ntlVec3Gfx>& displacements); + + protected: + + void computeWeights(std::vector<ntlVec3Gfx> &reference_vertices, + std::vector<ntlTriangle> &tris, mvmTransferPoint& tds, gfxReal numweights); + + std::vector<mvmTransferPoint> mVertices; + int mNumVerts; + +}; + +#endif + diff --git a/intern/elbeem/intern/ntl_geometryclass.h b/intern/elbeem/intern/ntl_geometryclass.h index 9282371d183..545f8c1d54f 100644 --- a/intern/elbeem/intern/ntl_geometryclass.h +++ b/intern/elbeem/intern/ntl_geometryclass.h @@ -37,6 +37,7 @@ class ntlGeometryClass //! Default destructor virtual ~ntlGeometryClass() { delete mpAttrs; + delete mpSwsAttrs; }; //! Return type id diff --git a/intern/elbeem/intern/ntl_geometryobject.cpp b/intern/elbeem/intern/ntl_geometryobject.cpp index f2ebd572682..c7a222af3e5 100644 --- a/intern/elbeem/intern/ntl_geometryobject.cpp +++ b/intern/elbeem/intern/ntl_geometryobject.cpp @@ -41,7 +41,9 @@ ntlGeometryObject::ntlGeometryObject() : mCachedMovPoints(), mCachedMovNormals(), mTriangleDivs1(), mTriangleDivs2(), mTriangleDivs3(), mMovPntsInited(-100.0), mMaxMovPnt(-1), - mcGeoActive(1.) + mcGeoActive(1.), + mCpsTimeStart(0.), mCpsTimeEnd(1.0), mCpsQuality(10.), + mcAttrFStr(0.),mcAttrFRad(0.), mcVelFStr(0.), mcVelFRad(0.) { }; @@ -82,20 +84,21 @@ bool ntlGeometryObject::checkIsAnimated() { /*****************************************************************************/ /* Init attributes etc. of this object */ /*****************************************************************************/ -#define GEOINIT_STRINGS 9 +#define GEOINIT_STRINGS 10 static const char *initStringStrs[GEOINIT_STRINGS] = { "fluid", "bnd_no","bnd_noslip", "bnd_free","bnd_freeslip", "bnd_part","bnd_partslip", - "inflow", "outflow" + "inflow", "outflow", "control", }; static int initStringTypes[GEOINIT_STRINGS] = { FGI_FLUID, FGI_BNDNO, FGI_BNDNO, FGI_BNDFREE, FGI_BNDFREE, FGI_BNDPART, FGI_BNDPART, - FGI_MBNDINFLOW, FGI_MBNDOUTFLOW + FGI_MBNDINFLOW, FGI_MBNDOUTFLOW, + FGI_CONTROL }; void ntlGeometryObject::initialize(ntlRenderGlobals *glob) { @@ -330,7 +333,11 @@ void ntlGeometryObject::sceneAddTriangleNoVert(int *trips, void ntlGeometryObject::initChannels( int nTrans, float *trans, int nRot, float *rot, int nScale, float *scale, - int nAct, float *act, int nIvel, float *ivel + int nAct, float *act, int nIvel, float *ivel, + int nAttrFStr, float *attrFStr, + int nAttrFRad, float *attrFRad, + int nVelFStr, float *velFStr, + int nVelFRad, float *velFRad ) { const bool debugInitc=true; if(debugInitc) { debMsgStd("ntlGeometryObject::initChannels",DM_MSG,"nt:"<<nTrans<<" nr:"<<nRot<<" ns:"<<nScale, 10); @@ -343,8 +350,15 @@ void ntlGeometryObject::initChannels( if((scale)&&(nScale>0)) { ADD_CHANNEL_VEC(mcScale, nScale, scale); } if((act)&&(nAct>0)) { ADD_CHANNEL_FLOAT(mcGeoActive, nAct, act); } if((ivel)&&(nIvel>0)) { ADD_CHANNEL_VEC(mcInitialVelocity, nIvel, ivel); } + + /* fluid control channels */ + if((attrFStr)&&(nAttrFStr>0)) { ADD_CHANNEL_FLOAT(mcAttrFStr, nAttrFStr, attrFStr); } + if((attrFRad)&&(nAttrFRad>0)) { ADD_CHANNEL_FLOAT(mcAttrFRad, nAttrFRad, attrFRad); } + if((velFStr)&&(nVelFStr>0)) { ADD_CHANNEL_FLOAT(mcVelFStr, nAct, velFStr); } + if((velFRad)&&(nVelFRad>0)) { ADD_CHANNEL_FLOAT(mcVelFRad, nVelFRad, velFRad); } checkIsAnimated(); + if(debugInitc) { debMsgStd("ntlGeometryObject::initChannels",DM_MSG,getName()<< " nt:"<<mcTrans.accessValues().size()<<" nr:"<<mcRot.accessValues().size()<< @@ -565,7 +579,7 @@ void ntlGeometryObject::initMovingPoints(double time, gfxReal featureSize) { } } - if( (this-getMeshAnimated()) + if( (this->getMeshAnimated()) || (mcTrans.accessValues().size()>1) // VALIDATE || (mcRot.accessValues().size()>1) || (mcScale.accessValues().size()>1) diff --git a/intern/elbeem/intern/ntl_geometryobject.h b/intern/elbeem/intern/ntl_geometryobject.h index a5afd6b2207..666798385f6 100644 --- a/intern/elbeem/intern/ntl_geometryobject.h +++ b/intern/elbeem/intern/ntl_geometryobject.h @@ -97,11 +97,37 @@ class ntlGeometryObject : public ntlGeometryClass /*! Set/get the local inivel coords flag */ inline bool getLocalCoordInivel() const { return mLocalCoordInivel; } inline void setLocalCoordInivel(bool set) { mLocalCoordInivel=set; } - + + /****************************************/ + /* fluid control features */ + /****************************************/ + /*! Set/get the particle control set attract force strength */ + inline float getCpsTimeStart() const { return mCpsTimeStart; } + inline void setCpsTimeStart(float set) { mCpsTimeStart=set; } + + /*! Set/get the particle control set attract force strength */ + inline float getCpsTimeEnd() const { return mCpsTimeEnd; } + inline void setCpsTimeEnd(float set) { mCpsTimeEnd=set; } + + /*! Set/get the particle control set quality */ + inline float getCpsQuality() const { return mCpsQuality; } + inline void setCpsQuality(float set) { mCpsQuality=set; } + + inline AnimChannel<float> getCpsAttrFStr() const { return mcAttrFStr; } + inline AnimChannel<float> getCpsAttrFRad() const { return mcAttrFRad; } + inline AnimChannel<float> getCpsVelFStr() const { return mcVelFStr; } + inline AnimChannel<float> getCpsVelFRad() const { return mcVelFRad; } + + /****************************************/ + /*! Init channels from float arrays (for elbeem API) */ void initChannels( int nTrans, float *trans, int nRot, float *rot, int nScale, float *scale, - int nAct, float *act, int nIvel, float *ivel + int nAct, float *act, int nIvel, float *ivel, + int nAttrFStr, float *attrFStr, + int nAttrFRad, float *attrFRad, + int nVelFStr, float *velFStr, + int nVelFRad, float *velFRad ); /*! is the object animated? */ @@ -202,6 +228,12 @@ class ntlGeometryObject : public ntlGeometryClass /*! animated channels for in/outflow on/off */ AnimChannel<float> mcGeoActive; + + /* fluid control settings */ + float mCpsTimeStart; + float mCpsTimeEnd; + float mCpsQuality; + AnimChannel<float> mcAttrFStr, mcAttrFRad, mcVelFStr, mcVelFRad; public: diff --git a/intern/elbeem/intern/ntl_ray.cpp b/intern/elbeem/intern/ntl_ray.cpp index d6593b6b335..242b82085be 100644 --- a/intern/elbeem/intern/ntl_ray.cpp +++ b/intern/elbeem/intern/ntl_ray.cpp @@ -688,7 +688,8 @@ ntlScene::~ntlScene() if(mpTree != NULL) delete mpTree; // cleanup lists, only if this is the rendering cleanup scene - if(mSceneDel) { + if(mSceneDel) + { for (vector<ntlGeometryClass*>::iterator iter = mGeos.begin(); iter != mGeos.end(); iter++) { //errMsg("ntlScene::~ntlScene","Deleting obj "<<(*iter)->getName() ); diff --git a/intern/elbeem/intern/ntl_ray.h b/intern/elbeem/intern/ntl_ray.h index 096d5fd61d3..9b77fdcae28 100644 --- a/intern/elbeem/intern/ntl_ray.h +++ b/intern/elbeem/intern/ntl_ray.h @@ -20,6 +20,7 @@ class ntlRay; class ntlTree; class ntlScene; class ntlRenderGlobals; +class ntlGeometryObject; //! store data for an intersection of a ray and a triangle // NOT YET USED @@ -323,8 +324,8 @@ public: /* CONSTRUCTORS */ /*! Default constructor */ ntlScene( ntlRenderGlobals *glob, bool del=true ); - /*! Default destructor */ - ~ntlScene(); + /*! Default destructor */ + ~ntlScene(); /*! Add an object to the scene */ inline void addGeoClass(ntlGeometryClass *geo) { diff --git a/intern/elbeem/intern/ntl_vector3dim.h b/intern/elbeem/intern/ntl_vector3dim.h index 27c3be0d71f..6f17f9f5e7b 100644 --- a/intern/elbeem/intern/ntl_vector3dim.h +++ b/intern/elbeem/intern/ntl_vector3dim.h @@ -825,7 +825,7 @@ template<class T> inline ntlColor vec2Col(T v) { return ntlColor(v[0],v[1],v[2]) #endif #endif #endif - + #if GFX_PRECISION==1 typedef float gfxReal; #define GFX_REAL_MAX __FLT_MAX__ diff --git a/intern/elbeem/intern/ntl_world.cpp b/intern/elbeem/intern/ntl_world.cpp index 21d9d63aac0..c7aa3495c93 100644 --- a/intern/elbeem/intern/ntl_world.cpp +++ b/intern/elbeem/intern/ntl_world.cpp @@ -236,10 +236,15 @@ ntlWorld::~ntlWorld() { delete mpGlob->getRenderScene(); delete mpGlob->getSimScene(); - delete mpGlob; - delete mpLightList; - delete mpPropList; - delete mpSims; + + delete mpGlob; + + + // these get assigned to mpGlob but not freed there + delete mpLightList; + delete mpPropList; // materials + delete mpSims; + #ifndef NOGUI if(mpOpenGLRenderer) delete mpOpenGLRenderer; #endif // NOGUI @@ -895,6 +900,8 @@ ntlRenderGlobals::ntlRenderGlobals() : ntlRenderGlobals::~ntlRenderGlobals() { if(mpOpenGlAttr) delete mpOpenGlAttr; if(mpBlenderAttr) delete mpBlenderAttr; + + } diff --git a/intern/elbeem/intern/simulation_object.cpp b/intern/elbeem/intern/simulation_object.cpp index 9b47ae696af..81e056771fc 100644 --- a/intern/elbeem/intern/simulation_object.cpp +++ b/intern/elbeem/intern/simulation_object.cpp @@ -58,7 +58,8 @@ SimulationObject::~SimulationObject() if(mpGiTree) delete mpGiTree; if(mpElbeemSettings) delete mpElbeemSettings; if(mpLbm) delete mpLbm; - if(mpParam) delete mpParam; + if(mpParam) delete mpParam; + if(mpParts) delete mpParts; debMsgStd("SimulationObject",DM_MSG,"El'Beem Done!\n",10); } diff --git a/intern/elbeem/intern/solver_adap.cpp b/intern/elbeem/intern/solver_adap.cpp index 5616d805232..ef516a578bd 100644 --- a/intern/elbeem/intern/solver_adap.cpp +++ b/intern/elbeem/intern/solver_adap.cpp @@ -11,9 +11,7 @@ #include "solver_relax.h" #include "particletracer.h" -#if (defined (__sun__) || defined (__sun)) || (!defined(linux) && (defined (__sparc) || defined (__sparc__))) -#include <ieeefp.h> -#endif + /*****************************************************************************/ //! coarse step functions diff --git a/intern/elbeem/intern/solver_class.h b/intern/elbeem/intern/solver_class.h index d46f065adfd..f61ef72e8ab 100644 --- a/intern/elbeem/intern/solver_class.h +++ b/intern/elbeem/intern/solver_class.h @@ -100,11 +100,14 @@ // sirdude fix for solaris #if !defined(linux) && defined(sun) +#include "ieeefp.h" #ifndef expf #define expf(x) exp((double)(x)) #endif #endif +#include "solver_control.h" + #if LBM_INCLUDE_TESTSOLVERS==1 #include "solver_test.h" #endif // LBM_INCLUDE_TESTSOLVERS==1 @@ -497,6 +500,12 @@ class LbmFsgrSolver : LbmFloat& debRAC(LbmFloat* s,int l); # endif // FSGR_STRICT_DEBUG==1 + LbmControlData *mpControl; + + void initCpdata(); + void handleCpdata(); + void cpDebugDisplay(int dispset); + bool mUseTestdata; # if LBM_INCLUDE_TESTSOLVERS==1 // test functions @@ -506,10 +515,6 @@ class LbmFsgrSolver : void handleTestdata(); void set3dHeight(int ,int ); - void initCpdata(); - void handleCpdata(); - void cpDebugDisplay(int dispset); - int mMpNum,mMpIndex; int mOrgSizeX; LbmFloat mOrgStartX; diff --git a/intern/elbeem/intern/solver_control.cpp b/intern/elbeem/intern/solver_control.cpp new file mode 100644 index 00000000000..d3f5598e6dc --- /dev/null +++ b/intern/elbeem/intern/solver_control.cpp @@ -0,0 +1,1020 @@ +/****************************************************************************** + * + * El'Beem - the visual lattice boltzmann freesurface simulator + * All code distributed as part of El'Beem is covered by the version 2 of the + * GNU General Public License. See the file COPYING for details. + * + * Copyright 2003-2008 Nils Thuerey + * + * control extensions + * + *****************************************************************************/ +#include "solver_class.h" +#include "solver_relax.h" +#include "particletracer.h" + +#include "solver_control.h" + +#include "controlparticles.h" + +#include "elbeem.h" + +#include "ntl_geometrymodel.h" + +/****************************************************************************** + * LbmControlData control set + *****************************************************************************/ + +LbmControlSet::LbmControlSet() : + mCparts(NULL), mCpmotion(NULL), mContrPartFile(""), mCpmotionFile(""), + mcForceAtt(0.), mcForceVel(0.), mcForceMaxd(0.), + mcRadiusAtt(0.), mcRadiusVel(0.), mcRadiusMind(0.), mcRadiusMaxd(0.), + mcCpScale(1.), mcCpOffset(0.) +{ +} +LbmControlSet::~LbmControlSet() { + if(mCparts) delete mCparts; + if(mCpmotion) delete mCpmotion; +} +void LbmControlSet::initCparts() { + mCparts = new ControlParticles(); + mCpmotion = new ControlParticles(); +} + + + +/****************************************************************************** + * LbmControlData control + *****************************************************************************/ + +LbmControlData::LbmControlData() : + mSetForceStrength(0.), + mCons(), + mCpUpdateInterval(8), // DG: was 16 --> causes problems (big sphere after some time), unstable + mCpOutfile(""), + mCpForces(), mCpKernel(), mMdKernel(), + mDiffVelCon(1.), + mDebugCpscale(0.), + mDebugVelScale(0.), + mDebugCompavScale(0.), + mDebugAttScale(0.), + mDebugMaxdScale(0.), + mDebugAvgVelScale(0.) +{ +} + +LbmControlData::~LbmControlData() +{ + while (!mCons.empty()) { + delete mCons.back(); mCons.pop_back(); + } +} + + +void LbmControlData::parseControldataAttrList(AttributeList *attr) { + // controlpart vars + mSetForceStrength = attr->readFloat("tforcestrength", mSetForceStrength,"LbmControlData", "mSetForceStrength", false); + //errMsg("tforcestrength set to "," "<<mSetForceStrength); + mCpUpdateInterval = attr->readInt("controlparticle_updateinterval", mCpUpdateInterval,"LbmControlData","mCpUpdateInterval", false); + // tracer output file + mCpOutfile = attr->readString("controlparticle_outfile",mCpOutfile,"LbmControlData","mCpOutfile", false); + if(getenv("ELBEEM_CPOUTFILE")) { + string outfile(getenv("ELBEEM_CPOUTFILE")); + mCpOutfile = outfile; + debMsgStd("LbmControlData::parseAttrList",DM_NOTIFY,"Using envvar ELBEEM_CPOUTFILE to set mCpOutfile to "<<outfile<<","<<mCpOutfile,7); + } + + for(int cpii=0; cpii<10; cpii++) { + string suffix(""); + //if(cpii>0) + { suffix = string("0"); suffix[0]+=cpii; } + LbmControlSet *cset; + cset = new LbmControlSet(); + cset->initCparts(); + + cset->mContrPartFile = attr->readString("controlparticle"+suffix+"_file",cset->mContrPartFile,"LbmControlData","cset->mContrPartFile", false); + if((cpii==0) && (getenv("ELBEEM_CPINFILE")) ) { + string infile(getenv("ELBEEM_CPINFILE")); + cset->mContrPartFile = infile; + debMsgStd("LbmControlData::parseAttrList",DM_NOTIFY,"Using envvar ELBEEM_CPINFILE to set mContrPartFile to "<<infile<<","<<cset->mContrPartFile,7); + } + + LbmFloat cpvort=0.; + cset->mcRadiusAtt = attr->readChannelSinglePrecFloat("controlparticle"+suffix+"_radiusatt", 0., "LbmControlData","mcRadiusAtt" ); + cset->mcRadiusVel = attr->readChannelSinglePrecFloat("controlparticle"+suffix+"_radiusvel", 0., "LbmControlData","mcRadiusVel" ); + cset->mcRadiusVel = attr->readChannelSinglePrecFloat("controlparticle"+suffix+"_radiusvel", 0., "LbmControlData","mcRadiusVel" ); + cset->mCparts->setRadiusAtt(cset->mcRadiusAtt.get(0.)); + cset->mCparts->setRadiusVel(cset->mcRadiusVel.get(0.)); + + // WARNING currently only for first set + //if(cpii==0) { + cset->mcForceAtt = attr->readChannelSinglePrecFloat("controlparticle"+suffix+"_attraction", 0. , "LbmControlData","cset->mcForceAtt", false); + cset->mcForceVel = attr->readChannelSinglePrecFloat("controlparticle"+suffix+"_velocity", 0. , "LbmControlData","mcForceVel", false); + cset->mcForceMaxd = attr->readChannelSinglePrecFloat("controlparticle"+suffix+"_maxdist", 0. , "LbmControlData","mcForceMaxd", false); + cset->mCparts->setInfluenceAttraction(cset->mcForceAtt.get(0.) ); + // warning - stores temprorarily, value converted to dt dep. factor + cset->mCparts->setInfluenceVelocity(cset->mcForceVel.get(0.) , 0.01 ); // dummy dt + cset->mCparts->setInfluenceMaxdist(cset->mcForceMaxd.get(0.) ); + cpvort = attr->readFloat("controlparticle"+suffix+"_vorticity", cpvort, "LbmControlData","cpvort", false); + cset->mCparts->setInfluenceTangential(cpvort); + + cset->mcRadiusMind = attr->readChannelSinglePrecFloat("controlparticle"+suffix+"_radiusmin", cset->mcRadiusMind.get(0.), "LbmControlData","mcRadiusMind", false); + cset->mcRadiusMaxd = attr->readChannelSinglePrecFloat("controlparticle"+suffix+"_radiusmax", cset->mcRadiusMind.get(0.), "LbmControlData","mcRadiusMaxd", false); + cset->mCparts->setRadiusMinMaxd(cset->mcRadiusMind.get(0.)); + cset->mCparts->setRadiusMaxd(cset->mcRadiusMaxd.get(0.)); + //} + + // now local... + //LbmVec cpOffset(0.), cpScale(1.); + LbmFloat cpTimescale = 1.; + string cpMirroring(""); + + //cset->mcCpOffset = attr->readChannelVec3f("controlparticle"+suffix+"_offset", ntlVec3f(0.),"LbmControlData","mcCpOffset", false); + //cset->mcCpScale = attr->readChannelVec3f("controlparticle"+suffix+"_scale", ntlVec3f(1.), "LbmControlData","mcCpScale", false); + cset->mcCpOffset = attr->readChannelVec3f("controlparticle"+suffix+"_offset", ntlVec3f(0.),"LbmControlData","mcCpOffset", false); + cset->mcCpScale = attr->readChannelVec3f("controlparticle"+suffix+"_scale", ntlVec3f(1.), "LbmControlData","mcCpScale", false); + cpTimescale = attr->readFloat("controlparticle"+suffix+"_timescale", cpTimescale, "LbmControlData","cpTimescale", false); + cpMirroring = attr->readString("controlparticle"+suffix+"_mirror", cpMirroring, "LbmControlData","cpMirroring", false); + + LbmFloat cpsWidth = cset->mCparts->getCPSWith(); + cpsWidth = attr->readFloat("controlparticle"+suffix+"_cpswidth", cpsWidth, "LbmControlData","cpsWidth", false); + LbmFloat cpsDt = cset->mCparts->getCPSTimestep(); + cpsDt = attr->readFloat("controlparticle"+suffix+"_cpstimestep", cpsDt, "LbmControlData","cpsDt", false); + LbmFloat cpsTstart = cset->mCparts->getCPSTimeStart(); + cpsTstart = attr->readFloat("controlparticle"+suffix+"_cpststart", cpsTstart, "LbmControlData","cpsTstart", false); + LbmFloat cpsTend = cset->mCparts->getCPSTimeEnd(); + cpsTend = attr->readFloat("controlparticle"+suffix+"_cpstend", cpsTend, "LbmControlData","cpsTend", false); + LbmFloat cpsMvmfac = cset->mCparts->getCPSMvmWeightFac(); + cpsMvmfac = attr->readFloat("controlparticle"+suffix+"_cpsmvmfac", cpsMvmfac, "LbmControlData","cpsMvmfac", false); + cset->mCparts->setCPSWith(cpsWidth); + cset->mCparts->setCPSTimestep(cpsDt); + cset->mCparts->setCPSTimeStart(cpsTstart); + cset->mCparts->setCPSTimeEnd(cpsTend); + cset->mCparts->setCPSMvmWeightFac(cpsMvmfac); + + cset->mCparts->setOffset( vec2L(cset->mcCpOffset.get(0.)) ); + cset->mCparts->setScale( vec2L(cset->mcCpScale.get(0.)) ); + cset->mCparts->setInitTimeScale( cpTimescale ); + cset->mCparts->setInitMirror( cpMirroring ); + + int mDebugInit = 0; + mDebugInit = attr->readInt("controlparticle"+suffix+"_debuginit", mDebugInit,"LbmControlData","mDebugInit", false); + cset->mCparts->setDebugInit(mDebugInit); + + // motion particle settings + LbmVec mcpOffset(0.), mcpScale(1.); + LbmFloat mcpTimescale = 1.; + string mcpMirroring(""); + + cset->mCpmotionFile = attr->readString("cpmotion"+suffix+"_file",cset->mCpmotionFile,"LbmControlData","mCpmotionFile", false); + mcpTimescale = attr->readFloat("cpmotion"+suffix+"_timescale", mcpTimescale, "LbmControlData","mcpTimescale", false); + mcpMirroring = attr->readString("cpmotion"+suffix+"_mirror", mcpMirroring, "LbmControlData","mcpMirroring", false); + mcpOffset = vec2L( attr->readVec3d("cpmotion"+suffix+"_offset", vec2P(mcpOffset),"LbmControlData","cpOffset", false) ); + mcpScale = vec2L( attr->readVec3d("cpmotion"+suffix+"_scale", vec2P(mcpScale), "LbmControlData","cpScale", false) ); + + cset->mCpmotion->setOffset( vec2L(mcpOffset) ); + cset->mCpmotion->setScale( vec2L(mcpScale) ); + cset->mCpmotion->setInitTimeScale( mcpTimescale ); + cset->mCpmotion->setInitMirror( mcpMirroring ); + + if(cset->mContrPartFile.length()>1) { + errMsg("LbmControlData","Using control particle set "<<cpii<<" file:"<<cset->mContrPartFile<<" cpmfile:"<<cset->mCpmotionFile<<" mirr:'"<<cset->mCpmotion->getInitMirror()<<"' " ); + mCons.push_back( cset ); + } else { + delete cset; + } + } + + // debug, testing - make sure theres at least an empty set + if(mCons.size()<1) { + mCons.push_back( new LbmControlSet() ); + mCons[0]->initCparts(); + } + + // take from first set + for(int cpii=1; cpii<(int)mCons.size(); cpii++) { + mCons[cpii]->mCparts->setRadiusMinMaxd( mCons[0]->mCparts->getRadiusMinMaxd() ); + mCons[cpii]->mCparts->setRadiusMaxd( mCons[0]->mCparts->getRadiusMaxd() ); + mCons[cpii]->mCparts->setInfluenceAttraction( mCons[0]->mCparts->getInfluenceAttraction() ); + mCons[cpii]->mCparts->setInfluenceTangential( mCons[0]->mCparts->getInfluenceTangential() ); + mCons[cpii]->mCparts->setInfluenceVelocity( mCons[0]->mCparts->getInfluenceVelocity() , 0.01 ); // dummy dt + mCons[cpii]->mCparts->setInfluenceMaxdist( mCons[0]->mCparts->getInfluenceMaxdist() ); + } + + // invert for usage in relax macro + mDiffVelCon = 1.-attr->readFloat("cpdiffvelcon", mDiffVelCon, "LbmControlData","mDiffVelCon", false); + + mDebugCpscale = attr->readFloat("cpdebug_cpscale", mDebugCpscale, "LbmControlData","mDebugCpscale", false); + mDebugMaxdScale = attr->readFloat("cpdebug_maxdscale", mDebugMaxdScale, "LbmControlData","mDebugMaxdScale", false); + mDebugAttScale = attr->readFloat("cpdebug_attscale", mDebugAttScale, "LbmControlData","mDebugAttScale", false); + mDebugVelScale = attr->readFloat("cpdebug_velscale", mDebugVelScale, "LbmControlData","mDebugVelScale", false); + mDebugCompavScale = attr->readFloat("cpdebug_compavscale", mDebugCompavScale, "LbmControlData","mDebugCompavScale", false); + mDebugAvgVelScale = attr->readFloat("cpdebug_avgvelsc", mDebugAvgVelScale, "LbmControlData","mDebugAvgVelScale", false); +} + + +void +LbmFsgrSolver::initCpdata() +{ + // enable for cps via env. vars + //if( (getenv("ELBEEM_CPINFILE")) || (getenv("ELBEEM_CPOUTFILE")) ){ mUseTestdata=1; } + + + // manually switch on! if this is zero, nothing is done... + mpControl->mSetForceStrength = this->mTForceStrength = 1.; + mpControl->mCons.clear(); + + // init all control fluid objects + int numobjs = (int)(mpGiObjects->size()); + for(int o=0; o<numobjs; o++) { + ntlGeometryObjModel *obj = (ntlGeometryObjModel *)(*mpGiObjects)[o]; + if(obj->getGeoInitType() & FGI_CONTROL) { + // add new control set per object + LbmControlSet *cset; + + cset = new LbmControlSet(); + cset->initCparts(); + + // dont load any file + cset->mContrPartFile = string(""); + + cset->mcForceAtt = obj->getCpsAttrFStr(); + cset->mcRadiusAtt = obj->getCpsAttrFRad(); + cset->mcForceVel = obj->getCpsVelFStr(); + cset->mcRadiusVel = obj->getCpsVelFRad(); + + cset->mCparts->setCPSTimeStart(obj->getCpsTimeStart()); + cset->mCparts->setCPSTimeEnd(obj->getCpsTimeEnd()); + + if(obj->getCpsQuality() > LBM_EPSILON) + cset->mCparts->setCPSWith(1.0 / obj->getCpsQuality()); + + // this value can be left at 0.5: + cset->mCparts->setCPSMvmWeightFac(0.5); + + mpControl->mCons.push_back( cset ); + mpControl->mCons[mpControl->mCons.size()-1]->mCparts->initFromObject(obj); + } + } + + // NT blender integration manual test setup + if(0) { + // manually switch on! if this is zero, nothing is done... + mpControl->mSetForceStrength = this->mTForceStrength = 1.; + mpControl->mCons.clear(); + + // add new set + LbmControlSet *cset; + + cset = new LbmControlSet(); + cset->initCparts(); + // dont load any file + cset->mContrPartFile = string(""); + + // set radii for attraction & velocity forces + // set strength of the forces + // don't set directly! but use channels: + // mcForceAtt, mcForceVel, mcForceMaxd, mcRadiusAtt, mcRadiusVel, mcRadiusMind, mcRadiusMaxd etc. + + // wrong: cset->mCparts->setInfluenceAttraction(1.15); cset->mCparts->setRadiusAtt(1.5); + // right, e.g., to init some constant values: + cset->mcForceAtt = AnimChannel<float>(0.2); + cset->mcRadiusAtt = AnimChannel<float>(0.75); + cset->mcForceVel = AnimChannel<float>(0.2); + cset->mcRadiusVel = AnimChannel<float>(0.75); + + // this value can be left at 0.5: + cset->mCparts->setCPSMvmWeightFac(0.5); + + mpControl->mCons.push_back( cset ); + + // instead of reading from file (cset->mContrPartFile), manually init some particles + mpControl->mCons[0]->mCparts->initBlenderTest(); + + // other values that might be interesting to change: + //cset->mCparts->setCPSTimestep(0.02); + //cset->mCparts->setCPSTimeStart(0.); + //cset->mCparts->setCPSTimeEnd(1.); + + //mpControl->mDiffVelCon = 1.; // more rigid velocity control, 0 (default) allows more turbulence + } + + // control particle ------------------------------------------------------------------------------------- + + // init cppf stage, use set 0! + if(mCppfStage>0) { + if(mpControl->mCpOutfile.length()<1) mpControl->mCpOutfile = string("cpout"); // use getOutFilename !? + char strbuf[100]; + const char *cpFormat = "_d%dcppf%d"; + + // initial coarse stage, no input + if(mCppfStage==1) { + mpControl->mCons[0]->mContrPartFile = ""; + } else { + // read from prev stage + snprintf(strbuf,100, cpFormat ,LBMDIM,mCppfStage-1); + mpControl->mCons[0]->mContrPartFile = mpControl->mCpOutfile; + mpControl->mCons[0]->mContrPartFile += strbuf; + mpControl->mCons[0]->mContrPartFile += ".cpart2"; + } + + snprintf(strbuf,100, cpFormat ,LBMDIM,mCppfStage); + mpControl->mCpOutfile += strbuf; + } // */ + + for(int cpssi=0; cpssi<(int)mpControl->mCons.size(); cpssi++) { + ControlParticles *cparts = mpControl->mCons[cpssi]->mCparts; + ControlParticles *cpmotion = mpControl->mCons[cpssi]->mCpmotion; + + // now set with real dt + cparts->setInfluenceVelocity( mpControl->mCons[cpssi]->mcForceVel.get(0.), mLevel[mMaxRefine].timestep); + cparts->setCharLength( mLevel[mMaxRefine].nodeSize ); + cparts->setCharLength( mLevel[mMaxRefine].nodeSize ); + errMsg("LbmControlData","CppfStage "<<mCppfStage<<" in:"<<mpControl->mCons[cpssi]->mContrPartFile<< + " out:"<<mpControl->mCpOutfile<<" cl:"<< cparts->getCharLength() ); + + // control particle test init + if(mpControl->mCons[cpssi]->mCpmotionFile.length()>=1) cpmotion->initFromTextFile(mpControl->mCons[cpssi]->mCpmotionFile); + // not really necessary... + //? cparts->setFluidSpacing( mLevel[mMaxRefine].nodeSize ); // use grid coords!? + //? cparts->calculateKernelWeight(); + //? debMsgStd("LbmFsgrSolver::initCpdata",DM_MSG,"ControlParticles - motion inited: "<<cparts->getSize() ,10); + + // ensure both are on for env. var settings + // when no particles, but outfile enabled, initialize + const int lev = mMaxRefine; + if((mpParticles) && (mpControl->mCpOutfile.length()>=1) && (cpssi==0)) { + // check if auto num + if( (mpParticles->getNumInitialParticles()<=1) && + (mpParticles->getNumParticles()<=1) ) { // initParticles done afterwards anyway + int tracers = 0; + const int workSet = mLevel[lev].setCurr; + FSGR_FORIJK_BOUNDS(lev) { + if(RFLAG(lev,i,j,k, workSet)&(CFFluid)) tracers++; + } + if(LBMDIM==3) tracers /= 8; + else tracers /= 4; + mpParticles->setNumInitialParticles(tracers); + mpParticles->setDumpTextFile(mpControl->mCpOutfile); + debMsgStd("LbmFsgrSolver::initCpdata",DM_MSG,"ControlParticles - set tracers #"<<tracers<<", actual #"<<mpParticles->getNumParticles() ,10); + } + if(mpParticles->getDumpTextInterval()<=0.) { + mpParticles->setDumpTextInterval(mLevel[lev].timestep * mLevel[lev].lSizex); + debMsgStd("LbmFsgrSolver::initCpdata",DM_MSG,"ControlParticles - dump delta t not set, using dti="<< mpParticles->getDumpTextInterval()<<", sim dt="<<mLevel[lev].timestep, 5 ); + } + mpParticles->setDumpParts(true); // DEBUG? also dump as particle system + } + + if(mpControl->mCons[cpssi]->mContrPartFile.length()>=1) cparts->initFromTextFile(mpControl->mCons[cpssi]->mContrPartFile); + cparts->setFluidSpacing( mLevel[lev].nodeSize ); // use grid coords!? + cparts->calculateKernelWeight(); + debMsgStd("LbmFsgrSolver::initCpdata",DM_MSG,"ControlParticles mCons"<<cpssi<<" - inited, parts:"<<cparts->getTotalSize()<<","<<cparts->getSize()<<" dt:"<<mpParam->getTimestep()<<" control time:"<<cparts->getControlTimStart()<<" to "<<cparts->getControlTimEnd() ,10); + } // cpssi + + if(getenv("ELBEEM_CPINFILE")) { + this->mTForceStrength = 1.0; + } + this->mTForceStrength = mpControl->mSetForceStrength; + if(mpControl->mCpOutfile.length()>=1) mpParticles->setDumpTextFile(mpControl->mCpOutfile); + + // control particle init end ------------------------------------------------------------------------------------- + + // make sure equiv to solver init + if(this->mTForceStrength>0.) { \ + mpControl->mCpForces.resize( mMaxRefine+1 ); + for(int lev = 0; lev<=mMaxRefine; lev++) { + LONGINT rcellSize = (mLevel[lev].lSizex*mLevel[lev].lSizey*mLevel[lev].lSizez); + debMsgStd("LbmFsgrSolver::initControl",DM_MSG,"mCpForces init, lev="<<lev<<" rcs:"<<(int)(rcellSize+4)<<","<<(rcellSize*sizeof(ControlForces)/(1024*1024)), 9 ); + mpControl->mCpForces[lev].resize( (int)(rcellSize+4) ); + //for(int i=0 ;i<rcellSize; i++) mpControl->mCpForces.push_back( ControlForces() ); + for(int i=0 ;i<rcellSize; i++) mpControl->mCpForces[lev][i].resetForces(); + } + } // on? + + debMsgStd("LbmFsgrSolver::initCpdata",DM_MSG,"ControlParticles #mCons "<<mpControl->mCons.size()<<" done", 6); +} + + +#define CPODEBUG 0 +//define CPINTER ((int)(mpControl->mCpUpdateInterval)) + +#define KERN(x,y,z) mpControl->mCpKernel[ (((z)*cpkarWidth + (y))*cpkarWidth + (x)) ] +#define MDKERN(x,y,z) mpControl->mMdKernel[ (((z)*mdkarWidth + (y))*mdkarWidth + (x)) ] + +#define BOUNDCHECK(x,low,high) ( ((x)<low) ? low : (((x)>high) ? high : (x) ) ) +#define BOUNDSKIP(x,low,high) ( ((x)<low) || ((x)>high) ) + +void +LbmFsgrSolver::handleCpdata() +{ + myTime_t cpstart = getTime(); + int cpChecks=0; + int cpInfs=0; + //debMsgStd("ControlData::handleCpdata",DM_MSG,"called... "<<this->mTForceStrength,1); + + // add cp influence + if((true) && (this->mTForceStrength>0.)) { + // ok continue... + } // on off + else { + return; + } + + // check if we have control objects + if(mpControl->mCons.size()==0) + return; + + if((mpControl->mCpUpdateInterval<1) || (this->mStepCnt%mpControl->mCpUpdateInterval==0)) { + // do full reinit later on... + } + else if(this->mStepCnt>mpControl->mCpUpdateInterval) { + // only reinit new cells + // TODO !? remove loop dependance!? +#define NOFORCEENTRY(lev, i,j,k) (LBMGET_FORCE(lev, i,j,k).maxDistance==CPF_MAXDINIT) + // interpolate missing + for(int lev=0; lev<=mMaxRefine; lev++) { + FSGR_FORIJK_BOUNDS(lev) { + if( (RFLAG(lev,i,j,k, mLevel[lev].setCurr)) & (CFFluid|CFInter) ) + //if( (RFLAG(lev,i,j,k, mLevel[lev].setCurr)) & (CFInter) ) + //if(0) + { // only check new inter? RFLAG?check + if(NOFORCEENTRY(lev, i,j,k)) { + //errMsg("CP","FE_MISSING at "<<PRINT_IJK<<" f"<<LBMGET_FORCE(lev, i,j,k).weightAtt<<" md"<<LBMGET_FORCE(lev, i,j,k).maxDistance ); + + LbmFloat nbs=0.; + ControlForces vals; + vals.resetForces(); vals.maxDistance = 0.; + for(int l=1; l<this->cDirNum; l++) { + int ni=i+this->dfVecX[l], nj=j+this->dfVecY[l], nk=k+this->dfVecZ[l]; + //errMsg("CP","FE_MISSING check "<<PRINT_VEC(ni,nj,nk)<<" f"<<LBMGET_FORCE(lev, ni,nj,nk).weightAtt<<" md"<<LBMGET_FORCE(lev, ni,nj,nk).maxDistance ); + if(!NOFORCEENTRY(lev, ni,nj,nk)) { + //? vals.weightAtt += LBMGET_FORCE(lev, ni,nj,nk).weightAtt; + //? vals.forceAtt += LBMGET_FORCE(lev, ni,nj,nk).forceAtt; + vals.maxDistance += LBMGET_FORCE(lev, ni,nj,nk).maxDistance; + vals.forceMaxd += LBMGET_FORCE(lev, ni,nj,nk).forceMaxd; + vals.weightVel += LBMGET_FORCE(lev, ni,nj,nk).weightVel; + vals.forceVel += LBMGET_FORCE(lev, ni,nj,nk).forceVel; + // ignore att/compAv/avgVel here for now + nbs += 1.; + } + } + if(nbs>0.) { + nbs = 1./nbs; + //? LBMGET_FORCE(lev, i,j,k).weightAtt = vals.weightAtt*nbs; + //? LBMGET_FORCE(lev, i,j,k).forceAtt = vals.forceAtt*nbs; + LBMGET_FORCE(lev, i,j,k).maxDistance = vals.maxDistance*nbs; + LBMGET_FORCE(lev, i,j,k).forceMaxd = vals.forceMaxd*nbs; + LBMGET_FORCE(lev, i,j,k).weightVel = vals.weightVel*nbs; + LBMGET_FORCE(lev, i,j,k).forceVel = vals.forceVel*nbs; + } + /*ControlForces *ff = &LBMGET_FORCE(lev, i,j,k); // DEBUG + errMsg("CP","FE_MISSING rec at "<<PRINT_IJK // DEBUG + <<" w:"<<ff->weightAtt<<" wa:" <<PRINT_VEC( ff->forceAtt[0],ff->forceAtt[1],ff->forceAtt[2] ) + <<" v:"<<ff->weightVel<<" wv:" <<PRINT_VEC( ff->forceVel[0],ff->forceVel[1],ff->forceVel[2] ) + <<" v:"<<ff->maxDistance<<" wv:" <<PRINT_VEC( ff->forceMaxd[0],ff->forceMaxd[1],ff->forceMaxd[2] ) ); // DEBUG */ + // else errMsg("CP","FE_MISSING rec at "<<PRINT_IJK<<" failed!"); // DEBUG + + } + } + }} // ijk, lev + + // mStepCnt > mpControl->mCpUpdateInterval + return; + } else { + // nothing to do ... + return; + } + + // reset + for(int lev=0; lev<=mMaxRefine; lev++) { + FSGR_FORIJK_BOUNDS(lev) { LBMGET_FORCE(lev,i,j,k).resetForces(); } + } + // do setup for coarsest level + const int coarseLev = 0; + const int fineLev = mMaxRefine; + + // init for current time + for(int cpssi=0; cpssi<(int)mpControl->mCons.size(); cpssi++) { + ControlParticles *cparts = mpControl->mCons[cpssi]->mCparts; + LbmControlSet *cset = mpControl->mCons[cpssi]; + + cparts->setRadiusAtt(cset->mcRadiusAtt.get(mSimulationTime)); + cparts->setRadiusVel(cset->mcRadiusVel.get(mSimulationTime)); + cparts->setInfluenceAttraction(cset->mcForceAtt.get(mSimulationTime) ); + cparts->setInfluenceMaxdist(cset->mcForceMaxd.get(mSimulationTime) ); + cparts->setRadiusMinMaxd(cset->mcRadiusMind.get(mSimulationTime)); + cparts->setRadiusMaxd(cset->mcRadiusMaxd.get(mSimulationTime)); + cparts->calculateKernelWeight(); // always necessary!? + cparts->setOffset( vec2L(cset->mcCpOffset.get(mSimulationTime)) ); + cparts->setScale( vec2L(cset->mcCpScale.get(mSimulationTime)) ); + + cparts->setInfluenceVelocity( cset->mcForceVel.get(mSimulationTime), mLevel[fineLev].timestep ); + cparts->setLastOffset( vec2L(cset->mcCpOffset.get(mSimulationTime-mLevel[fineLev].timestep)) ); + cparts->setLastScale( vec2L(cset->mcCpScale.get(mSimulationTime-mLevel[fineLev].timestep)) ); + + } + + // check actual values + LbmFloat iatt = ABS(mpControl->mCons[0]->mCparts->getInfluenceAttraction()); + LbmFloat ivel = mpControl->mCons[0]->mCparts->getInfluenceVelocity(); + LbmFloat imaxd = mpControl->mCons[0]->mCparts->getInfluenceMaxdist(); + //errMsg("FINCIT","iatt="<<iatt<<" ivel="<<ivel<<" imaxd="<<imaxd); + for(int cpssi=1; cpssi<(int)mpControl->mCons.size(); cpssi++) { + LbmFloat iatt2 = ABS(mpControl->mCons[cpssi]->mCparts->getInfluenceAttraction()); + LbmFloat ivel2 = mpControl->mCons[cpssi]->mCparts->getInfluenceVelocity(); + LbmFloat imaxd2 = mpControl->mCons[cpssi]->mCparts->getInfluenceMaxdist(); + + // we allow negative attraction force here! + if(iatt2 > iatt) iatt = iatt2; + + if(ivel2 >ivel) ivel = ivel2; + if(imaxd2>imaxd) imaxd= imaxd2; + //errMsg("FINCIT"," "<<cpssi<<" iatt2="<<iatt2<<" ivel2="<<ivel2<<" imaxd2="<<imaxd<<" NEW "<<" iatt="<<iatt<<" ivel="<<ivel<<" imaxd="<<imaxd); + } + + if(iatt==0. && ivel==0. && imaxd==0.) { + debMsgStd("ControlData::initControl",DM_MSG,"Skipped, all zero...",4); + return; + } + //iatt = mpControl->mCons[1]->mCparts->getInfluenceAttraction(); //ivel = mpControl->mCons[1]->mCparts->getInfluenceVelocity(); //imaxd = mpControl->mCons[1]->mCparts->getInfluenceMaxdist(); // TTTTTT + + // do control setup + for(int cpssi=0; cpssi<(int)mpControl->mCons.size(); cpssi++) { + ControlParticles *cparts = mpControl->mCons[cpssi]->mCparts; + ControlParticles *cpmotion = mpControl->mCons[cpssi]->mCpmotion; + + // TEST!? + bool radmod = false; + const LbmFloat minRadSize = mLevel[coarseLev].nodeSize * 1.5; + if((cparts->getRadiusAtt()>0.) && (cparts->getRadiusAtt()<minRadSize) && (!radmod) ) { + LbmFloat radfac = minRadSize / cparts->getRadiusAtt(); radmod=true; + debMsgStd("ControlData::initControl",DM_MSG,"Modified radii att, fac="<<radfac, 7); + cparts->setRadiusAtt(cparts->getRadiusAtt()*radfac); + cparts->setRadiusVel(cparts->getRadiusVel()*radfac); + cparts->setRadiusMaxd(cparts->getRadiusMaxd()*radfac); + cparts->setRadiusMinMaxd(cparts->getRadiusMinMaxd()*radfac); + } else if((cparts->getRadiusVel()>0.) && (cparts->getRadiusVel()<minRadSize) && (!radmod) ) { + LbmFloat radfac = minRadSize / cparts->getRadiusVel(); + debMsgStd("ControlData::initControl",DM_MSG,"Modified radii vel, fac="<<radfac, 7); + cparts->setRadiusVel(cparts->getRadiusVel()*radfac); + cparts->setRadiusMaxd(cparts->getRadiusMaxd()*radfac); + cparts->setRadiusMinMaxd(cparts->getRadiusMinMaxd()*radfac); + } else if((cparts->getRadiusMaxd()>0.) && (cparts->getRadiusMaxd()<minRadSize) && (!radmod) ) { + LbmFloat radfac = minRadSize / cparts->getRadiusMaxd(); + debMsgStd("ControlData::initControl",DM_MSG,"Modified radii maxd, fac="<<radfac, 7); + cparts->setRadiusMaxd(cparts->getRadiusMaxd()*radfac); + cparts->setRadiusMinMaxd(cparts->getRadiusMinMaxd()*radfac); + } + if(radmod) { + debMsgStd("ControlData::initControl",DM_MSG,"Modified radii: att="<< + cparts->getRadiusAtt()<<", vel=" << cparts->getRadiusVel()<<", maxd=" << + cparts->getRadiusMaxd()<<", mind=" << cparts->getRadiusMinMaxd() ,5); + } + + cpmotion->prepareControl( mSimulationTime+((LbmFloat)mpControl->mCpUpdateInterval)*(mpParam->getTimestep()), mpParam->getTimestep(), NULL ); + cparts->prepareControl( mSimulationTime+((LbmFloat)mpControl->mCpUpdateInterval)*(mpParam->getTimestep()), mpParam->getTimestep(), cpmotion ); + } + + // do control... + for(int lev=0; lev<=mMaxRefine; lev++) { + LbmFloat levVolume = 1.; + LbmFloat levForceScale = 1.; + for(int ll=lev; ll<mMaxRefine; ll++) { + if(LBMDIM==3) levVolume *= 8.; + else levVolume *= 4.; + levForceScale *= 2.; + } + errMsg("LbmFsgrSolver::handleCpdata","levVolume="<<levVolume<<" levForceScale="<<levForceScale ); + //todo: scale velocity, att by level timestep!? + + for(int cpssi=0; cpssi<(int)mpControl->mCons.size(); cpssi++) { + ControlParticles *cparts = mpControl->mCons[cpssi]->mCparts; + // ControlParticles *cpmotion = mpControl->mCons[cpssi]->mCpmotion; + + // if control set is not active skip it + if((cparts->getControlTimStart() > mSimulationTime) || (cparts->getControlTimEnd() < mLastSimTime)) + { + continue; + } + + const LbmFloat velLatticeScale = mLevel[lev].timestep/mLevel[lev].nodeSize; + LbmFloat gsx = ((mvGeoEnd[0]-mvGeoStart[0])/(LbmFloat)mLevel[lev].lSizex); + LbmFloat gsy = ((mvGeoEnd[1]-mvGeoStart[1])/(LbmFloat)mLevel[lev].lSizey); + LbmFloat gsz = ((mvGeoEnd[2]-mvGeoStart[2])/(LbmFloat)mLevel[lev].lSizez); +#if LBMDIM==2 + gsz = gsx; +#endif + LbmFloat goffx = mvGeoStart[0]; + LbmFloat goffy = mvGeoStart[1]; + LbmFloat goffz = mvGeoStart[2]; + + //const LbmFloat cpwIncFac = 2.0; + // max to two thirds of domain size + const int cpw = MIN( mLevel[lev].lSizex/3, MAX( (int)( cparts->getRadiusAtt() /gsx) +1 , 2) ); // normal kernel, att,vel + const int cpkarWidth = 2*cpw+1; + mpControl->mCpKernel.resize(cpkarWidth* cpkarWidth* cpkarWidth); + ControlParticle cpt; cpt.reset(); + cpt.pos = LbmVec( (gsx*(LbmFloat)cpw)+goffx, (gsy*(LbmFloat)cpw)+goffy, (gsz*(LbmFloat)cpw)+goffz ); // optimize? + cpt.density = 0.5; cpt.densityWeight = 0.5; +#if LBMDIM==3 + for(int k= 0; k<cpkarWidth; ++k) { +#else // LBMDIM==3 + { int k = cpw; +#endif + for(int j= 0; j<cpkarWidth; ++j) + for(int i= 0; i<cpkarWidth; ++i) { + KERN(i,j,k).resetForces(); + //LbmFloat dx = i-cpw; LbmFloat dy = j-cpw; LbmFloat dz = k-cpw; + //LbmVec dv = ( LbmVec(dx,dy,dz) ); + //LbmFloat dl = norm( dv ); //LbmVec dir = dv / dl; + LbmVec pos = LbmVec( (gsx*(LbmFloat)i)+goffx, (gsy*(LbmFloat)j)+goffy, (gsz*(LbmFloat)k)+goffz ); // optimize? + cparts->calculateCpInfluenceOpt( &cpt, pos, LbmVec(0,0,0), &KERN(i,j,k) ,1. ); + /*if((CPODEBUG)&&(k==cpw)) errMsg("kern"," at "<<PRINT_IJK<<" pos"<<pos<<" cpp"<<cpt.pos + <<" wf:"<<KERN(i,j,k).weightAtt<<" wa:"<< PRINT_VEC( KERN(i,j,k).forceAtt[0],KERN(i,j,k).forceAtt[1],KERN(i,j,k).forceAtt[2] ) + <<" wf:"<<KERN(i,j,k).weightVel<<" wa:"<< PRINT_VEC( KERN(i,j,k).forceVel[0],KERN(i,j,k).forceVel[1],KERN(i,j,k).forceVel[2] ) + <<" wf:"<<KERN(i,j,k).maxDistance<<" wa:"<< PRINT_VEC( KERN(i,j,k).forceMaxd[0],KERN(i,j,k).forceMaxd[1],KERN(i,j,k).forceMaxd[2] ) ); // */ + KERN(i,j,k).weightAtt *= 2.; + KERN(i,j,k).forceAtt *= 2.; + //KERN(i,j,k).forceAtt[1] *= 2.; KERN(i,j,k).forceAtt[2] *= 2.; + KERN(i,j,k).weightVel *= 2.; + KERN(i,j,k).forceVel *= 2.; + //KERN(i,j,k).forceVel[1] *= 2.; KERN(i,j,k).forceVel[2] *= 2.; + } + } + + if(CPODEBUG) errMsg("cpw"," = "<<cpw<<" f"<< cparts->getRadiusAtt()<<" gsx"<<gsx<<" kpw"<<cpkarWidth); // DEBUG + // first cp loop - add att and vel forces + for(int cppi=0; cppi<cparts->getSize(); cppi++) { + ControlParticle *cp = cparts->getParticle(cppi); + if(cp->influence<=0.) continue; + const int cpi = (int)( (cp->pos[0]-goffx)/gsx ); + const int cpj = (int)( (cp->pos[1]-goffy)/gsy ); + int cpk = (int)( (cp->pos[2]-goffz)/gsz ); + /*if( ((LBMDIM==3)&&(BOUNDSKIP(cpk - cpwsm, getForZMinBnd(), getForZMaxBnd(lev) ))) || + ((LBMDIM==3)&&(BOUNDSKIP(cpk + cpwsm, getForZMinBnd(), getForZMaxBnd(lev) ))) || + BOUNDSKIP(cpj - cpwsm, 0, mLevel[lev].lSizey ) || + BOUNDSKIP(cpj + cpwsm, 0, mLevel[lev].lSizey ) || + BOUNDSKIP(cpi - cpwsm, 0, mLevel[lev].lSizex ) || + BOUNDSKIP(cpi + cpwsm, 0, mLevel[lev].lSizex ) ) { + continue; + } // */ + int is,ie,js,je,ks,ke; + ks = BOUNDCHECK(cpk - cpw, getForZMinBnd(), getForZMaxBnd(lev) ); + ke = BOUNDCHECK(cpk + cpw, getForZMinBnd(), getForZMaxBnd(lev) ); + js = BOUNDCHECK(cpj - cpw, 0, mLevel[lev].lSizey ); + je = BOUNDCHECK(cpj + cpw, 0, mLevel[lev].lSizey ); + is = BOUNDCHECK(cpi - cpw, 0, mLevel[lev].lSizex ); + ie = BOUNDCHECK(cpi + cpw, 0, mLevel[lev].lSizex ); + if(LBMDIM==2) { cpk = 0; ks = 0; ke = 1; } + if(CPODEBUG) errMsg("cppft","i"<<cppi<<" cpw"<<cpw<<" gpos"<<PRINT_VEC(cpi,cpj,cpk)<<" i:"<<is<<","<<ie<<" j:"<<js<<","<<je<<" k:"<<ks<<","<<ke<<" "); // DEBUG + cpInfs++; + + for(int k= ks; k<ke; ++k) { + for(int j= js; j<je; ++j) { + + CellFlagType *pflag = &RFLAG(lev,is,j,k, mLevel[lev].setCurr); + ControlForces *kk = &KERN( is-cpi+cpw, j-cpj+cpw, k-cpk+cpw); + ControlForces *ff = &LBMGET_FORCE(lev,is,j,k); + pflag--; kk--; ff--; + + for(int i= is; i<ie; ++i) { + // first cp loop (att,vel) + pflag++; kk++; ff++; + + //add weight for bnd cells + const LbmFloat pwforce = kk->weightAtt; + // control particle mod, + // dont add multiple CFFluid fsgr boundaries + if(lev==mMaxRefine) { + //if( ( ((*pflag)&(CFFluid )) && (lev==mMaxRefine) ) || + //( ((*pflag)&(CFGrNorm)) && (lev <mMaxRefine) ) ) { + if((*pflag)&(CFFluid|CFUnused)) { + // check not fromcoarse? + cp->density += levVolume* kk->weightAtt; // old CFFluid + } else if( (*pflag) & (CFEmpty) ) { + cp->density -= levVolume* 0.5; + } else { //if( ((*pflag) & (CFBnd)) ) { + cp->density -= levVolume* 0.2; // penalty + } + } else { + //if((*pflag)&(CFGrNorm)) { + //cp->density += levVolume* kk->weightAtt; // old CFFluid + //} + } + //else if(!((*pflag) & (CFUnused)) ) { cp->density -= levVolume* 0.2; } // penalty + + if( (*pflag) & (CFFluid|CFInter) ) // RFLAG_check + { + + cpChecks++; + //const LbmFloat pwforce = kk->weightAtt; + LbmFloat pwvel = kk->weightVel; + if((pwforce==0.)&&(pwvel==0.)) { continue; } + ff->weightAtt += 1e-6; // for distance + + if(pwforce>0.) { + ff->weightAtt += pwforce *cp->densityWeight *cp->influence; + ff->forceAtt += kk->forceAtt *levForceScale *cp->densityWeight *cp->influence; + + // old fill handling here + const int workSet =mLevel[lev].setCurr; + LbmFloat ux=0., uy=0., uz=0.; + FORDF1{ + const LbmFloat dfn = QCELL(lev, i,j,k, workSet, l); + ux += (this->dfDvecX[l]*dfn); + uy += (this->dfDvecY[l]*dfn); + uz += (this->dfDvecZ[l]*dfn); + } + // control particle mod + cp->avgVelWeight += levVolume*pwforce; + cp->avgVelAcc += LbmVec(ux,uy,uz) * levVolume*pwforce; + } + + if(pwvel>0.) { + // TODO make switch? vel.influence depends on density weight... + // (reduced lowering with 0.75 factor) + pwvel *= cp->influence *(1.-0.75*cp->densityWeight); + // control particle mod + // todo use Omega instead!? + ff->forceVel += cp->vel*levVolume*pwvel * velLatticeScale; // levVolume? + ff->weightVel += levVolume*pwvel; // levVolume? + ff->compAv += cp->avgVel*levVolume*pwvel; // levVolume? + ff->compAvWeight += levVolume*pwvel; // levVolume? + } + + if(CPODEBUG) errMsg("cppft","i"<<cppi<<" at "<<PRINT_IJK<<" kern:"<< + PRINT_VEC(i-cpi+cpw, j-cpj+cpw, k-cpk+cpw ) + //<<" w:"<<ff->weightAtt<<" wa:" + //<<PRINT_VEC( ff->forceAtt[0],ff->forceAtt[1],ff->forceAtt[2] ) + //<<" v:"<<ff->weightVel<<" wv:" + //<<PRINT_VEC( ff->forceVel[0],ff->forceVel[1],ff->forceVel[2] ) + //<<" v:"<<ff->maxDistance<<" wv:" + //<<PRINT_VEC( ff->forceMaxd[0],ff->forceMaxd[1],ff->forceMaxd[2] ) + ); + } // celltype + + } // ijk + } // ijk + } // ijk + } // cpi, end first cp loop (att,vel) + debMsgStd("LbmFsgrSolver::handleCpdata",DM_MSG,"Force cpgrid "<<cpssi<<" generated checks:"<<cpChecks<<" infs:"<<cpInfs ,9); + } //cpssi + } // lev + + // second loop + for(int lev=0; lev<=mMaxRefine; lev++) { + LbmFloat levVolume = 1.; + LbmFloat levForceScale = 1.; + for(int ll=lev; ll<mMaxRefine; ll++) { + if(LBMDIM==3) levVolume *= 8.; + else levVolume *= 4.; + levForceScale *= 2.; + } + // prepare maxd forces + for(int cpssi=0; cpssi<(int)mpControl->mCons.size(); cpssi++) { + ControlParticles *cparts = mpControl->mCons[cpssi]->mCparts; + + // WARNING copied from above! + const LbmFloat velLatticeScale = mLevel[lev].timestep/mLevel[lev].nodeSize; + LbmFloat gsx = ((mvGeoEnd[0]-mvGeoStart[0])/(LbmFloat)mLevel[lev].lSizex); + LbmFloat gsy = ((mvGeoEnd[1]-mvGeoStart[1])/(LbmFloat)mLevel[lev].lSizey); + LbmFloat gsz = ((mvGeoEnd[2]-mvGeoStart[2])/(LbmFloat)mLevel[lev].lSizez); +#if LBMDIM==2 + gsz = gsx; +#endif + LbmFloat goffx = mvGeoStart[0]; + LbmFloat goffy = mvGeoStart[1]; + LbmFloat goffz = mvGeoStart[2]; + + //const LbmFloat cpwIncFac = 2.0; + const int mdw = MIN( mLevel[lev].lSizex/2, MAX( (int)( cparts->getRadiusMaxd() /gsx) +1 , 2) ); // wide kernel, md + const int mdkarWidth = 2*mdw+1; + mpControl->mMdKernel.resize(mdkarWidth* mdkarWidth* mdkarWidth); + ControlParticle cpt; cpt.reset(); + cpt.density = 0.5; cpt.densityWeight = 0.5; + cpt.pos = LbmVec( (gsx*(LbmFloat)mdw)+goffx, (gsy*(LbmFloat)mdw)+goffy, (gsz*(LbmFloat)mdw)+goffz ); // optimize? +#if LBMDIM==3 + for(int k= 0; k<mdkarWidth; ++k) { +#else // LBMDIM==3 + { int k = mdw; +#endif + for(int j= 0; j<mdkarWidth; ++j) + for(int i= 0; i<mdkarWidth; ++i) { + MDKERN(i,j,k).resetForces(); + LbmVec pos = LbmVec( (gsx*(LbmFloat)i)+goffx, (gsy*(LbmFloat)j)+goffy, (gsz*(LbmFloat)k)+goffz ); // optimize? + cparts->calculateMaxdForce( &cpt, pos, &MDKERN(i,j,k) ); + } + } + + // second cpi loop, maxd forces + if(cparts->getInfluenceMaxdist()>0.) { + for(int cppi=0; cppi<cparts->getSize(); cppi++) { + ControlParticle *cp = cparts->getParticle(cppi); + if(cp->influence<=0.) continue; + const int cpi = (int)( (cp->pos[0]-goffx)/gsx ); + const int cpj = (int)( (cp->pos[1]-goffy)/gsy ); + int cpk = (int)( (cp->pos[2]-goffz)/gsz ); + + int is,ie,js,je,ks,ke; + ks = BOUNDCHECK(cpk - mdw, getForZMinBnd(), getForZMaxBnd(lev) ); + ke = BOUNDCHECK(cpk + mdw, getForZMinBnd(), getForZMaxBnd(lev) ); + js = BOUNDCHECK(cpj - mdw, 0, mLevel[lev].lSizey ); + je = BOUNDCHECK(cpj + mdw, 0, mLevel[lev].lSizey ); + is = BOUNDCHECK(cpi - mdw, 0, mLevel[lev].lSizex ); + ie = BOUNDCHECK(cpi + mdw, 0, mLevel[lev].lSizex ); + if(LBMDIM==2) { cpk = 0; ks = 0; ke = 1; } + if(CPODEBUG) errMsg("cppft","i"<<cppi<<" mdw"<<mdw<<" gpos"<<PRINT_VEC(cpi,cpj,cpk)<<" i:"<<is<<","<<ie<<" j:"<<js<<","<<je<<" k:"<<ks<<","<<ke<<" "); // DEBUG + cpInfs++; + + for(int k= ks; k<ke; ++k) + for(int j= js; j<je; ++j) { + CellFlagType *pflag = &RFLAG(lev,is-1,j,k, mLevel[lev].setCurr); + for(int i= is; i<ie; ++i) { + // second cpi loop, maxd forces + pflag++; + if( (*pflag) & (CFFluid|CFInter) ) // RFLAG_check + { + cpChecks++; + ControlForces *ff = &LBMGET_FORCE(lev,i,j,k); + if(ff->weightAtt == 0.) { + ControlForces *kk = &MDKERN( i-cpi+mdw, j-cpj+mdw, k-cpk+mdw); + const LbmFloat pmdf = kk->maxDistance; + if((ff->maxDistance > pmdf) || (ff->maxDistance<0.)) + ff->maxDistance = pmdf; + ff->forceMaxd = kk->forceMaxd; + // todo use Omega instead!? + ff->forceVel = cp->vel* velLatticeScale; + } + } // celltype + } } // ijk + } // cpi, md loop + } // maxd inf>0 */ + + + debMsgStd("ControlData::initControl",DM_MSG,"Maxd cpgrid "<<cpssi<<" generated checks:"<<cpChecks<<" infs:"<<cpInfs ,9); + } //cpssi + + // normalize, only done once for the whole array + mpControl->mCons[0]->mCparts->finishControl( mpControl->mCpForces[lev], iatt,ivel,imaxd ); + + } // lev loop + + myTime_t cpend = getTime(); + debMsgStd("ControlData::handleCpdata",DM_MSG,"Time for cpgrid generation:"<< getTimeString(cpend-cpstart)<<", checks:"<<cpChecks<<" infs:"<<cpInfs<<" " ,8); + + // warning, may return before +} + +#if LBM_USE_GUI==1 + +#define USE_GLUTILITIES +#include "../gui/gui_utilities.h" + +void LbmFsgrSolver::cpDebugDisplay(int dispset) +{ + for(int cpssi=0; cpssi<(int)mpControl->mCons.size(); cpssi++) { + ControlParticles *cparts = mpControl->mCons[cpssi]->mCparts; + //ControlParticles *cpmotion = mpControl->mCons[cpssi]->mCpmotion; + // display cp parts + const bool cpCubes = false; + const bool cpDots = true; + const bool cpCpdist = true; + const bool cpHideIna = true; + glShadeModel(GL_FLAT); + glDisable( GL_LIGHTING ); // dont light lines + + // dot influence + if((mpControl->mDebugCpscale>0.) && cpDots) { + glPointSize(mpControl->mDebugCpscale * 8.); + glBegin(GL_POINTS); + for(int i=0; i<cparts->getSize(); i++) { + if((cpHideIna)&&( (cparts->getParticle(i)->influence<=0.) || (cparts->getParticle(i)->size<=0.) )) continue; + ntlVec3Gfx org( vec2G(cparts->getParticle(i)->pos ) ); + //LbmFloat halfsize = 0.5; + LbmFloat scale = cparts->getParticle(i)->densityWeight; + //glColor4f( scale,scale,scale,scale ); + glColor4f( 0.,scale,0.,scale ); + glVertex3f( org[0],org[1],org[2] ); + //errMsg("lbmDebugDisplay","CP "<<i<<" at "<<org); // DEBUG + } + glEnd(); + } + + // cp positions + if((mpControl->mDebugCpscale>0.) && cpDots) { + glPointSize(mpControl->mDebugCpscale * 3.); + glBegin(GL_POINTS); + glColor3f( 0,1,0 ); + } + for(int i=0; i<cparts->getSize(); i++) { + if((cpHideIna)&&( (cparts->getParticle(i)->influence<=0.) || (cparts->getParticle(i)->size<=0.) )) continue; + ntlVec3Gfx org( vec2G(cparts->getParticle(i)->pos ) ); + LbmFloat halfsize = 0.5; + LbmFloat scale = cparts->getRadiusAtt() * cparts->getParticle(i)->densityWeight; + if(cpCubes){ glLineWidth( 1 ); + glColor3f( 1,1,1 ); + ntlVec3Gfx s = org-(halfsize * (scale)); + ntlVec3Gfx e = org+(halfsize * (scale)); + drawCubeWire( s,e ); } + if((mpControl->mDebugCpscale>0.) && cpDots) { + glVertex3f( org[0],org[1],org[2] ); + } + } + if(cpDots) glEnd(); + + if(mpControl->mDebugAvgVelScale>0.) { + const float scale = mpControl->mDebugAvgVelScale; + + glColor3f( 1.0,1.0,1 ); + glBegin(GL_LINES); + for(int i=0; i<cparts->getSize(); i++) { + if((cpHideIna)&&( (cparts->getParticle(i)->influence<=0.) || (cparts->getParticle(i)->size<=0.) )) continue; + ntlVec3Gfx org( vec2G(cparts->getParticle(i)->pos ) ); + + //errMsg("CPAVGVEL","i"<<i<<" pos"<<org<<" av"<<cparts->getParticle(i)->avgVel);// DEBUG + float dx = cparts->getParticle(i)->avgVel[0]; + float dy = cparts->getParticle(i)->avgVel[1]; + float dz = cparts->getParticle(i)->avgVel[2]; + dx *= scale; dy *= scale; dz *= scale; + glVertex3f( org[0],org[1],org[2] ); + glVertex3f( org[0]+dx,org[1]+dy,org[2]+dz ); + } + glEnd(); + } // */ + + if( (LBMDIM==2) && (cpCpdist) ) { + + // debug, for use of e.g. LBMGET_FORCE LbmControlData *mpControl = this; +# define TESTGET_FORCE(lev,i,j,k) mpControl->mCpForces[lev][ ((k*mLevel[lev].lSizey)+j)*mLevel[lev].lSizex+i ] + + glBegin(GL_LINES); + //const int lev=0; + for(int lev=0; lev<=mMaxRefine; lev++) { + FSGR_FORIJK_BOUNDS(lev) { + LbmVec pos = LbmVec( + ((mvGeoEnd[0]-mvGeoStart[0])/(LbmFloat)mLevel[lev].lSizex) * ((LbmFloat)i+0.5) + mvGeoStart[0], + ((mvGeoEnd[1]-mvGeoStart[1])/(LbmFloat)mLevel[lev].lSizey) * ((LbmFloat)j+0.5) + mvGeoStart[1], + ((mvGeoEnd[2]-mvGeoStart[2])/(LbmFloat)mLevel[lev].lSizez) * ((LbmFloat)k+0.5) + mvGeoStart[2] ); + if(LBMDIM==2) pos[2] = ((mvGeoEnd[2]-mvGeoStart[2])*0.5 + mvGeoStart[2]); + + if((mpControl->mDebugMaxdScale>0.) && (TESTGET_FORCE(lev,i,j,k).weightAtt<=0.) ) + if(TESTGET_FORCE(lev,i,j,k).maxDistance>=0.) + if(TESTGET_FORCE(lev,i,j,k).maxDistance<CPF_MAXDINIT ) { + const float scale = mpControl->mDebugMaxdScale*10001.; + float dx = TESTGET_FORCE(lev,i,j,k).forceMaxd[0]; + float dy = TESTGET_FORCE(lev,i,j,k).forceMaxd[1]; + float dz = TESTGET_FORCE(lev,i,j,k).forceMaxd[2]; + dx *= scale; dy *= scale; dz *= scale; + glColor3f( 0,1,0 ); + glVertex3f( pos[0],pos[1],pos[2] ); + glVertex3f( pos[0]+dx,pos[1]+dy,pos[2]+dz ); + } // */ + if((mpControl->mDebugAttScale>0.) && (TESTGET_FORCE(lev,i,j,k).weightAtt>0.)) { + const float scale = mpControl->mDebugAttScale*100011.; + float dx = TESTGET_FORCE(lev,i,j,k).forceAtt[0]; + float dy = TESTGET_FORCE(lev,i,j,k).forceAtt[1]; + float dz = TESTGET_FORCE(lev,i,j,k).forceAtt[2]; + dx *= scale; dy *= scale; dz *= scale; + glColor3f( 1,0,0 ); + glVertex3f( pos[0],pos[1],pos[2] ); + glVertex3f( pos[0]+dx,pos[1]+dy,pos[2]+dz ); + } // */ + // why check maxDistance? + if((mpControl->mDebugVelScale>0.) && (TESTGET_FORCE(lev,i,j,k).maxDistance+TESTGET_FORCE(lev,i,j,k).weightVel>0.)) { + float scale = mpControl->mDebugVelScale*1.; + float wvscale = TESTGET_FORCE(lev,i,j,k).weightVel; + float dx = TESTGET_FORCE(lev,i,j,k).forceVel[0]; + float dy = TESTGET_FORCE(lev,i,j,k).forceVel[1]; + float dz = TESTGET_FORCE(lev,i,j,k).forceVel[2]; + scale *= wvscale; + dx *= scale; dy *= scale; dz *= scale; + glColor3f( 0.2,0.2,1 ); + glVertex3f( pos[0],pos[1],pos[2] ); + glVertex3f( pos[0]+dx,pos[1]+dy,pos[2]+dz ); + } // */ + if((mpControl->mDebugCompavScale>0.) && (TESTGET_FORCE(lev,i,j,k).compAvWeight>0.)) { + const float scale = mpControl->mDebugCompavScale*1.; + float dx = TESTGET_FORCE(lev,i,j,k).compAv[0]; + float dy = TESTGET_FORCE(lev,i,j,k).compAv[1]; + float dz = TESTGET_FORCE(lev,i,j,k).compAv[2]; + dx *= scale; dy *= scale; dz *= scale; + glColor3f( 0.2,0.2,1 ); + glVertex3f( pos[0],pos[1],pos[2] ); + glVertex3f( pos[0]+dx,pos[1]+dy,pos[2]+dz ); + } // */ + } // att,maxd + } + glEnd(); + } + } // cpssi + + //fprintf(stderr,"BLA\n"); + glEnable( GL_LIGHTING ); // dont light lines + glShadeModel(GL_SMOOTH); +} + +#else // LBM_USE_GUI==1 +void LbmFsgrSolver::cpDebugDisplay(int dispset) { } +#endif // LBM_USE_GUI==1 + + diff --git a/intern/elbeem/intern/solver_control.h b/intern/elbeem/intern/solver_control.h new file mode 100644 index 00000000000..57112b365ce --- /dev/null +++ b/intern/elbeem/intern/solver_control.h @@ -0,0 +1,182 @@ +/****************************************************************************** + * + * El'Beem - the visual lattice boltzmann freesurface simulator + * All code distributed as part of El'Beem is covered by the version 2 of the + * GNU General Public License. See the file COPYING for details. + * Copyright 2003-2006 Nils Thuerey + * + * testing extensions + * + *****************************************************************************/ + + +#ifndef LBM_TESTCLASS_H +#define LBM_TESTCLASS_H + +//class IsoSurface; +class ParticleObject; +class ControlParticles; +class ControlForces; + +//#define NUMGRIDS 2 +//#define MAXNUMSWS 10 + +// farfield modes +#define FARF_3DONLY -1 +#define FARF_BOTH 0 +#define FARF_SWEONLY 1 +// dont reuse 3d vars/init +#define FARF_SEPSWE 2 + +// relaxation macros for solver_relax.h + +// WARNING has to match controlparts.h +#define CPF_ENTRIES 12 +#define CPF_FORCE 0 +#define CPF_VELWEIGHT 3 +#define CPF_VELOCITY 4 +#define CPF_FORCEWEIGHT 7 +#define CPF_MINCPDIST 8 +#define CPF_MINCPDIR 9 + +#include "controlparticles.h" + +#include "ntl_geometrymodel.h" + +// get force entry, set=0 is unused anyway +#define LBMGET_FORCE(lev, i,j,k) mpControl->mCpForces[lev][ (LBMGI(lev,i,j,k,0)) ] + +// debug mods off... +// same as in src/solver_relax.h! +#define __PRECOLLIDE_MODS(rho,ux,uy,uz, grav) \ + ux += (grav)[0]; \ + uy += (grav)[1]; \ + uz += (grav)[2]; + +//void testMaxdmod(int i, int j,int k, LbmFloat &ux,LbmFloat &uy,LbmFloat &uz,ControlForces &ff); +#if LBMDIM==3 +#define MAXDGRAV \ + if(myforce->forceMaxd[0]*ux+myforce->forceMaxd[1]*uy<LBM_EPSILON) { \ + ux = v2w*myforce->forceVel[0]+ v2wi*ux; \ + uy = v2w*myforce->forceVel[1]+ v2wi*uy; } \ + /* movement inverse to g? */ \ + if((uz>LBM_EPSILON)&&(uz>myforce->forceVel[2])) { \ + uz = v2w*myforce->forceVel[2]+ v2wi*uz; } +#else // LBMDIM==3 +#define MAXDGRAV \ + if(myforce->forceMaxd[0]*ux<LBM_EPSILON) { \ + ux = v2w*myforce->forceVel[0]+ v2wi*ux; } \ + /* movement inverse to g? */ \ + if((uy>LBM_EPSILON)&&(uy>myforce->forceVel[1])) { \ + uy = v2w*myforce->forceVel[1]+ v2wi*uy; } +#endif // LBMDIM==3 + +// debug modifications of collide vars (testing) +// requires: lev,i,j,k +#define PRECOLLIDE_MODS(rho,ux,uy,uz, grav) \ + LbmFloat attforce = 1.; \ + if(this->mTForceStrength>0.) { \ + ControlForces* myforce = &LBMGET_FORCE(lev,i,j,k); \ + const LbmFloat vf = myforce->weightAtt;\ + const LbmFloat vw = myforce->weightVel;\ + if(vf!=0.) { attforce = MAX(0., 1.-vf); /* TODO FIXME? use ABS(vf) for repulsion force? */ \ + ux += myforce->forceAtt[0]; \ + uy += myforce->forceAtt[1]; \ + uz += myforce->forceAtt[2]; \ + \ + } else if(( myforce->maxDistance>0.) && ( myforce->maxDistance<CPF_MAXDINIT)) {\ + const LbmFloat v2w = mpControl->mCons[0]->mCparts->getInfluenceMaxdist() * \ + (myforce->maxDistance-mpControl->mCons[0]->mCparts->getRadiusMinMaxd()) / (mpControl->mCons[0]->mCparts->getRadiusMaxd()-mpControl->mCons[0]->mCparts->getRadiusMinMaxd()); \ + const LbmFloat v2wi = 1.-v2w; \ + if(v2w>0.){ MAXDGRAV; \ + /* errMsg("ERRMDTT","at "<<PRINT_IJK<<" maxd="<<myforce->maxDistance<<", newu"<<PRINT_VEC(ux,uy,uz)<<", org"<<PRINT_VEC(oux,ouy,ouz)<<", fv"<<myforce->forceVel<<" " ); */ \ + }\ + } \ + if(vw>0.) { \ + const LbmFloat vwi = 1.-vw;\ + const LbmFloat vwd = mpControl->mDiffVelCon;\ + ux += vw*(myforce->forceVel[0]-myforce->compAv[0] + vwd*(myforce->compAv[0]-ux) ); \ + uy += vw*(myforce->forceVel[1]-myforce->compAv[1] + vwd*(myforce->compAv[1]-uy) ); \ + uz += vw*(myforce->forceVel[2]-myforce->compAv[2] + vwd*(myforce->compAv[2]-uz) ); \ + /* TODO test!? modify smooth vel by influence of force for each lbm step, to account for force update only each N steps */ \ + myforce->compAv = (myforce->forceVel*vw+ myforce->compAv*vwi); \ + } \ + } \ + ux += (grav)[0]*attforce; \ + uy += (grav)[1]*attforce; \ + uz += (grav)[2]*attforce; \ + /* end PRECOLLIDE_MODS */ + +#define TEST_IF_CHECK \ + if((!iffilled)&&(LBMGET_FORCE(lev,i,j,k).weightAtt!=0.)) { \ + errMsg("TESTIFFILL"," at "<<PRINT_IJK<<" "<<mass<<" "<<rho); \ + iffilled = true; \ + if(mass<rho*1.0) mass = rho*1.0; myfrac = 1.0; \ + } + + +// a single set of control particles and params +class LbmControlSet { + public: + LbmControlSet(); + ~LbmControlSet(); + void initCparts(); + + // control particles + ControlParticles *mCparts; + // control particle overall motion (for easier manual generation) + ControlParticles *mCpmotion; + // cp data file + string mContrPartFile; + string mCpmotionFile; + // cp debug displau + LbmFloat mDebugCpscale, mDebugVelScale, mDebugCompavScale, mDebugAttScale, mDebugMaxdScale, mDebugAvgVelScale; + + // params + AnimChannel<float> mcForceAtt; + AnimChannel<float> mcForceVel; + AnimChannel<float> mcForceMaxd; + + AnimChannel<float> mcRadiusAtt; + AnimChannel<float> mcRadiusVel; + AnimChannel<float> mcRadiusMind; + AnimChannel<float> mcRadiusMaxd; + + AnimChannel<ntlVec3f> mcCpScale; + AnimChannel<ntlVec3f> mcCpOffset; +}; + + + +// main control data storage +class LbmControlData +{ + public: + LbmControlData(); + virtual ~LbmControlData(); + + // control data + + // contorl params + void parseControldataAttrList(AttributeList *attr); + + // control strength, set for solver interface + LbmFloat mSetForceStrength; + // cp vars + std::vector<LbmControlSet*> mCons; + // update interval + int mCpUpdateInterval; + // output + string mCpOutfile; + // control particle precomputed influence + std::vector< std::vector<ControlForces> > mCpForces; + std::vector<ControlForces> mCpKernel; + std::vector<ControlForces> mMdKernel; + // activate differential velcon + LbmFloat mDiffVelCon; + + // cp debug displau + LbmFloat mDebugCpscale, mDebugVelScale, mDebugCompavScale, mDebugAttScale, mDebugMaxdScale, mDebugAvgVelScale; +}; + +#endif // LBM_TESTCLASS_H diff --git a/intern/elbeem/intern/solver_init.cpp b/intern/elbeem/intern/solver_init.cpp index c953d2f47da..270531d80be 100644 --- a/intern/elbeem/intern/solver_init.cpp +++ b/intern/elbeem/intern/solver_init.cpp @@ -328,7 +328,8 @@ LbmFsgrSolver::LbmFsgrSolver() : mInit2dYZ(false), mForceTadapRefine(-1), mCutoff(-1) { - // not much to do here... + mpControl = new LbmControlData(); + #if LBM_INCLUDE_TESTSOLVERS==1 mpTest = new LbmTestdata(); mMpNum = mMpIndex = 0; @@ -438,6 +439,8 @@ LbmFsgrSolver::~LbmFsgrSolver() delete mpIso; if(mpPreviewSurface) delete mpPreviewSurface; // cleanup done during scene deletion... + + if(mpControl) delete mpControl; // always output performance estimate debMsgStd("LbmFsgrSolver::~LbmFsgrSolver",DM_MSG," Avg. MLSUPS:"<<(mAvgMLSUPS/mAvgMLSUPSCnt), 5); @@ -488,6 +491,8 @@ void LbmFsgrSolver::parseAttrList() mSimulationTime += starttimeskip; if(starttimeskip>0.) debMsgStd("LbmFsgrSolver::parseStdAttrList",DM_NOTIFY,"Used starttimeskip="<<starttimeskip<<", t="<<mSimulationTime, 1); + mpControl->parseControldataAttrList(mpSifAttrs); + #if LBM_INCLUDE_TESTSOLVERS==1 mUseTestdata = 0; mUseTestdata = mpSifAttrs->readBool("use_testdata", mUseTestdata,"LbmFsgrSolver", "mUseTestdata", false); @@ -689,21 +694,21 @@ bool LbmFsgrSolver::initializeSolverMemory() // restrict max. chunk of 1 mem block to 1GB for windos bool memBlockAllocProblem = false; - double maxWinMemChunk = 1100.*1024.*1024.; - double maxMacMemChunk = 1200.*1024.*1024.; double maxDefaultMemChunk = 2.*1024.*1024.*1024.; //std::cerr<<" memEstFine "<< memEstFine <<" maxWin:" <<maxWinMemChunk <<" maxMac:" <<maxMacMemChunk ; // DEBUG #ifdef WIN32 - if(memEstFine> maxWinMemChunk) { + double maxWinMemChunk = 1100.*1024.*1024.; + if(sizeof(void *)==4 && memEstFine>maxWinMemChunk) { memBlockAllocProblem = true; } #endif // WIN32 #ifdef __APPLE__ + double maxMacMemChunk = 1200.*1024.*1024.; if(memEstFine> maxMacMemChunk) { memBlockAllocProblem = true; } #endif // Mac - if(sizeof(void *)==4 && memEstFine>maxDefaultMemChunk) { + if(sizeof(void*)==4 && memEstFine>maxDefaultMemChunk) { // max memory chunk for 32bit systems 2gig memBlockAllocProblem = true; } @@ -1264,8 +1269,10 @@ bool LbmFsgrSolver::initializeSolverPostinit() { debMsgStd("LbmFsgrSolver::initialize",DM_MSG,"Init done ... ",10); mInitDone = 1; -#if LBM_INCLUDE_TESTSOLVERS==1 + // init fluid control initCpdata(); + +#if LBM_INCLUDE_TESTSOLVERS==1 initTestdata(); #endif // ELBEEM_PLUGIN!=1 // not inited? dont use... diff --git a/intern/elbeem/intern/solver_main.cpp b/intern/elbeem/intern/solver_main.cpp index 13ebf91b696..9df53a824d4 100644 --- a/intern/elbeem/intern/solver_main.cpp +++ b/intern/elbeem/intern/solver_main.cpp @@ -13,11 +13,6 @@ #include "loop_tools.h" #include <stdlib.h> -#if (defined (__sun__) || defined (__sun)) || (!defined(linux) && (defined (__sparc) || defined (__sparc__))) -#include <ieeefp.h> -#endif - - /*****************************************************************************/ /*! perform a single LBM step */ /*****************************************************************************/ @@ -58,9 +53,9 @@ void LbmFsgrSolver::stepMain() { // init moving bc's, can change mMaxVlen initMovingObstacles(false); -#if LBM_INCLUDE_TESTSOLVERS==1 + + // handle fluid control handleCpdata(); -#endif // important - keep for tadap LbmFloat lastMass = mCurrentMass; diff --git a/intern/elbeem/intern/solver_relax.h b/intern/elbeem/intern/solver_relax.h index 287b73c77b2..c28e7aacd29 100644 --- a/intern/elbeem/intern/solver_relax.h +++ b/intern/elbeem/intern/solver_relax.h @@ -14,53 +14,6 @@ #else // FSGR_STRICT_DEBUG==1 #define CAUSE_PANIC { this->mPanic=1; } /*set flag*/ #endif // FSGR_STRICT_DEBUG==1 - -#if LBM_INCLUDE_TESTSOLVERS!=1 - -#define PRECOLLIDE_MODS(rho,ux,uy,uz, grav) \ - ux += (grav)[0]; \ - uy += (grav)[1]; \ - uz += (grav)[2]; - -#define TEST_IF_CHECK - -#else // LBM_INCLUDE_TESTSOLVERS!=1 -// defined in test.h - -#define NEWDIRVELMOTEST 0 -#if NEWDIRVELMOTEST==1 -// off for non testing -#undef PRECOLLIDE_MODS -#define PRECOLLIDE_MODS(rho,ux,uy,uz, grav) \ - ux += (grav)[0]; \ - uy += (grav)[1]; \ - uz += (grav)[2]; \ - { \ - int lev = mMaxRefine, nomb=0; \ - LbmFloat bcnt = 0.,nux=0.,nuy=0.,nuz=0.; \ - for(int l=1; l<this->cDfNum; l++) { \ - if(RFLAG_NB(lev, i,j,k,SRCS(lev),l)&CFBnd) { \ - if(RFLAG_NB(lev, i,j,k,SRCS(lev),l)&CFBndMoving) { \ - nux += QCELL_NB(lev, i,j,k,SRCS(lev),l, dMass); \ - nuy += QCELL_NB(lev, i,j,k,SRCS(lev),l, dFfrac); \ - bcnt += 1.; \ - } else { \ - nomb++; \ - } \ - } \ - } \ - if((bcnt>0.)&&(nomb==0)) { \ - ux = nux/bcnt; \ - uy = nuy/bcnt; \ - uz = nuz/bcnt; \ - } \ - } -#else // NEWDIRVELMOTEST==1 -// off for non testing -#endif // NEWDIRVELMOTEST==1 - -#endif // LBM_INCLUDE_TESTSOLVERS!=1 - /****************************************************************************** * normal relaxation diff --git a/intern/elbeem/intern/solver_util.cpp b/intern/elbeem/intern/solver_util.cpp index a6685babe68..25b8b98b3c6 100644 --- a/intern/elbeem/intern/solver_util.cpp +++ b/intern/elbeem/intern/solver_util.cpp @@ -37,10 +37,10 @@ void LbmFsgrSolver::prepareVisualization( void ) { int lev = mMaxRefine; int workSet = mLevel[lev].setCurr; - int mainGravDir=0; + int mainGravDir=6; // if normalizing fails, we asume z-direction gravity LbmFloat mainGravLen = 0.; FORDF1{ - LbmFloat thisGravLen = dot(LbmVec(dfVecX[l],dfVecY[l],dfVecZ[l]), getNormalized(mLevel[mMaxRefine].gravity) ); + LbmFloat thisGravLen = dot(LbmVec(dfVecX[l],dfVecY[l],dfVecZ[l]), mLevel[mMaxRefine].gravity ); if(thisGravLen>mainGravLen) { mainGravLen = thisGravLen; mainGravDir = l; @@ -112,6 +112,7 @@ void LbmFsgrSolver::prepareVisualization( void ) { const CellFlagType nbflag = RFLAG_NB(lev, i,j,k, workSet,l); if(nbflag&CFInter){ intercnt++; } + // check all directions otherwise we get bugs with splashes on obstacles if(l!=mainGravDir) continue; // only check bnd along main grav. dir //if((nbflag&CFBnd)&&(nbflag&CFBndNoslip)){ noslipbnd=1; } if((nbflag&CFBnd)){ noslipbnd=1; } @@ -140,11 +141,10 @@ void LbmFsgrSolver::prepareVisualization( void ) { if(val<minval) val = minval; *mpIso->lbmGetData(i,j,ZKOFF) += minval-( val * mIsoWeight[13] ); } -#endif // SURFACE_ENH>0 - } else { // all others, unused? continue; } +#endif // SURFACE_ENH>0 *mpIso->lbmGetData( i-1 , j-1 ,ZKOFF-ZKD1) += ( val * mIsoWeight[0] ); *mpIso->lbmGetData( i , j-1 ,ZKOFF-ZKD1) += ( val * mIsoWeight[1] ); diff --git a/intern/elbeem/make/msvc_7_0/elbeem.vcproj b/intern/elbeem/make/msvc_7_0/elbeem.vcproj index 9de4482e2fd..958d74f8fa0 100644 --- a/intern/elbeem/make/msvc_7_0/elbeem.vcproj +++ b/intern/elbeem/make/msvc_7_0/elbeem.vcproj @@ -19,8 +19,8 @@ <Tool Name="VCCLCompilerTool" Optimization="0" - AdditionalIncludeDirectories="..\..\intern;..\..\..\..\..\lib\windows\png\include;..\..\..\..\..\lib\windows\zlib\include;..\..\..\..\source\kernel\gen_messaging;..\..\..\..\..\lib\windows\sdl\include" - PreprocessorDefinitions="WIN32;_DEBUG;_LIB;NOGUI;ELBEEM_BLENDER=1" + AdditionalIncludeDirectories="..\..\intern;..\..\extern;..\..\..\..\..\lib\windows\png\include;..\..\..\..\..\lib\windows\zlib\include;..\..\..\..\source\kernel\gen_messaging;..\..\..\..\..\lib\windows\sdl\include" + PreprocessorDefinitions="WIN32;_DEBUG;_LIB;NOGUI;ELBEEM_BLENDER=1;LBM_INCLUDE_CONTROL=1" MinimalRebuild="FALSE" BasicRuntimeChecks="3" RuntimeLibrary="1" @@ -72,8 +72,8 @@ ECHO Done CharacterSet="2"> <Tool Name="VCCLCompilerTool" - AdditionalIncludeDirectories="..\..\intern;..\..\..\..\..\lib\windows\png\include;..\..\..\..\..\lib\windows\zlib\include;..\..\..\..\source\kernel\gen_messaging;..\..\..\..\..\lib\windows\sdl\include" - PreprocessorDefinitions="WIN32;NDEBUG;_LIB;NOGUI;ELBEEM_BLENDER=1" + AdditionalIncludeDirectories="..\..\intern;..\..\extern;..\..\..\..\..\lib\windows\png\include;..\..\..\..\..\lib\windows\zlib\include;..\..\..\..\source\kernel\gen_messaging;..\..\..\..\..\lib\windows\sdl\include" + PreprocessorDefinitions="WIN32;NDEBUG;_LIB;NOGUI;ELBEEM_BLENDER=1;LBM_INCLUDE_CONTROL=1" StringPooling="TRUE" MinimalRebuild="FALSE" RuntimeLibrary="0" @@ -126,7 +126,7 @@ ECHO Done <Tool Name="VCCLCompilerTool" Optimization="0" - AdditionalIncludeDirectories="..\..\intern;..\..\..\..\..\lib\windows\png\include;..\..\..\..\..\lib\windows\zlib\include;..\..\..\..\source\kernel\gen_messaging;..\..\..\..\..\lib\windows\sdl\include" + AdditionalIncludeDirectories="..\..\intern;..\..\extern;..\..\..\..\..\lib\windows\png\include;..\..\..\..\..\lib\windows\zlib\include;..\..\..\..\source\kernel\gen_messaging;..\..\..\..\..\lib\windows\sdl\include" PreprocessorDefinitions="WIN32;_DEBUG;_LIB;NOGUI;ELBEEM_BLENDER=1" MinimalRebuild="FALSE" BasicRuntimeChecks="3" @@ -179,7 +179,7 @@ ECHO Done CharacterSet="2"> <Tool Name="VCCLCompilerTool" - AdditionalIncludeDirectories="..\..\intern;..\..\..\..\..\lib\windows\png\include;..\..\..\..\..\lib\windows\zlib\include;..\..\..\..\source\kernel\gen_messaging;..\..\..\..\..\lib\windows\sdl\include" + AdditionalIncludeDirectories="..\..\intern;..\..\extern;..\..\..\..\..\lib\windows\png\include;..\..\..\..\..\lib\windows\zlib\include;..\..\..\..\source\kernel\gen_messaging;..\..\..\..\..\lib\windows\sdl\include" PreprocessorDefinitions="WIN32;NDEBUG;_LIB;NOGUI;ELBEEM_BLENDER=1" StringPooling="TRUE" MinimalRebuild="FALSE" @@ -236,12 +236,21 @@ ECHO Done RelativePath="..\..\intern\attributes.cpp"> </File> <File + RelativePath="..\..\intern\controlparticles.cpp"> + </File> + <File RelativePath="..\..\intern\elbeem.cpp"> </File> <File + RelativePath="..\..\intern\elbeem_control.cpp"> + </File> + <File RelativePath="..\..\intern\isosurface.cpp"> </File> <File + RelativePath="..\..\intern\mvmcoords.cpp"> + </File> + <File RelativePath="..\..\intern\ntl_blenderdumper.cpp"> </File> <File @@ -275,6 +284,9 @@ ECHO Done RelativePath="..\..\intern\solver_adap.cpp"> </File> <File + RelativePath="..\..\intern\solver_control.cpp"> + </File> + <File RelativePath="..\..\intern\solver_init.cpp"> </File> <File @@ -298,7 +310,13 @@ ECHO Done RelativePath="..\..\intern\attributes.h"> </File> <File - RelativePath="..\..\intern\elbeem.h"> + RelativePath="..\..\intern\controlparticles.h"> + </File> + <File + RelativePath="..\..\extern\elbeem.h"> + </File> + <File + RelativePath="..\..\intern\elbeem_control.h"> </File> <File RelativePath="..\..\intern\isosurface.h"> @@ -307,6 +325,9 @@ ECHO Done RelativePath="..\..\intern\mcubes_tables.h"> </File> <File + RelativePath="..\..\intern\mvmcoords.h"> + </File> + <File RelativePath="..\..\intern\ntl_blenderdumper.h"> </File> <File @@ -352,6 +373,9 @@ ECHO Done RelativePath="..\..\intern\solver_class.h"> </File> <File + RelativePath="..\..\intern\solver_control.h"> + </File> + <File RelativePath="..\..\intern\solver_interface.h"> </File> <File diff --git a/intern/elbeem/make/msvc_9_0/elbeem.vcproj b/intern/elbeem/make/msvc_9_0/elbeem.vcproj new file mode 100644 index 00000000000..4108e09799d --- /dev/null +++ b/intern/elbeem/make/msvc_9_0/elbeem.vcproj @@ -0,0 +1,524 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9,00"
+ Name="INT_elbeem"
+ ProjectGUID="{A90C4918-4B21-4277-93BD-AF65F30951D9}"
+ RootNamespace="elbeem"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Blender Debug|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\elbeem\debug"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\elbeem\debug"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\intern;..\..\extern;..\..\..\..\..\lib\windows\png\include;..\..\..\..\..\lib\windows\zlib\include;..\..\..\..\source\kernel\gen_messaging;..\..\..\..\..\lib\windows\sdl\include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB;NOGUI;ELBEEM_BLENDER=1;LBM_INCLUDE_CONTROL=1"
+ MinimalRebuild="false"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ BufferSecurityCheck="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\elbeem\debug\elbeem.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\elbeem\debug\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\elbeem\debug\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\elbeem\debug\"
+ BrowseInformation="1"
+ WarningLevel="2"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\debug\libelbeem.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying ELBEEM files library (debug target) to lib tree."
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\elbeem\include MKDIR ..\..\..\..\..\build\msvc_9\intern\elbeem\include
XCOPY /Y ..\..\extern\*.h ..\..\..\..\..\build\msvc_9\intern\elbeem\include
ECHO Done
"
+ />
+ </Configuration>
+ <Configuration
+ Name="Blender Release|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\elbeem"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\elbeem"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="..\..\intern;..\..\extern;..\..\..\..\..\lib\windows\png\include;..\..\..\..\..\lib\windows\zlib\include;..\..\..\..\source\kernel\gen_messaging;..\..\..\..\..\lib\windows\sdl\include"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB;NOGUI;ELBEEM_BLENDER=1;LBM_INCLUDE_CONTROL=1"
+ StringPooling="true"
+ MinimalRebuild="false"
+ RuntimeLibrary="0"
+ BufferSecurityCheck="true"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\elbeem\elbeem.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\elbeem\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\elbeem\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\elbeem\"
+ WarningLevel="4"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\libelbeem.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying ELBEEM files library (release target) to lib tree."
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\elbeem\include MKDIR ..\..\..\..\..\build\msvc_9\intern\elbeem\include
XCOPY /Y ..\..\extern\*.h ..\..\..\..\..\build\msvc_9\intern\elbeem\include
ECHO Done
"
+ />
+ </Configuration>
+ <Configuration
+ Name="3DPlugin Debug|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\elbeem\mtdll\debug"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\elbeem\mtdll\debug"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\intern;..\..\extern;..\..\..\..\..\lib\windows\png\include;..\..\..\..\..\lib\windows\zlib\include;..\..\..\..\source\kernel\gen_messaging;..\..\..\..\..\lib\windows\sdl\include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB;NOGUI;ELBEEM_BLENDER=1"
+ MinimalRebuild="false"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ BufferSecurityCheck="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\elbeem\mtdll\debug\elbeem.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\elbeem\mtdll\debug\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\elbeem\mtdll\debug\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\elbeem\mtdll\debug\"
+ BrowseInformation="1"
+ WarningLevel="2"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\mtdll\debug\libelbeem.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying ELBEEM files library (debug target) to lib tree."
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\elbeem\include MKDIR ..\..\..\..\..\build\msvc_9\intern\elbeem\include
XCOPY /Y ..\..\extern\*.h ..\..\..\..\..\build\msvc_9\intern\elbeem\include
ECHO Done
"
+ />
+ </Configuration>
+ <Configuration
+ Name="3DPlugin Release|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\elbeem\mtdll"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\elbeem\mtdll"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="..\..\intern;..\..\extern;..\..\..\..\..\lib\windows\png\include;..\..\..\..\..\lib\windows\zlib\include;..\..\..\..\source\kernel\gen_messaging;..\..\..\..\..\lib\windows\sdl\include"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB;NOGUI;ELBEEM_BLENDER=1"
+ StringPooling="true"
+ MinimalRebuild="false"
+ RuntimeLibrary="2"
+ BufferSecurityCheck="true"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\elbeem\mtdll\elbeem.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\elbeem\mtdll\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\elbeem\mtdll\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\elbeem\mtdll\"
+ WarningLevel="2"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\libelbeem.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying ELBEEM files library (release target) to lib tree."
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\elbeem\include MKDIR ..\..\..\..\..\build\msvc_9\intern\elbeem\include
XCOPY /Y ..\..\extern\*.h ..\..\..\..\..\build\msvc_9\intern\elbeem\include
ECHO Done
"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath="..\..\intern\attributes.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\controlparticles.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\elbeem.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\elbeem_control.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\isosurface.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\mvmcoords.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\ntl_blenderdumper.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\ntl_bsptree.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\ntl_geometrymodel.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\ntl_geometryobject.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\ntl_lighting.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\ntl_ray.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\ntl_world.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\parametrizer.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\particletracer.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\simulation_object.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\solver_adap.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\solver_control.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\solver_init.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\solver_interface.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\solver_main.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\solver_util.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\utilities.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath="..\..\intern\attributes.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\controlparticles.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\extern\elbeem.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\elbeem_control.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\isosurface.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\mcubes_tables.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\mvmcoords.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\ntl_blenderdumper.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\ntl_bsptree.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\ntl_geometryclass.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\ntl_geometrymodel.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\ntl_geometryobject.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\ntl_geometryshader.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\ntl_lighting.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\ntl_matrices.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\ntl_ray.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\ntl_vector3dim.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\ntl_world.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\parametrizer.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\particletracer.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\simulation_object.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\solver_class.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\solver_control.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\solver_interface.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\solver_relax.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\utilities.h"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h index 21ddc467f59..cb1eac7a9a6 100644 --- a/intern/ghost/GHOST_C-api.h +++ b/intern/ghost/GHOST_C-api.h @@ -262,6 +262,19 @@ extern GHOST_TSuccess GHOST_AddEventConsumer(GHOST_SystemHandle systemhandle, GHOST_EventConsumerHandle consumerhandle); +/*************************************************************************************** + ** N-degree of freedom device management functionality + ***************************************************************************************/ + +/** +* Open N-degree of freedom devices + */ +extern int GHOST_OpenNDOF(GHOST_SystemHandle systemhandle, + GHOST_WindowHandle windowhandle, + GHOST_NDOFLibraryInit_fp setNdofLibraryInit, + GHOST_NDOFLibraryShutdown_fp setNdofLibraryShutdown, + GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen + ); /*************************************************************************************** ** Cursor management functionality @@ -755,6 +768,18 @@ extern void GHOST_SetRectangleCenter(GHOST_RectangleHandle rectanglehandle, */ extern GHOST_TSuccess GHOST_ClipRectangle(GHOST_RectangleHandle rectanglehandle, GHOST_RectangleHandle anotherrectanglehandle); + +/** + * Return the data from the clipboad + * @return clipboard data + */ +extern GHOST_TUns8* GHOST_getClipboard(int flag); + +/** + * Put data to the Clipboard + */ +extern void GHOST_putClipboard(GHOST_TInt8 *buffer, int flag); + #ifdef __cplusplus } #endif diff --git a/intern/ghost/GHOST_ISystem.h b/intern/ghost/GHOST_ISystem.h index a27b7453687..baf0cb813f8 100644 --- a/intern/ghost/GHOST_ISystem.h +++ b/intern/ghost/GHOST_ISystem.h @@ -224,13 +224,15 @@ public: * @param state The state of the window when opened. * @param type The type of drawing context installed in this window. * @param stereoVisual Create a stereo visual for quad buffered stereo. + * @param parentWindow Parent (embedder) window * @return The new window (or 0 if creation failed). */ virtual GHOST_IWindow* createWindow( const STR_String& title, GHOST_TInt32 left, GHOST_TInt32 top, GHOST_TUns32 width, GHOST_TUns32 height, GHOST_TWindowState state, GHOST_TDrawingContextType type, - const bool stereoVisual) = 0; + const bool stereoVisual, + const GHOST_TEmbedderWindowID parentWindow = 0) = 0; /** * Dispose a window. @@ -292,6 +294,22 @@ public: */ virtual GHOST_TSuccess addEventConsumer(GHOST_IEventConsumer* consumer) = 0; + /*************************************************************************************** + ** N-degree of freedom device management functionality + ***************************************************************************************/ + + /** + * Starts the N-degree of freedom device manager + */ + virtual int openNDOF(GHOST_IWindow*, + GHOST_NDOFLibraryInit_fp setNdofLibraryInit, + GHOST_NDOFLibraryShutdown_fp setNdofLibraryShutdown, + GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen + // original patch only + // GHOST_NDOFEventHandler_fp setNdofEventHandler + ) = 0; + + /*************************************************************************************** ** Cursor management functionality ***************************************************************************************/ @@ -333,6 +351,18 @@ public: */ virtual GHOST_TSuccess getButtonState(GHOST_TButtonMask mask, bool& isDown) const = 0; + /** + * Returns the selection buffer + * @return Returns "unsinged char" from X11 XA_CUT_BUFFER0 buffer + * + */ + virtual GHOST_TUns8* getClipboard(int flag) const = 0; + + /** + * Put data to the Clipboard + */ + virtual void putClipboard(GHOST_TInt8 *buffer, int flag) const = 0; + protected: /** * Initialize the system. diff --git a/intern/ghost/GHOST_Types.h b/intern/ghost/GHOST_Types.h index a413b765ccb..b683740247a 100644 --- a/intern/ghost/GHOST_Types.h +++ b/intern/ghost/GHOST_Types.h @@ -36,6 +36,11 @@ typedef unsigned short GHOST_TUns16; typedef int GHOST_TInt32; typedef unsigned int GHOST_TUns32; +#ifdef WIN32 +#define WM_BLND_NDOF_AXIS WM_USER + 1 +#define WM_BLND_NDOF_BTN WM_USER + 2 +#endif + #if defined(WIN32) && !defined(FREE_WINDOWS) typedef __int64 GHOST_TInt64; typedef unsigned __int64 GHOST_TUns64; @@ -95,6 +100,7 @@ typedef enum { GHOST_kWindowStateMaximized, GHOST_kWindowStateMinimized, GHOST_kWindowStateFullScreen, + GHOST_kWindowStateEmbedded, GHOST_kWindowState8Normal = 8, GHOST_kWindowState8Maximized, GHOST_kWindowState8Minimized, @@ -130,6 +136,9 @@ typedef enum { GHOST_kEventButtonUp, /// Mouse button event GHOST_kEventWheel, /// Mouse wheel event + GHOST_kEventNDOFMotion, /// N degree of freedom device motion event + GHOST_kEventNDOFButton, /// N degree of freedom device button event + GHOST_kEventKeyDown, GHOST_kEventKeyUp, // GHOST_kEventKeyAuto, @@ -336,6 +345,38 @@ typedef struct { GHOST_TInt32 z; } GHOST_TEventWheelData; + +/* original patch used floats, but the driver return ints and uns. We will calibrate in view, no sense on doing conversions twice */ +/* as all USB device controls are likely to use ints, this is also more future proof */ +//typedef struct { +// /** N-degree of freedom device data */ +// float tx, ty, tz; /** -x left, +y up, +z forward */ +// float rx, ry, rz; +// float dt; +//} GHOST_TEventNDOFData; + +typedef struct { + /** N-degree of freedom device data v2*/ + int changed; + GHOST_TUns64 client; + GHOST_TUns64 address; + GHOST_TInt16 tx, ty, tz; /** -x left, +y up, +z forward */ + GHOST_TInt16 rx, ry, rz; + GHOST_TInt16 buttons; + GHOST_TUns64 time; + GHOST_TUns64 delta; +} GHOST_TEventNDOFData; + +typedef int (*GHOST_NDOFLibraryInit_fp)(); +typedef void (*GHOST_NDOFLibraryShutdown_fp)(void* deviceHandle); +typedef void* (*GHOST_NDOFDeviceOpen_fp)(void* platformData); + +// original patch windows callback. In mac os X version the callback is internal to the plug-in and post an event to main thead. +// not necessary faster, but better integration with other events. + +//typedef int (*GHOST_NDOFEventHandler_fp)(float* result7, void* deviceHandle, unsigned int message, unsigned int* wParam, unsigned long* lParam); +//typedef void (*GHOST_NDOFCallBack_fp)(GHOST_TEventNDOFDataV2 *VolDatas); + typedef struct { /** The key code. */ GHOST_TKey key; @@ -355,6 +396,15 @@ typedef struct { } GHOST_DisplaySetting; +#ifdef _WIN32 +typedef long GHOST_TEmbedderWindowID; +#endif // _WIN32 + +#ifndef _WIN32 +// I can't use "Window" from "<X11/Xlib.h>" because it conflits with Window defined in winlay.h +typedef int GHOST_TEmbedderWindowID; +#endif // _WIN32 + /** * A timer task callback routine. * @param task The timer task object. diff --git a/intern/ghost/SConscript b/intern/ghost/SConscript index bca9d715324..ad6b4ff51ba 100644 --- a/intern/ghost/SConscript +++ b/intern/ghost/SConscript @@ -10,25 +10,23 @@ sources = env.Glob('intern/*.cpp') pf = ['GHOST_DisplayManager', 'GHOST_System', 'GHOST_Window'] -if window_system in ('linux2', 'openbsd3', 'sunos5', 'freebsd6'): - for f in pf: - sources.remove('intern' + os.sep + f + 'Win32.cpp') - sources.remove('intern' + os.sep + f + 'Carbon.cpp') +if window_system in ('linux2', 'openbsd3', 'sunos5', 'freebsd6', 'irix6'): + for f in pf: + sources.remove('intern' + os.sep + f + 'Win32.cpp') + sources.remove('intern' + os.sep + f + 'Carbon.cpp') elif window_system in ('win32-vc', 'win32-mingw', 'cygwin', 'linuxcross'): - for f in pf: - sources.remove('intern' + os.sep + f + 'X11.cpp') - sources.remove('intern' + os.sep + f + 'Carbon.cpp') + for f in pf: + sources.remove('intern' + os.sep + f + 'X11.cpp') + sources.remove('intern' + os.sep + f + 'Carbon.cpp') elif window_system == 'darwin': - for f in pf: - sources.remove('intern' + os.sep + f + 'Win32.cpp') - sources.remove('intern' + os.sep + f + 'X11.cpp') + for f in pf: + sources.remove('intern' + os.sep + f + 'Win32.cpp') + sources.remove('intern' + os.sep + f + 'X11.cpp') else: - print "Unknown window system specified." - Exit() + print "Unknown window system specified." + Exit() incs = '. ../string ' + env['BF_OPENGL_INC'] - if window_system in ('win32-vc', 'win32-mingw', 'cygwin', 'linuxcross'): - incs = env['BF_WINTAB_INC'] + ' ' + incs - + incs = env['BF_WINTAB_INC'] + ' ' + incs env.BlenderLib ('bf_ghost', sources, Split(incs), defines=['_USE_MATH_DEFINES'], libtype=['core','intern','player'], priority = [40,44,5] ) diff --git a/intern/ghost/intern/GHOST_C-api.cpp b/intern/ghost/intern/GHOST_C-api.cpp index 75d993c3e03..ad5189af0e9 100644 --- a/intern/ghost/intern/GHOST_C-api.cpp +++ b/intern/ghost/intern/GHOST_C-api.cpp @@ -251,6 +251,21 @@ GHOST_TSuccess GHOST_AddEventConsumer(GHOST_SystemHandle systemhandle, GHOST_Eve return system->addEventConsumer((GHOST_CallbackEventConsumer*)consumerhandle); } +int GHOST_OpenNDOF(GHOST_SystemHandle systemhandle, GHOST_WindowHandle windowhandle, + GHOST_NDOFLibraryInit_fp setNdofLibraryInit, + GHOST_NDOFLibraryShutdown_fp setNdofLibraryShutdown, + GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen) + //original patch only + /* GHOST_NDOFEventHandler_fp setNdofEventHandler)*/ +{ + GHOST_ISystem* system = (GHOST_ISystem*) systemhandle; + + return system->openNDOF((GHOST_IWindow*) windowhandle, + setNdofLibraryInit, setNdofLibraryShutdown, setNdofDeviceOpen); +// original patch +// setNdofLibraryInit, setNdofLibraryShutdown, setNdofDeviceOpen, setNdofEventHandler); +} + GHOST_TStandardCursor GHOST_GetCursorShape(GHOST_WindowHandle windowhandle) @@ -794,3 +809,16 @@ GHOST_TSuccess GHOST_ClipRectangle(GHOST_RectangleHandle rectanglehandle, return result; } + +GHOST_TUns8* GHOST_getClipboard(int flag) +{ + GHOST_ISystem* system = GHOST_ISystem::getSystem(); + return system->getClipboard(flag); +} + +void GHOST_putClipboard(GHOST_TInt8 *buffer, int flag) +{ + GHOST_ISystem* system = GHOST_ISystem::getSystem(); + system->putClipboard(buffer, flag); +} + diff --git a/intern/ghost/intern/GHOST_EventNDOF.h b/intern/ghost/intern/GHOST_EventNDOF.h new file mode 100644 index 00000000000..76f5a9e0894 --- /dev/null +++ b/intern/ghost/intern/GHOST_EventNDOF.h @@ -0,0 +1,57 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + + +#ifndef _GHOST_EVENT_NDOF_H_ +#define _GHOST_EVENT_NDOF_H_ + +#include "GHOST_Event.h" + +/** + * N-degree of freedom device event. + */ +class GHOST_EventNDOF : public GHOST_Event +{ +public: + /** + * Constructor. + * @param msec The time this event was generated. + * @param type The type of this event. + * @param x The x-coordinate of the location the cursor was at at the time of the event. + * @param y The y-coordinate of the location the cursor was at at the time of the event. + */ + GHOST_EventNDOF(GHOST_TUns64 msec, GHOST_TEventType type, GHOST_IWindow* window, + GHOST_TEventNDOFData data) + : GHOST_Event(msec, type, window) + { + m_ndofEventData = data; + m_data = &m_ndofEventData; + } + +protected: + /** translation & rotation from the device. */ + GHOST_TEventNDOFData m_ndofEventData; +}; + + +#endif // _GHOST_EVENT_NDOF_H_ + diff --git a/intern/ghost/intern/GHOST_NDOFManager.cpp b/intern/ghost/intern/GHOST_NDOFManager.cpp new file mode 100644 index 00000000000..2426146184a --- /dev/null +++ b/intern/ghost/intern/GHOST_NDOFManager.cpp @@ -0,0 +1,127 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include <stdio.h> /* just for printf */ + +#include "GHOST_NDOFManager.h" + + +// the variable is outside the class because it must be accessed from plugin +static volatile GHOST_TEventNDOFData currentNdofValues = {0,0,0,0,0,0,0,0,0,0,0}; + +#if !defined(_WIN32) && !defined(__APPLE__) +#include "GHOST_SystemX11.h" +#endif + +namespace +{ + GHOST_NDOFLibraryInit_fp ndofLibraryInit = 0; + GHOST_NDOFLibraryShutdown_fp ndofLibraryShutdown = 0; + GHOST_NDOFDeviceOpen_fp ndofDeviceOpen = 0; +} + +GHOST_NDOFManager::GHOST_NDOFManager() +{ + m_DeviceHandle = 0; + + // discover the API from the plugin + ndofLibraryInit = 0; + ndofLibraryShutdown = 0; + ndofDeviceOpen = 0; +} + +GHOST_NDOFManager::~GHOST_NDOFManager() +{ + if (ndofLibraryShutdown) + ndofLibraryShutdown(m_DeviceHandle); + + m_DeviceHandle = 0; +} + + +int +GHOST_NDOFManager::deviceOpen(GHOST_IWindow* window, + GHOST_NDOFLibraryInit_fp setNdofLibraryInit, + GHOST_NDOFLibraryShutdown_fp setNdofLibraryShutdown, + GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen) +{ + int Pid; + + ndofLibraryInit = setNdofLibraryInit; + ndofLibraryShutdown = setNdofLibraryShutdown; + ndofDeviceOpen = setNdofDeviceOpen; + + if (ndofLibraryInit && ndofDeviceOpen) + { + Pid= ndofLibraryInit(); +#if 0 + printf("%i client \n", Pid); +#endif + #if defined(_WIN32) || defined(__APPLE__) + m_DeviceHandle = ndofDeviceOpen((void *)¤tNdofValues); + #else + GHOST_SystemX11 *sys; + sys = static_cast<GHOST_SystemX11*>(GHOST_ISystem::getSystem()); + void *ndofInfo = sys->prepareNdofInfo(¤tNdofValues); + m_DeviceHandle = ndofDeviceOpen(ndofInfo); + #endif + return (Pid > 0) ? 0 : 1; + + } else + return 1; +} + + +bool +GHOST_NDOFManager::available() const +{ + return m_DeviceHandle != 0; +} + +bool +GHOST_NDOFManager::event_present() const +{ + if( currentNdofValues.changed >0) { + printf("time %llu but%u x%i y%i z%i rx%i ry%i rz%i \n" , + currentNdofValues.time, currentNdofValues.buttons, + currentNdofValues.tx,currentNdofValues.ty,currentNdofValues.tz, + currentNdofValues.rx,currentNdofValues.ry,currentNdofValues.rz); + return true; + }else + return false; + +} + +void GHOST_NDOFManager::GHOST_NDOFGetDatas(GHOST_TEventNDOFData &datas) const +{ + datas.tx = currentNdofValues.tx; + datas.ty = currentNdofValues.ty; + datas.tz = currentNdofValues.tz; + datas.rx = currentNdofValues.rx; + datas.ry = currentNdofValues.ry; + datas.rz = currentNdofValues.rz; + datas.buttons = currentNdofValues.buttons; + datas.client = currentNdofValues.client; + datas.address = currentNdofValues.address; + datas.time = currentNdofValues.time; + datas.delta = currentNdofValues.delta; +} diff --git a/intern/ghost/intern/GHOST_NDOFManager.h b/intern/ghost/intern/GHOST_NDOFManager.h new file mode 100644 index 00000000000..18d651b89af --- /dev/null +++ b/intern/ghost/intern/GHOST_NDOFManager.h @@ -0,0 +1,52 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef _GHOST_NDOFMANAGER_H_ +#define _GHOST_NDOFMANAGER_H_ + +#include "GHOST_System.h" +#include "GHOST_IWindow.h" + + + +class GHOST_NDOFManager +{ +public: + GHOST_NDOFManager(); + virtual ~GHOST_NDOFManager(); + + int deviceOpen(GHOST_IWindow* window, + GHOST_NDOFLibraryInit_fp setNdofLibraryInit, + GHOST_NDOFLibraryShutdown_fp setNdofLibraryShutdown, + GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen); + + void GHOST_NDOFGetDatas(GHOST_TEventNDOFData &datas) const; + + bool available() const; + bool event_present() const; + +protected: + void* m_DeviceHandle; +}; + + +#endif diff --git a/intern/ghost/intern/GHOST_System.cpp b/intern/ghost/intern/GHOST_System.cpp index 71448a390d7..87e5f375958 100644 --- a/intern/ghost/intern/GHOST_System.cpp +++ b/intern/ghost/intern/GHOST_System.cpp @@ -41,16 +41,18 @@ #include "GHOST_System.h" #include <time.h> +#include <stdio.h> /* just for printf */ #include "GHOST_DisplayManager.h" #include "GHOST_EventManager.h" +#include "GHOST_NDOFManager.h" #include "GHOST_TimerTask.h" #include "GHOST_TimerManager.h" #include "GHOST_WindowManager.h" GHOST_System::GHOST_System() -: m_displayManager(0), m_timerManager(0), m_windowManager(0), m_eventManager(0) +: m_displayManager(0), m_timerManager(0), m_windowManager(0), m_eventManager(0), m_ndofManager(0) { } @@ -236,6 +238,17 @@ GHOST_TSuccess GHOST_System::pushEvent(GHOST_IEvent* event) return success; } +int GHOST_System::openNDOF(GHOST_IWindow* w, + GHOST_NDOFLibraryInit_fp setNdofLibraryInit, + GHOST_NDOFLibraryShutdown_fp setNdofLibraryShutdown, + GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen) +{ + return m_ndofManager->deviceOpen(w, + setNdofLibraryInit, + setNdofLibraryShutdown, + setNdofDeviceOpen); +} + GHOST_TSuccess GHOST_System::getModifierKeyState(GHOST_TModifierKeyMask mask, bool& isDown) const { @@ -268,6 +281,13 @@ GHOST_TSuccess GHOST_System::init() m_timerManager = new GHOST_TimerManager (); m_windowManager = new GHOST_WindowManager (); m_eventManager = new GHOST_EventManager (); + m_ndofManager = new GHOST_NDOFManager(); + +#if 0 + if(m_ndofManager) + printf("ndof manager \n"); +#endif + #ifdef GHOST_DEBUG if (m_eventManager) { m_eventManager->addConsumer(&m_eventPrinter); @@ -303,6 +323,10 @@ GHOST_TSuccess GHOST_System::exit() delete m_eventManager; m_eventManager = 0; } + if (m_ndofManager) { + delete m_ndofManager; + m_ndofManager = 0; + } return GHOST_kSuccess; } diff --git a/intern/ghost/intern/GHOST_System.h b/intern/ghost/intern/GHOST_System.h index 0484f57246f..efce931860a 100644 --- a/intern/ghost/intern/GHOST_System.h +++ b/intern/ghost/intern/GHOST_System.h @@ -48,6 +48,7 @@ class GHOST_Event; class GHOST_TimerManager; class GHOST_Window; class GHOST_WindowManager; +class GHOST_NDOFManager; /** * Implementation of platform independent functionality of the GHOST_ISystem @@ -181,6 +182,27 @@ public: */ virtual GHOST_TSuccess addEventConsumer(GHOST_IEventConsumer* consumer); + + + /*************************************************************************************** + ** N-degree of freedom devcice management functionality + ***************************************************************************************/ + + /** Inherited from GHOST_ISystem + * Opens the N-degree of freedom device manager + * return 0 if device found, 1 otherwise + */ + virtual int openNDOF(GHOST_IWindow* w, + GHOST_NDOFLibraryInit_fp setNdofLibraryInit, + GHOST_NDOFLibraryShutdown_fp setNdofLibraryShutdown, + GHOST_NDOFDeviceOpen_fp setNdofDeviceOpen); + +// original patch only +// GHOST_NDOFEventHandler_fp setNdofEventHandler); + + + + /*************************************************************************************** ** Cursor management functionality ***************************************************************************************/ @@ -240,6 +262,12 @@ public: */ virtual inline GHOST_WindowManager* getWindowManager() const; + /** + * Returns a pointer to our n-degree of freedeom manager. + * @return A pointer to our n-degree of freedeom manager. + */ + virtual inline GHOST_NDOFManager* getNDOFManager() const; + /** * Returns the state of all modifier keys. * @param keys The state of all modifier keys (true == pressed). @@ -254,6 +282,21 @@ public: */ virtual GHOST_TSuccess getButtons(GHOST_Buttons& buttons) const = 0; + /** + * Returns the selection buffer + * @param flag Only used on X11 + * @return Returns the clipboard data + * + */ + virtual GHOST_TUns8* getClipboard(int flag) const = 0; + + /** + * Put data to the Clipboard + * @param buffer The buffer to copy to the clipboard + * @param flag The clipboard to copy too only used on X11 + */ + virtual void putClipboard(GHOST_TInt8 *buffer, int flag) const = 0; + protected: /** * Initialize the system. @@ -287,6 +330,9 @@ protected: /** The event manager. */ GHOST_EventManager* m_eventManager; + /** The N-degree of freedom device manager */ + GHOST_NDOFManager* m_ndofManager; + /** Prints all the events. */ #ifdef GHOST_DEBUG GHOST_EventPrinter m_eventPrinter; @@ -311,5 +357,10 @@ inline GHOST_WindowManager* GHOST_System::getWindowManager() const return m_windowManager; } +inline GHOST_NDOFManager* GHOST_System::getNDOFManager() const +{ + return m_ndofManager; +} + #endif // _GHOST_SYSTEM_H_ diff --git a/intern/ghost/intern/GHOST_SystemCarbon.cpp b/intern/ghost/intern/GHOST_SystemCarbon.cpp index e1980521eb0..5de00d9ab3e 100644 --- a/intern/ghost/intern/GHOST_SystemCarbon.cpp +++ b/intern/ghost/intern/GHOST_SystemCarbon.cpp @@ -34,10 +34,9 @@ * @date May 7, 2001 */ -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif +#include <Carbon/Carbon.h> +#include <ApplicationServices/ApplicationServices.h> #include "GHOST_SystemCarbon.h" #include "GHOST_DisplayManagerCarbon.h" @@ -45,22 +44,34 @@ #include "GHOST_EventButton.h" #include "GHOST_EventCursor.h" #include "GHOST_EventWheel.h" +#include "GHOST_EventNDOF.h" + #include "GHOST_TimerManager.h" #include "GHOST_TimerTask.h" #include "GHOST_WindowManager.h" #include "GHOST_WindowCarbon.h" +#include "GHOST_NDOFManager.h" +#include "AssertMacros.h" #define GHOST_KEY_SWITCH(mac, ghost) { case (mac): ghostKey = (ghost); break; } +/* blender class and types events */ +enum { + kEventClassBlender = 'blnd' +}; + +enum { + kEventBlenderNdofAxis = 1, + kEventBlenderNdofButtons = 2 +}; + const EventTypeSpec kEvents[] = { { kEventClassAppleEvent, kEventAppleEvent }, - /* { kEventClassApplication, kEventAppActivated }, { kEventClassApplication, kEventAppDeactivated }, */ - { kEventClassKeyboard, kEventRawKeyDown }, { kEventClassKeyboard, kEventRawKeyRepeat }, { kEventClassKeyboard, kEventRawKeyUp }, @@ -81,7 +92,12 @@ const EventTypeSpec kEvents[] = { kEventClassWindow, kEventWindowActivated }, { kEventClassWindow, kEventWindowDeactivated }, { kEventClassWindow, kEventWindowUpdate }, - { kEventClassWindow, kEventWindowBoundsChanged } + { kEventClassWindow, kEventWindowBoundsChanged }, + + { kEventClassBlender, kEventBlenderNdofAxis }, + { kEventClassBlender, kEventBlenderNdofButtons } + + }; @@ -386,7 +402,8 @@ GHOST_IWindow* GHOST_SystemCarbon::createWindow( GHOST_TUns32 height, GHOST_TWindowState state, GHOST_TDrawingContextType type, - bool stereoVisual + bool stereoVisual, + const GHOST_TEmbedderWindowID parentWindow ) { GHOST_IWindow* window = 0; @@ -413,7 +430,9 @@ GHOST_IWindow* GHOST_SystemCarbon::createWindow( return window; } - +/* this is an old style low level event queue. + As we want to handle our own timers, this is ok. + the full screen hack should be removed */ bool GHOST_SystemCarbon::processEvents(bool waitForEvent) { bool anyProcessed = false; @@ -421,7 +440,7 @@ bool GHOST_SystemCarbon::processEvents(bool waitForEvent) do { GHOST_TimerManager* timerMgr = getTimerManager(); - + if (waitForEvent) { GHOST_TUns64 next = timerMgr->nextFireTime(); double timeOut; @@ -450,6 +469,8 @@ bool GHOST_SystemCarbon::processEvents(bool waitForEvent) } } + + /* end loop when no more events available */ while (::ReceiveNextEvent(0, NULL, 0, true, &event)==noErr) { OSStatus status= ::SendEventToEventTarget(event, ::GetEventDispatcherTarget()); if (status==noErr) { @@ -461,7 +482,9 @@ bool GHOST_SystemCarbon::processEvents(bool waitForEvent) * are, but we get a lot of them */ if (i!='cgs ') { - //printf("Missed - Class: '%.4s', Kind: %d\n", &i, ::GetEventKind(event)); + if (i!='tblt') { // tablet event. we use the one packaged in the mouse event + ; //printf("Missed - Class: '%.4s', Kind: %d\n", &i, ::GetEventKind(event)); + } } } ::ReleaseEvent(event); @@ -605,6 +628,7 @@ OSErr GHOST_SystemCarbon::sAEHandlerQuit(const AppleEvent *event, AppleEvent *re GHOST_TSuccess GHOST_SystemCarbon::init() { + GHOST_TSuccess success = GHOST_System::init(); if (success) { /* @@ -624,6 +648,7 @@ GHOST_TSuccess GHOST_SystemCarbon::init() ::AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments, sAEHandlerOpenDocs, (SInt32) this, false); ::AEInstallEventHandler(kCoreEventClass, kAEPrintDocuments, sAEHandlerPrintDocs, (SInt32) this, false); ::AEInstallEventHandler(kCoreEventClass, kAEQuitApplication, sAEHandlerQuit, (SInt32) this, false); + } return success; } @@ -760,6 +785,7 @@ OSStatus GHOST_SystemCarbon::handleTabletEvent(EventRef event) } err = noErr; } + } OSStatus GHOST_SystemCarbon::handleMouseEvent(EventRef event) @@ -962,7 +988,7 @@ bool GHOST_SystemCarbon::handleMouseDown(EventRef event) GHOST_ASSERT(ghostWindow, "GHOST_SystemCarbon::handleMouseEvent: ghostWindow==0"); if (::TrackGoAway(window, mousePos)) { - // todo: add option-close, because itØs in the HIG + // todo: add option-close, because itÿs in the HIG // if (event.modifiers & optionKey) { // Close the clean documents, others will be confirmed one by one. //} @@ -1040,11 +1066,15 @@ bool GHOST_SystemCarbon::handleMenuCommand(GHOST_TInt32 menuResult) return handled; } + OSStatus GHOST_SystemCarbon::sEventHandlerProc(EventHandlerCallRef handler, EventRef event, void* userData) { GHOST_SystemCarbon* sys = (GHOST_SystemCarbon*) userData; OSStatus err = eventNotHandledErr; - + GHOST_IWindow* window; + GHOST_TEventNDOFData data; + UInt32 kind; + switch (::GetEventClass(event)) { case kEventClassAppleEvent: @@ -1062,7 +1092,102 @@ OSStatus GHOST_SystemCarbon::sEventHandlerProc(EventHandlerCallRef handler, Even case kEventClassKeyboard: err = sys->handleKeyEvent(event); break; - } + case kEventClassBlender : + window = sys->m_windowManager->getActiveWindow(); + sys->m_ndofManager->GHOST_NDOFGetDatas(data); + kind = ::GetEventKind(event); + + switch (kind) + { + case 1: + sys->m_eventManager->pushEvent(new GHOST_EventNDOF(sys->getMilliSeconds(), GHOST_kEventNDOFMotion, window, data)); + // printf("motion\n"); + break; + case 2: + sys->m_eventManager->pushEvent(new GHOST_EventNDOF(sys->getMilliSeconds(), GHOST_kEventNDOFButton, window, data)); +// printf("button\n"); + break; + } + err = noErr; + break; + default : + ; + break; + } return err; } + +GHOST_TUns8* GHOST_SystemCarbon::getClipboard(int flag) const +{ + PasteboardRef inPasteboard; + PasteboardItemID itemID; + CFDataRef flavorData; + OSStatus err = noErr; + GHOST_TUns8 * temp_buff; + CFRange range; + OSStatus syncFlags; + + err = PasteboardCreate(kPasteboardClipboard, &inPasteboard); + if(err != noErr) { return NULL;} + + syncFlags = PasteboardSynchronize( inPasteboard ); + /* as we always get in a new string, we can safely ignore sync flags if not an error*/ + if(syncFlags <0) { return NULL;} + + + err = PasteboardGetItemIdentifier( inPasteboard, 1, &itemID ); + if(err != noErr) { return NULL;} + + err = PasteboardCopyItemFlavorData( inPasteboard, itemID, CFSTR("public.utf8-plain-text"), &flavorData); + if(err != noErr) { return NULL;} + + range = CFRangeMake(0, CFDataGetLength(flavorData)); + + temp_buff = (GHOST_TUns8*) malloc(range.length+1); + + CFDataGetBytes(flavorData, range, (UInt8*)temp_buff); + + temp_buff[range.length] = '\0'; + + if(temp_buff) { + return temp_buff; + } else { + return NULL; + } +} + +void GHOST_SystemCarbon::putClipboard(GHOST_TInt8 *buffer, int flag) const +{ + if(flag == 1) {return;} //If Flag is 1 means the selection and is used on X11 + + PasteboardRef inPasteboard; + CFDataRef textData = NULL; + OSStatus err = noErr; /*For error checking*/ + OSStatus syncFlags; + + err = PasteboardCreate(kPasteboardClipboard, &inPasteboard); + if(err != noErr) { return;} + + syncFlags = PasteboardSynchronize( inPasteboard ); + /* as we always put in a new string, we can safely ignore sync flags */ + if(syncFlags <0) { return;} + + err = PasteboardClear( inPasteboard ); + if(err != noErr) { return;} + + textData = CFDataCreate(kCFAllocatorDefault, (UInt8*)buffer, strlen(buffer)); + + if (textData) { + err = PasteboardPutItemFlavor( inPasteboard, (PasteboardItemID)1, CFSTR("public.utf8-plain-text"), textData, 0); + if(err != noErr) { + if(textData) { CFRelease(textData);} + return; + } + } + + if(textData) { + CFRelease(textData); + } +} + diff --git a/intern/ghost/intern/GHOST_SystemCarbon.h b/intern/ghost/intern/GHOST_SystemCarbon.h index 6f59710f019..2a1d6325784 100644 --- a/intern/ghost/intern/GHOST_SystemCarbon.h +++ b/intern/ghost/intern/GHOST_SystemCarbon.h @@ -57,12 +57,12 @@ public: /** * Constructor. */ - GHOST_SystemCarbon::GHOST_SystemCarbon(); + GHOST_SystemCarbon(); /** * Destructor. */ - GHOST_SystemCarbon::~GHOST_SystemCarbon(); + ~GHOST_SystemCarbon(); /*************************************************************************************** ** Time(r) functionality @@ -103,6 +103,7 @@ public: * @param height The height the window. * @param state The state of the window when opened. * @param type The type of drawing context installed in this window. + * @param parentWindow Parent (embedder) window * @return The new window (or 0 if creation failed). */ virtual GHOST_IWindow* createWindow( @@ -113,7 +114,8 @@ public: GHOST_TUns32 height, GHOST_TWindowState state, GHOST_TDrawingContextType type, - const bool stereoVisual + const bool stereoVisual, + const GHOST_TEmbedderWindowID parentWindow = 0 ); /*************************************************************************************** @@ -165,6 +167,20 @@ public: */ virtual GHOST_TSuccess getButtons(GHOST_Buttons& buttons) const; + /** + * Returns Clipboard data + * @param flag Indicate which buffer to return + * @return Returns the selected buffer + */ + virtual GHOST_TUns8* getClipboard(int flag) const; + + /** + * Puts buffer to system clipboard + * @param buffer The buffer to be copied + * @param flag Indicates which buffer to copy too Only used on X11 + */ + virtual void putClipboard(GHOST_TInt8 *buffer, int flag) const; + protected: /** * Initializes the system. @@ -221,6 +237,10 @@ protected: */ bool handleMenuCommand(GHOST_TInt32 menuResult); + /* callback for blender generated events */ +// static OSStatus blendEventHandlerProc(EventHandlerCallRef handler, EventRef event, void* userData); + + /** * Callback for Carbon when it has events. */ diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp index 61b504400d2..6b5fcfe7705 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -40,6 +40,14 @@ #include "GHOST_SystemWin32.h" +// win64 doesn't define GWL_USERDATA +#ifdef WIN32 +#ifndef GWL_USERDATA +#define GWL_USERDATA GWLP_USERDATA +#define GWL_WNDPROC GWLP_WNDPROC +#endif +#endif + /* * According to the docs the mouse wheel message is supported from windows 98 * upwards. Leaving WINVER at default value, the WM_MOUSEWHEEL message and the @@ -59,10 +67,12 @@ #include "GHOST_EventCursor.h" #include "GHOST_EventKey.h" #include "GHOST_EventWheel.h" +#include "GHOST_EventNDOF.h" #include "GHOST_TimerTask.h" #include "GHOST_TimerManager.h" #include "GHOST_WindowManager.h" #include "GHOST_WindowWin32.h" +#include "GHOST_NDOFManager.h" // Key code values not found in winuser.h #ifndef VK_MINUS @@ -157,7 +167,7 @@ GHOST_IWindow* GHOST_SystemWin32::createWindow( const STR_String& title, GHOST_TInt32 left, GHOST_TInt32 top, GHOST_TUns32 width, GHOST_TUns32 height, GHOST_TWindowState state, GHOST_TDrawingContextType type, - bool stereoVisual) + bool stereoVisual, const GHOST_TEmbedderWindowID parentWindow ) { GHOST_Window* window = 0; window = new GHOST_WindowWin32 (title, left, top, width, height, state, type, stereoVisual); @@ -299,6 +309,15 @@ GHOST_TSuccess GHOST_SystemWin32::init() { GHOST_TSuccess success = GHOST_System::init(); + /* Disable scaling on high DPI displays on Vista */ + HMODULE user32 = ::LoadLibraryA("user32.dll"); + typedef BOOL (WINAPI * LPFNSETPROCESSDPIAWARE)(); + LPFNSETPROCESSDPIAWARE SetProcessDPIAware = + (LPFNSETPROCESSDPIAWARE)GetProcAddress(user32, "SetProcessDPIAware"); + if (SetProcessDPIAware) + SetProcessDPIAware(); + FreeLibrary(user32); + // Determine whether this system has a high frequency performance counter. */ m_hasPerformanceCounter = ::QueryPerformanceFrequency((LARGE_INTEGER*)&m_freq) == TRUE; if (m_hasPerformanceCounter) { @@ -843,6 +862,28 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, * In GHOST, we let DefWindowProc call the timer callback. */ break; + case WM_BLND_NDOF_AXIS: + { + GHOST_TEventNDOFData ndofdata; + system->m_ndofManager->GHOST_NDOFGetDatas(ndofdata); + system->m_eventManager-> + pushEvent(new GHOST_EventNDOF( + system->getMilliSeconds(), + GHOST_kEventNDOFMotion, + window, ndofdata)); + } + break; + case WM_BLND_NDOF_BTN: + { + GHOST_TEventNDOFData ndofdata; + system->m_ndofManager->GHOST_NDOFGetDatas(ndofdata); + system->m_eventManager-> + pushEvent(new GHOST_EventNDOF( + system->getMilliSeconds(), + GHOST_kEventNDOFButton, + window, ndofdata)); + } + break; } } else { @@ -871,3 +912,58 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, } return lResult; } + +GHOST_TUns8* GHOST_SystemWin32::getClipboard(int flag) const +{ + char *buffer; + char *temp_buff; + + if ( IsClipboardFormatAvailable(CF_TEXT) && OpenClipboard(NULL) ) { + HANDLE hData = GetClipboardData( CF_TEXT ); + if (hData == NULL) { + CloseClipboard(); + return NULL; + } + buffer = (char*)GlobalLock( hData ); + + temp_buff = (char*) malloc(strlen(buffer)+1); + strcpy(temp_buff, buffer); + + GlobalUnlock( hData ); + CloseClipboard(); + + temp_buff[strlen(buffer)] = '\0'; + if (buffer) { + return (GHOST_TUns8*)temp_buff; + } else { + return NULL; + } + } else { + return NULL; + } +} + +void GHOST_SystemWin32::putClipboard(GHOST_TInt8 *buffer, int flag) const +{ + if(flag == 1) {return;} //If Flag is 1 means the selection and is used on X11 + if (OpenClipboard(NULL)) { + HLOCAL clipbuffer; + char *data; + + if (buffer) { + EmptyClipboard(); + + clipbuffer = LocalAlloc(LMEM_FIXED,((strlen(buffer)+1))); + data = (char*)GlobalLock(clipbuffer); + + strcpy(data, (char*)buffer); + data[strlen(buffer)] = '\0'; + LocalUnlock(clipbuffer); + SetClipboardData(CF_TEXT,clipbuffer); + } + CloseClipboard(); + } else { + return; + } +} + diff --git a/intern/ghost/intern/GHOST_SystemWin32.h b/intern/ghost/intern/GHOST_SystemWin32.h index 968586965ed..00f7af00162 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.h +++ b/intern/ghost/intern/GHOST_SystemWin32.h @@ -109,13 +109,14 @@ public: * @param height The height the window. * @param state The state of the window when opened. * @param type The type of drawing context installed in this window. + * @param parentWindow Parent (embedder) window * @return The new window (or 0 if creation failed). */ virtual GHOST_IWindow* createWindow( const STR_String& title, GHOST_TInt32 left, GHOST_TInt32 top, GHOST_TUns32 width, GHOST_TUns32 height, GHOST_TWindowState state, GHOST_TDrawingContextType type, - const bool stereoVisual); + const bool stereoVisual, const GHOST_TEmbedderWindowID parentWindow = 0 ); /*************************************************************************************** ** Event management functionality @@ -167,6 +168,20 @@ public: */ virtual GHOST_TSuccess getButtons(GHOST_Buttons& buttons) const; + /** + * Returns unsinged char from CUT_BUFFER0 + * @param flag Flag is not used on win32 on used on X11 + * @return Returns the Clipboard + */ + virtual GHOST_TUns8* getClipboard(int flag) const; + + /** + * Puts buffer to system clipboard + * @param flag Flag is not used on win32 on used on X11 + * @return No return + */ + virtual void putClipboard(GHOST_TInt8 *buffer, int flag) const; + protected: /** * Initializes the system. diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp index 170a7c23843..5a145510e54 100644 --- a/intern/ghost/intern/GHOST_SystemX11.cpp +++ b/intern/ghost/intern/GHOST_SystemX11.cpp @@ -26,34 +26,6 @@ * ***** END GPL LICENSE BLOCK ***** */ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - #ifdef HAVE_CONFIG_H #include <config.h> #endif @@ -66,12 +38,15 @@ #include "GHOST_EventKey.h" #include "GHOST_EventButton.h" #include "GHOST_EventWheel.h" +#include "GHOST_EventNDOF.h" +#include "GHOST_NDOFManager.h" #include "GHOST_DisplayManagerX11.h" #include "GHOST_Debug.h" #include <X11/Xatom.h> #include <X11/keysym.h> +#include <X11/XKBlib.h> /* allow detectable autorepeate */ #ifdef __sgi @@ -89,6 +64,24 @@ #include <unistd.h> #include <vector> +#include <stdio.h> // for fprintf only + +typedef struct NDOFPlatformInfo { + Display *display; + Window window; + volatile GHOST_TEventNDOFData *currValues; + Atom cmdAtom; + Atom motionAtom; + Atom btnPressAtom; + Atom btnRelAtom; +} NDOFPlatformInfo; + +static NDOFPlatformInfo sNdofInfo = {NULL, 0, NULL, 0, 0, 0, 0}; + + +//these are for copy and select copy +static char *txt_cut_buffer= NULL; +static char *txt_select_buffer= NULL; using namespace std; @@ -103,15 +96,17 @@ GHOST_SystemX11( if (!m_display) return; #ifdef __sgi - m_delete_window_atom = XSGIFastInternAtom(m_display, - "WM_DELETE_WINDOW", - SGI_XA_WM_DELETE_WINDOW, - False); + m_delete_window_atom + = XSGIFastInternAtom(m_display, + "WM_DELETE_WINDOW", + SGI_XA_WM_DELETE_WINDOW, False); #else - m_delete_window_atom = XInternAtom(m_display, - "WM_DELETE_WINDOW", False); + m_delete_window_atom + = XInternAtom(m_display, "WM_DELETE_WINDOW", True); #endif + m_wm_protocols= XInternAtom(m_display, "WM_PROTOCOLS", False); + m_wm_take_focus= XInternAtom(m_display, "WM_TAKE_FOCUS", False); m_wm_state= XInternAtom(m_display, "WM_STATE", False); m_wm_change_state= XInternAtom(m_display, "WM_CHANGE_STATE", False); m_net_state= XInternAtom(m_display, "_NET_WM_STATE", False); @@ -123,6 +118,7 @@ GHOST_SystemX11( "_NET_WM_STATE_FULLSCREEN", False); m_motif= XInternAtom(m_display, "_MOTIF_WM_HINTS", False); + // compute the initial time timeval tv; if (gettimeofday(&tv,NULL) == -1) { @@ -130,6 +126,18 @@ GHOST_SystemX11( } m_start_time = GHOST_TUns64(tv.tv_sec*1000 + tv.tv_usec/1000); + + + /* use detectable autorepeate, mac and windows also do this */ + int use_xkb; + int xkb_opcode, xkb_event, xkb_error; + int xkb_major = XkbMajorVersion, xkb_minor = XkbMinorVersion; + + use_xkb = XkbQueryExtension(m_display, &xkb_opcode, &xkb_event, &xkb_error, &xkb_major, &xkb_minor); + if (use_xkb) { + XkbSetDetectableAutoRepeat(m_display, true, NULL); + } + } GHOST_TSuccess @@ -150,8 +158,6 @@ init( return GHOST_kFailure; } - - GHOST_TUns64 GHOST_SystemX11:: @@ -199,6 +205,7 @@ getMainDisplayDimensions( * @param height The height the window. * @param state The state of the window when opened. * @param type The type of drawing context installed in this window. + * @param parentWindow Parent (embedder) window * @return The new window (or 0 if creation failed). */ GHOST_IWindow* @@ -211,14 +218,18 @@ createWindow( GHOST_TUns32 height, GHOST_TWindowState state, GHOST_TDrawingContextType type, - bool stereoVisual + bool stereoVisual, + const GHOST_TEmbedderWindowID parentWindow ){ GHOST_WindowX11 * window = 0; if (!m_display) return 0; + + + window = new GHOST_WindowX11 ( - this,m_display,title, left, top, width, height, state, type, stereoVisual + this,m_display,title, left, top, width, height, state, parentWindow, type, stereoVisual ); if (window) { @@ -240,7 +251,6 @@ createWindow( } } return window; - } GHOST_WindowX11 * @@ -344,7 +354,7 @@ GHOST_SystemX11::processEvent(XEvent *xe) if (!window) { return; } - + switch (xe->type) { case Expose: { @@ -484,20 +494,54 @@ GHOST_SystemX11::processEvent(XEvent *xe) XClientMessageEvent & xcme = xe->xclient; #ifndef __sgi - if (xcme.data.l[0] == m_delete_window_atom) { + if (((Atom)xcme.data.l[0]) == m_delete_window_atom) { g_event = new GHOST_Event( getMilliSeconds(), GHOST_kEventWindowClose, window ); + } else +#endif + if (sNdofInfo.currValues) { + static GHOST_TEventNDOFData data = {0,0,0,0,0,0,0,0,0,0,0}; + if (xcme.message_type == sNdofInfo.motionAtom) + { + data.changed = 1; + data.delta = xcme.data.s[8] - data.time; + data.time = xcme.data.s[8]; + data.tx = xcme.data.s[2] >> 2; + data.ty = xcme.data.s[3] >> 2; + data.tz = xcme.data.s[4] >> 2; + data.rx = xcme.data.s[5]; + data.ry = xcme.data.s[6]; + data.rz =-xcme.data.s[7]; + g_event = new GHOST_EventNDOF(getMilliSeconds(), + GHOST_kEventNDOFMotion, + window, data); + } else if (xcme.message_type == sNdofInfo.btnPressAtom) { + data.changed = 2; + data.delta = xcme.data.s[8] - data.time; + data.time = xcme.data.s[8]; + data.buttons = xcme.data.s[2]; + g_event = new GHOST_EventNDOF(getMilliSeconds(), + GHOST_kEventNDOFButton, + window, data); + } + } else if (((Atom)xcme.data.l[0]) == m_wm_take_focus) { + /* as ICCCM say, we need reply this event + * with a SetInputFocus, the data[1] have + * the valid timestamp (send by the wm). + */ + XSetInputFocus(m_display, xcme.window, RevertToParent, xcme.data.l[1]); } else { /* Unknown client message, ignore */ } -#endif break; } - + + case DestroyNotify: + ::exit(-1); // We're not interested in the following things.(yet...) case NoExpose : case GraphicsExpose : @@ -530,8 +574,57 @@ GHOST_SystemX11::processEvent(XEvent *xe) case MappingNotify: case ReparentNotify: break; - - default: { + case SelectionRequest: + { + XEvent nxe; + Atom target, string, compound_text, c_string; + XSelectionRequestEvent *xse = &xe->xselectionrequest; + + target = XInternAtom(m_display, "TARGETS", False); + string = XInternAtom(m_display, "STRING", False); + compound_text = XInternAtom(m_display, "COMPOUND_TEXT", False); + c_string = XInternAtom(m_display, "C_STRING", False); + + /* support obsolete clients */ + if (xse->property == None) { + xse->property = xse->target; + } + + nxe.xselection.type = SelectionNotify; + nxe.xselection.requestor = xse->requestor; + nxe.xselection.property = xse->property; + nxe.xselection.display = xse->display; + nxe.xselection.selection = xse->selection; + nxe.xselection.target = xse->target; + nxe.xselection.time = xse->time; + + /*Check to see if the requestor is asking for String*/ + if(xse->target == string || xse->target == compound_text || xse->target == c_string) { + if (xse->selection == XInternAtom(m_display, "PRIMARY", False)) { + XChangeProperty(m_display, xse->requestor, xse->property, xse->target, 8, PropModeReplace, (unsigned char*)txt_select_buffer, strlen(txt_select_buffer)); + } else if (xse->selection == XInternAtom(m_display, "CLIPBOARD", False)) { + XChangeProperty(m_display, xse->requestor, xse->property, xse->target, 8, PropModeReplace, (unsigned char*)txt_cut_buffer, strlen(txt_cut_buffer)); + } + } else if (xse->target == target) { + Atom alist[4]; + alist[0] = target; + alist[1] = string; + alist[2] = compound_text; + alist[3] = c_string; + XChangeProperty(m_display, xse->requestor, xse->property, xse->target, 32, PropModeReplace, (unsigned char*)alist, 4); + XFlush(m_display); + } else { + //Change property to None because we do not support anything but STRING + nxe.xselection.property = None; + } + + //Send the event to the client 0 0 == False, SelectionNotify + XSendEvent(m_display, xse->requestor, 0, 0, &nxe); + XFlush(m_display); + break; + } + + default: { if(xe->type == window->GetXTablet().MotionEvent) { XDeviceMotionEvent* data = (XDeviceMotionEvent*)xe; @@ -565,6 +658,17 @@ GHOST_SystemX11::processEvent(XEvent *xe) } } + void * +GHOST_SystemX11:: +prepareNdofInfo(volatile GHOST_TEventNDOFData *currentNdofValues) +{ + const vector<GHOST_IWindow*>& v(m_windowManager->getWindows()); + if (v.size() > 0) + sNdofInfo.window = static_cast<GHOST_WindowX11*>(v[0])->getXWindow(); + sNdofInfo.display = m_display; + sNdofInfo.currValues = currentNdofValues; + return (void*)&sNdofInfo; +} GHOST_TSuccess GHOST_SystemX11:: @@ -902,3 +1006,115 @@ convertXKey( } #undef GXMAP + + GHOST_TUns8* +GHOST_SystemX11:: +getClipboard(int flag +) const { + //Flag + //0 = Regular clipboard 1 = selection + static Atom Primary_atom, clip_String, compound_text; + Atom rtype; + Window m_window, owner; + unsigned char *data, *tmp_data; + int bits; + unsigned long len, bytes; + XEvent xevent; + + vector<GHOST_IWindow *> & win_vec = m_windowManager->getWindows(); + vector<GHOST_IWindow *>::iterator win_it = win_vec.begin(); + GHOST_WindowX11 * window = static_cast<GHOST_WindowX11 *>(*win_it); + m_window = window->getXWindow(); + + clip_String = XInternAtom(m_display, "_BLENDER_STRING", False); + compound_text = XInternAtom(m_display, "COMPOUND_TEXT", False); + + //lets check the owner and if it is us then return the static buffer + if(flag == 0) { + Primary_atom = XInternAtom(m_display, "CLIPBOARD", False); + owner = XGetSelectionOwner(m_display, Primary_atom); + if (owner == m_window) { + data = (unsigned char*) malloc(strlen(txt_cut_buffer)+1); + strcpy((char*)data, txt_cut_buffer); + return (GHOST_TUns8*)data; + } else if (owner == None) { + return NULL; + } + } else { + Primary_atom = XInternAtom(m_display, "PRIMARY", False); + owner = XGetSelectionOwner(m_display, Primary_atom); + if (owner == m_window) { + data = (unsigned char*) malloc(strlen(txt_select_buffer)+1); + strcpy((char*)data, txt_select_buffer); + return (GHOST_TUns8*)data; + } else if (owner == None) { + return NULL; + } + } + + if(!Primary_atom) { + return NULL; + } + + XDeleteProperty(m_display, m_window, Primary_atom); + XConvertSelection(m_display, Primary_atom, compound_text, clip_String, m_window, CurrentTime); //XA_STRING + XFlush(m_display); + + //This needs to change so we do not wait for ever or check owner first + while(1) { + XNextEvent(m_display, &xevent); + if(xevent.type == SelectionNotify) { + if(XGetWindowProperty(m_display, m_window, xevent.xselection.property, 0L, 4096L, False, AnyPropertyType, &rtype, &bits, &len, &bytes, &data) == Success) { + if (data) { + tmp_data = (unsigned char*) malloc(strlen((char*)data)+1); + strcpy((char*)tmp_data, (char*)data); + XFree(data); + return (GHOST_TUns8*)tmp_data; + } + } + return NULL; + } + } +} + + void +GHOST_SystemX11:: +putClipboard( +GHOST_TInt8 *buffer, int flag) const +{ + static Atom Primary_atom; + Window m_window, owner; + + if(!buffer) {return;} + + if(flag == 0) { + Primary_atom = XInternAtom(m_display, "CLIPBOARD", False); + if(txt_cut_buffer) { free((void*)txt_cut_buffer); } + + txt_cut_buffer = (char*) malloc(strlen(buffer)+1); + strcpy(txt_cut_buffer, buffer); + } else { + Primary_atom = XInternAtom(m_display, "PRIMARY", False); + if(txt_select_buffer) { free((void*)txt_select_buffer); } + + txt_select_buffer = (char*) malloc(strlen(buffer)+1); + strcpy(txt_select_buffer, buffer); + } + + vector<GHOST_IWindow *> & win_vec = m_windowManager->getWindows(); + vector<GHOST_IWindow *>::iterator win_it = win_vec.begin(); + GHOST_WindowX11 * window = static_cast<GHOST_WindowX11 *>(*win_it); + m_window = window->getXWindow(); + + if(!Primary_atom) { + return; + } + + XSetSelectionOwner(m_display, Primary_atom, m_window, CurrentTime); + owner = XGetSelectionOwner(m_display, Primary_atom); + if (owner != m_window) + fprintf(stderr, "failed to own primary\n"); + + return; +} + diff --git a/intern/ghost/intern/GHOST_SystemX11.h b/intern/ghost/intern/GHOST_SystemX11.h index c4d7a6ace54..4b0ddd7a4f9 100644 --- a/intern/ghost/intern/GHOST_SystemX11.h +++ b/intern/ghost/intern/GHOST_SystemX11.h @@ -108,6 +108,7 @@ public: * @param state The state of the window when opened. * @param type The type of drawing context installed in this window. * @param stereoVisual Create a stereo visual for quad buffered stereo. + * @param parentWindow Parent (embedder) window * @return The new window (or 0 if creation failed). */ GHOST_IWindow* @@ -119,9 +120,10 @@ public: GHOST_TUns32 height, GHOST_TWindowState state, GHOST_TDrawingContextType type, - const bool stereoVisual + const bool stereoVisual, + const GHOST_TEmbedderWindowID parentWindow = 0 ); - + /** * @section Interface Inherited from GHOST_ISystem */ @@ -193,6 +195,26 @@ public: return m_display; } + void * + prepareNdofInfo( + volatile GHOST_TEventNDOFData *current_values + ); + + /** + * Returns unsinged char from CUT_BUFFER0 + * @param flag Flag indicates which buffer to return 0 for clipboard 1 for selection + * @return Returns the Clipboard indicated by Flag + */ + GHOST_TUns8* + getClipboard(int flag) const; + + /** + * Puts buffer to system clipboard + * @param buffer The buffer to copy to the clipboard + * @param flag Flag indicates which buffer to set ownership of 0 for clipboard 1 for selection + */ + virtual void putClipboard(GHOST_TInt8 *buffer, int flag) const; + /** * Atom used for ICCCM, WM-spec and Motif. * We only need get this atom at the start, it's relative @@ -206,16 +228,14 @@ public: Atom m_net_max_vert; Atom m_net_fullscreen; Atom m_motif; - + Atom m_wm_take_focus; + Atom m_wm_protocols; + Atom m_delete_window_atom; + private : Display * m_display; - /** - * Atom used to detect window close events - */ - Atom m_delete_window_atom; - /// The vector of windows that need to be updated. std::vector<GHOST_WindowX11 *> m_dirty_windows; diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp index e2e4a2323ee..ce1a42176bd 100644 --- a/intern/ghost/intern/GHOST_WindowWin32.cpp +++ b/intern/ghost/intern/GHOST_WindowWin32.cpp @@ -48,6 +48,14 @@ #define M_PI 3.1415926536 #endif +// win64 doesn't define GWL_USERDATA +#ifdef WIN32 +#ifndef GWL_USERDATA +#define GWL_USERDATA GWLP_USERDATA +#define GWL_WNDPROC GWLP_WNDPROC +#endif +#endif + LPCSTR GHOST_WindowWin32::s_windowClassName = "GHOST_WindowClass"; const int GHOST_WindowWin32::s_maxTitleLength = 128; HGLRC GHOST_WindowWin32::s_firsthGLRc = NULL; @@ -441,10 +449,6 @@ GHOST_TSuccess GHOST_WindowWin32::setOrder(GHOST_TWindowOrder order) GHOST_TSuccess GHOST_WindowWin32::swapBuffers() { - // adding a glFinish() here is to prevent Geforce in 'full scene antialias' mode - // from antialising the Blender window. Officially a swapbuffers does a glFinish - // itself, so this feels really like a hack... but it won't harm. (ton) - glFinish(); return ::SwapBuffers(m_hDC) == TRUE ? GHOST_kSuccess : GHOST_kFailure; } @@ -886,12 +890,25 @@ static int EnumPixelFormats(HDC hdc) { for(i=1; i<=n; i++) { /* not the idiom, but it's right */ ::DescribePixelFormat( hdc, i, sizeof(PIXELFORMATDESCRIPTOR), &pfd ); w = WeightPixelFormat(pfd); - if(w > weight) { - weight = w; - iPixelFormat = i; + // be strict on stereo + if (!((sPreferredFormat.dwFlags ^ pfd.dwFlags) & PFD_STEREO)) { + if(w > weight) { + weight = w; + iPixelFormat = i; + } + } + } + if (weight == 0) { + // we could find the correct stereo setting, just find any suitable format + for(i=1; i<=n; i++) { /* not the idiom, but it's right */ + ::DescribePixelFormat( hdc, i, sizeof(PIXELFORMATDESCRIPTOR), &pfd ); + w = WeightPixelFormat(pfd); + if(w > weight) { + weight = w; + iPixelFormat = i; + } } } - return iPixelFormat; } diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp index faf6c5b2a99..3785b325eaf 100644 --- a/intern/ghost/intern/GHOST_WindowX11.cpp +++ b/intern/ghost/intern/GHOST_WindowX11.cpp @@ -35,12 +35,12 @@ #include <X11/cursorfont.h> #include <X11/Xatom.h> -#include <cstdio> - #if defined(__sun__) || defined( __sun ) || defined (__sparc) || defined (__sparc__) #include <strings.h> #endif +#include <cstring> +#include <cstdio> // For obscure full screen mode stuuf // lifted verbatim from blut. @@ -148,6 +148,7 @@ GHOST_WindowX11( GHOST_TUns32 width, GHOST_TUns32 height, GHOST_TWindowState state, + const GHOST_TEmbedderWindowID parentWindow, GHOST_TDrawingContextType type, const bool stereoVisual ) : @@ -165,7 +166,8 @@ GHOST_WindowX11( // X can find us a visual matching those requirements. int attributes[40], i = 0; - + Atom atoms[2]; + int natom; if(m_stereoVisual) attributes[i++] = GLX_STEREO; @@ -211,25 +213,60 @@ GHOST_WindowX11( KeyPressMask | KeyReleaseMask | EnterWindowMask | LeaveWindowMask | ButtonPressMask | ButtonReleaseMask | - PointerMotionMask | FocusChangeMask; + PointerMotionMask | FocusChangeMask | PropertyChangeMask; // create the window! - m_window = - XCreateWindow( - m_display, - RootWindow(m_display, m_visual->screen), - left, - top, - width, - height, - 0, // no border. - m_visual->depth, - InputOutput, - m_visual->visual, - CWBorderPixel|CWColormap|CWEventMask, - &xattributes - ); + ; + if (parentWindow == 0) { + m_window = + XCreateWindow( + m_display, + RootWindow(m_display, m_visual->screen), + left, + top, + width, + height, + 0, // no border. + m_visual->depth, + InputOutput, + m_visual->visual, + CWBorderPixel|CWColormap|CWEventMask, + &xattributes + ); + } else { + + Window root_return; + int x_return,y_return; + unsigned int w_return,h_return,border_w_return,depth_return; + + XGetGeometry(m_display, parentWindow, &root_return, &x_return, &y_return, + &w_return, &h_return, &border_w_return, &depth_return ); + + left = 0; + top = 0; + width = w_return; + height = h_return; + + + m_window = XCreateWindow( + m_display, + parentWindow, // reparent against embedder + left, + top, + width, + height, + 0, // no border. + m_visual->depth, + InputOutput, + m_visual->visual, + CWBorderPixel|CWColormap|CWEventMask, + &xattributes + ); + + XSelectInput(m_display , parentWindow, SubstructureNotifyMask); + + } /* * One of the problem with WM-spec is that can't set a property @@ -273,6 +310,25 @@ GHOST_WindowX11( free(wmclass); XFree(xclasshint); + /* The basic for a good ICCCM "work" */ + if (m_system->m_wm_protocols) { + natom= 0; + + if (m_system->m_delete_window_atom) { + atoms[natom]= m_system->m_delete_window_atom; + natom++; + } + + if (m_system->m_wm_take_focus) { + atoms[natom]= m_system->m_wm_take_focus; + natom++; + } + + if (natom) { + /* printf("Register atoms: %d\n", natom); */ + XSetWMProtocols(m_display, m_window, atoms, natom); + } + } // Set the window icon XWMHints *xwmhints = XAllocWMHints(); @@ -921,9 +977,9 @@ setOrder( xev.xclient.message_type = atom; xev.xclient.format = 32; - xev.xclient.data.l[0] = 0; - xev.xclient.data.l[1] = 0; - xev.xclient.data.l[2] = 0; + xev.xclient.data.l[0] = 1; + xev.xclient.data.l[1] = CurrentTime; + xev.xclient.data.l[2] = m_window; xev.xclient.data.l[3] = 0; xev.xclient.data.l[4] = 0; @@ -1020,6 +1076,15 @@ validate( GHOST_WindowX11:: ~GHOST_WindowX11( ){ + static Atom Primary_atom, Clipboard_atom; + Window p_owner, c_owner; + /*Change the owner of the Atoms to None if we are the owner*/ + Primary_atom = XInternAtom(m_display, "PRIMARY", False); + Clipboard_atom = XInternAtom(m_display, "CLIPBOARD", False); + + p_owner = XGetSelectionOwner(m_display, Primary_atom); + c_owner = XGetSelectionOwner(m_display, Clipboard_atom); + std::map<unsigned int, Cursor>::iterator it = m_standard_cursors.begin(); for (; it != m_standard_cursors.end(); it++) { XFreeCursor(m_display, it->second); @@ -1038,6 +1103,14 @@ GHOST_WindowX11:: } glXDestroyContext(m_display, m_context); } + + if (p_owner == m_window) { + XSetSelectionOwner(m_display, Primary_atom, None, CurrentTime); + } + if (c_owner == m_window) { + XSetSelectionOwner(m_display, Clipboard_atom, None, CurrentTime); + } + XDestroyWindow(m_display, m_window); XFree(m_visual); } diff --git a/intern/ghost/intern/GHOST_WindowX11.h b/intern/ghost/intern/GHOST_WindowX11.h index a80928ae15f..1392e2c19a6 100644 --- a/intern/ghost/intern/GHOST_WindowX11.h +++ b/intern/ghost/intern/GHOST_WindowX11.h @@ -64,6 +64,7 @@ public: * @param width The width the window. * @param height The height the window. * @param state The state the window is initially opened with. + * @param parentWindow Parent (embedder) window * @param type The type of drawing context installed in this window. * @param stereoVisual Stereo visual for quad buffered stereo. */ @@ -76,6 +77,7 @@ public: GHOST_TUns32 width, GHOST_TUns32 height, GHOST_TWindowState state, + const GHOST_TEmbedderWindowID parentWindow, GHOST_TDrawingContextType type = GHOST_kDrawingContextTypeNone, const bool stereoVisual = false ); diff --git a/intern/ghost/intern/Makefile b/intern/ghost/intern/Makefile index f4dfcd30ce0..467ec768720 100644 --- a/intern/ghost/intern/Makefile +++ b/intern/ghost/intern/Makefile @@ -36,6 +36,7 @@ CCSRCS += GHOST_EventManager.cpp GHOST_EventPrinter.cpp GHOST_WindowManager.cpp CCSRCS += GHOST_ISystem.cpp GHOST_ModifierKeys.cpp GHOST_TimerManager.cpp CCSRCS += GHOST_Rect.cpp GHOST_DisplayManager.cpp GHOST_C-api.cpp CCSRCS += GHOST_CallbackEventConsumer.cpp +CCSRCS += GHOST_NDOFManager.cpp include nan_definitions.mk diff --git a/intern/ghost/make/msvc_7_0/ghost.vcproj b/intern/ghost/make/msvc_7_0/ghost.vcproj index 9d0aef451e7..e5b2e09a678 100644 --- a/intern/ghost/make/msvc_7_0/ghost.vcproj +++ b/intern/ghost/make/msvc_7_0/ghost.vcproj @@ -281,6 +281,9 @@ ECHO Done RelativePath="..\..\intern\GHOST_EventManager.h"> </File> <File + RelativePath="..\..\intern\GHOST_EventNDOF.h"> + </File> + <File RelativePath="..\..\intern\GHOST_EventPrinter.h"> </File> <File @@ -293,6 +296,9 @@ ECHO Done RelativePath="..\..\intern\GHOST_ModifierKeys.h"> </File> <File + RelativePath="..\..\intern\GHOST_NDOFManager.cpp"> + </File> + <File RelativePath="..\..\intern\GHOST_System.h"> </File> <File @@ -374,6 +380,9 @@ ECHO Done RelativePath="..\..\intern\GHOST_ModifierKeys.cpp"> </File> <File + RelativePath="..\..\intern\GHOST_NDOFManager.cpp"> + </File> + <File RelativePath="..\..\intern\GHOST_Rect.cpp"> </File> <File diff --git a/intern/ghost/make/msvc_9_0/ghost.vcproj b/intern/ghost/make/msvc_9_0/ghost.vcproj new file mode 100644 index 00000000000..fa128786a90 --- /dev/null +++ b/intern/ghost/make/msvc_9_0/ghost.vcproj @@ -0,0 +1,539 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9,00"
+ Name="INT_ghost"
+ ProjectGUID="{76D90B92-ECC7-409C-9F98-A8814B90F3C0}"
+ RootNamespace="ghost"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Blender Release|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\ghost"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\ghost"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="..\..;..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\lib\windows\wintab\INCLUDE"
+ PreprocessorDefinitions="WIN32,NDEBUG,_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\ghost\ghost.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\ghost\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\ghost\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\ghost\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\libghost.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying GHOST files library (release target) to lib tree."
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\ghost\include MKDIR ..\..\..\..\..\build\msvc_9\intern\ghost\include
XCOPY /Y ..\..\*.h ..\..\..\..\..\build\msvc_9\intern\ghost\include
ECHO Done
"
+ />
+ </Configuration>
+ <Configuration
+ Name="Blender Debug|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\ghost\debug"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\ghost\debug"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..;..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\lib\windows\wintab\INCLUDE"
+ PreprocessorDefinitions="WIN32,_DEBUG,_LIB,_USE_MATH_DEFINES"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\ghost\debug\ghost.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\ghost\debug\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\ghost\debug\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\ghost\debug\"
+ BrowseInformation="1"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="3"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\debug\libghost.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying GHOST files library (debug target) to lib tree."
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\ghost\include MKDIR ..\..\..\..\..\build\msvc_9\intern\ghost\include
XCOPY /Y ..\..\*.h ..\..\..\..\..\build\msvc_9\intern\ghost\include
ECHO Done
"
+ />
+ </Configuration>
+ <Configuration
+ Name="3DPlugin Release|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\ghost\mtdll"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\ghost\mtdll"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="..\..;..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\lib\windows\wintab\INCLUDE"
+ PreprocessorDefinitions="WIN32,NDEBUG,_LIB"
+ StringPooling="true"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\ghost\mtdll\ghost.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\ghost\mtdll\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\ghost\mtdll\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\ghost\mtdll\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\mtdll\libghost.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying GHOST files library (release target) to lib tree."
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\ghost\include MKDIR ..\..\..\..\..\build\msvc_9\intern\ghost\include
XCOPY /Y ..\..\*.h ..\..\..\..\..\build\msvc_9\intern\ghost\include
ECHO Done
"
+ />
+ </Configuration>
+ <Configuration
+ Name="3DPlugin Debug|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\ghost\mtdll\debug"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\ghost\mtdll\debug"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..;..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\lib\windows\wintab\INCLUDE"
+ PreprocessorDefinitions="WIN32,_DEBUG,_LIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\ghost\mtdll\debug\ghost.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\ghost\mtdll\debug\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\ghost\mtdll\debug\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\ghost\mtdll\debug\"
+ BrowseInformation="1"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="3"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\mtdll\debug\libghost.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying GHOST files library (debug target) to lib tree."
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\ghost\include MKDIR ..\..\..\..\..\build\msvc_9\intern\ghost\include
XCOPY /Y ..\..\*.h ..\..\..\..\..\build\msvc_9\intern\ghost\include
ECHO Done
"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Header Files"
+ >
+ <Filter
+ Name="intern"
+ >
+ <File
+ RelativePath="..\..\intern\GHOST_Buttons.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\GHOST_CallbackEventConsumer.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\GHOST_Debug.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\GHOST_DisplayManager.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\GHOST_DisplayManagerWin32.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\GHOST_Event.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\GHOST_EventButton.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\GHOST_EventCursor.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\GHOST_EventKey.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\GHOST_EventManager.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\GHOST_EventNDOF.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\GHOST_EventPrinter.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\GHOST_EventWheel.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\GHOST_EventWindow.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\GHOST_ModifierKeys.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\GHOST_NDOFManager.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\GHOST_System.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\GHOST_SystemWin32.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\GHOST_TimerManager.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\GHOST_TimerTask.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\GHOST_Window.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\GHOST_WindowManager.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\GHOST_WindowWin32.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="extern"
+ >
+ <File
+ RelativePath="..\..\GHOST_C-api.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\GHOST_IEvent.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\GHOST_IEventConsumer.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\GHOST_ISystem.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\GHOST_ITimerTask.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\GHOST_IWindow.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\GHOST_Rect.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\GHOST_Types.h"
+ >
+ </File>
+ </Filter>
+ </Filter>
+ <Filter
+ Name="Source Files"
+ >
+ <File
+ RelativePath="..\..\intern\GHOST_Buttons.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\GHOST_C-api.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\GHOST_CallbackEventConsumer.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\GHOST_DisplayManager.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\GHOST_DisplayManagerWin32.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\GHOST_EventManager.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\GHOST_EventPrinter.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\GHOST_ISystem.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\GHOST_ModifierKeys.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\GHOST_NDOFManager.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\GHOST_Rect.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\GHOST_System.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\GHOST_SystemWin32.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\GHOST_TimerManager.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\GHOST_Window.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\GHOST_WindowManager.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\GHOST_WindowWin32.cpp"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/intern/guardedalloc/BLO_sys_types.h b/intern/guardedalloc/BLO_sys_types.h new file mode 100644 index 00000000000..5ed3117c890 --- /dev/null +++ b/intern/guardedalloc/BLO_sys_types.h @@ -0,0 +1,125 @@ +/** + * $Id$ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + * A platform-independent definition of [u]intXX_t + * Plus the accompanying header include for htonl/ntohl + * + * This file includes <sys/types.h> to define [u]intXX_t types, where + * XX can be 8, 16, 32 or 64. Unfortunately, not all systems have this + * file. + * - Windows uses __intXX compiler-builtin types. These are signed, + * so we have to flip the signs. + * For these rogue platforms, we make the typedefs ourselves. + * + */ + +/* +// DG: original BLO_sys_types.h is in source/blender/blenkernel +// but is not allowed be accessed here because of bad-level-call +*/ + +#ifndef BLO_SYS_TYPES_H +#define BLO_SYS_TYPES_H + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(_WIN32) && !defined(FREE_WINDOWS) + +/* The __intXX are built-in types of the visual complier! So we don't + * need to include anything else here. */ + +typedef signed __int8 int8_t; +typedef signed __int16 int16_t; +typedef signed __int32 int32_t; +typedef signed __int64 int64_t; + +typedef unsigned __int8 uint8_t; +typedef unsigned __int16 uint16_t; +typedef unsigned __int32 uint32_t; +typedef unsigned __int64 uint64_t; + +#ifndef _INTPTR_T_DEFINED +#ifdef _WIN64 +typedef __int64 intptr_t; +#else +typedef long intptr_t; +#endif +#define _INTPTR_T_DEFINED +#endif + +#ifndef _UINTPTR_T_DEFINED +#ifdef _WIN64 +typedef unsigned __int64 uintptr_t; +#else +typedef unsigned long uintptr_t; +#endif +#define _UINTPTR_T_DEFINED +#endif + +#elif defined(__linux__) + + /* Linux-i386, Linux-Alpha, Linux-ppc */ +#include <stdint.h> + +#elif defined (__APPLE__) + +#include <inttypes.h> + +#elif defined(FREE_WINDOWS) + +#include <stdint.h> + +#else + + /* FreeBSD, Irix, Solaris */ +#include <sys/types.h> + +#endif /* ifdef platform for types */ + +#ifdef _WIN32 +#ifndef htonl +#define htonl(x) correctByteOrder(x) +#endif +#ifndef ntohl +#define ntohl(x) correctByteOrder(x) +#endif +#elif defined (__FreeBSD__) || defined (__OpenBSD__) +#include <sys/param.h> +#elif defined (__APPLE__) +#include <sys/types.h> +#else /* irix sun linux */ +#include <netinet/in.h> +#endif /* ifdef platform for htonl/ntohl */ + +#ifdef __cplusplus +} +#endif + +#endif /* eof */ + diff --git a/intern/guardedalloc/MEM_guardedalloc.h b/intern/guardedalloc/MEM_guardedalloc.h index ef40b2a1163..1d4c753802b 100644 --- a/intern/guardedalloc/MEM_guardedalloc.h +++ b/intern/guardedalloc/MEM_guardedalloc.h @@ -58,8 +58,8 @@ #ifndef MEM_MALLOCN_H #define MEM_MALLOCN_H -/* Needed for FILE* */ -#include "stdio.h" +#include "stdio.h" /* needed for FILE* */ +#include "BLO_sys_types.h" /* needed for uintptr_t */ #ifdef __cplusplus extern "C" { @@ -97,9 +97,16 @@ extern "C" { void *MEM_mapallocN(unsigned int len, const char * str); /** Print a list of the names and sizes of all allocated memory + * blocks. as a python dict for easy investigation */ + void MEM_printmemlist_pydict(void); + + /** Print a list of the names and sizes of all allocated memory * blocks. */ void MEM_printmemlist(void); + /** Print statistics about memory usage */ + void MEM_printmemlist_stats(void); + /** Set the callback function for error output. */ void MEM_set_error_callback(void (*func)(char *)); @@ -116,6 +123,12 @@ extern "C" { /** Attempt to enforce OSX (or other OS's) to have malloc and stack nonzero */ void MEM_set_memory_debug(void); + /* Memory usage stats + * - MEM_get_memory_in_use is all memory + * - MEM_get_mapped_memory_in_use is a subset of all memory */ + uintptr_t MEM_get_memory_in_use(void); + uintptr_t MEM_get_mapped_memory_in_use(void); + int MEM_get_memory_blocks_in_use(void); #ifdef __cplusplus } diff --git a/intern/guardedalloc/intern/mallocn.c b/intern/guardedalloc/intern/mallocn.c index b9d5a595363..7bdca7339fc 100644 --- a/intern/guardedalloc/intern/mallocn.c +++ b/intern/guardedalloc/intern/mallocn.c @@ -38,7 +38,10 @@ #include <stdarg.h> /* mmap exception */ -#if defined(AMIGA) || defined(__BeOS) || defined(WIN32) +#if defined(AMIGA) || defined(__BeOS) +#elif defined(WIN32) +#include <sys/types.h> +#include "mmap_win.h" #else #include <sys/types.h> #include <sys/mman.h> @@ -108,11 +111,11 @@ static const char *check_memlist(MemHead *memh); /* --------------------------------------------------------------------- */ -volatile int totblock= 0; -volatile unsigned long mem_in_use= 0, mmap_in_use= 0; +static volatile int totblock= 0; +static volatile uintptr_t mem_in_use= 0, mmap_in_use= 0; -volatile static struct localListBase _membase; -volatile static struct localListBase *membase = &_membase; +static volatile struct localListBase _membase; +static volatile struct localListBase *membase = &_membase; static void (*error_callback)(char *) = NULL; static void (*thread_lock_callback)(void) = NULL; static void (*thread_unlock_callback)(void) = NULL; @@ -289,7 +292,7 @@ void *MEM_callocN(unsigned int len, const char *str) /* note; mmap returns zero'd memory */ void *MEM_mapallocN(unsigned int len, const char *str) { -#if defined(AMIGA) || defined(__BeOS) || defined(WIN32) +#if defined(AMIGA) || defined(__BeOS) return MEM_callocN(len, str); #else MemHead *memh; @@ -329,25 +332,146 @@ void *MEM_mapallocN(unsigned int len, const char *str) #endif } +/* Memory statistics print */ +typedef struct MemPrintBlock { + const char *name; + uintptr_t len; + int items; +} MemPrintBlock; + +static int compare_name(const void *p1, const void *p2) +{ + const MemPrintBlock *pb1= (const MemPrintBlock*)p1; + const MemPrintBlock *pb2= (const MemPrintBlock*)p2; + + return strcmp(pb1->name, pb2->name); +} + +static int compare_len(const void *p1, const void *p2) +{ + const MemPrintBlock *pb1= (const MemPrintBlock*)p1; + const MemPrintBlock *pb2= (const MemPrintBlock*)p2; + + if(pb1->len < pb2->len) + return 1; + else if(pb1->len == pb2->len) + return 0; + else + return -1; +} -void MEM_printmemlist() +void MEM_printmemlist_stats() { MemHead *membl; + MemPrintBlock *pb, *printblock; + int totpb, a, b; mem_lock_thread(); + /* put memory blocks into array */ + printblock= malloc(sizeof(MemPrintBlock)*totblock); + + pb= printblock; + totpb= 0; + membl = membase->first; if (membl) membl = MEMNEXT(membl); + while(membl) { - print_error("%s len: %d %p\n",membl->name,membl->len, membl+1); + pb->name= membl->name; + pb->len= membl->len; + pb->items= 1; + + totpb++; + pb++; + if(membl->next) membl= MEMNEXT(membl->next); else break; } + /* sort by name and add together blocks with the same name */ + qsort(printblock, totpb, sizeof(MemPrintBlock), compare_name); + for(a=0, b=0; a<totpb; a++) { + if(a == b) { + continue; + } + else if(strcmp(printblock[a].name, printblock[b].name) == 0) { + printblock[b].len += printblock[a].len; + printblock[b].items++; + } + else { + b++; + memcpy(&printblock[b], &printblock[a], sizeof(MemPrintBlock)); + } + } + totpb= b+1; + + /* sort by length and print */ + qsort(printblock, totpb, sizeof(MemPrintBlock), compare_len); + printf("\ntotal memory len: %.3f MB\n", (double)mem_in_use/(double)(1024*1024)); + for(a=0, pb=printblock; a<totpb; a++, pb++) + printf("%s items: %d, len: %.3f MB\n", pb->name, pb->items, (double)pb->len/(double)(1024*1024)); + + free(printblock); + + mem_unlock_thread(); +} + +/* Prints in python syntax for easy */ +static void MEM_printmemlist_internal( int pydict ) +{ + MemHead *membl; + + mem_lock_thread(); + + membl = membase->first; + if (membl) membl = MEMNEXT(membl); + + if (pydict) { + print_error("# membase_debug.py\n"); + print_error("membase = [\\\n"); + } + while(membl) { + if (pydict) { + fprintf(stderr, "{'len':%i, 'name':'''%s''', 'pointer':'%p'},\\\n", membl->len, membl->name, membl+1); + } else { + print_error("%s len: %d %p\n",membl->name,membl->len, membl+1); + } + if(membl->next) + membl= MEMNEXT(membl->next); + else break; + } + if (pydict) { + fprintf(stderr, "]\n\n"); + fprintf(stderr, +"mb_userinfo = {}\n" +"totmem = 0\n" +"for mb_item in membase:\n" +"\tmb_item_user_size = mb_userinfo.setdefault(mb_item['name'], [0,0])\n" +"\tmb_item_user_size[0] += 1 # Add a user\n" +"\tmb_item_user_size[1] += mb_item['len'] # Increment the size\n" +"\ttotmem += mb_item['len']\n" +"print '(membase) items:', len(membase), '| unique-names:', len(mb_userinfo), '| total-mem:', totmem\n" +"mb_userinfo_sort = mb_userinfo.items()\n" +"for sort_name, sort_func in (('size', lambda a: -a[1][1]), ('users', lambda a: -a[1][0]), ('name', lambda a: a[0])):\n" +"\tprint '\\nSorting by:', sort_name\n" +"\tmb_userinfo_sort.sort(key = sort_func)\n" +"\tfor item in mb_userinfo_sort:\n" +"\t\tprint 'name:%%s, users:%%i, len:%%i' %% (item[0], item[1][0], item[1][1])\n" + ); + } + mem_unlock_thread(); } +void MEM_printmemlist( void ) { + MEM_printmemlist_internal(0); +} +void MEM_printmemlist_pydict( void ) { + MEM_printmemlist_internal(1); +} + short MEM_freeN(void *vmemh) /* anders compileertie niet meer */ { short error = 0; @@ -361,14 +485,14 @@ short MEM_freeN(void *vmemh) /* anders compileertie niet meer */ return(-1); } - if(sizeof(long)==8) { - if (((long) memh) & 0x7) { + if(sizeof(intptr_t)==8) { + if (((intptr_t) memh) & 0x7) { MemorY_ErroR("free","attempt to free illegal pointer"); return(-1); } } else { - if (((long) memh) & 0x3) { + if (((intptr_t) memh) & 0x3) { MemorY_ErroR("free","attempt to free illegal pointer"); return(-1); } @@ -405,8 +529,10 @@ short MEM_freeN(void *vmemh) /* anders compileertie niet meer */ } else{ error = -1; name = check_memlist(memh); - if (name == 0) MemorY_ErroR("free","pointer not in memlist"); - else MemorY_ErroR(name,"error in header"); + if (name == 0) + MemorY_ErroR("free","pointer not in memlist"); + else + MemorY_ErroR(name,"error in header"); } totblock--; @@ -463,7 +589,7 @@ static void rem_memblock(MemHead *memh) totblock--; mem_in_use -= memh->len; -#if defined(AMIGA) || defined(__BeOS) || defined(WIN32) +#if defined(AMIGA) || defined(__BeOS) free(memh); #else @@ -570,4 +696,19 @@ static const char *check_memlist(MemHead *memh) return(name); } +uintptr_t MEM_get_memory_in_use(void) +{ + return mem_in_use; +} + +uintptr_t MEM_get_mapped_memory_in_use(void) +{ + return mmap_in_use; +} + +int MEM_get_memory_blocks_in_use(void) +{ + return totblock; +} + /* eof */ diff --git a/intern/guardedalloc/intern/mmap_win.c b/intern/guardedalloc/intern/mmap_win.c new file mode 100644 index 00000000000..642cc16296e --- /dev/null +++ b/intern/guardedalloc/intern/mmap_win.c @@ -0,0 +1,260 @@ +/** + * $Id: $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * The Original Code is Copyright (C) 2008 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): Andrea Weikert. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#if defined(WIN32) + +#include <windows.h> +#include <errno.h> +#include <io.h> +#include <sys/types.h> +#include <stdio.h> + +#include "mmap_win.h" + +#ifndef FILE_MAP_EXECUTE +//not defined in earlier versions of the Platform SDK (before February 2003) +#define FILE_MAP_EXECUTE 0x0020 +#endif + +/* --------------------------------------------------------------------- */ +/* local storage definitions */ +/* --------------------------------------------------------------------- */ +/* all memory mapped chunks are put in linked lists */ +typedef struct mmapLink +{ + struct mmapLink *next,*prev; +} mmapLink; + +typedef struct mmapListBase +{ + void *first, *last; +} mmapListBase; + +typedef struct MemMap { + struct MemMap *next,*prev; + void *mmap; + HANDLE fhandle; + HANDLE maphandle; +} MemMap; + +/* --------------------------------------------------------------------- */ +/* local functions */ +/* --------------------------------------------------------------------- */ + +static void mmap_addtail(volatile mmapListBase *listbase, void *vlink); +static void mmap_remlink(volatile mmapListBase *listbase, void *vlink); +static void *mmap_findlink(volatile mmapListBase *listbase, void *ptr); + +static int mmap_get_prot_flags (int flags); +static int mmap_get_access_flags (int flags); + +/* --------------------------------------------------------------------- */ +/* vars */ +/* --------------------------------------------------------------------- */ +volatile static struct mmapListBase _mmapbase; +volatile static struct mmapListBase *mmapbase = &_mmapbase; + + +/* --------------------------------------------------------------------- */ +/* implementation */ +/* --------------------------------------------------------------------- */ + +/* mmap for windows */ +void *mmap(void *start, size_t len, int prot, int flags, int fd, off_t offset) +{ + HANDLE fhandle = INVALID_HANDLE_VALUE; + HANDLE maphandle; + int prot_flags = mmap_get_prot_flags(prot); + int access_flags = mmap_get_access_flags(prot); + MemMap *mm = NULL; + void *ptr = NULL; + + if ( flags & MAP_FIXED ) { + return MAP_FAILED; + } + + /* + if ( fd == -1 ) { + _set_errno( EBADF ); + return MAP_FAILED; + } + */ + + if ( fd != -1 ) { + fhandle = (HANDLE) _get_osfhandle (fd); + } + if ( fhandle == INVALID_HANDLE_VALUE ) { + if (!(flags & MAP_ANONYMOUS)) { + errno = EBADF; + return MAP_FAILED; + } + } else { + if ( !DuplicateHandle( GetCurrentProcess(), fhandle, GetCurrentProcess(), + &fhandle, 0, FALSE, DUPLICATE_SAME_ACCESS ) ) { + return MAP_FAILED; + } + } + + maphandle = CreateFileMapping(fhandle, NULL, prot_flags, 0, len, NULL); + if ( maphandle == 0 ) { + errno = EBADF; + return MAP_FAILED; + } + + ptr = MapViewOfFile(maphandle, access_flags, 0, offset, 0); + if ( ptr == NULL ) { + DWORD dwLastErr = GetLastError(); + if ( dwLastErr == ERROR_MAPPED_ALIGNMENT ) + errno=EINVAL; + else + errno=EACCES; + CloseHandle(maphandle); + return MAP_FAILED; + } + + mm= (MemMap *)malloc(sizeof(MemMap)); + if (!mm) { + errno=ENOMEM; + } + mm->fhandle = fhandle; + mm->maphandle = maphandle; + mm->mmap = ptr; + mmap_addtail(mmapbase, mm); + + return ptr; +} + +/* munmap for windows */ +intptr_t munmap(void *ptr, intptr_t size) +{ + MemMap *mm = mmap_findlink(mmapbase, ptr); + if (!mm) { + errno=EINVAL; + return -1; + } + UnmapViewOfFile( mm->mmap ); + CloseHandle( mm->maphandle ); + CloseHandle( mm->fhandle); + mmap_remlink(mmapbase, mm); + return 0; +} + +/* --------------------------------------------------------------------- */ +/* local functions */ +/* --------------------------------------------------------------------- */ + +static void mmap_addtail(volatile mmapListBase *listbase, void *vlink) +{ + struct mmapLink *link= vlink; + + if (link == 0) return; + if (listbase == 0) return; + + link->next = 0; + link->prev = listbase->last; + + if (listbase->last) ((struct mmapLink *)listbase->last)->next = link; + if (listbase->first == 0) listbase->first = link; + listbase->last = link; +} + +static void mmap_remlink(volatile mmapListBase *listbase, void *vlink) +{ + struct mmapLink *link= vlink; + + if (link == 0) return; + if (listbase == 0) return; + + if (link->next) link->next->prev = link->prev; + if (link->prev) link->prev->next = link->next; + + if (listbase->last == link) listbase->last = link->prev; + if (listbase->first == link) listbase->first = link->next; +} + +static void *mmap_findlink(volatile mmapListBase *listbase, void *ptr) +{ + MemMap *mm; + + if (ptr == 0) return NULL; + if (listbase == 0) return NULL; + + mm = (MemMap *)listbase->first; + while (mm) { + if (mm->mmap == ptr) { + return mm; + } + mm = mm->next; + } + return NULL; +} + +static int mmap_get_prot_flags (int flags) +{ + int prot = PAGE_NOACCESS; + + if ( ( flags & PROT_READ ) == PROT_READ ) { + if ( ( flags & PROT_WRITE ) == PROT_WRITE ) { + prot = (flags & PROT_EXEC) ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE; + } else { + prot = (flags & PROT_EXEC) ? PAGE_EXECUTE_READ : PAGE_READONLY; + } + } else if ( ( flags & PROT_WRITE ) == PROT_WRITE ) { + prot = (flags & PROT_EXEC) ? PAGE_EXECUTE_READ : PAGE_WRITECOPY; + } else if ( ( flags & PROT_EXEC ) == PROT_EXEC ) { + prot = PAGE_EXECUTE_READ; + } + return prot; +} + +static int mmap_get_access_flags (int flags) +{ + int access = 0; + + if ( ( flags & PROT_READ ) == PROT_READ ) { + if ( ( flags & PROT_WRITE ) == PROT_WRITE ) { + access = FILE_MAP_WRITE; + } else { + access = (flags & PROT_EXEC) ? FILE_MAP_EXECUTE : FILE_MAP_READ; + } + } else if ( ( flags & PROT_WRITE ) == PROT_WRITE ) { + access = FILE_MAP_COPY; + } else if ( ( flags & PROT_EXEC ) == PROT_EXEC ) { + access = FILE_MAP_EXECUTE; + } + return access; +} + + +#endif // WIN32 + + + + + diff --git a/intern/guardedalloc/make/msvc_7_0/guardedalloc.vcproj b/intern/guardedalloc/make/msvc_7_0/guardedalloc.vcproj index cb3490716fa..974acef4e70 100644 --- a/intern/guardedalloc/make/msvc_7_0/guardedalloc.vcproj +++ b/intern/guardedalloc/make/msvc_7_0/guardedalloc.vcproj @@ -251,6 +251,9 @@ ECHO Done <File RelativePath="..\..\intern\mallocn.c"> </File> + <File + RelativePath="..\..\intern\mmap_win.c"> + </File> </Filter> <Filter Name="Header Files" @@ -259,8 +262,18 @@ ECHO Done Name="extern" Filter=""> <File + RelativePath="..\..\BLO_sys_types.h"> + </File> + <File RelativePath="..\..\MEM_guardedalloc.h"> </File> + <File + RelativePath="..\..\mmap_win.h"> + </File> + </Filter> + <Filter + Name="intern" + Filter=""> </Filter> </Filter> </Files> diff --git a/intern/guardedalloc/make/msvc_9_0/guardedalloc.vcproj b/intern/guardedalloc/make/msvc_9_0/guardedalloc.vcproj new file mode 100644 index 00000000000..d59b80f7b62 --- /dev/null +++ b/intern/guardedalloc/make/msvc_9_0/guardedalloc.vcproj @@ -0,0 +1,369 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9,00"
+ Name="INT_guardedalloc"
+ ProjectGUID="{1CC733F1-6AB5-4904-8F63-C08C46B79DD9}"
+ RootNamespace="guardedalloc"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Blender Release|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\guardedalloc"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\guardedalloc"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="..\.."
+ PreprocessorDefinitions="WIN32,NDEBUG,_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\guardedalloc\guardedalloc.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\guardedalloc\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\guardedalloc\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\guardedalloc\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\libguardedalloc.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying MEM files library to lib tree."
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\guardedalloc\include MKDIR ..\..\..\..\..\build\msvc_9\intern\guardedalloc\include
XCOPY /Y ..\..\*.h ..\..\..\..\..\build\msvc_9\intern\guardedalloc\include
ECHO Done
"
+ />
+ </Configuration>
+ <Configuration
+ Name="Blender Debug|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\guardedalloc\debug"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\guardedalloc\debug"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\.."
+ PreprocessorDefinitions="WIN32,_DEBUG,_LIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ BufferSecurityCheck="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\guardedalloc\debug\guardedalloc.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\guardedalloc\debug\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\guardedalloc\debug\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\guardedalloc\debug\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="3"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\debug\libguardedalloc.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying MEM files library (debug target) to lib tree."
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\guardedalloc\include MKDIR ..\..\..\..\..\build\msvc_9\intern\guardedalloc\include
XCOPY /Y ..\..\*.h ..\..\..\..\..\build\msvc_9\intern\guardedalloc\include
ECHO Done
"
+ />
+ </Configuration>
+ <Configuration
+ Name="3DPlugin Release|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\guardedalloc\mtdll"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\guardedalloc\mtdll"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="..\.."
+ PreprocessorDefinitions="WIN32,NDEBUG,_LIB"
+ StringPooling="true"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\guardedalloc\mtdll\guardedalloc.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\guardedalloc\mtdll\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\guardedalloc\mtdll\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\guardedalloc\mtdll\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\mtdll\libguardedalloc.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying MEM files library to lib tree."
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\guardedalloc\include MKDIR ..\..\..\..\..\build\msvc_9\intern\guardedalloc\include
XCOPY /Y ..\..\*.h ..\..\..\..\..\build\msvc_9\intern\guardedalloc\include
ECHO Done
"
+ />
+ </Configuration>
+ <Configuration
+ Name="3DPlugin Debug|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\guardedalloc\mtdll\debug"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\guardedalloc\mtdll\debug"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\.."
+ PreprocessorDefinitions="WIN32,_DEBUG,_LIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ BufferSecurityCheck="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\guardedalloc\mtdll\debug\guardedalloc.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\guardedalloc\mtdll\debug\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\guardedalloc\mtdll\debug\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\guardedalloc\mtdll\debug\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="3"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\mtdll\debug\libguardedalloc.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying MEM files library (debug target) to lib tree."
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\guardedalloc\include MKDIR ..\..\..\..\..\build\msvc_9\intern\guardedalloc\include
XCOPY /Y ..\..\*.h ..\..\..\..\..\build\msvc_9\intern\guardedalloc\include
ECHO Done
"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath="..\..\intern\mallocn.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\mmap_win.c"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ <Filter
+ Name="extern"
+ >
+ <File
+ RelativePath="..\..\BLO_sys_types.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\MEM_guardedalloc.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\mmap_win.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="intern"
+ >
+ </Filter>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/intern/guardedalloc/mmap_win.h b/intern/guardedalloc/mmap_win.h new file mode 100644 index 00000000000..443c3b6f4ce --- /dev/null +++ b/intern/guardedalloc/mmap_win.h @@ -0,0 +1,54 @@ +/** + * $Id: $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * The Original Code is Copyright (C) 2008 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): Andrea Weikert. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef MMAP_WIN_H +#define MMAP_WIN_H + +#define PROT_NONE 0 +#define PROT_READ 1 +#define PROT_WRITE 2 +#define PROT_EXEC 4 + +#define MAP_FILE 0 +#define MAP_SHARED 1 +#define MAP_PRIVATE 2 +#define MAP_TYPE 0xF +#define MAP_FIXED 0x10 +#define MAP_ANONYMOUS 0x20 +#define MAP_ANON MAP_ANONYMOUS + +#define MAP_FAILED ((void *)-1) + +#include "BLO_sys_types.h" // needed for intptr_t + +void *mmap(void *start, size_t len, int prot, int flags, int fd, off_t offset); +intptr_t munmap(void *ptr, intptr_t size); + +#endif + diff --git a/intern/iksolver/CMakeLists.txt b/intern/iksolver/CMakeLists.txt index da69f2a3332..736a2a78bb2 100644 --- a/intern/iksolver/CMakeLists.txt +++ b/intern/iksolver/CMakeLists.txt @@ -28,5 +28,5 @@ SET(INC intern ../moto/include ../memutil) FILE(GLOB SRC intern/*.cpp) -BLENDERLIB_NOLIST(blender_IK "${SRC}" "${INC}") +BLENDERLIB(bf_IK "${SRC}" "${INC}") #, libtype=['blender'], priority = [10] ) diff --git a/intern/iksolver/SConscript b/intern/iksolver/SConscript index ce4a05341d3..543ee46487c 100644 --- a/intern/iksolver/SConscript +++ b/intern/iksolver/SConscript @@ -5,4 +5,5 @@ sources = env.Glob('intern/*.cpp') incs = 'intern ../moto/include ../memutil' -env.BlenderLib ('bf_IK', sources, Split(incs), [], libtype='blender', priority=10 ) +env.BlenderLib ('bf_IK', sources, Split(incs), [], libtype=['intern','player'], priority=[20,100] ) + diff --git a/intern/iksolver/intern/IK_QTask.h b/intern/iksolver/intern/IK_QTask.h index c291a0e7e50..4d469d737f8 100644 --- a/intern/iksolver/intern/IK_QTask.h +++ b/intern/iksolver/intern/IK_QTask.h @@ -74,7 +74,7 @@ public: virtual bool PositionTask() const { return false; } - virtual void Scale(float scale) {} + virtual void Scale(float) {} protected: int m_id; diff --git a/intern/iksolver/intern/TNT/svd.h b/intern/iksolver/intern/TNT/svd.h index af281d0fce0..9ca51fa2650 100644 --- a/intern/iksolver/intern/TNT/svd.h +++ b/intern/iksolver/intern/TNT/svd.h @@ -18,11 +18,13 @@ #include "tntmath.h" +#define SVD_MAX_ITER 200 + namespace TNT { template <class MaTRiX, class VecToR > -void SVD(MaTRiX &A, MaTRiX &U, VecToR &s, MaTRiX &V, VecToR &work1, VecToR &work2) { +void SVD(MaTRiX &A, MaTRiX &U, VecToR &s, MaTRiX &V, VecToR &work1, VecToR &work2, int maxiter=SVD_MAX_ITER) { int m = A.num_rows(); int n = A.num_cols(); @@ -216,7 +218,10 @@ void SVD(MaTRiX &A, MaTRiX &U, VecToR &s, MaTRiX &V, VecToR &work1, VecToR &work int kase=0; k=0; - // Here is where a test for too many iterations would go. + // Test for maximum iterations to avoid infinite loop + if(maxiter == 0) + break; + maxiter--; // This section of the program inspects for // negligible elements in the s and e arrays. On diff --git a/intern/iksolver/make/msvc_9_0/iksolver.vcproj b/intern/iksolver/make/msvc_9_0/iksolver.vcproj new file mode 100644 index 00000000000..0e87556380b --- /dev/null +++ b/intern/iksolver/make/msvc_9_0/iksolver.vcproj @@ -0,0 +1,487 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9,00"
+ Name="INT_iksolver"
+ ProjectGUID="{542A9FA1-B7FF-441C-AE15-054DB31D3488}"
+ RootNamespace="iksolver"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Blender Release|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\iksolver"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\iksolver"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="2"
+ AdditionalIncludeDirectories="..\..\..\..\..\build\msvc_9\intern\memutil\include;..\..\..\..\..\build\msvc_9\intern\moto\include"
+ PreprocessorDefinitions="WIN32,NDEBUG,_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\iksolver\iksolver.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\iksolver\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\iksolver\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\iksolver\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1043"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\libiksolver.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying IK files library to lib tree."
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\iksolver\include MKDIR ..\..\..\..\..\build\msvc_9\intern\iksolver\include
XCOPY /Y ..\..\extern\*.h ..\..\..\..\..\build\msvc_9\intern\iksolver\include
ECHO Done
"
+ />
+ </Configuration>
+ <Configuration
+ Name="Blender Debug|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\iksolver\debug"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\iksolver\debug"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\..\..\..\build\msvc_9\intern\memutil\include;..\..\..\..\..\build\msvc_9\intern\moto\include"
+ PreprocessorDefinitions="WIN32,_DEBUG,_LIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ BufferSecurityCheck="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\iksolver\debug\iksolver.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\iksolver\debug\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\iksolver\debug\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\iksolver\debug\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="3"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1043"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\debug\libiksolver.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying IK files library (debug target) to lib tree."
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\iksolver\include MKDIR ..\..\..\..\..\build\msvc_9\intern\iksolver\include
XCOPY /Y ..\..\extern\*.h ..\..\..\..\..\build\msvc_9\intern\iksolver\include
ECHO Done
"
+ />
+ </Configuration>
+ <Configuration
+ Name="3DPlugin Release|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\iksolver\mtdll"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\iksolver\mtdll"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="2"
+ AdditionalIncludeDirectories="..\..\..\..\..\build\msvc_9\intern\memutil\include;..\..\..\..\..\build\msvc_9\intern\moto\include"
+ PreprocessorDefinitions="WIN32,NDEBUG,_LIB"
+ StringPooling="true"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\iksolver\mtdll\iksolver.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\iksolver\mtdll\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\iksolver\mtdll\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\iksolver\mtdll\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1043"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\mtdll\libiksolver.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying IK files library to lib tree."
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\iksolver\include MKDIR ..\..\..\..\..\build\msvc_9\intern\iksolver\include
XCOPY /Y ..\..\extern\*.h ..\..\..\..\..\build\msvc_9\intern\iksolver\include
ECHO Done
"
+ />
+ </Configuration>
+ <Configuration
+ Name="3DPlugin Debug|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\iksolver\mtdll\debug"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\iksolver\mtdll\debug"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\..\..\..\build\msvc_9\intern\memutil\include;..\..\..\..\..\build\msvc_9\intern\moto\include"
+ PreprocessorDefinitions="WIN32,_DEBUG,_LIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ BufferSecurityCheck="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\iksolver\mtdll\debug\iksolver.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\iksolver\mtdll\debug\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\iksolver\mtdll\debug\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\iksolver\mtdll\debug\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="3"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1043"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\mtdll\debug\libiksolver.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying IK files library (debug target) to lib tree."
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\iksolver\include MKDIR ..\..\..\..\..\build\msvc_9\intern\iksolver\include
XCOPY /Y ..\..\extern\*.h ..\..\..\..\..\build\msvc_9\intern\iksolver\include
ECHO Done
"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="intern"
+ >
+ <File
+ RelativePath="..\..\intern\IK_QJacobian.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\IK_QJacobian.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\IK_QJacobianSolver.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\IK_QJacobianSolver.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\IK_QSegment.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\IK_QSegment.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\IK_QTask.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\IK_QTask.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\IK_Solver.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\MT_ExpMap.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\MT_ExpMap.h"
+ >
+ </File>
+ <Filter
+ Name="TNT"
+ >
+ <File
+ RelativePath="..\..\intern\TNT\cholesky.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\TNT\cmat.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\TNT\fcscmat.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\TNT\fmat.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\TNT\fortran.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\TNT\fspvec.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\TNT\index.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\TNT\lapack.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\TNT\lu.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\TNT\qr.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\TNT\region1d.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\TNT\region2d.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\TNT\stopwatch.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\TNT\subscript.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\TNT\svd.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\TNT\tnt.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\TNT\tntmath.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\TNT\tntreqs.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\TNT\transv.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\TNT\triang.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\TNT\trisolve.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\TNT\vec.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\TNT\vecadaptor.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\TNT\version.h"
+ >
+ </File>
+ </Filter>
+ </Filter>
+ <Filter
+ Name="extern"
+ >
+ <File
+ RelativePath="..\..\extern\IK_solver.h"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/intern/iksolver/test/ik_glut_test/intern/main.cpp b/intern/iksolver/test/ik_glut_test/intern/main.cpp index 74cf0639066..7372b3f1858 100644 --- a/intern/iksolver/test/ik_glut_test/intern/main.cpp +++ b/intern/iksolver/test/ik_glut_test/intern/main.cpp @@ -26,34 +26,6 @@ * ***** END GPL LICENSE BLOCK ***** */ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - #ifdef HAVE_CONFIG_H #include <config.h> #endif diff --git a/intern/make/msvc_9_0/INT_build_install_all.vcproj b/intern/make/msvc_9_0/INT_build_install_all.vcproj new file mode 100644 index 00000000000..dbb58134b0f --- /dev/null +++ b/intern/make/msvc_9_0/INT_build_install_all.vcproj @@ -0,0 +1,109 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9,00"
+ Name="INT_build_install_all"
+ ProjectGUID="{02110D03-59DB-4571-8787-72B3C03B2F2D}"
+ Keyword="MakeFileProj"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Blender Debug|Win32"
+ OutputDirectory="..\..\..\..\build\msvc_9\intern\debug"
+ IntermediateDirectory="..\..\..\..\build\msvc_9\intern\debug"
+ ConfigurationType="10"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ ExcludedFromBuild="false"
+ />
+ </Configuration>
+ <Configuration
+ Name="Blender Release|Win32"
+ OutputDirectory="..\..\..\..\build\msvc_9\intern"
+ IntermediateDirectory="..\..\..\..\build\msvc_9\intern"
+ ConfigurationType="10"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="3DPlugin Release|Win32"
+ OutputDirectory="..\..\..\..\build\msvc_9\intern\mtdll"
+ IntermediateDirectory="..\..\..\..\build\msvc_9\intern\mtdll"
+ ConfigurationType="10"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="3DPlugin Debug|Win32"
+ OutputDirectory="..\..\..\..\build\msvc_9\intern\mtdll\debug"
+ IntermediateDirectory="..\..\..\..\build\msvc_9\intern\mtdll\debug"
+ ConfigurationType="10"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ ExcludedFromBuild="false"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ </Files>
+</VisualStudioProject>
diff --git a/intern/memutil/MEM_Allocator.h b/intern/memutil/MEM_Allocator.h index d5ae94cc6b8..b2c3c5e82e2 100644 --- a/intern/memutil/MEM_Allocator.h +++ b/intern/memutil/MEM_Allocator.h @@ -25,6 +25,7 @@ #define __MEM_Allocator_h_included__ 1 #include "guardedalloc/MEM_guardedalloc.h" +#include "guardedalloc/BLO_sys_types.h" #ifdef _MSC_VER #if _MSC_VER < 1300 // 1200 == VC++ 6.0 according to boost diff --git a/intern/memutil/MEM_CacheLimiter.h b/intern/memutil/MEM_CacheLimiter.h index cada06ae523..43149efc977 100644 --- a/intern/memutil/MEM_CacheLimiter.h +++ b/intern/memutil/MEM_CacheLimiter.h @@ -61,11 +61,8 @@ class MEM_CacheLimiter; #ifndef __MEM_cache_limiter_c_api_h_included__ extern "C" { - extern void MEM_CacheLimiter_set_maximum(int m); - extern int MEM_CacheLimiter_get_maximum(); - // this is rather _ugly_! - extern int mem_in_use; - extern int mmap_in_use; + extern void MEM_CacheLimiter_set_maximum(intptr_t m); + extern intptr_t MEM_CacheLimiter_get_maximum(); }; #endif @@ -141,7 +138,10 @@ public: delete handle; } void enforce_limits() { - int max = MEM_CacheLimiter_get_maximum(); + intptr_t max = MEM_CacheLimiter_get_maximum(); + intptr_t mem_in_use= MEM_get_memory_in_use(); + intptr_t mmap_in_use= MEM_get_mapped_memory_in_use(); + if (max == 0) { return; } diff --git a/intern/memutil/intern/MEM_CacheLimiterC-Api.cpp b/intern/memutil/intern/MEM_CacheLimiterC-Api.cpp index 4cf0ef305d4..d998c9a3e80 100644 --- a/intern/memutil/intern/MEM_CacheLimiterC-Api.cpp +++ b/intern/memutil/intern/MEM_CacheLimiterC-Api.cpp @@ -27,18 +27,18 @@ #include "MEM_CacheLimiter.h" #include "MEM_CacheLimiterC-Api.h" -static int & get_max() +static intptr_t & get_max() { - static int m = 32*1024*1024; + static intptr_t m = 32*1024*1024; return m; } -void MEM_CacheLimiter_set_maximum(int m) +void MEM_CacheLimiter_set_maximum(intptr_t m) { get_max() = m; } -int MEM_CacheLimiter_get_maximum() +intptr_t MEM_CacheLimiter_get_maximum() { return get_max(); } diff --git a/intern/memutil/make/msvc_9_0/memutil.vcproj b/intern/memutil/make/msvc_9_0/memutil.vcproj new file mode 100644 index 00000000000..6f642fb16bc --- /dev/null +++ b/intern/memutil/make/msvc_9_0/memutil.vcproj @@ -0,0 +1,385 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9,00"
+ Name="INT_memutil"
+ ProjectGUID="{E86B7BDE-C33C-4E55-9433-E74C141D7538}"
+ RootNamespace="memutil"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Blender Debug|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\memutil\debug"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\memutil\debug"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\..\..\intern;..\..\..\memutil"
+ PreprocessorDefinitions="WIN32,_DEBUG,_LIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ BufferSecurityCheck="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\memutil\debug\memutil.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\memutil\debug\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\memutil\debug\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\memutil\debug\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="3"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\debug\memutil.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying MEM files library (debug target) to lib tree."
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\memutil\include MKDIR ..\..\..\..\..\build\msvc_9\intern\memutil\include
XCOPY /Y ..\..\*.h ..\..\..\..\..\build\msvc_9\intern\memutil\include
ECHO Done
"
+ />
+ </Configuration>
+ <Configuration
+ Name="Blender Release|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\memutil"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\memutil"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="2"
+ AdditionalIncludeDirectories="..\..\..\..\intern;..\..\..\memutil"
+ PreprocessorDefinitions="WIN32,NDEBUG,_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\memutil\memutil.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\memutil\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\memutil\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\memutil\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\memutil.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying MEM files library to lib tree."
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\memutil\include MKDIR ..\..\..\..\..\build\msvc_9\intern\memutil\include
XCOPY /Y ..\..\*.h ..\..\..\..\..\build\msvc_9\intern\memutil\include
ECHO Done
"
+ />
+ </Configuration>
+ <Configuration
+ Name="3DPlugin Release|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\memutil\mtdll"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\memutil\mtdll"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="2"
+ AdditionalIncludeDirectories="..\..\..\..\intern;..\..\..\memutil"
+ PreprocessorDefinitions="WIN32,NDEBUG,_LIB"
+ StringPooling="true"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\memutil\mtdll\memutil.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\memutil\mtdll\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\memutil\mtdll\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\memutil\mtdll\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\mtdll\memutil.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying MEM files library to lib tree."
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\memutil\include MKDIR ..\..\..\..\..\build\msvc_9\intern\memutil\include
XCOPY /Y ..\..\*.h ..\..\..\..\..\build\msvc_9\intern\memutil\include
ECHO Done
"
+ />
+ </Configuration>
+ <Configuration
+ Name="3DPlugin Debug|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\memutil\mtdll\debug"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\memutil\mtdll\debug"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\..\..\intern;..\..\..\memutil"
+ PreprocessorDefinitions="WIN32,_DEBUG,_LIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ BufferSecurityCheck="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\memutil\mtdll\debug\memutil.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\memutil\mtdll\debug\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\memutil\mtdll\debug\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\memutil\mtdll\debug\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="3"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\mtdll\debug\memutil.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying MEM files library (debug target) to lib tree."
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\memutil\include MKDIR ..\..\..\..\..\build\msvc_9\intern\memutil\include
XCOPY /Y ..\..\*.h ..\..\..\..\..\build\msvc_9\intern\memutil\include
ECHO Done
"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath="..\..\intern\MEM_CacheLimiterC-Api.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\intern\MEM_RefCountedC-Api.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ <File
+ RelativePath="..\..\MEM_Allocator.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\MEM_CacheLimiter.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\MEM_CacheLimiterC-Api.h"
+ >
+ </File>
+ <Filter
+ Name="extern"
+ >
+ <File
+ RelativePath="..\..\MEM_NonCopyable.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\MEM_RefCounted.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\MEM_RefCountedC-Api.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\MEM_RefCountPtr.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\MEM_SmartPtr.h"
+ >
+ </File>
+ </Filter>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/intern/moto/include/GEN_List.h b/intern/moto/include/GEN_List.h index 2bc09e44c70..9eb3901a7d5 100644 --- a/intern/moto/include/GEN_List.h +++ b/intern/moto/include/GEN_List.h @@ -26,34 +26,6 @@ * ***** END GPL LICENSE BLOCK ***** */ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - #ifndef GEN_LIST_H #define GEN_LIST_H diff --git a/intern/moto/include/GEN_Map.h b/intern/moto/include/GEN_Map.h index db3335d6110..d85e9af175b 100644 --- a/intern/moto/include/GEN_Map.h +++ b/intern/moto/include/GEN_Map.h @@ -50,6 +50,19 @@ public: m_buckets[i] = 0; } } + + GEN_Map(const GEN_Map& map) + { + m_num_buckets = map.m_num_buckets; + m_buckets = new Entry *[m_num_buckets]; + + for (int i = 0; i < m_num_buckets; ++i) { + m_buckets[i] = 0; + + for(Entry *entry = map.m_buckets[i]; entry; entry=entry->m_next) + insert(entry->m_key, entry->m_value); + } + } int size() { int count=0; @@ -82,6 +95,24 @@ public: } return 0; } + + Key* getKey(int index) { + int count=0; + for (int i=0;i<m_num_buckets;i++) + { + Entry* bucket = m_buckets[i]; + while(bucket) + { + if (count==index) + { + return &bucket->m_key; + } + bucket = bucket->m_next; + count++; + } + } + return 0; + } void clear() { for (int i = 0; i < m_num_buckets; ++i) { diff --git a/intern/moto/include/MT_Matrix3x3.h b/intern/moto/include/MT_Matrix3x3.h index 3197103a267..899a2731588 100644 --- a/intern/moto/include/MT_Matrix3x3.h +++ b/intern/moto/include/MT_Matrix3x3.h @@ -144,6 +144,26 @@ public: -sj, cj * si, cj * ci); } + void getEuler(MT_Scalar& yaw, MT_Scalar& pitch, MT_Scalar& roll) const + { + if (m_el[2][0] != -1.0 && m_el[2][0] != 1.0) { + pitch = MT_Scalar(-asin(m_el[2][0])); + yaw = MT_Scalar(atan2(m_el[2][1] / cos(pitch), m_el[2][2] / cos(pitch))); + roll = MT_Scalar(atan2(m_el[1][0] / cos(pitch), m_el[0][0] / cos(pitch))); + } + else { + roll = MT_Scalar(0); + if (m_el[2][0] == -1.0) { + pitch = MT_PI / 2.0; + yaw = MT_Scalar(atan2(m_el[0][1], m_el[0][2])); + } + else { + pitch = - MT_PI / 2.0; + yaw = MT_Scalar(atan2(m_el[0][1], m_el[0][2])); + } + } + } + void scale(MT_Scalar x, MT_Scalar y, MT_Scalar z) { m_el[0][0] *= x; m_el[0][1] *= y; m_el[0][2] *= z; m_el[1][0] *= x; m_el[1][1] *= y; m_el[1][2] *= z; diff --git a/intern/moto/include/MT_Matrix4x4.h b/intern/moto/include/MT_Matrix4x4.h index 823541347b7..b4ee84a718b 100644 --- a/intern/moto/include/MT_Matrix4x4.h +++ b/intern/moto/include/MT_Matrix4x4.h @@ -212,6 +212,7 @@ public: MT_Matrix4x4 transposed() const; void transpose(); + MT_Matrix4x4 inverse() const; void invert(); protected: diff --git a/intern/moto/include/MT_Matrix4x4.inl b/intern/moto/include/MT_Matrix4x4.inl index a2aa893a6b3..074bd6e4b05 100644 --- a/intern/moto/include/MT_Matrix4x4.inl +++ b/intern/moto/include/MT_Matrix4x4.inl @@ -52,14 +52,14 @@ GEN_INLINE void MT_Matrix4x4::invert() { } } -/* We do things slightly different here, because the invert() modifies - * the buffer itself. This makes it impossible to make this op right - * away. Like other, still missing facilities, I will repair this - * later. */ -/* GEN_INLINE T_Matrix4x4 MT_Matrix4x4::inverse() const */ -/* { */ -/* } */ +GEN_INLINE MT_Matrix4x4 MT_Matrix4x4::inverse() const +{ + MT_Matrix4x4 invmat = *this; + + invmat.invert(); + return invmat; +} GEN_INLINE MT_Matrix4x4& MT_Matrix4x4::operator*=(const MT_Matrix4x4& m) { diff --git a/intern/moto/include/MT_random.h b/intern/moto/include/MT_random.h index d7da546cf03..3afe1dd1662 100644 --- a/intern/moto/include/MT_random.h +++ b/intern/moto/include/MT_random.h @@ -31,10 +31,10 @@ #include <limits.h> -#define MT_RAND_MAX ULONG_MAX +#define MT_RAND_MAX UINT_MAX -extern void MT_srand(unsigned long); -extern unsigned long MT_rand(); +extern void MT_srand(unsigned int); +extern unsigned int MT_rand(); #endif diff --git a/intern/moto/intern/MT_CmMatrix4x4.cpp b/intern/moto/intern/MT_CmMatrix4x4.cpp index 80feb615a54..98e8d68ed06 100644 --- a/intern/moto/intern/MT_CmMatrix4x4.cpp +++ b/intern/moto/intern/MT_CmMatrix4x4.cpp @@ -26,34 +26,6 @@ * ***** END GPL LICENSE BLOCK ***** */ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - #ifdef HAVE_CONFIG_H #include <config.h> #endif diff --git a/intern/moto/intern/MT_Plane3.cpp b/intern/moto/intern/MT_Plane3.cpp index 33ef09d35ed..a2510476724 100644 --- a/intern/moto/intern/MT_Plane3.cpp +++ b/intern/moto/intern/MT_Plane3.cpp @@ -26,34 +26,6 @@ * ***** END GPL LICENSE BLOCK ***** */ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - #ifdef HAVE_CONFIG_H #include <config.h> #endif diff --git a/intern/moto/intern/MT_random.cpp b/intern/moto/intern/MT_random.cpp index 96cb394d3da..b8302e093ca 100644 --- a/intern/moto/intern/MT_random.cpp +++ b/intern/moto/intern/MT_random.cpp @@ -76,11 +76,11 @@ #define TEMPERING_SHIFT_T(y) (y << 15) #define TEMPERING_SHIFT_L(y) (y >> 18) -static unsigned long mt[N]; /* the array for the state vector */ +static unsigned int mt[N]; /* the array for the state vector */ static int mti = N+1; /* mti==N+1 means mt[N] is not initialized */ /* initializing the array with a NONZERO seed */ -void MT_srand(unsigned long seed) +void MT_srand(unsigned int seed) { /* setting initial seeds to mt[N] using */ /* the generator Line 25 of Table 1 in */ @@ -91,12 +91,12 @@ void MT_srand(unsigned long seed) mt[mti] = (69069 * mt[mti-1]) & 0xffffffff; } -unsigned long MT_rand() +unsigned int MT_rand() { - static unsigned long mag01[2] = { 0x0, MATRIX_A }; + static unsigned int mag01[2] = { 0x0, MATRIX_A }; /* mag01[x] = x * MATRIX_A for x=0,1 */ - unsigned long y; + unsigned int y; if (mti >= N) { /* generate N words at one time */ int kk; diff --git a/intern/moto/make/msvc_9_0/moto.vcproj b/intern/moto/make/msvc_9_0/moto.vcproj new file mode 100644 index 00000000000..b33bb165a75 --- /dev/null +++ b/intern/moto/make/msvc_9_0/moto.vcproj @@ -0,0 +1,713 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9,00"
+ Name="INT_MoTo"
+ ProjectGUID="{4B6AFCC5-968C-424A-8F20-76E41B3BEF74}"
+ RootNamespace="MoTo"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Blender Release|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\moto"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\moto"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="2"
+ AdditionalIncludeDirectories="..\..\include\"
+ PreprocessorDefinitions="WIN32,NDEBUG,_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\moto\MoTo.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\moto\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\moto\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\moto\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1043"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\libmoto.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying MOTO files library to lib tree."
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\moto\include MKDIR ..\..\..\..\..\build\msvc_9\intern\moto\include
XCOPY /Y ..\..\include\*.h ..\..\..\..\..\build\msvc_9\intern\moto\include
ECHO Done
"
+ />
+ </Configuration>
+ <Configuration
+ Name="Blender Debug|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\moto\debug"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\moto\debug"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\include\"
+ PreprocessorDefinitions="WIN32,_DEBUG,_LIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ BufferSecurityCheck="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\moto\debug\MoTo.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\moto\debug\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\moto\debug\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\moto\debug\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="3"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1043"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\debug\libmoto.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying MOTO files library (debug target) to lib tree."
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\moto\include MKDIR ..\..\..\..\..\build\msvc_9\intern\moto\include
XCOPY /Y ..\..\include\*.h ..\..\..\..\..\build\msvc_9\intern\moto\include
ECHO Done
"
+ />
+ </Configuration>
+ <Configuration
+ Name="3DPlugin Release|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\moto\mtdll"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\moto\mtdll"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="2"
+ AdditionalIncludeDirectories="..\..\include\"
+ PreprocessorDefinitions="WIN32,NDEBUG,_LIB"
+ StringPooling="true"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\moto\mtdll\MoTo.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\moto\mtdll\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\moto\mtdll\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\moto\mtdll\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1043"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\mtdll\libmoto.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying MOTO files library to lib tree."
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\moto\include MKDIR ..\..\..\..\..\build\msvc_9\intern\moto\include
XCOPY /Y ..\..\include\*.h ..\..\..\..\..\build\msvc_9\intern\moto\include
ECHO Done
"
+ />
+ </Configuration>
+ <Configuration
+ Name="3DPlugin Debug|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\moto\mtdll\debug"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\moto\mtdll\debug"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\include\"
+ PreprocessorDefinitions="WIN32,_DEBUG,_LIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ BufferSecurityCheck="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\moto\mtdll\debug\MoTo.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\moto\mtdll\debug\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\moto\mtdll\debug\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\moto\mtdll\debug\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="3"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1043"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\mtdll\debug\libmoto.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying MOTO files library (debug target) to lib tree."
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\moto\include MKDIR ..\..\..\..\..\build\msvc_9\intern\moto\include
XCOPY /Y ..\..\include\*.h ..\..\..\..\..\build\msvc_9\intern\moto\include
ECHO Done
"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath="..\..\intern\MT_CmMatrix4x4.cpp"
+ >
+ <FileConfiguration
+ Name="Blender Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="..\..\include\;../../include;$(NoInherit)"
+ WarningLevel="3"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="3DPlugin Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="..\..\include\;../../include;$(NoInherit)"
+ WarningLevel="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\intern\MT_Matrix3x3.cpp"
+ >
+ <FileConfiguration
+ Name="Blender Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="..\..\include\;../../include;$(NoInherit)"
+ WarningLevel="3"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="3DPlugin Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="..\..\include\;../../include;$(NoInherit)"
+ WarningLevel="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\intern\MT_Matrix4x4.cpp"
+ >
+ <FileConfiguration
+ Name="Blender Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="..\..\include\;../../include;$(NoInherit)"
+ WarningLevel="3"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="3DPlugin Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="..\..\include\;../../include;$(NoInherit)"
+ WarningLevel="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\intern\MT_Plane3.cpp"
+ >
+ <FileConfiguration
+ Name="Blender Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ WarningLevel="3"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="3DPlugin Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ WarningLevel="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\intern\MT_Point3.cpp"
+ >
+ <FileConfiguration
+ Name="Blender Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="..\..\include\;../../include;$(NoInherit)"
+ WarningLevel="3"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="3DPlugin Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="..\..\include\;../../include;$(NoInherit)"
+ WarningLevel="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\intern\MT_Quaternion.cpp"
+ >
+ <FileConfiguration
+ Name="Blender Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="..\..\include\;../../include;$(NoInherit)"
+ WarningLevel="3"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="3DPlugin Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="..\..\include\;../../include;$(NoInherit)"
+ WarningLevel="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\intern\MT_random.cpp"
+ >
+ <FileConfiguration
+ Name="Blender Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="..\..\include\;../../include;$(NoInherit)"
+ WarningLevel="3"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="3DPlugin Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="..\..\include\;../../include;$(NoInherit)"
+ WarningLevel="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\intern\MT_Transform.cpp"
+ >
+ <FileConfiguration
+ Name="Blender Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="..\..\include\;../../include;$(NoInherit)"
+ WarningLevel="3"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="3DPlugin Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="..\..\include\;../../include;$(NoInherit)"
+ WarningLevel="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\intern\MT_Vector2.cpp"
+ >
+ <FileConfiguration
+ Name="Blender Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="..\..\include\;../../include;$(NoInherit)"
+ WarningLevel="3"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="3DPlugin Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="..\..\include\;../../include;$(NoInherit)"
+ WarningLevel="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\intern\MT_Vector3.cpp"
+ >
+ <FileConfiguration
+ Name="Blender Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="..\..\include\;../../include;$(NoInherit)"
+ WarningLevel="3"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="3DPlugin Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="..\..\include\;../../include;$(NoInherit)"
+ WarningLevel="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\intern\MT_Vector4.cpp"
+ >
+ <FileConfiguration
+ Name="Blender Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="..\..\include\;../../include;$(NoInherit)"
+ WarningLevel="3"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="3DPlugin Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="..\..\include\;../../include;$(NoInherit)"
+ WarningLevel="3"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ <File
+ RelativePath="..\..\include\GEN_List.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\include\GEN_Map.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\include\MT_assert.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\include\MT_CmMatrix4x4.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\include\MT_Matrix3x3.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\include\MT_Matrix4x4.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\include\MT_MinMax.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\include\MT_Optimize.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\include\MT_Plane3.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\include\MT_Point2.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\include\MT_Point3.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\include\MT_Quaternion.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\include\MT_random.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\include\MT_Scalar.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\include\MT_Stream.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\include\MT_Transform.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\include\MT_Tuple2.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\include\MT_Tuple3.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\include\MT_Tuple4.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\include\MT_Vector2.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\include\MT_Vector3.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\include\MT_Vector4.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\include\NM_Scalar.h"
+ >
+ </File>
+ <Filter
+ Name="inlines"
+ >
+ <File
+ RelativePath="..\..\include\MT_Matrix3x3.inl"
+ >
+ </File>
+ <File
+ RelativePath="..\..\include\MT_Matrix4x4.inl"
+ >
+ </File>
+ <File
+ RelativePath="..\..\include\MT_Plane3.inl"
+ >
+ </File>
+ <File
+ RelativePath="..\..\include\MT_Point2.inl"
+ >
+ </File>
+ <File
+ RelativePath="..\..\include\MT_Point3.inl"
+ >
+ </File>
+ <File
+ RelativePath="..\..\include\MT_Quaternion.inl"
+ >
+ </File>
+ <File
+ RelativePath="..\..\include\MT_Vector2.inl"
+ >
+ </File>
+ <File
+ RelativePath="..\..\include\MT_Vector3.inl"
+ >
+ </File>
+ <File
+ RelativePath="..\..\include\MT_Vector4.inl"
+ >
+ </File>
+ </Filter>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/intern/opennl/SConscript b/intern/opennl/SConscript index 56ad5a57ecf..e5f5d12c7d7 100644 --- a/intern/opennl/SConscript +++ b/intern/opennl/SConscript @@ -6,7 +6,7 @@ sources = env.Glob('intern/*.c') + env.Glob('superlu/*.c') incs = 'extern superlu' if (env['OURPLATFORM'] == 'win32-mingw'): - env.BlenderLib ('blender_ONL', sources, Split(incs), [], libtype=['core','intern'], priority=[1,80] ) + env.BlenderLib ('blender_ONL', sources, Split(incs), [], libtype=['core','intern','player'], priority=[1,80,22] ) else: - env.BlenderLib ('blender_ONL', sources, Split(incs), [], libtype='core', priority=65 ) + env.BlenderLib ('blender_ONL', sources, Split(incs), [], libtype=['core','player'], priority=[65,22] ) diff --git a/intern/opennl/make/msvc_7_0/opennl.vcproj b/intern/opennl/make/msvc_7_0/opennl.vcproj index ec999b0c252..d302a2508ab 100644 --- a/intern/opennl/make/msvc_7_0/opennl.vcproj +++ b/intern/opennl/make/msvc_7_0/opennl.vcproj @@ -716,6 +716,9 @@ ECHO Done Name="superlu" Filter=""> <File + RelativePath="..\..\superlu\BLO_sys_types.h"> + </File> + <File RelativePath="..\..\superlu\Cnames.h"> </File> <File diff --git a/intern/opennl/make/msvc_9_0/opennl.vcproj b/intern/opennl/make/msvc_9_0/opennl.vcproj new file mode 100644 index 00000000000..28051a491d2 --- /dev/null +++ b/intern/opennl/make/msvc_9_0/opennl.vcproj @@ -0,0 +1,993 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9,00"
+ Name="INT_opennl"
+ ProjectGUID="{8B8D4FC3-3234-4E54-8376-5AB83D00D164}"
+ RootNamespace="opennl"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Blender Debug|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\opennl\debug"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\opennl\debug"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\..\opennl\extern;..\..\..\opennl\superlu"
+ PreprocessorDefinitions="_DEBUG,WIN32,_LIB"
+ MinimalRebuild="false"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ BufferSecurityCheck="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\opennl\debug\OpenNL.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\opennl\debug\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\opennl\debug\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\opennl\debug\"
+ WarningLevel="2"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\debug\libopennl.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying OpenNL files library (debug target) to lib tree."
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\opennl\include MKDIR ..\..\..\..\..\build\msvc_9\intern\opennl\include
XCOPY /Y ..\..\extern\*.h ..\..\..\..\..\build\msvc_9\intern\opennl\include
ECHO Done
"
+ />
+ </Configuration>
+ <Configuration
+ Name="Blender Release|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\opennl"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\opennl"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ AdditionalIncludeDirectories="..\..\..\opennl\extern;..\..\..\opennl\superlu"
+ PreprocessorDefinitions="NDEBUG,WIN32,_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ DefaultCharIsUnsigned="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\opennl\OpenNL.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\opennl\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\opennl\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\opennl\"
+ WarningLevel="2"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ CompileAs="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\libopennl.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying OpenNL files library to lib tree."
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\opennl\include MKDIR ..\..\..\..\..\build\msvc_9\intern\opennl\include
XCOPY /Y ..\..\extern\*.h ..\..\..\..\..\build\msvc_9\intern\opennl\include
ECHO Done
"
+ />
+ </Configuration>
+ <Configuration
+ Name="3DPlugin Release|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\opennl\mtdll"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\opennl\mtdll"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ AdditionalIncludeDirectories="..\..\..\opennl\extern;..\..\..\opennl\superlu"
+ PreprocessorDefinitions="NDEBUG,WIN32,_LIB"
+ StringPooling="true"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ DefaultCharIsUnsigned="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\opennl\mtdll\OpenNL.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\opennl\mtdll\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\opennl\mtdll\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\opennl\mtdll\"
+ WarningLevel="2"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ CompileAs="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\mtdll\libopennl.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying OpenNL files library to lib tree."
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\opennl\include MKDIR ..\..\..\..\..\build\msvc_9\intern\opennl\include
XCOPY /Y ..\..\extern\*.h ..\..\..\..\..\build\msvc_9\intern\opennl\include
ECHO Done
"
+ />
+ </Configuration>
+ <Configuration
+ Name="3DPlugin Debug|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\opennl\mtdll\debug"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\opennl\mtdll\debug"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\..\opennl\extern;..\..\..\opennl\superlu"
+ PreprocessorDefinitions="_DEBUG,WIN32,_LIB"
+ MinimalRebuild="false"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ BufferSecurityCheck="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\opennl\mtdll\debug\OpenNL.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9\intern\opennl\mtdll\debug\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\opennl\mtdll\debug\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\opennl\mtdll\debug\"
+ WarningLevel="2"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\mtdll\debug\libopennl.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying OpenNL files library (debug target) to lib tree."
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\opennl\include MKDIR ..\..\..\..\..\build\msvc_9\intern\opennl\include
XCOPY /Y ..\..\extern\*.h ..\..\..\..\..\build\msvc_9\intern\opennl\include
ECHO Done
"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
+ >
+ <File
+ RelativePath="..\..\superlu\colamd.c"
+ >
+ <FileConfiguration
+ Name="Blender Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="3DPlugin Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\superlu\get_perm_c.c"
+ >
+ <FileConfiguration
+ Name="Blender Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="3DPlugin Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\superlu\heap_relax_snode.c"
+ >
+ <FileConfiguration
+ Name="Blender Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="3DPlugin Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\superlu\lsame.c"
+ >
+ <FileConfiguration
+ Name="Blender Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="3DPlugin Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\superlu\memory.c"
+ >
+ <FileConfiguration
+ Name="Blender Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="3DPlugin Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\superlu\mmd.c"
+ >
+ <FileConfiguration
+ Name="Blender Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="3DPlugin Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\intern\opennl.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\superlu\relax_snode.c"
+ >
+ <FileConfiguration
+ Name="Blender Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="3DPlugin Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\superlu\scolumn_bmod.c"
+ >
+ <FileConfiguration
+ Name="Blender Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="3DPlugin Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\superlu\scolumn_dfs.c"
+ >
+ <FileConfiguration
+ Name="Blender Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="3DPlugin Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\superlu\scopy_to_ucol.c"
+ >
+ <FileConfiguration
+ Name="Blender Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="3DPlugin Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\superlu\sgssv.c"
+ >
+ <FileConfiguration
+ Name="Blender Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="3DPlugin Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\superlu\sgstrf.c"
+ >
+ <FileConfiguration
+ Name="Blender Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="3DPlugin Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\superlu\sgstrs.c"
+ >
+ <FileConfiguration
+ Name="Blender Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="3DPlugin Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\superlu\smemory.c"
+ >
+ <FileConfiguration
+ Name="Blender Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="3DPlugin Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\superlu\smyblas2.c"
+ >
+ <FileConfiguration
+ Name="Blender Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="3DPlugin Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\superlu\sp_coletree.c"
+ >
+ <FileConfiguration
+ Name="Blender Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="3DPlugin Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\superlu\sp_ienv.c"
+ >
+ <FileConfiguration
+ Name="Blender Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="3DPlugin Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\superlu\sp_preorder.c"
+ >
+ <FileConfiguration
+ Name="Blender Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="3DPlugin Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\superlu\spanel_bmod.c"
+ >
+ <FileConfiguration
+ Name="Blender Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="3DPlugin Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\superlu\spanel_dfs.c"
+ >
+ <FileConfiguration
+ Name="Blender Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="3DPlugin Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\superlu\spivotL.c"
+ >
+ <FileConfiguration
+ Name="Blender Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="3DPlugin Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\superlu\spruneL.c"
+ >
+ <FileConfiguration
+ Name="Blender Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="3DPlugin Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\superlu\ssnode_bmod.c"
+ >
+ <FileConfiguration
+ Name="Blender Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="3DPlugin Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\superlu\ssnode_dfs.c"
+ >
+ <FileConfiguration
+ Name="Blender Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="3DPlugin Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\superlu\ssp_blas2.c"
+ >
+ <FileConfiguration
+ Name="Blender Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="3DPlugin Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\superlu\ssp_blas3.c"
+ >
+ <FileConfiguration
+ Name="Blender Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="3DPlugin Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\superlu\strsv.c"
+ >
+ <FileConfiguration
+ Name="Blender Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="3DPlugin Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\superlu\superlu_timer.c"
+ >
+ <FileConfiguration
+ Name="Blender Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="3DPlugin Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\superlu\sutil.c"
+ >
+ <FileConfiguration
+ Name="Blender Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="3DPlugin Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\superlu\util.c"
+ >
+ <FileConfiguration
+ Name="Blender Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="3DPlugin Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\superlu\xerbla.c"
+ >
+ <FileConfiguration
+ Name="Blender Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="3DPlugin Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc"
+ >
+ <File
+ RelativePath="..\..\extern\ONL_opennl.h"
+ >
+ </File>
+ <Filter
+ Name="superlu"
+ >
+ <File
+ RelativePath="..\..\superlu\BLO_sys_types.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\superlu\Cnames.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\superlu\colamd.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\superlu\ssp_defs.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\superlu\supermatrix.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\superlu\util.h"
+ >
+ </File>
+ </Filter>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/intern/opennl/superlu/BLO_sys_types.h b/intern/opennl/superlu/BLO_sys_types.h new file mode 100644 index 00000000000..411a8582f96 --- /dev/null +++ b/intern/opennl/superlu/BLO_sys_types.h @@ -0,0 +1,127 @@ +/** + * $Id$ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + * A platform-independent definition of [u]intXX_t + * Plus the accompanying header include for htonl/ntohl + * + * This file includes <sys/types.h> to define [u]intXX_t types, where + * XX can be 8, 16, 32 or 64. Unfortunately, not all systems have this + * file. + * - Windows uses __intXX compiler-builtin types. These are signed, + * so we have to flip the signs. + * For these rogue platforms, we make the typedefs ourselves. + * + */ + +/* +// DG: original BLO_sys_types.h is in source/blender/blenkernel +// but is not allowed be accessed here because of bad-level-call +*/ + +#ifndef BLO_SYS_TYPES_H +#define BLO_SYS_TYPES_H + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(_WIN32) && !defined(FREE_WINDOWS) + +/* The __intXX are built-in types of the visual complier! So we don't + * need to include anything else here. */ + + +typedef signed __int8 int8_t; +typedef signed __int16 int16_t; +typedef signed __int32 int32_t; +typedef signed __int64 int64_t; + +typedef unsigned __int8 uint8_t; +typedef unsigned __int16 uint16_t; +typedef unsigned __int32 uint32_t; +typedef unsigned __int64 uint64_t; + +#ifndef _INTPTR_T_DEFINED +#ifdef _WIN64 +typedef __int64 intptr_t; +#else +typedef long intptr_t; +#endif +#define _INTPTR_T_DEFINED +#endif + +#ifndef _UINTPTR_T_DEFINED +#ifdef _WIN64 +typedef unsigned __int64 uintptr_t; +#else +typedef unsigned long uintptr_t; +#endif +#define _UINTPTR_T_DEFINED +#endif + +#elif defined(__linux__) + + /* Linux-i386, Linux-Alpha, Linux-ppc */ +#include <stdint.h> + +#elif defined (__APPLE__) + +#include <inttypes.h> + +#elif defined(FREE_WINDOWS) + +#include <stdint.h> + +#else + + /* FreeBSD, Irix, Solaris */ +#include <sys/types.h> + +#endif /* ifdef platform for types */ + + +#ifdef _WIN32 +#ifndef htonl +#define htonl(x) correctByteOrder(x) +#endif +#ifndef ntohl +#define ntohl(x) correctByteOrder(x) +#endif +#elif defined (__FreeBSD__) || defined (__OpenBSD__) +#include <sys/param.h> +#elif defined (__APPLE__) +#include <sys/types.h> +#else /* irix sun linux */ +#include <netinet/in.h> +#endif /* ifdef platform for htonl/ntohl */ + +#ifdef __cplusplus +} +#endif + +#endif /* eof */ + diff --git a/intern/opennl/superlu/smemory.c b/intern/opennl/superlu/smemory.c index 79da748671a..7eefb900673 100644 --- a/intern/opennl/superlu/smemory.c +++ b/intern/opennl/superlu/smemory.c @@ -8,6 +8,8 @@ */ #include "ssp_defs.h" +#include "BLO_sys_types.h" // needed for intptr_t + /* Constants */ #define NO_MEMTYPE 4 /* 0: lusup; 1: ucol; @@ -49,8 +51,8 @@ static int no_expand; /* Macros to manipulate stack */ #define StackFull(x) ( x + stack.used >= stack.size ) -#define NotDoubleAlign(addr) ( (long int)addr & 7 ) -#define DoubleAlign(addr) ( ((long int)addr + 7) & ~7L ) +#define NotDoubleAlign(addr) ( (intptr_t)addr & 7 ) +#define DoubleAlign(addr) ( ((intptr_t)addr + 7) & ~7L ) #define TempSpace(m, w) ( (2*w + 4 + NO_MARKER) * m * sizeof(int) + \ (w + 1) * m * sizeof(float) ) #define Reduce(alpha) ((alpha + 1) / 2) /* i.e. (alpha-1)/2 + 1 */ @@ -611,8 +613,8 @@ sStackCompress(GlobalLU_t *Glu) last = (char*)usub + xusub[ndim] * iword; fragment = (char*) (((char*)stack.array + stack.top1) - last); - stack.used -= (long int) fragment; - stack.top1 -= (long int) fragment; + stack.used -= (intptr_t) fragment; + stack.top1 -= (intptr_t) fragment; Glu->ucol = ucol; Glu->lsub = lsub; diff --git a/intern/string/STR_String.h b/intern/string/STR_String.h index 2e489f91ae0..941430fd976 100644 --- a/intern/string/STR_String.h +++ b/intern/string/STR_String.h @@ -42,10 +42,12 @@ #define assertd(exp) ((void)NULL) #endif -#include <cstdlib> -#include <cstring> #include <vector> #include <limits.h> + +#include <cstring> +#include <cstdlib> + using namespace std; diff --git a/intern/string/make/msvc_9_0/string.vcproj b/intern/string/make/msvc_9_0/string.vcproj new file mode 100644 index 00000000000..16df974ff9c --- /dev/null +++ b/intern/string/make/msvc_9_0/string.vcproj @@ -0,0 +1,355 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9,00"
+ Name="INT_string"
+ ProjectGUID="{B789C2F3-279E-4A85-8F0A-7F7AC068E598}"
+ RootNamespace="string"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Blender Debug|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\string\debug"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\string\debug"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\.."
+ PreprocessorDefinitions="WIN32,_DEBUG,_LIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\string\debug\string.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9/intern\string\debug\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\string\debug\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\string\debug\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="3"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\debug\libstring.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying STRING files library (debug target) to lib tree."
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\string\include MKDIR ..\..\..\..\..\build\msvc_9\intern\string\include
XCOPY /Y ..\..\*.h ..\..\..\..\..\build\msvc_9\intern\string\include
ECHO Done
"
+ />
+ </Configuration>
+ <Configuration
+ Name="Blender Release|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\string"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\string"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="..\.."
+ PreprocessorDefinitions="WIN32,NDEBUG,_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\string\string.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9/intern\string\"
+ ObjectFile="..\..\..\..\..\build\msvc_9/intern\string\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9/intern\string\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\libstring.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying STRING files library to lib tree."
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\string\include MKDIR ..\..\..\..\..\build\msvc_9\intern\string\include
XCOPY /Y ..\..\*.h ..\..\..\..\..\build\msvc_9\intern\string\include
ECHO Done
"
+ />
+ </Configuration>
+ <Configuration
+ Name="3DPlugin Release|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\string\mtdll"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\string\mtdll"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="..\.."
+ PreprocessorDefinitions="WIN32,NDEBUG,_LIB"
+ StringPooling="true"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\string\mtdll\string.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9/intern\string\mtdll\"
+ ObjectFile="..\..\..\..\..\build\msvc_9/intern\string\mtdll\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9/intern\string\mtdll\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\mtdll\libstring.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying STRING files library to lib tree."
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\string\include MKDIR ..\..\..\..\..\build\msvc_9\intern\string\include
XCOPY /Y ..\..\*.h ..\..\..\..\..\build\msvc_9\intern\string\include
ECHO Done
"
+ />
+ </Configuration>
+ <Configuration
+ Name="3DPlugin Debug|Win32"
+ OutputDirectory="..\..\..\..\..\build\msvc_9\intern\string\mtdll\debug"
+ IntermediateDirectory="..\..\..\..\..\build\msvc_9\intern\string\mtdll\debug"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\.."
+ PreprocessorDefinitions="WIN32,_DEBUG,_LIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\intern\string\mtdll\debug\string.pch"
+ AssemblerListingLocation="..\..\..\..\..\build\msvc_9/intern\string\mtdll\debug\"
+ ObjectFile="..\..\..\..\..\build\msvc_9\intern\string\mtdll\debug\"
+ ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\intern\string\mtdll\debug\"
+ WarningLevel="2"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="3"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\build\msvc_9\libs\intern\mtdll\debug\libstring.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="Copying STRING files library (debug target) to lib tree."
+ CommandLine="ECHO Copying header files
IF NOT EXIST ..\..\..\..\..\build\msvc_9\intern\string\include MKDIR ..\..\..\..\..\build\msvc_9\intern\string\include
XCOPY /Y ..\..\*.h ..\..\..\..\..\build\msvc_9\intern\string\include
ECHO Done
"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath="..\..\intern\STR_String.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ <Filter
+ Name="extern"
+ >
+ <File
+ RelativePath="..\..\STR_HashedString.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\STR_String.h"
+ >
+ </File>
+ </Filter>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
|