mirror of
https://github.com/bulletphysics/bullet3
synced 2024-12-13 21:30:09 +00:00
fixed for Mac in examples
This commit is contained in:
parent
ffb0cab2e7
commit
b2ba615874
@ -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();
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -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"
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -795,4 +795,4 @@ b3WheelCallback Win32Window::getWheelCallback()
|
||||
return m_data->m_wheelCallback;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <stdio.h>
|
||||
#include "b3Scalar.h"
|
||||
#include <stddef.h>//ptrdiff_h
|
||||
#include <string>
|
||||
|
||||
struct b3FileUtils
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user