public async ValueTask <bool> intersects(BoundingInfo boundingInfo, bool precise) { return(await EventHorizonBlazorInterop.Func <bool>( new object[] { new string[] { this.___guid, "intersects" }, boundingInfo, precise } )); }
public async ValueTask <SubMesh> setBoundingInfo(BoundingInfo boundingInfo) { return(await EventHorizonBlazorInterop.FuncClass <SubMesh>( entity => new SubMesh() { ___guid = entity.___guid }, new object[] { new string[] { this.___guid, "setBoundingInfo" }, boundingInfo } )); }
/// <summary> /// </summary> public virtual void _updateBoundingInfo() { this._boundingInfo = this._boundingInfo ?? new BoundingInfo(this.absolutePosition, this.absolutePosition); this._boundingInfo._update(this.worldMatrixFromCache); if (this.subMeshes == null) { return; } for (var subIndex = 0; subIndex < this.subMeshes.Length; subIndex++) { var subMesh = this.subMeshes[subIndex]; subMesh.updateBoundingInfo(this.worldMatrixFromCache); } }
/// <summary> /// </summary> public virtual void dispose() { var meshes = this._meshes; var numOfMeshes = meshes.Length; for (var index = 0; index < numOfMeshes; index++) { this.releaseForMesh(meshes[index]); } this._meshes = new Array <Mesh>(); foreach (var kind in this._vertexBuffers.Keys) { this._vertexBuffers[kind].dispose(); } this._vertexBuffers.Clear(); this._totalVertices = 0; if (this._indexBuffer != null) { this._engine._releaseBuffer(this._indexBuffer); } this._indexBuffer = null; this._indices = new Array <int>(); this.delayLoadState = Engine.DELAYLOADSTATE_NONE; this.delayLoadingFile = null; this._delayLoadingFunction = null; this._delayInfo = new Array <VertexBufferKind>(); this._boundingInfo = null; var geometries = this._scene.getGeometries(); var index2 = geometries.IndexOf(this); if (index2 > -1) { geometries.RemoveAt(index2); } }
/// <summary> /// </summary> public virtual void refreshBoundingInfo() { var data = this._renderingMesh.getVerticesData(VertexBufferKind.PositionKind); if (data == null) { this._boundingInfo = this._mesh._boundingInfo; return; } var indices = this._renderingMesh.getIndices(); MinMax extend = null; if (this.indexStart == 0 && this.indexCount == indices.Length) { extend = Tools.ExtractMinAndMax(data, this.verticesStart, this.verticesCount); } else { extend = Tools.ExtractMinAndMaxIndexed(data, indices, this.indexStart, this.indexCount); } this._boundingInfo = new BoundingInfo(extend.minimum, extend.maximum); }
/// <summary> /// </summary> /// <param name="boundingInfo"> /// </param> /// <param name="precise"> /// </param> /// <returns> /// </returns> public virtual bool intersects(BoundingInfo boundingInfo, bool precise) { if (this.boundingSphere.centerWorld == null || boundingInfo.boundingSphere.centerWorld == null) { return(false); } if (!BoundingSphere.Intersects(this.boundingSphere, boundingInfo.boundingSphere)) { return(false); } if (!BoundingBox.Intersects(this.boundingBox, boundingInfo.boundingBox)) { return(false); } if (!precise) { return(true); } var box0 = this.boundingBox; var box1 = boundingInfo.boundingBox; if (!this.axisOverlap(box0.directions[0], box0, box1)) { return(false); } if (!this.axisOverlap(box0.directions[1], box0, box1)) { return(false); } if (!this.axisOverlap(box0.directions[2], box0, box1)) { return(false); } if (!this.axisOverlap(box1.directions[0], box0, box1)) { return(false); } if (!this.axisOverlap(box1.directions[1], box0, box1)) { return(false); } if (!this.axisOverlap(box1.directions[2], box0, box1)) { return(false); } if (!this.axisOverlap(Vector3.Cross(box0.directions[0], box1.directions[0]), box0, box1)) { return(false); } if (!this.axisOverlap(Vector3.Cross(box0.directions[0], box1.directions[1]), box0, box1)) { return(false); } if (!this.axisOverlap(Vector3.Cross(box0.directions[0], box1.directions[2]), box0, box1)) { return(false); } if (!this.axisOverlap(Vector3.Cross(box0.directions[1], box1.directions[0]), box0, box1)) { return(false); } if (!this.axisOverlap(Vector3.Cross(box0.directions[1], box1.directions[1]), box0, box1)) { return(false); } if (!this.axisOverlap(Vector3.Cross(box0.directions[1], box1.directions[2]), box0, box1)) { return(false); } if (!this.axisOverlap(Vector3.Cross(box0.directions[2], box1.directions[0]), box0, box1)) { return(false); } if (!this.axisOverlap(Vector3.Cross(box0.directions[2], box1.directions[1]), box0, box1)) { return(false); } if (!this.axisOverlap(Vector3.Cross(box0.directions[2], box1.directions[2]), box0, box1)) { return(false); } return(true); }