add very simple (rudimentary) time series graphing example
tweak camera near plane distance, less sensitive mouse wheel
This commit is contained in:
Binary file not shown.
@@ -7,6 +7,8 @@ struct Common2dCanvasInterface
|
|||||||
virtual int createCanvas(const char* canvasName, int width, int height)=0;
|
virtual int createCanvas(const char* canvasName, int width, int height)=0;
|
||||||
virtual void destroyCanvas(int canvasId)=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 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;
|
virtual void refreshImageData(int canvasId)=0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ struct CommonGraphicsApp
|
|||||||
float cameraDistance = camera->getCameraDistance();
|
float cameraDistance = camera->getCameraDistance();
|
||||||
if (deltay<0 || cameraDistance>1)
|
if (deltay<0 || cameraDistance>1)
|
||||||
{
|
{
|
||||||
cameraDistance -= deltay*0.1f;
|
cameraDistance -= deltay*0.01f;
|
||||||
if (cameraDistance<1)
|
if (cameraDistance<1)
|
||||||
cameraDistance=1;
|
cameraDistance=1;
|
||||||
camera->setCameraDistance(cameraDistance);
|
camera->setCameraDistance(cameraDistance);
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
#include "../SharedMemory/PhysicsServerExample.h"
|
#include "../SharedMemory/PhysicsServerExample.h"
|
||||||
#include "../SharedMemory/PhysicsClientExample.h"
|
#include "../SharedMemory/PhysicsClientExample.h"
|
||||||
#include "../Constraints/TestHingeTorque.h"
|
#include "../Constraints/TestHingeTorque.h"
|
||||||
|
#include "../RenderingExamples/TimeSeriesExample.h"
|
||||||
|
|
||||||
|
|
||||||
#ifdef ENABLE_LUA
|
#ifdef ENABLE_LUA
|
||||||
@@ -204,6 +205,7 @@ static ExampleEntry gDefaultExamples[]=
|
|||||||
ExampleEntry(0,"Rendering"),
|
ExampleEntry(0,"Rendering"),
|
||||||
ExampleEntry(1,"Instanced Rendering", "Simple example of fast instanced rendering, only active when using OpenGL3+.",RenderInstancingCreateFunc),
|
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,"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)
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,13 @@ struct GraphingTexture
|
|||||||
m_imageData[x*4+y*4*m_width+3] = alpha;
|
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();
|
void uploadImageData();
|
||||||
|
|
||||||
int getTextureId()
|
int getTextureId()
|
||||||
|
|||||||
@@ -578,6 +578,14 @@ struct QuickCanvas : public Common2dCanvasInterface
|
|||||||
btAssert(m_curNumGraphWindows==1);
|
btAssert(m_curNumGraphWindows==1);
|
||||||
m_gt[canvasId]->setPixel(x,y,red,green,blue,alpha);
|
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)
|
virtual void refreshImageData(int canvasId)
|
||||||
{
|
{
|
||||||
m_gt[canvasId]->uploadImageData();
|
m_gt[canvasId]->uploadImageData();
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ struct SimpleCameraInternalData
|
|||||||
m_cameraUp(b3MakeVector3(0,1,0)),
|
m_cameraUp(b3MakeVector3(0,1,0)),
|
||||||
m_cameraUpAxis(1),
|
m_cameraUpAxis(1),
|
||||||
m_cameraForward(b3MakeVector3(1,0,0)),
|
m_cameraForward(b3MakeVector3(1,0,0)),
|
||||||
m_frustumZNear(1),
|
m_frustumZNear(0.01),
|
||||||
m_frustumZFar(10000),
|
m_frustumZFar(1000),
|
||||||
m_yaw(20),
|
m_yaw(20),
|
||||||
m_pitch(0),
|
m_pitch(0),
|
||||||
m_aspect(1)
|
m_aspect(1)
|
||||||
|
|||||||
1100
examples/RenderingExamples/TimeSeriesExample.cpp
Normal file
1100
examples/RenderingExamples/TimeSeriesExample.cpp
Normal file
File diff suppressed because it is too large
Load Diff
8
examples/RenderingExamples/TimeSeriesExample.h
Normal file
8
examples/RenderingExamples/TimeSeriesExample.h
Normal 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
|
||||||
Reference in New Issue
Block a user