/// <summary>
        /// Constructor
        /// </summary>
        /// <param name="scenery">Escenario</param>
        public SceneryTriangleNode(Triangle[] triangles, Dictionary <LOD, SceneryNodeIndexInfo> indexInfo)
            : base()
        {
            this.TriangleList = triangles;

            this.IndexInfo = indexInfo;

            if ((this.TriangleList != null) && (this.TriangleList.Length > 0))
            {
                this.AABB = BoundingBoxEx.CreateFromTriangles(this.TriangleList);
                this.SPH  = BoundingSphereEx.CreateFromTriangles(this.TriangleList);

                this.NodeCenter = Vector3.Divide(this.AABB.Max + this.AABB.Min, 2.0f);
            }
        }
Beispiel #2
0
        public bool areObjectsInFrustum(BoundingFrustum frustum, float songPos, Project project, TrackProps trackProps)
        {
            foreach (var bbox in _geo.bboxes)
            {
                BoundingBoxEx bb = bbox.clone();
                bb.scale(new Vector3(project.ViewWidthQnScale, 1, 1));

                Vector3 posOffset = project.getSpatialNormPosOffset(trackProps);
                posOffset.X -= songPos;
                bb.translate(posOffset);

                if (bb.intersects(frustum))
                {
                    return(true);
                }
            }
            return(false);
        }