Fix inherited 3MF triangle property group resolution
Deploy HickLab3D Dashboard / Deploy to production (push) Successful in 50s
Deploy HickLab3D Dashboard / Deploy to production (push) Successful in 50s
This commit is contained in:
@@ -561,7 +561,7 @@ class ThreeMfGeometryExtractor
|
||||
$ancestry[] = $objectId;
|
||||
|
||||
if ($object['mesh'] !== null) {
|
||||
$defaultColor = $this->resolveColor($baseMaterials, $object['pid'], $object['pindex']);
|
||||
$this->resolveColor($baseMaterials, $object['pid'], $object['pindex']);
|
||||
$determinant = $transform[0] * ($transform[4] * $transform[8] - $transform[5] * $transform[7])
|
||||
- $transform[1] * ($transform[3] * $transform[8] - $transform[5] * $transform[6])
|
||||
+ $transform[2] * ($transform[3] * $transform[7] - $transform[4] * $transform[6]);
|
||||
@@ -578,9 +578,11 @@ class ThreeMfGeometryExtractor
|
||||
throw new RuntimeException('3MF triangle references a vertex index that does not exist.');
|
||||
}
|
||||
|
||||
$color = $triangle['pid'] !== null
|
||||
? $this->resolveColor($baseMaterials, $triangle['pid'], $this->resolveTriangleVertexIndex($triangle))
|
||||
: $defaultColor;
|
||||
$color = $this->resolveColor(
|
||||
$baseMaterials,
|
||||
$triangle['pid'] ?? $object['pid'],
|
||||
$this->resolveTriangleVertexIndex($triangle, $object['pindex']),
|
||||
);
|
||||
|
||||
$triangles[] = [
|
||||
'v' => [
|
||||
@@ -640,13 +642,14 @@ class ThreeMfGeometryExtractor
|
||||
* the face. This renderer only paints one flat colour per triangle, so a
|
||||
* triangle that actually declares differing per-vertex indices is
|
||||
* rejected explicitly rather than silently picking p1 and discarding the
|
||||
* rest of the declared colour data.
|
||||
* rest of the declared colour data. The property group and first index
|
||||
* inherit independently from object pid and pindex; omitted p2/p3 use p1.
|
||||
*
|
||||
* @param array{v1:int,v2:int,v3:int,pid:?int,p1:?int,p2:?int,p3:?int} $triangle
|
||||
*/
|
||||
private function resolveTriangleVertexIndex(array $triangle): ?int
|
||||
private function resolveTriangleVertexIndex(array $triangle, ?int $objectPindex): ?int
|
||||
{
|
||||
$p1 = $triangle['p1'];
|
||||
$p1 = $triangle['p1'] ?? $objectPindex;
|
||||
$p2 = $triangle['p2'] ?? $p1;
|
||||
$p3 = $triangle['p3'] ?? $p1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user