[DEV] Better shader debugLog, and bullet compatibility with Android
This commit is contained in:
parent
e79a88c7f1
commit
0dffbae44d
2
build
2
build
@ -1 +1 @@
|
|||||||
Subproject commit aca9ee5a4dc58f87a5670eb1ad4490ebc5d0910d
|
Subproject commit 94dbc0b4755f2e28b96c8cfea013037665a2d278
|
3
external/bullet/Generic.mk
vendored
3
external/bullet/Generic.mk
vendored
@ -11,7 +11,8 @@ LOCAL_C_INCLUDES := \
|
|||||||
$(LOCAL_PATH)/bullet/Extras/ConvexDecomposition
|
$(LOCAL_PATH)/bullet/Extras/ConvexDecomposition
|
||||||
|
|
||||||
LOCAL_CFLAGS := -Wno-write-strings \
|
LOCAL_CFLAGS := -Wno-write-strings \
|
||||||
-DHAVE_CONFIG_H
|
-DHAVE_CONFIG_H \
|
||||||
|
-O2
|
||||||
|
|
||||||
|
|
||||||
# load the common sources file of the platform
|
# load the common sources file of the platform
|
||||||
|
4
external/bullet/file.mk
vendored
4
external/bullet/file.mk
vendored
@ -146,7 +146,7 @@ FILE_LIST+= \
|
|||||||
bullet/Extras/GIMPACTUtils/btGImpactConvexDecompositionShape.cpp
|
bullet/Extras/GIMPACTUtils/btGImpactConvexDecompositionShape.cpp
|
||||||
|
|
||||||
# lib convexdecomposition
|
# lib convexdecomposition
|
||||||
FILE_LIST+= \
|
#FILE_LIST+= \
|
||||||
bullet/Extras/ConvexDecomposition/concavity.cpp \
|
bullet/Extras/ConvexDecomposition/concavity.cpp \
|
||||||
bullet/Extras/ConvexDecomposition/ConvexDecomposition.cpp \
|
bullet/Extras/ConvexDecomposition/ConvexDecomposition.cpp \
|
||||||
bullet/Extras/ConvexDecomposition/vlookup.cpp \
|
bullet/Extras/ConvexDecomposition/vlookup.cpp \
|
||||||
@ -164,7 +164,7 @@ FILE_LIST+= \
|
|||||||
|
|
||||||
|
|
||||||
# lib HACD
|
# lib HACD
|
||||||
FILE_LIST+= \
|
#FILE_LIST+= \
|
||||||
bullet/Extras/HACD/hacdGraph.cpp \
|
bullet/Extras/HACD/hacdGraph.cpp \
|
||||||
bullet/Extras/HACD/hacdHACD.cpp \
|
bullet/Extras/HACD/hacdHACD.cpp \
|
||||||
bullet/Extras/HACD/hacdICHull.cpp \
|
bullet/Extras/HACD/hacdICHull.cpp \
|
||||||
|
@ -20,7 +20,10 @@ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
|
|||||||
|
|
||||||
LOCAL_CFLAGS := -Wno-write-strings \
|
LOCAL_CFLAGS := -Wno-write-strings \
|
||||||
-DEWOL_VERSION_TAG_NAME="\"$(LOCAL_VERSION_TAG)-$(BUILD_DIRECTORY_MODE)\"" \
|
-DEWOL_VERSION_TAG_NAME="\"$(LOCAL_VERSION_TAG)-$(BUILD_DIRECTORY_MODE)\"" \
|
||||||
-DDATA_IN_APK
|
-DDATA_IN_APK \
|
||||||
|
-O2
|
||||||
|
|
||||||
|
#LOCAL_EXPORT_CFLAGS := -DBT_USE_NEON
|
||||||
|
|
||||||
LOCAL_EXPORT_LDLIBS := -lGLESv2
|
LOCAL_EXPORT_LDLIBS := -lGLESv2
|
||||||
|
|
||||||
|
@ -173,7 +173,22 @@ void ewol::Program::UpdateContext(void)
|
|||||||
GLint bufLength = 0;
|
GLint bufLength = 0;
|
||||||
l_bufferDisplayError[0] = '\0';
|
l_bufferDisplayError[0] = '\0';
|
||||||
glGetProgramInfoLog(m_program, LOG_OGL_INTERNAL_BUFFER_LEN, &bufLength, l_bufferDisplayError);
|
glGetProgramInfoLog(m_program, LOG_OGL_INTERNAL_BUFFER_LEN, &bufLength, l_bufferDisplayError);
|
||||||
EWOL_ERROR("Could not compile \"PROGRAM\": " << l_bufferDisplayError);
|
char tmpLog[256];
|
||||||
|
int32_t idOut=0;
|
||||||
|
EWOL_ERROR("Could not compile \"PROGRAM\": ");
|
||||||
|
for (int32_t iii=0; iii<LOG_OGL_INTERNAL_BUFFER_LEN ; iii++) {
|
||||||
|
tmpLog[idOut] = l_bufferDisplayError[iii];
|
||||||
|
if (tmpLog[idOut] == '\n' || tmpLog[idOut] == '\0') {
|
||||||
|
tmpLog[idOut] = '\0';
|
||||||
|
EWOL_ERROR(" | " << tmpLog);
|
||||||
|
idOut=0;
|
||||||
|
} else {
|
||||||
|
idOut++;
|
||||||
|
}
|
||||||
|
if (l_bufferDisplayError[iii] == '\0') {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
glDeleteProgram(m_program);
|
glDeleteProgram(m_program);
|
||||||
checkGlError("glDeleteProgram", __LINE__);
|
checkGlError("glDeleteProgram", __LINE__);
|
||||||
m_program = 0;
|
m_program = 0;
|
||||||
@ -265,6 +280,9 @@ void ewol::Program::Reload(void)
|
|||||||
|
|
||||||
void ewol::Program::SendAttribute(int32_t idElem, int32_t nbElement, void* pointer, int32_t jumpBetweenSample)
|
void ewol::Program::SendAttribute(int32_t idElem, int32_t nbElement, void* pointer, int32_t jumpBetweenSample)
|
||||||
{
|
{
|
||||||
|
if (0==m_program) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (idElem<0 || idElem>m_elementList.Size()) {
|
if (idElem<0 || idElem>m_elementList.Size()) {
|
||||||
EWOL_ERROR("idElem = " << idElem << " not in [0.." << (m_elementList.Size()-1) << "]");
|
EWOL_ERROR("idElem = " << idElem << " not in [0.." << (m_elementList.Size()-1) << "]");
|
||||||
return;
|
return;
|
||||||
@ -287,6 +305,9 @@ void ewol::Program::SendAttribute(int32_t idElem, int32_t nbElement, void* point
|
|||||||
|
|
||||||
void ewol::Program::UniformMatrix4fv(int32_t idElem, int32_t nbElement, mat4 _matrix, bool transpose)
|
void ewol::Program::UniformMatrix4fv(int32_t idElem, int32_t nbElement, mat4 _matrix, bool transpose)
|
||||||
{
|
{
|
||||||
|
if (0==m_program) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (idElem<0 || idElem>m_elementList.Size()) {
|
if (idElem<0 || idElem>m_elementList.Size()) {
|
||||||
EWOL_ERROR("idElem = " << idElem << " not in [0.." << (m_elementList.Size()-1) << "]");
|
EWOL_ERROR("idElem = " << idElem << " not in [0.." << (m_elementList.Size()-1) << "]");
|
||||||
return;
|
return;
|
||||||
@ -306,6 +327,9 @@ void ewol::Program::UniformMatrix4fv(int32_t idElem, int32_t nbElement, mat4 _ma
|
|||||||
|
|
||||||
void ewol::Program::Uniform1f(int32_t idElem, float value1)
|
void ewol::Program::Uniform1f(int32_t idElem, float value1)
|
||||||
{
|
{
|
||||||
|
if (0==m_program) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (idElem<0 || idElem>m_elementList.Size()) {
|
if (idElem<0 || idElem>m_elementList.Size()) {
|
||||||
EWOL_ERROR("idElem = " << idElem << " not in [0.." << (m_elementList.Size()-1) << "]");
|
EWOL_ERROR("idElem = " << idElem << " not in [0.." << (m_elementList.Size()-1) << "]");
|
||||||
return;
|
return;
|
||||||
@ -318,6 +342,9 @@ void ewol::Program::Uniform1f(int32_t idElem, float value1)
|
|||||||
}
|
}
|
||||||
void ewol::Program::Uniform2f(int32_t idElem, float value1, float value2)
|
void ewol::Program::Uniform2f(int32_t idElem, float value1, float value2)
|
||||||
{
|
{
|
||||||
|
if (0==m_program) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (idElem<0 || idElem>m_elementList.Size()) {
|
if (idElem<0 || idElem>m_elementList.Size()) {
|
||||||
EWOL_ERROR("idElem = " << idElem << " not in [0.." << (m_elementList.Size()-1) << "]");
|
EWOL_ERROR("idElem = " << idElem << " not in [0.." << (m_elementList.Size()-1) << "]");
|
||||||
return;
|
return;
|
||||||
@ -330,6 +357,9 @@ void ewol::Program::Uniform2f(int32_t idElem, float value1, float value2)
|
|||||||
}
|
}
|
||||||
void ewol::Program::Uniform3f(int32_t idElem, float value1, float value2, float value3)
|
void ewol::Program::Uniform3f(int32_t idElem, float value1, float value2, float value3)
|
||||||
{
|
{
|
||||||
|
if (0==m_program) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (idElem<0 || idElem>m_elementList.Size()) {
|
if (idElem<0 || idElem>m_elementList.Size()) {
|
||||||
EWOL_ERROR("idElem = " << idElem << " not in [0.." << (m_elementList.Size()-1) << "]");
|
EWOL_ERROR("idElem = " << idElem << " not in [0.." << (m_elementList.Size()-1) << "]");
|
||||||
return;
|
return;
|
||||||
@ -342,6 +372,9 @@ void ewol::Program::Uniform3f(int32_t idElem, float value1, float value2, float
|
|||||||
}
|
}
|
||||||
void ewol::Program::Uniform4f(int32_t idElem, float value1, float value2, float value3, float value4)
|
void ewol::Program::Uniform4f(int32_t idElem, float value1, float value2, float value3, float value4)
|
||||||
{
|
{
|
||||||
|
if (0==m_program) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (idElem<0 || idElem>m_elementList.Size()) {
|
if (idElem<0 || idElem>m_elementList.Size()) {
|
||||||
EWOL_ERROR("idElem = " << idElem << " not in [0.." << (m_elementList.Size()-1) << "]");
|
EWOL_ERROR("idElem = " << idElem << " not in [0.." << (m_elementList.Size()-1) << "]");
|
||||||
return;
|
return;
|
||||||
@ -357,6 +390,9 @@ void ewol::Program::Uniform4f(int32_t idElem, float value1, float value2, float
|
|||||||
|
|
||||||
void ewol::Program::Uniform1i(int32_t idElem, int32_t value1)
|
void ewol::Program::Uniform1i(int32_t idElem, int32_t value1)
|
||||||
{
|
{
|
||||||
|
if (0==m_program) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (idElem<0 || idElem>m_elementList.Size()) {
|
if (idElem<0 || idElem>m_elementList.Size()) {
|
||||||
EWOL_ERROR("idElem = " << idElem << " not in [0.." << (m_elementList.Size()-1) << "]");
|
EWOL_ERROR("idElem = " << idElem << " not in [0.." << (m_elementList.Size()-1) << "]");
|
||||||
return;
|
return;
|
||||||
@ -369,6 +405,9 @@ void ewol::Program::Uniform1i(int32_t idElem, int32_t value1)
|
|||||||
}
|
}
|
||||||
void ewol::Program::Uniform2i(int32_t idElem, int32_t value1, int32_t value2)
|
void ewol::Program::Uniform2i(int32_t idElem, int32_t value1, int32_t value2)
|
||||||
{
|
{
|
||||||
|
if (0==m_program) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (idElem<0 || idElem>m_elementList.Size()) {
|
if (idElem<0 || idElem>m_elementList.Size()) {
|
||||||
EWOL_ERROR("idElem = " << idElem << " not in [0.." << (m_elementList.Size()-1) << "]");
|
EWOL_ERROR("idElem = " << idElem << " not in [0.." << (m_elementList.Size()-1) << "]");
|
||||||
return;
|
return;
|
||||||
@ -381,6 +420,9 @@ void ewol::Program::Uniform2i(int32_t idElem, int32_t value1, int32_t value2)
|
|||||||
}
|
}
|
||||||
void ewol::Program::Uniform3i(int32_t idElem, int32_t value1, int32_t value2, int32_t value3)
|
void ewol::Program::Uniform3i(int32_t idElem, int32_t value1, int32_t value2, int32_t value3)
|
||||||
{
|
{
|
||||||
|
if (0==m_program) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (idElem<0 || idElem>m_elementList.Size()) {
|
if (idElem<0 || idElem>m_elementList.Size()) {
|
||||||
EWOL_ERROR("idElem = " << idElem << " not in [0.." << (m_elementList.Size()-1) << "]");
|
EWOL_ERROR("idElem = " << idElem << " not in [0.." << (m_elementList.Size()-1) << "]");
|
||||||
return;
|
return;
|
||||||
@ -393,6 +435,9 @@ void ewol::Program::Uniform3i(int32_t idElem, int32_t value1, int32_t value2, in
|
|||||||
}
|
}
|
||||||
void ewol::Program::Uniform4i(int32_t idElem, int32_t value1, int32_t value2, int32_t value3, int32_t value4)
|
void ewol::Program::Uniform4i(int32_t idElem, int32_t value1, int32_t value2, int32_t value3, int32_t value4)
|
||||||
{
|
{
|
||||||
|
if (0==m_program) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (idElem<0 || idElem>m_elementList.Size()) {
|
if (idElem<0 || idElem>m_elementList.Size()) {
|
||||||
EWOL_ERROR("idElem = " << idElem << " not in [0.." << (m_elementList.Size()-1) << "]");
|
EWOL_ERROR("idElem = " << idElem << " not in [0.." << (m_elementList.Size()-1) << "]");
|
||||||
return;
|
return;
|
||||||
@ -409,6 +454,9 @@ void ewol::Program::Uniform4i(int32_t idElem, int32_t value1, int32_t value2, in
|
|||||||
|
|
||||||
void ewol::Program::Uniform1fv(int32_t idElem, int32_t nbElement, float *value)
|
void ewol::Program::Uniform1fv(int32_t idElem, int32_t nbElement, float *value)
|
||||||
{
|
{
|
||||||
|
if (0==m_program) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (idElem<0 || idElem>m_elementList.Size()) {
|
if (idElem<0 || idElem>m_elementList.Size()) {
|
||||||
EWOL_ERROR("idElem = " << idElem << " not in [0.." << (m_elementList.Size()-1) << "]");
|
EWOL_ERROR("idElem = " << idElem << " not in [0.." << (m_elementList.Size()-1) << "]");
|
||||||
return;
|
return;
|
||||||
@ -429,6 +477,9 @@ void ewol::Program::Uniform1fv(int32_t idElem, int32_t nbElement, float *value)
|
|||||||
}
|
}
|
||||||
void ewol::Program::Uniform2fv(int32_t idElem, int32_t nbElement, float *value)
|
void ewol::Program::Uniform2fv(int32_t idElem, int32_t nbElement, float *value)
|
||||||
{
|
{
|
||||||
|
if (0==m_program) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (idElem<0 || idElem>m_elementList.Size()) {
|
if (idElem<0 || idElem>m_elementList.Size()) {
|
||||||
EWOL_ERROR("idElem = " << idElem << " not in [0.." << (m_elementList.Size()-1) << "]");
|
EWOL_ERROR("idElem = " << idElem << " not in [0.." << (m_elementList.Size()-1) << "]");
|
||||||
return;
|
return;
|
||||||
@ -449,6 +500,9 @@ void ewol::Program::Uniform2fv(int32_t idElem, int32_t nbElement, float *value)
|
|||||||
}
|
}
|
||||||
void ewol::Program::Uniform3fv(int32_t idElem, int32_t nbElement, float *value)
|
void ewol::Program::Uniform3fv(int32_t idElem, int32_t nbElement, float *value)
|
||||||
{
|
{
|
||||||
|
if (0==m_program) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (idElem<0 || idElem>m_elementList.Size()) {
|
if (idElem<0 || idElem>m_elementList.Size()) {
|
||||||
EWOL_ERROR("idElem = " << idElem << " not in [0.." << (m_elementList.Size()-1) << "]");
|
EWOL_ERROR("idElem = " << idElem << " not in [0.." << (m_elementList.Size()-1) << "]");
|
||||||
return;
|
return;
|
||||||
@ -469,6 +523,9 @@ void ewol::Program::Uniform3fv(int32_t idElem, int32_t nbElement, float *value)
|
|||||||
}
|
}
|
||||||
void ewol::Program::Uniform4fv(int32_t idElem, int32_t nbElement, float *value)
|
void ewol::Program::Uniform4fv(int32_t idElem, int32_t nbElement, float *value)
|
||||||
{
|
{
|
||||||
|
if (0==m_program) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (idElem<0 || idElem>m_elementList.Size()) {
|
if (idElem<0 || idElem>m_elementList.Size()) {
|
||||||
EWOL_ERROR("idElem = " << idElem << " not in [0.." << (m_elementList.Size()-1) << "]");
|
EWOL_ERROR("idElem = " << idElem << " not in [0.." << (m_elementList.Size()-1) << "]");
|
||||||
return;
|
return;
|
||||||
@ -492,6 +549,9 @@ void ewol::Program::Uniform4fv(int32_t idElem, int32_t nbElement, float *value)
|
|||||||
|
|
||||||
void ewol::Program::Uniform1iv(int32_t idElem, int32_t nbElement, int32_t *value)
|
void ewol::Program::Uniform1iv(int32_t idElem, int32_t nbElement, int32_t *value)
|
||||||
{
|
{
|
||||||
|
if (0==m_program) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (idElem<0 || idElem>m_elementList.Size()) {
|
if (idElem<0 || idElem>m_elementList.Size()) {
|
||||||
EWOL_ERROR("idElem = " << idElem << " not in [0.." << (m_elementList.Size()-1) << "]");
|
EWOL_ERROR("idElem = " << idElem << " not in [0.." << (m_elementList.Size()-1) << "]");
|
||||||
return;
|
return;
|
||||||
@ -512,6 +572,9 @@ void ewol::Program::Uniform1iv(int32_t idElem, int32_t nbElement, int32_t *value
|
|||||||
}
|
}
|
||||||
void ewol::Program::Uniform2iv(int32_t idElem, int32_t nbElement, int32_t *value)
|
void ewol::Program::Uniform2iv(int32_t idElem, int32_t nbElement, int32_t *value)
|
||||||
{
|
{
|
||||||
|
if (0==m_program) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (idElem<0 || idElem>m_elementList.Size()) {
|
if (idElem<0 || idElem>m_elementList.Size()) {
|
||||||
EWOL_ERROR("idElem = " << idElem << " not in [0.." << (m_elementList.Size()-1) << "]");
|
EWOL_ERROR("idElem = " << idElem << " not in [0.." << (m_elementList.Size()-1) << "]");
|
||||||
return;
|
return;
|
||||||
@ -532,6 +595,9 @@ void ewol::Program::Uniform2iv(int32_t idElem, int32_t nbElement, int32_t *value
|
|||||||
}
|
}
|
||||||
void ewol::Program::Uniform3iv(int32_t idElem, int32_t nbElement, int32_t *value)
|
void ewol::Program::Uniform3iv(int32_t idElem, int32_t nbElement, int32_t *value)
|
||||||
{
|
{
|
||||||
|
if (0==m_program) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (idElem<0 || idElem>m_elementList.Size()) {
|
if (idElem<0 || idElem>m_elementList.Size()) {
|
||||||
EWOL_ERROR("idElem = " << idElem << " not in [0.." << (m_elementList.Size()-1) << "]");
|
EWOL_ERROR("idElem = " << idElem << " not in [0.." << (m_elementList.Size()-1) << "]");
|
||||||
return;
|
return;
|
||||||
@ -552,6 +618,9 @@ void ewol::Program::Uniform3iv(int32_t idElem, int32_t nbElement, int32_t *value
|
|||||||
}
|
}
|
||||||
void ewol::Program::Uniform4iv(int32_t idElem, int32_t nbElement, int32_t *value)
|
void ewol::Program::Uniform4iv(int32_t idElem, int32_t nbElement, int32_t *value)
|
||||||
{
|
{
|
||||||
|
if (0==m_program) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (idElem<0 || idElem>m_elementList.Size()) {
|
if (idElem<0 || idElem>m_elementList.Size()) {
|
||||||
EWOL_ERROR("idElem = " << idElem << " not in [0.." << (m_elementList.Size()-1) << "]");
|
EWOL_ERROR("idElem = " << idElem << " not in [0.." << (m_elementList.Size()-1) << "]");
|
||||||
return;
|
return;
|
||||||
@ -577,6 +646,9 @@ void ewol::Program::Uniform4iv(int32_t idElem, int32_t nbElement, int32_t *value
|
|||||||
|
|
||||||
void ewol::Program::Use(void)
|
void ewol::Program::Use(void)
|
||||||
{
|
{
|
||||||
|
if (0==m_program) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
glUseProgram(m_program);
|
glUseProgram(m_program);
|
||||||
checkGlError("glUseProgram", __LINE__);
|
checkGlError("glUseProgram", __LINE__);
|
||||||
}
|
}
|
||||||
@ -584,6 +656,9 @@ void ewol::Program::Use(void)
|
|||||||
|
|
||||||
void ewol::Program::SetTexture0(int32_t idElem, GLint textureOpenGlID)
|
void ewol::Program::SetTexture0(int32_t idElem, GLint textureOpenGlID)
|
||||||
{
|
{
|
||||||
|
if (0==m_program) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (idElem<0 || idElem>m_elementList.Size()) {
|
if (idElem<0 || idElem>m_elementList.Size()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -607,6 +682,9 @@ void ewol::Program::SetTexture0(int32_t idElem, GLint textureOpenGlID)
|
|||||||
|
|
||||||
void ewol::Program::UnUse(void)
|
void ewol::Program::UnUse(void)
|
||||||
{
|
{
|
||||||
|
if (0==m_program) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
#if 0
|
#if 0
|
||||||
if (true == m_hasTexture) {
|
if (true == m_hasTexture) {
|
||||||
glDisable(GL_TEXTURE_2D);
|
glDisable(GL_TEXTURE_2D);
|
||||||
|
@ -41,12 +41,14 @@ class SceneDebugDrawer : public btIDebugDraw
|
|||||||
virtual void drawLine(const btVector3& from,const btVector3& to,const btVector3& fromColor, const btVector3& toColor)
|
virtual void drawLine(const btVector3& from,const btVector3& to,const btVector3& fromColor, const btVector3& toColor)
|
||||||
{
|
{
|
||||||
EWOL_DEBUG("DebugDisplay : drawLine");
|
EWOL_DEBUG("DebugDisplay : drawLine");
|
||||||
|
/*
|
||||||
glBegin(GL_LINES);
|
glBegin(GL_LINES);
|
||||||
glColor3f(fromColor.getX(), fromColor.getY(), fromColor.getZ());
|
glColor3f(fromColor.getX(), fromColor.getY(), fromColor.getZ());
|
||||||
glVertex3d(from.getX(), from.getY(), from.getZ());
|
glVertex3d(from.getX(), from.getY(), from.getZ());
|
||||||
glColor3f(toColor.getX(), toColor.getY(), toColor.getZ());
|
glColor3f(toColor.getX(), toColor.getY(), toColor.getZ());
|
||||||
glVertex3d(to.getX(), to.getY(), to.getZ());
|
glVertex3d(to.getX(), to.getY(), to.getZ());
|
||||||
glEnd();
|
glEnd();
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
virtual void drawLine(const btVector3& from,const btVector3& to,const btVector3& color)
|
virtual void drawLine(const btVector3& from,const btVector3& to,const btVector3& color)
|
||||||
{
|
{
|
||||||
@ -55,9 +57,11 @@ class SceneDebugDrawer : public btIDebugDraw
|
|||||||
virtual void drawSphere (const btVector3& p, btScalar radius, const btVector3& color)
|
virtual void drawSphere (const btVector3& p, btScalar radius, const btVector3& color)
|
||||||
{
|
{
|
||||||
EWOL_DEBUG("DebugDisplay : drawSphere");
|
EWOL_DEBUG("DebugDisplay : drawSphere");
|
||||||
|
/*
|
||||||
glColor4f (color.getX(), color.getY(), color.getZ(), btScalar(1.0f));
|
glColor4f (color.getX(), color.getY(), color.getZ(), btScalar(1.0f));
|
||||||
glPushMatrix ();
|
glPushMatrix ();
|
||||||
glTranslatef (p.getX(), p.getY(), p.getZ());
|
glTranslatef (p.getX(), p.getY(), p.getZ());
|
||||||
|
*/
|
||||||
int lats = 5;
|
int lats = 5;
|
||||||
int longs = 5;
|
int longs = 5;
|
||||||
int i, j;
|
int i, j;
|
||||||
@ -68,6 +72,7 @@ class SceneDebugDrawer : public btIDebugDraw
|
|||||||
btScalar lat1 = SIMD_PI * (-btScalar(0.5) + (btScalar) i / lats);
|
btScalar lat1 = SIMD_PI * (-btScalar(0.5) + (btScalar) i / lats);
|
||||||
btScalar z1 = radius*sin(lat1);
|
btScalar z1 = radius*sin(lat1);
|
||||||
btScalar zr1 = radius*cos(lat1);
|
btScalar zr1 = radius*cos(lat1);
|
||||||
|
/*
|
||||||
glBegin(GL_QUAD_STRIP);
|
glBegin(GL_QUAD_STRIP);
|
||||||
for(j = 0; j <= longs; j++) {
|
for(j = 0; j <= longs; j++) {
|
||||||
btScalar lng = 2 * SIMD_PI * (btScalar) (j - 1) / longs;
|
btScalar lng = 2 * SIMD_PI * (btScalar) (j - 1) / longs;
|
||||||
@ -79,8 +84,9 @@ class SceneDebugDrawer : public btIDebugDraw
|
|||||||
glVertex3f(x * zr1, y * zr1, z1);
|
glVertex3f(x * zr1, y * zr1, z1);
|
||||||
}
|
}
|
||||||
glEnd();
|
glEnd();
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
glPopMatrix();
|
//glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void drawTriangle(const btVector3& a,const btVector3& b,const btVector3& c,const btVector3& color,btScalar alpha)
|
virtual void drawTriangle(const btVector3& a,const btVector3& b,const btVector3& c,const btVector3& color,btScalar alpha)
|
||||||
@ -88,6 +94,7 @@ class SceneDebugDrawer : public btIDebugDraw
|
|||||||
EWOL_DEBUG("DebugDisplay : drawTriangle");
|
EWOL_DEBUG("DebugDisplay : drawTriangle");
|
||||||
// if (m_debugMode > 0)
|
// if (m_debugMode > 0)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
const btVector3 n=btCross(b-a,c-a).normalized();
|
const btVector3 n=btCross(b-a,c-a).normalized();
|
||||||
glBegin(GL_TRIANGLES);
|
glBegin(GL_TRIANGLES);
|
||||||
glColor4f(color.getX(), color.getY(), color.getZ(),alpha);
|
glColor4f(color.getX(), color.getY(), color.getZ(),alpha);
|
||||||
@ -96,6 +103,7 @@ class SceneDebugDrawer : public btIDebugDraw
|
|||||||
glVertex3d(b.getX(),b.getY(),b.getZ());
|
glVertex3d(b.getX(),b.getY(),b.getZ());
|
||||||
glVertex3d(c.getX(),c.getY(),c.getZ());
|
glVertex3d(c.getX(),c.getY(),c.getZ());
|
||||||
glEnd();
|
glEnd();
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,6 +111,7 @@ class SceneDebugDrawer : public btIDebugDraw
|
|||||||
virtual void drawContactPoint(const btVector3& pointOnB,const btVector3& normalOnB,btScalar distance,int lifeTime,const btVector3& color)
|
virtual void drawContactPoint(const btVector3& pointOnB,const btVector3& normalOnB,btScalar distance,int lifeTime,const btVector3& color)
|
||||||
{
|
{
|
||||||
EWOL_DEBUG("DebugDisplay : drawContactPoint");
|
EWOL_DEBUG("DebugDisplay : drawContactPoint");
|
||||||
|
/*
|
||||||
btVector3 to=pointOnB+normalOnB*1;//distance;
|
btVector3 to=pointOnB+normalOnB*1;//distance;
|
||||||
const btVector3&from = pointOnB;
|
const btVector3&from = pointOnB;
|
||||||
glColor4f(color.getX(), color.getY(), color.getZ(),1.f);
|
glColor4f(color.getX(), color.getY(), color.getZ(),1.f);
|
||||||
@ -111,6 +120,7 @@ class SceneDebugDrawer : public btIDebugDraw
|
|||||||
glVertex3d(from.getX(), from.getY(), from.getZ());
|
glVertex3d(from.getX(), from.getY(), from.getZ());
|
||||||
glVertex3d(to.getX(), to.getY(), to.getZ());
|
glVertex3d(to.getX(), to.getY(), to.getZ());
|
||||||
glEnd();
|
glEnd();
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void reportErrorWarning(const char* warningString)
|
virtual void reportErrorWarning(const char* warningString)
|
||||||
@ -122,7 +132,7 @@ class SceneDebugDrawer : public btIDebugDraw
|
|||||||
virtual void draw3dText(const btVector3& location,const char* textString)
|
virtual void draw3dText(const btVector3& location,const char* textString)
|
||||||
{
|
{
|
||||||
EWOL_DEBUG("DebugDisplay : draw3dText");
|
EWOL_DEBUG("DebugDisplay : draw3dText");
|
||||||
glRasterPos3f(location.x(), location.y(), location.z());
|
//glRasterPos3f(location.x(), location.y(), location.z());
|
||||||
//BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),textString);
|
//BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),textString);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -247,8 +257,8 @@ widget::Scene::Scene(btDynamicsWorld* gameEngine) :
|
|||||||
btDefaultMotionState* myMotionState = new btDefaultMotionState(startTransform);
|
btDefaultMotionState* myMotionState = new btDefaultMotionState(startTransform);
|
||||||
if(jjj%2==0) {
|
if(jjj%2==0) {
|
||||||
btRigidBody::btRigidBodyConstructionInfo rbInfo(mass,myMotionState,colBoxShape,localInertia);
|
btRigidBody::btRigidBodyConstructionInfo rbInfo(mass,myMotionState,colBoxShape,localInertia);
|
||||||
btRigidBody* body = new btRigidBody(rbInfo);
|
btRigidBody* body = new btRigidBody(rbInfo);
|
||||||
m_dynamicsWorld->addRigidBody(body);
|
m_dynamicsWorld->addRigidBody(body);
|
||||||
} else {
|
} else {
|
||||||
btRigidBody::btRigidBodyConstructionInfo rbInfo(mass,myMotionState,colSphereShape,localInertia);
|
btRigidBody::btRigidBodyConstructionInfo rbInfo(mass,myMotionState,colSphereShape,localInertia);
|
||||||
btRigidBody* body = new btRigidBody(rbInfo);
|
btRigidBody* body = new btRigidBody(rbInfo);
|
||||||
@ -361,14 +371,14 @@ void widget::Scene::DrawSphere(btScalar radius, int lats, int longs, mat4& trans
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline void glDrawVector(const btVector3& v) { glVertex3d(v[0], v[1], v[2]); }
|
inline void glDrawVector(const btVector3& v) { /*glVertex3d(v[0], v[1], v[2]);*/ }
|
||||||
|
|
||||||
void widget::Scene::DrawOpenGL(btScalar* mmm,
|
void widget::Scene::DrawOpenGL(btScalar* mmm,
|
||||||
const btCollisionShape* shape,
|
const btCollisionShape* shape,
|
||||||
const btVector3& color,
|
const btVector3& color,
|
||||||
int32_t debugMode,
|
int32_t debugMode,
|
||||||
const btVector3& worldBoundsMin,
|
const btVector3& worldBoundsMin,
|
||||||
const btVector3& worldBoundsMax)
|
const btVector3& worldBoundsMax)
|
||||||
{
|
{
|
||||||
mat4 transformationMatrix(mmm);
|
mat4 transformationMatrix(mmm);
|
||||||
transformationMatrix.Transpose();
|
transformationMatrix.Transpose();
|
||||||
@ -390,6 +400,7 @@ void widget::Scene::DrawOpenGL(btScalar* mmm,
|
|||||||
btVector3 halfExtent = boxShape->getHalfExtentsWithMargin();
|
btVector3 halfExtent = boxShape->getHalfExtentsWithMargin();
|
||||||
dx *= halfExtent[0];
|
dx *= halfExtent[0];
|
||||||
dy *= halfExtent[1];
|
dy *= halfExtent[1];
|
||||||
|
/*
|
||||||
glColor3f(1,1,1);
|
glColor3f(1,1,1);
|
||||||
glDisable(GL_LIGHTING);
|
glDisable(GL_LIGHTING);
|
||||||
glLineWidth(2);
|
glLineWidth(2);
|
||||||
@ -399,6 +410,7 @@ void widget::Scene::DrawOpenGL(btScalar* mmm,
|
|||||||
glDrawVector(org + dx + dy);
|
glDrawVector(org + dx + dy);
|
||||||
glDrawVector(org + dx - dy);
|
glDrawVector(org + dx - dy);
|
||||||
glEnd();
|
glEnd();
|
||||||
|
*/
|
||||||
return;
|
return;
|
||||||
} else if((shape->getShapeType() == BOX_SHAPE_PROXYTYPE) && (debugMode & btIDebugDraw::DBG_FastWireframe)) {
|
} else if((shape->getShapeType() == BOX_SHAPE_PROXYTYPE) && (debugMode & btIDebugDraw::DBG_FastWireframe)) {
|
||||||
EWOL_DEBUG(" Draw (2): BOX_SHAPE_PROXYTYPE");
|
EWOL_DEBUG(" Draw (2): BOX_SHAPE_PROXYTYPE");
|
||||||
@ -411,6 +423,7 @@ void widget::Scene::DrawOpenGL(btScalar* mmm,
|
|||||||
dx *= halfExtent[0];
|
dx *= halfExtent[0];
|
||||||
dy *= halfExtent[1];
|
dy *= halfExtent[1];
|
||||||
dz *= halfExtent[2];
|
dz *= halfExtent[2];
|
||||||
|
/*
|
||||||
glBegin(GL_LINE_LOOP);
|
glBegin(GL_LINE_LOOP);
|
||||||
glDrawVector(org - dx - dy - dz);
|
glDrawVector(org - dx - dy - dz);
|
||||||
glDrawVector(org + dx - dy - dz);
|
glDrawVector(org + dx - dy - dz);
|
||||||
@ -431,6 +444,7 @@ void widget::Scene::DrawOpenGL(btScalar* mmm,
|
|||||||
glDrawVector(org - dx - dy + dz);
|
glDrawVector(org - dx - dy + dz);
|
||||||
glDrawVector(org - dx + dy + dz);
|
glDrawVector(org - dx + dy + dz);
|
||||||
glEnd();
|
glEnd();
|
||||||
|
*/
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -454,7 +468,7 @@ void widget::Scene::DrawOpenGL(btScalar* mmm,
|
|||||||
worldBoundsMin,
|
worldBoundsMin,
|
||||||
worldBoundsMax);
|
worldBoundsMax);
|
||||||
}
|
}
|
||||||
glPopMatrix();
|
//glPopMatrix();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (shape->getShapeType() == COMPOUND_SHAPE_PROXYTYPE) {
|
if (shape->getShapeType() == COMPOUND_SHAPE_PROXYTYPE) {
|
||||||
@ -581,7 +595,7 @@ void widget::Scene::DrawOpenGL(btScalar* mmm,
|
|||||||
EWOL_DEBUG(" shape->isConvex()");
|
EWOL_DEBUG(" shape->isConvex()");
|
||||||
const btConvexPolyhedron* poly = shape->isPolyhedral() ? ((btPolyhedralConvexShape*) shape)->getConvexPolyhedron() : 0;
|
const btConvexPolyhedron* poly = shape->isPolyhedral() ? ((btPolyhedralConvexShape*) shape)->getConvexPolyhedron() : 0;
|
||||||
if (NULL!=poly) {
|
if (NULL!=poly) {
|
||||||
glBegin(GL_TRIANGLES);
|
//glBegin(GL_TRIANGLES);
|
||||||
for (int32_t iii=0 ; iii<poly->m_faces.size() ; iii++) {
|
for (int32_t iii=0 ; iii<poly->m_faces.size() ; iii++) {
|
||||||
btVector3 centroid(0,0,0);
|
btVector3 centroid(0,0,0);
|
||||||
int numVerts = poly->m_faces[iii].m_indices.size();
|
int numVerts = poly->m_faces[iii].m_indices.size();
|
||||||
@ -592,14 +606,16 @@ void widget::Scene::DrawOpenGL(btScalar* mmm,
|
|||||||
btVector3 v3 = poly->m_vertices[poly->m_faces[iii].m_indices[vvv+2]];
|
btVector3 v3 = poly->m_vertices[poly->m_faces[iii].m_indices[vvv+2]];
|
||||||
btVector3 normal = (v3-v1).cross(v2-v1);
|
btVector3 normal = (v3-v1).cross(v2-v1);
|
||||||
normal.normalize ();
|
normal.normalize ();
|
||||||
|
/*
|
||||||
glNormal3f(normal.getX(),normal.getY(),normal.getZ());
|
glNormal3f(normal.getX(),normal.getY(),normal.getZ());
|
||||||
glVertex3f (v1.x(), v1.y(), v1.z());
|
glVertex3f (v1.x(), v1.y(), v1.z());
|
||||||
glVertex3f (v2.x(), v2.y(), v2.z());
|
glVertex3f (v2.x(), v2.y(), v2.z());
|
||||||
glVertex3f (v3.x(), v3.y(), v3.z());
|
glVertex3f (v3.x(), v3.y(), v3.z());
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
glEnd();
|
//glEnd();
|
||||||
} else {
|
} else {
|
||||||
// TODO : Set it back ...
|
// TODO : Set it back ...
|
||||||
/*
|
/*
|
||||||
@ -670,8 +686,8 @@ void DrawShadow(btScalar* mmm,
|
|||||||
const btVector3& worldBoundsMin,
|
const btVector3& worldBoundsMin,
|
||||||
const btVector3& worldBoundsMax)
|
const btVector3& worldBoundsMax)
|
||||||
{
|
{
|
||||||
glPushMatrix();
|
//glPushMatrix();
|
||||||
glMultMatrixf(mmm);
|
//glMultMatrixf(mmm);
|
||||||
if(shape->getShapeType() == UNIFORM_SCALING_SHAPE_PROXYTYPE) {
|
if(shape->getShapeType() == UNIFORM_SCALING_SHAPE_PROXYTYPE) {
|
||||||
const btUniformScalingShape* scalingShape = static_cast<const btUniformScalingShape*>(shape);
|
const btUniformScalingShape* scalingShape = static_cast<const btUniformScalingShape*>(shape);
|
||||||
const btConvexShape* convexShape = scalingShape->getChildShape();
|
const btConvexShape* convexShape = scalingShape->getChildShape();
|
||||||
@ -685,7 +701,7 @@ void DrawShadow(btScalar* mmm,
|
|||||||
convexShape,
|
convexShape,
|
||||||
worldBoundsMin,
|
worldBoundsMin,
|
||||||
worldBoundsMax);
|
worldBoundsMax);
|
||||||
glPopMatrix();
|
//glPopMatrix();
|
||||||
return;
|
return;
|
||||||
} else if(shape->getShapeType()==COMPOUND_SHAPE_PROXYTYPE) {
|
} else if(shape->getShapeType()==COMPOUND_SHAPE_PROXYTYPE) {
|
||||||
const btCompoundShape* compoundShape = static_cast<const btCompoundShape*>(shape);
|
const btCompoundShape* compoundShape = static_cast<const btCompoundShape*>(shape);
|
||||||
@ -719,8 +735,8 @@ void DrawShadow(btScalar* mmm,
|
|||||||
glVertex3f(a[0]+extrusion[0],a[1]+extrusion[1],a[2]+extrusion[2]);
|
glVertex3f(a[0]+extrusion[0],a[1]+extrusion[1],a[2]+extrusion[2]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
glEnd();
|
glEnd();
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (shape->isConcave()) {
|
if (shape->isConcave()) {
|
||||||
@ -732,7 +748,7 @@ void DrawShadow(btScalar* mmm,
|
|||||||
concaveMesh->processAllTriangles(&drawCallback,worldBoundsMin,worldBoundsMax);
|
concaveMesh->processAllTriangles(&drawCallback,worldBoundsMin,worldBoundsMax);
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
glPopMatrix();
|
//glPopMatrix();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -740,7 +756,7 @@ void DrawShadow(btScalar* mmm,
|
|||||||
void widget::Scene::renderscene(int pass)
|
void widget::Scene::renderscene(int pass)
|
||||||
{
|
{
|
||||||
//glPushMatrix();
|
//glPushMatrix();
|
||||||
EWOL_DEBUG("Render Scene pass=" << pass);
|
//EWOL_DEBUG("Render Scene pass=" << pass);
|
||||||
//mat4& myMatrix = ewol::openGL::GetMatrix();
|
//mat4& myMatrix = ewol::openGL::GetMatrix();
|
||||||
//myMatrix = m_camera.GetMatrix() * myMatrix;
|
//myMatrix = m_camera.GetMatrix() * myMatrix;
|
||||||
//myMatrix.Transpose();
|
//myMatrix.Transpose();
|
||||||
@ -824,7 +840,7 @@ void widget::Scene::renderscene(int pass)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
glPopMatrix();
|
//glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -124,6 +124,12 @@ void ewol::Widget::GenDraw(DrawProperty displayProp)
|
|||||||
// widget is hidden ...
|
// widget is hidden ...
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// check if the element is displayable in the windows :
|
||||||
|
if( displayProp.m_windowsSize.x < m_origin.x
|
||||||
|
|| displayProp.m_windowsSize.y < m_origin.y ) {
|
||||||
|
// out of the windows ==> nothing to display ...
|
||||||
|
return;
|
||||||
|
}
|
||||||
ewol::openGL::Push();
|
ewol::openGL::Push();
|
||||||
if( (displayProp.m_origin.x > m_origin.x)
|
if( (displayProp.m_origin.x > m_origin.x)
|
||||||
|| (displayProp.m_origin.x + displayProp.m_size.x < m_size.x + m_origin.x) ) {
|
|| (displayProp.m_origin.x + displayProp.m_size.x < m_size.x + m_origin.x) ) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user