Ejemplo n.º 1
0
        public override void Bake()
        {
            if (bakedRenderers == null)
            {
                bakedRenderers = new List <Renderer>();
            }

            bakedRenderers.Clear();

            AVolumeSettings settings = new AVolumeSettings(bounds, dimensions);

            //first check if any objects are parented to this object
            //if anything is found, try to use renderers from those instead of volume overlap
            if (!GetChildRenderersAndEncapsulate(ref settings, ref bakedRenderers, transform))
            {
                //otherwise try to get renderers intersecting the volume
                //get mesh renderers within volume
                if (!GetMeshRenderersIntersectingVolume(settings, transform, ref bakedRenderers))
                {
                    //TODO display error?
                    return;
                }
            }

            SDFVolume sdfVolume = AVolume <SDFVolume> .CreateVolume(transform, settings);

            // sdfVolume.Bake( raySamples, bakedRenderers, BakeComplete );

            Debug.Log($"settings: {settings.BoundsLocal} {settings.Dimensions} {settings.CellCount} ");

            sdfVolume.Dispose();
        }
Ejemplo n.º 2
0
        public override void Bake()
        {
            if (bakedRenderers == null)
            {
                bakedRenderers = new List <Renderer>();
            }
            bakedRenderers.Clear();

            AVolumeSettings settings = new AVolumeSettings(bounds, dimensions, useStandardBorder);

            //first check if any objects are parented to this object
            //if anything is found, try to use renderers from those instead of volume overlap
            if (!SDFBaker.GetMeshRenderersInChildren(ref settings, ref bakedRenderers, transform, fitToVertices))
            {
                //otherwise try to get renderers intersecting the volume
                //get mesh renderers within volume
                if (!SDFBaker.GetMeshRenderersIntersectingVolume(settings, transform, ref bakedRenderers))
                {
                    //TODO display error?
                    return;
                }
            }

            SDFVolume sdfVolume = AVolume <SDFVolume> .CreateVolume(transform, settings);

            sdfVolume.Bake(raySamples, bakedRenderers, BakeComplete);

            sdfVolume.Dispose();
        }
Ejemplo n.º 3
0
        public virtual void EditorCreateAVolume()
        {
            EditorDestroyAVolume();

            AVolumeSettings settings = new AVolumeSettings
            {
                Bounds = bounds, Dimensions = dimensions
            };

            //create new
            aVolume = AVolume <T> .CreateVolume(transform, settings);
        }