Merge branch 'master' into 3D-NN-walkers-example
This commit is contained in:
@@ -20,10 +20,7 @@
|
||||
class DynamicTexturedCubeDemo : public CommonExampleInterface
|
||||
{
|
||||
CommonGraphicsApp* m_app;
|
||||
float m_x;
|
||||
float m_y;
|
||||
float m_z;
|
||||
b3AlignedObjectArray<int> m_movingInstances;
|
||||
b3AlignedObjectArray<int> m_movingInstances;
|
||||
|
||||
|
||||
TinyVRGui* m_tinyVrGUI;
|
||||
@@ -37,10 +34,7 @@ public:
|
||||
|
||||
DynamicTexturedCubeDemo(CommonGraphicsApp* app)
|
||||
:m_app(app),
|
||||
m_x(0),
|
||||
m_y(0),
|
||||
m_z(0),
|
||||
m_tinyVrGUI(0)
|
||||
m_tinyVrGUI(0)
|
||||
{
|
||||
m_app->setUpAxis(2);
|
||||
|
||||
|
||||
@@ -76,16 +76,16 @@ struct RaytracerInternalData
|
||||
RaytracerInternalData()
|
||||
:m_canvasIndex(-1),
|
||||
m_canvas(0),
|
||||
m_roll(0),
|
||||
m_pitch(0),
|
||||
m_yaw(0),
|
||||
#ifdef _DEBUG
|
||||
m_width(64),
|
||||
m_height(64)
|
||||
m_width(64),
|
||||
m_height(64),
|
||||
#else
|
||||
m_width(128),
|
||||
m_height(128)
|
||||
m_width(128),
|
||||
m_height(128),
|
||||
#endif
|
||||
m_pitch(0),
|
||||
m_roll(0),
|
||||
m_yaw(0)
|
||||
{
|
||||
btConeShape* cone = new btConeShape(1,1);
|
||||
btSphereShape* sphere = new btSphereShape(1);
|
||||
@@ -300,7 +300,7 @@ void RaytracerPhysicsSetup::stepSimulation(float deltaTime)
|
||||
|
||||
|
||||
|
||||
int mode = 0;
|
||||
// int mode = 0;
|
||||
int x,y;
|
||||
|
||||
for (x=0;x<m_internalData->m_width;x++)
|
||||
|
||||
@@ -316,7 +316,7 @@ void TimeSeriesCanvas::insertDataAtCurrentTime(float orgV, int dataSourceIndex,
|
||||
float amp = m_internalData->m_pixelsPerUnit;
|
||||
//insert some new value(s) in the right-most column
|
||||
{
|
||||
float time = m_internalData->getTime();
|
||||
// float time = m_internalData->getTime();
|
||||
|
||||
float v = zero+amp*orgV;
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
#include "../CommonInterfaces/CommonParameterInterface.h"
|
||||
|
||||
|
||||
|
||||
|
||||
struct TinyRendererSetupInternalData
|
||||
{
|
||||
|
||||
@@ -42,17 +44,21 @@ struct TinyRendererSetupInternalData
|
||||
int m_textureHandle;
|
||||
int m_animateRenderer;
|
||||
|
||||
TinyRendererSetupInternalData(int width, int height)
|
||||
:m_roll(0),
|
||||
m_pitch(0),
|
||||
m_yaw(0),
|
||||
btVector3 m_lightPos;
|
||||
|
||||
m_width(width),
|
||||
m_height(height),
|
||||
TinyRendererSetupInternalData(int width, int height)
|
||||
:
|
||||
m_rgbColorBuffer(width,height,TGAImage::RGB),
|
||||
m_textureHandle(0),
|
||||
m_width(width),
|
||||
m_height(height),
|
||||
m_pitch(0),
|
||||
m_roll(0),
|
||||
m_yaw(0),
|
||||
m_textureHandle(0),
|
||||
m_animateRenderer(0)
|
||||
{
|
||||
m_lightPos.setValue(-3,15,15);
|
||||
|
||||
m_depthBuffer.resize(m_width*m_height);
|
||||
m_shadowBuffer.resize(m_width*m_height);
|
||||
// m_segmentationMaskBuffer.resize(m_width*m_height);
|
||||
@@ -115,9 +121,7 @@ struct TinyRendererSetup : public CommonExampleInterface
|
||||
|
||||
virtual bool keyboardCallback(int key, int state);
|
||||
|
||||
virtual void renderScene()
|
||||
{
|
||||
}
|
||||
virtual void renderScene();
|
||||
|
||||
void animateRenderer(int animateRendererIndex)
|
||||
{
|
||||
@@ -295,6 +299,28 @@ void TinyRendererSetup::initPhysics()
|
||||
m_guiHelper->getParameterInterface()->registerComboBox( comboParams);
|
||||
}
|
||||
|
||||
{
|
||||
SliderParams slider("LightPosX",&m_internalData->m_lightPos[0]);
|
||||
slider.m_minVal=-10;
|
||||
slider.m_maxVal=10;
|
||||
if (m_guiHelper->getParameterInterface())
|
||||
m_guiHelper->getParameterInterface()->registerSliderFloatParameter(slider);
|
||||
}
|
||||
{
|
||||
SliderParams slider("LightPosY",&m_internalData->m_lightPos[1]);
|
||||
slider.m_minVal=-10;
|
||||
slider.m_maxVal=10;
|
||||
if (m_guiHelper->getParameterInterface())
|
||||
m_guiHelper->getParameterInterface()->registerSliderFloatParameter(slider);
|
||||
}
|
||||
{
|
||||
SliderParams slider("LightPosZ",&m_internalData->m_lightPos[2]);
|
||||
slider.m_minVal=-10;
|
||||
slider.m_maxVal=10;
|
||||
if (m_guiHelper->getParameterInterface())
|
||||
m_guiHelper->getParameterInterface()->registerSliderFloatParameter(slider);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -303,14 +329,33 @@ void TinyRendererSetup::exitPhysics()
|
||||
|
||||
}
|
||||
|
||||
|
||||
void TinyRendererSetup::stepSimulation(float deltaTime)
|
||||
{
|
||||
m_internalData->updateTransforms();
|
||||
}
|
||||
|
||||
void TinyRendererSetup::renderScene()
|
||||
{
|
||||
m_internalData->updateTransforms();
|
||||
|
||||
btVector4 from(m_internalData->m_lightPos[0],m_internalData->m_lightPos[1],m_internalData->m_lightPos[2],1);
|
||||
btVector4 toX(m_internalData->m_lightPos[0]+0.1,m_internalData->m_lightPos[1],m_internalData->m_lightPos[2],1);
|
||||
btVector4 toY(m_internalData->m_lightPos[0],m_internalData->m_lightPos[1]+0.1,m_internalData->m_lightPos[2],1);
|
||||
btVector4 toZ(m_internalData->m_lightPos[0],m_internalData->m_lightPos[1],m_internalData->m_lightPos[2]+0.1,1);
|
||||
btVector4 colorX(1,0,0,1);
|
||||
btVector4 colorY(0,1,0,1);
|
||||
btVector4 colorZ(0,0,1,1);
|
||||
int width=2;
|
||||
m_guiHelper->getRenderInterface()->drawLine( from,toX,colorX,width);
|
||||
m_guiHelper->getRenderInterface()->drawLine( from,toY,colorY,width);
|
||||
m_guiHelper->getRenderInterface()->drawLine( from,toZ,colorZ,width);
|
||||
|
||||
if (!m_useSoftware)
|
||||
{
|
||||
|
||||
|
||||
btVector3 lightPos(m_internalData->m_lightPos[0],m_internalData->m_lightPos[1],m_internalData->m_lightPos[2]);
|
||||
m_guiHelper->getRenderInterface()->setLightPosition(lightPos);
|
||||
|
||||
for (int i=0;i<m_internalData->m_transforms.size();i++)
|
||||
{
|
||||
m_guiHelper->getRenderInterface()->writeSingleInstanceTransformToCPU(m_internalData->m_transforms[i].getOrigin(),m_internalData->m_transforms[i].getRotation(),i);
|
||||
@@ -358,17 +403,7 @@ void TinyRendererSetup::stepSimulation(float deltaTime)
|
||||
m_internalData->m_renderObjects[o]->m_viewMatrix[i][j] = viewMat[i+4*j];
|
||||
m_internalData->m_renderObjects[o]->m_projectionMatrix[i][j] = projMat[i+4*j];
|
||||
|
||||
btVector3 lightDirWorld;
|
||||
switch (m_app->getUpAxis())
|
||||
{
|
||||
case 1:
|
||||
lightDirWorld = btVector3(-50.f,100,30);
|
||||
break;
|
||||
case 2:
|
||||
lightDirWorld = btVector3(-50.f,30,100);
|
||||
break;
|
||||
default:{}
|
||||
};
|
||||
btVector3 lightDirWorld = btVector3(m_internalData->m_lightPos[0],m_internalData->m_lightPos[1],m_internalData->m_lightPos[2]);
|
||||
|
||||
m_internalData->m_renderObjects[o]->m_lightDirWorld = lightDirWorld.normalized();
|
||||
|
||||
@@ -399,17 +434,7 @@ void TinyRendererSetup::stepSimulation(float deltaTime)
|
||||
m_internalData->m_renderObjects[o]->m_viewMatrix[i][j] = viewMat[i+4*j];
|
||||
m_internalData->m_renderObjects[o]->m_projectionMatrix[i][j] = projMat[i+4*j];
|
||||
|
||||
btVector3 lightDirWorld;
|
||||
switch (m_app->getUpAxis())
|
||||
{
|
||||
case 1:
|
||||
lightDirWorld = btVector3(-50.f,100,30);
|
||||
break;
|
||||
case 2:
|
||||
lightDirWorld = btVector3(-50.f,30,100);
|
||||
break;
|
||||
default:{}
|
||||
};
|
||||
btVector3 lightDirWorld = btVector3(m_internalData->m_lightPos[0],m_internalData->m_lightPos[1],m_internalData->m_lightPos[2]);
|
||||
|
||||
m_internalData->m_renderObjects[o]->m_lightDirWorld = lightDirWorld.normalized();
|
||||
|
||||
|
||||
@@ -19,9 +19,10 @@ struct TestCanvasInterface2 : public Common2dCanvasInterface
|
||||
int m_height;
|
||||
|
||||
TestCanvasInterface2(b3AlignedObjectArray<unsigned char>& texelsRGB, int width, int height)
|
||||
:m_width(width),
|
||||
m_height(height),
|
||||
m_texelsRGB(texelsRGB)
|
||||
:
|
||||
m_texelsRGB(texelsRGB),
|
||||
m_width(width),
|
||||
m_height(height)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user