diff --git a/src/editors/ActorEditor/UI_ActorTools.h b/src/editors/ActorEditor/UI_ActorTools.h
index 0d4c9a7204b..9500478f2ef 100644
--- a/src/editors/ActorEditor/UI_ActorTools.h
+++ b/src/editors/ActorEditor/UI_ActorTools.h
@@ -52,7 +52,7 @@ class EngineModel : public CPhysicsShellHolderEditorBase
struct BPPlayItem
{
- AnsiString name;
+ xr_string name;
u16 slot;
};
@@ -93,10 +93,10 @@ class EngineModel : public CPhysicsShellHolderEditorBase
CMotion* FindMotionKeys(LPCSTR name, u16 slot);
private:
- // virtual Fmatrix& _BCL ObjectXFORM() { return m_pobject_matrix; }
- // virtual Fvector& _BCL ObjectPosition() { return m_pobject_matrix.c; }
- // virtual IRenderVisual* _BCL ObjectVisual() { return m_pVisual; }
- virtual IKinematics* _BCL ObjectKinematics()
+ // virtual Fmatrix& ObjectXFORM() { return m_pobject_matrix; }
+ // virtual Fvector& ObjectPosition() { return m_pobject_matrix.c; }
+ // virtual IRenderVisual* ObjectVisual() { return m_pVisual; }
+ virtual IKinematics* ObjectKinematics()
{
if (!m_pVisual)
return 0;
diff --git a/src/editors/ECore/ECore.vcxproj b/src/editors/ECore/ECore.vcxproj
index 812eacbf19b..21213cf06aa 100644
--- a/src/editors/ECore/ECore.vcxproj
+++ b/src/editors/ECore/ECore.vcxproj
@@ -63,12 +63,10 @@
-
-
@@ -102,15 +100,8 @@
-
-
-
-
-
-
-
@@ -125,7 +116,6 @@
-
@@ -169,16 +159,9 @@
-
-
-
-
-
-
-
Create
diff --git a/src/editors/ECore/ECore.vcxproj.filters b/src/editors/ECore/ECore.vcxproj.filters
index ee4bbd6603e..5873adbcd05 100644
--- a/src/editors/ECore/ECore.vcxproj.filters
+++ b/src/editors/ECore/ECore.vcxproj.filters
@@ -25,9 +25,6 @@
editor
-
- editor
-
editor
@@ -40,9 +37,6 @@
editor
-
- editor
-
editor
@@ -142,33 +136,12 @@
engine
-
- engine
-
-
- engine
-
-
- engine
-
engine
engine
-
- engine
-
-
- engine
-
-
- engine
-
-
- engine
-
engine
@@ -205,9 +178,6 @@
editor
-
- editor
-
editor
@@ -337,36 +307,15 @@
editor
-
- editor
-
engine
-
- engine
-
-
- engine
-
-
- engine
-
-
- engine
-
engine
engine
-
- engine
-
-
- engine
-
\ No newline at end of file
diff --git a/src/editors/ECore/Editor/ColorPicker.cpp b/src/editors/ECore/Editor/ColorPicker.cpp
index 8543665cedf..f70d75f1cb1 100644
--- a/src/editors/ECore/Editor/ColorPicker.cpp
+++ b/src/editors/ECore/Editor/ColorPicker.cpp
@@ -4,6 +4,7 @@
#include "ColorPicker.h"
+/*
class CTCD
{
public:
@@ -19,13 +20,15 @@ class CTCD
~CTCD() { xr_delete(cdColor); }
};
-static CTCD TCD;
+static CTCD TCD;*/
+// XXX: Find and delete.
extern "C" DLL_API bool FSColorPickerExecute(u32* currentColor, LPDWORD originalColor, const int initialExpansionState);
-bool SelectColor(u32* currentcolor, bool bDefaultPicker)
+[[deprecated]] bool SelectColor(u32* currentcolor, bool bDefaultPicker)
{
- VERIFY(currentcolor);
+ return false;
+ /*VERIFY(currentcolor);
if (bDefaultPicker)
{
TCD.cdColor->Color = TColor(rgb2bgr(*currentcolor));
@@ -45,12 +48,13 @@ bool SelectColor(u32* currentcolor, bool bDefaultPicker)
return true;
}
return false;
- }
+ }*/
}
-bool SelectColorWin(u32* currentcolor, bool bDefaultPicker)
+[[deprecated]] bool SelectColorWin(u32* currentcolor, bool bDefaultPicker)
{
- VERIFY(currentcolor);
+ return false;
+ /*VERIFY(currentcolor);
if (bDefaultPicker)
{
TCD.cdColor->Color = TColor(*currentcolor);
@@ -70,5 +74,5 @@ bool SelectColorWin(u32* currentcolor, bool bDefaultPicker)
return true;
}
return false;
- }
+ }*/
}
diff --git a/src/editors/ECore/Editor/DrawUtils.h b/src/editors/ECore/Editor/DrawUtils.h
deleted file mode 100644
index 8b137891791..00000000000
--- a/src/editors/ECore/Editor/DrawUtils.h
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/src/editors/ECore/Editor/EThumbnail.h b/src/editors/ECore/Editor/EThumbnail.h
index 160bee8b536..99ac8862587 100644
--- a/src/editors/ECore/Editor/EThumbnail.h
+++ b/src/editors/ECore/Editor/EThumbnail.h
@@ -4,7 +4,7 @@
#include "Layers/xrRender/ETextureParams.h"
#include "xrServerEntities/PropertiesListHelper.h"
-#include "MXCtrls.hpp"
+//#include "MXCtrls.hpp"
//------------------------------------------------------------------------------
// Custom class
//------------------------------------------------------------------------------
diff --git a/src/editors/ECore/Editor/EThumbnailObject.cpp b/src/editors/ECore/Editor/EThumbnailObject.cpp
index dcfb0337c1f..57ac0bf3020 100644
--- a/src/editors/ECore/Editor/EThumbnailObject.cpp
+++ b/src/editors/ECore/Editor/EThumbnailObject.cpp
@@ -115,16 +115,16 @@ void EObjectThumbnail::Save(int age, LPCSTR path)
void EObjectThumbnail::FillProp(PropItemVec& items)
{
- PHelper().CreateCaption(items, "Face Count", AnsiString(face_count).c_str());
- PHelper().CreateCaption(items, "Vertex Count", AnsiString(vertex_count).c_str());
+ PHelper().CreateCaption(items, "Face Count", xr_string(face_count).c_str());
+ PHelper().CreateCaption(items, "Vertex Count", xr_string(vertex_count).c_str());
}
//------------------------------------------------------------------------------
void EObjectThumbnail::FillInfo(PropItemVec& items)
{
- PHelper().CreateCaption(items, "Face Count", AnsiString(face_count).c_str());
- PHelper().CreateCaption(items, "Vertex Count", AnsiString(vertex_count).c_str());
+ PHelper().CreateCaption(items, "Face Count", xr_string(face_count).c_str());
+ PHelper().CreateCaption(items, "Vertex Count", xr_string(vertex_count).c_str());
}
//------------------------------------------------------------------------------
diff --git a/src/editors/ECore/Editor/GeometryCollector.cpp b/src/editors/ECore/Editor/GeometryCollector.cpp
index 9513860f0f9..2bdf850038a 100644
--- a/src/editors/ECore/Editor/GeometryCollector.cpp
+++ b/src/editors/ECore/Editor/GeometryCollector.cpp
@@ -19,8 +19,8 @@ VCPacked::VCPacked(const Fbox& bb, float _eps, u32 _sx, u32 _sy, u32 _sz, int ap
VM.resize(sx * sy * sz);
// Params
- VMscale.set(bb.max.x - bb.min.x, bb.max.y - bb.min.y, bb.max.z - bb.min.z);
- VMmin.set(bb.min);
+ VMscale.set(bb.vMax.x - bb.vMin.x, bb.vMax.y - bb.vMin.y, bb.vMax.z - bb.vMin.z);
+ VMmin.set(bb.vMin);
VMeps.set(VMscale.x / (sx - 1) / 2, VMscale.y / (sy - 1) / 2, VMscale.z / (sz - 1) / 2);
VMeps.x = (VMeps.x < EPS_L) ? VMeps.x : EPS_L;
VMeps.y = (VMeps.y < EPS_L) ? VMeps.y : EPS_L;
diff --git a/src/editors/ECore/Editor/ImageEditor.h b/src/editors/ECore/Editor/ImageEditor.h
index fbabdd258a6..2f3cd8bf71f 100644
--- a/src/editors/ECore/Editor/ImageEditor.h
+++ b/src/editors/ECore/Editor/ImageEditor.h
@@ -13,7 +13,7 @@
#include "mxPlacemnt.hpp"
#include
-#include "MXCtrls.hpp"
+//#include "MXCtrls.hpp"
//---------------------------------------------------------------------------
// refs
diff --git a/src/editors/ECore/Editor/Library.h b/src/editors/ECore/Editor/Library.h
index c3f4071c0d3..caf6e71f32c 100644
--- a/src/editors/ECore/Editor/Library.h
+++ b/src/editors/ECore/Editor/Library.h
@@ -5,7 +5,7 @@
#ifndef LibraryH
#define LibraryH
-#include "pure.h"
+#include "xrEngine/pure.h"
#include "editors/xrEProps/FolderLib.h"
//----------------------------------------------------
class CEditableObject;
@@ -15,7 +15,7 @@ DEFINE_MAP_PRED(AnsiString, CEditableObject*, EditObjMap, EditObjPairIt, astr_pr
class ECORE_API ELibrary //: public pureDeviceCreate, public pureDeviceDestroy
{
bool m_bReady;
- friendclass TfrmChoseObject;
+ friend class TfrmChoseObject;
EditObjMap m_EditObjects;
CEditableObject* LoadEditObject(LPCSTR full_name);
@@ -25,8 +25,8 @@ class ECORE_API ELibrary //: public pureDeviceCreate, public pureDeviceDestroy
ELibrary();
virtual ~ELibrary();
- void__stdcall RemoveObject(LPCSTR fname, EItemType type, bool& res);
- void__stdcall RenameObject(LPCSTR fn0, LPCSTR fn1, EItemType type);
+ void __stdcall RemoveObject(LPCSTR fname, EItemType type, bool& res);
+ void __stdcall RenameObject(LPCSTR fn0, LPCSTR fn1, EItemType type);
void OnCreate();
void OnDestroy();
diff --git a/src/editors/ECore/Editor/MinimapEditor.h b/src/editors/ECore/Editor/MinimapEditor.h
index 8863237249f..48a68ebad4c 100644
--- a/src/editors/ECore/Editor/MinimapEditor.h
+++ b/src/editors/ECore/Editor/MinimapEditor.h
@@ -9,7 +9,7 @@
#include
#include "ExtBtn.hpp"
#include
-#include "MXCtrls.hpp"
+//#include "MXCtrls.hpp"
#include "ElEdits.hpp"
#include "ElSpin.hpp"
#include "ElXPThemedControl.hpp"
diff --git a/src/editors/ECore/Editor/PhysicsShellHolderEditorBase.h b/src/editors/ECore/Editor/PhysicsShellHolderEditorBase.h
index 6cfc8abbb0f..a6bace9593b 100644
--- a/src/editors/ECore/Editor/PhysicsShellHolderEditorBase.h
+++ b/src/editors/ECore/Editor/PhysicsShellHolderEditorBase.h
@@ -22,48 +22,48 @@ class ECORE_API CPhysicsShellHolderEditorBase : public IPhysicsShellHolder
Fmatrix m_object_xform;
private:
- virtual LPCSTR _BCL ObjectName() const { return "EditorActor"; }
- virtual LPCSTR _BCL ObjectNameVisual() const { return "unknown"; }
- virtual LPCSTR _BCL ObjectNameSect() const { return "unknown"; }
- virtual bool _BCL ObjectGetDestroy() const { return false; };
- virtual ICollisionHitCallback* _BCL ObjectGetCollisionHitCallback() { return 0; }
- virtual u16 _BCL ObjectID() const { return u16(-1); }
- virtual IGameObject* _BCL IObject() { return 0; } //--#SM+#--
- virtual ICollisionForm* _BCL ObjectCollisionModel()
+ virtual LPCSTR ObjectName() const { return "EditorActor"; }
+ virtual LPCSTR ObjectNameVisual() const { return "unknown"; }
+ virtual LPCSTR ObjectNameSect() const { return "unknown"; }
+ virtual bool ObjectGetDestroy() const { return false; };
+ virtual ICollisionHitCallback* ObjectGetCollisionHitCallback() { return 0; }
+ virtual u16 ObjectID() const { return u16(-1); }
+ virtual IGameObject* IObject() { return 0; } //--#SM+#--
+ virtual ICollisionForm* ObjectCollisionModel()
{
VERIFY(false);
return 0;
}
// virtual IRenderVisual* _BCL ObjectVisual () { return
// m_pVisual;}
- virtual IDamageSource* _BCL ObjectCastIDamageSource() { return 0; }
- virtual void _BCL ObjectProcessingDeactivate() { ; }
- virtual void _BCL ObjectProcessingActivate() {}
- virtual void _BCL ObjectSpatialMove() {}
- virtual CPhysicsShell*& _BCL ObjectPPhysicsShell() { return m_physics_shell; }
- virtual void _BCL enable_notificate() {}
- virtual bool _BCL has_parent_object() { return false; }
- virtual void _BCL on_physics_disable() {}
- virtual IPHCapture* _BCL PHCapture() { return 0; }
- virtual bool _BCL IsInventoryItem() { return false; }
- virtual bool _BCL IsActor() { return false; }
- virtual bool _BCL IsStalker() { return false; }
- virtual bool _BCL IsCollideWithBullets() { return false; } //--#SM+#--
- virtual bool _BCL IsCollideWithActorCamera() { return false; } //--#SM+#--
+ virtual IDamageSource* ObjectCastIDamageSource() { return 0; }
+ virtual void ObjectProcessingDeactivate() { ; }
+ virtual void ObjectProcessingActivate() {}
+ virtual void ObjectSpatialMove() {}
+ virtual CPhysicsShell*& ObjectPPhysicsShell() { return m_physics_shell; }
+ virtual void enable_notificate() {}
+ virtual bool has_parent_object() { return false; }
+ virtual void on_physics_disable() {}
+ virtual IPHCapture* PHCapture() { return 0; }
+ virtual bool IsInventoryItem() { return false; }
+ virtual bool IsActor() { return false; }
+ virtual bool IsStalker() { return false; }
+ virtual bool IsCollideWithBullets() { return false; } //--#SM+#--
+ virtual bool IsCollideWithActorCamera() { return false; } //--#SM+#--
// virtual void SetWeaponHideState ( u16 State, bool bSet )=0;
- virtual void _BCL HideAllWeapons(bool v) {} //(SetWeaponHideState(INV_STATE_BLOCK_ALL,true))
- virtual void _BCL MovementCollisionEnable(bool enable) {}
- virtual CPHSoundPlayer* _BCL ObjectPhSoundPlayer() { return 0; }
- virtual ICollisionDamageReceiver* _BCL ObjectPhCollisionDamageReceiver() { return 0; }
- virtual void _BCL BonceDamagerCallback(float& damage_factor) {}
+ virtual void HideAllWeapons(bool v) {} //(SetWeaponHideState(INV_STATE_BLOCK_ALL,true))
+ virtual void MovementCollisionEnable(bool enable) {}
+ virtual CPHSoundPlayer* ObjectPhSoundPlayer() { return 0; }
+ virtual ICollisionDamageReceiver* ObjectPhCollisionDamageReceiver() { return 0; }
+ virtual void BonceDamagerCallback(float& damage_factor) {}
public:
- virtual Fmatrix& _BCL ObjectXFORM() { return m_object_xform; }
+ virtual Fmatrix& ObjectXFORM() { return m_object_xform; }
private:
- virtual Fvector& _BCL ObjectPosition() { return m_object_xform.c; }
+ virtual Fvector& ObjectPosition() { return m_object_xform.c; }
#ifdef DEBUG
- virtual std::string _BCL dump(EDumpType type) const
+ virtual std::string dump(EDumpType type) const
{
VERIFY(false);
return std::string("ActorEditor!");
diff --git a/src/editors/ECore/Editor/SoundEditor.h b/src/editors/ECore/Editor/SoundEditor.h
index fc08674bf76..f0f311f8506 100644
--- a/src/editors/ECore/Editor/SoundEditor.h
+++ b/src/editors/ECore/Editor/SoundEditor.h
@@ -13,7 +13,7 @@
#include "mxPlacemnt.hpp"
#include
-#include "MXCtrls.hpp"
+//#include "MXCtrls.hpp"
//---------------------------------------------------------------------------
// refs
diff --git a/src/editors/ECore/Editor/UI_MainCommand.cpp b/src/editors/ECore/Editor/UI_MainCommand.cpp
index 58f8dd8a3cd..8329dee624b 100644
--- a/src/editors/ECore/Editor/UI_MainCommand.cpp
+++ b/src/editors/ECore/Editor/UI_MainCommand.cpp
@@ -21,7 +21,7 @@
#include "xrEngine/IGame_Persistent.h"
#include "editors/xrEProps/NumericVector.h"
-#include "editors/xrEProps/TextForm.h"
+//#include "editors/xrEProps/TextForm.h"
ECommandVec ECommands;
BOOL bAllowReceiveCommand = FALSE;
diff --git a/src/editors/ECore/Editor/UI_MainCommand.h b/src/editors/ECore/Editor/UI_MainCommand.h
index 9f39d7591c4..ce38dfc5ad8 100644
--- a/src/editors/ECore/Editor/UI_MainCommand.h
+++ b/src/editors/ECore/Editor/UI_MainCommand.h
@@ -123,7 +123,7 @@ class CCommandVar
typedef fastdelegate::FastDelegate2 TECommandEvent;
-class SECommand;
+struct SECommand;
struct ECORE_API SESubCommand
{
diff --git a/src/editors/ECore/Editor/UI_ToolsCustom.h b/src/editors/ECore/Editor/UI_ToolsCustom.h
index b1103528b6c..8551afdf7dd 100644
--- a/src/editors/ECore/Editor/UI_ToolsCustom.h
+++ b/src/editors/ECore/Editor/UI_ToolsCustom.h
@@ -2,8 +2,8 @@
#ifndef UI_ToolsCustomH
#define UI_ToolsCustomH
-#include "eltree.hpp"
-#include "mxplacemnt.hpp"
+//#include "eltree.hpp"
+//#include "mxplacemnt.hpp"
#include "editors/xrEProps/ItemListHelper.h"
#include "EditObject.h"
diff --git a/src/editors/ECore/Editor/du_sphere_part.cpp b/src/editors/ECore/Editor/du_sphere_part.cpp
deleted file mode 100644
index 8b137891791..00000000000
--- a/src/editors/ECore/Editor/du_sphere_part.cpp
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/src/editors/ECore/Editor/du_sphere_part.h b/src/editors/ECore/Editor/du_sphere_part.h
deleted file mode 100644
index 8b137891791..00000000000
--- a/src/editors/ECore/Editor/du_sphere_part.h
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/src/editors/ECore/Editor/render.cpp b/src/editors/ECore/Editor/render.cpp
index a8d1e1e81c3..dfbcb77e7e0 100644
--- a/src/editors/ECore/Editor/render.cpp
+++ b/src/editors/ECore/Editor/render.cpp
@@ -8,10 +8,8 @@
float ssaDISCARD = 4.f;
float ssaDONTSORT = 32.f;
-ECORE_API
-float r_ssaDISCARD;
-ECORE_API
-float g_fSCREEN;
+ECORE_API float r_ssaDISCARD;
+ECORE_API float g_fSCREEN;
CRender RImplementation;
ECORE_API CRender* Render = &RImplementation;
@@ -53,7 +51,7 @@ void CRender::Calculate()
}
#include "xrEngine/IGame_Persistent.h"
-#include "environment.h"
+#include "xrEngine/Environment.h"
void CRender::Render() {}
IRender_DetailModel* CRender::model_CreateDM(IReader* F)
diff --git a/src/editors/ECore/Editor/render.h b/src/editors/ECore/Editor/render.h
index cd835374cf1..0641cd92d54 100644
--- a/src/editors/ECore/Editor/render.h
+++ b/src/editors/ECore/Editor/render.h
@@ -134,6 +134,6 @@ IC
}
extern ECORE_API CRender RImplementation;
-//.extern ECORE_API CRender* Render;
+extern ECORE_API CRender* Render;
#endif
diff --git a/src/editors/ECore/Editor/ui_main.h b/src/editors/ECore/Editor/ui_main.h
index 38adb136b68..2ac14dd3fca 100644
--- a/src/editors/ECore/Editor/ui_main.h
+++ b/src/editors/ECore/Editor/ui_main.h
@@ -2,9 +2,9 @@
#ifndef UI_MainH
#define UI_MainH
-#include "RenderWindow.hpp"
+//#include "RenderWindow.hpp"
#include "UI_MainCommand.h"
-#include "IInputReceiver.h"
+#include "xrEngine/IInputReceiver.h"
// refs
class CCustomObject;
@@ -41,9 +41,12 @@ struct ECORE_API SPBItem
typedef xr_vector EStateList;
typedef EStateList::iterator EStateIt;
-class ECORE_API TUI :
-
- public IInputReceiver
+// XXX: Get rid of
+class TD3DWindow;
+class TPanel;
+class THintWindow;
+class TForm;
+class ECORE_API TUI : public IInputReceiver
{
protected:
friend class CCustomPreferences;
@@ -142,7 +145,7 @@ class ECORE_API TUI :
virtual ~TUI();
void Quit() { m_Flags.set(flNeedQuit, TRUE); }
- IC HANDLE GetHWND() { return m_D3DWindow->Handle; }
+ IC HANDLE GetHWND() { return nullptr /*m_D3DWindow->Handle*/; }
int GetRenderWidth() { return EDevice.dwWidth; }
int GetRenderHeight() { return EDevice.dwHeight; }
int GetRealWidth() { return EDevice.m_RealWidth; }
@@ -223,7 +226,7 @@ class ECORE_API TUI :
bool NeedAbort()
{
- Application->ProcessMessages();
+ //Application->ProcessMessages();
return bNeedAbort;
}
void NeedBreak() { bNeedAbort = true; }
@@ -281,6 +284,7 @@ void ECORE_API ResetActionToSelect();
ExecCommand(cmd, p0); \
bExec = true; \
}
+class TObject;
extern ECORE_API void __fastcall PanelMinMax(TPanel* pa);
extern ECORE_API void __fastcall PanelMinimize(TPanel* pa);
extern ECORE_API void __fastcall PanelMaximize(TPanel* pa);
diff --git a/src/editors/ECore/Editor/xrLoadSurface.cpp b/src/editors/ECore/Editor/xrLoadSurface.cpp
deleted file mode 100644
index 102557f2b2a..00000000000
--- a/src/editors/ECore/Editor/xrLoadSurface.cpp
+++ /dev/null
@@ -1,145 +0,0 @@
-#include "stdafx.h"
-#pragma hdrstop
-
-#include "freeimage/freeimage.h"
-
-struct SExts
-{
- xr_vector exts;
-
- void format_register(LPCSTR ext)
- {
- if (ext && ext[0])
- {
- for (u32 i = 0; i < exts.size(); i++)
- if (0 == xr_stricmp(exts[i], ext))
- return;
- exts.push_back(xr_strdup(ext));
- }
- }
-
- u32 size() { return (u32)exts.size(); }
- LPSTR operator[](int k) { return exts[k]; }
- ~SExts()
- {
- for (u32 i = 0; i < exts.size(); i++)
- xr_free(exts[i]);
- exts.clear();
- }
-};
-
-SExts formats;
-
-void Surface_FormatExt(FREE_IMAGE_FORMAT f)
-{
- LPCSTR n = FreeImage_GetFIFExtensionList(f);
- if (n)
- {
- LPSTR base = xr_strdup(n);
- LPSTR ext = base;
- LPSTR cur = ext;
- for (; ext[0]; ext++)
- {
- if (ext[0] == ',')
- {
- ext[0] = 0;
- formats.format_register(cur);
- cur = ++ext;
- }
- }
- if (cur && cur[0])
- formats.format_register(cur);
- xr_free(base);
- }
-}
-
-void Surface_Init()
-{
- Msg("* ImageLibrary version: %s", FreeImage_GetVersion());
-
- formats.format_register("tga");
- Surface_FormatExt(FIF_BMP);
- Surface_FormatExt(FIF_ICO);
- Surface_FormatExt(FIF_JPEG);
- Surface_FormatExt(FIF_JNG);
- Surface_FormatExt(FIF_KOALA);
- Surface_FormatExt(FIF_LBM);
- Surface_FormatExt(FIF_MNG);
- Surface_FormatExt(FIF_PBM);
- Surface_FormatExt(FIF_PBMRAW);
- Surface_FormatExt(FIF_PCD);
- Surface_FormatExt(FIF_PCX);
- Surface_FormatExt(FIF_PGM);
- Surface_FormatExt(FIF_PGMRAW);
- Surface_FormatExt(FIF_PNG);
- Surface_FormatExt(FIF_PPM);
- Surface_FormatExt(FIF_PPMRAW);
- Surface_FormatExt(FIF_RAS);
- Surface_FormatExt(FIF_TARGA);
- Surface_FormatExt(FIF_TIFF);
- Surface_FormatExt(FIF_WBMP);
- Surface_FormatExt(FIF_PSD);
- Surface_FormatExt(FIF_IFF);
-
- Msg("* %d supported formats", formats.size());
-}
-
-BOOL Surface_Detect(string_path& F, LPSTR N)
-{
- for (u32 i = 0; i < formats.size(); i++)
- {
- FS.update_path(F, "$textures$", strconcat(sizeof(F), F, N, ".", formats[i]));
- int h = _open(F, O_RDONLY | O_BINARY);
- if (h > 0)
- {
- _close(h);
- return TRUE;
- }
- }
- return FALSE;
-}
-
-FIBITMAP* Surface_Load(char* full_name)
-{
- // load
- FREE_IMAGE_FORMAT fif = FreeImage_GetFIFFromFilename(full_name);
- FIBITMAP* map = FreeImage_Load(fif, full_name);
- if (0 == map)
- return NULL;
-
- // check if already 32bpp
- if (32 == FreeImage_GetBPP(map))
- return map;
-
- // convert
- FIBITMAP* map32 = FreeImage_ConvertTo32Bits(map);
- if (0 == map32)
- map32 = map;
- else
- FreeImage_Unload(map);
-
- return map32;
-}
-
-u32* Surface_Load(char* name, u32& w, u32& h)
-{
- if (strchr(name, '.'))
- *(strchr(name, '.')) = 0;
-
- // detect format
- string_path full;
- if (!Surface_Detect(full, name))
- return NULL;
-
- FIBITMAP* map32 = Surface_Load(full);
-
- h = FreeImage_GetHeight(map32);
- w = FreeImage_GetWidth(map32);
-
- u32 memSize = w * h * 4;
- u32* memPTR = (u32*)(xr_malloc(memSize));
- u32* memDATA = (u32*)(FreeImage_GetScanLine(map32, 0));
- CopyMemory(memPTR, memDATA, memSize);
- FreeImage_Unload(map32);
- return memPTR;
-}
diff --git a/src/editors/ECore/Engine/GameMtlLib.cpp b/src/editors/ECore/Engine/GameMtlLib.cpp
deleted file mode 100644
index 8b137891791..00000000000
--- a/src/editors/ECore/Engine/GameMtlLib.cpp
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/src/editors/ECore/Engine/GameMtlLib.h b/src/editors/ECore/Engine/GameMtlLib.h
deleted file mode 100644
index 8b137891791..00000000000
--- a/src/editors/ECore/Engine/GameMtlLib.h
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/src/editors/ECore/Engine/GameMtlLib_Engine.cpp b/src/editors/ECore/Engine/GameMtlLib_Engine.cpp
deleted file mode 100644
index 8b137891791..00000000000
--- a/src/editors/ECore/Engine/GameMtlLib_Engine.cpp
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/src/editors/ECore/Engine/Image.cpp b/src/editors/ECore/Engine/Image.cpp
index 5d921776e81..90e87a16a40 100644
--- a/src/editors/ECore/Engine/Image.cpp
+++ b/src/editors/ECore/Engine/Image.cpp
@@ -1,10 +1,6 @@
-// Image.cpp: implementation of the CImage class.
-//
-//////////////////////////////////////////////////////////////////////
-
#include "stdafx.h"
-#pragma hdrstop
+/*
#include "Image.h"
#include "../../../Layers/xrRender/tga.h"
@@ -124,7 +120,7 @@ void CImage::Grayscale()
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
-/*
+/ *
#pragma pack(push,8)
struct _fileT {
D3DFORMAT fmt;
@@ -153,7 +149,7 @@ void CImage::LoadT(char *name)
xr_free(data);
}
-*/
+* /
//-----------------------------------------------------------------------------
// Load an TGA file
@@ -308,7 +304,7 @@ bool CImage::LoadTGA(LPCSTR name)
}
}
}
- /*
+ / *
if (hdr.pixsize==24)
{ // 24bpp
bAlpha = FALSE;
@@ -329,7 +325,7 @@ bool CImage::LoadTGA(LPCSTR name)
bAlpha = TRUE;
TGA.r(pData,hdr.width*hdr.height*4);
}
- */
+ * /
if (vflip)
Vflip();
if (hflip)
@@ -337,3 +333,4 @@ bool CImage::LoadTGA(LPCSTR name)
return true;
}
+*/
diff --git a/src/editors/ECore/Engine/Image.h b/src/editors/ECore/Engine/Image.h
index 34d3ecf3b83..99a6c40374a 100644
--- a/src/editors/ECore/Engine/Image.h
+++ b/src/editors/ECore/Engine/Image.h
@@ -6,6 +6,7 @@
#define AFX_IMAGE_H__4281EEAB_9522_40E5_A90D_831A40E1A344__INCLUDED_
#pragma once
+[[deprecated]]
class ENGINE_API CImage
{
public:
diff --git a/src/editors/ECore/Engine/NVMeshMender.cpp b/src/editors/ECore/Engine/NVMeshMender.cpp
deleted file mode 100644
index e95389c053e..00000000000
--- a/src/editors/ECore/Engine/NVMeshMender.cpp
+++ /dev/null
@@ -1,918 +0,0 @@
-/*********************************************************************NVMH2****
-Copyright (C) 1999, 2000, 2001, 2002 NVIDIA Corporation
-This file is provided without support, instruction, or implied warranty of any
-kind. NVIDIA makes no guarantee of its fitness for a particular purpose and is
-not liable under any circumstances for any damages or loss whatsoever arising
-from the use or inability to use this file or items derived from it.
-
-Questions to sim.dietrich@nvidia.com
-
-Comments:
-
- This tool is designed to help condition meshes for use in vertex & pixel shaders.
-
- It can generate normals, texture coordinates, and perhaps most importantly, texture space
- basis matrices. It also can fix common texuring problems that come up when bump mapping, including
-
- Texture Mirroring - When two one halves of a character use the same part of a texture.
-
- Cylindrical TexGen - When the rendering relies on cylindrical wrapping, texture space computation
- won't work right.
-
- Stretched Basis - When two adjacend faces use wildly different texture mappings, causing stretching
- that can ruin per-pixel lighting.
-
-
- Here is an example usage scenario :
-
- Say you have positions & indices, and want textures, normals, and tangents.
-
- NVMeshMender aMender;
-
- MVMeshMender::VAVector inputAtts; // this is what you have
-
- MVMeshMender::VAVector outputAtts; // this is what you want
-
- MVMeshMender::VertexAttribute att; // this is my working attribute
-
- att.Name_ = "position";
-
- for ( int p = 0; p < number_of_vertices; ++p )
- {
- att.floatVector_.push_back( myPositions[ p ].x );
- att.floatVector_.push_back( myPositions[ p ].y );
- att.floatVector_.push_back( myPositions[ p ].z );
- }
-
- att.floatVector.clear();
-
- att.Name_ = "indices";
-
- for ( int i = 0; i < number_of_indices; ++i )
- {
- att.intVector_.push_back( myIndices[ i ] );
- }
-
- // All inputs except for indices are assumed to be sets of 3 floats
-
- // "indices" are assumed to be unsigned ints
-
- // "tex0" is used for the tangent space calculation
-
- // "tex0" is the only coordinate set generated, and the texture matrix applies only to it
-
- // All unknown attribute types, including "tex1", "tex2", "random_attribute", "weights", "bones", etc.
- // are simply passed through. They will be duplicated as needed just like positions, normals, etc.
-
- bool bSuccess = aMender.Munge( inputAtts, // these are my positions & indices
- outputAtts, // these are the outputs I requested, plus extra stuff
-generated on my behalf
- 3.141592654f / 2.5f, // tangent space smooth angle
- NULL, // no Texture matrix applied to my tex0 coords
- FixTangents, // fix degenerate bases & texture mirroring
- FixCylindricalTexGen // handle cylidrically mapped textures via vertex duplication
- WeightNormalsByFaceSize // weight vertex normals by the triangle's size
- );
-
-
- if ( !bSuccess ) return false;
-
- // Now the outputAtts may contain more vertex then you sent in !
- // This is because in handling tangent space smoothing, and solving texture mirroring &
- // cylindrical texture wrapping problems, we partially duplicate vertices.
-
- // All attributes are duplicated, even unknowns.
-
- // You may also get things you didn't ask for. For instance, if you ask for tangent space,
- // in other words, you ask for "tangent" or "binormal", you will get "normal", "tex0",
- // "tangent" and "binormal". You can then ignore things in the output vector that you don't want.
-
- // If you ask for FixCylindricalTexGen, it will fix any absolute change in texture coordinates > 0.5
- // across a single edge. Therefore, if you pass in a single quad or cube, it won't work. Any more
- // complicated or tessellated mesh should work fine.
-
-******************************************************************************/
-
-#include "stdafx.h"
-#pragma hdrstop
-
-#include "NVMeshMender.h"
-#include "nv_math.h"
-
-bool NVMeshMender::Munge(const NVMeshMender::VAVector& input, NVMeshMender::VAVector& output,
- const float bSmoothCreaseAngleRadians, const float* pTextureMatrix, const Option _FixTangents,
- const Option _FixCylindricalTexGen, const Option _WeightNormalsByFaceSize)
-{
- typedef xr_map Mapping;
- typedef xr_set EdgeSet;
- typedef xr_vector> IdenticalVertices;
-
- IdenticalVertices IdenticalVertices_;
-
- // make room for potential tex coords, normals, binormals and tangents
- output.resize(input.size() + 4);
-
- Mapping inmap;
- Mapping outmap;
-
- for (unsigned int a = 0; a < input.size(); ++a)
- {
- inmap[input[a].Name_] = a;
- }
-
- for (unsigned int b = 0; b < output.size(); ++b)
- {
- output[b].intVector_.clear();
- output[b].floatVector_.clear();
- outmap[output[b].Name_] = b;
- }
-
- for (unsigned int c = 0; c < output.size(); ++c)
- {
- // for every output that has a match in the input, just copy it over
- Mapping::iterator in = inmap.find(output[c].Name_);
- if (in != inmap.end())
- {
- // copy over existing indices, position, or whatever
- output[c] = input[(*in).second];
- }
- }
-
- if (inmap.find("indices") == inmap.end())
- {
- SetLastError("Missing indices from input");
- return false;
- }
- if (outmap.find("indices") == outmap.end())
- {
- SetLastError("Missing indices from output");
- return false;
- }
-
- // Go through all required outputs & generate as necessary
- if (inmap.find("position") == inmap.end())
- {
- SetLastError("Missing position from input");
- return false;
- }
- if (outmap.find("position") == outmap.end())
- {
- SetLastError("Missing position from output");
- return false;
- }
-
- Mapping::iterator pos = outmap.find("position");
- VertexAttribute::FloatVector& positions = output[(*pos).second].floatVector_;
- vec3* pPositions = (vec3*)(&(positions[0]));
-
- xr_set EmptySet;
-
- for (unsigned int i = 0; i < positions.size(); i += 3)
- {
- IdenticalVertices_.push_back(EmptySet);
- }
-
- // initialize all attributes
- for (unsigned int att = 0; att < output.size(); ++att)
- {
- if (output[att].Name_ != "indices")
- {
- if (output[att].floatVector_.size() == 0)
- {
- output[att].floatVector_ = positions;
- }
- }
- }
-
- Mapping::iterator ind = outmap.find("indices");
- VertexAttribute::IntVector& indices = output[(*ind).second].intVector_;
- int* pIndices = (int*)(&(indices[0]));
-
- vec3* pNormals = 0;
- // vec3* pBiNormals = 0;
- // vec3* pTangents = 0;
- vec3* pTex0 = 0;
-
- bool bNeedNormals = false;
- bool bNeedTexCoords = false;
- bool bComputeTangentSpace = false;
-
- // see if texture coords are needed
- if (outmap.find("tex0") != outmap.end())
- {
- bNeedTexCoords = true;
- }
-
- // see if tangent or binormal are needed
- if ((outmap.find("binormal") != outmap.end()) || (outmap.find("tangent") != outmap.end()))
- {
- bComputeTangentSpace = true;
- }
-
- // see if normals are needed
- if (outmap.find("normal") != outmap.end())
- {
- bNeedNormals = true;
- }
-
- // Compute normals.
- Mapping::iterator want = outmap.find("normal");
- bool have_normals = (inmap.find("normal") != inmap.end()) ? true : false;
-
- if (bNeedNormals || bComputeTangentSpace)
- {
- // see if normals are provided
- if (!have_normals)
- {
- // create normals
- if (want == outmap.end())
- {
- VertexAttribute norAtt;
- norAtt.Name_ = "normal";
- output.push_back(norAtt);
-
- outmap["normal"] = output.size() - 1;
- want = outmap.find("normal");
- }
-
- // just initialize array so it's the correct size
- output[(*want).second].floatVector_ = positions;
-
- // VertexAttribute::FloatVector& normals = output[ (*want).second ].floatVector_;
-
- // zero out normals
- for (unsigned n = 0; n < positions.size(); ++n)
- {
- output[(*want).second].floatVector_[n] = nv_zero;
- }
-
- pNormals = (vec3*)(&(output[(*want).second].floatVector_[0]));
-
- // calculate face normals for each face
- // & add its normal to vertex normal total
- for (unsigned int t = 0; t < indices.size(); t += 3)
- {
- vec3 edge0;
- vec3 edge1;
-
- edge0 = pPositions[indices[t + 1]] - pPositions[indices[t + 0]];
- edge1 = pPositions[indices[t + 2]] - pPositions[indices[t + 0]];
-
- exact_normalize(&edge0.x);
- exact_normalize(&edge1.x);
-
- vec3 faceNormal = edge0 ^ edge1;
-
- if (_WeightNormalsByFaceSize == DontWeightNormalsByFaceSize)
- {
- // Renormalize face normal, so it's not weighted by face size
- exact_normalize(&faceNormal.x);
- }
- else
- {
- // Leave it as-is, to weight by face size naturally by the cross product result
- }
-
- pNormals[indices[t + 0]] += faceNormal;
- pNormals[indices[t + 1]] += faceNormal;
- pNormals[indices[t + 2]] += faceNormal;
- }
-
- // Renormalize each vertex normal
- for (unsigned int v = 0; v < output[(*want).second].floatVector_.size() / 3; ++v)
- pNormals[v].normalize();
- }
- }
-
- // Compute texture coordinates.
- if (bNeedTexCoords || bComputeTangentSpace)
- {
- if (outmap.find("tex0") == outmap.end())
- {
- VertexAttribute texCoordAtt;
- texCoordAtt.Name_ = "tex0";
- output.push_back(texCoordAtt);
- outmap["tex0"] = output.size() - 1;
- }
- want = outmap.find("tex0");
- Mapping::iterator have = inmap.find("tex0");
- bool have_texcoords = (have != inmap.end());
-
- // see if texcoords are provided
- if (have_texcoords)
- output[(*want).second].floatVector_ = input[(*have).second].floatVector_;
- else
- {
- // just initialize array so it's the correct size
- output[(*want).second].floatVector_ = positions;
-
- pTex0 = (vec3*)(&(output[(*want).second].floatVector_[0]));
-
- // Generate cylindrical coordinates
-
- // Find min and max positions for object bounding box
-
- vec3 maxPosition(-flt_max, -flt_max, -flt_max);
- vec3 minPosition(flt_max, flt_max, flt_max);
-
- // there are 1/3 as many vectors as floats
- const unsigned int theCount = static_cast(positions.size() / 3.0f);
-
- for (unsigned int i = 0; i < theCount; ++i)
- {
- maxPosition.x = nv_max(maxPosition.x, pPositions[i].x);
- maxPosition.y = nv_max(maxPosition.y, pPositions[i].y);
- maxPosition.z = nv_max(maxPosition.z, pPositions[i].z);
-
- minPosition.x = nv_min(minPosition.x, pPositions[i].x);
- minPosition.y = nv_min(minPosition.y, pPositions[i].y);
- minPosition.z = nv_min(minPosition.z, pPositions[i].z);
- }
-
- // Find major, minor and other axis for cylindrical texgen
-
- vec3 delta = maxPosition - minPosition;
-
- delta.x = _abs(delta.x);
- delta.y = _abs(delta.y);
- delta.z = _abs(delta.z);
-
- bool maxx, maxy, maxz;
- maxx = maxy = maxz = false;
- bool minz, miny, minx;
- minx = miny = minz = false;
-
- nv_scalar deltaMajor;
-
- if ((delta.x >= delta.y) && (delta.x >= delta.z))
- {
- maxx = true;
- deltaMajor = delta.x;
- if (delta.y > delta.z)
- {
- minz = true;
- }
- else
- {
- miny = true;
- }
- }
- else if ((delta.z >= delta.y) && (delta.z >= delta.x))
- {
- maxz = true;
- deltaMajor = delta.z;
- if (delta.y > delta.x)
- {
- minx = true;
- }
- else
- {
- miny = true;
- }
- }
- else if ((delta.y >= delta.z) && (delta.y >= delta.x))
- {
- maxy = true;
- deltaMajor = delta.y;
- if (delta.x > delta.z)
- {
- minz = true;
- }
- else
- {
- minx = true;
- }
- }
-
- for (unsigned int p = 0; p < theCount; ++p)
- {
- // Find position relative to center of bounding box
-
- vec3 texCoords = ((maxPosition + minPosition) / 2.0f) - pPositions[p];
-
- nv_scalar Major, Minor, Other = nv_zero;
-
- if (maxx)
- {
- Major = texCoords.x;
- if (miny)
- {
- Minor = texCoords.y;
- Other = texCoords.z;
- }
- else
- {
- Minor = texCoords.z;
- Other = texCoords.y;
- }
- }
- else if (maxy)
- {
- Major = texCoords.y;
- if (minx)
- {
- Minor = texCoords.x;
- Other = texCoords.z;
- }
- else
- {
- Minor = texCoords.z;
- Other = texCoords.x;
- }
- }
- else if (maxz)
- {
- Major = texCoords.z;
- if (miny)
- {
- Minor = texCoords.y;
- Other = texCoords.x;
- }
- else
- {
- Minor = texCoords.x;
- Other = texCoords.y;
- }
- }
-
- nv_scalar longitude = nv_zero;
-
- // Prevent zero or near-zero from being passed into atan2
- if (_abs(Other) < 0.0001f)
- {
- if (Other >= nv_zero)
- {
- Other = 0.0001f;
- }
- else
- {
- Other = -0.0001f;
- }
- }
-
- // perform cylindrical mapping onto object, and remap from -pi,pi to -1,1
-
- longitude = ((atan2(Minor, Other)) / nv_scalar(3.141592654));
-
- texCoords.x = 0.5f * longitude + 0.5f;
- texCoords.y = (Major / deltaMajor) + 0.5f;
-
- texCoords.x = nv_max(texCoords.x, nv_zero);
- texCoords.y = nv_max(texCoords.y, nv_zero);
-
- texCoords.x = nv_min(texCoords.x, 1.0f);
- texCoords.y = nv_min(texCoords.y, 1.0f);
-
- pTex0[p].x = texCoords.x - 0.25f;
- if (pTex0[p].x < nv_zero)
- pTex0[p].x += 1.0;
- pTex0[p].y = 1.0f - texCoords.y;
- pTex0[p].z = 1.0f;
- }
- }
-
- if (_FixCylindricalTexGen == FixCylindricalTexGen)
- {
- Mapping::iterator texIter = outmap.find("tex0");
-
- VertexAttribute::FloatVector& texcoords = (output[(*texIter).second].floatVector_);
-
- const unsigned int theSize = indices.size();
-
- for (unsigned int f = 0; f < theSize; f += 3)
- {
- for (int v = 0; v < 3; ++v)
- {
- int start = f + v;
- int end = start + 1;
-
- if (v == 2)
- {
- end = f;
- }
-
- nv_scalar dS = texcoords[indices[end] * 3 + 0] - texcoords[indices[start] * 3 + 0];
-
- nv_scalar newS = nv_zero;
-
- bool bDoS = false;
-
- unsigned int theOneToChange = start;
-
- if (_abs(dS) >= 0.5f)
- {
- bDoS = true;
- if (texcoords[indices[start] * 3 + 0] < texcoords[indices[end] * 3 + 0])
- {
- newS = texcoords[indices[start] * 3 + 0] + 1.0f;
- }
- else
- {
- theOneToChange = end;
- newS = texcoords[indices[end] * 3 + 0] + 1.0f;
- }
- }
-
- if (bDoS == true)
- {
- unsigned int theNewIndex = texcoords.size() / 3;
- // Duplicate every part of the vertex
- for (unsigned int att = 0; att < output.size(); ++att)
- {
- // No new indices are created, just vertex attributes
- if (output[att].Name_ != "indices")
- {
- if (output[att].Name_ == "tex0")
- {
- output[att].floatVector_.push_back((float)newS); // y
- output[att].floatVector_.push_back(
- output[att].floatVector_[indices[theOneToChange] * 3 + 1]); // x
- output[att].floatVector_.push_back(
- output[att].floatVector_[indices[theOneToChange] * 3 + 2]); // z
- }
- else
- {
- // *3 b/c we are looking up 3vectors in an array of floats
- output[att].floatVector_.push_back(
- output[att].floatVector_[indices[theOneToChange] * 3 + 0]); // x
- output[att].floatVector_.push_back(
- output[att].floatVector_[indices[theOneToChange] * 3 + 1]); // y
- output[att].floatVector_.push_back(
- output[att].floatVector_[indices[theOneToChange] * 3 + 2]); // z
- }
- }
- }
-
- IdenticalVertices_.push_back(EmptySet);
-
- IdenticalVertices_[indices[theOneToChange]].insert(theNewIndex);
- IdenticalVertices_[theNewIndex].insert(indices[theOneToChange]);
-
- // point to where the new vertices will go
- indices[theOneToChange] = theNewIndex;
- }
- } // for v
-
- {
- for (int v = 0; v < 3; ++v)
- {
- int start = f + v;
- int end = start + 1;
-
- if (v == 2)
- {
- end = f;
- }
-
- nv_scalar dT = texcoords[indices[end] * 3 + 1] - texcoords[indices[start] * 3 + 1];
-
- nv_scalar newT = nv_zero;
-
- bool bDoT = false;
-
- unsigned int theOneToChange = start;
-
- if (_abs(dT) >= 0.5f)
- {
- bDoT = true;
- if (texcoords[indices[start] * 3 + 1] < texcoords[indices[end] * 3 + 1])
- {
- newT = texcoords[indices[start] * 3 + 1] + 1.0f;
- }
- else
- {
- theOneToChange = end;
- newT = texcoords[indices[end] * 3 + 1] + 1.0f;
- }
- }
-
- if (bDoT == true)
- {
- unsigned int theNewIndex = texcoords.size() / 3;
- // Duplicate every part of the vertex
- for (unsigned int att = 0; att < output.size(); ++att)
- {
- // No new indices are created, just vertex attributes
- if (output[att].Name_ != "indices")
- {
- if (output[att].Name_ == "tex0")
- {
- output[att].floatVector_.push_back(
- output[att].floatVector_[indices[theOneToChange] * 3 + 0]); // x
- output[att].floatVector_.push_back((float)newT); // y
- output[att].floatVector_.push_back(
- output[att].floatVector_[indices[theOneToChange] * 3 + 2]); // z
- }
- else
- {
- // *3 b/c we are looking up 3vectors in an array of floats
- output[att].floatVector_.push_back(
- output[att].floatVector_[indices[theOneToChange] * 3 + 0]); // x
- output[att].floatVector_.push_back(
- output[att].floatVector_[indices[theOneToChange] * 3 + 1]); // y
- output[att].floatVector_.push_back(
- output[att].floatVector_[indices[theOneToChange] * 3 + 2]); // z
- }
- }
- }
-
- IdenticalVertices_.push_back(EmptySet);
-
- IdenticalVertices_[theNewIndex].insert(indices[theOneToChange]);
- IdenticalVertices_[indices[theOneToChange]].insert(theNewIndex);
-
- // point to where the new vertices will go
- indices[theOneToChange] = theNewIndex;
- }
- }
- } // for v
- } // for f
- } // if fix texgen
- if (pTextureMatrix)
- {
- const mat4 M(pTextureMatrix[0], pTextureMatrix[1], pTextureMatrix[2], pTextureMatrix[3], pTextureMatrix[4],
- pTextureMatrix[5], pTextureMatrix[6], pTextureMatrix[7], pTextureMatrix[8], pTextureMatrix[9],
- pTextureMatrix[10], pTextureMatrix[11], pTextureMatrix[12], pTextureMatrix[13], pTextureMatrix[14],
- pTextureMatrix[15]);
- Mapping::iterator texIter = outmap.find("tex0");
- VertexAttribute::FloatVector& texcoords = output[(*texIter).second].floatVector_;
-
- // now apply matrix
- for (unsigned int v = 0; v < texcoords.size(); v += 3)
- {
- vec3& V = *reinterpret_cast(&texcoords[v]);
- V = V * M;
- }
- }
- }
-
- if (bComputeTangentSpace)
- {
- EdgeSet Edges;
-
- Mapping::iterator texIter = outmap.find("tex0");
-
- vec3* tex = (vec3*)&(output[(*texIter).second].floatVector_[0]);
-
- typedef xr_vector VecVector;
-
- // create tangents
- want = outmap.find("tangent");
- if (want == outmap.end())
- {
- VertexAttribute tanAtt;
- tanAtt.Name_ = "tangent";
- output.push_back(tanAtt);
- outmap["tangent"] = output.size() - 1;
- want = outmap.find("tangent");
- }
- // just initialize array so it's the correct size
- output[(*want).second].floatVector_ = positions;
-
- // create binormals
- want = outmap.find("binormal");
- if (want == outmap.end())
- {
- VertexAttribute binAtt;
- binAtt.Name_ = "binormal";
- output.push_back(binAtt);
- outmap["binormal"] = output.size() - 1;
- want = outmap.find("binormal");
- }
- // just initialize array so it's the correct size
- output[(*want).second].floatVector_ = positions;
-
- // Create a vector of s,t and sxt for each face of the model
- VecVector sVector;
- VecVector tVector;
- VecVector sxtVector;
-
- const unsigned int theSize = indices.size();
- // for each face, calculate its S,T & SxT vector, & store its edges
- for (unsigned int f = 0; f < theSize; f += 3)
- {
- vec3d edge0;
- vec3d edge1;
-
- vec3d s;
- vec3d t;
-
- // grap position & tex coords again in case they were reallocated
- pPositions = (vec3*)(&(positions[0]));
- tex = (vec3*)(&(output[(*texIter).second].floatVector_[0]));
-
- double _eps = type_epsilon(double) * 10;
- double a, b, c;
- vec3d sxt;
-
- // create an edge(s) out of s and t
- edge0.y = tex[indices[f + 1]].x - tex[indices[f]].x;
- edge0.z = tex[indices[f + 1]].y - tex[indices[f]].y;
- edge1.y = tex[indices[f + 2]].x - tex[indices[f]].x;
- edge1.z = tex[indices[f + 2]].y - tex[indices[f]].y;
-
- // create an edge out of x, s and t
- edge0.x = pPositions[indices[f + 1]].x - pPositions[indices[f]].x;
- edge1.x = pPositions[indices[f + 2]].x - pPositions[indices[f]].x;
- sxt = edge0 ^ edge1;
-
- a = sxt.x;
- b = sxt.y;
- c = sxt.z;
- double ds_dx = nv_zero;
- if (_abs(a) > _eps)
- ds_dx = -b / a;
- double dt_dx = nv_zero;
- if (_abs(a) > _eps)
- dt_dx = -c / a;
-
- // create an edge out of y, s and t
- edge0.x = pPositions[indices[f + 1]].y - pPositions[indices[f]].y;
- edge1.x = pPositions[indices[f + 2]].y - pPositions[indices[f]].y;
- sxt = edge0 ^ edge1;
-
- a = sxt.x;
- b = sxt.y;
- c = sxt.z;
- double ds_dy = nv_zero;
- if (_abs(a) > _eps)
- ds_dy = -b / a;
- double dt_dy = nv_zero;
- if (_abs(a) > _eps)
- dt_dy = -c / a;
-
- // create an edge out of z, s and t
- edge0.x = pPositions[indices[f + 1]].z - pPositions[indices[f]].z;
- edge1.x = pPositions[indices[f + 2]].z - pPositions[indices[f]].z;
- sxt = edge0 ^ edge1;
-
- a = sxt.x;
- b = sxt.y;
- c = sxt.z;
- double ds_dz = nv_zero;
- if (_abs(a) > _eps)
- ds_dz = -b / a;
- double dt_dz = nv_zero;
- if (_abs(a) > _eps)
- dt_dz = -c / a;
-
- // generate coordinate frame from the gradients
- s = vec3d(ds_dx, ds_dy, ds_dz);
- t = vec3d(dt_dx, dt_dy, dt_dz);
-
- s.normalize();
- t.normalize();
- sxt = s ^ t;
- sxt.normalize();
-
- // save vectors for this face
- sVector.push_back(vec3(s));
- tVector.push_back(vec3(t));
- sxtVector.push_back(vec3(sxt));
-
- if (_FixTangents == FixTangents)
- {
- // Look for each edge of the triangle in the edge map, in order to find
- // a neighboring face along the edge
-
- for (int e = 0; e < 3; ++e)
- {
- Edge edge;
-
- int start = f + e;
- int end = start + 1;
-
- if (e == 2)
- {
- end = f;
- }
- // order vertex indices ( low, high )
- edge.v0 = (unsigned int)nv_min((nv_scalar)indices[start], (nv_scalar)indices[end]);
- edge.v1 = (unsigned int)nv_max((nv_scalar)indices[start], (nv_scalar)indices[end]);
-
- EdgeSet::iterator iter = Edges.find(edge);
-
- // if we are the only triangle with this edge...
- if (iter == Edges.end())
- {
- // ...then add us to the set of edges
- edge.face = f / 3;
- Edges.insert(edge);
- }
- else
- {
- // otherwise, check our neighbor's s,t & sxt vectors vs our own
- const nv_scalar sAgreement = dot(s, sVector[(*iter).face]);
- const nv_scalar tAgreement = dot(t, tVector[(*iter).face]);
- const nv_scalar sxtAgreement = dot(sxt, sxtVector[(*iter).face]);
-
- // Check Radian angle split limit
- const nv_scalar epsilon = _cos(bSmoothCreaseAngleRadians);
-
- // if the discontinuity in s, t, or sxt is greater than some epsilon,
- // duplicate the vertex so it won't smooth with its neighbor anymore
-
- if ((_abs(sAgreement) < epsilon) || (_abs(tAgreement) < epsilon) ||
- (_abs(sxtAgreement) < epsilon))
- {
- // Duplicate two vertices of this edge for this triangle only.
- // This way the faces won't smooth with each other, thus
- // preventing the tangent basis from becoming degenerate
-
- // divide by 3 b/c vector is of floats and not vectors
- const unsigned int theNewIndex = positions.size() / 3;
-
- // Duplicate every part of the vertex
- for (unsigned int att = 0; att < output.size(); ++att)
- {
- // No new indices are created, just vertex attributes
- if (output[att].Name_ != "indices")
- {
- // *3 b/c we are looking up 3vectors in an array of floats
- output[att].floatVector_.push_back(
- output[att].floatVector_[indices[start] * 3 + 0]); // x
- output[att].floatVector_.push_back(
- output[att].floatVector_[indices[start] * 3 + 1]); // y
- output[att].floatVector_.push_back(
- output[att].floatVector_[indices[start] * 3 + 2]); // z
-
- output[att].floatVector_.push_back(
- output[att].floatVector_[indices[end] * 3 + 0]); // x
- output[att].floatVector_.push_back(
- output[att].floatVector_[indices[end] * 3 + 1]); // y
- output[att].floatVector_.push_back(
- output[att].floatVector_[indices[end] * 3 + 2]); // z
- }
- }
-
- IdenticalVertices_.push_back(EmptySet);
- IdenticalVertices_.push_back(EmptySet);
-
- // point to where the new vertices will go
- indices[start] = theNewIndex;
- indices[end] = theNewIndex + 1;
- }
-
- // Now that the vertices are duplicated, smoothing won't occur over this edge,
- // because the two faces will sum their tangent basis vectors into separate indices
- }
- }
- } // if fixtangents
- }
-
- // Allocate std::vector & Zero out average basis for tangent space smoothing
- VecVector avgS;
- VecVector avgT;
-
- for (unsigned int p = 0; p < positions.size(); p += 3)
- {
- avgS.push_back(vec3_null); // do S
- avgT.push_back(vec3_null); // now t
- }
-
- // go through faces and add up the bases for each vertex
- const int theFaceCount = indices.size() / 3;
-
- for (unsigned int face = 0; face < (unsigned int)theFaceCount; ++face)
- {
- // sum bases, so we smooth the tangent space across edges
- avgS[pIndices[face * 3]] += sVector[face];
- avgT[pIndices[face * 3]] += tVector[face];
-
- avgS[pIndices[face * 3 + 1]] += sVector[face];
- avgT[pIndices[face * 3 + 1]] += tVector[face];
-
- avgS[pIndices[face * 3 + 2]] += sVector[face];
- avgT[pIndices[face * 3 + 2]] += tVector[face];
- }
-
- if (_FixCylindricalTexGen == FixCylindricalTexGen)
- {
- for (unsigned int v = 0; v < IdenticalVertices_.size(); ++v)
- {
- // go through each vertex & sum up it's true neighbors
- for (xr_set::iterator iter = IdenticalVertices_[v].begin();
- iter != IdenticalVertices_[v].end(); ++iter)
- {
- avgS[v] += avgS[*iter];
- avgT[v] += avgT[*iter];
- }
- }
- }
-
- Mapping::iterator tangent = outmap.find("tangent");
- Mapping::iterator binormal = outmap.find("binormal");
-
- // now renormalize
- for (unsigned int b = 0; b < positions.size(); b += 3)
- {
- *reinterpret_cast(&output[(*tangent).second].floatVector_[b]) = normalize(avgS[b / 3]); // s
- *reinterpret_cast(&output[(*binormal).second].floatVector_[b]) = normalize(avgT[b / 3]); // T
- }
- }
-
- // At this point, tex coords, normals, binormals and tangents should be generated if necessary,
- // and other attributes are simply copied as available
-
- return true;
-}
diff --git a/src/editors/ECore/Engine/NVMeshMender.h b/src/editors/ECore/Engine/NVMeshMender.h
deleted file mode 100644
index 9103c539742..00000000000
--- a/src/editors/ECore/Engine/NVMeshMender.h
+++ /dev/null
@@ -1,222 +0,0 @@
-#ifndef NVMeshMenderH
-#define NVMeshMenderH
-
-/*********************************************************************NVMH2****
-Copyright (C) 1999, 2000, 2001, 2002 NVIDIA Corporation
-This file is provided without support, instruction, or implied warranty of any
-kind. NVIDIA makes no guarantee of its fitness for a particular purpose and is
-not liable under any circumstances for any damages or loss whatsoever arising
-from the use or inability to use this file or items derived from it.
-
-Questions to sim.dietrich@nvidia.com
-
-Comments:
-
- This tool is designed to help condition meshes for use in vertex & pixel shaders.
-
- It can generate normals, texture coordinates, and perhaps most importantly, texture space
- basis matrices. It also can fix common texuring problems that come up when bump mapping, including
-
- Texture Mirroring - When two one halves of a character use the same part of a texture.
-
- Cylindrical TexGen - When the rendering relies on cylindrical wrapping, texture space computation
- won't work right.
-
- Stretched Basis - When two adjacend faces use wildly different texture mappings, causing stretching
- that can ruin per-pixel lighting.
-
-
- Here is an example usage scenario :
-
- Say you have positions & indices & normals, and want textures, and tangents, and binormals.
- and assume that positions, indices, and normals are in STL arrays: vpos, triIndices and vnor respectively.
-
- xr_vector vpos;
- xr_vector triIndices;
- xr_vector vnor;
- ...
-
- NVMeshMender aMender;
-
-
- xr_vector inputAtts; // What you have
- xr_vector outputAtts; // What you want.
-
- NVMeshMender::VertexAttribute posAtt;
- posAtt.Name_ = "position";
- posAtt.floatVector_ = vpos;
-
- NVMeshMender::VertexAttribute triIndAtt;
- triIndAtt.Name_ = "indices";
- triIndAtt.intVector_ = triIndices;
-
- NVMeshMender::VertexAttribute norAtt;
- norAtt.Name_ = "normal";
- norAtt.floatVector_ = vnor;
-
- xr_vector texCoords;
- NVMeshMender::VertexAttribute texCoordAtt;
- texCoordAtt.Name_ = "tex0";
- texCoordAtt.floatVector_;// = texCoords;
-
- NVMeshMender::VertexAttribute tgtSpaceAtt;
- tgtSpaceAtt.Name_ = "tangent";
-
- NVMeshMender::VertexAttribute binormalAtt;
- binormalAtt.Name_ = "binormal";
-
- inputAtts.push_back(posAtt);
- inputAtts.push_back(triIndAtt);
- inputAtts.push_back(norAtt);
-
- outputAtts.push_back(posAtt);
- outputAtts.push_back(triIndAtt);
- outputAtts.push_back(norAtt);
- outputAtts.push_back(texCoordAtt);
- outputAtts.push_back(tgtSpaceAtt);
- outputAtts.push_back(binormalAtt);
-
- // All inputs except for indices are assumed to be sets of 3 floats
-
- // "indices" are assumed to be unsigned ints
-
- // "tex0" is used for the tangent space calculation
-
- // "tex0" is the only coordinate set generated, and the texture matrix applies only to it
-
- // All unknown attribute types, including "tex1", "tex2", "random_attribute", "weights", "bones", etc.
- // are simply passed through. They will be duplicated as needed just like positions, normals, etc.
-
- bool bSuccess = aMender.Munge( inputAtts, // these are my positions & indices
- outputAtts, // these are the outputs I requested, plus extra stuff
-generated on my behalf
- 3.141592654f / 2.5f, // tangent space smooth angle
- NULL, // no Texture matrix applied to my tex0 coords
- FixTangents, // fix degenerate bases & texture mirroring
- FixCylindricalTexGen // handle cylidrically mapped textures via vertex duplication
- WeightNormalsByFaceSize // weight vertex normals by the triangle's size
- );
-
-
- if ( !bSuccess ) return false;
-
- vpos = outputAtts[0].floatVector_; // Note that there may be more vertices than you sent in.
- vnor = outputAtts[2].floatVector_;
- xr_vector texCoords = outputAtts[3].floatVector_; // texcoords
- xr_vector vtgt = outputAtts[4].floatVector_; // tgts
- triIndices = outputAtts[1].intVector_; // new indices.
- xr_vector vbin = outputAtts[5].floatVector_; // binormals.
-
- // Now the outputAtts may contain more vertex then you sent in !
- // This is because in handling tangent space smoothing, and solving texture mirroring &
- // cylindrical texture wrapping problems, we partially duplicate vertices.
-
- // All attributes are duplicated, even unknowns.
-
- // You may also get things you didn't ask for. For instance, if you ask for tangent space,
- // in other words, you ask for "tangent" or "binormal", you will get "normal", "tex0",
- // "tangent" and "binormal". You can then ignore things in the output vector that you don't want.
-
- // If you ask for FixCylindricalTexGen, it will fix any absolute change in texture coordinates > 0.5
- // across a single edge. Therefore, if you pass in a single quad or cube, it won't work. Any more
- // complicated or tessellated mesh should work fine.
-
-
-******************************************************************************/
-#pragma warning(push)
-#pragma warning(disable : 4995)
-#include
-#pragma warning(pop)
-
-class NVMeshMender
-{
-private:
- mutable xr_vector LastErrors_;
-
- struct Edge
- {
- unsigned int v0;
- unsigned int v1;
-
- unsigned int face;
- unsigned int face2;
-
- bool operator==(const Edge& rhs) const { return ((v0 == rhs.v0) && (v1 == rhs.v1)); }
- bool operator<(const Edge& rhs) const
- {
- if (v0 < rhs.v0)
- {
- return true;
- }
-
- if (v0 > rhs.v0)
- {
- return false;
- }
-
- return (v1 < rhs.v1);
- }
- };
-
-public:
- void SetLastError(const xr_string& rhs) const { LastErrors_.push_back(rhs); }
- xr_string GetLastError() const
- {
- xr_string aString;
-
- if (LastErrors_.size() > 0)
- {
- aString = LastErrors_.back();
- }
- return aString;
- }
-
- struct VertexAttribute
- {
- xr_string Name_;
-
- typedef xr_vector IntVector;
- IntVector intVector_;
-
- typedef xr_vector FloatVector;
- FloatVector floatVector_;
-
- VertexAttribute& operator=(const VertexAttribute& rhs)
- {
- Name_ = rhs.Name_;
- intVector_ = rhs.intVector_;
- floatVector_ = rhs.floatVector_;
- return *this;
- }
-
- VertexAttribute(const char* pName = "") : Name_(pName) { ; }
- VertexAttribute(const VertexAttribute& rhs) { *this = rhs; }
- bool operator==(const VertexAttribute& rhs) { return (Name_ == rhs.Name_); }
- bool operator<(const VertexAttribute& rhs) { return (Name_ < rhs.Name_); }
- };
-
- typedef xr_vector VAVector;
-
- enum Option
- {
- FixTangents,
- DontFixTangents,
-
- FixCylindricalTexGen,
- DontFixCylindricalTexGen,
-
- WeightNormalsByFaceSize,
- DontWeightNormalsByFaceSize
- };
-
- bool Munge(const NVMeshMender::VAVector& input, NVMeshMender::VAVector& output,
- const float bSmoothCreaseAngleRadians = 3.141592654f / 3.0f, const float* pTextureMatrix = 0,
- const Option _FixTangents = FixTangents, const Option _FixCylindricalTexGen = FixCylindricalTexGen,
- const Option _WeightNormalsByFaceSize = WeightNormalsByFaceSize);
- bool MungeD3DX(const NVMeshMender::VAVector& input, NVMeshMender::VAVector& output,
- const float bSmoothCreaseAngleRadians = 3.141592654f / 3.0f, const float* pTextureMatrix = 0,
- const Option _FixTangents = FixTangents, const Option _FixCylindricalTexGen = FixCylindricalTexGen,
- const Option _WeightNormalsByFaceSize = WeightNormalsByFaceSize);
-};
-
-#endif //_NVMeshMender_H_
diff --git a/src/editors/ECore/Engine/ai_sounds.cpp b/src/editors/ECore/Engine/ai_sounds.cpp
index bb57e52c337..507b5c30264 100644
--- a/src/editors/ECore/Engine/ai_sounds.cpp
+++ b/src/editors/ECore/Engine/ai_sounds.cpp
@@ -3,14 +3,28 @@
#include "ai_sounds.h"
-xr_token anomaly_type_token[] = {{"undefined", sg_Undefined}, {"Item picking up", SOUND_TYPE_ITEM_PICKING_UP},
- {"Item dropping", SOUND_TYPE_ITEM_DROPPING}, {"Item taking", SOUND_TYPE_ITEM_TAKING},
- {"Item hiding", SOUND_TYPE_ITEM_HIDING}, {"Item using", SOUND_TYPE_ITEM_USING},
- {"Weapon shooting", SOUND_TYPE_WEAPON_SHOOTING}, {"Weapon empty clicking", SOUND_TYPE_WEAPON_EMPTY_CLICKING},
- {"Weapon bullet hit", SOUND_TYPE_WEAPON_BULLET_HIT}, {"Weapon recharging", SOUND_TYPE_WEAPON_RECHARGING},
- {"NPC dying", SOUND_TYPE_MONSTER_DYING}, {"NPC injuring", SOUND_TYPE_MONSTER_INJURING},
- {"NPC step", SOUND_TYPE_MONSTER_STEP}, {"NPC talking", SOUND_TYPE_MONSTER_TALKING},
- {"NPC attacking", SOUND_TYPE_MONSTER_ATTACKING}, {"NPC eating", SOUND_TYPE_MONSTER_EATING},
- {"Anomaly idle", SOUND_TYPE_ANOMALY_IDLE}, {"Object breaking", SOUND_TYPE_WORLD_OBJECT_BREAKING},
- {"Object colliding", SOUND_TYPE_WORLD_OBJECT_COLLIDING}, {"Object exploding", SOUND_TYPE_WORLD_OBJECT_EXPLODING},
- {"World ambient", SOUND_TYPE_WORLD_AMBIENT}, {0, 0}};
+xr_token anomaly_type_token[] =
+{
+ {"undefined", sg_Undefined},
+ {"Item picking up", SOUND_TYPE_ITEM_PICKING_UP},
+ {"Item dropping", SOUND_TYPE_ITEM_DROPPING},
+ {"Item taking", SOUND_TYPE_ITEM_TAKING},
+ {"Item hiding", SOUND_TYPE_ITEM_HIDING},
+ {"Item using", SOUND_TYPE_ITEM_USING},
+ {"Weapon shooting", SOUND_TYPE_WEAPON_SHOOTING},
+ {"Weapon empty clicking", SOUND_TYPE_WEAPON_EMPTY_CLICKING},
+ {"Weapon bullet hit", SOUND_TYPE_WEAPON_BULLET_HIT},
+ {"Weapon recharging", SOUND_TYPE_WEAPON_RECHARGING},
+ {"NPC dying", SOUND_TYPE_MONSTER_DYING},
+ {"NPC injuring", SOUND_TYPE_MONSTER_INJURING},
+ {"NPC step", SOUND_TYPE_MONSTER_STEP},
+ {"NPC talking", SOUND_TYPE_MONSTER_TALKING},
+ {"NPC attacking", SOUND_TYPE_MONSTER_ATTACKING},
+ {"NPC eating", SOUND_TYPE_MONSTER_EATING},
+ {"Anomaly idle", SOUND_TYPE_ANOMALY_IDLE},
+ {"Object breaking", SOUND_TYPE_WORLD_OBJECT_BREAKING},
+ {"Object colliding", SOUND_TYPE_WORLD_OBJECT_COLLIDING},
+ {"Object exploding", SOUND_TYPE_WORLD_OBJECT_EXPLODING},
+ {"World ambient", SOUND_TYPE_WORLD_AMBIENT},
+ {}
+};
diff --git a/src/editors/ECore/Engine/bone.cpp b/src/editors/ECore/Engine/bone.cpp
deleted file mode 100644
index 8b137891791..00000000000
--- a/src/editors/ECore/Engine/bone.cpp
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/src/editors/ECore/Engine/cl_collector.cpp b/src/editors/ECore/Engine/cl_collector.cpp
deleted file mode 100644
index 69966916e73..00000000000
--- a/src/editors/ECore/Engine/cl_collector.cpp
+++ /dev/null
@@ -1,12 +0,0 @@
-// cl_collector.cpp: implementation of the Collector class.
-//
-//////////////////////////////////////////////////////////////////////
-
-#include "stdafx.h"
-#pragma hdrstop
-
-#include "cl_collector.h"
-
-//////////////////////////////////////////////////////////////////////
-// Construction/Destruction
-//////////////////////////////////////////////////////////////////////
diff --git a/src/editors/ECore/Engine/cl_collector.h b/src/editors/ECore/Engine/cl_collector.h
deleted file mode 100644
index 85b72fbac85..00000000000
--- a/src/editors/ECore/Engine/cl_collector.h
+++ /dev/null
@@ -1,9 +0,0 @@
-// cl_collector.h: interface for the Collector class.
-//
-//////////////////////////////////////////////////////////////////////
-
-#if !defined(AFX_CL_COLLECTOR_H__F107ABA0_E877_4C5A_8EFF_DAB3A86ABDB6__INCLUDED_)
-#define AFX_CL_COLLECTOR_H__F107ABA0_E877_4C5A_8EFF_DAB3A86ABDB6__INCLUDED_
-#pragma once
-
-#endif // !defined(AFX_CL_COLLECTOR_H__F107ABA0_E877_4C5A_8EFF_DAB3A86ABDB6__INCLUDED_)
diff --git a/src/editors/ECore/Engine/cl_intersect.h b/src/editors/ECore/Engine/cl_intersect.h
deleted file mode 100644
index 8b137891791..00000000000
--- a/src/editors/ECore/Engine/cl_intersect.h
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/src/editors/ECore/Engine/guid_generator.cpp b/src/editors/ECore/Engine/guid_generator.cpp
index 9449c392e80..ab8ff361165 100644
--- a/src/editors/ECore/Engine/guid_generator.cpp
+++ b/src/editors/ECore/Engine/guid_generator.cpp
@@ -20,10 +20,10 @@ xrGUID generate_guid()
{
xrGUID result;
#ifdef WINVER
- STATIC_CHECK(sizeof(xrGUID) == sizeof(GUID), Different_GUID_types);
+ static_assert(sizeof(xrGUID) == sizeof(GUID), "Different GUID types");
GUID _result;
RPC_STATUS gen_result = UuidCreate(&_result);
- Memory.mem_copy(&result, &_result, sizeof(_result));
+ CopyMemory(&result, &_result, sizeof(_result));
switch (gen_result)
{
case RPC_S_OK: return (result);
@@ -32,9 +32,9 @@ xrGUID generate_guid()
default: break;
}
#endif
- STATIC_CHECK(sizeof(result) >= sizeof(u64), GUID_must_have_size_greater_or_equal_to_the_long_long);
+ static_assert(sizeof(result) >= sizeof(u64), "GUID must have size greater or equal to the long long");
ZeroMemory(&result, sizeof(result));
u64 temp = CPU::GetCLK();
- Memory.mem_copy(&result, &temp, sizeof(temp));
+ CopyMemory(&result, &temp, sizeof(temp));
return (result);
}
diff --git a/src/editors/ECore/Engine/nv_algebra.cpp b/src/editors/ECore/Engine/nv_algebra.cpp
deleted file mode 100644
index 7ab48bed571..00000000000
--- a/src/editors/ECore/Engine/nv_algebra.cpp
+++ /dev/null
@@ -1,1420 +0,0 @@
-/*********************************************************************NVMH1****
-File:
-nv_algebra.cpp
-
-Copyright (C) 1999, 2000 NVIDIA Corporation
-This file is provided without support, instruction, or implied warranty of any
-kind. NVIDIA makes no guarantee of its fitness for a particular purpose and is
-not liable under any circumstances for any damages or loss whatsoever arising
-from the use or inability to use this file or items derived from it.
-
-Comments:
-
-
-******************************************************************************/
-#include "stdafx.h"
-#pragma hdrstop
-
-#ifndef nv_algebraH
-#include "nv_math.h"
-#endif
-
-#ifndef _WIN32
-#define _isnan isnan
-#define _finite finite
-#endif
-
-mat3::mat3() {}
-mat3::mat3(const nv_scalar* array) { Memory.mem_copy(mat_array, array, sizeof(nv_scalar) * 9); }
-mat3::mat3(const mat3& M) { Memory.mem_copy(mat_array, M.mat_array, sizeof(nv_scalar) * 9); }
-mat4::mat4() {}
-mat4::mat4(const nv_scalar* array) { Memory.mem_copy(mat_array, array, sizeof(nv_scalar) * 16); }
-mat4::mat4(const mat4& M) { Memory.mem_copy(mat_array, M.mat_array, sizeof(nv_scalar) * 16); }
-vec3& cross(vec3& u, const vec3& v, const vec3& w)
-{
- u.x = v.y * w.z - v.z * w.y;
- u.y = v.z * w.x - v.x * w.z;
- u.z = v.x * w.y - v.y * w.x;
- return u;
-}
-
-nv_scalar& dot(nv_scalar& u, const vec3& v, const vec3& w)
-{
- u = v.x * w.x + v.y * w.y + v.z * w.z;
- return u;
-}
-
-nv_scalar dot(const vec3& v, const vec3& w) { return v.x * w.x + v.y * w.y + v.z * w.z; }
-nv_scalar& dot(nv_scalar& u, const vec4& v, const vec4& w)
-{
- u = v.x * w.x + v.y * w.y + v.z * w.z + v.w * w.w;
- return u;
-}
-
-nv_scalar dot(const vec4& v, const vec4& w) { return v.x * w.x + v.y * w.y + v.z * w.z + v.w * w.w; }
-nv_scalar& dot(nv_scalar& u, const vec3& v, const vec4& w)
-{
- u = v.x * w.x + v.y * w.y + v.z * w.z;
- return u;
-}
-
-nv_scalar dot(const vec3& v, const vec4& w) { return v.x * w.x + v.y * w.y + v.z * w.z; }
-nv_scalar& dot(nv_scalar& u, const vec4& v, const vec3& w)
-{
- u = v.x * w.x + v.y * w.y + v.z * w.z;
- return u;
-}
-
-nv_scalar dot(const vec4& v, const vec3& w) { return v.x * w.x + v.y * w.y + v.z * w.z; }
-vec3& reflect(vec3& r, const vec3& n, const vec3& l)
-{
- nv_scalar n_dot_l;
- n_dot_l = nv_two * dot(n_dot_l, n, l);
- mult(r, l, -nv_one);
- madd(r, n, n_dot_l);
- return r;
-}
-
-vec3& madd(vec3& u, const vec3& v, const nv_scalar& lambda)
-{
- u.x += v.x * lambda;
- u.y += v.y * lambda;
- u.z += v.z * lambda;
- return u;
-}
-
-vec3& mult(vec3& u, const vec3& v, const nv_scalar& lambda)
-{
- u.x = v.x * lambda;
- u.y = v.y * lambda;
- u.z = v.z * lambda;
- return u;
-}
-
-vec3& mult(vec3& u, const vec3& v, const vec3& w)
-{
- u.x = v.x * w.x;
- u.y = v.y * w.y;
- u.z = v.z * w.z;
- return u;
-}
-
-vec3& sub(vec3& u, const vec3& v, const vec3& w)
-{
- u.x = v.x - w.x;
- u.y = v.y - w.y;
- u.z = v.z - w.z;
- return u;
-}
-
-vec3& add(vec3& u, const vec3& v, const vec3& w)
-{
- u.x = v.x + w.x;
- u.y = v.y + w.y;
- u.z = v.z + w.z;
- return u;
-}
-
-vec3& scale(vec3& u, const nv_scalar s)
-{
- u.x *= s;
- u.y *= s;
- u.z *= s;
- return u;
-}
-
-vec4& scale(vec4& u, const nv_scalar s)
-{
- u.x *= s;
- u.y *= s;
- u.z *= s;
- u.w *= s;
- return u;
-}
-
-vec3& mult(vec3& u, const mat3& M, const vec3& v)
-{
- u.x = M.a00 * v.x + M.a01 * v.y + M.a02 * v.z;
- u.y = M.a10 * v.x + M.a11 * v.y + M.a12 * v.z;
- u.z = M.a20 * v.x + M.a21 * v.y + M.a22 * v.z;
- return u;
-}
-
-vec3& mult(vec3& u, const vec3& v, const mat3& M)
-{
- u.x = M.a00 * v.x + M.a10 * v.y + M.a20 * v.z;
- u.y = M.a01 * v.x + M.a11 * v.y + M.a21 * v.z;
- u.z = M.a02 * v.x + M.a12 * v.y + M.a22 * v.z;
- return u;
-}
-
-const vec3 operator*(const mat3& M, const vec3& v)
-{
- vec3 u;
- u.x = M.a00 * v.x + M.a01 * v.y + M.a02 * v.z;
- u.y = M.a10 * v.x + M.a11 * v.y + M.a12 * v.z;
- u.z = M.a20 * v.x + M.a21 * v.y + M.a22 * v.z;
- return u;
-}
-
-const vec3 operator*(const vec3& v, const mat3& M)
-{
- vec3 u;
- u.x = M.a00 * v.x + M.a10 * v.y + M.a20 * v.z;
- u.y = M.a01 * v.x + M.a11 * v.y + M.a21 * v.z;
- u.z = M.a02 * v.x + M.a12 * v.y + M.a22 * v.z;
- return u;
-}
-
-vec4& mult(vec4& u, const mat4& M, const vec4& v)
-{
- u.x = M.a00 * v.x + M.a01 * v.y + M.a02 * v.z + M.a03 * v.w;
- u.y = M.a10 * v.x + M.a11 * v.y + M.a12 * v.z + M.a13 * v.w;
- u.z = M.a20 * v.x + M.a21 * v.y + M.a22 * v.z + M.a23 * v.w;
- u.w = M.a30 * v.x + M.a31 * v.y + M.a32 * v.z + M.a33 * v.w;
- return u;
-}
-
-vec4& mult(vec4& u, const vec4& v, const mat4& M)
-{
- u.x = M.a00 * v.x + M.a10 * v.y + M.a20 * v.z + M.a30 * v.w;
- u.y = M.a01 * v.x + M.a11 * v.y + M.a21 * v.z + M.a31 * v.w;
- u.z = M.a02 * v.x + M.a12 * v.y + M.a22 * v.z + M.a32 * v.w;
- u.w = M.a03 * v.x + M.a13 * v.y + M.a23 * v.z + M.a33 * v.w;
- return u;
-}
-
-const vec4 operator*(const mat4& M, const vec4& v)
-{
- vec4 u;
- u.x = M.a00 * v.x + M.a01 * v.y + M.a02 * v.z + M.a03 * v.w;
- u.y = M.a10 * v.x + M.a11 * v.y + M.a12 * v.z + M.a13 * v.w;
- u.z = M.a20 * v.x + M.a21 * v.y + M.a22 * v.z + M.a23 * v.w;
- u.w = M.a30 * v.x + M.a31 * v.y + M.a32 * v.z + M.a33 * v.w;
- return u;
-}
-
-const vec4 operator*(const vec4& v, const mat4& M)
-{
- vec4 u;
- u.x = M.a00 * v.x + M.a10 * v.y + M.a20 * v.z + M.a30 * v.w;
- u.y = M.a01 * v.x + M.a11 * v.y + M.a21 * v.z + M.a31 * v.w;
- u.z = M.a02 * v.x + M.a12 * v.y + M.a22 * v.z + M.a32 * v.w;
- u.w = M.a03 * v.x + M.a13 * v.y + M.a23 * v.z + M.a33 * v.w;
- return u;
-}
-
-vec3& mult_pos(vec3& u, const mat4& M, const vec3& v)
-{
- nv_scalar oow = nv_one / (v.x * M.a30 + v.y * M.a31 + v.z * M.a32 + M.a33);
- u.x = (M.a00 * v.x + M.a01 * v.y + M.a02 * v.z + M.a03) * oow;
- u.y = (M.a10 * v.x + M.a11 * v.y + M.a12 * v.z + M.a13) * oow;
- u.z = (M.a20 * v.x + M.a21 * v.y + M.a22 * v.z + M.a23) * oow;
- return u;
-}
-
-vec3& mult_pos(vec3& u, const vec3& v, const mat4& M)
-{
- nv_scalar oow = nv_one / (v.x * M.a03 + v.y * M.a13 + v.z * M.a23 + M.a33);
- u.x = (M.a00 * v.x + M.a10 * v.y + M.a20 * v.z + M.a30) * oow;
- u.y = (M.a01 * v.x + M.a11 * v.y + M.a21 * v.z + M.a31) * oow;
- u.z = (M.a02 * v.x + M.a12 * v.y + M.a22 * v.z + M.a32) * oow;
- return u;
-}
-
-vec3& mult_dir(vec3& u, const mat4& M, const vec3& v)
-{
- u.x = M.a00 * v.x + M.a01 * v.y + M.a02 * v.z;
- u.y = M.a10 * v.x + M.a11 * v.y + M.a12 * v.z;
- u.z = M.a20 * v.x + M.a21 * v.y + M.a22 * v.z;
- return u;
-}
-
-vec3& mult_dir(vec3& u, const vec3& v, const mat4& M)
-{
- u.x = M.a00 * v.x + M.a10 * v.y + M.a20 * v.z;
- u.y = M.a01 * v.x + M.a11 * v.y + M.a21 * v.z;
- u.z = M.a02 * v.x + M.a12 * v.y + M.a22 * v.z;
- return u;
-}
-
-vec3& mult(vec3& u, const mat4& M, const vec3& v)
-{
- u.x = M.a00 * v.x + M.a01 * v.y + M.a02 * v.z + M.a03;
- u.y = M.a10 * v.x + M.a11 * v.y + M.a12 * v.z + M.a13;
- u.z = M.a20 * v.x + M.a21 * v.y + M.a22 * v.z + M.a23;
- return u;
-}
-
-vec3& mult(vec3& u, const vec3& v, const mat4& M)
-{
- u.x = M.a00 * v.x + M.a10 * v.y + M.a20 * v.z + M.a30;
- u.y = M.a01 * v.x + M.a11 * v.y + M.a21 * v.z + M.a31;
- u.z = M.a02 * v.x + M.a12 * v.y + M.a22 * v.z + M.a32;
- return u;
-}
-
-mat4& add(mat4& A, const mat4& B)
-{
- A.a00 += B.a00;
- A.a10 += B.a10;
- A.a20 += B.a20;
- A.a30 += B.a30;
- A.a01 += B.a01;
- A.a11 += B.a11;
- A.a21 += B.a21;
- A.a31 += B.a31;
- A.a02 += B.a02;
- A.a12 += B.a12;
- A.a22 += B.a22;
- A.a32 += B.a32;
- A.a03 += B.a03;
- A.a13 += B.a13;
- A.a23 += B.a23;
- A.a33 += B.a33;
- return A;
-}
-
-mat3& add(mat3& A, const mat3& B)
-{
- A.a00 += B.a00;
- A.a10 += B.a10;
- A.a20 += B.a20;
- A.a01 += B.a01;
- A.a11 += B.a11;
- A.a21 += B.a21;
- A.a02 += B.a02;
- A.a12 += B.a12;
- A.a22 += B.a22;
- return A;
-}
-
-// C = A * B
-
-// C.a00 C.a01 C.a02 C.a03 A.a00 A.a01 A.a02 A.a03 B.a00 B.a01 B.a02 B.a03
-//
-// C.a10 C.a11 C.a12 C.a13 A.a10 A.a11 A.a12 A.a13 B.a10 B.a11 B.a12 B.a13
-//
-// C.a20 C.a21 C.a22 C.a23 A.a20 A.a21 A.a22 A.a23 B.a20 B.a21 B.a22 B.a23
-//
-// C.a30 C.a31 C.a32 C.a33 = A.a30 A.a31 A.a32 A.a33 * B.a30 B.a31 B.a32 B.a33
-
-mat4& mult(mat4& C, const mat4& A, const mat4& B)
-{
- C.a00 = A.a00 * B.a00 + A.a01 * B.a10 + A.a02 * B.a20 + A.a03 * B.a30;
- C.a10 = A.a10 * B.a00 + A.a11 * B.a10 + A.a12 * B.a20 + A.a13 * B.a30;
- C.a20 = A.a20 * B.a00 + A.a21 * B.a10 + A.a22 * B.a20 + A.a23 * B.a30;
- C.a30 = A.a30 * B.a00 + A.a31 * B.a10 + A.a32 * B.a20 + A.a33 * B.a30;
- C.a01 = A.a00 * B.a01 + A.a01 * B.a11 + A.a02 * B.a21 + A.a03 * B.a31;
- C.a11 = A.a10 * B.a01 + A.a11 * B.a11 + A.a12 * B.a21 + A.a13 * B.a31;
- C.a21 = A.a20 * B.a01 + A.a21 * B.a11 + A.a22 * B.a21 + A.a23 * B.a31;
- C.a31 = A.a30 * B.a01 + A.a31 * B.a11 + A.a32 * B.a21 + A.a33 * B.a31;
- C.a02 = A.a00 * B.a02 + A.a01 * B.a12 + A.a02 * B.a22 + A.a03 * B.a32;
- C.a12 = A.a10 * B.a02 + A.a11 * B.a12 + A.a12 * B.a22 + A.a13 * B.a32;
- C.a22 = A.a20 * B.a02 + A.a21 * B.a12 + A.a22 * B.a22 + A.a23 * B.a32;
- C.a32 = A.a30 * B.a02 + A.a31 * B.a12 + A.a32 * B.a22 + A.a33 * B.a32;
- C.a03 = A.a00 * B.a03 + A.a01 * B.a13 + A.a02 * B.a23 + A.a03 * B.a33;
- C.a13 = A.a10 * B.a03 + A.a11 * B.a13 + A.a12 * B.a23 + A.a13 * B.a33;
- C.a23 = A.a20 * B.a03 + A.a21 * B.a13 + A.a22 * B.a23 + A.a23 * B.a33;
- C.a33 = A.a30 * B.a03 + A.a31 * B.a13 + A.a32 * B.a23 + A.a33 * B.a33;
- return C;
-}
-
-mat4 mat4::operator*(const mat4& B) const
-{
- mat4 C;
- C.a00 = a00 * B.a00 + a01 * B.a10 + a02 * B.a20 + a03 * B.a30;
- C.a10 = a10 * B.a00 + a11 * B.a10 + a12 * B.a20 + a13 * B.a30;
- C.a20 = a20 * B.a00 + a21 * B.a10 + a22 * B.a20 + a23 * B.a30;
- C.a30 = a30 * B.a00 + a31 * B.a10 + a32 * B.a20 + a33 * B.a30;
- C.a01 = a00 * B.a01 + a01 * B.a11 + a02 * B.a21 + a03 * B.a31;
- C.a11 = a10 * B.a01 + a11 * B.a11 + a12 * B.a21 + a13 * B.a31;
- C.a21 = a20 * B.a01 + a21 * B.a11 + a22 * B.a21 + a23 * B.a31;
- C.a31 = a30 * B.a01 + a31 * B.a11 + a32 * B.a21 + a33 * B.a31;
- C.a02 = a00 * B.a02 + a01 * B.a12 + a02 * B.a22 + a03 * B.a32;
- C.a12 = a10 * B.a02 + a11 * B.a12 + a12 * B.a22 + a13 * B.a32;
- C.a22 = a20 * B.a02 + a21 * B.a12 + a22 * B.a22 + a23 * B.a32;
- C.a32 = a30 * B.a02 + a31 * B.a12 + a32 * B.a22 + a33 * B.a32;
- C.a03 = a00 * B.a03 + a01 * B.a13 + a02 * B.a23 + a03 * B.a33;
- C.a13 = a10 * B.a03 + a11 * B.a13 + a12 * B.a23 + a13 * B.a33;
- C.a23 = a20 * B.a03 + a21 * B.a13 + a22 * B.a23 + a23 * B.a33;
- C.a33 = a30 * B.a03 + a31 * B.a13 + a32 * B.a23 + a33 * B.a33;
- return C;
-}
-
-// C = A * B
-
-// C.a00 C.a01 C.a02 A.a00 A.a01 A.a02 B.a00 B.a01 B.a02
-//
-// C.a10 C.a11 C.a12 A.a10 A.a11 A.a12 B.a10 B.a11 B.a12
-//
-// C.a20 C.a21 C.a22 = A.a20 A.a21 A.a22 * B.a20 B.a21 B.a22
-
-mat3& mult(mat3& C, const mat3& A, const mat3& B)
-{
- C.a00 = A.a00 * B.a00 + A.a01 * B.a10 + A.a02 * B.a20;
- C.a10 = A.a10 * B.a00 + A.a11 * B.a10 + A.a12 * B.a20;
- C.a20 = A.a20 * B.a00 + A.a21 * B.a10 + A.a22 * B.a20;
- C.a01 = A.a00 * B.a01 + A.a01 * B.a11 + A.a02 * B.a21;
- C.a11 = A.a10 * B.a01 + A.a11 * B.a11 + A.a12 * B.a21;
- C.a21 = A.a20 * B.a01 + A.a21 * B.a11 + A.a22 * B.a21;
- C.a02 = A.a00 * B.a02 + A.a01 * B.a12 + A.a02 * B.a22;
- C.a12 = A.a10 * B.a02 + A.a11 * B.a12 + A.a12 * B.a22;
- C.a22 = A.a20 * B.a02 + A.a21 * B.a12 + A.a22 * B.a22;
- return C;
-}
-
-mat3& transpose(mat3& A)
-{
- nv_scalar tmp;
- tmp = A.a01;
- A.a01 = A.a10;
- A.a10 = tmp;
-
- tmp = A.a02;
- A.a02 = A.a20;
- A.a20 = tmp;
-
- tmp = A.a12;
- A.a12 = A.a21;
- A.a21 = tmp;
- return A;
-}
-
-mat4& transpose(mat4& A)
-{
- nv_scalar tmp;
- tmp = A.a01;
- A.a01 = A.a10;
- A.a10 = tmp;
-
- tmp = A.a02;
- A.a02 = A.a20;
- A.a20 = tmp;
-
- tmp = A.a03;
- A.a03 = A.a30;
- A.a30 = tmp;
-
- tmp = A.a12;
- A.a12 = A.a21;
- A.a21 = tmp;
-
- tmp = A.a13;
- A.a13 = A.a31;
- A.a31 = tmp;
-
- tmp = A.a23;
- A.a23 = A.a32;
- A.a32 = tmp;
- return A;
-}
-
-mat4& transpose(mat4& B, const mat4& A)
-{
- B.a00 = A.a00;
- B.a01 = A.a10;
- B.a02 = A.a20;
- B.a03 = A.a30;
- B.a10 = A.a01;
- B.a11 = A.a11;
- B.a12 = A.a21;
- B.a13 = A.a31;
- B.a20 = A.a02;
- B.a21 = A.a12;
- B.a22 = A.a22;
- B.a23 = A.a32;
- B.a30 = A.a03;
- B.a31 = A.a13;
- B.a32 = A.a23;
- B.a33 = A.a33;
- return B;
-}
-
-mat3& transpose(mat3& B, const mat3& A)
-{
- B.a00 = A.a00;
- B.a01 = A.a10;
- B.a02 = A.a20;
- B.a10 = A.a01;
- B.a11 = A.a11;
- B.a12 = A.a21;
- B.a20 = A.a02;
- B.a21 = A.a12;
- B.a22 = A.a22;
- return B;
-}
-
-/*
- calculate the determinent of a 2x2 matrix in the from
-
- | a1 a2 |
- | b1 b2 |
-
-*/
-nv_scalar det2x2(nv_scalar a1, nv_scalar a2, nv_scalar b1, nv_scalar b2) { return a1 * b2 - b1 * a2; }
-/*
- calculate the determinent of a 3x3 matrix in the from
-
- | a1 a2 a3 |
- | b1 b2 b3 |
- | c1 c2 c3 |
-
-*/
-nv_scalar det3x3(nv_scalar a1, nv_scalar a2, nv_scalar a3, nv_scalar b1, nv_scalar b2, nv_scalar b3, nv_scalar c1,
- nv_scalar c2, nv_scalar c3)
-{
- return a1 * det2x2(b2, b3, c2, c3) - b1 * det2x2(a2, a3, c2, c3) + c1 * det2x2(a2, a3, b2, b3);
-}
-
-mat4& invert(mat4& B, const mat4& A)
-{
- nv_scalar det, oodet;
-
- B.a00 = det3x3(A.a11, A.a21, A.a31, A.a12, A.a22, A.a32, A.a13, A.a23, A.a33);
- B.a10 = -det3x3(A.a10, A.a20, A.a30, A.a12, A.a22, A.a32, A.a13, A.a23, A.a33);
- B.a20 = det3x3(A.a10, A.a20, A.a30, A.a11, A.a21, A.a31, A.a13, A.a23, A.a33);
- B.a30 = -det3x3(A.a10, A.a20, A.a30, A.a11, A.a21, A.a31, A.a12, A.a22, A.a32);
-
- B.a01 = -det3x3(A.a01, A.a21, A.a31, A.a02, A.a22, A.a32, A.a03, A.a23, A.a33);
- B.a11 = det3x3(A.a00, A.a20, A.a30, A.a02, A.a22, A.a32, A.a03, A.a23, A.a33);
- B.a21 = -det3x3(A.a00, A.a20, A.a30, A.a01, A.a21, A.a31, A.a03, A.a23, A.a33);
- B.a31 = det3x3(A.a00, A.a20, A.a30, A.a01, A.a21, A.a31, A.a02, A.a22, A.a32);
-
- B.a02 = det3x3(A.a01, A.a11, A.a31, A.a02, A.a12, A.a32, A.a03, A.a13, A.a33);
- B.a12 = -det3x3(A.a00, A.a10, A.a30, A.a02, A.a12, A.a32, A.a03, A.a13, A.a33);
- B.a22 = det3x3(A.a00, A.a10, A.a30, A.a01, A.a11, A.a31, A.a03, A.a13, A.a33);
- B.a32 = -det3x3(A.a00, A.a10, A.a30, A.a01, A.a11, A.a31, A.a02, A.a12, A.a32);
-
- B.a03 = -det3x3(A.a01, A.a11, A.a21, A.a02, A.a12, A.a22, A.a03, A.a13, A.a23);
- B.a13 = det3x3(A.a00, A.a10, A.a20, A.a02, A.a12, A.a22, A.a03, A.a13, A.a23);
- B.a23 = -det3x3(A.a00, A.a10, A.a20, A.a01, A.a11, A.a21, A.a03, A.a13, A.a23);
- B.a33 = det3x3(A.a00, A.a10, A.a20, A.a01, A.a11, A.a21, A.a02, A.a12, A.a22);
-
- det = (A.a00 * B.a00) + (A.a01 * B.a10) + (A.a02 * B.a20) + (A.a03 * B.a30);
-
- oodet = nv_one / det;
-
- B.a00 *= oodet;
- B.a10 *= oodet;
- B.a20 *= oodet;
- B.a30 *= oodet;
-
- B.a01 *= oodet;
- B.a11 *= oodet;
- B.a21 *= oodet;
- B.a31 *= oodet;
-
- B.a02 *= oodet;
- B.a12 *= oodet;
- B.a22 *= oodet;
- B.a32 *= oodet;
-
- B.a03 *= oodet;
- B.a13 *= oodet;
- B.a23 *= oodet;
- B.a33 *= oodet;
-
- return B;
-}
-
-mat4& invert_rot_trans(mat4& B, const mat4& A)
-{
- B.a00 = A.a00;
- B.a10 = A.a01;
- B.a20 = A.a02;
- B.a30 = A.a30;
- B.a01 = A.a10;
- B.a11 = A.a11;
- B.a21 = A.a12;
- B.a31 = A.a31;
- B.a02 = A.a20;
- B.a12 = A.a21;
- B.a22 = A.a22;
- B.a32 = A.a32;
- B.a03 = -(A.a00 * A.a03 + A.a10 * A.a13 + A.a20 * A.a23);
- B.a13 = -(A.a01 * A.a03 + A.a11 * A.a13 + A.a21 * A.a23);
- B.a23 = -(A.a02 * A.a03 + A.a12 * A.a13 + A.a22 * A.a23);
- B.a33 = A.a33;
- return B;
-}
-
-nv_scalar det(const mat3& A) { return det3x3(A.a00, A.a01, A.a02, A.a10, A.a11, A.a12, A.a20, A.a21, A.a22); }
-mat3& invert(mat3& B, const mat3& A)
-{
- nv_scalar det, oodet;
-
- B.a00 = (A.a11 * A.a22 - A.a21 * A.a12);
- B.a10 = -(A.a10 * A.a22 - A.a20 * A.a12);
- B.a20 = (A.a10 * A.a21 - A.a20 * A.a11);
- B.a01 = -(A.a01 * A.a22 - A.a21 * A.a02);
- B.a11 = (A.a00 * A.a22 - A.a20 * A.a02);
- B.a21 = -(A.a00 * A.a21 - A.a20 * A.a01);
- B.a02 = (A.a01 * A.a12 - A.a11 * A.a02);
- B.a12 = -(A.a00 * A.a12 - A.a10 * A.a02);
- B.a22 = (A.a00 * A.a11 - A.a10 * A.a01);
-
- det = (A.a00 * B.a00) + (A.a01 * B.a10) + (A.a02 * B.a20);
-
- oodet = nv_one / det;
-
- B.a00 *= oodet;
- B.a01 *= oodet;
- B.a02 *= oodet;
- B.a10 *= oodet;
- B.a11 *= oodet;
- B.a12 *= oodet;
- B.a20 *= oodet;
- B.a21 *= oodet;
- B.a22 *= oodet;
- return B;
-}
-
-vec3& normalize(vec3& u)
-{
- nv_scalar norm = _sqrt(u.x * u.x + u.y * u.y + u.z * u.z);
- if (norm > nv_eps)
- norm = nv_one / norm;
- else
- norm = nv_zero;
- return scale(u, norm);
-}
-
-vec4& normalize(vec4& u)
-{
- nv_scalar norm = _sqrt(u.x * u.x + u.y * u.y + u.z * u.z + u.w * u.w);
- if (norm > nv_eps)
- norm = nv_one / norm;
- else
- norm = nv_zero;
- return scale(u, norm);
-}
-
-quat& normalize(quat& p)
-{
- nv_scalar norm = _sqrt(p.x * p.x + p.y * p.y + p.z * p.z + p.w * p.w);
- if (norm > nv_eps)
- norm = nv_one / norm;
- else
- norm = nv_zero;
- p.x *= norm;
- p.y *= norm;
- p.z *= norm;
- p.w *= norm;
- return p;
-}
-
-mat4& look_at(mat4& M, const vec3& eye, const vec3& center, const vec3& up)
-{
- vec3 x, y, z;
-
- // make rotation matrix
-
- // Z vector
- z.x = eye.x - center.x;
- z.y = eye.y - center.y;
- z.z = eye.z - center.z;
- normalize(z);
-
- // Y vector
- y.x = up.x;
- y.y = up.y;
- y.z = up.z;
-
- // X vector = Y cross Z
- cross(x, y, z);
-
- // Recompute Y = Z cross X
- cross(y, z, x);
-
- // cross product gives area of parallelogram, which is < 1.0 for
- // non-perpendicular unit-length vectors; so normalize x, y here
- normalize(x);
- normalize(y);
-
- M.a00 = x.x;
- M.a01 = x.y;
- M.a02 = x.z;
- M.a03 = -x.x * eye.x - x.y * eye.y - x.z * eye.z;
- M.a10 = y.x;
- M.a11 = y.y;
- M.a12 = y.z;
- M.a13 = -y.x * eye.x - y.y * eye.y - y.z * eye.z;
- M.a20 = z.x;
- M.a21 = z.y;
- M.a22 = z.z;
- M.a23 = -z.x * eye.x - z.y * eye.y - z.z * eye.z;
- M.a30 = nv_zero;
- M.a31 = nv_zero;
- M.a32 = nv_zero;
- M.a33 = nv_one;
- return M;
-}
-
-mat4& frustum(mat4& M, const nv_scalar l, const nv_scalar r, const nv_scalar b, const nv_scalar t, const nv_scalar n,
- const nv_scalar f)
-{
- M.a00 = (nv_two * n) / (r - l);
- M.a10 = 0.0;
- M.a20 = 0.0;
- M.a30 = 0.0;
-
- M.a01 = 0.0;
- M.a11 = (nv_two * n) / (t - b);
- M.a21 = 0.0;
- M.a31 = 0.0;
-
- M.a02 = (r + l) / (r - l);
- M.a12 = (t + b) / (t - b);
- M.a22 = -(f + n) / (f - n);
- M.a32 = -nv_one;
-
- M.a03 = 0.0;
- M.a13 = 0.0;
- M.a23 = -(nv_two * f * n) / (f - n);
- M.a33 = 0.0;
- return M;
-}
-
-mat4& perspective(mat4& M, const nv_scalar fovy, const nv_scalar aspect, const nv_scalar n, const nv_scalar f)
-{
- nv_scalar xmin, xmax, ymin, ymax;
-
- ymax = n * tan(fovy * nv_to_rad * nv_zero_5);
- ymin = -ymax;
-
- xmin = ymin * aspect;
- xmax = ymax * aspect;
-
- return frustum(M, xmin, xmax, ymin, ymax, n, f);
-}
-
-const quat quat::Identity(0, 0, 0, 1);
-
-quat::quat(nv_scalar x, nv_scalar y, nv_scalar z, nv_scalar w) : x(x), y(y), z(z), w(w) {}
-quat::quat(const quat& quat)
-{
- x = quat.x;
- y = quat.y;
- z = quat.z;
- w = quat.w;
-}
-
-quat::quat(const vec3& axis, nv_scalar angle)
-{
- nv_scalar len = axis.norm();
- if (len)
- {
- nv_scalar invLen = 1 / len;
- nv_scalar angle2 = angle / 2;
- nv_scalar scale = _sin(angle2) * invLen;
- x = scale * axis[0];
- y = scale * axis[1];
- z = scale * axis[2];
- w = _cos(angle2);
- }
-}
-
-quat::quat(const mat3& rot) { FromMatrix(rot); }
-quat& quat::operator=(const quat& quat)
-{
- x = quat.x;
- y = quat.y;
- z = quat.z;
- w = quat.w;
- return *this;
-}
-
-quat quat::Inverse() { return quat(-x, -y, -z, w); }
-void quat::Normalize()
-{
- nv_scalar len = _sqrt(x * x + y * y + z * z + w * w);
- if (len > 0)
- {
- nv_scalar invLen = 1 / len;
- x *= invLen;
- y *= invLen;
- z *= invLen;
- w *= invLen;
- }
-}
-
-void quat::FromMatrix(const mat3& mat)
-{
- nv_scalar trace = mat(0, 0) + mat(1, 1) + mat(2, 2);
- if (trace > 0)
- {
- nv_scalar scale = _sqrt(trace + 1.0f);
- w = 0.5f * scale;
- scale = 0.5f / scale;
- x = scale * (mat(2, 1) - mat(1, 2));
- y = scale * (mat(0, 2) - mat(2, 0));
- z = scale * (mat(1, 0) - mat(0, 1));
- }
- else
- {
- static int next[] = {1, 2, 0};
- int i = 0;
- if (mat(1, 1) > mat(0, 0))
- i = 1;
- if (mat(2, 2) > mat(i, i))
- i = 2;
- int j = next[i];
- int k = next[j];
- nv_scalar scale = _sqrt(mat(i, i) - mat(j, j) - mat(k, k) + 1);
- nv_scalar* q[] = {&x, &y, &z};
- *q[i] = 0.5f * scale;
- scale = 0.5f / scale;
- w = scale * (mat(k, j) - mat(j, k));
- *q[j] = scale * (mat(j, i) + mat(i, j));
- *q[k] = scale * (mat(k, i) + mat(i, k));
- }
-}
-
-void quat::ToMatrix(mat3& mat) const
-{
- nv_scalar x2 = x * 2;
- nv_scalar y2 = y * 2;
- nv_scalar z2 = z * 2;
- nv_scalar wx = x2 * w;
- nv_scalar wy = y2 * w;
- nv_scalar wz = z2 * w;
- nv_scalar xx = x2 * x;
- nv_scalar xy = y2 * x;
- nv_scalar xz = z2 * x;
- nv_scalar yy = y2 * y;
- nv_scalar yz = z2 * y;
- nv_scalar zz = z2 * z;
- mat(0, 0) = 1 - (yy + zz);
- mat(0, 1) = xy - wz;
- mat(0, 2) = xz + wy;
- mat(1, 0) = xy + wz;
- mat(1, 1) = 1 - (xx + zz);
- mat(1, 2) = yz - wx;
- mat(2, 0) = xz - wy;
- mat(2, 1) = yz + wx;
- mat(2, 2) = 1 - (xx + yy);
-}
-
-const quat operator*(const quat& p, const quat& q)
-{
- return quat(p.w * q.x + p.x * q.w + p.y * q.z - p.z * q.y, p.w * q.y + p.y * q.w + p.z * q.x - p.x * q.z,
- p.w * q.z + p.z * q.w + p.x * q.y - p.y * q.x, p.w * q.w - p.x * q.x - p.y * q.y - p.z * q.z);
-}
-
-quat& quat::operator*=(const quat& quat)
-{
- *this = *this * quat;
- return *this;
-}
-
-mat3& quat_2_mat(mat3& M, const quat& q)
-{
- q.ToMatrix(M);
- return M;
-}
-
-quat& mat_2_quat(quat& q, const mat3& M)
-{
- q.FromMatrix(M);
- return q;
-}
-
-quat& mat_2_quat(quat& q, const mat4& M)
-{
- mat3 m;
- M.get_rot(m);
- q.FromMatrix(m);
- return q;
-}
-
-/*
- Given an axis and angle, compute quaternion.
- */
-quat& axis_to_quat(quat& q, const vec3& a, const nv_scalar phi)
-{
- vec3 tmp(a.x, a.y, a.z);
-
- normalize(tmp);
- nv_scalar s = _sin(phi / nv_two);
- q.x = s * tmp.x;
- q.y = s * tmp.y;
- q.z = s * tmp.z;
- q.w = _cos(phi / nv_two);
- return q;
-}
-
-quat& conj(quat& p)
-{
- p.x = -p.x;
- p.y = -p.y;
- p.z = -p.z;
- return p;
-}
-
-quat& conj(quat& p, const quat& q)
-{
- p.x = -q.x;
- p.y = -q.y;
- p.z = -q.z;
- p.w = q.w;
- return p;
-}
-
-quat& add_quats(quat& p, const quat& q1, const quat& q2)
-{
- quat t1, t2;
-
- t1 = q1;
- t1.x *= q2.w;
- t1.y *= q2.w;
- t1.z *= q2.w;
-
- t2 = q2;
- t2.x *= q1.w;
- t2.y *= q1.w;
- t2.z *= q1.w;
-
- p.x = (q2.y * q1.z) - (q2.z * q1.y) + t1.x + t2.x;
- p.y = (q2.z * q1.x) - (q2.x * q1.z) + t1.y + t2.y;
- p.z = (q2.x * q1.y) - (q2.y * q1.x) + t1.z + t2.z;
- p.w = q1.w * q2.w - (q1.x * q2.x + q1.y * q2.y + q1.z * q2.z);
-
- return p;
-}
-
-nv_scalar& dot(nv_scalar& s, const quat& q1, const quat& q2)
-{
- s = q1.x * q2.x + q1.y * q2.y + q1.z * q2.z + q1.w * q2.w;
- return s;
-}
-
-nv_scalar dot(const quat& q1, const quat& q2) { return q1.x * q2.x + q1.y * q2.y + q1.z * q2.z + q1.w * q2.w; }
-#ifndef acosf
-#define acosf acos
-#endif
-
-quat& slerp_quats(quat& p, nv_scalar s, const quat& q1, const quat& q2)
-{
- nv_scalar cosine = dot(q1, q2);
- if (cosine < -1)
- cosine = -1;
- else if (cosine > 1)
- cosine = 1;
- nv_scalar angle = (nv_scalar)acosf(cosine);
- if (_abs(angle) < nv_eps)
- {
- p = q1;
- return p;
- }
- nv_scalar sine = _sin(angle);
- nv_scalar sineInv = 1.0f / sine;
- nv_scalar c1 = _sin((1.0f - s) * angle) * sineInv;
- nv_scalar c2 = _sin(s * angle) * sineInv;
- p.x = c1 * q1.x + c2 * q2.x;
- p.y = c1 * q1.y + c2 * q2.y;
- p.z = c1 * q1.z + c2 * q2.z;
- p.w = c1 * q1.w + c2 * q2.w;
- return p;
-}
-
-const int HALF_RAND = (RAND_MAX / 2);
-
-nv_scalar nv_random() { return ((nv_scalar)(rand() - HALF_RAND) / (nv_scalar)HALF_RAND); }
-// v is normalized
-// theta in radians
-void mat3::set_rot(const nv_scalar& theta, const vec3& v)
-{
- nv_scalar ct = nv_scalar(_cos(theta));
- nv_scalar st = nv_scalar(_sin(theta));
-
- nv_scalar xx = v.x * v.x;
- nv_scalar yy = v.y * v.y;
- nv_scalar zz = v.z * v.z;
- nv_scalar xy = v.x * v.y;
- nv_scalar xz = v.x * v.z;
- nv_scalar yz = v.y * v.z;
-
- a00 = xx + ct * (1 - xx);
- a01 = xy + ct * (-xy) + st * -v.z;
- a02 = xz + ct * (-xz) + st * v.y;
-
- a10 = xy + ct * (-xy) + st * v.z;
- a11 = yy + ct * (1 - yy);
- a12 = yz + ct * (-yz) + st * -v.x;
-
- a20 = xz + ct * (-xz) + st * -v.y;
- a21 = yz + ct * (-yz) + st * v.x;
- a22 = zz + ct * (1 - zz);
-}
-
-void mat3::set_rot(const vec3& u, const vec3& v)
-{
- nv_scalar phi;
- nv_scalar h;
- nv_scalar lambda;
- vec3 w;
-
- cross(w, u, v);
- dot(phi, u, v);
- dot(lambda, w, w);
- if (lambda > nv_eps)
- h = (nv_one - phi) / lambda;
- else
- h = lambda;
-
- nv_scalar hxy = w.x * w.y * h;
- nv_scalar hxz = w.x * w.z * h;
- nv_scalar hyz = w.y * w.z * h;
-
- a00 = phi + w.x * w.x * h;
- a01 = hxy - w.z;
- a02 = hxz + w.y;
-
- a10 = hxy + w.z;
- a11 = phi + w.y * w.y * h;
- a12 = hyz - w.x;
-
- a20 = hxz - w.y;
- a21 = hyz + w.x;
- a22 = phi + w.z * w.z * h;
-}
-
-void mat4::set_rot(const quat& q)
-{
- mat3 m;
- q.ToMatrix(m);
- set_rot(m);
-}
-
-// v is normalized
-// theta in radians
-void mat4::set_rot(const nv_scalar& theta, const vec3& v)
-{
- nv_scalar ct = nv_scalar(_cos(theta));
- nv_scalar st = nv_scalar(_sin(theta));
-
- nv_scalar xx = v.x * v.x;
- nv_scalar yy = v.y * v.y;
- nv_scalar zz = v.z * v.z;
- nv_scalar xy = v.x * v.y;
- nv_scalar xz = v.x * v.z;
- nv_scalar yz = v.y * v.z;
-
- a00 = xx + ct * (1 - xx);
- a01 = xy + ct * (-xy) + st * -v.z;
- a02 = xz + ct * (-xz) + st * v.y;
-
- a10 = xy + ct * (-xy) + st * v.z;
- a11 = yy + ct * (1 - yy);
- a12 = yz + ct * (-yz) + st * -v.x;
-
- a20 = xz + ct * (-xz) + st * -v.y;
- a21 = yz + ct * (-yz) + st * v.x;
- a22 = zz + ct * (1 - zz);
-}
-
-void mat4::set_rot(const vec3& u, const vec3& v)
-{
- nv_scalar phi;
- nv_scalar h;
- nv_scalar lambda;
- vec3 w;
-
- cross(w, u, v);
- dot(phi, u, v);
- dot(lambda, w, w);
- if (lambda > nv_eps)
- h = (nv_one - phi) / lambda;
- else
- h = lambda;
-
- nv_scalar hxy = w.x * w.y * h;
- nv_scalar hxz = w.x * w.z * h;
- nv_scalar hyz = w.y * w.z * h;
-
- a00 = phi + w.x * w.x * h;
- a01 = hxy - w.z;
- a02 = hxz + w.y;
-
- a10 = hxy + w.z;
- a11 = phi + w.y * w.y * h;
- a12 = hyz - w.x;
-
- a20 = hxz - w.y;
- a21 = hyz + w.x;
- a22 = phi + w.z * w.z * h;
-}
-
-void mat4::set_rot(const mat3& M)
-{
- // copy the 3x3 rotation block
- a00 = M.a00;
- a10 = M.a10;
- a20 = M.a20;
- a01 = M.a01;
- a11 = M.a11;
- a21 = M.a21;
- a02 = M.a02;
- a12 = M.a12;
- a22 = M.a22;
-}
-
-void mat4::set_translation(const vec3& t)
-{
- a03 = t.x;
- a13 = t.y;
- a23 = t.z;
-}
-
-vec3& mat4::get_translation(vec3& t) const
-{
- t.x = a03;
- t.y = a13;
- t.z = a23;
- return t;
-}
-
-mat3& mat4::get_rot(mat3& M) const
-{
- // assign the 3x3 rotation block
- M.a00 = a00;
- M.a10 = a10;
- M.a20 = a20;
- M.a01 = a01;
- M.a11 = a11;
- M.a21 = a21;
- M.a02 = a02;
- M.a12 = a12;
- M.a22 = a22;
- return M;
-}
-
-quat& mat4::get_rot(quat& q) const
-{
- mat3 m;
- get_rot(m);
- q.FromMatrix(m);
- return q;
-}
-
-mat3& tangent_basis(mat3& basis, const vec3& v0, const vec3& v1, const vec3& v2, const vec2& t0, const vec2& t1,
- const vec2& t2, const vec3& n)
-{
- vec3 cp;
- vec3 e0(v1.x - v0.x, t1.s - t0.s, t1.t - t0.t);
- vec3 e1(v2.x - v0.x, t2.s - t0.s, t2.t - t0.t);
-
- cross(cp, e0, e1);
- if (_abs(cp.x) > nv_eps)
- {
- basis.a00 = -cp.y / cp.x;
- basis.a10 = -cp.z / cp.x;
- }
-
- e0.x = v1.y - v0.y;
- e1.x = v2.y - v0.y;
-
- cross(cp, e0, e1);
- if (_abs(cp.x) > nv_eps)
- {
- basis.a01 = -cp.y / cp.x;
- basis.a11 = -cp.z / cp.x;
- }
-
- e0.x = v1.z - v0.z;
- e1.x = v2.z - v0.z;
-
- cross(cp, e0, e1);
- if (_abs(cp.x) > nv_eps)
- {
- basis.a02 = -cp.y / cp.x;
- basis.a12 = -cp.z / cp.x;
- }
-
- // tangent...
- nv_scalar oonorm = nv_one / _sqrt(basis.a00 * basis.a00 + basis.a01 * basis.a01 + basis.a02 * basis.a02);
- basis.a00 *= oonorm;
- basis.a01 *= oonorm;
- basis.a02 *= oonorm;
-
- // binormal...
- oonorm = nv_one / _sqrt(basis.a10 * basis.a10 + basis.a11 * basis.a11 + basis.a12 * basis.a12);
- basis.a10 *= oonorm;
- basis.a11 *= oonorm;
- basis.a12 *= oonorm;
-
- // normal...
- // compute the cross product TxB
- basis.a20 = basis.a01 * basis.a12 - basis.a02 * basis.a11;
- basis.a21 = basis.a02 * basis.a10 - basis.a00 * basis.a12;
- basis.a22 = basis.a00 * basis.a11 - basis.a01 * basis.a10;
-
- oonorm = nv_one / _sqrt(basis.a20 * basis.a20 + basis.a21 * basis.a21 + basis.a22 * basis.a22);
- basis.a20 *= oonorm;
- basis.a21 *= oonorm;
- basis.a22 *= oonorm;
-
- // Gram-Schmidt orthogonalization process for B
- // compute the cross product B=NxT to obtain
- // an orthogonal basis
- basis.a10 = basis.a21 * basis.a02 - basis.a22 * basis.a01;
- basis.a11 = basis.a22 * basis.a00 - basis.a20 * basis.a02;
- basis.a12 = basis.a20 * basis.a01 - basis.a21 * basis.a00;
-
- if (basis.a20 * n.x + basis.a21 * n.y + basis.a22 * n.z < nv_zero)
- {
- basis.a20 = -basis.a20;
- basis.a21 = -basis.a21;
- basis.a22 = -basis.a22;
- }
- return basis;
-}
-
-/*
- * Project an x,y pair onto a sphere of radius r OR a hyperbolic sheet
- * if we are away from the center of the sphere.
- */
-nv_scalar tb_project_to_sphere(nv_scalar r, nv_scalar x, nv_scalar y)
-{
- nv_scalar d, t, z;
-
- d = _sqrt(x * x + y * y);
- if (d < r * 0.70710678118654752440)
- { /* Inside sphere */
- z = _sqrt(r * r - d * d);
- }
- else
- { /* On hyperbola */
- t = r / (nv_scalar)1.41421356237309504880;
- z = t * t / d;
- }
- return z;
-}
-
-/*
- * Ok, simulate a track-ball. Project the points onto the virtual
- * trackball, then figure out the axis of rotation, which is the cross
- * product of P1 P2 and O P1 (O is the center of the ball, 0,0,0)
- * Note: This is a deformed trackball-- is a trackball in the center,
- * but is deformed into a hyperbolic sheet of rotation away from the
- * center. This particular function was chosen after trying out
- * several variations.
- *
- * It is assumed that the arguments to this routine are in the range
- * (-1.0 ... 1.0)
- */
-quat& trackball(quat& q, vec2& pt1, vec2& pt2, nv_scalar trackballsize)
-{
- vec3 a; // Axis of rotation
- nv_scalar phi; // how much to rotate about axis
- vec3 d;
- nv_scalar t;
-
- if (pt1.x == pt2.x && pt1.y == pt2.y)
- {
- // Zero rotation
- q = quat_id;
- return q;
- }
-
- // First, figure out z-coordinates for projection of P1 and P2 to
- // deformed sphere
- vec3 p1(pt1.x, pt1.y, tb_project_to_sphere(trackballsize, pt1.x, pt1.y));
- vec3 p2(pt2.x, pt2.y, tb_project_to_sphere(trackballsize, pt2.x, pt2.y));
-
- // Now, we want the cross product of P1 and P2
- cross(a, p1, p2);
-
- // Figure out how much to rotate around that axis.
- d.x = p1.x - p2.x;
- d.y = p1.y - p2.y;
- d.z = p1.z - p2.z;
- t = _sqrt(d.x * d.x + d.y * d.y + d.z * d.z) / (trackballsize);
-
- // Avoid problems with out-of-control values...
-
- if (t > nv_one)
- t = nv_one;
- if (t < -nv_one)
- t = -nv_one;
- phi = nv_two * nv_scalar(asin(t));
- axis_to_quat(q, a, phi);
- return q;
-}
-
-vec3& cube_map_normal(int i, int x, int y, int cubesize, vec3& v)
-{
- nv_scalar s, t, sc, tc;
- s = (nv_scalar(x) + nv_zero_5) / nv_scalar(cubesize);
- t = (nv_scalar(y) + nv_zero_5) / nv_scalar(cubesize);
- sc = s * nv_two - nv_one;
- tc = t * nv_two - nv_one;
-
- switch (i)
- {
- case 0:
- v.x = nv_one;
- v.y = -tc;
- v.z = -sc;
- break;
- case 1:
- v.x = -nv_one;
- v.y = -tc;
- v.z = sc;
- break;
- case 2:
- v.x = sc;
- v.y = nv_one;
- v.z = tc;
- break;
- case 3:
- v.x = sc;
- v.y = -nv_one;
- v.z = -tc;
- break;
- case 4:
- v.x = sc;
- v.y = -tc;
- v.z = nv_one;
- break;
- case 5:
- v.x = -sc;
- v.y = -tc;
- v.z = -nv_one;
- break;
- }
- normalize(v);
- return v;
-}
-
-// computes the area of a triangle
-nv_scalar nv_area(const vec3& v1, const vec3& v2, const vec3& v3)
-{
- vec3 cp_sum;
- vec3 cp;
- cross(cp_sum, v1, v2);
- cp_sum += cross(cp, v2, v3);
- cp_sum += cross(cp, v3, v1);
- return nv_norm(cp_sum) * nv_zero_5;
-}
-
-// computes the perimeter of a triangle
-nv_scalar nv_perimeter(const vec3& v1, const vec3& v2, const vec3& v3)
-{
- nv_scalar perim;
- vec3 diff;
- sub(diff, v1, v2);
- perim = nv_norm(diff);
- sub(diff, v2, v3);
- perim += nv_norm(diff);
- sub(diff, v3, v1);
- perim += nv_norm(diff);
- return perim;
-}
-
-// compute the center and radius of the inscribed circle defined by the three vertices
-nv_scalar nv_find_in_circle(vec3& center, const vec3& v1, const vec3& v2, const vec3& v3)
-{
- nv_scalar area = nv_area(v1, v2, v3);
- // if the area is null
- if (area < nv_eps)
- {
- center = v1;
- return nv_zero;
- }
-
- nv_scalar oo_perim = nv_one / nv_perimeter(v1, v2, v3);
-
- vec3 diff;
-
- sub(diff, v2, v3);
- mult(center, v1, nv_norm(diff));
-
- sub(diff, v3, v1);
- madd(center, v2, nv_norm(diff));
-
- sub(diff, v1, v2);
- madd(center, v3, nv_norm(diff));
-
- center *= oo_perim;
-
- return nv_two * area * oo_perim;
-}
-
-// compute the center and radius of the circumscribed circle defined by the three vertices
-// i.e. the osculating circle of the three vertices
-nv_scalar nv_find_circ_circle(vec3& center, const vec3& v1, const vec3& v2, const vec3& v3)
-{
- vec3 e0;
- vec3 e1;
- nv_scalar d1, d2, d3;
- nv_scalar c1, c2, c3, oo_c;
-
- sub(e0, v3, v1);
- sub(e1, v2, v1);
- dot(d1, e0, e1);
-
- sub(e0, v3, v2);
- sub(e1, v1, v2);
- dot(d2, e0, e1);
-
- sub(e0, v1, v3);
- sub(e1, v2, v3);
- dot(d3, e0, e1);
-
- c1 = d2 * d3;
- c2 = d3 * d1;
- c3 = d1 * d2;
- oo_c = nv_one / (c1 + c2 + c3);
-
- mult(center, v1, c2 + c3);
- madd(center, v2, c3 + c1);
- madd(center, v3, c1 + c2);
- center *= oo_c * nv_zero_5;
-
- return nv_zero_5 * _sqrt((d1 + d2) * (d2 + d3) * (d3 + d1) * oo_c);
-}
-
-nv_scalar ffast_cos(const nv_scalar x)
-{
- // assert: 0 <= fT <= PI/2
- // maximum absolute error = 1.1880e-03
- // speedup = 2.14
-
- nv_scalar x_sqr = x * x;
- nv_scalar res = nv_scalar(3.705e-02);
- res *= x_sqr;
- res -= nv_scalar(4.967e-01);
- res *= x_sqr;
- res += nv_one;
- return res;
-}
-
-nv_scalar fast_cos(const nv_scalar x)
-{
- // assert: 0 <= fT <= PI/2
- // maximum absolute error = 2.3082e-09
- // speedup = 1.47
-
- nv_scalar x_sqr = x * x;
- nv_scalar res = nv_scalar(-2.605e-07);
- res *= x_sqr;
- res += nv_scalar(2.47609e-05);
- res *= x_sqr;
- res -= nv_scalar(1.3888397e-03);
- res *= x_sqr;
- res += nv_scalar(4.16666418e-02);
- res *= x_sqr;
- res -= nv_scalar(4.999999963e-01);
- res *= x_sqr;
- res += nv_one;
- return res;
-}
-
-void nv_is_valid(const vec3& v)
-{
- assert(!_isnan(v.x) && !_isnan(v.y) && !_isnan(v.z) && _finite(v.x) && _finite(v.y) && _finite(v.z));
-}
-
-void nv_is_valid(nv_scalar lambda) { assert(!_isnan(lambda) && _finite(lambda)); }
diff --git a/src/editors/ECore/Engine/nv_algebra.h b/src/editors/ECore/Engine/nv_algebra.h
deleted file mode 100644
index 26673477a04..00000000000
--- a/src/editors/ECore/Engine/nv_algebra.h
+++ /dev/null
@@ -1,654 +0,0 @@
-/*********************************************************************NVMH1****
-File:
-nv_algebra.h
-
-Copyright (C) 1999, 2002 NVIDIA Corporation
-This file is provided without support, instruction, or implied warranty of any
-kind. NVIDIA makes no guarantee of its fitness for a particular purpose and is
-not liable under any circumstances for any damages or loss whatsoever arising
-from the use or inability to use this file or items derived from it.
-
-Comments:
-
-
-******************************************************************************/
-
-#ifndef nv_algebraH
-#define nv_algebraH
-
-struct DECLSPEC_NV_MATH vec2
-{
- vec2() {}
- vec2(nv_scalar x, nv_scalar y) : x(x), y(y) {}
- vec2(const nv_scalar* xy) : x(xy[0]), y(xy[1]) {}
- vec2(const vec2& u) : x(u.x), y(u.y) {}
- vec2(const vec3t&);
-
- bool operator==(const vec2& u) const { return (u.x == x && u.y == y) ? true : false; }
- bool operator!=(const vec2& u) const { return !(*this == u); }
- vec2& operator*=(const nv_scalar& lambda)
- {
- x *= lambda;
- y *= lambda;
- return *this;
- }
-
- vec2& operator-=(const vec2& u)
- {
- x -= u.x;
- y -= u.y;
- return *this;
- }
-
- vec2& operator+=(const vec2& u)
- {
- x += u.x;
- y += u.y;
- return *this;
- }
-
- nv_scalar& operator[](int i) { return vec_array[i]; }
- const nv_scalar operator[](int i) const { return vec_array[i]; }
- union
- {
- struct
- {
- nv_scalar x, y; // standard names for components
- };
-
- struct
- {
- nv_scalar s, t; // standard names for components
- };
-
- nv_scalar vec_array[2]; // array access
- };
-};
-
-inline const vec2 operator+(const vec2& u, const vec2& v) { return vec2(u.x + v.x, u.y + v.y); }
-inline const vec2 operator-(const vec2& u, const vec2& v) { return vec2(u.x - v.x, u.y - v.y); }
-inline const vec2 operator*(const nv_scalar s, const vec2& u) { return vec2(s * u.x, s * u.y); }
-inline const vec2 operator/(const vec2& u, const nv_scalar s) { return vec2(u.x / s, u.y / s); }
-inline const vec2 operator*(const vec2& u, const vec2& v) { return vec2(u.x * v.x, u.y * v.y); }
-template
-struct vec3t
-{
- vec3t() {}
- vec3t(_T x, _T y, _T z) : x(x), y(y), z(z) {}
- vec3t(const _T* xyz) : x(xyz[0]), y(xyz[1]), z(xyz[2]) {}
- vec3t(const vec2& u) : x(u.x), y(u.y), z(1.0f) {}
- vec3t(const vec3t& u) : x(_T(u.x)), y(_T(u.y)), z(_T(u.z)) {}
- vec3t(const vec3t& u) : x(_T(u.x)), y(_T(u.y)), z(_T(u.z)) {}
- vec3t(const vec4&);
-
- bool operator==(const vec3t<_T>& u) const { return (u.x == x && u.y == y && u.z == z) ? true : false; }
- bool operator!=(const vec3t<_T>& rhs) const { return !(*this == rhs); }
- vec3t<_T>& operator*=(const _T& lambda)
- {
- x *= lambda;
- y *= lambda;
- z *= lambda;
- return *this;
- }
-
- vec3t<_T> operator-() const { return vec3t<_T>(-x, -y, -z); }
- vec3t<_T>& operator-=(const vec3t<_T>& u)
- {
- x -= u.x;
- y -= u.y;
- z -= u.z;
- return *this;
- }
-
- vec3t<_T>& operator+=(const vec3t<_T>& u)
- {
- x += u.x;
- y += u.y;
- z += u.z;
- return *this;
- }
-
- _T sq_norm() const { return x * x + y * y + z * z; }
- _T norm() const { return _sqrt(sq_norm()); }
- _T normalize()
- {
- _T _norm = norm();
- if (_norm > nv_eps)
- _norm = nv_one / _norm;
- else
- _norm = nv_zero;
- x *= _norm;
- y *= _norm;
- z *= _norm;
- return _norm;
- }
-
- _T& operator[](int i) { return vec_array[i]; }
- union
- {
- struct
- {
- _T x, y, z; // standard names for components
- };
-
- struct
- {
- _T s, t, r; // standard names for components
- };
-
- _T vec_array[3]; // array access
- };
-
- const _T operator[](int i) const { return vec_array[i]; }
-};
-
-template
-inline const vec3t<_T> operator+(const vec3t<_T>& u, const vec3t<_T>& v)
-{
- return vec3t<_T>(u.x + v.x, u.y + v.y, u.z + v.z);
-}
-
-template
-inline const vec3t<_T> operator-(const vec3t<_T>& u, const vec3t<_T>& v)
-{
- return vec3t<_T>(u.x - v.x, u.y - v.y, u.z - v.z);
-}
-
-template
-inline const vec3t<_T> operator^(const vec3t<_T>& u, const vec3t<_T>& v)
-{
- return vec3t<_T>(u.y * v.z - u.z * v.y, u.z * v.x - u.x * v.z, u.x * v.y - u.y * v.x);
-}
-
-template
-inline const vec3t<_T> operator*(const _T s, const vec3t<_T>& u)
-{
- return vec3t<_T>(s * u.x, s * u.y, s * u.z);
-}
-
-template
-inline const vec3t<_T> operator/(const vec3t<_T>& u, const _T s)
-{
- return vec3t<_T>(u.x / s, u.y / s, u.z / s);
-}
-
-template
-inline const vec3t<_T> operator*(const vec3t<_T>& u, const vec3t<_T>& v)
-{
- return vec3t<_T>(u.x * v.x, u.y * v.y, u.z * v.z);
-}
-
-//
-typedef vec3t vec3;
-typedef vec3t vec3f;
-typedef vec3t vec3d;
-
-inline vec2::vec2(const vec3& u)
-{
- nv_scalar k = 1 / u.z;
- x = k * u.x;
- y = k * u.y;
-}
-
-struct DECLSPEC_NV_MATH vec4
-{
- vec4() {}
- vec4(nv_scalar x, nv_scalar y, nv_scalar z, nv_scalar w) : x(x), y(y), z(z), w(w) {}
- vec4(const nv_scalar* xyzw) : x(xyzw[0]), y(xyzw[1]), z(xyzw[2]), w(xyzw[3]) {}
- vec4(const vec3& u) : x(u.x), y(u.y), z(u.z), w(1.0f) {}
- vec4(const vec4& u) : x(u.x), y(u.y), z(u.z), w(u.w) {}
- bool operator==(const vec4& u) const { return (u.x == x && u.y == y && u.z == z && u.w == w) ? true : false; }
- bool operator!=(const vec4& rhs) const { return !(*this == rhs); }
- vec4& operator*=(const nv_scalar& lambda)
- {
- x *= lambda;
- y *= lambda;
- z *= lambda;
- w *= lambda;
- return *this;
- }
-
- vec4& operator-=(const vec4& u)
- {
- x -= u.x;
- y -= u.y;
- z -= u.z;
- w -= u.w;
- return *this;
- }
-
- vec4& operator+=(const vec4& u)
- {
- x += u.x;
- y += u.y;
- z += u.z;
- w += u.w;
- return *this;
- }
-
- vec4 operator-() const { return vec4(-x, -y, -z, -w); }
- nv_scalar& operator[](int i) { return vec_array[i]; }
- const nv_scalar operator[](int i) const { return vec_array[i]; }
- union
- {
- struct
- {
- nv_scalar x, y, z, w; // standard names for components
- };
-
- struct
- {
- nv_scalar s, t, r, q; // standard names for components
- };
-
- nv_scalar vec_array[4]; // array access
- };
-};
-
-inline const vec4 operator+(const vec4& u, const vec4& v) { return vec4(u.x + v.x, u.y + v.y, u.z + v.z, u.w + v.w); }
-inline const vec4 operator-(const vec4& u, const vec4& v) { return vec4(u.x - v.x, u.y - v.y, u.z - v.z, u.w - v.w); }
-inline const vec4 operator*(const nv_scalar s, const vec4& u) { return vec4(s * u.x, s * u.y, s * u.z, s * u.w); }
-inline const vec4 operator/(const vec4& u, const nv_scalar s) { return vec4(u.x / s, u.y / s, u.z / s, u.w / s); }
-inline const vec4 operator*(const vec4& u, const vec4& v) { return vec4(u.x * v.x, u.y * v.y, u.z * v.z, u.w * v.w); }
-template
-inline vec3t<_T>::vec3t(const vec4& u)
-{
- x = u.x;
- y = u.y;
- z = u.z;
-}
-
-// quaternion
-struct quat;
-
-/*
- for all the matrices...a indicates the element at row x, col y
-
- For example:
- a01 <-> row 0, col 1
-*/
-
-struct DECLSPEC_NV_MATH mat3
-{
- mat3();
- mat3(const nv_scalar* array);
- mat3(const mat3& M);
-
- mat3(const nv_scalar& f0, const nv_scalar& f1, const nv_scalar& f2, const nv_scalar& f3, const nv_scalar& f4,
- const nv_scalar& f5, const nv_scalar& f6, const nv_scalar& f7, const nv_scalar& f8)
- : a00(f0), a10(f1), a20(f2), a01(f3), a11(f4), a21(f5), a02(f6), a12(f7), a22(f8)
- {
- }
-
- const vec3 col(const int i) const { return vec3(&mat_array[i * 3]); }
- const vec3 operator[](int i) const { return vec3(mat_array[i], mat_array[i + 3], mat_array[i + 6]); }
- const nv_scalar& operator()(const int& i, const int& j) const { return mat_array[j * 3 + i]; }
- nv_scalar& operator()(const int& i, const int& j) { return mat_array[j * 3 + i]; }
- void set_row(int i, const vec3& v)
- {
- mat_array[i] = v.x;
- mat_array[i + 3] = v.y;
- mat_array[i + 6] = v.z;
- }
-
- void set_col(int i, const vec3& v)
- {
- mat_array[i * 3] = v.x;
- mat_array[i * 3 + 1] = v.y;
- mat_array[i * 3 + 2] = v.z;
- }
-
- void set_rot(const nv_scalar& theta, const vec3& v);
- void set_rot(const vec3& u, const vec3& v);
-
- union
- {
- struct
- {
- nv_scalar a00, a10, a20; // standard names for components
- nv_scalar a01, a11, a21; // standard names for components
- nv_scalar a02, a12, a22; // standard names for components
- };
-
- nv_scalar mat_array[9]; // array access
- };
-};
-
-const vec3 operator*(const mat3&, const vec3&);
-const vec3 operator*(const vec3&, const mat3&);
-
-struct DECLSPEC_NV_MATH mat4
-{
- mat4();
- mat4(const nv_scalar* array);
- mat4(const mat4& M);
-
- mat4(const nv_scalar& f0, const nv_scalar& f1, const nv_scalar& f2, const nv_scalar& f3, const nv_scalar& f4,
- const nv_scalar& f5, const nv_scalar& f6, const nv_scalar& f7, const nv_scalar& f8, const nv_scalar& f9,
- const nv_scalar& f10, const nv_scalar& f11, const nv_scalar& f12, const nv_scalar& f13, const nv_scalar& f14,
- const nv_scalar& f15)
- : a00(f0), a10(f1), a20(f2), a30(f3), a01(f4), a11(f5), a21(f6), a31(f7), a02(f8), a12(f9), a22(f10), a32(f11),
- a03(f12), a13(f13), a23(f14), a33(f15)
- {
- }
-
- const vec4 col(const int i) const { return vec4(&mat_array[i * 4]); }
- const vec4 operator[](const int& i) const
- {
- return vec4(mat_array[i], mat_array[i + 4], mat_array[i + 8], mat_array[i + 12]);
- }
-
- const nv_scalar& operator()(const int& i, const int& j) const { return mat_array[j * 4 + i]; }
- nv_scalar& operator()(const int& i, const int& j) { return mat_array[j * 4 + i]; }
- void set_col(int i, const vec4& v)
- {
- mat_array[i * 4] = v.x;
- mat_array[i * 4 + 1] = v.y;
- mat_array[i * 4 + 2] = v.z;
- mat_array[i * 4 + 3] = v.w;
- }
-
- void set_row(int i, const vec4& v)
- {
- mat_array[i] = v.x;
- mat_array[i + 4] = v.y;
- mat_array[i + 8] = v.z;
- mat_array[i + 12] = v.w;
- }
-
- mat3& get_rot(mat3& M) const;
- quat& get_rot(quat& q) const;
- void set_rot(const quat& q);
- void set_rot(const mat3& M);
- void set_rot(const nv_scalar& theta, const vec3& v);
- void set_rot(const vec3& u, const vec3& v);
-
- void set_translation(const vec3& t);
- vec3& get_translation(vec3& t) const;
-
- mat4 operator*(const mat4&)const;
-
- union
- {
- struct
- {
- nv_scalar a00, a10, a20, a30; // standard names for components
- nv_scalar a01, a11, a21, a31; // standard names for components
- nv_scalar a02, a12, a22, a32; // standard names for components
- nv_scalar a03, a13, a23, a33; // standard names for components
- };
-
- struct
- {
- nv_scalar _11, _12, _13, _14; // standard names for components
- nv_scalar _21, _22, _23, _24; // standard names for components
- nv_scalar _31, _32, _33, _34; // standard names for components
- nv_scalar _41, _42, _43, _44; // standard names for components
- };
-
- union
- {
- struct
- {
- nv_scalar b00, b10, b20, p; // standard names for components
- nv_scalar b01, b11, b21, q; // standard names for components
- nv_scalar b02, b12, b22, r; // standard names for components
- nv_scalar x, y, z, w; // standard names for components
- };
- };
-
- nv_scalar mat_array[16]; // array access
- };
-};
-
-const vec4 operator*(const mat4&, const vec4&);
-const vec4 operator*(const vec4&, const mat4&);
-
-// quaternion
-struct DECLSPEC_NV_MATH quat
-{
-public:
- quat(nv_scalar x = 0, nv_scalar y = 0, nv_scalar z = 0, nv_scalar w = 1);
- quat(const quat& quat);
- quat(const vec3& axis, nv_scalar angle);
- quat(const mat3& rot);
- quat& operator=(const quat& quat);
-
- quat operator-() { return quat(-x, -y, -z, -w); }
- quat Inverse();
- void Normalize();
- void FromMatrix(const mat3& mat);
- void ToMatrix(mat3& mat) const;
- quat& operator*=(const quat& quat);
- static const quat Identity;
-
- nv_scalar& operator[](int i) { return comp[i]; }
- const nv_scalar operator[](int i) const { return comp[i]; }
- union
- {
- struct
- {
- nv_scalar x, y, z, w;
- };
-
- nv_scalar comp[4];
- };
-};
-
-const quat operator*(const quat&, const quat&);
-extern quat& conj(quat& p, const quat& q);
-extern quat& add_quats(quat& p, const quat& q1, const quat& q2);
-extern nv_scalar dot(const quat& p, const quat& q);
-extern quat& dot(nv_scalar s, const quat& p, const quat& q);
-extern quat& slerp_quats(quat& p, nv_scalar s, const quat& q1, const quat& q2);
-extern quat& axis_to_quat(quat& q, const vec3& a, const nv_scalar phi);
-extern mat3& quat_2_mat(mat3& M, const quat& q);
-extern quat& mat_2_quat(quat& q, const mat3& M);
-
-// constant algebraic values
-const nv_scalar array16_id[] = {nv_one, nv_zero, nv_zero, nv_zero, nv_zero, nv_one, nv_zero, nv_zero, nv_zero, nv_zero,
- nv_one, nv_zero, nv_zero, nv_zero, nv_zero, nv_one};
-
-const nv_scalar array16_null[] = {nv_zero, nv_zero, nv_zero, nv_zero, nv_zero, nv_zero, nv_zero, nv_zero, nv_zero,
- nv_zero, nv_zero, nv_zero, nv_zero, nv_zero, nv_zero, nv_zero};
-
-const nv_scalar array16_scale_bias[] = {nv_zero_5, nv_zero, nv_zero, nv_zero, nv_zero, nv_zero_5, nv_zero, nv_zero,
- nv_zero, nv_zero, nv_zero_5, nv_zero, nv_zero_5, nv_zero_5, nv_zero_5, nv_one};
-
-const nv_scalar array9_id[] = {nv_one, nv_zero, nv_zero, nv_zero, nv_one, nv_zero, nv_zero, nv_zero, nv_one};
-
-const vec2 vec2_null(nv_zero, nv_zero);
-const vec4 vec4_one(nv_one, nv_one, nv_one, nv_one);
-const vec3 vec3_one(nv_one, nv_one, nv_one);
-const vec3 vec3_null(nv_zero, nv_zero, nv_zero);
-const vec3 vec3_x(nv_one, nv_zero, nv_zero);
-const vec3 vec3_y(nv_zero, nv_one, nv_zero);
-const vec3 vec3_z(nv_zero, nv_zero, nv_one);
-const vec3 vec3_neg_x(-nv_one, nv_zero, nv_zero);
-const vec3 vec3_neg_y(nv_zero, -nv_one, nv_zero);
-const vec3 vec3_neg_z(nv_zero, nv_zero, -nv_one);
-const vec4 vec4_null(nv_zero, nv_zero, nv_zero, nv_zero);
-const vec4 vec4_x(nv_one, nv_zero, nv_zero, nv_zero);
-const vec4 vec4_neg_x(-nv_one, nv_zero, nv_zero, nv_zero);
-const vec4 vec4_y(nv_zero, nv_one, nv_zero, nv_zero);
-const vec4 vec4_neg_y(nv_zero, -nv_one, nv_zero, nv_zero);
-const vec4 vec4_z(nv_zero, nv_zero, nv_one, nv_zero);
-const vec4 vec4_neg_z(nv_zero, nv_zero, -nv_one, nv_zero);
-const vec4 vec4_w(nv_zero, nv_zero, nv_zero, nv_one);
-const vec4 vec4_neg_w(nv_zero, nv_zero, nv_zero, -nv_one);
-const quat quat_id(nv_zero, nv_zero, nv_zero, nv_one);
-const mat4 mat4_id(array16_id);
-const mat3 mat3_id(array9_id);
-const mat4 mat4_null(array16_null);
-const mat4 mat4_scale_bias(array16_scale_bias);
-
-// normalizes a vector and return a reference of itself
-extern vec3& normalize(vec3& u);
-extern vec4& normalize(vec4& u);
-
-// Computes the squared magnitude
-inline nv_scalar nv_sq_norm(const vec3& n) { return n.x * n.x + n.y * n.y + n.z * n.z; }
-inline nv_scalar nv_sq_norm(const vec4& n) { return n.x * n.x + n.y * n.y + n.z * n.z + n.w * n.w; }
-// Computes the magnitude
-inline nv_scalar nv_norm(const vec3& n) { return _sqrt(nv_sq_norm(n)); }
-inline nv_scalar nv_norm(const vec4& n) { return _sqrt(nv_sq_norm(n)); }
-// computes the cross product ( v cross w) and stores the result in u
-// i.e. u = v cross w
-extern vec3& cross(vec3& u, const vec3& v, const vec3& w);
-
-// computes the dot product ( v dot w) and stores the result in u
-// i.e. u = v dot w
-extern nv_scalar& dot(nv_scalar& u, const vec3& v, const vec3& w);
-extern nv_scalar dot(const vec3& v, const vec3& w);
-extern nv_scalar& dot(nv_scalar& u, const vec4& v, const vec4& w);
-extern nv_scalar dot(const vec4& v, const vec4& w);
-extern nv_scalar& dot(nv_scalar& u, const vec3& v, const vec4& w);
-extern nv_scalar dot(const vec3& v, const vec4& w);
-extern nv_scalar& dot(nv_scalar& u, const vec4& v, const vec3& w);
-extern nv_scalar dot(const vec4& v, const vec3& w);
-
-// compute the reflected vector R of L w.r.t N - vectors need to be
-// normalized
-//
-// R N L
-// _ _
-// |\ ^ /|
-// \ | /
-// \ | /
-// \|/
-// +
-extern vec3& reflect(vec3& r, const vec3& n, const vec3& l);
-
-// Computes u = v * lambda + u
-extern vec3& madd(vec3& u, const vec3& v, const nv_scalar& lambda);
-// Computes u = v * lambda
-extern vec3& mult(vec3& u, const vec3& v, const nv_scalar& lambda);
-// Computes u = v * w
-extern vec3& mult(vec3& u, const vec3& v, const vec3& w);
-// Computes u = v + w
-extern vec3& add(vec3& u, const vec3& v, const vec3& w);
-// Computes u = v - w
-extern vec3& sub(vec3& u, const vec3& v, const vec3& w);
-
-// Computes u = u * s
-extern vec3& scale(vec3& u, const nv_scalar s);
-extern vec4& scale(vec4& u, const nv_scalar s);
-
-// Computes u = M * v
-extern vec3& mult(vec3& u, const mat3& M, const vec3& v);
-extern vec4& mult(vec4& u, const mat4& M, const vec4& v);
-
-// Computes u = v * M
-extern vec3& mult(vec3& u, const vec3& v, const mat3& M);
-extern vec4& mult(vec4& u, const vec4& v, const mat4& M);
-
-// Computes u = M(4x4) * v and divides by w
-extern vec3& mult_pos(vec3& u, const mat4& M, const vec3& v);
-// Computes u = M(4x4) * v
-extern vec3& mult_dir(vec3& u, const mat4& M, const vec3& v);
-// Computes u = M(4x4) * v and does not divide by w (assumed to be 1)
-extern vec3& mult(vec3& u, const mat4& M, const vec3& v);
-
-// Computes u = v * M(4x4) and divides by w
-extern vec3& mult_pos(vec3& u, const vec3& v, const mat4& M);
-// Computes u = v * M(4x4)
-extern vec3& mult_dir(vec3& u, const vec3& v, const mat4& M);
-// Computes u = v * M(4x4) and does not divide by w (assumed to be 1)
-extern vec3& mult(vec3& u, const vec3& v, const mat4& M);
-
-// Computes A += B
-extern mat4& add(mat4& A, const mat4& B);
-extern mat3& add(mat3& A, const mat3& B);
-
-// Computes C = A * B
-extern mat4& mult(mat4& C, const mat4& A, const mat4& B);
-extern mat3& mult(mat3& C, const mat3& A, const mat3& B);
-
-// Computes B = Transpose(A)
-// T
-// B = A
-extern mat3& transpose(mat3& B, const mat3& A);
-extern mat4& transpose(mat4& B, const mat4& A);
-extern mat3& transpose(mat3& B);
-extern mat4& transpose(mat4& B);
-
-// Computes B = inverse(A)
-// -1
-// B = A
-extern mat4& invert(mat4& B, const mat4& A);
-extern mat3& invert(mat3& B, const mat3& A);
-
-// Computes B = inverse(A)
-// T T
-// (R t) (R -R t)
-// assuming that A = (0 1) so that B = (0 1)
-// B = A
-extern mat4& invert_rot_trans(mat4& B, const mat4& A);
-
-extern mat4& look_at(mat4& M, const vec3& eye, const vec3& center, const vec3& up);
-extern mat4& frustum(mat4& M, const nv_scalar l, const nv_scalar r, const nv_scalar b, const nv_scalar t,
- const nv_scalar n, const nv_scalar f);
-
-extern mat4& perspective(mat4& M, const nv_scalar fovy, const nv_scalar aspect, const nv_scalar n, const nv_scalar f);
-
-// quaternion
-extern quat& normalize(quat& p);
-extern quat& conj(quat& p);
-extern quat& conj(quat& p, const quat& q);
-extern quat& add_quats(quat& p, const quat& q1, const quat& q2);
-extern quat& axis_to_quat(quat& q, const vec3& a, const nv_scalar phi);
-extern mat3& quat_2_mat(mat3& M, const quat& q);
-extern quat& mat_2_quat(quat& q, const mat3& M);
-extern quat& mat_2_quat(quat& q, const mat4& M);
-
-// surface properties
-extern mat3& tangent_basis(mat3& basis, const vec3& v0, const vec3& v1, const vec3& v2, const vec2& t0, const vec2& t1,
- const vec2& t2, const vec3& n);
-
-// linear interpolation
-inline nv_scalar lerp(nv_scalar t, nv_scalar a, nv_scalar b) { return a * (nv_one - t) + t * b; }
-inline vec3& lerp(vec3& w, const nv_scalar& t, const vec3& u, const vec3& v)
-{
- w.x = lerp(t, u.x, v.x);
- w.y = lerp(t, u.y, v.y);
- w.z = lerp(t, u.z, v.z);
- return w;
-}
-
-// utilities
-inline nv_scalar nv_min(const nv_scalar& lambda, const nv_scalar& n) { return (lambda < n) ? lambda : n; }
-inline nv_scalar nv_max(const nv_scalar& lambda, const nv_scalar& n) { return (lambda > n) ? lambda : n; }
-inline nv_scalar nv_clamp(nv_scalar u, const nv_scalar min, const nv_scalar max)
-{
- u = (u < min) ? min : u;
- u = (u > max) ? max : u;
- return u;
-}
-
-extern nv_scalar nv_random();
-
-extern quat& trackball(quat& q, vec2& pt1, vec2& pt2, nv_scalar trackballsize);
-
-extern vec3& cube_map_normal(int i, int x, int y, int cubesize, vec3& v);
-
-// geometry
-// computes the area of a triangle
-extern nv_scalar nv_area(const vec3& v1, const vec3& v2, const vec3& v3);
-// computes the perimeter of a triangle
-extern nv_scalar nv_perimeter(const vec3& v1, const vec3& v2, const vec3& v3);
-// find the inscribed circle
-extern nv_scalar nv_find_in_circle(vec3& center, const vec3& v1, const vec3& v2, const vec3& v3);
-// find the circumscribed circle
-extern nv_scalar nv_find_circ_circle(vec3& center, const vec3& v1, const vec3& v2, const vec3& v3);
-
-// fast cosine functions
-extern nv_scalar fast_cos(const nv_scalar x);
-extern nv_scalar ffast_cos(const nv_scalar x);
-
-// determinant
-nv_scalar det(const mat3& A);
-
-extern void nv_is_valid(const vec3& v);
-extern void nv_is_valid(nv_scalar lambda);
-
-#endif // nv_algebraH
diff --git a/src/editors/ECore/Engine/nv_math.h b/src/editors/ECore/Engine/nv_math.h
deleted file mode 100644
index fc8859f70f3..00000000000
--- a/src/editors/ECore/Engine/nv_math.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*********************************************************************NVMH1****
-File:
-nv_math.h
-
-Copyright (C) 1999, 2002 NVIDIA Corporation
-This file is provided without support, instruction, or implied warranty of any
-kind. NVIDIA makes no guarantee of its fitness for a particular purpose and is
-not liable under any circumstances for any damages or loss whatsoever arising
-from the use or inability to use this file or items derived from it.
-
-Comments:
-
-
-******************************************************************************/
-#ifndef _nv_math_h_
-#define _nv_math_h_
-
-#ifndef _nv_mathdecl_h_
-#include "nv_mathdecl.h"
-#endif // _nv_mathdecl_h_
-
-#include
-
-typedef f32 nv_scalar;
-
-#define nv_zero nv_scalar(0)
-#define nv_zero_5 nv_scalar(0.5)
-#define nv_one nv_scalar(1.0)
-#define nv_two nv_scalar(2)
-#define nv_half_pi nv_scalar(3.14159265358979323846264338327950288419716939937510582 * 0.5)
-#define nv_quarter_pi nv_scalar(3.14159265358979323846264338327950288419716939937510582 * 0.25)
-#define nv_pi nv_scalar(3.14159265358979323846264338327950288419716939937510582)
-#define nv_two_pi nv_scalar(3.14159265358979323846264338327950288419716939937510582 * 2.0)
-#define nv_oo_pi nv_one / nv_pi
-#define nv_oo_two_pi nv_one / nv_two_pi
-#define nv_oo_255 nv_one / nv_scalar(255)
-#define nv_oo_128 nv_one / nv_scalar(128)
-#define nv_to_rad nv_pi / nv_scalar(180)
-#define nv_to_deg nv_scalar(180) / nv_pi
-#define nv_eps nv_scalar(10e-6)
-#define nv_double_eps nv_scalar(10e-6) * nv_two
-#define nv_big_eps nv_scalar(10e-6)
-#define nv_small_eps nv_scalar(10e-2)
-
-template
-struct vec3t;
-struct vec2;
-struct vec4;
-
-#ifndef _nv_algebra_h_
-#include "nv_algebra.h"
-#endif // _nv_algebra_h_
-
-#endif //_nv_math_h_
diff --git a/src/editors/ECore/Engine/nv_mathdecl.h b/src/editors/ECore/Engine/nv_mathdecl.h
deleted file mode 100644
index 8a3ed4b40a9..00000000000
--- a/src/editors/ECore/Engine/nv_mathdecl.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*********************************************************************NVMH1****
-File:
-nv_mathdecl.h
-
-Copyright (C) 1999, 2002 NVIDIA Corporation
-This file is provided without support, instruction, or implied warranty of any
-kind. NVIDIA makes no guarantee of its fitness for a particular purpose and is
-not liable under any circumstances for any damages or loss whatsoever arising
-from the use or inability to use this file or items derived from it.
-
-Comments:
-
-
-******************************************************************************/
-
-#ifndef _nv_mathdecl_h_
-#define _nv_mathdecl_h_
-
-#ifdef NV_MATH_DLL
-#include "xrCore/Platform.h"
-#ifdef NV_MATH_EXPORTS
-#define DECLSPEC_NV_MATH XR_EXPORT
-#else
-#define DECLSPEC_NV_MATH XR_IMPORT
-#endif
-
-#else
-#define DECLSPEC_NV_MATH
-#endif
-
-#endif // _nv_mathdecl_h_
diff --git a/src/editors/ECore/stdafx.h b/src/editors/ECore/stdafx.h
index 8ec996b565e..d50ebde0fae 100644
--- a/src/editors/ECore/stdafx.h
+++ b/src/editors/ECore/stdafx.h
@@ -57,13 +57,17 @@ __inline float modff(float a, float* b)
}
__inline float expf(float val) { return ::exp(val); }*/
+/*
#ifdef _ECOREB
#define ECORE_API XR_EXPORT
#define ENGINE_API XR_EXPORT
#else
#define ECORE_API XR_IMPORT
#define ENGINE_API XR_IMPORT
-#endif
+#endif*/
+
+#define ECORE_API XR_EXPORT
+#define ENGINE_API XR_IMPORT
#define DLL_API XR_IMPORT
#define PropertyGP(a, b) __declspec(property(get = a, put = b))
@@ -102,7 +106,9 @@ typedef TMsgDlgBtn TMsgDlgButtons[mbHelp];
#include "xrCore/_stl_extensions.h"
#include "xrCore/_types.h"
#include "xrCore/_fbox.h"
+#include "xrCore/xr_token.h"
#include "xrCommon/xr_vector.h"
+#include "xrCommon/xr_string.h"
#include "xrCore/Animation/Bone.hpp"
#include "xrCore/Animation/Motion.hpp"
diff --git a/src/editors/xrEProps/PropertiesList.h b/src/editors/xrEProps/PropertiesList.h
index 19e2358a5f6..ee392a7dfb0 100644
--- a/src/editors/xrEProps/PropertiesList.h
+++ b/src/editors/xrEProps/PropertiesList.h
@@ -167,7 +167,7 @@ class XR_EPROPS_API TProperties : public TForm
{
bool expand;
};
- DEFINE_MAP(AnsiString, SFolderStore, FolderStoreMap, FolderStorePairIt);
+ DEFINE_MAP(xr_string, SFolderStore, FolderStoreMap, FolderStorePairIt);
FolderStoreMap FolderStorage;
void FolderStore();
void FolderRestore();
diff --git a/src/xrCore/_std_extensions.h b/src/xrCore/_std_extensions.h
index 518e7f604fb..bafd840d7a7 100644
--- a/src/xrCore/_std_extensions.h
+++ b/src/xrCore/_std_extensions.h
@@ -28,7 +28,7 @@
#undef max
#endif
-#ifdef _EDITOR
+#if 0//def _EDITOR
IC char* strncpy_s(char* strDestination, size_t sizeInBytes, const char* strSource, size_t count)
{
return strncpy(strDestination, strSource, count);
@@ -138,7 +138,7 @@ IC s64 _max(s64 x, s64 y) { return x - ((x - y) & ((x - y) >> (sizeof(s64) * 8 -
IC char* strext(const char* S) { return (char*)strrchr(S, '.'); }
IC size_t xr_strlen(const char* S) { return strlen(S); }
-#ifndef _EDITOR
+//#ifndef _EDITOR
#ifndef MASTER_GOLD
inline int xr_strcpy(LPSTR destination, size_t const destination_size, LPCSTR source)
@@ -214,7 +214,7 @@ inline int xr_strcat(char (&destination)[count], LPCSTR source)
{
return xr_strcat(destination, count, source);
}
-#endif // #ifndef _EDITOR
+//#endif // #ifndef _EDITOR
inline void MemFill32(void* dst, u32 value, size_t dstSize)
{
diff --git a/src/xrCore/string_concatenations.h b/src/xrCore/string_concatenations.h
index 8d2ebe62efb..a896c7ec721 100644
--- a/src/xrCore/string_concatenations.h
+++ b/src/xrCore/string_concatenations.h
@@ -1,7 +1,7 @@
#ifndef STRING_CONCATENATIONS_H
#define STRING_CONCATENATIONS_H
-#ifndef _EDITOR
+#if 1//ndef _EDITOR
pstr XRCORE_API strconcat(int dest_sz, pstr dest, pcstr S1, pcstr S2);
pstr XRCORE_API strconcat(int dest_sz, pstr dest, pcstr S1, pcstr S2, pcstr S3);
diff --git a/src/xrEngine/GameMtlLib.h b/src/xrEngine/GameMtlLib.h
index 13a85341f90..4fa738de64c 100644
--- a/src/xrEngine/GameMtlLib.h
+++ b/src/xrEngine/GameMtlLib.h
@@ -48,7 +48,7 @@ class IWriter;
#ifndef MTL_EXPORT_API
#ifdef _EDITOR
-#include "ElTree.hpp"
+//#include "ElTree.hpp"
#define MTL_EXPORT_API ECORE_API
#else
#define MTL_EXPORT_API ENGINE_API