Ejemplo n.º 1
0
        /// <summary>
        ///     Picking con plano YZ ubicado en el centro del objeto
        /// </summary>
        public TGCVector3 getPickingYZ(TgcRay ray, TGCVector3 objCenter)
        {
            //Mover aabb en Y al centro del mesh
            pickingYZAabb.setExtremes(
                new TGCVector3(objCenter.X - SMALL_VAL, pickingYZAabb.PMin.Y, pickingYZAabb.PMin.Z),
                new TGCVector3(objCenter.X, pickingYZAabb.PMax.Y, pickingYZAabb.PMax.Z));
            TGCVector3 q;
            var        r = TgcCollisionUtils.intersectRayAABB(ray, pickingYZAabb, out q);

            if (r)
            {
                return(clampPickingResult(q));
            }
            return(objCenter);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Actualiza los vertices segun los valores de HeightmapData
        /// </summary>
        public void updateVertices()
        {
            minIntensity = -1;
            maxIntensity = 0;
            for (var i = 0; i < vertices.Length; i++)
            {
                var v         = vertices[i];
                var intensity = HeightmapData[(int)vertices[i].X, (int)vertices[i].Z];
                vertices[i].Y = intensity;
                if (intensity > maxIntensity)
                {
                    maxIntensity = intensity;
                }
                if (minIntensity == -1 || intensity < minIntensity)
                {
                    minIntensity = intensity;
                }
            }

            vbTerrain.SetData(vertices, 0, LockFlags.None);
            aabb.setExtremes(new TGCVector3(0, minIntensity, 0),
                             new TGCVector3(HeightmapData.GetLength(0), maxIntensity, HeightmapData.GetLength(1)));
        }
Ejemplo n.º 3
0
        private void updateBB()
        {
            var r = new TGCVector3(mesh.Radius, mesh.Radius, mesh.Radius);

            bb.setExtremes(TGCVector3.Subtract(mesh.Position, r), TGCVector3.Add(mesh.Position, r));
        }