Compare commits
31 Commits
v0.0.104.5
...
v0.0.105.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7b6cab626e | ||
|
|
736a63e89f | ||
|
|
a74d485d1c | ||
|
|
b7f276f849 | ||
|
|
e0be70f5e6 | ||
|
|
4ff212f2f3 | ||
|
|
af8823c508 | ||
|
|
c27aa6a114 | ||
|
|
df77572fe7 | ||
|
|
8c47024960 | ||
|
|
16a7b893e4 | ||
| 4a38f077a3 | |||
|
|
e17aa16086 | ||
|
|
316359a395 | ||
|
|
226f2adda4 | ||
|
|
d3f9b74ba1 | ||
|
|
ce999d226d | ||
| 032e2ae668 | |||
|
|
bc9a5bfc72 | ||
|
|
8e73755d80 | ||
|
|
2f3cb43807 | ||
|
|
550962f1e6 | ||
|
|
c86fb57710 | ||
|
|
daacf6ae02 | ||
|
|
066e955933 | ||
|
|
bba534be3c | ||
|
|
e473d0eb7e | ||
|
|
aab26d2e35 | ||
|
|
b9305d1fb9 | ||
|
|
f9c4700e7d | ||
|
|
239f7b8fa8 |
BIN
B3dIcon.ico
Normal file
BIN
B3dIcon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 108 KiB |
1834
Blocks3D.vcproj
1834
Blocks3D.vcproj
File diff suppressed because it is too large
Load Diff
BIN
Dialogs.aps
Normal file
BIN
Dialogs.aps
Normal file
Binary file not shown.
164
Dialogs.rc
164
Dialogs.rc
@@ -1,121 +1,43 @@
|
|||||||
// Microsoft Visual C++ generated resource script.
|
// Generated by ResEdit 1.6.6
|
||||||
//
|
// Copyright (C) 2006-2015
|
||||||
#include "resource.h"
|
// http://www.resedit.net
|
||||||
|
|
||||||
#define APSTUDIO_READONLY_SYMBOLS
|
#include <windows.h>
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
#include <commctrl.h>
|
||||||
//
|
#include <richedit.h>
|
||||||
// Generated from the TEXTINCLUDE 2 resource.
|
#include "src/include/resource.h"
|
||||||
//
|
|
||||||
#include "afxres.h"
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
#undef APSTUDIO_READONLY_SYMBOLS
|
//
|
||||||
|
// Bitmap resources
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
//
|
||||||
// Neutral resources
|
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_CAN
|
||||||
|
IDB_BITMAP1 BITMAP "Parts.bmp"
|
||||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
|
|
||||||
#ifdef _WIN32
|
|
||||||
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
|
||||||
#pragma code_page(1252)
|
//
|
||||||
#endif //_WIN32
|
// Dialog resources
|
||||||
|
//
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
||||||
//
|
IDD_DIALOG1 DIALOG 0, 0, 295, 43
|
||||||
// Icon
|
STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SETFOREGROUND | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU
|
||||||
//
|
EXSTYLE WS_EX_WINDOWEDGE
|
||||||
|
CAPTION "Insert Object"
|
||||||
// Icon with lowest ID value placed first to ensure application icon
|
FONT 8, "Ms Shell Dlg"
|
||||||
// remains consistent on all systems.
|
{
|
||||||
IDI_ICON1 ICON "roblox_RN1_icon.ico"
|
EDITTEXT IDC_EDIT1, 35, 6, 195, 14, ES_AUTOHSCROLL, WS_EX_LEFT
|
||||||
#endif // Neutral resources
|
LTEXT "Class:", 0, 10, 9, 20, 9, SS_LEFT, WS_EX_LEFT
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
PUSHBUTTON "Cancel", IDCANCEL, 237, 24, 50, 14, 0, WS_EX_LEFT
|
||||||
|
DEFPUSHBUTTON "OK", IDOK, 237, 6, 50, 14, 0, WS_EX_LEFT
|
||||||
|
}
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
// English (Canada) resources
|
|
||||||
|
|
||||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENC)
|
//
|
||||||
#ifdef _WIN32
|
// Icon resources
|
||||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_CAN
|
//
|
||||||
#pragma code_page(1252)
|
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_CAN
|
||||||
#endif //_WIN32
|
IDI_ICON1 ICON "FatB3dIcon.ico"
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// Bitmap
|
|
||||||
//
|
|
||||||
|
|
||||||
IDB_BITMAP1 BITMAP "Parts.bmp"
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// Dialog
|
|
||||||
//
|
|
||||||
|
|
||||||
IDD_DIALOG1 DIALOGEX 0, 0, 304, 46
|
|
||||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
|
||||||
CAPTION "Dialog"
|
|
||||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
|
||||||
BEGIN
|
|
||||||
DEFPUSHBUTTON "OK",IDOK,247,7,50,14
|
|
||||||
PUSHBUTTON "Cancel",IDCANCEL,247,24,50,14
|
|
||||||
EDITTEXT IDC_EDIT1,68,7,162,14,ES_AUTOHSCROLL
|
|
||||||
LTEXT "Class:",-1,43,7,20,8
|
|
||||||
END
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef APSTUDIO_INVOKED
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// TEXTINCLUDE
|
|
||||||
//
|
|
||||||
|
|
||||||
1 TEXTINCLUDE
|
|
||||||
BEGIN
|
|
||||||
"resource.h\0"
|
|
||||||
END
|
|
||||||
|
|
||||||
|
|
||||||
3 TEXTINCLUDE
|
|
||||||
BEGIN
|
|
||||||
"\r\n"
|
|
||||||
END
|
|
||||||
|
|
||||||
#endif // APSTUDIO_INVOKED
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// DESIGNINFO
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifdef APSTUDIO_INVOKED
|
|
||||||
GUIDELINES DESIGNINFO
|
|
||||||
BEGIN
|
|
||||||
IDD_DIALOG1, DIALOG
|
|
||||||
BEGIN
|
|
||||||
LEFTMARGIN, 7
|
|
||||||
RIGHTMARGIN, 297
|
|
||||||
TOPMARGIN, 7
|
|
||||||
BOTTOMMARGIN, 39
|
|
||||||
END
|
|
||||||
END
|
|
||||||
#endif // APSTUDIO_INVOKED
|
|
||||||
|
|
||||||
#endif // English (Canada) resources
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef APSTUDIO_INVOKED
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// Generated from the TEXTINCLUDE 3 resource.
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
#endif // not APSTUDIO_INVOKED
|
|
||||||
|
|
||||||
BIN
FatB3dIcon.ico
Normal file
BIN
FatB3dIcon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 108 KiB |
@@ -1,9 +1,9 @@
|
|||||||
;InnoSetupVersion=5.5.7
|
;InnoSetupVersion=5.4.3
|
||||||
|
|
||||||
[Setup]
|
[Setup]
|
||||||
AppName=Blocks3D
|
AppName=Blocks3D
|
||||||
AppId={{4C5DF268-0208-4CDE-A7F0-65F7E2CB5067}
|
AppId={{4C5DF268-0208-4CDE-A7F0-65F7E2CB5067}
|
||||||
AppVersion=v0_0_104_4
|
AppVersion=v0.0.105.0
|
||||||
AppPublisherURL=http://blocks3d.com/
|
AppPublisherURL=http://blocks3d.com/
|
||||||
AppSupportURL=http://blocks3d.com/
|
AppSupportURL=http://blocks3d.com/
|
||||||
AppUpdatesURL=http://blocks3d.com/
|
AppUpdatesURL=http://blocks3d.com/
|
||||||
@@ -40,8 +40,6 @@ Name: "{group}\Blocks3D Editor"; Filename: "{app}\Blocks3D.exe"; Tasks: startscu
|
|||||||
Name: "{userdesktop}\Play Blocks3D"; Filename: "{%programfiles}\Internet Explorer\iexplore.exe"; Parameters: "http://www.blocks3d.com/Games"; IconFilename: "{app}\Blocks3D.exe"; Tasks: startscut;
|
Name: "{userdesktop}\Play Blocks3D"; Filename: "{%programfiles}\Internet Explorer\iexplore.exe"; Parameters: "http://www.blocks3d.com/Games"; IconFilename: "{app}\Blocks3D.exe"; Tasks: startscut;
|
||||||
Name: "{userdesktop}\Blocks3D Editor"; Filename: "{app}\Blocks3D.exe"; Tasks: desktopicon
|
Name: "{userdesktop}\Blocks3D Editor"; Filename: "{app}\Blocks3D.exe"; Tasks: desktopicon
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[Tasks]
|
[Tasks]
|
||||||
Name: "instvc"; Description: "Install Visual C++ Redistributable 2005 SP1 (Requires elevated permissions)";
|
Name: "instvc"; Description: "Install Visual C++ Redistributable 2005 SP1 (Requires elevated permissions)";
|
||||||
Name: "desktopicon"; Description: "Create Desktop Icons";
|
Name: "desktopicon"; Description: "Create Desktop Icons";
|
||||||
|
|||||||
0
Manifest.xml
Normal file
0
Manifest.xml
Normal file
6
ODE Copyright.txt
Normal file
6
ODE Copyright.txt
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
Open Dynamics Engine
|
||||||
|
|
||||||
|
Copyright (c) 2001-2004,
|
||||||
|
Russell L. Smith.
|
||||||
|
|
||||||
|
All rights reserved.
|
||||||
2064
resource.h
2064
resource.h
File diff suppressed because it is too large
Load Diff
@@ -26,6 +26,7 @@ class CameraController {
|
|||||||
void panRight();
|
void panRight();
|
||||||
void tiltUp();
|
void tiltUp();
|
||||||
void tiltDown();
|
void tiltDown();
|
||||||
|
void zoomExtents();
|
||||||
void Zoom(short delta);
|
void Zoom(short delta);
|
||||||
bool onMouseWheel(int x, int y, short delta);
|
bool onMouseWheel(int x, int y, short delta);
|
||||||
GCamera* getCamera();
|
GCamera* getCamera();
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include "PartInstance.h"
|
#include "PartInstance.h"
|
||||||
#include "rapidxml/rapidxml.hpp"
|
#include "rapidxml/rapidxml.hpp"
|
||||||
#include "GuiRootInstance.h"
|
#include "GuiRootInstance.h"
|
||||||
|
#include "XplicitNgine/XplicitNgine.h"
|
||||||
|
|
||||||
class GuiRootInstance;
|
class GuiRootInstance;
|
||||||
|
|
||||||
@@ -23,6 +24,7 @@ public:
|
|||||||
void drawMessage(RenderDevice*);
|
void drawMessage(RenderDevice*);
|
||||||
WorkspaceInstance* getWorkspace();
|
WorkspaceInstance* getWorkspace();
|
||||||
LevelInstance * getLevel();
|
LevelInstance * getLevel();
|
||||||
|
XplicitNgine * getEngine();
|
||||||
std::string message;
|
std::string message;
|
||||||
std::string _loadedFileName;
|
std::string _loadedFileName;
|
||||||
bool showMessage;
|
bool showMessage;
|
||||||
@@ -38,6 +40,7 @@ public:
|
|||||||
void clearLevel();
|
void clearLevel();
|
||||||
void toggleRun();
|
void toggleRun();
|
||||||
bool isRunning();
|
bool isRunning();
|
||||||
|
void resetEngine();
|
||||||
#if _DEBUG
|
#if _DEBUG
|
||||||
void modXMLLevel(float modY);
|
void modXMLLevel(float modY);
|
||||||
#endif
|
#endif
|
||||||
@@ -54,4 +57,5 @@ private:
|
|||||||
LevelInstance * level;
|
LevelInstance * level;
|
||||||
GuiRootInstance* guiRoot;
|
GuiRootInstance* guiRoot;
|
||||||
bool running;
|
bool running;
|
||||||
|
XplicitNgine * xplicitNgine;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "instance.h"
|
#include "instance.h"
|
||||||
#include "enum.h"
|
#include "enum.h"
|
||||||
|
#include <ode/ode.h>
|
||||||
|
|
||||||
class PVInstance :
|
class PVInstance :
|
||||||
public Instance
|
public Instance
|
||||||
|
|||||||
@@ -29,7 +29,8 @@ public:
|
|||||||
//Variables
|
//Variables
|
||||||
Color3 color;
|
Color3 color;
|
||||||
bool canCollide;
|
bool canCollide;
|
||||||
bool anchored;
|
dBodyID physBody;
|
||||||
|
dGeomID physGeom[3];
|
||||||
|
|
||||||
//Getters
|
//Getters
|
||||||
Vector3 getPosition();
|
Vector3 getPosition();
|
||||||
@@ -47,10 +48,14 @@ public:
|
|||||||
void setVelocity(Vector3);
|
void setVelocity(Vector3);
|
||||||
void setRotVelocity(Vector3);
|
void setRotVelocity(Vector3);
|
||||||
void setCFrame(CoordinateFrame);
|
void setCFrame(CoordinateFrame);
|
||||||
|
void setCFrameNoSync(CoordinateFrame);
|
||||||
void setSize(Vector3);
|
void setSize(Vector3);
|
||||||
void setShape(Enum::Shape::Value shape);
|
void setShape(Enum::Shape::Value shape);
|
||||||
void setChanged();
|
void setChanged();
|
||||||
void setSurface(int face, Enum::SurfaceType::Value surface);
|
void setSurface(int face, Enum::SurfaceType::Value surface);
|
||||||
|
void setAnchored(bool anchored);
|
||||||
|
bool isAnchored();
|
||||||
|
float getMass();
|
||||||
|
|
||||||
//Collision
|
//Collision
|
||||||
bool collides(PartInstance * part);
|
bool collides(PartInstance * part);
|
||||||
@@ -60,6 +65,7 @@ public:
|
|||||||
virtual std::vector<PROPGRIDITEM> getProperties();
|
virtual std::vector<PROPGRIDITEM> getProperties();
|
||||||
virtual void PropUpdate(LPPROPGRIDITEM &pItem);
|
virtual void PropUpdate(LPPROPGRIDITEM &pItem);
|
||||||
private:
|
private:
|
||||||
|
bool anchored;
|
||||||
Vector3 position;
|
Vector3 position;
|
||||||
Vector3 size;
|
Vector3 size;
|
||||||
Vector3 velocity;
|
Vector3 velocity;
|
||||||
@@ -67,4 +73,4 @@ private:
|
|||||||
bool changed;
|
bool changed;
|
||||||
Box itemBox;
|
Box itemBox;
|
||||||
GLuint glList;
|
GLuint glList;
|
||||||
};
|
};
|
||||||
@@ -9,5 +9,6 @@ public:
|
|||||||
WorkspaceInstance(void);
|
WorkspaceInstance(void);
|
||||||
~WorkspaceInstance(void);
|
~WorkspaceInstance(void);
|
||||||
void clearChildren();
|
void clearChildren();
|
||||||
|
void zoomToExtents();
|
||||||
std::vector<PartInstance *> partObjects;
|
std::vector<PartInstance *> partObjects;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "DataModelV2/DataModelInstance.h"
|
#include "DataModelV2/DataModelInstance.h"
|
||||||
|
#include "XplicitNgine/XplicitNgine.h"
|
||||||
|
|
||||||
class Application;
|
class Application;
|
||||||
|
|
||||||
@@ -28,6 +28,7 @@ extern std::vector<Instance*> postRenderStack;
|
|||||||
extern std::vector<Instance*> g_selectedInstances;
|
extern std::vector<Instance*> g_selectedInstances;
|
||||||
extern bool running;
|
extern bool running;
|
||||||
extern DataModelInstance* g_dataModel;
|
extern DataModelInstance* g_dataModel;
|
||||||
|
extern XplicitNgine* g_xplicitNgine;
|
||||||
extern Application* g_usableApp;
|
extern Application* g_usableApp;
|
||||||
|
|
||||||
extern GFontRef g_fntdominant;
|
extern GFontRef g_fntdominant;
|
||||||
|
|||||||
19
src/include/XplicitNgine/XplicitNgine.h
Normal file
19
src/include/XplicitNgine/XplicitNgine.h
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <ode/ode.h>
|
||||||
|
#include "DatamodelV2/Instance.h"
|
||||||
|
#include "DatamodelV2/PartInstance.h"
|
||||||
|
|
||||||
|
class XplicitNgine : public Instance
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
XplicitNgine();
|
||||||
|
~XplicitNgine();
|
||||||
|
dWorldID physWorld;
|
||||||
|
dSpaceID physSpace;
|
||||||
|
dJointGroupID contactgroup;
|
||||||
|
|
||||||
|
void step(float stepSize);
|
||||||
|
void createBody(PartInstance* partInstance);
|
||||||
|
void deleteBody(PartInstance* partInstance);
|
||||||
|
void updateBody(PartInstance* partInstance, CoordinateFrame * cFrame);
|
||||||
|
};
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#define IDC_PROPERTYGRID 2000
|
#define IDC_PROPERTYGRID 2000
|
||||||
#define IDC_STATIC 2
|
#define IDC_STATIC 2
|
||||||
|
|
||||||
#define IDE_EDIT 105
|
#define IDC_EDIT1 105
|
||||||
#define IDI_ICON1 102
|
#define IDI_ICON1 102
|
||||||
#define IDB_BITMAP1 103
|
#define IDB_BITMAP1 103
|
||||||
#define IDD_DIALOG1 104
|
#define IDD_DIALOG1 104
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
#include "DataModelV2/ImageButtonInstance.h"
|
#include "DataModelV2/ImageButtonInstance.h"
|
||||||
#include "DataModelV2/DataModelInstance.h"
|
#include "DataModelV2/DataModelInstance.h"
|
||||||
#include "DataModelV2/GuiRootInstance.h"
|
#include "DataModelV2/GuiRootInstance.h"
|
||||||
|
#include "XplicitNgine/XplicitNgine.h"
|
||||||
#include "CameraController.h"
|
#include "CameraController.h"
|
||||||
#include "AudioPlayer.h"
|
#include "AudioPlayer.h"
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
@@ -187,10 +188,9 @@ void Application::onInit() {
|
|||||||
_dataModel->setName("undefined");
|
_dataModel->setName("undefined");
|
||||||
_dataModel->font = g_fntdominant;
|
_dataModel->font = g_fntdominant;
|
||||||
g_dataModel = _dataModel;
|
g_dataModel = _dataModel;
|
||||||
|
|
||||||
//initGUI();
|
|
||||||
|
|
||||||
#ifdef LEGACY_LOAD_G3DFUN_LEVEL
|
#ifdef LEGACY_LOAD_G3DFUN_LEVEL
|
||||||
|
// Anchored this baseplate for XplicitNgine tests
|
||||||
PartInstance* test = makePart();
|
PartInstance* test = makePart();
|
||||||
test->setParent(_dataModel->getWorkspace());
|
test->setParent(_dataModel->getWorkspace());
|
||||||
test->color = Color3(0.2F,0.3F,1);
|
test->color = Color3(0.2F,0.3F,1);
|
||||||
@@ -198,7 +198,8 @@ void Application::onInit() {
|
|||||||
test->setPosition(Vector3(0,0,0));
|
test->setPosition(Vector3(0,0,0));
|
||||||
test->setCFrame(test->getCFrame() * Matrix3::fromEulerAnglesXYZ(0,toRadians(0),toRadians(0)));
|
test->setCFrame(test->getCFrame() * Matrix3::fromEulerAnglesXYZ(0,toRadians(0),toRadians(0)));
|
||||||
test->setSurface(TOP, Enum::SurfaceType::Bumps);
|
test->setSurface(TOP, Enum::SurfaceType::Bumps);
|
||||||
|
test->setAnchored(true);
|
||||||
|
|
||||||
test = makePart();
|
test = makePart();
|
||||||
test->setParent(_dataModel->getWorkspace());
|
test->setParent(_dataModel->getWorkspace());
|
||||||
test->color = Color3(.5F,1,.5F);
|
test->color = Color3(.5F,1,.5F);
|
||||||
@@ -262,9 +263,6 @@ void Application::onInit() {
|
|||||||
test->setPosition(Vector3(-2,5,0));
|
test->setPosition(Vector3(-2,5,0));
|
||||||
test->setSurface(TOP, Enum::SurfaceType::Bumps);
|
test->setSurface(TOP, Enum::SurfaceType::Bumps);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
test = makePart();
|
test = makePart();
|
||||||
test->setParent(_dataModel->getWorkspace());
|
test->setParent(_dataModel->getWorkspace());
|
||||||
test->color = Color3::gray();
|
test->color = Color3::gray();
|
||||||
@@ -294,86 +292,15 @@ void Application::onInit() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Application::onCleanup() {
|
void Application::onCleanup() {
|
||||||
clearInstances();
|
clearInstances();
|
||||||
sky->~Sky();
|
sky->~Sky();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Application::onLogic() {
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
Class HyperSnapSolver
|
|
||||||
|
|
||||||
function getCollisionDepth(Part colliding, part collider);
|
|
||||||
function getFaceCollision(Part colliding, part collider);
|
|
||||||
|
|
||||||
function eject(Part colliding, Part collider)
|
|
||||||
{
|
|
||||||
if(!colliding.canCollide || !collider.canCollide)
|
|
||||||
return;
|
|
||||||
if(getCollisionDepth(colliding, collider) != 0) {
|
|
||||||
int ejectMultiplier, ejectMultipliery = 1-(collider.Friction+colliding.Friction), ejectMultiplierz = 1-(collider.Friction/2+colliding.Friction/2);
|
|
||||||
if(colliding.Anchored)
|
|
||||||
ejectMultiplier = collider.elasticity;
|
|
||||||
int faceCollided = getFaceCollision(colliding, collider);
|
|
||||||
if(faceCollided % 3 == 1)
|
|
||||||
{
|
|
||||||
ejectMultipliery = ejectMultiplier;
|
|
||||||
ejectMultiplier = 1-(collider.Friction+colliding.Friction/2);
|
|
||||||
}
|
|
||||||
else if(faceCollided % 3 == 2)
|
|
||||||
{
|
|
||||||
ejectMultiplierz = ejectMultiplier;
|
|
||||||
ejectMultiplier = 1-(collider.Friction+colliding.Friction/2);
|
|
||||||
}
|
|
||||||
|
|
||||||
collider.Velocity *= Vector3.new(colliding.Velocity.x*ejectMultiplier,colliding.Velocity.y*ejectMultipliery,colliding.Velocity.z)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
double grav = 0.32666666666666666666666666666667;
|
|
||||||
void simGrav(PartInstance * collider)
|
|
||||||
{
|
|
||||||
if(!collider->anchored)
|
|
||||||
{
|
|
||||||
collider->setPosition(collider->getPosition()+collider->getVelocity());
|
|
||||||
collider->setVelocity(collider->getVelocity()-Vector3(0,grav,0));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void eject(PartInstance * colliding, PartInstance * collider)
|
|
||||||
{
|
|
||||||
if(colliding == collider || !colliding->canCollide || !collider->canCollide)
|
|
||||||
return;
|
|
||||||
if(G3D::CollisionDetection::fixedSolidBoxIntersectsFixedSolidBox(collider->getBox(), colliding->getBox()))
|
|
||||||
collider->setVelocity(collider->getVelocity().reflectionDirection(colliding->getCFrame().upVector())/1.3F);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Application::onLogic() {
|
|
||||||
//PhysicsStart
|
|
||||||
for_each (_dataModel->getWorkspace()->partObjects.begin(), _dataModel->getWorkspace()->partObjects.end(), simGrav);
|
|
||||||
for(size_t i = 0; i < _dataModel->getWorkspace()->partObjects.size(); i++)
|
|
||||||
{
|
|
||||||
for(size_t j = 0; j < _dataModel->getWorkspace()->partObjects.size(); j++)
|
|
||||||
{
|
|
||||||
eject(_dataModel->getWorkspace()->partObjects[i], _dataModel->getWorkspace()->partObjects[j]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Application::onNetwork() {
|
void Application::onNetwork() {
|
||||||
// Poll net messages here
|
// Poll net messages here
|
||||||
}
|
}
|
||||||
@@ -391,8 +318,34 @@ std::vector<Instance*> Application::getSelection()
|
|||||||
void Application::onSimulation(RealTime rdt, SimTime sdt, SimTime idt) {
|
void Application::onSimulation(RealTime rdt, SimTime sdt, SimTime idt) {
|
||||||
|
|
||||||
if(_dataModel->isRunning())
|
if(_dataModel->isRunning())
|
||||||
|
{
|
||||||
|
// XplicitNgine Start
|
||||||
|
std::vector<PartInstance *> toDelete;
|
||||||
|
for(size_t i = 0; i < _dataModel->getWorkspace()->partObjects.size(); i++)
|
||||||
|
{
|
||||||
|
PartInstance* partInstance = _dataModel->getWorkspace()->partObjects[i];
|
||||||
|
if(partInstance->getPosition().y < -255)
|
||||||
|
{
|
||||||
|
toDelete.push_back(partInstance);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
_dataModel->getEngine()->createBody(partInstance);
|
||||||
|
}
|
||||||
|
while(toDelete.size() > 0)
|
||||||
|
{
|
||||||
|
PartInstance * p = toDelete.back();
|
||||||
|
toDelete.pop_back();
|
||||||
|
p->setParent(NULL);
|
||||||
|
delete p;
|
||||||
|
}
|
||||||
|
for(int i = 0; i < 6; i++)
|
||||||
|
{
|
||||||
|
_dataModel->getEngine()->step(sdt*2);
|
||||||
|
}
|
||||||
onLogic();
|
onLogic();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
_dataModel->getGuiRoot()->update();
|
_dataModel->getGuiRoot()->update();
|
||||||
|
|
||||||
if(_dataModel->name != _title)
|
if(_dataModel->name != _title)
|
||||||
@@ -407,95 +360,29 @@ void Application::onSimulation(RealTime rdt, SimTime sdt, SimTime idt) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*double getOSVersion() {
|
|
||||||
OSVERSIONINFO osvi;
|
|
||||||
|
|
||||||
ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
|
|
||||||
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
|
||||||
|
|
||||||
GetVersionEx(&osvi);
|
|
||||||
std::string version = Convert(osvi.dwMajorVersion) + "." + Convert(osvi.dwMinorVersion);
|
|
||||||
return ::atof(version.c_str());
|
|
||||||
}*/
|
|
||||||
/*
|
|
||||||
bool IsHolding(int button)
|
|
||||||
{
|
|
||||||
return (GetKeyState(button) >> 1)>0;
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
void Application::onUserInput(UserInput* ui) {
|
void Application::onUserInput(UserInput* ui) {
|
||||||
if(mouseMoveState)
|
if(mouseMoveState)
|
||||||
{
|
{
|
||||||
mouseMoveState = false;
|
mouseMoveState = false;
|
||||||
tool->onMouseMoved(mouse);
|
tool->onMouseMoved(mouse);
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
if(GetHoldKeyState(VK_LCONTROL))
|
|
||||||
{
|
|
||||||
if(GetHoldKeyState('D'))
|
|
||||||
{
|
|
||||||
_messageTime = System::time();
|
|
||||||
if(debugMode())
|
|
||||||
_message = "Debug Mode Disabled";
|
|
||||||
else
|
|
||||||
_message = "Debug Mode Enabled";
|
|
||||||
setDebugMode(!debugMode());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
if(GetHoldKeyState(VK_F8))
|
if(GetHoldKeyState(VK_F8))
|
||||||
{
|
{
|
||||||
_dataModel->getGuiRoot()->setDebugMessage("FOV Set to 10", System::time());
|
_dataModel->getGuiRoot()->setDebugMessage("FOV Set to 10", System::time());
|
||||||
}
|
}
|
||||||
//}
|
|
||||||
|
|
||||||
//_dataModel->mousex = ui->getMouseX();
|
|
||||||
//_dataModel->mousey = ui->getMouseY();
|
|
||||||
mouse.setMouseDown((GetKeyState(VK_LBUTTON) & 0x100) != 0);
|
mouse.setMouseDown((GetKeyState(VK_LBUTTON) & 0x100) != 0);
|
||||||
|
|
||||||
if (GetHoldKeyState(VK_LBUTTON)) {
|
// Camera KB Handling
|
||||||
/* if (_dragging) {
|
if (GetKPBool(VK_OEM_COMMA)) //Left
|
||||||
PartInstance* part = NULL;
|
g_usableApp->cameraController.panLeft();
|
||||||
if(g_selectedInstances.size() > 0)
|
else if (GetKPBool(VK_OEM_PERIOD)) // Right
|
||||||
part = (PartInstance*) g_selectedInstances.at(0);
|
g_usableApp->cameraController.panRight();
|
||||||
Ray dragRay = cameraController.getCamera()->worldRay(mouse.x, mouse.y, renderDevice->getViewport());
|
else if (GetKPBool(0x49)) // Zoom In (I)
|
||||||
std::vector<Instance*> instances = _dataModel->getWorkspace()->getAllChildren();
|
g_usableApp->cameraController.Zoom(1);
|
||||||
for(size_t i = 0; i < instances.size(); i++)
|
else if (GetKPBool(0x4F)) // Zoom Out (O)
|
||||||
{
|
g_usableApp->cameraController.Zoom(-1);
|
||||||
if(PartInstance* moveTo = dynamic_cast<PartInstance*>(instances.at(i)))
|
|
||||||
{
|
|
||||||
float __time = testRay.intersectionTime(moveTo->getBox());
|
|
||||||
float __nearest=std::numeric_limits<float>::infinity();
|
|
||||||
if (__time != inf())
|
|
||||||
{
|
|
||||||
if (__nearest>__time)
|
|
||||||
{
|
|
||||||
// BROKEN
|
|
||||||
//Vector3 closest = (dragRay.closestPoint(moveTo->getPosition()) * 2);
|
|
||||||
//part->setPosition(closest);
|
|
||||||
//part->setPosition(Vector3(floor(closest.x),part->getPosition().y,floor(closest.z)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Sleep(10);
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
// Camera KB Handling {
|
|
||||||
if (GetKPBool(VK_OEM_COMMA)) //Left
|
|
||||||
g_usableApp->cameraController.panLeft();
|
|
||||||
else if (GetKPBool(VK_OEM_PERIOD)) // Right
|
|
||||||
g_usableApp->cameraController.panRight();
|
|
||||||
else if (GetKPBool(0x49)) // Zoom In (I)
|
|
||||||
g_usableApp->cameraController.Zoom(1);
|
|
||||||
else if (GetKPBool(0x4F)) // Zoom Out (O)
|
|
||||||
g_usableApp->cameraController.Zoom(-1);
|
|
||||||
// }
|
|
||||||
|
|
||||||
//readMouseGUIInput();
|
|
||||||
// Add other key handling here
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::changeTool(Tool * newTool)
|
void Application::changeTool(Tool * newTool)
|
||||||
@@ -943,6 +830,8 @@ void Application::run() {
|
|||||||
RealTime rdt = timeStep;
|
RealTime rdt = timeStep;
|
||||||
SimTime sdt = timeStep * rate;
|
SimTime sdt = timeStep * rate;
|
||||||
SimTime idt = desiredFrameDuration * rate;
|
SimTime idt = desiredFrameDuration * rate;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
onSimulation(rdt,sdt,idt);
|
onSimulation(rdt,sdt,idt);
|
||||||
m_simulationWatch.tock();
|
m_simulationWatch.tock();
|
||||||
|
|||||||
@@ -159,6 +159,11 @@ void CameraController::tiltDown()
|
|||||||
setFrame(frame);
|
setFrame(frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CameraController::zoomExtents()
|
||||||
|
{
|
||||||
|
// do some weird jank math
|
||||||
|
}
|
||||||
|
|
||||||
void CameraController::centerCamera(Instance* selection)
|
void CameraController::centerCamera(Instance* selection)
|
||||||
{
|
{
|
||||||
CoordinateFrame frame = CoordinateFrame(g3dCamera.getCoordinateFrame().translation);
|
CoordinateFrame frame = CoordinateFrame(g3dCamera.getCoordinateFrame().translation);
|
||||||
|
|||||||
@@ -33,12 +33,33 @@ DataModelInstance::DataModelInstance(void)
|
|||||||
_loadedFileName="..//skooter.rbxm";
|
_loadedFileName="..//skooter.rbxm";
|
||||||
listicon = 5;
|
listicon = 5;
|
||||||
running = false;
|
running = false;
|
||||||
|
xplicitNgine = NULL;
|
||||||
|
resetEngine();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DataModelInstance::resetEngine()
|
||||||
|
{
|
||||||
|
if(xplicitNgine != NULL)
|
||||||
|
delete xplicitNgine;
|
||||||
|
xplicitNgine = new XplicitNgine();
|
||||||
|
g_xplicitNgine = xplicitNgine;
|
||||||
|
for(size_t i = 0; i < getWorkspace()->partObjects.size(); i++)
|
||||||
|
{
|
||||||
|
PartInstance* partInstance = getWorkspace()->partObjects[i];
|
||||||
|
partInstance->physBody = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
XplicitNgine * DataModelInstance::getEngine()
|
||||||
|
{
|
||||||
|
return xplicitNgine;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataModelInstance::toggleRun()
|
void DataModelInstance::toggleRun()
|
||||||
{
|
{
|
||||||
running = !running;
|
running = !running;
|
||||||
|
//if(!running)
|
||||||
|
//resetEngine();
|
||||||
}
|
}
|
||||||
bool DataModelInstance::isRunning()
|
bool DataModelInstance::isRunning()
|
||||||
{
|
{
|
||||||
@@ -47,6 +68,7 @@ bool DataModelInstance::isRunning()
|
|||||||
|
|
||||||
DataModelInstance::~DataModelInstance(void)
|
DataModelInstance::~DataModelInstance(void)
|
||||||
{
|
{
|
||||||
|
delete xplicitNgine;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
@@ -270,6 +292,7 @@ bool DataModelInstance::scanXMLObject(xml_node<> * scanNode)
|
|||||||
xml_node<> *propNode = node->first_node();
|
xml_node<> *propNode = node->first_node();
|
||||||
xml_node<> *cFrameNode=0;
|
xml_node<> *cFrameNode=0;
|
||||||
xml_node<> *sizeNode=0;
|
xml_node<> *sizeNode=0;
|
||||||
|
xml_node<> *anchoredNode=0;
|
||||||
xml_node<> *shapeNode=0;
|
xml_node<> *shapeNode=0;
|
||||||
xml_node<> *colorNode=0;
|
xml_node<> *colorNode=0;
|
||||||
xml_node<> *brickColorNode=0;
|
xml_node<> *brickColorNode=0;
|
||||||
@@ -285,6 +308,10 @@ bool DataModelInstance::scanXMLObject(xml_node<> * scanNode)
|
|||||||
if (xmlValue=="CFrame" | xmlValue=="CoordinateFrame")
|
if (xmlValue=="CFrame" | xmlValue=="CoordinateFrame")
|
||||||
{
|
{
|
||||||
cFrameNode = partPropNode;
|
cFrameNode = partPropNode;
|
||||||
|
}
|
||||||
|
if (xmlValue=="Anchored")
|
||||||
|
{
|
||||||
|
anchoredNode = partPropNode;
|
||||||
}
|
}
|
||||||
if (xmlValue=="Name")
|
if (xmlValue=="Name")
|
||||||
{
|
{
|
||||||
@@ -396,6 +423,10 @@ bool DataModelInstance::scanXMLObject(xml_node<> * scanNode)
|
|||||||
{
|
{
|
||||||
test->color = bcToRGB(atoi(brickColorNode->value()));
|
test->color = bcToRGB(atoi(brickColorNode->value()));
|
||||||
}
|
}
|
||||||
|
if(anchoredNode)
|
||||||
|
{
|
||||||
|
test->setAnchored(stricmp(anchoredNode->value(), "true") == 0);
|
||||||
|
}
|
||||||
test->setSize(Vector3(sizeX,sizeY+_modY,sizeZ));
|
test->setSize(Vector3(sizeX,sizeY+_modY,sizeZ));
|
||||||
test->setName(newName);
|
test->setName(newName);
|
||||||
CoordinateFrame cf;
|
CoordinateFrame cf;
|
||||||
@@ -448,6 +479,7 @@ bool DataModelInstance::load(const char* filename, bool clearObjects)
|
|||||||
std::string hname = sfilename.substr(begin);
|
std::string hname = sfilename.substr(begin);
|
||||||
std::string tname = hname.substr(0, hname.length() - 5);
|
std::string tname = hname.substr(0, hname.length() - 5);
|
||||||
name = tname;
|
name = tname;
|
||||||
|
resetEngine();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -34,13 +34,11 @@ void GroupInstance::PropUpdate(LPPROPGRIDITEM &pItem)
|
|||||||
|
|
||||||
std::vector<Instance *> GroupInstance::unGroup()
|
std::vector<Instance *> GroupInstance::unGroup()
|
||||||
{
|
{
|
||||||
std::vector<Instance *> child;
|
|
||||||
while(children.size() > 0)
|
while(children.size() > 0)
|
||||||
{
|
{
|
||||||
child.push_back(children[0]);
|
|
||||||
children[0]->setParent(parent);
|
children[0]->setParent(parent);
|
||||||
}
|
}
|
||||||
return child;
|
return std::vector<Instance *>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroupInstance::render(RenderDevice * rd)
|
void GroupInstance::render(RenderDevice * rd)
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
PartInstance::PartInstance(void)
|
PartInstance::PartInstance(void)
|
||||||
{
|
{
|
||||||
PVInstance::PVInstance();
|
PVInstance::PVInstance();
|
||||||
|
physBody = NULL;
|
||||||
glList = glGenLists(1);
|
glList = glGenLists(1);
|
||||||
name = "Unnamed PVItem";
|
name = "Unnamed PVItem";
|
||||||
className = "Part";
|
className = "Part";
|
||||||
@@ -27,6 +28,13 @@ PartInstance::PartInstance(void)
|
|||||||
shape = Enum::Shape::Block;
|
shape = Enum::Shape::Block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float PartInstance::getMass()
|
||||||
|
{
|
||||||
|
if(shape == Enum::Shape::Block)
|
||||||
|
return size.x*size.y*size.z*0.7F;
|
||||||
|
else
|
||||||
|
return 1.3333333333333333333333333333333F*(size.x/2)*(size.y/2)*(size.z/2)*0.7F;
|
||||||
|
}
|
||||||
|
|
||||||
Vector3 PartInstance::getVelocity()
|
Vector3 PartInstance::getVelocity()
|
||||||
{
|
{
|
||||||
@@ -109,27 +117,28 @@ void PartInstance::setSurface(int face, Enum::SurfaceType::Value surface)
|
|||||||
|
|
||||||
void PartInstance::setParent(Instance* prnt)
|
void PartInstance::setParent(Instance* prnt)
|
||||||
{
|
{
|
||||||
|
g_dataModel->getEngine()->deleteBody(this);
|
||||||
Instance * cparent = getParent();
|
Instance * cparent = getParent();
|
||||||
while(cparent != NULL)
|
while(cparent != NULL)
|
||||||
{
|
{
|
||||||
if(WorkspaceInstance* workspace = dynamic_cast<WorkspaceInstance*>(cparent))
|
if(WorkspaceInstance* workspace = dynamic_cast<WorkspaceInstance*>(cparent))
|
||||||
{
|
{
|
||||||
std::cout << "Removed from partarray " << std::endl;
|
|
||||||
workspace->partObjects.erase(std::remove(workspace->partObjects.begin(), workspace->partObjects.end(), this), workspace->partObjects.end());
|
workspace->partObjects.erase(std::remove(workspace->partObjects.begin(), workspace->partObjects.end(), this), workspace->partObjects.end());
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
cparent = cparent->getParent();
|
cparent = cparent->getParent();
|
||||||
}
|
}
|
||||||
Instance::setParent(prnt);
|
Instance::setParent(prnt);
|
||||||
while(parent != NULL)
|
cparent = getParent();
|
||||||
|
while(cparent != NULL)
|
||||||
{
|
{
|
||||||
if(WorkspaceInstance* workspace = dynamic_cast<WorkspaceInstance*>(parent))
|
if(WorkspaceInstance* workspace = dynamic_cast<WorkspaceInstance*>(cparent))
|
||||||
{
|
{
|
||||||
workspace->partObjects.push_back(this);
|
workspace->partObjects.push_back(this);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
parent = parent->getParent();
|
cparent = cparent->getParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PartInstance::PartInstance(const PartInstance &oinst)
|
PartInstance::PartInstance(const PartInstance &oinst)
|
||||||
@@ -143,7 +152,7 @@ PartInstance::PartInstance(const PartInstance &oinst)
|
|||||||
setParent(oinst.parent);
|
setParent(oinst.parent);
|
||||||
anchored = oinst.anchored;
|
anchored = oinst.anchored;
|
||||||
size = oinst.size;
|
size = oinst.size;
|
||||||
setCFrame(oinst.cFrame);
|
setCFrameNoSync(oinst.cFrame);
|
||||||
color = oinst.color;
|
color = oinst.color;
|
||||||
velocity = oinst.velocity;
|
velocity = oinst.velocity;
|
||||||
rotVelocity = oinst.rotVelocity;
|
rotVelocity = oinst.rotVelocity;
|
||||||
@@ -220,15 +229,32 @@ void PartInstance::setShape(Enum::Shape::Value shape)
|
|||||||
void PartInstance::setPosition(Vector3 pos)
|
void PartInstance::setPosition(Vector3 pos)
|
||||||
{
|
{
|
||||||
position = pos;
|
position = pos;
|
||||||
cFrame = CoordinateFrame(cFrame.rotation, pos);
|
setCFrame(CoordinateFrame(cFrame.rotation, pos));
|
||||||
changed = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PartInstance::setAnchored(bool anchored)
|
||||||
|
{
|
||||||
|
this->anchored = anchored;
|
||||||
|
g_dataModel->getEngine()->deleteBody(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PartInstance::isAnchored()
|
||||||
|
{
|
||||||
|
return this->anchored;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
CoordinateFrame PartInstance::getCFrame()
|
CoordinateFrame PartInstance::getCFrame()
|
||||||
{
|
{
|
||||||
return cFrame;
|
return cFrame;
|
||||||
}
|
}
|
||||||
void PartInstance::setCFrame(CoordinateFrame coordinateFrame)
|
void PartInstance::setCFrame(CoordinateFrame coordinateFrame)
|
||||||
|
{
|
||||||
|
g_dataModel->getEngine()->updateBody(this, &coordinateFrame);
|
||||||
|
setCFrameNoSync(coordinateFrame);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PartInstance::setCFrameNoSync(CoordinateFrame coordinateFrame)
|
||||||
{
|
{
|
||||||
cFrame = coordinateFrame;
|
cFrame = coordinateFrame;
|
||||||
position = coordinateFrame.translation;
|
position = coordinateFrame.translation;
|
||||||
@@ -296,6 +322,16 @@ void PartInstance::render(RenderDevice* rd) {
|
|||||||
PartInstance::~PartInstance(void)
|
PartInstance::~PartInstance(void)
|
||||||
{
|
{
|
||||||
glDeleteLists(glList, 1);
|
glDeleteLists(glList, 1);
|
||||||
|
/*
|
||||||
|
// Causes some weird ODE error
|
||||||
|
// Someone, please look into this
|
||||||
|
|
||||||
|
dBodyDestroy(physBody);
|
||||||
|
for (int i = 0; i < 3; i++) {
|
||||||
|
if (physGeom[i] != NULL)
|
||||||
|
dGeomDestroy(physGeom[i]);
|
||||||
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
char pto[512];
|
char pto[512];
|
||||||
@@ -334,7 +370,7 @@ void PartInstance::PropUpdate(LPPROPGRIDITEM &item)
|
|||||||
}
|
}
|
||||||
else if(strcmp(item->lpszPropName, "Anchored") == 0)
|
else if(strcmp(item->lpszPropName, "Anchored") == 0)
|
||||||
{
|
{
|
||||||
anchored= item->lpCurValue == TRUE;
|
setAnchored(item->lpCurValue == TRUE);
|
||||||
}
|
}
|
||||||
else if(strcmp(item->lpszPropName, "Offset") == 0)
|
else if(strcmp(item->lpszPropName, "Offset") == 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "DataModelV2/WorkspaceInstance.h"
|
#include "DataModelV2/WorkspaceInstance.h"
|
||||||
|
#include "Globals.h"
|
||||||
|
#include "Application.h"
|
||||||
|
|
||||||
WorkspaceInstance::WorkspaceInstance(void)
|
WorkspaceInstance::WorkspaceInstance(void)
|
||||||
{
|
{
|
||||||
@@ -15,6 +16,11 @@ void WorkspaceInstance::clearChildren()
|
|||||||
Instance::clearChildren();
|
Instance::clearChildren();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WorkspaceInstance::zoomToExtents()
|
||||||
|
{
|
||||||
|
g_usableApp->cameraController.zoomExtents();
|
||||||
|
}
|
||||||
|
|
||||||
WorkspaceInstance::~WorkspaceInstance(void)
|
WorkspaceInstance::~WorkspaceInstance(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
|
|
||||||
int const Globals::gen = 0;
|
int const Globals::gen = 0;
|
||||||
int const Globals::major = 100;
|
int const Globals::major = 0;
|
||||||
int const Globals::minor = 4;
|
int const Globals::minor = 105;
|
||||||
int const Globals::patch = 3;
|
int const Globals::patch = 0;
|
||||||
int Globals::surfaceId = 2;
|
int Globals::surfaceId = 2;
|
||||||
//bool Globals::showMouse = true;
|
//bool Globals::showMouse = true;
|
||||||
bool Globals::useMousePoint = false;
|
bool Globals::useMousePoint = false;
|
||||||
@@ -12,6 +12,7 @@ std::vector<Instance*> postRenderStack = std::vector<Instance*>();
|
|||||||
|
|
||||||
std::vector<Instance*> g_selectedInstances = std::vector<Instance*>();
|
std::vector<Instance*> g_selectedInstances = std::vector<Instance*>();
|
||||||
DataModelInstance* g_dataModel = NULL;
|
DataModelInstance* g_dataModel = NULL;
|
||||||
|
XplicitNgine* g_xplicitNgine = NULL;
|
||||||
|
|
||||||
bool running = false;
|
bool running = false;
|
||||||
G3D::TextureRef Globals::surface;
|
G3D::TextureRef Globals::surface;
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ void GUDButtonListener::onButton1MouseClick(BaseButtonInstance* button)
|
|||||||
else if(button->name == "Group")
|
else if(button->name == "Group")
|
||||||
{
|
{
|
||||||
GroupInstance * inst = new GroupInstance();
|
GroupInstance * inst = new GroupInstance();
|
||||||
|
inst->setParent(g_dataModel->getWorkspace());
|
||||||
for(size_t i = 0; i < g_selectedInstances.size(); i++)
|
for(size_t i = 0; i < g_selectedInstances.size(); i++)
|
||||||
{
|
{
|
||||||
if(g_selectedInstances.at(i)->canDelete)
|
if(g_selectedInstances.at(i)->canDelete)
|
||||||
@@ -52,7 +53,6 @@ void GUDButtonListener::onButton1MouseClick(BaseButtonInstance* button)
|
|||||||
/*tempinst->setPosition(Vector3(tempPos.x, tempPos.y + tempSize.y, tempPos.z));
|
/*tempinst->setPosition(Vector3(tempPos.x, tempPos.y + tempSize.y, tempPos.z));
|
||||||
g_usableApp->cameraController.centerCamera(g_selectedInstances.at(0));*/
|
g_usableApp->cameraController.centerCamera(g_selectedInstances.at(0));*/
|
||||||
}
|
}
|
||||||
inst->setParent(g_dataModel->getWorkspace());
|
|
||||||
g_selectedInstances.clear();
|
g_selectedInstances.clear();
|
||||||
g_selectedInstances.push_back(inst);
|
g_selectedInstances.push_back(inst);
|
||||||
if(g_selectedInstances.size() > 0)
|
if(g_selectedInstances.size() > 0)
|
||||||
|
|||||||
@@ -14,10 +14,23 @@ void MenuButtonListener::onButton1MouseClick(BaseButtonInstance* button)
|
|||||||
HMENU mainmenu = CreatePopupMenu();
|
HMENU mainmenu = CreatePopupMenu();
|
||||||
AppendMenu(mainmenu, MF_STRING, 100, "New");
|
AppendMenu(mainmenu, MF_STRING, 100, "New");
|
||||||
AppendMenu(mainmenu, MF_STRING, 101, "Open...");
|
AppendMenu(mainmenu, MF_STRING, 101, "Open...");
|
||||||
AppendMenu(mainmenu, MF_STRING, 101, "Close");
|
AppendMenu(mainmenu, MF_STRING, 102, "Close");
|
||||||
AppendMenu(mainmenu, MF_SEPARATOR, 0, NULL);
|
AppendMenu(mainmenu, MF_SEPARATOR, 0, NULL);
|
||||||
POINT p;
|
POINT p;
|
||||||
GetCursorPos(&p);
|
GetCursorPos(&p);
|
||||||
TrackPopupMenu(mainmenu, TPM_LEFTBUTTON, p.x, p.y, 0, Globals::mainHwnd, 0);
|
int menuClick = TrackPopupMenu(mainmenu, TPM_LEFTBUTTON | TPM_RETURNCMD, p.x, p.y, 0, Globals::mainHwnd, 0);
|
||||||
|
switch (menuClick)
|
||||||
|
{
|
||||||
|
case 100:
|
||||||
|
g_usableApp->clearInstances();
|
||||||
|
g_usableApp->onInit();
|
||||||
|
break;
|
||||||
|
case 101:
|
||||||
|
g_dataModel->getOpen();
|
||||||
|
break;
|
||||||
|
case 102:
|
||||||
|
g_usableApp->QuitApp();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7,11 +7,6 @@
|
|||||||
#include "strsafe.h"
|
#include "strsafe.h"
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
|
|
||||||
/*typedef struct typPRGP {
|
|
||||||
Instance* instance; // Declare member types
|
|
||||||
Property ∝
|
|
||||||
} PRGP;*/
|
|
||||||
|
|
||||||
std::vector<PROPGRIDITEM> prop;
|
std::vector<PROPGRIDITEM> prop;
|
||||||
std::vector<Instance*> children;
|
std::vector<Instance*> children;
|
||||||
Instance * selectedInstance;
|
Instance * selectedInstance;
|
||||||
|
|||||||
@@ -224,8 +224,9 @@ void renderShape(const Enum::Shape::Value& shape, const Vector3& size, const Col
|
|||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
/*Plusses, can possibly integrate into cylinder code later on*/
|
/*Plusses, can possibly integrate into cylinder code later on*/
|
||||||
glVertexPointer(2, GL_FLOAT,0, square_arr);
|
glVertexPointer(2, GL_FLOAT,0, square_arr);
|
||||||
glColor3f(127,127,127);
|
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
|
glDisable(GL_COLOR_ARRAY);
|
||||||
|
glColor3f(127,127,127);
|
||||||
glRotatef(90,0,1,0);
|
glRotatef(90,0,1,0);
|
||||||
glTranslatef(0,0,-(size.z+0.001F));
|
glTranslatef(0,0,-(size.z+0.001F));
|
||||||
glScalef(0.75,0.75,0.75);
|
glScalef(0.75,0.75,0.75);
|
||||||
@@ -233,9 +234,11 @@ void renderShape(const Enum::Shape::Value& shape, const Vector3& size, const Col
|
|||||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||||
glScalef(1/(size.x*8),size.x*8,1);
|
glScalef(1/(size.x*8),size.x*8,1);
|
||||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||||
|
glEnable(GL_COLOR_ARRAY);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
|
glDisable(GL_COLOR_ARRAY);
|
||||||
glRotatef(-90,0,1,0);
|
glRotatef(-90,0,1,0);
|
||||||
glTranslatef(0,0,-(size.z+0.001F));
|
glTranslatef(0,0,-(size.z+0.001F));
|
||||||
glScalef(0.75,0.75,0.75);
|
glScalef(0.75,0.75,0.75);
|
||||||
@@ -243,6 +246,7 @@ void renderShape(const Enum::Shape::Value& shape, const Vector3& size, const Col
|
|||||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||||
glScalef(1/(size.x*8),size.x*8,1);
|
glScalef(1/(size.x*8),size.x*8,1);
|
||||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||||
|
glEnable(GL_COLOR_ARRAY);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
194
src/source/XplicitNgine/XplicitNgine.cpp
Normal file
194
src/source/XplicitNgine/XplicitNgine.cpp
Normal file
@@ -0,0 +1,194 @@
|
|||||||
|
#include "XplicitNgine/XplicitNgine.h"
|
||||||
|
#include "Globals.h"
|
||||||
|
|
||||||
|
#define SIDE (0.5f)
|
||||||
|
#define MASS (1.0)
|
||||||
|
|
||||||
|
// constraints
|
||||||
|
#define MAX_BODIES 65535
|
||||||
|
#define OBJ_DENSITY (5.0)
|
||||||
|
#define MAX_CONTACT_PER_BODY 4
|
||||||
|
|
||||||
|
XplicitNgine::XplicitNgine()
|
||||||
|
{
|
||||||
|
physWorld = dWorldCreate();
|
||||||
|
physSpace = dHashSpaceCreate(0);
|
||||||
|
contactgroup = dJointGroupCreate(0);
|
||||||
|
|
||||||
|
dWorldSetGravity(physWorld, 0, -0.5, 0);
|
||||||
|
|
||||||
|
this->name = "PhysicsService";
|
||||||
|
//dGeomID ground_geom = dCreatePlane(physSpace, 0, 1, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
XplicitNgine::~XplicitNgine()
|
||||||
|
{
|
||||||
|
dJointGroupDestroy (contactgroup);
|
||||||
|
dSpaceDestroy (physSpace);
|
||||||
|
dWorldDestroy (physWorld);
|
||||||
|
dCloseODE();
|
||||||
|
}
|
||||||
|
|
||||||
|
void collisionCallback(void *data, dGeomID o1, dGeomID o2)
|
||||||
|
{
|
||||||
|
int i,n;
|
||||||
|
|
||||||
|
dBodyID b1 = dGeomGetBody(o1);
|
||||||
|
dBodyID b2 = dGeomGetBody(o2);
|
||||||
|
if (b1 && b2 && dAreConnected(b1, b2))
|
||||||
|
return;
|
||||||
|
|
||||||
|
const int N = 4;
|
||||||
|
dContact contact[N];
|
||||||
|
n = dCollide (o1,o2,N,&contact[0].geom,sizeof(dContact));
|
||||||
|
if (n > 0) {
|
||||||
|
for (i=0; i<n; i++) {
|
||||||
|
contact[i].surface.mode = dContactBounce | dContactSlip1 | dContactSlip2 | dContactSoftERP | dContactSoftCFM | dContactApprox1;
|
||||||
|
|
||||||
|
// Define contact surface properties
|
||||||
|
|
||||||
|
contact[i].surface.bounce = 0.5; //Elasticity
|
||||||
|
contact[i].surface.mu = 0.3F; //Friction
|
||||||
|
contact[i].surface.slip1 = 0.0;
|
||||||
|
contact[i].surface.slip2 = 0.0;
|
||||||
|
contact[i].surface.soft_erp = 0.8F;
|
||||||
|
contact[i].surface.soft_cfm = 0.01F;
|
||||||
|
|
||||||
|
// Create joints
|
||||||
|
dJointID c = dJointCreateContact(
|
||||||
|
g_xplicitNgine->physWorld,
|
||||||
|
g_xplicitNgine->contactgroup,
|
||||||
|
contact+i
|
||||||
|
);
|
||||||
|
|
||||||
|
dJointAttach (c,b1,b2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void XplicitNgine::deleteBody(PartInstance* partInstance)
|
||||||
|
{
|
||||||
|
if(partInstance->physBody != NULL)
|
||||||
|
{
|
||||||
|
while(dBodyGetNumJoints(partInstance->physBody) > 0) {
|
||||||
|
dJointDestroy(dBodyGetJoint(partInstance->physBody, 0));
|
||||||
|
}
|
||||||
|
dBodyDestroy(partInstance->physBody);
|
||||||
|
dGeomDestroy(partInstance->physGeom[0]);
|
||||||
|
partInstance->physBody = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void XplicitNgine::createBody(PartInstance* partInstance)
|
||||||
|
{
|
||||||
|
// calculate collisions
|
||||||
|
//dSpaceCollide (physSpace,0,&collisionCallback);
|
||||||
|
|
||||||
|
if(partInstance->physBody == NULL)
|
||||||
|
{
|
||||||
|
// init body
|
||||||
|
partInstance->physBody = dBodyCreate(physWorld);
|
||||||
|
|
||||||
|
// Create geom
|
||||||
|
if(partInstance->shape == Enum::Shape::Block)
|
||||||
|
{
|
||||||
|
partInstance->physGeom[0] = dCreateBox(physSpace,
|
||||||
|
partInstance->getSize()[0],
|
||||||
|
partInstance->getSize()[1],
|
||||||
|
partInstance->getSize()[2]
|
||||||
|
);
|
||||||
|
|
||||||
|
dVector3 result;
|
||||||
|
dGeomBoxGetLengths(partInstance->physGeom[0], result);
|
||||||
|
//printf("[XplicitNgine] Part Geom Size: %.1f, %.1f, %.1f\n",
|
||||||
|
// result[0],
|
||||||
|
// result[1],
|
||||||
|
// result[2]
|
||||||
|
//);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
partInstance->physGeom[0] = dCreateSphere(physSpace, partInstance->getSize()[0]/2);
|
||||||
|
}
|
||||||
|
|
||||||
|
dMass mass;
|
||||||
|
mass.setBox(partInstance->getSize().x, partInstance->getSize().y, partInstance->getSize().z, 0.7F);
|
||||||
|
dBodySetMass(partInstance->physBody, &mass);
|
||||||
|
|
||||||
|
// Debug output
|
||||||
|
|
||||||
|
|
||||||
|
// Create rigid body
|
||||||
|
//printf("[XplicitNgine] Created Geom for PartInstance\n");
|
||||||
|
dBodySetPosition(partInstance->physBody,
|
||||||
|
partInstance->getPosition()[0],
|
||||||
|
partInstance->getPosition()[1],
|
||||||
|
partInstance->getPosition()[2]
|
||||||
|
);
|
||||||
|
|
||||||
|
dGeomSetPosition(partInstance->physGeom[0],
|
||||||
|
partInstance->getPosition()[0],
|
||||||
|
partInstance->getPosition()[1],
|
||||||
|
partInstance->getPosition()[2]);
|
||||||
|
|
||||||
|
Matrix3 g3dRot = partInstance->getCFrame().rotation;
|
||||||
|
float rotation [12] = { g3dRot[0][0], g3dRot[0][1], g3dRot[0][2], 0,
|
||||||
|
g3dRot[1][0], g3dRot[1][1], g3dRot[1][2], 0,
|
||||||
|
g3dRot[2][0], g3dRot[2][1], g3dRot[2][2], 0};
|
||||||
|
|
||||||
|
dGeomSetRotation(partInstance->physGeom[0], rotation);
|
||||||
|
dBodySetRotation(partInstance->physBody, rotation);
|
||||||
|
|
||||||
|
//printf("[XplicitNgine] Created Body for PartInstance\n");
|
||||||
|
|
||||||
|
if(!partInstance->isAnchored())
|
||||||
|
dGeomSetBody(partInstance->physGeom[0], partInstance->physBody);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if(!partInstance->isAnchored())
|
||||||
|
{
|
||||||
|
const dReal* physPosition = dBodyGetPosition(partInstance->physBody);
|
||||||
|
|
||||||
|
// TODO: Rotation code
|
||||||
|
// Probably should be done AFTER we get physics KINDA working!!!
|
||||||
|
const dReal* physRotation = dGeomGetRotation(partInstance->physGeom[0]);
|
||||||
|
//partInstance->setPosition(Vector3(physPosition[0], physPosition[1], physPosition[2]));
|
||||||
|
partInstance->setCFrameNoSync(CoordinateFrame(
|
||||||
|
Matrix3(physRotation[0],physRotation[1],physRotation[2],
|
||||||
|
physRotation[4],physRotation[5],physRotation[6],
|
||||||
|
physRotation[8],physRotation[9],physRotation[10]),
|
||||||
|
Vector3(physPosition[0], physPosition[1], physPosition[2])));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//STEP SHOULD NOT BE HERE!
|
||||||
|
//dWorldQuickStep(physWorld, stepSize);
|
||||||
|
//dJointGroupEmpty(contactgroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
void XplicitNgine::step(float stepSize)
|
||||||
|
{
|
||||||
|
dSpaceCollide (physSpace,0,&collisionCallback);
|
||||||
|
dWorldQuickStep(physWorld, stepSize);
|
||||||
|
dJointGroupEmpty(contactgroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
void XplicitNgine::updateBody(PartInstance *partInstance, CoordinateFrame * cFrame)
|
||||||
|
{
|
||||||
|
if(partInstance->physBody != NULL)
|
||||||
|
{
|
||||||
|
Vector3 position = cFrame->translation;
|
||||||
|
|
||||||
|
dBodySetPosition(partInstance->physBody,
|
||||||
|
position[0],
|
||||||
|
position[1],
|
||||||
|
position[2]
|
||||||
|
);
|
||||||
|
|
||||||
|
Matrix3 g3dRot = cFrame->rotation;
|
||||||
|
float rotation [12] = { g3dRot[0][0], g3dRot[0][1], g3dRot[0][2], 0,
|
||||||
|
g3dRot[1][0], g3dRot[1][1], g3dRot[1][2], 0,
|
||||||
|
g3dRot[2][0], g3dRot[2][1], g3dRot[2][2], 0};
|
||||||
|
|
||||||
|
dBodySetRotation(partInstance->physBody, rotation);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user