matrix support

metadata
Wenzel Jakob 2010-08-31 03:35:45 +02:00
parent 559af6f2b3
commit e2b860610c
4 changed files with 18 additions and 7 deletions

View File

@ -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())
@ -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<double> value = daeSafeCast<domMatrix>(element)->getValue();
ref<Matrix4x4> 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<instanceGeometries.getCount(); ++i) {

View File

@ -132,10 +132,12 @@ AABB Triangle::getClippedAABB(const Vertex *buffer, const AABB &aabb) const {
result.expandBy(vertices[i]);
/* Cover up some numerical imprecisions */
for (int i=0; i<3; ++i)
result.min[i] -= Epsilon;
result.min[i] -= Epsilon * std::abs(result.min[i]);
for (int i=0; i<3; ++i)
result.max[i] += Epsilon;
result.max[i] += Epsilon * std::abs(result.max[i]);
result.clip(aabb);
return result;

View File

@ -732,7 +732,7 @@ void GLWidget::paintGL() {
uint8_t *targetData = m_fallbackBitmap->getData();
for (int y=0; y<source->getHeight(); ++y) {
for (int x=0; x<source->getWidth(); ++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);