You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Oriented SceneObjectModel/SceneObjectPolygon measure depth from the world origin #342
In oriented draw mode, SceneObjectModel and SceneObjectPolygon measure their camera depth from the world origin instead of from the object.
Both override getPositionForCameraDistance() to return m.worldPoints.getCenter() when drawMode = oriented (SceneObjectModel.bs:330-335, SceneObjectPolygon.bs:88-93). worldPoints is inherited from SceneObjectBillboard, but only SceneObjectBillboard.updateWorldPosition() fills it. Both subclasses override updateWorldPosition() without calling super, and fill modelWorldFaces/modelWorldBounds or polygonWorldPoints instead. So worldPoints keeps its default zero vectors, and depthPosition/negDistanceFromCamera come out as the distance to (0, 0, 0).
Effect
An oriented model or polygon depth-sorts as though it were at the world origin, so it can draw in front of or behind other objects incorrectly.
The behind-the-camera skip (negDistanceFromCamera >= 0) and BSP dynamic-item classification (getDepthPosition()) use the same wrong point.
Return a real centre for these classes in oriented mode: the centre of modelWorldBounds for models, and the centroid or bounds centre of polygonWorldPoints for polygons.
Add specs asserting that an oriented model/polygon placed away from the origin reports a depth based on its own position.
Activity