Thanks to @dchichkov for some of the fixes in the eglRendererPlugin!
Rename tinyRenderer -> eglRenderer in the eglRendererPlugin.
Allow to run the eglRendererPlugin to run on Windows (not in EGL mode but Win32OpenGLWindow mode)
Here is a script I tested on Windows:
~~~~~~~~~~~~
mport pybullet as p
import time
p.connect(p.DIRECT)
plugin = p.loadPlugin("e:/develop/bullet3/bin/pybullet_eglRendererPlugin_vs2010_x64_debug.dll","_eglRendererPlugin")
print("plugin=",plugin)
p.setGravity(0,0,-10)
p.loadURDF("plane.urdf",[0,0,-1])
p.loadURDF("r2d2.urdf")
pixelWidth = 320
pixelHeight = 220
while (1):
p.stepSimulation()
viewMatrix = [1.0, 0.0, -0.0, 0.0, -0.0, 0.1736481785774231, -0.9848078489303589, 0.0, 0.0, 0.9848078489303589, 0.1736481785774231, 0.0, -0.0, -5.960464477539063e-08, -4.0, 1.0]
projectionMatrix = [1.0825318098068237, 0.0, 0.0, 0.0, 0.0, 1.732050895690918, 0.0, 0.0, 0.0, 0.0, -1.0002000331878662, -1.0, 0.0, 0.0, -0.020002000033855438, 0.0]
#img_arr = p.getCameraImage(pixelWidth, pixelHeight, viewMatrix,projectionMatrix, shadow=1,lightDirection=[1,1,1])#,renderer=pybullet.ER_BULLET_HARDWARE_OPENGL)
img_arr = p.getCameraImage(pixelWidth, pixelHeight, shadow=1,lightDirection=[1,1,1])#,renderer=pybullet.ER_BULLET_HARDWARE_OPENGL)
#print("img_arr=",img_arr)
time.sleep(1)
~~~~~~~~~~~~~
This commit is contained in:
@@ -73,6 +73,14 @@
|
|||||||
description = "Use Midi controller to control parameters"
|
description = "Use Midi controller to control parameters"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
newoption
|
||||||
|
{
|
||||||
|
trigger = "enable_egl",
|
||||||
|
description = "Build an experimental eglPlugin"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
newoption
|
newoption
|
||||||
{
|
{
|
||||||
trigger = "enable_grpc",
|
trigger = "enable_grpc",
|
||||||
@@ -146,6 +154,13 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
if _OPTIONS["enable_egl"] then
|
||||||
|
function initEGL()
|
||||||
|
defines {"BT_USE_EGL"}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
if _OPTIONS["enable_grpc"] then
|
if _OPTIONS["enable_grpc"] then
|
||||||
function initGRPC()
|
function initGRPC()
|
||||||
|
|
||||||
|
|||||||
@@ -12,16 +12,17 @@ set /p myvar1= < tmp1234.txt
|
|||||||
set myvar=c:/%myvar1%
|
set myvar=c:/%myvar1%
|
||||||
del tmp1234.txt
|
del tmp1234.txt
|
||||||
|
|
||||||
#you can also override and hardcode the Python path like this (just remove the # hashmark in next line)
|
rem you can also override and hardcode the Python path like this (just remove the # hashmark in next line)
|
||||||
#SET myvar=c:\python-3.5.2
|
rem SET myvar=c:\python-3.5.2
|
||||||
|
|
||||||
cd build3
|
cd build3
|
||||||
|
|
||||||
|
|
||||||
premake4 --double --enable_multithreading --midi --enable_static_vr_plugin --enable_openvr --enable_pybullet --python_include_dir="%myvar%/include" --python_lib_dir="%myvar%/libs" --targetdir="../bin" vs2010
|
premake4 --double --enable_multithreading --midi --enable_static_vr_plugin --enable_openvr --enable_pybullet --python_include_dir="%myvar%/include" --python_lib_dir="%myvar%/libs" --targetdir="../bin" vs2010
|
||||||
#premake4 --double --grpc --enable_multithreading --midi --enable_static_vr_plugin --enable_openvr --enable_pybullet --python_include_dir="%myvar%/include" --python_lib_dir="%myvar%/libs" --targetdir="../binserver" vs2010
|
|
||||||
|
|
||||||
#premake4 --serial --audio --double --midi --enable_openvr --enable_pybullet --python_include_dir="%myvar%/include" --python_lib_dir="%myvar%/libs" --targetdir="../bin" vs2010
|
rem premake4 --double --enable_multithreading --midi --enable_static_vr_plugin --enable_openvr --enable_pybullet --python_include_dir="%myvar%/include" --python_lib_dir="%myvar%/libs" --targetdir="../binserver" vs2010
|
||||||
|
rem premake4 --double --enable_grpc --enable_multithreading --midi --enable_static_vr_plugin --enable_openvr --enable_pybullet --python_include_dir="%myvar%/include" --python_lib_dir="%myvar%/libs" --targetdir="../binserver" vs2010
|
||||||
|
rem premake4 --serial --audio --double --midi --enable_openvr --enable_pybullet --python_include_dir="%myvar%/include" --python_lib_dir="%myvar%/libs" --targetdir="../bin" vs2010
|
||||||
|
|
||||||
start vs2010
|
start vs2010
|
||||||
|
|
||||||
|
|||||||
@@ -30,11 +30,12 @@
|
|||||||
|
|
||||||
#ifdef BT_USE_EGL
|
#ifdef BT_USE_EGL
|
||||||
|
|
||||||
#include <pthread.h>
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#include "OpenGLInclude.h"
|
#include "OpenGLInclude.h"
|
||||||
|
|
||||||
@@ -213,7 +214,7 @@ void EGLOpenGLWindow::createWindow(const b3gWindowConstructionInfo& ci) {
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gladLoadGL(eglGetProcAddress)) {
|
if (!gladLoadGL((GLADloadfunc) eglGetProcAddress)) {
|
||||||
fprintf(stderr, "failed to load GL with glad.\n");
|
fprintf(stderr, "failed to load GL with glad.\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
@@ -228,8 +229,8 @@ void EGLOpenGLWindow::createWindow(const b3gWindowConstructionInfo& ci) {
|
|||||||
const GLubyte* sl = glGetString(GL_SHADING_LANGUAGE_VERSION);
|
const GLubyte* sl = glGetString(GL_SHADING_LANGUAGE_VERSION);
|
||||||
printf("GL_SHADING_LANGUAGE_VERSION=%s\n", sl);
|
printf("GL_SHADING_LANGUAGE_VERSION=%s\n", sl);
|
||||||
|
|
||||||
int i = pthread_getconcurrency();
|
//int i = pthread_getconcurrency();
|
||||||
printf("pthread_getconcurrency()=%d\n", i);
|
//printf("pthread_getconcurrency()=%d\n", i);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EGLOpenGLWindow::closeWindow() {
|
void EGLOpenGLWindow::closeWindow() {
|
||||||
|
|||||||
@@ -1,85 +0,0 @@
|
|||||||
import os
|
|
||||||
import sys
|
|
||||||
import time
|
|
||||||
import subprocess
|
|
||||||
import pybullet as p
|
|
||||||
from pdb import set_trace
|
|
||||||
import matplotlib.pyplot as plt
|
|
||||||
import numpy as np
|
|
||||||
#subprocess.call(["hardening-check", p.__file__])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
p.connect(p.DIRECT)
|
|
||||||
logId = p.startStateLogging(p.STATE_LOGGING_PROFILE_TIMINGS, "debugTimings")
|
|
||||||
|
|
||||||
plugin = True
|
|
||||||
if plugin:
|
|
||||||
plugin_fn = '/home/argusm/lang/bullet3/build/lib.linux-x86_64-3.5/eglRenderer.cpython-35m-x86_64-linux-gnu.so'
|
|
||||||
plugin = p.loadPlugin(plugin_fn,"_tinyRendererPlugin")
|
|
||||||
if plugin < 0:
|
|
||||||
print("\nPlugin Failed to load!\n")
|
|
||||||
sys.exit()
|
|
||||||
print("plugin =",plugin)
|
|
||||||
|
|
||||||
path = '/home/argusm/lang/bullet3/examples/pybullet/gym/pybullet_data/duck_vhacd.urdf'
|
|
||||||
p.loadURDF(path,globalScaling=12)
|
|
||||||
#path = '/home/argusm/lang/gym-grasping/gym_grasping/robots/models/kuka_iiwa/kuka_weiss_bolt.sdf'
|
|
||||||
#p.loadSDF(path)
|
|
||||||
|
|
||||||
start = time.time()
|
|
||||||
|
|
||||||
camTargetPos = [0,0,0]
|
|
||||||
upAxisIndex = 2
|
|
||||||
nearPlane = 0.01
|
|
||||||
farPlane = 100
|
|
||||||
camDistance = 2
|
|
||||||
pixelWidth = 128
|
|
||||||
pixelHeight = 128
|
|
||||||
fov = 60
|
|
||||||
|
|
||||||
plot = False
|
|
||||||
anim = True
|
|
||||||
if plot:
|
|
||||||
plt.ion()
|
|
||||||
if anim:
|
|
||||||
import matplotlib.animation as manimation
|
|
||||||
FFMpegWriter = manimation.writers['ffmpeg']
|
|
||||||
metadata = dict(title='Movie Test', artist='Matplotlib',
|
|
||||||
comment='Movie support!')
|
|
||||||
writer = FFMpegWriter(fps=15, metadata=metadata)
|
|
||||||
if plot or anim:
|
|
||||||
fig = plt.figure()
|
|
||||||
img = np.random.rand(pixelWidth,pixelHeight)
|
|
||||||
image = plt.imshow(img,interpolation='none',animated=True,label="blah")
|
|
||||||
ax = plt.gca()
|
|
||||||
ax.set_axis_off()
|
|
||||||
ax.set_aspect('equal')
|
|
||||||
plt.subplots_adjust(wspace=0, hspace=0, left=0, bottom=0, right=1, top=1)
|
|
||||||
|
|
||||||
|
|
||||||
try:
|
|
||||||
iter = range(0,360,10)
|
|
||||||
with writer.saving(fig, "debug.mp4", len(iter)):
|
|
||||||
for i,yaw in enumerate(iter):
|
|
||||||
viewMatrix = p.computeViewMatrixFromYawPitchRoll(camTargetPos, camDistance, 0, yaw-90, 0, upAxisIndex)
|
|
||||||
aspect = pixelWidth / pixelHeight;
|
|
||||||
projectionMatrix = p.computeProjectionMatrixFOV(fov, aspect, nearPlane, farPlane);
|
|
||||||
|
|
||||||
hight, width, img_arr, deept_arr, obj_arr = p.getCameraImage(pixelWidth,pixelHeight,viewMatrix,projectionMatrix)
|
|
||||||
if plot:
|
|
||||||
image.set_data(img_arr)#np_img_arr)
|
|
||||||
ax.plot([0])
|
|
||||||
#plt.draw()
|
|
||||||
#plt.show()
|
|
||||||
plt.pause(0.01)
|
|
||||||
if anim:
|
|
||||||
image.set_data(img_arr)#np_img_arr)
|
|
||||||
ax.plot([0])
|
|
||||||
writer.grab_frame()
|
|
||||||
|
|
||||||
if i % 100 == 0 and i > 0:
|
|
||||||
print("FPS",100/(time.time()-start))
|
|
||||||
start = time.time()
|
|
||||||
finally:
|
|
||||||
p.stopStateLogging(logId)
|
|
||||||
@@ -1,15 +1,7 @@
|
|||||||
|
|
||||||
//tinyRenderer plugin
|
//eglRenderer plugin
|
||||||
|
|
||||||
/*
|
//see Bullet/examples/pybullet/examples/eglRendererTest.py
|
||||||
import pybullet as p
|
|
||||||
p.connect(p.GUI)
|
|
||||||
plugin = p.loadPlugin("e:/develop/bullet3/bin/pybullet_tinyRendererPlugin_vs2010_x64_debug.dll","_tinyRendererPlugin")
|
|
||||||
print("plugin=",plugin)
|
|
||||||
p.loadURDF("r2d2.urdf")
|
|
||||||
while (1):
|
|
||||||
p.getCameraImage(320,200)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "eglRendererPlugin.h"
|
#include "eglRendererPlugin.h"
|
||||||
#include "eglRendererVisualShapeConverter.h"
|
#include "eglRendererVisualShapeConverter.h"
|
||||||
@@ -20,43 +12,43 @@ while (1):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct MyRendererPluginClass
|
struct EGLRendererPluginClass
|
||||||
{
|
{
|
||||||
|
|
||||||
TinyRendererVisualShapeConverter m_renderer;
|
EGLRendererVisualShapeConverter m_renderer;
|
||||||
MyRendererPluginClass()
|
EGLRendererPluginClass()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
virtual ~MyRendererPluginClass()
|
virtual ~EGLRendererPluginClass()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
B3_SHARED_API int initPlugin_tinyRendererPlugin(struct b3PluginContext* context)
|
B3_SHARED_API int initPlugin_eglRendererPlugin(struct b3PluginContext* context)
|
||||||
{
|
{
|
||||||
MyRendererPluginClass* obj = new MyRendererPluginClass();
|
EGLRendererPluginClass* obj = new EGLRendererPluginClass();
|
||||||
context->m_userPointer = obj;
|
context->m_userPointer = obj;
|
||||||
return SHARED_MEMORY_MAGIC_NUMBER;
|
return SHARED_MEMORY_MAGIC_NUMBER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
B3_SHARED_API int executePluginCommand_tinyRendererPlugin(struct b3PluginContext* context, const struct b3PluginArguments* arguments)
|
B3_SHARED_API int executePluginCommand_eglRendererPlugin(struct b3PluginContext* context, const struct b3PluginArguments* arguments)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
B3_SHARED_API void exitPlugin_tinyRendererPlugin(struct b3PluginContext* context)
|
B3_SHARED_API void exitPlugin_eglRendererPlugin(struct b3PluginContext* context)
|
||||||
{
|
{
|
||||||
MyRendererPluginClass* obj = (MyRendererPluginClass*) context->m_userPointer;
|
EGLRendererPluginClass* obj = (EGLRendererPluginClass*) context->m_userPointer;
|
||||||
delete obj;
|
delete obj;
|
||||||
context->m_userPointer = 0;
|
context->m_userPointer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//all the APIs below are optional
|
//all the APIs below are optional
|
||||||
B3_SHARED_API struct UrdfRenderingInterface* getRenderInterface_tinyRendererPlugin(struct b3PluginContext* context)
|
B3_SHARED_API struct UrdfRenderingInterface* getRenderInterface_eglRendererPlugin(struct b3PluginContext* context)
|
||||||
{
|
{
|
||||||
MyRendererPluginClass* obj = (MyRendererPluginClass*) context->m_userPointer;
|
EGLRendererPluginClass* obj = (EGLRendererPluginClass*) context->m_userPointer;
|
||||||
return &obj->m_renderer;
|
return &obj->m_renderer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef TINY_RENDERER_PLUGIN_H
|
#ifndef EGL_RENDERER_PLUGIN_H
|
||||||
#define TINY_RENDERER_PLUGIN_H
|
#define EGL_RENDERER_PLUGIN_H
|
||||||
|
|
||||||
#include "../b3PluginAPI.h"
|
#include "../b3PluginAPI.h"
|
||||||
|
|
||||||
@@ -9,12 +9,12 @@ extern "C"
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//initPlugin, exitPlugin and executePluginCommand are required, otherwise plugin won't load
|
//initPlugin, exitPlugin and executePluginCommand are required, otherwise plugin won't load
|
||||||
B3_SHARED_API int initPlugin_tinyRendererPlugin(struct b3PluginContext* context);
|
B3_SHARED_API int initPlugin_eglRendererPlugin(struct b3PluginContext* context);
|
||||||
B3_SHARED_API void exitPlugin_tinyRendererPlugin(struct b3PluginContext* context);
|
B3_SHARED_API void exitPlugin_eglRendererPlugin(struct b3PluginContext* context);
|
||||||
B3_SHARED_API int executePluginCommand_tinyRendererPlugin(struct b3PluginContext* context, const struct b3PluginArguments* arguments);
|
B3_SHARED_API int executePluginCommand_eglRendererPlugin(struct b3PluginContext* context, const struct b3PluginArguments* arguments);
|
||||||
|
|
||||||
//all the APIs below are optional
|
//all the APIs below are optional
|
||||||
B3_SHARED_API struct UrdfRenderingInterface* getRenderInterface_tinyRendererPlugin(struct b3PluginContext* context);
|
B3_SHARED_API struct UrdfRenderingInterface* getRenderInterface_eglRendererPlugin(struct b3PluginContext* context);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -22,4 +22,4 @@ B3_SHARED_API struct UrdfRenderingInterface* getRenderInterface_tinyRendererPlug
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif//#define TEST_PLUGIN_H
|
#endif//#define EGL_RENDERER_PLUGIN_H
|
||||||
|
|||||||
@@ -38,9 +38,16 @@ subject to the following restrictions:
|
|||||||
#include "stb_image/stb_image.h"
|
#include "stb_image/stb_image.h"
|
||||||
|
|
||||||
|
|
||||||
#include "../OpenGLWindow/EGLOpenGLWindow.h"
|
#ifdef _WIN32
|
||||||
#include "../OpenGLWindow/GLInstancingRenderer.h"
|
#include "OpenGLWindow/Win32OpenGLWindow.h"
|
||||||
#include "../OpenGLWindow/GLRenderToTexture.h"
|
typedef Win32OpenGLWindow DefaultOpenGLWindow;
|
||||||
|
#else
|
||||||
|
#include "OpenGLWindow/EGLOpenGLWindow.h"
|
||||||
|
typedef EGLOpenGLWindow DefaultOpenGLWindow;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "OpenGLWindow/GLInstancingRenderer.h"
|
||||||
|
#include "OpenGLWindow/GLRenderToTexture.h"
|
||||||
|
|
||||||
static void printGLString(const char *name, GLenum s) {
|
static void printGLString(const char *name, GLenum s) {
|
||||||
const char *v = (const char *) glGetString(s);
|
const char *v = (const char *) glGetString(s);
|
||||||
@@ -62,6 +69,7 @@ struct TinyRendererObjectArray
|
|||||||
btAlignedObjectArray< TinyRenderObjectData*> m_renderObjects;
|
btAlignedObjectArray< TinyRenderObjectData*> m_renderObjects;
|
||||||
int m_objectUniqueId;
|
int m_objectUniqueId;
|
||||||
int m_linkIndex;
|
int m_linkIndex;
|
||||||
|
int m_graphicsInstanceId;
|
||||||
btTransform m_worldTransform;
|
btTransform m_worldTransform;
|
||||||
btVector3 m_localScaling;
|
btVector3 m_localScaling;
|
||||||
|
|
||||||
@@ -69,13 +77,14 @@ struct TinyRendererObjectArray
|
|||||||
{
|
{
|
||||||
m_worldTransform.setIdentity();
|
m_worldTransform.setIdentity();
|
||||||
m_localScaling.setValue(1,1,1);
|
m_localScaling.setValue(1,1,1);
|
||||||
|
m_graphicsInstanceId = -1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#define START_WIDTH 640
|
#define START_WIDTH 640
|
||||||
#define START_HEIGHT 480
|
#define START_HEIGHT 480
|
||||||
|
|
||||||
struct TinyRendererVisualShapeConverterInternalData
|
struct EGLRendererVisualShapeConverterInternalData
|
||||||
{
|
{
|
||||||
class CommonWindowInterface* m_window;
|
class CommonWindowInterface* m_window;
|
||||||
class GLInstancingRenderer* m_instancingRenderer;
|
class GLInstancingRenderer* m_instancingRenderer;
|
||||||
@@ -111,7 +120,7 @@ struct TinyRendererVisualShapeConverterInternalData
|
|||||||
SimpleCamera m_camera;
|
SimpleCamera m_camera;
|
||||||
|
|
||||||
|
|
||||||
TinyRendererVisualShapeConverterInternalData()
|
EGLRendererVisualShapeConverterInternalData()
|
||||||
:m_upAxis(2),
|
:m_upAxis(2),
|
||||||
m_swWidth(START_WIDTH),
|
m_swWidth(START_WIDTH),
|
||||||
m_swHeight(START_HEIGHT),
|
m_swHeight(START_HEIGHT),
|
||||||
@@ -137,7 +146,7 @@ struct TinyRendererVisualShapeConverterInternalData
|
|||||||
|
|
||||||
// OpenGL window
|
// OpenGL window
|
||||||
bool allowRetina=true;
|
bool allowRetina=true;
|
||||||
m_window = new EGLOpenGLWindow();
|
m_window = new DefaultOpenGLWindow();
|
||||||
m_window->setAllowRetina(allowRetina);
|
m_window->setAllowRetina(allowRetina);
|
||||||
b3gWindowConstructionInfo ci;
|
b3gWindowConstructionInfo ci;
|
||||||
ci.m_title = "Title";
|
ci.m_title = "Title";
|
||||||
@@ -177,9 +186,9 @@ struct TinyRendererVisualShapeConverterInternalData
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
TinyRendererVisualShapeConverter::TinyRendererVisualShapeConverter()
|
EGLRendererVisualShapeConverter::EGLRendererVisualShapeConverter()
|
||||||
{
|
{
|
||||||
m_data = new TinyRendererVisualShapeConverterInternalData();
|
m_data = new EGLRendererVisualShapeConverterInternalData();
|
||||||
|
|
||||||
float dist = 1.5;
|
float dist = 1.5;
|
||||||
float pitch = -10;
|
float pitch = -10;
|
||||||
@@ -190,53 +199,53 @@ TinyRendererVisualShapeConverter::TinyRendererVisualShapeConverter()
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
TinyRendererVisualShapeConverter::~TinyRendererVisualShapeConverter()
|
EGLRendererVisualShapeConverter::~EGLRendererVisualShapeConverter()
|
||||||
{
|
{
|
||||||
resetAll();
|
resetAll();
|
||||||
delete m_data;
|
delete m_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TinyRendererVisualShapeConverter::setLightDirection(float x, float y, float z)
|
void EGLRendererVisualShapeConverter::setLightDirection(float x, float y, float z)
|
||||||
{
|
{
|
||||||
m_data->m_lightDirection.setValue(x, y, z);
|
m_data->m_lightDirection.setValue(x, y, z);
|
||||||
m_data->m_hasLightDirection = true;
|
m_data->m_hasLightDirection = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TinyRendererVisualShapeConverter::setLightColor(float x, float y, float z)
|
void EGLRendererVisualShapeConverter::setLightColor(float x, float y, float z)
|
||||||
{
|
{
|
||||||
m_data->m_lightColor.setValue(x, y, z);
|
m_data->m_lightColor.setValue(x, y, z);
|
||||||
m_data->m_hasLightColor = true;
|
m_data->m_hasLightColor = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TinyRendererVisualShapeConverter::setLightDistance(float dist)
|
void EGLRendererVisualShapeConverter::setLightDistance(float dist)
|
||||||
{
|
{
|
||||||
m_data->m_lightDistance = dist;
|
m_data->m_lightDistance = dist;
|
||||||
m_data->m_hasLightDistance = true;
|
m_data->m_hasLightDistance = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TinyRendererVisualShapeConverter::setShadow(bool hasShadow)
|
void EGLRendererVisualShapeConverter::setShadow(bool hasShadow)
|
||||||
{
|
{
|
||||||
m_data->m_hasShadow = hasShadow;
|
m_data->m_hasShadow = hasShadow;
|
||||||
}
|
}
|
||||||
void TinyRendererVisualShapeConverter::setFlags(int flags)
|
void EGLRendererVisualShapeConverter::setFlags(int flags)
|
||||||
{
|
{
|
||||||
m_data->m_flags = flags;
|
m_data->m_flags = flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TinyRendererVisualShapeConverter::setLightAmbientCoeff(float ambientCoeff)
|
void EGLRendererVisualShapeConverter::setLightAmbientCoeff(float ambientCoeff)
|
||||||
{
|
{
|
||||||
m_data->m_lightAmbientCoeff = ambientCoeff;
|
m_data->m_lightAmbientCoeff = ambientCoeff;
|
||||||
m_data->m_hasLightAmbientCoeff = true;
|
m_data->m_hasLightAmbientCoeff = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TinyRendererVisualShapeConverter::setLightDiffuseCoeff(float diffuseCoeff)
|
void EGLRendererVisualShapeConverter::setLightDiffuseCoeff(float diffuseCoeff)
|
||||||
{
|
{
|
||||||
m_data->m_lightDiffuseCoeff = diffuseCoeff;
|
m_data->m_lightDiffuseCoeff = diffuseCoeff;
|
||||||
m_data->m_hasLightDiffuseCoeff = true;
|
m_data->m_hasLightDiffuseCoeff = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TinyRendererVisualShapeConverter::setLightSpecularCoeff(float specularCoeff)
|
void EGLRendererVisualShapeConverter::setLightSpecularCoeff(float specularCoeff)
|
||||||
{
|
{
|
||||||
m_data->m_lightSpecularCoeff = specularCoeff;
|
m_data->m_lightSpecularCoeff = specularCoeff;
|
||||||
m_data->m_hasLightSpecularCoeff = true;
|
m_data->m_hasLightSpecularCoeff = true;
|
||||||
@@ -609,7 +618,7 @@ static btVector4 sColors[4] =
|
|||||||
// If you are getting segfaults in this function it may be ecause you are
|
// If you are getting segfaults in this function it may be ecause you are
|
||||||
// compliling the plugin with differently from pybullet, try complining the
|
// compliling the plugin with differently from pybullet, try complining the
|
||||||
// plugin with distutils too.
|
// plugin with distutils too.
|
||||||
void TinyRendererVisualShapeConverter::convertVisualShapes(
|
void EGLRendererVisualShapeConverter::convertVisualShapes(
|
||||||
int linkIndex, const char* pathPrefix, const btTransform& localInertiaFrame,
|
int linkIndex, const char* pathPrefix, const btTransform& localInertiaFrame,
|
||||||
const UrdfLink* linkPtr, const UrdfModel* model,
|
const UrdfLink* linkPtr, const UrdfModel* model,
|
||||||
int collisionObjectUniqueId, int bodyUniqueId)
|
int collisionObjectUniqueId, int bodyUniqueId)
|
||||||
@@ -740,12 +749,15 @@ void TinyRendererVisualShapeConverter::convertVisualShapes(
|
|||||||
int textureWidth=0;
|
int textureWidth=0;
|
||||||
int textureHeight=0;
|
int textureHeight=0;
|
||||||
bool isCached = false;
|
bool isCached = false;
|
||||||
|
int textureIndex = -1;
|
||||||
|
|
||||||
if (textures.size())
|
if (textures.size())
|
||||||
{
|
{
|
||||||
textureImage1 = textures[0].textureData1;
|
textureImage1 = textures[0].textureData1;
|
||||||
textureWidth = textures[0].m_width;
|
textureWidth = textures[0].m_width;
|
||||||
textureHeight = textures[0].m_height;
|
textureHeight = textures[0].m_height;
|
||||||
isCached = textures[0].m_isCached;
|
isCached = textures[0].m_isCached;
|
||||||
|
textureIndex = m_data->m_instancingRenderer->registerTexture(textureImage1, textureWidth, textureHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -760,10 +772,11 @@ void TinyRendererVisualShapeConverter::convertVisualShapes(
|
|||||||
B3_PROFILE("m_instancingRenderer register");
|
B3_PROFILE("m_instancingRenderer register");
|
||||||
|
|
||||||
// register mesh to m_instancingRenderer too.
|
// register mesh to m_instancingRenderer too.
|
||||||
int textureIndex = m_data->m_instancingRenderer->registerTexture(textureImage1, textureWidth, textureHeight);
|
|
||||||
int shapeIndex = m_data->m_instancingRenderer->registerShape(&vertices[0].xyzw[0], vertices.size(), &indices[0], indices.size(),textureIndex);
|
int shapeIndex = m_data->m_instancingRenderer->registerShape(&vertices[0].xyzw[0], vertices.size(), &indices[0], indices.size(),B3_GL_TRIANGLES, textureIndex);
|
||||||
btVector3 scaling(1,1,1);
|
btVector3 scaling(1,1,1);
|
||||||
m_data->m_instancingRenderer->registerGraphicsInstance(shapeIndex, &visualShape.m_localVisualFrame[0], &visualShape.m_localVisualFrame[3], &visualShape.m_rgbaColor[0],scaling);
|
visuals->m_graphicsInstanceId = m_data->m_instancingRenderer->registerGraphicsInstance(shapeIndex, &visualShape.m_localVisualFrame[0], &visualShape.m_localVisualFrame[3], &visualShape.m_rgbaColor[0],scaling);
|
||||||
|
|
||||||
m_data->m_instancingRenderer->writeTransforms();
|
m_data->m_instancingRenderer->writeTransforms();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -778,7 +791,7 @@ void TinyRendererVisualShapeConverter::convertVisualShapes(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int TinyRendererVisualShapeConverter::getNumVisualShapes(int bodyUniqueId)
|
int EGLRendererVisualShapeConverter::getNumVisualShapes(int bodyUniqueId)
|
||||||
{
|
{
|
||||||
int start = -1;
|
int start = -1;
|
||||||
//find first one, then count how many
|
//find first one, then count how many
|
||||||
@@ -810,7 +823,7 @@ int TinyRendererVisualShapeConverter::getNumVisualShapes(int bodyUniqueId)
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
int TinyRendererVisualShapeConverter::getVisualShapesData(int bodyUniqueId, int shapeIndex, struct b3VisualShapeData* shapeData)
|
int EGLRendererVisualShapeConverter::getVisualShapesData(int bodyUniqueId, int shapeIndex, struct b3VisualShapeData* shapeData)
|
||||||
{
|
{
|
||||||
int start = -1;
|
int start = -1;
|
||||||
//find first one, then count how many
|
//find first one, then count how many
|
||||||
@@ -837,7 +850,7 @@ int TinyRendererVisualShapeConverter::getVisualShapesData(int bodyUniqueId, int
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void TinyRendererVisualShapeConverter::changeRGBAColor(int bodyUniqueId, int linkIndex, int shapeIndex, const double rgbaColor[4])
|
void EGLRendererVisualShapeConverter::changeRGBAColor(int bodyUniqueId, int linkIndex, int shapeIndex, const double rgbaColor[4])
|
||||||
{
|
{
|
||||||
//int start = -1;
|
//int start = -1;
|
||||||
for (int i = 0; i < m_data->m_visualShapes.size(); i++)
|
for (int i = 0; i < m_data->m_visualShapes.size(); i++)
|
||||||
@@ -874,7 +887,7 @@ void TinyRendererVisualShapeConverter::changeRGBAColor(int bodyUniqueId, int lin
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void TinyRendererVisualShapeConverter::setUpAxis(int axis)
|
void EGLRendererVisualShapeConverter::setUpAxis(int axis)
|
||||||
{
|
{
|
||||||
m_data->m_upAxis = axis;
|
m_data->m_upAxis = axis;
|
||||||
m_data->m_camera.setCameraUpAxis(axis);
|
m_data->m_camera.setCameraUpAxis(axis);
|
||||||
@@ -882,7 +895,7 @@ void TinyRendererVisualShapeConverter::setUpAxis(int axis)
|
|||||||
m_data->m_instancingRenderer->updateCamera();
|
m_data->m_instancingRenderer->updateCamera();
|
||||||
|
|
||||||
}
|
}
|
||||||
void TinyRendererVisualShapeConverter::resetCamera(float camDist, float yaw, float pitch, float camPosX,float camPosY, float camPosZ)
|
void EGLRendererVisualShapeConverter::resetCamera(float camDist, float yaw, float pitch, float camPosX,float camPosY, float camPosZ)
|
||||||
{
|
{
|
||||||
m_data->m_camera.setCameraDistance(camDist);
|
m_data->m_camera.setCameraDistance(camDist);
|
||||||
m_data->m_camera.setCameraPitch(pitch);
|
m_data->m_camera.setCameraPitch(pitch);
|
||||||
@@ -892,7 +905,7 @@ void TinyRendererVisualShapeConverter::resetCamera(float camDist, float yaw, flo
|
|||||||
m_data->m_camera.update();
|
m_data->m_camera.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TinyRendererVisualShapeConverter::clearBuffers(TGAColor& clearColor)
|
void EGLRendererVisualShapeConverter::clearBuffers(TGAColor& clearColor)
|
||||||
{
|
{
|
||||||
float farPlane = m_data->m_camera.getCameraFrustumFar();
|
float farPlane = m_data->m_camera.getCameraFrustumFar();
|
||||||
for(int y=0;y<m_data->m_swHeight;++y)
|
for(int y=0;y<m_data->m_swHeight;++y)
|
||||||
@@ -908,7 +921,7 @@ void TinyRendererVisualShapeConverter::clearBuffers(TGAColor& clearColor)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TinyRendererVisualShapeConverter::render()
|
void EGLRendererVisualShapeConverter::render()
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
ATTRIBUTE_ALIGNED16(float viewMat[16]);
|
ATTRIBUTE_ALIGNED16(float viewMat[16]);
|
||||||
@@ -920,13 +933,23 @@ void TinyRendererVisualShapeConverter::render()
|
|||||||
cout<<viewMat[4*2 + 0]<<" "<<viewMat[4*2+1]<<" "<<viewMat[4*2+2]<<" "<<viewMat[4*2+3] << endl;
|
cout<<viewMat[4*2 + 0]<<" "<<viewMat[4*2+1]<<" "<<viewMat[4*2+2]<<" "<<viewMat[4*2+3] << endl;
|
||||||
cout<<viewMat[4*3 + 0]<<" "<<viewMat[4*3+1]<<" "<<viewMat[4*3+2]<<" "<<viewMat[4*3+3] << endl;
|
cout<<viewMat[4*3 + 0]<<" "<<viewMat[4*3+1]<<" "<<viewMat[4*3+2]<<" "<<viewMat[4*3+3] << endl;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
B3_PROFILE("m_instancingRenderer render");
|
B3_PROFILE("m_instancingRenderer render");
|
||||||
|
m_data->m_instancingRenderer->writeTransforms();
|
||||||
|
if (m_data->m_hasLightDirection)
|
||||||
|
{
|
||||||
|
m_data->m_instancingRenderer->setLightPosition(m_data->m_lightDirection);
|
||||||
|
}
|
||||||
m_data->m_instancingRenderer->setActiveCamera(&m_data->m_camera);
|
m_data->m_instancingRenderer->setActiveCamera(&m_data->m_camera);
|
||||||
m_data->m_instancingRenderer->updateCamera();
|
m_data->m_instancingRenderer->updateCamera(m_data->m_upAxis);
|
||||||
|
|
||||||
m_data->m_instancingRenderer->renderScene();
|
m_data->m_instancingRenderer->renderScene();
|
||||||
|
m_data->m_window->endRendering();
|
||||||
|
m_data->m_window->startRendering();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TinyRendererVisualShapeConverter::render(const float viewMat[16], const float projMat[16])
|
void EGLRendererVisualShapeConverter::render(const float viewMat[16], const float projMat[16])
|
||||||
{
|
{
|
||||||
// This code is very similar to that of
|
// This code is very similar to that of
|
||||||
// PhysicsServerCommandProcessor::processRequestCameraImageCommand
|
// PhysicsServerCommandProcessor::processRequestCameraImageCommand
|
||||||
@@ -934,10 +957,10 @@ void TinyRendererVisualShapeConverter::render(const float viewMat[16], const flo
|
|||||||
|
|
||||||
// Tiny allows rendering with viewMat, projMat explicitly, but
|
// Tiny allows rendering with viewMat, projMat explicitly, but
|
||||||
// GLInstancingRender calls m_activeCamera, so set this.
|
// GLInstancingRender calls m_activeCamera, so set this.
|
||||||
|
|
||||||
m_data->m_camera.setVRCamera(viewMat,projMat);
|
m_data->m_camera.setVRCamera(viewMat,projMat);
|
||||||
m_data->m_instancingRenderer->setActiveCamera(&m_data->m_camera);
|
|
||||||
m_data->m_instancingRenderer->updateCamera();
|
render();
|
||||||
m_data->m_instancingRenderer->renderScene();
|
|
||||||
|
|
||||||
//cout<<viewMat[4*0 + 0]<<" "<<viewMat[4*0+1]<<" "<<viewMat[4*0+2]<<" "<<viewMat[4*0+3] << endl;
|
//cout<<viewMat[4*0 + 0]<<" "<<viewMat[4*0+1]<<" "<<viewMat[4*0+2]<<" "<<viewMat[4*0+3] << endl;
|
||||||
//cout<<viewMat[4*1 + 0]<<" "<<viewMat[4*1+1]<<" "<<viewMat[4*1+2]<<" "<<viewMat[4*1+3] << endl;
|
//cout<<viewMat[4*1 + 0]<<" "<<viewMat[4*1+1]<<" "<<viewMat[4*1+2]<<" "<<viewMat[4*1+3] << endl;
|
||||||
@@ -945,14 +968,14 @@ void TinyRendererVisualShapeConverter::render(const float viewMat[16], const flo
|
|||||||
//cout<<viewMat[4*3 + 0]<<" "<<viewMat[4*3+1]<<" "<<viewMat[4*3+2]<<" "<<viewMat[4*3+3] << endl;
|
//cout<<viewMat[4*3 + 0]<<" "<<viewMat[4*3+1]<<" "<<viewMat[4*3+2]<<" "<<viewMat[4*3+3] << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TinyRendererVisualShapeConverter::getWidthAndHeight(int& width, int& height)
|
void EGLRendererVisualShapeConverter::getWidthAndHeight(int& width, int& height)
|
||||||
{
|
{
|
||||||
width = m_data->m_swWidth;
|
width = m_data->m_swWidth;
|
||||||
height = m_data->m_swHeight;
|
height = m_data->m_swHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TinyRendererVisualShapeConverter::setWidthAndHeight(int width, int height)
|
void EGLRendererVisualShapeConverter::setWidthAndHeight(int width, int height)
|
||||||
{
|
{
|
||||||
m_data->m_swWidth = width;
|
m_data->m_swWidth = width;
|
||||||
m_data->m_swHeight = height;
|
m_data->m_swHeight = height;
|
||||||
@@ -966,7 +989,7 @@ void TinyRendererVisualShapeConverter::setWidthAndHeight(int width, int height)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//copied from OpenGLGuiHelper.cpp
|
//copied from OpenGLGuiHelper.cpp
|
||||||
void TinyRendererVisualShapeConverter::copyCameraImageDataGL(
|
void EGLRendererVisualShapeConverter::copyCameraImageDataGL(
|
||||||
unsigned char* pixelsRGBA, int rgbaBufferSizeInPixels,
|
unsigned char* pixelsRGBA, int rgbaBufferSizeInPixels,
|
||||||
float* depthBuffer, int depthBufferSizeInPixels,
|
float* depthBuffer, int depthBufferSizeInPixels,
|
||||||
int* segmentationMaskBuffer, int segmentationMaskSizeInPixels,
|
int* segmentationMaskBuffer, int segmentationMaskSizeInPixels,
|
||||||
@@ -1079,7 +1102,7 @@ void TinyRendererVisualShapeConverter::copyCameraImageDataGL(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TinyRendererVisualShapeConverter::copyCameraImageData(unsigned char* pixelsRGBA, int rgbaBufferSizeInPixels,
|
void EGLRendererVisualShapeConverter::copyCameraImageData(unsigned char* pixelsRGBA, int rgbaBufferSizeInPixels,
|
||||||
float* depthBuffer, int depthBufferSizeInPixels,
|
float* depthBuffer, int depthBufferSizeInPixels,
|
||||||
int* segmentationMaskBuffer, int segmentationMaskSizeInPixels,
|
int* segmentationMaskBuffer, int segmentationMaskSizeInPixels,
|
||||||
int startPixelIndex, int* widthPtr, int* heightPtr, int* numPixelsCopied)
|
int startPixelIndex, int* widthPtr, int* heightPtr, int* numPixelsCopied)
|
||||||
@@ -1091,7 +1114,7 @@ void TinyRendererVisualShapeConverter::copyCameraImageData(unsigned char* pixels
|
|||||||
startPixelIndex, widthPtr, heightPtr, numPixelsCopied);
|
startPixelIndex, widthPtr, heightPtr, numPixelsCopied);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TinyRendererVisualShapeConverter::removeVisualShape(int collisionObjectUniqueId)
|
void EGLRendererVisualShapeConverter::removeVisualShape(int collisionObjectUniqueId)
|
||||||
{
|
{
|
||||||
TinyRendererObjectArray** ptrptr = m_data->m_swRenderInstances[collisionObjectUniqueId];
|
TinyRendererObjectArray** ptrptr = m_data->m_swRenderInstances[collisionObjectUniqueId];
|
||||||
if (ptrptr && *ptrptr)
|
if (ptrptr && *ptrptr)
|
||||||
@@ -1110,7 +1133,7 @@ void TinyRendererVisualShapeConverter::removeVisualShape(int collisionObjectUniq
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TinyRendererVisualShapeConverter::resetAll()
|
void EGLRendererVisualShapeConverter::resetAll()
|
||||||
{
|
{
|
||||||
for (int i=0;i<m_data->m_swRenderInstances.size();i++)
|
for (int i=0;i<m_data->m_swRenderInstances.size();i++)
|
||||||
{
|
{
|
||||||
@@ -1142,7 +1165,7 @@ void TinyRendererVisualShapeConverter::resetAll()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TinyRendererVisualShapeConverter::changeShapeTexture(int objectUniqueId, int jointIndex, int shapeIndex, int textureUniqueId)
|
void EGLRendererVisualShapeConverter::changeShapeTexture(int objectUniqueId, int jointIndex, int shapeIndex, int textureUniqueId)
|
||||||
{
|
{
|
||||||
btAssert(textureUniqueId < m_data->m_textures.size());
|
btAssert(textureUniqueId < m_data->m_textures.size());
|
||||||
if (textureUniqueId >= 0 && textureUniqueId < m_data->m_textures.size())
|
if (textureUniqueId >= 0 && textureUniqueId < m_data->m_textures.size())
|
||||||
@@ -1170,7 +1193,7 @@ void TinyRendererVisualShapeConverter::changeShapeTexture(int objectUniqueId, in
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int TinyRendererVisualShapeConverter::registerTexture(unsigned char* texels, int width, int height)
|
int EGLRendererVisualShapeConverter::registerTexture(unsigned char* texels, int width, int height)
|
||||||
{
|
{
|
||||||
MyTexture2 texData;
|
MyTexture2 texData;
|
||||||
texData.m_width = width;
|
texData.m_width = width;
|
||||||
@@ -1181,7 +1204,7 @@ int TinyRendererVisualShapeConverter::registerTexture(unsigned char* texels, int
|
|||||||
return m_data->m_textures.size()-1;
|
return m_data->m_textures.size()-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int TinyRendererVisualShapeConverter::loadTextureFile(const char* filename)
|
int EGLRendererVisualShapeConverter::loadTextureFile(const char* filename)
|
||||||
{
|
{
|
||||||
B3_PROFILE("loadTextureFile");
|
B3_PROFILE("loadTextureFile");
|
||||||
int width,height,n;
|
int width,height,n;
|
||||||
@@ -1194,7 +1217,7 @@ int TinyRendererVisualShapeConverter::loadTextureFile(const char* filename)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TinyRendererVisualShapeConverter::syncTransform(int collisionObjectUniqueId, const btTransform& worldTransform, const btVector3& localScaling)
|
void EGLRendererVisualShapeConverter::syncTransform(int collisionObjectUniqueId, const btTransform& worldTransform, const btVector3& localScaling)
|
||||||
{
|
{
|
||||||
TinyRendererObjectArray** renderObjPtr = m_data->m_swRenderInstances[collisionObjectUniqueId];
|
TinyRendererObjectArray** renderObjPtr = m_data->m_swRenderInstances[collisionObjectUniqueId];
|
||||||
if (renderObjPtr)
|
if (renderObjPtr)
|
||||||
@@ -1202,5 +1225,11 @@ void TinyRendererVisualShapeConverter::syncTransform(int collisionObjectUniqueId
|
|||||||
TinyRendererObjectArray* renderObj = *renderObjPtr;
|
TinyRendererObjectArray* renderObj = *renderObjPtr;
|
||||||
renderObj->m_worldTransform = worldTransform;
|
renderObj->m_worldTransform = worldTransform;
|
||||||
renderObj->m_localScaling = localScaling;
|
renderObj->m_localScaling = localScaling;
|
||||||
|
if (renderObj->m_graphicsInstanceId>=0)
|
||||||
|
{
|
||||||
|
btVector3 pos = worldTransform.getOrigin();
|
||||||
|
btQuaternion orn = worldTransform.getRotation();
|
||||||
|
m_data->m_instancingRenderer->writeSingleInstanceTransformToCPU(pos, orn, renderObj->m_graphicsInstanceId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,15 +3,14 @@
|
|||||||
|
|
||||||
#include "../../../Importers/ImportURDFDemo/UrdfRenderingInterface.h"
|
#include "../../../Importers/ImportURDFDemo/UrdfRenderingInterface.h"
|
||||||
|
|
||||||
struct TinyRendererVisualShapeConverter : public UrdfRenderingInterface
|
struct EGLRendererVisualShapeConverter : public UrdfRenderingInterface
|
||||||
{
|
{
|
||||||
int frame = 0;
|
|
||||||
|
|
||||||
struct TinyRendererVisualShapeConverterInternalData* m_data;
|
struct EGLRendererVisualShapeConverterInternalData* m_data;
|
||||||
|
|
||||||
TinyRendererVisualShapeConverter();
|
EGLRendererVisualShapeConverter();
|
||||||
|
|
||||||
virtual ~TinyRendererVisualShapeConverter();
|
virtual ~EGLRendererVisualShapeConverter();
|
||||||
|
|
||||||
virtual void convertVisualShapes(int linkIndex, const char* pathPrefix, const btTransform& localInertiaFrame, const UrdfLink* linkPtr, const UrdfModel* model, int shapeUid, int objectIndex);
|
virtual void convertVisualShapes(int linkIndex, const char* pathPrefix, const btTransform& localInertiaFrame, const UrdfLink* linkPtr, const UrdfModel* model, int shapeUid, int objectIndex);
|
||||||
|
|
||||||
|
|||||||
@@ -3,25 +3,36 @@
|
|||||||
project ("pybullet_eglRendererPlugin")
|
project ("pybullet_eglRendererPlugin")
|
||||||
language "C++"
|
language "C++"
|
||||||
kind "SharedLib"
|
kind "SharedLib"
|
||||||
|
initEGL()
|
||||||
|
|
||||||
includedirs {".","../../../../src", "../../../../examples",
|
includedirs {".","../../../../src", "../../../../examples",
|
||||||
"../../../ThirdPartyLibs"}
|
"../../../ThirdPartyLibs", ""../../examples/ThirdPartyLibs/glad"}
|
||||||
defines {"PHYSICS_IN_PROCESS_EXAMPLE_BROWSER"}
|
defines {"PHYSICS_IN_PROCESS_EXAMPLE_BROWSER", "STB_AGAIN"}
|
||||||
hasCL = findOpenCL("clew")
|
hasCL = findOpenCL("clew")
|
||||||
|
|
||||||
links{"BulletCollision", "Bullet3Common", "LinearMath"}
|
links{"BulletCollision", "Bullet3Common", "LinearMath"}
|
||||||
|
|
||||||
|
initOpenGL()
|
||||||
|
|
||||||
|
if os.is("Windows") then
|
||||||
|
files {"../../../OpenGLWindow/Win32OpenGLWindow.cpp",
|
||||||
|
"../../../OpenGLWindow/Win32GLWindow.cpp",}
|
||||||
|
|
||||||
|
end
|
||||||
if os.is("MacOSX") then
|
if os.is("MacOSX") then
|
||||||
-- targetextension {"so"}
|
-- targetextension {"so"}
|
||||||
links{"Cocoa.framework","Python"}
|
links{"Cocoa.framework"}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if os.is("Linux") then
|
||||||
|
files {"../../../ThirdPartyLibs/glad/glx.c",}
|
||||||
|
end
|
||||||
|
|
||||||
files {
|
files {
|
||||||
"eglRendererPlugin.cpp",
|
"eglRendererPlugin.cpp",
|
||||||
"eglRendererPlugin.h",
|
"eglRendererPlugin.h",
|
||||||
"TinyRendererVisualShapeConverter.cpp",
|
"eglRendererVisualShapeConverter.cpp",
|
||||||
"TinyRendererVisualShapeConverter.h",
|
"eglRendererVisualShapeConverter.h",
|
||||||
"../../../Importers/ImportColladaDemo/LoadMeshFromCollada.cpp",
|
"../../../Importers/ImportColladaDemo/LoadMeshFromCollada.cpp",
|
||||||
"../../../Importers/ImportColladaDemo/LoadMeshFromCollada.h",
|
"../../../Importers/ImportColladaDemo/LoadMeshFromCollada.h",
|
||||||
"../../../Importers/ImportMeshUtility/b3ImportMeshUtility.cpp",
|
"../../../Importers/ImportMeshUtility/b3ImportMeshUtility.cpp",
|
||||||
@@ -35,14 +46,22 @@ project ("pybullet_eglRendererPlugin")
|
|||||||
"../../../TinyRenderer/our_gl.cpp",
|
"../../../TinyRenderer/our_gl.cpp",
|
||||||
"../../../TinyRenderer/tgaimage.cpp",
|
"../../../TinyRenderer/tgaimage.cpp",
|
||||||
"../../../TinyRenderer/TinyRenderer.cpp",
|
"../../../TinyRenderer/TinyRenderer.cpp",
|
||||||
"../../../ThirdPartyLibs/Wavefront/egl_obj_loader.cpp",
|
"../../../ThirdPartyLibs/glad/gl.c",
|
||||||
"../../../ThirdPartyLibs/Wavefront/egl_obj_loader.h",
|
"../../../ThirdPartyLibs/glad/egl.c",
|
||||||
|
"../../../ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp",
|
||||||
|
"../../../ThirdPartyLibs/Wavefront/tiny_obj_loader.h",
|
||||||
"../../../ThirdPartyLibs/stb_image/stb_image.cpp",
|
"../../../ThirdPartyLibs/stb_image/stb_image.cpp",
|
||||||
"../../../ThirdPartyLibs/stb_image/stb_image.h",
|
"../../../ThirdPartyLibs/stb_image/stb_image.h",
|
||||||
"../../../ThirdPartyLibs/eglxml2/eglxml2.cpp",
|
"../../../ThirdPartyLibs/tinyxml2/tinyxml2.cpp",
|
||||||
"../../../ThirdPartyLibs/eglxml2/eglxml2.h",
|
"../../../ThirdPartyLibs/tinyxml2/tinyxml2.h",
|
||||||
"../../../OpenGLWindow/SimpleCamera.cpp",
|
"../../../OpenGLWindow/SimpleCamera.cpp",
|
||||||
"../../../OpenGLWindow/SimpleCamera.h",
|
"../../../OpenGLWindow/SimpleCamera.h",
|
||||||
|
"../../../OpenGLWindow/GLInstancingRenderer.cpp",
|
||||||
|
"../../../OpenGLWindow/GLInstancingRenderer.h",
|
||||||
|
"../../../OpenGLWindow/LoadShader.cpp",
|
||||||
|
"../../../OpenGLWindow/LoadShader.h",
|
||||||
|
"../../../OpenGLWindow/GLRenderToTexture.cpp",
|
||||||
|
"../../../OpenGLWindow/GLRenderToTexture.h",
|
||||||
"../../../Utils/b3Clock.cpp",
|
"../../../Utils/b3Clock.cpp",
|
||||||
"../../../Utils/b3Clock.h",
|
"../../../Utils/b3Clock.h",
|
||||||
"../../../Utils/b3ResourcePath.cpp",
|
"../../../Utils/b3ResourcePath.cpp",
|
||||||
|
|||||||
@@ -474,6 +474,10 @@ include "plugins/tinyRendererPlugin"
|
|||||||
include "plugins/pdControlPlugin"
|
include "plugins/pdControlPlugin"
|
||||||
include "plugins/collisionFilterPlugin"
|
include "plugins/collisionFilterPlugin"
|
||||||
|
|
||||||
|
if _OPTIONS["enable_egl"] then
|
||||||
|
include "plugins/eglPlugin"
|
||||||
|
end
|
||||||
|
|
||||||
if _OPTIONS["enable_grpc"] then
|
if _OPTIONS["enable_grpc"] then
|
||||||
include "grpc"
|
include "grpc"
|
||||||
include "plugins/grpcPlugin"
|
include "plugins/grpcPlugin"
|
||||||
|
|||||||
Reference in New Issue
Block a user