add very simple (rudimentary) time series graphing example

tweak camera near plane distance, less sensitive mouse wheel
This commit is contained in:
Erwin Coumans
2015-07-15 09:07:47 -07:00
parent 48f6484b3d
commit a6fa717dac
9 changed files with 1130 additions and 3 deletions

Binary file not shown.

View File

@@ -7,6 +7,8 @@ struct Common2dCanvasInterface
virtual int createCanvas(const char* canvasName, int width, int height)=0;
virtual void destroyCanvas(int canvasId)=0;
virtual void setPixel(int canvasId, int x, int y, unsigned char red, unsigned char green,unsigned char blue, unsigned char alpha)=0;
virtual void getPixel(int canvasId, int x, int y, unsigned char& red, unsigned char& green,unsigned char& blue, unsigned char& alpha)=0;
virtual void refreshImageData(int canvasId)=0;
};

View File

@@ -187,7 +187,7 @@ struct CommonGraphicsApp
float cameraDistance = camera->getCameraDistance();
if (deltay<0 || cameraDistance>1)
{
cameraDistance -= deltay*0.1f;
cameraDistance -= deltay*0.01f;
if (cameraDistance<1)
cameraDistance=1;
camera->setCameraDistance(cameraDistance);

View File

@@ -34,6 +34,7 @@
#include "../SharedMemory/PhysicsServerExample.h"
#include "../SharedMemory/PhysicsClientExample.h"
#include "../Constraints/TestHingeTorque.h"
#include "../RenderingExamples/TimeSeriesExample.h"
#ifdef ENABLE_LUA
@@ -204,6 +205,7 @@ static ExampleEntry gDefaultExamples[]=
ExampleEntry(0,"Rendering"),
ExampleEntry(1,"Instanced Rendering", "Simple example of fast instanced rendering, only active when using OpenGL3+.",RenderInstancingCreateFunc),
ExampleEntry(1,"CoordinateSystemDemo","Show the axis and positive rotation direction around the axis.", CoordinateSystemCreateFunc),
ExampleEntry(1,"Time Series", "Render some value(s) in a 2D graph window, shifting to the left", TimeSeriesCreateFunc)
};

View File

@@ -24,6 +24,13 @@ struct GraphingTexture
m_imageData[x*4+y*4*m_width+3] = alpha;
}
void getPixel(int x, int y, unsigned char& red, unsigned char& green, unsigned char& blue, unsigned char& alpha)
{
red = m_imageData[x*4+y*4*m_width+0];
green = m_imageData[x*4+y*4*m_width+1];
blue = m_imageData[x*4+y*4*m_width+2];
alpha = m_imageData[x*4+y*4*m_width+3];
}
void uploadImageData();
int getTextureId()

View File

@@ -578,6 +578,14 @@ struct QuickCanvas : public Common2dCanvasInterface
btAssert(m_curNumGraphWindows==1);
m_gt[canvasId]->setPixel(x,y,red,green,blue,alpha);
}
virtual void getPixel(int canvasId, int x, int y, unsigned char& red, unsigned char& green,unsigned char& blue, unsigned char& alpha)
{
btAssert(canvasId==0);//hardcoded
btAssert(m_curNumGraphWindows==1);
m_gt[canvasId]->getPixel(x,y,red,green,blue,alpha);
}
virtual void refreshImageData(int canvasId)
{
m_gt[canvasId]->uploadImageData();

View File

@@ -12,8 +12,8 @@ struct SimpleCameraInternalData
m_cameraUp(b3MakeVector3(0,1,0)),
m_cameraUpAxis(1),
m_cameraForward(b3MakeVector3(1,0,0)),
m_frustumZNear(1),
m_frustumZFar(10000),
m_frustumZNear(0.01),
m_frustumZFar(1000),
m_yaw(20),
m_pitch(0),
m_aspect(1)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
#ifndef TIME_SERIES_EXAMPLE_H
#define TIME_SERIES_EXAMPLE_H
class CommonExampleInterface* TimeSeriesCreateFunc(struct CommonExampleOptions& options);
#endif//TIME_SERIES_EXAMPLE_H