fixed for Mac in examples

This commit is contained in:
Erwin Coumans 2015-04-16 15:52:30 -07:00
parent ffb0cab2e7
commit b2ba615874
9 changed files with 46 additions and 13 deletions

View File

@ -5,7 +5,7 @@
#include "../OpenGLWindow/SimpleOpenGL3App.h"
#include "../CommonInterfaces/CommonRenderInterface.h"
#ifdef __APPLE__
#include "OpenGLWindow/MacOpenGLWindow.h"
#include "../OpenGLWindow/MacOpenGLWindow.h"
#else
#ifdef _WIN32
#include "../OpenGLWindow/Win32OpenGLWindow.h"
@ -778,4 +778,4 @@ void OpenGLExampleBrowser::update(float deltaTime)
gui->forceUpdateScrollBars();
}
}

View File

@ -1,7 +1,7 @@
#include "ImportObjExample.h"
#include <vector>
#include "../OpenGLWindow/GLInstancingRenderer.h"
#include"../Wavefront/tiny_obj_loader.h"
#include"Wavefront/tiny_obj_loader.h"
#include "../OpenGLWindow/GLInstanceGraphicsShape.h"
#include "btBulletDynamicsCommon.h"
#include "../OpenGLWindow/SimpleOpenGL3App.h"

View File

@ -1,5 +1,5 @@
#include "LoadMeshFromObj.h"
#include"../Wavefront/tiny_obj_loader.h"
#include"Wavefront/tiny_obj_loader.h"
#include "../OpenGLWindow/GLInstanceGraphicsShape.h"
#include <stdio.h> //fopen
#include "Bullet3Common/b3AlignedObjectArray.h"
@ -14,4 +14,4 @@ GLInstanceGraphicsShape* LoadMeshFromObj(const char* relativeFileName, const cha
GLInstanceGraphicsShape* gfxShape = btgCreateGraphicsShapeFromWavefrontObj(shapes);
return gfxShape;
}
}

View File

@ -1,7 +1,7 @@
#ifndef WAVEFRONT2GRAPHICS_H
#define WAVEFRONT2GRAPHICS_H
#include"../Wavefront/tiny_obj_loader.h"
#include"Wavefront/tiny_obj_loader.h"
#include <vector>
struct GLInstanceGraphicsShape* btgCreateGraphicsShapeFromWavefrontObj(std::vector<tinyobj::shape_t>& shapes);

View File

@ -1,7 +1,7 @@
#ifndef MAC_OPENGL_WINDOW_H
#define MAC_OPENGL_WINDOW_H
#include "b3gWindowInterface.h"
#include "../CommonInterfaces/CommonWindowInterface.h"
#define b3gDefaultOpenGLWindow MacOpenGLWindow
@ -39,6 +39,8 @@ public:
void getMouseCoordinates(int& x, int& y);
void runMainLoop();
virtual bool isModifiedKeyPressed(int key);
void setMouseButtonCallback(b3MouseButtonCallback mouseCallback)
{
@ -51,7 +53,8 @@ public:
}
void setResizeCallback(b3ResizeCallback resizeCallback);
void setKeyboardCallback( b3KeyboardCallback keyboardCallback)
{
m_keyboardCallback = keyboardCallback;

View File

@ -222,6 +222,35 @@ MacOpenGLWindow::~MacOpenGLWindow()
}
bool MacOpenGLWindow::isModifiedKeyPressed(int key)
{
bool isPressed = false;
switch (key)
{
case B3G_ALT:
{
isPressed = ((m_modifierFlags && NSAlternateKeyMask)!=0);
break;
};
case B3G_SHIFT:
{
isPressed = ((m_modifierFlags && NSShiftKeyMask)!=0);
break;
};
case B3G_CONTROL:
{
isPressed = ((m_modifierFlags && NSControlKeyMask )!=0);
break;
};
default:
{
}
};
return isPressed;
}
float MacOpenGLWindow::getTimeInSeconds()
{
return 0.f;

View File

@ -795,4 +795,4 @@ b3WheelCallback Win32Window::getWheelCallback()
return m_data->m_wheelCallback;
}

View File

@ -47,11 +47,11 @@ struct RaytracerPhysicsSetup : public ExampleInterface
///lowlevelRaytest performs a ray versus convex shape, returning true is a hit is found (filling in worldNormal and worldHitPoint)
bool lowlevelRaytest(const btVector3& rayFrom,const btVector3& rayTo,btVector3& worldNormal,btVector3& worldHitPoint);
virtual bool RaytracerPhysicsSetup::mouseMoveCallback(float x,float y);
virtual bool mouseMoveCallback(float x,float y);
virtual bool RaytracerPhysicsSetup::mouseButtonCallback(int button, int state, float x, float y);
virtual bool mouseButtonCallback(int button, int state, float x, float y);
virtual bool RaytracerPhysicsSetup::keyboardCallback(int key, int state);
virtual bool keyboardCallback(int key, int state);
virtual void renderScene()
{
@ -381,4 +381,4 @@ void RaytracerPhysicsSetup::syncPhysicsToGraphics(GraphicsPhysicsBridge& gfxBrid
ExampleInterface* RayTracerCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option)
{
return new RaytracerPhysicsSetup(helper->getAppInterface());
}
}

View File

@ -4,6 +4,7 @@
#include <stdio.h>
#include "b3Scalar.h"
#include <stddef.h>//ptrdiff_h
#include <string>
struct b3FileUtils
{