Clean bloat comments
Please make sure these were bloat and not important.
This commit is contained in:
BIN
click_output.PNG
BIN
click_output.PNG
Binary file not shown.
|
Before Width: | Height: | Size: 4.2 KiB |
@@ -33,10 +33,7 @@
|
||||
#include "Listener/RotateButtonListener.h"
|
||||
#include "Faces.h"
|
||||
#define LEGACY_LOAD_G3DFUN_LEVEL
|
||||
//Ray testRay;
|
||||
//static int cursorid = 0;
|
||||
//static int cursorOvrid = 0;
|
||||
//static int currentcursorid = 0;
|
||||
|
||||
static bool mouseMovedBeginMotion = false;
|
||||
static POINT oldGlobalMouse;
|
||||
Vector2 oldMouse = Vector2(0,0);
|
||||
@@ -291,16 +288,6 @@ void Application::onInit() {
|
||||
|
||||
_dataModel->getSelectionService()->clearSelection();
|
||||
_dataModel->getSelectionService()->addSelected(_dataModel);
|
||||
|
||||
|
||||
|
||||
//setDesiredFrameRate(60);
|
||||
|
||||
|
||||
|
||||
|
||||
//GApplet::onInit();
|
||||
|
||||
}
|
||||
|
||||
void Application::onCleanup() {
|
||||
@@ -316,12 +303,6 @@ void Application::onNetwork() {
|
||||
// Poll net messages here
|
||||
}
|
||||
|
||||
|
||||
//double getVectorDistance(Vector3 vector1, Vector3 vector2)
|
||||
//{
|
||||
// return pow(pow((double)vector1.x - (double)vector2.x, 2) + pow((double)vector1.y - (double)vector2.y, 2) + pow((double)vector1.z - (double)vector2.z, 2), 0.5);
|
||||
//}
|
||||
|
||||
void Application::onSimulation(RealTime rdt, SimTime sdt, SimTime idt) {
|
||||
|
||||
if(_dataModel->isRunning())
|
||||
@@ -428,7 +409,7 @@ int Application::getMode()
|
||||
void Application::drawOutline(Vector3 from, Vector3 to, RenderDevice* rd, LightingParameters lighting, Vector3 size, Vector3 pos, CoordinateFrame c)
|
||||
{
|
||||
rd->disableLighting();
|
||||
Color3 outline = Color3::cyan();//Color3(0.098F,0.6F,1.0F);
|
||||
Color3 outline = Color3::cyan();
|
||||
float offsetSize = 0.05F;
|
||||
//X
|
||||
Draw::box(c.toWorldSpace(Box(Vector3(from.x - offsetSize, from.y + offsetSize, from.z + offsetSize), Vector3(to.x + offsetSize, from.y - offsetSize, from.z - offsetSize))), rd, outline, Color4::clear());
|
||||
@@ -503,8 +484,6 @@ void Application::drawOutline(Vector3 from, Vector3 to, RenderDevice* rd, Lighti
|
||||
|
||||
void Application::exitApplication()
|
||||
{
|
||||
//endApplet = true;
|
||||
//endProgram = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -518,27 +497,18 @@ void Application::onGraphics(RenderDevice* rd) {
|
||||
if (GetCursorPos(&mousepos))
|
||||
{
|
||||
POINT pointm = mousepos;
|
||||
if (ScreenToClient(_hWndMain, &mousepos))
|
||||
{
|
||||
//mouseOnScreen = true;
|
||||
//POINT pointm;
|
||||
///GetCursorPos(&pointm);
|
||||
if(_hwndRenderer != WindowFromPoint(pointm)) //OLD: mousepos.x < 1 || mousepos.y < 1 || mousepos.x >= rd->getViewport().width()-1 || mousepos.y >= rd->getViewport().height()-1
|
||||
if (ScreenToClient(_hWndMain, &mousepos))
|
||||
{
|
||||
mouseOnScreen = false;
|
||||
//ShowCursor(true);
|
||||
//_window->setMouseVisible(true);
|
||||
//rd->window()->setInputCaptureCount(0);
|
||||
if(_hwndRenderer != WindowFromPoint(pointm))
|
||||
{
|
||||
mouseOnScreen = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
mouseOnScreen = true;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
mouseOnScreen = true;
|
||||
//SetCursor(NULL);
|
||||
//_window->setMouseVisible(false);
|
||||
//rd->window()->setInputCaptureCount(1);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(Globals::useMousePoint)
|
||||
@@ -556,8 +526,6 @@ void Application::onGraphics(RenderDevice* rd) {
|
||||
renderDevice->clear(sky.isNull(), true, true);
|
||||
if (sky.notNull()) sky->render(renderDevice, lighting);
|
||||
} else {
|
||||
printf("ThumbnailGenerator::click\n");
|
||||
|
||||
rd->setColorClearValue(Color4(0.0f, 0.0f, 0.0f, 0.0f));
|
||||
renderDevice->clear(true, true, true);
|
||||
toggleSky();
|
||||
@@ -572,41 +540,18 @@ void Application::onGraphics(RenderDevice* rd) {
|
||||
renderDevice->setLight(0, GLight::directional(lighting.lightDirection, lighting.lightColor, true, true));
|
||||
renderDevice->setAmbientLightColor(lighting.ambient);
|
||||
|
||||
//renderDevice->setBlendFunc(RenderDevice::BLEND_ONE, RenderDevice::BLEND_ONE);
|
||||
|
||||
|
||||
|
||||
//renderDevice->setShininess(70);
|
||||
//renderDevice->setSpecularCoefficient(Color3(0.1F, 0.1F, 0.1F));
|
||||
|
||||
//float lightAmbient[] = { 0.5F, 0.5F, 0.5F, 1.0F };
|
||||
//float lightDiffuse[] = { 0.6F, 0.6F, 0.6F, 1.0F };
|
||||
//float lightSpecular[] = { 0.8F, 0.8F, 0.8F, 1.0F };
|
||||
|
||||
//glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, lightAmbient);
|
||||
//glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, lightDiffuse);
|
||||
//glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, lightSpecular);
|
||||
//glMateriali(GL_FRONT_AND_BACK, GL_SHININESS, 70);
|
||||
|
||||
|
||||
rd->beforePrimitive();
|
||||
CoordinateFrame forDraw = rd->getObjectToWorldMatrix();
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
glEnableClientState(GL_NORMAL_ARRAY);
|
||||
//if(_dataModel->getWorkspace() != NULL)
|
||||
|
||||
_dataModel->getWorkspace()->render(rd);
|
||||
//else throw std::exception("Workspace not found");
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
glDisableClientState(GL_COLOR_ARRAY);
|
||||
glDisableClientState(GL_NORMAL_ARRAY);
|
||||
rd->setObjectToWorldMatrix(forDraw);
|
||||
rd->afterPrimitive();
|
||||
|
||||
|
||||
//Draw::box(G3D::Box(mouse.getPosition()-Vector3(2,0.5F,1),mouse.getPosition()+Vector3(2,0.5F,1)), rd, Color3::cyan(), Color4::clear());
|
||||
|
||||
for(size_t i = 0; i < _dataModel->getSelectionService()->getSelection().size(); i++)
|
||||
{
|
||||
if(PartInstance* part = dynamic_cast<PartInstance*>(g_dataModel->getSelectionService()->getSelection()[i]))
|
||||
@@ -616,18 +561,6 @@ void Application::onGraphics(RenderDevice* rd) {
|
||||
drawOutline(Vector3(0+size.x/2, 0+size.y/2, 0+size.z/2) ,Vector3(0-size.x/2,0-size.y/2,0-size.z/2), rd, lighting, Vector3(size.x/2, size.y/2, size.z/2), Vector3(pos.x, pos.y, pos.z), part->getCFrame());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Vector3 gamepoint = Vector3(0, 5, 0);
|
||||
//Vector3 camerapoint = rd->getCameraToWorldMatrix().translation;
|
||||
//float distance = pow(pow((double)gamepoint.x - (double)camerapoint.x, 2) + pow((double)gamepoint.y - (double)camerapoint.y, 2) + pow((double)gamepoint.z - (double)camerapoint.z, 2), 0.5);
|
||||
//if(distance < 50 && distance > -50)
|
||||
|
||||
//{
|
||||
// if(distance < 0)
|
||||
// distance = distance*-1;
|
||||
// fntdominant->draw3D(rd, "Testing", CoordinateFrame(rd->getCameraToWorldMatrix().rotation, gamepoint), 0.04*distance, Color3::yellow(), Color3::black(), G3D::GFont::XALIGN_CENTER, G3D::GFont::YALIGN_CENTER);
|
||||
//}
|
||||
|
||||
renderDevice->disableLighting();
|
||||
|
||||
@@ -636,51 +569,6 @@ void Application::onGraphics(RenderDevice* rd) {
|
||||
}
|
||||
renderDevice->push2D();
|
||||
_dataModel->getGuiRoot()->renderGUI(renderDevice, m_graphicsWatch.FPS());
|
||||
/*rd->pushState();
|
||||
rd->beforePrimitive();
|
||||
|
||||
if(Globals::showMouse && mouseOnScreen)
|
||||
{
|
||||
glEnable( GL_TEXTURE_2D );
|
||||
glEnable(GL_BLEND);// you enable blending function
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
/*
|
||||
std::vector<Instance*> instances = _dataModel->getWorkspace()->getAllChildren();
|
||||
currentcursorid = cursorid;
|
||||
for(size_t i = 0; i < instances.size(); i++)
|
||||
{
|
||||
if(PartInstance* test = dynamic_cast<PartInstance*>(instances.at(i)))
|
||||
{
|
||||
float time = cameraController.getCamera()->worldRay(_dataModel->mousex, _dataModel->mousey, renderDevice->getViewport()).intersectionTime(test->getBox());
|
||||
//float time = testRay.intersectionTime(test->getBox());
|
||||
if (time != inf())
|
||||
{
|
||||
currentcursorid = cursorOvrid;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
*/
|
||||
/*glBindTexture( GL_TEXTURE_2D, tool->getCursorId());
|
||||
|
||||
|
||||
glBegin( GL_QUADS );
|
||||
glTexCoord2d(0.0,0.0);
|
||||
glVertex2f(mousepos.x-64, mousepos.y-64);
|
||||
glTexCoord2d( 1.0,0.0 );
|
||||
glVertex2f(mousepos.x+64, mousepos.y-64);
|
||||
glTexCoord2d(1.0,1.0 );
|
||||
glVertex2f(mousepos.x+64, mousepos.y+64 );
|
||||
glTexCoord2d( 0.0,1.0 );
|
||||
glVertex2f( mousepos.x-64, mousepos.y+64 );
|
||||
glEnd();
|
||||
|
||||
glDisable( GL_TEXTURE_2D );*/
|
||||
//}
|
||||
|
||||
/*rd->afterPrimitive();
|
||||
rd->popState();*/
|
||||
renderDevice->pop2D();
|
||||
}
|
||||
|
||||
@@ -739,7 +627,6 @@ void Application::onMouseMoved(int x,int y)
|
||||
mouse.oldy = mouse.y;
|
||||
mouse.x = x;
|
||||
mouse.y = y;
|
||||
//tool->onMouseMoved(mouse);
|
||||
mouseMoveState = true;
|
||||
|
||||
}
|
||||
@@ -755,26 +642,9 @@ void Application::onMouseWheel(int x,int y,short delta)
|
||||
|
||||
void Application::run() {
|
||||
g_usableApp = this;
|
||||
//setDebugMode(false);
|
||||
//debugController.setActive(false);
|
||||
/*
|
||||
if (!createWindowClass("ToolWindowClass",ToolProc,GetModuleHandle(0)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
HWND propertyHWnd = CreateWindowEx(
|
||||
WS_EX_TOOLWINDOW,"ToolWindowClass", "ToolWindow",
|
||||
WS_SYSMENU | WS_VISIBLE | WS_CHILD,
|
||||
0, 0, 800, 64,
|
||||
hWndMain, NULL, GetModuleHandle(0), NULL);
|
||||
|
||||
ShowWindow(propertyHWnd,SW_SHOW);
|
||||
*/
|
||||
UpdateWindow(_hWndMain);
|
||||
|
||||
// Load objects here=
|
||||
|
||||
Globals::surface = Texture::fromFile(GetFileInPath("/content/images/surfacebr.png"));
|
||||
Globals::surfaceId = Globals::surface->getOpenGLID();
|
||||
cameraSound = GetFileInPath("/content/sounds/SWITCH3.wav");
|
||||
@@ -790,12 +660,7 @@ void Application::run() {
|
||||
RealTime lastWaitTime=0;
|
||||
|
||||
MSG messages;
|
||||
//RECT cRect;
|
||||
//GetClientRect(_hWndMain,&cRect);
|
||||
//renderDevice->notifyResize(cRect.right,cRect.bottom);
|
||||
//Rect2D viewportRect = Rect2D::xywh(0,0,cRect.right,cRect.bottom);
|
||||
//renderDevice->setViewport(viewportRect);
|
||||
//window()->setInputCaptureCount(1);
|
||||
|
||||
resizeWithParent(_hWndMain);
|
||||
glEnable(GL_CULL_FACE);
|
||||
while (!quit)
|
||||
@@ -807,21 +672,15 @@ void Application::run() {
|
||||
|
||||
m_userInputWatch.tick();
|
||||
onUserInput(userInput);
|
||||
//m_moduleManager->onUserInput(_userInput);
|
||||
m_userInputWatch.tock();
|
||||
|
||||
m_simulationWatch.tick();
|
||||
//debugController.doSimulation(clamp(timeStep, 0.0, 0.1));
|
||||
//g3dCamera.setCoordinateFrame
|
||||
//(debugController.getCoordinateFrame());
|
||||
|
||||
double rate = simTimeRate;
|
||||
RealTime rdt = timeStep;
|
||||
SimTime sdt = timeStep * rate;
|
||||
SimTime idt = desiredFrameDuration * rate;
|
||||
|
||||
|
||||
|
||||
onSimulation(rdt,sdt,idt);
|
||||
m_simulationWatch.tock();
|
||||
|
||||
@@ -896,7 +755,4 @@ void Application::QuitApp()
|
||||
|
||||
void Application::onCreate(HWND parentWindow)
|
||||
{
|
||||
//SetWindowLongPtr(hwndRenderer,GWL_USERDATA,(LONG)this);
|
||||
//SetWindowLongPtr(hwndToolbox,GWL_USERDATA,(LONG)this);
|
||||
//SetWindowLongPtr(hwndMain,GWL_USERDATA,(LONG)&app);
|
||||
}
|
||||
@@ -6,11 +6,8 @@
|
||||
|
||||
void OnError(int err, std::string msg)
|
||||
{
|
||||
//g_usableApp->window()->setInputCaptureCount(0);
|
||||
//g_usableApp->window()->setMouseVisible(true);
|
||||
std::string emsg = "An unexpected error has occured and "+g_appName+" has to quit. We're sorry!" + msg;
|
||||
std::string title = g_appName+" Crash";
|
||||
//clearInstances();
|
||||
MessageBox(NULL, emsg.c_str(), title.c_str(), MB_OK);
|
||||
exit(err);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#include "Application.h"
|
||||
|
||||
int Globals::surfaceId = 2;
|
||||
//bool Globals::showMouse = true;
|
||||
bool Globals::useMousePoint = false;
|
||||
std::vector<Instance*> postRenderStack = std::vector<Instance*>();
|
||||
|
||||
|
||||
@@ -54,9 +54,6 @@ HRESULT IEBrowser::doExternal(std::wstring funcName,
|
||||
else if (funcName==L"SetController")
|
||||
{
|
||||
bool ding = false;
|
||||
//int len = SysStringLen(pDispParams->rgvarg->bstrVal)+1;
|
||||
//char * args = new char[len];
|
||||
//WideCharToMultiByte(CP_ACP, 0, pDispParams->rgvarg->bstrVal, len, args, len, NULL, (LPBOOL)TRUE);
|
||||
if(pDispParams->rgvarg->intVal < 0 || pDispParams->rgvarg->intVal > 7)
|
||||
return S_OK;
|
||||
Enum::Controller::Value cont = (Enum::Controller::Value)pDispParams->rgvarg->intVal;
|
||||
@@ -78,20 +75,9 @@ HRESULT IEBrowser::doExternal(std::wstring funcName,
|
||||
return E_NOTIMPL;
|
||||
int j = pDispParams->rgvarg->intVal;
|
||||
int i = (pDispParams->rgvarg+1)->intVal;
|
||||
//printf("Got values %d and %d", i, j);
|
||||
if(i > 5 || i < 0)
|
||||
return E_NOTIMPL;
|
||||
g_usableApp->changeTool(new SurfaceTool(i, j));
|
||||
/*VARIANT val1;
|
||||
VARIANT val2;
|
||||
unsigned int puArgErr;
|
||||
HRESULT res = DispGetParam(pDispParams,1,VT_VARIANT,&val1, &puArgErr);
|
||||
if(res != S_OK)
|
||||
return res;
|
||||
//res = DispGetParam(pDispParams,1,VT_UI4,&val2, &puArgErr);
|
||||
//if(res != S_OK)
|
||||
//return res;
|
||||
*/
|
||||
return S_OK;
|
||||
}
|
||||
else if(funcName==L"SetColor")
|
||||
@@ -112,11 +98,6 @@ HRESULT IEBrowser::doExternal(std::wstring funcName,
|
||||
color.Flags = CC_FULLOPEN | CC_RGBINIT;
|
||||
if(ChooseColorA((LPCHOOSECOLOR)&color))
|
||||
{
|
||||
//DWORD dwR = GetRValue(color.rgbResult);
|
||||
//DWORD dwG = GetGValue(color.rgbResult);
|
||||
//DWORD dwB = GetBValue(color.rgbResult);
|
||||
//wchar_t * str = L"Test";
|
||||
//swprintf_s(str, 16, L"#%02X%02X%02X", dwR, dwG, dwB);
|
||||
pVarResult->vt = VT_UI4;
|
||||
pVarResult->ulVal = color.rgbResult;
|
||||
}
|
||||
|
||||
@@ -17,10 +17,6 @@ void MenuButtonListener::onButton1MouseClick(BaseButtonInstance* button)
|
||||
AppendMenu(mainmenu, MF_STRING, 102, "Close");
|
||||
AppendMenu(mainmenu, MF_SEPARATOR, 0, NULL);
|
||||
|
||||
// Temporary
|
||||
// AppendMenu(mainmenu, MF_STRING, 103, "ThumbnailGenerator::click hideSky = true");
|
||||
// AppendMenu(mainmenu, MF_STRING, 104, "ThumbnailGenerator::click hideSky = false");
|
||||
|
||||
POINT p;
|
||||
GetCursorPos(&p);
|
||||
int menuClick = TrackPopupMenu(mainmenu, TPM_LEFTBUTTON | TPM_RETURNCMD, p.x, p.y, 0, Globals::mainHwnd, 0);
|
||||
@@ -36,17 +32,6 @@ void MenuButtonListener::onButton1MouseClick(BaseButtonInstance* button)
|
||||
case 102:
|
||||
g_usableApp->QuitApp();
|
||||
break;
|
||||
|
||||
/*
|
||||
// These are only here for future reference
|
||||
case 103:
|
||||
g_dataModel->getThumbnailGenerator()->click("PNG", 256, 256, true);
|
||||
break;
|
||||
case 104:
|
||||
g_dataModel->getThumbnailGenerator()->click("JPEG", 105, 70, false);
|
||||
break;
|
||||
*/
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
void ModeSelectionListener::onButton1MouseClick(BaseButtonInstance* button)
|
||||
{
|
||||
//CoordinateFrame frame = g_usableApp->g3dCamera.getCoordinateFrame();
|
||||
int mode = g_usableApp->getMode();
|
||||
|
||||
std::vector<Instance*> instances_2D = g_dataModel->getGuiRoot()->getAllChildren();
|
||||
|
||||
@@ -20,7 +20,6 @@ void eprt(PartInstance * instance)
|
||||
{
|
||||
nearest=time;
|
||||
selectedInstance = instance;
|
||||
//This is where dead code below was
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,7 +29,6 @@ PartInstance * Mouse::getTarget()
|
||||
selectedInstance = NULL;
|
||||
testRay = g_usableApp->cameraController.getCamera()->worldRay(x, y, g_usableApp->getRenderDevice()->getViewport());
|
||||
nearest=std::numeric_limits<float>::infinity();
|
||||
//Vector3 camPos = g_usableApp->cameraController.getCamera()->getCoordinateFrame().translation;
|
||||
for_each (g_dataModel->getWorkspace()->partObjects.begin(), g_dataModel->getWorkspace()->partObjects.end(), eprt);
|
||||
return selectedInstance;
|
||||
}
|
||||
|
||||
@@ -73,7 +73,6 @@ LRESULT CALLBACK PropProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
break;
|
||||
case WM_DRAWITEM:
|
||||
{
|
||||
std::cout << "Drawing?" << "\r\n";
|
||||
COLORREF clrBackground;
|
||||
COLORREF clrForeground;
|
||||
TEXTMETRIC tm;
|
||||
|
||||
@@ -105,7 +105,6 @@ void ArrowTool::onMouseMoved(Mouse mouse)
|
||||
return;
|
||||
}
|
||||
PartInstance * target = mouse.getTarget();
|
||||
//if(target == NULL)
|
||||
}
|
||||
void ArrowTool::onSelect(Mouse mouse)
|
||||
{
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
|
||||
Tool::Tool(void)
|
||||
{
|
||||
//cursorString = GetFileInPath("/content/images/ArrowFarCursor.png");
|
||||
//cursorId = cursorRef->openGLID();
|
||||
|
||||
}
|
||||
|
||||
Tool::~Tool(void)
|
||||
@@ -21,12 +20,4 @@ void Tool::onSelect(Mouse mouse){}
|
||||
void Tool::onDeselect(Mouse mouse){}
|
||||
void Tool::onMouseScroll(Mouse mouse){}
|
||||
void Tool::onKeyDown(int key){}
|
||||
void Tool::onKeyUp(int key){}
|
||||
/*void Tool::setCursor(std::string str)
|
||||
{
|
||||
//cursorString = str;
|
||||
}*/
|
||||
/*int Tool::getCursorId()
|
||||
{
|
||||
return TextureHandler::getTexturePermanent(cursorString);
|
||||
}*/
|
||||
void Tool::onKeyUp(int key){}
|
||||
@@ -1,14 +1,6 @@
|
||||
#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()
|
||||
{
|
||||
|
||||
@@ -23,7 +15,6 @@ XplicitNgine::XplicitNgine()
|
||||
dWorldSetAutoDisableSteps(physWorld, 20);
|
||||
|
||||
this->name = "PhysicsService";
|
||||
//dGeomID ground_geom = dCreatePlane(physSpace, 0, 1, 0, 0);
|
||||
}
|
||||
|
||||
XplicitNgine::~XplicitNgine()
|
||||
@@ -58,7 +49,6 @@ void collisionCallback(void *data, dGeomID o1, dGeomID o2)
|
||||
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.4F; //Friction
|
||||
contact[i].surface.slip1 = 0.0;
|
||||
@@ -121,9 +111,6 @@ void XplicitNgine::deleteBody(PartInstance* partInstance)
|
||||
|
||||
void XplicitNgine::createBody(PartInstance* partInstance)
|
||||
{
|
||||
// calculate collisions
|
||||
//dSpaceCollide (physSpace,0,&collisionCallback);
|
||||
|
||||
if(partInstance->physBody == NULL)
|
||||
{
|
||||
|
||||
@@ -131,6 +118,7 @@ void XplicitNgine::createBody(PartInstance* partInstance)
|
||||
Vector3 partPosition = partInstance->getPosition();
|
||||
Vector3 velocity = partInstance->getVelocity();
|
||||
Vector3 rotVelocity = partInstance->getRotVelocity();
|
||||
|
||||
// init body
|
||||
partInstance->physBody = dBodyCreate(physWorld);
|
||||
dBodySetData(partInstance->physBody, partInstance);
|
||||
@@ -146,11 +134,6 @@ void XplicitNgine::createBody(PartInstance* partInstance)
|
||||
|
||||
dVector3 result;
|
||||
dGeomBoxGetLengths(partInstance->physGeom[0], result);
|
||||
//printf("[XplicitNgine] Part Geom Size: %.1f, %.1f, %.1f\n",
|
||||
// result[0],
|
||||
// result[1],
|
||||
// result[2]
|
||||
//);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -161,11 +144,7 @@ void XplicitNgine::createBody(PartInstance* partInstance)
|
||||
mass.setBox(sqrt(partSize.x*2), sqrt(partSize.y*2), sqrt(partSize.z*2), 0.7F);
|
||||
dBodySetMass(partInstance->physBody, &mass);
|
||||
|
||||
// Debug output
|
||||
|
||||
|
||||
// Create rigid body
|
||||
//printf("[XplicitNgine] Created Geom for PartInstance\n");
|
||||
dBodySetPosition(partInstance->physBody,
|
||||
partPosition.x,
|
||||
partPosition.y,
|
||||
@@ -187,8 +166,6 @@ void XplicitNgine::createBody(PartInstance* partInstance)
|
||||
dGeomSetRotation(partInstance->physGeom[0], rotation);
|
||||
dBodySetRotation(partInstance->physBody, rotation);
|
||||
|
||||
//printf("[XplicitNgine] Created Body for PartInstance\n");
|
||||
|
||||
if(!partInstance->isAnchored() && !partInstance->isDragging())
|
||||
dGeomSetBody(partInstance->physGeom[0], partInstance->physBody);
|
||||
|
||||
@@ -203,10 +180,7 @@ void XplicitNgine::createBody(PartInstance* partInstance)
|
||||
|
||||
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],
|
||||
@@ -214,9 +188,6 @@ void XplicitNgine::createBody(PartInstance* partInstance)
|
||||
Vector3(physPosition[0], physPosition[1], physPosition[2])));
|
||||
}
|
||||
}
|
||||
//STEP SHOULD NOT BE HERE!
|
||||
//dWorldQuickStep(physWorld, stepSize);
|
||||
//dJointGroupEmpty(contactgroup);
|
||||
}
|
||||
|
||||
void XplicitNgine::step(float stepSize)
|
||||
@@ -224,8 +195,6 @@ void XplicitNgine::step(float stepSize)
|
||||
dJointGroupEmpty(contactgroup);
|
||||
dSpaceCollide (physSpace,0,&collisionCallback);
|
||||
dWorldQuickStep(physWorld, stepSize);
|
||||
//dWorldStepFast1(physWorld, stepSize*2, 100);
|
||||
//dWorldStep(physWorld, stepSize);
|
||||
}
|
||||
|
||||
void XplicitNgine::updateBody(PartInstance *partInstance)
|
||||
|
||||
@@ -63,12 +63,7 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
LRESULT CALLBACK ToolboxProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
//Application *app = (Application *)GetWindowLongPtr(hwnd, GWL_USERDATA);
|
||||
MessageBox(NULL, (LPCSTR)wParam, (LPCSTR)lParam, 1);
|
||||
//if (app==NULL)
|
||||
//{
|
||||
//return DefWindowProc(hwnd, msg, wParam, lParam);
|
||||
//}
|
||||
switch(msg)
|
||||
{
|
||||
case WM_SIZE:
|
||||
@@ -152,24 +147,11 @@ int main(int argc, char** argv) {
|
||||
try{
|
||||
#endif
|
||||
hresult = OleInitialize(NULL);
|
||||
|
||||
/* IInternetSecurityManager *pSecurityMgr;
|
||||
IInternetZoneManager *pZoneMgr;
|
||||
LPCWSTR site1 = SysAllocString(L"http://www.androdome.com");
|
||||
|
||||
hr = CoCreateInstance(CLSID_InternetSecurityManager, NULL, CLSCTX_INPROC_SERVER, IID_IInternetSecurityManager, (void**)&pSecurityMgr);
|
||||
|
||||
pSecurityMgr->SetZoneMapping((DWORD)2, site1, (DWORD)0); // 2 = Trusted Site, site1 is the URL to add, and 0 is to create the entry.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
if (!AXRegister())
|
||||
return 0;
|
||||
|
||||
|
||||
INITCOMMONCONTROLSEX icc;
|
||||
// WNDCLASSEX wcx;
|
||||
|
||||
/* Initialize common controls. Also needed for MANIFEST's */
|
||||
|
||||
@@ -179,10 +161,6 @@ int main(int argc, char** argv) {
|
||||
InitCommonControlsEx(&icc);
|
||||
|
||||
AudioPlayer::init();
|
||||
/* GAppSettings settings;
|
||||
settings.window.resizable = true;
|
||||
settings.writeLicenseFile = false;
|
||||
settings.window.center = true; */
|
||||
HMODULE hThisInstance = GetModuleHandle(NULL);
|
||||
|
||||
if (!createWindowClass("mainHWND",WndProc,hThisInstance))
|
||||
|
||||
Reference in New Issue
Block a user