From e2b860610cbe6cc0c8db3704745ef72d1d6cd88d Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Tue, 31 Aug 2010 03:35:45 +0200 Subject: [PATCH] matrix support --- src/converter/collada.cpp | 15 ++++++++++++--- src/libcore/triangle.cpp | 6 ++++-- src/librender/kdtree_compiler.cpp | 2 +- src/qtgui/glwidget.cpp | 2 +- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/converter/collada.cpp b/src/converter/collada.cpp index 3affe427..e8493307 100644 --- a/src/converter/collada.cpp +++ b/src/converter/collada.cpp @@ -119,8 +119,7 @@ VertexData *fetchVertexData(Transform transform, std::ostream &os, if (vertInputIndex > 0) { offset = result->data.size(); - result->data.resize(result->data.size()+1); - result->data[offset] = NULL; + result->data.push_back(NULL); } if (++vertInputIndex < (int) vertInputs.getCount()) @@ -227,7 +226,7 @@ void writeGeometry(std::string prefixName, std::string id, int geomIndex, std::s domUint normalRef = tess_data[i+vData->typeToOffsetInStream[ENormal]]; vertex.n = vData->data[vData->typeToOffset[ENormal]][normalRef].toNormal(); } - + if (vData->typeToOffset[EUV] != -1) { domUint uvRef = tess_data[i+vData->typeToOffsetInStream[EUV]]; vertex.uv = vData->data[vData->typeToOffset[EUV]][uvRef].toPoint2(); @@ -889,9 +888,19 @@ void loadNode(GeometryConverter *cvt, Transform transform, std::ostream &os, Point((Float) value.get(3), (Float) value.get(4), (Float) value.get(5)), Vector((Float) value.get(6), (Float) value.get(7), (Float) value.get(8)) ); + } else if (element->typeID() == domMatrix::ID()) { + daeTArray value = daeSafeCast(element)->getValue(); + ref matrix = new Matrix4x4( + (Float) value.get(0), (Float) value.get(1), (Float) value.get(2), (Float) value.get(3), + (Float) value.get(4), (Float) value.get(5), (Float) value.get(6), (Float) value.get(7), + (Float) value.get(8), (Float) value.get(9), (Float) value.get(10), (Float) value.get(11), + (Float) value.get(12), (Float) value.get(13), (Float) value.get(14), (Float) value.get(15) + ); + transform = transform * Transform(matrix); } } + /* Iterate over all geometry references */ domInstance_geometry_Array &instanceGeometries = node.getInstance_geometry_array(); for (size_t i=0; i= m_maxDepth || numPrims <= m_stopPrims) { createLeaf(nodeIndex, depth, numPrims, allEvents); return; diff --git a/src/qtgui/glwidget.cpp b/src/qtgui/glwidget.cpp index 71f91046..09b5c9b9 100644 --- a/src/qtgui/glwidget.cpp +++ b/src/qtgui/glwidget.cpp @@ -732,7 +732,7 @@ void GLWidget::paintGL() { uint8_t *targetData = m_fallbackBitmap->getData(); for (int y=0; ygetHeight(); ++y) { for (int x=0; xgetWidth(); ++x) { - const Float invGammaValue = 0.45455; + const float invGammaValue = 0.45455f; *targetData++ = (uint8_t) std::max(std::min(std::pow(*sourceData++, invGammaValue) * 255.0f, 255.0f), 0.0f); *targetData++ = (uint8_t) std::max(std::min(std::pow(*sourceData++, invGammaValue) * 255.0f, 255.0f), 0.0f); *targetData++ = (uint8_t) std::max(std::min(std::pow(*sourceData++, invGammaValue) * 255.0f, 255.0f), 0.0f);