Exemple #1
0
    /// <summary>
    ///
    /// </summary>
    public void UpdateLightprobes()
    {
        // Get _LightProbes game object
        LightProbeGameObj = GameObject.Find("CS_LightProbes");
        if (LightProbeGameObj == null)
        {
            return;
        }

        // Get light probe group component
        LightProbeGroup LPGroup = LightProbeGameObj.GetComponent("LightProbeGroup") as LightProbeGroup;

        if (LPGroup == null)
        {
            return;
        }

        // Create lightprobe positions
        //Vector3[] ProbePos = new Vector3[VertPositions.Count];
        //for(int i = 0; i<VertPositions.Count; i++){
        //    ProbePos[i] = VertPositions[i];
        //}

        // Set new light probes
        // LPGroup.probePositions = ProbePos;
    }
 // Start is called before the first frame update
 void Start()
 {
     Debug.Log("123");
     Object          obj2            = new Object();
     LightProbes     obj             = obj2 as LightProbes;
     LightProbeGroup lightProbeGroup = new LightProbeGroup();
 }
 public static void TetrahedralizeSceneProbes(out Vector3[] positions, out int[] indices)
 {
     LightProbeGroup[] array = UnityEngine.Object.FindObjectsOfType(typeof(LightProbeGroup)) as LightProbeGroup[];
     if (array == null)
     {
         positions = new Vector3[0];
         indices   = new int[0];
     }
     else
     {
         List <Vector3>    list   = new List <Vector3>();
         LightProbeGroup[] array2 = array;
         for (int i = 0; i < array2.Length; i++)
         {
             LightProbeGroup lightProbeGroup = array2[i];
             Vector3[]       probePositions  = lightProbeGroup.probePositions;
             Vector3[]       array3          = probePositions;
             for (int j = 0; j < array3.Length; j++)
             {
                 Vector3 position = array3[j];
                 Vector3 item     = lightProbeGroup.transform.TransformPoint(position);
                 list.Add(item);
             }
         }
         if (list.Count == 0)
         {
             positions = new Vector3[0];
             indices   = new int[0];
         }
         else
         {
             Lightmapping.Tetrahedralize(list.ToArray(), out indices, out positions);
         }
     }
 }
Exemple #4
0
 private void InternalOnSceneView()
 {
     if (EditorGUIUtility.IsGizmosAllowedForObject(this.target))
     {
         if ((SceneView.lastActiveSceneView != null) && this.m_ShouldFocus)
         {
             this.m_ShouldFocus = false;
             SceneView.lastActiveSceneView.FrameSelected();
         }
         this.m_Editor.PullProbePositions();
         LightProbeGroup target = this.target as LightProbeGroup;
         if (target != null)
         {
             if (this.m_Editor.OnSceneGUI(target.transform))
             {
                 this.StartEditProbes();
             }
             else
             {
                 this.EndEditProbes();
             }
         }
         this.m_Editor.PushProbePositions();
     }
 }
 public LightProbeGroupEditor(LightProbeGroup group)
 {
     this.m_Group = group;
     this.MarkTetrahedraDirty();
     this.m_SerializedSelectedProbes           = ScriptableObject.CreateInstance <LightProbeGroupSelection>();
     this.m_SerializedSelectedProbes.hideFlags = HideFlags.HideAndDontSave;
 }
    public void GenProbes()
    {
        ClearProbes();
        //todo: generate the probes
        LightProbeGroup lprobe = GetComponent <LightProbeGroup>();

        if (lprobe == null)
        {
            Debug.LogError("LightProbeGenerator: Must have LightProbeGroup attached!");
            return;
        }

        List <Vector3> probePositions = new List <Vector3>();

        foreach (LightProbeArea area in LightProbeVolumes)
        {
            if (PlacementAlgorithm == LightProbePlacementType.Grid)
            {
                probePositions.AddRange(GetProbesForVolume_Grid(area.ProbeVolume, area.Subdivisions));
            }
            else
            {
                probePositions.AddRange(GetProbesForVolume_Random(area.ProbeVolume, area.RandomCount));
            }
        }

        lprobe.probePositions = probePositions.ToArray();
    }
Exemple #7
0
            internal static bool TryCreateFromLightProbe(LightProbeGroup lightProbe, out BoundsData boundsData)
            {
                var positions = lightProbe.probePositions;

                if (positions.Length == 0)
                {
                    boundsData = default(BoundsData);
                    return(false);
                }

                var transformer = lightProbe.transform.localToWorldMatrix;

                var     first = transformer.MultiplyPoint3x4(positions[0]);
                Vector3 min   = first;
                Vector3 max   = first;

                for (int i = 1; i < positions.Length; i++)
                {
                    var worldPosition = transformer.MultiplyPoint3x4(positions[i]);
                    min = Vector3.Min(min, worldPosition);
                    max = Vector3.Max(max, worldPosition);
                }

                var center = (min + max) * 0.5f;
                var size   = max - min;

                boundsData = new BoundsData(lightProbe, new Bounds(center, size));

                return(true);
            }
        private void RebuildProbes()
        {
            if (MapData.IsWalkTable)
            {
                return;
            }

            if (ProbeGroup == null)
            {
                var go = new GameObject();
                ProbeGroup = go.AddComponent <LightProbeGroup>();
            }

            ProbeGroup.gameObject.name = "LightProbes";

            var layerMask = ~(1 << LayerMask.NameToLayer("DynamicObject"));

            var probePositions = new List <Vector3>();

            for (var x = 0; x < MapData.Width; x += 3)
            {
                for (var y = 0; y < MapData.Height; y += 3)
                {
                    var cell = MapData.Cell(x, y);

                    var castBottom = new Vector3(x * TileSize, cell.AverageHeights, y * TileSize);
                    var topCast    = new Vector3(x * TileSize, cell.AverageHeights * RoMapData.YScale + 50f, y * TileSize);

                    var ray = new Ray(topCast, Vector3.down);

                    if (Physics.Raycast(ray, out var hitInfo, 100f, layerMask))
                    {
                        probePositions.Add(hitInfo.point);
                    }
Exemple #9
0
 public LightProbeGroupEditor(LightProbeGroup group)
 {
     m_Group = group;
     m_ShouldRecalculateTetrahedra        = false;
     m_SourcePositionsDirty               = false;
     m_SerializedSelectedProbes           = ScriptableObject.CreateInstance <LightProbeGroupSelection>();
     m_SerializedSelectedProbes.hideFlags = HideFlags.HideAndDontSave;
 }
Exemple #10
0
 /// <summary>
 /// Add a probe instance into storage - must be called after the initial load call
 /// </summary>
 /// <param name="position">Position it is being located at</param>
 /// <param name="probeGroup">Probe group being managed</param>
 public void AddProbe(Vector3 position, LightProbeGroup probeGroup)
 {
     if (m_probeLocations == null)
     {
         return;
     }
     m_probeLocations.Insert(position.x, position.z, probeGroup);
 }
Exemple #11
0
 /// <summary>
 /// Add a probe instance into storage - must be called after the initial load call
 /// </summary>
 /// <param name="position">Position it is being located at</param>
 /// <param name="probeGroup">Probe group being managed</param>
 public static void RemoveProbe(Vector3 position, LightProbeGroup probeGroup)
 {
     if (m_probeLocations == null)
     {
         return;
     }
     m_probeLocations.Remove(position.x, position.z, probeGroup);
 }
 public LightProbeGroupEditor(LightProbeGroup group, LightProbeGroupInspector inspector)
 {
     m_Group = group;
     MarkTetrahedraDirty();
     m_SerializedSelectedProbes           = ScriptableObject.CreateInstance <LightProbeGroupSelection>();
     m_SerializedSelectedProbes.hideFlags = HideFlags.HideAndDontSave;
     m_Inspector    = inspector;
     drawTetrahedra = true;
 }
Exemple #13
0
        void OnScene(SceneView scene)
        {
            if (Selection.activeObject != gameObject)
            {
                pressed = false;
                return;
            }

            MagicLightProbes[] volumes = FindObjectsOfType <MagicLightProbes>();

            if (volumes.Length > 0)
            {
                if (Selection.activeGameObject == gameObject && !combined)
                {
                    EditorUtility.DisplayDialog("Magic Light Probes", "Some volumes have been changed. The combined volume needs to be updated.", "OK");
                    volumes[0].CombineVolumes(volumes);
                }

                Event e = Event.current;

                if (pressed && e.type == EventType.MouseDown && e.button == 1)
                {
                    Vector3 mousePos = e.mousePosition;

                    float pixelsPerPoint = EditorGUIUtility.pixelsPerPoint;
                    mousePos.y  = scene.camera.pixelHeight - mousePos.y * pixelsPerPoint;
                    mousePos.x *= pixelsPerPoint;

                    Ray        ray = scene.camera.ScreenPointToRay(mousePos);
                    RaycastHit hit;

                    if (Physics.Raycast(ray, out hit))
                    {
                        List <Vector3> tempPositionArray = new List <Vector3>();

                        if (targetProbeGroup == null)
                        {
                            targetProbeGroup = GetComponent <LightProbeGroup>();
                        }

                        Vector3 position = hit.point;
                        position = position + (hit.normal * distanceFromGeometry);


                        tempPositionArray.AddRange(targetProbeGroup.probePositions);
                        tempPositionArray.Add(position);

                        customPositions.Add(position);

                        targetProbeGroup.probePositions = null;
                        targetProbeGroup.probePositions = tempPositionArray.ToArray();
                    }

                    e.Use();
                }
            }
        }
Exemple #14
0
 public override void OnInspectorGUI()
 {
     this.m_Editor.PullProbePositions();
     GUILayout.BeginHorizontal(new GUILayoutOption[0]);
     GUILayout.BeginVertical(new GUILayoutOption[0]);
     if (GUILayout.Button("Add Probe", new GUILayoutOption[0]))
     {
         Vector3 zero = Vector3.zero;
         if (SceneView.lastActiveSceneView != null)
         {
             zero = SceneView.lastActiveSceneView.pivot;
             LightProbeGroup target = this.target as LightProbeGroup;
             if (target != null)
             {
                 zero = target.transform.InverseTransformPoint(zero);
             }
         }
         this.StartEditProbes();
         this.m_Editor.DeselectProbes();
         this.m_Editor.AddProbe(zero);
     }
     if (GUILayout.Button("Delete Selected", new GUILayoutOption[0]))
     {
         this.StartEditProbes();
         this.m_Editor.RemoveSelectedProbes();
     }
     GUILayout.EndVertical();
     GUILayout.BeginVertical(new GUILayoutOption[0]);
     if (GUILayout.Button("Select All", new GUILayoutOption[0]))
     {
         this.StartEditProbes();
         this.m_Editor.SelectAllProbes();
     }
     if (GUILayout.Button("Duplicate Selected", new GUILayoutOption[0]))
     {
         this.StartEditProbes();
         this.m_Editor.DuplicateSelectedProbes();
     }
     GUILayout.EndVertical();
     GUILayout.EndHorizontal();
     if (this.m_Editor.SelectedCount == 1)
     {
         Vector3    vector2  = this.m_Editor.GetSelectedPositions()[0];
         GUIContent label    = new GUIContent("Probe Position", "The local position of this probe relative to the parent group.");
         Vector3    position = EditorGUILayout.Vector3Field(label, vector2, new GUILayoutOption[0]);
         if (position != vector2)
         {
             this.StartEditProbes();
             this.m_Editor.UpdateSelectedPosition(0, position);
         }
     }
     this.m_Editor.HandleEditMenuHotKeyCommands();
     this.m_Editor.PushProbePositions();
 }
Exemple #15
0
    void OnDrawGizmosSelected()
    {
        LightProbeGroup lightProbeGroup = GetComponent <LightProbeGroup>();

        Vector3 center = transform.position;
        var     bounds = GeometryUtility.CalculateBounds(lightProbeGroup.probePositions, transform.localToWorldMatrix);

        Gizmos.color = new Color(1, 1, 1, 0.25f);
        Gizmos.DrawCube(center, bounds.size);
        Gizmos.DrawWireCube(center, bounds.size);
    }
Exemple #16
0
    public virtual void UpdateSamples()
    {
        LightProbeGroup lightProbeGroup = GetComponent <LightProbeGroup>();

        lightProbeGroup.probePositions = superprobes.Select(x => transform.InverseTransformPoint(x)).ToArray();

        foreach (var manager in FindObjectsOfType <LightprobeManager>())
        {
            manager.OnLightProbesUpdate();
        }
    }
 public override void OnInspectorGUI()
 {
     this.m_Editor.PullProbePositions();
     GUILayout.BeginHorizontal();
     GUILayout.BeginVertical();
     if (GUILayout.Button("Add Probe"))
     {
         Vector3 position = Vector3.zero;
         if ((bool)((Object)SceneView.lastActiveSceneView))
         {
             position = SceneView.lastActiveSceneView.pivot;
             LightProbeGroup target = this.target as LightProbeGroup;
             if ((bool)((Object)target))
             {
                 position = target.transform.InverseTransformPoint(position);
             }
         }
         this.StartEditProbes();
         this.m_Editor.DeselectProbes();
         this.m_Editor.AddProbe(position);
     }
     if (GUILayout.Button("Delete Selected"))
     {
         this.StartEditProbes();
         this.m_Editor.RemoveSelectedProbes();
     }
     GUILayout.EndVertical();
     GUILayout.BeginVertical();
     if (GUILayout.Button("Select All"))
     {
         this.StartEditProbes();
         this.m_Editor.SelectAllProbes();
     }
     if (GUILayout.Button("Duplicate Selected"))
     {
         this.StartEditProbes();
         this.m_Editor.DuplicateSelectedProbes();
     }
     GUILayout.EndVertical();
     GUILayout.EndHorizontal();
     if (this.m_Editor.SelectedCount == 1)
     {
         Vector3 selectedPosition = this.m_Editor.GetSelectedPositions()[0];
         Vector3 position         = EditorGUILayout.Vector3Field(new GUIContent("Probe Position", "The local position of this probe relative to the parent group."), selectedPosition);
         if (position != selectedPosition)
         {
             this.StartEditProbes();
             this.m_Editor.UpdateSelectedPosition(0, position);
         }
     }
     this.m_Editor.HandleEditMenuHotKeyCommands();
     this.m_Editor.PushProbePositions();
 }
    public void ClearProbes()
    {
        LightProbeGroup lprobe = GetComponent <LightProbeGroup>();

        if (lprobe == null)
        {
            Debug.LogError("LightProbeGenerator: Must have LightProbeGroup attached!");
            return;
        }

        lprobe.probePositions = null;
    }
Exemple #19
0
        public static void GenerateLightProbes(float gridSize, float height, float probeHeight)
        {
            if (gridSize < Mathf.Epsilon)
            {
                Debug.Log("间矩是个无效数值");
                return;
            }

            if (height < Mathf.Epsilon)
            {
                Debug.Log("碰撞高度是无效数值");
                return;
            }

            Bounds bounds = GetNavMeshBounds();

            if (bounds.extents.magnitude < Mathf.Epsilon)
            {
                Debug.Log("场景没有物件的layer属性设置为Terrain,请先完成相应设置.");
                return;
            }

            HitTester hitTester = new HitTester(bounds, gridSize, height, probeHeight);

            Vector3[] positions = hitTester.CalcProbes(bounds);

            // then set positions to component
            GameObject lightProbeHolder = GameObject.Find("LightProbeHolder");

            if (!lightProbeHolder)
            {
                lightProbeHolder = new GameObject("LightProbeHolder", typeof(LightProbeGroup));
            }

            if (!lightProbeHolder)
            {
                return;
            }
            LightProbeGroup lpg = lightProbeHolder.GetComponent <LightProbeGroup>();

            if (!lpg)
            {
                return;
            }

            lpg.probePositions = positions;
            Debug.Log("Generated " + lpg.probePositions.Length.ToString() + " probe points\n");

            HierarchyUtils.DestroyObjByName("LightProbeBox");

            //Lightmapping.Bake();
        }
Exemple #20
0
    private void PlaceLightProbe(Vector3 sceneRangeMin, Vector3 sceneRangeMax)
    {
        PlaceLightProbe plp = target as PlaceLightProbe;

        if (plp == null)
        {
            return;
        }

        LightProbeGroup lightProbeGroup = plp.GetComponent <LightProbeGroup>();

        if (lightProbeGroup == null)
        {
            return;
        }

        List <Vector3> posList = new List <Vector3>();
        Vector3        range   = sceneRangeMax - sceneRangeMin;

        if (range.x <= 0 || range.y <= 0 || range.z <= 0)
        {
            return;
        }

        Vector3 num    = new Vector3(10, 10, 10);            // xyz方向上分别有多少个probe //
        Vector3 offset = new Vector3(range.x / num.x, range.y / num.y, range.z / num.z);

        Vector3 curPos = sceneRangeMin;

        // 累加方式,最后会有非常小的一个差值,导致curPos.y 和 sceneRangeMax.y 不一致 //
        while (curPos.y <= sceneRangeMax.y)
        {
            while (curPos.z <= sceneRangeMax.z)
            {
                while (curPos.x <= sceneRangeMax.x)
                {
                    posList.Add(curPos);
                    curPos.x += offset.x;
                }

                curPos.x  = sceneRangeMin.x;
                curPos.z += offset.z;
            }

            curPos.x  = sceneRangeMin.x;
            curPos.z  = sceneRangeMin.z;
            curPos.y += offset.y;
        }

        lightProbeGroup.probePositions = posList.ToArray();
    }
Exemple #21
0
        private static void GenerateProbesOnTerrain(Terrain terrain, ReflectionProbeData profile, float seaLevel)
        {
            GameObject lightProbeObject = GameObject.Find(terrain.name + " Light Probes Group Data");

            if (lightProbeObject == null)
            {
                lightProbeObject = new GameObject(terrain.name + " Light Probes Group Data");
            }

            LightProbeGroup lightProbeData = lightProbeObject.GetComponent <LightProbeGroup>();

            if (lightProbeData == null)
            {
                lightProbeData = lightProbeObject.AddComponent <LightProbeGroup>();
                lightProbeData.probePositions = new Vector3[0];
            }
            GameObject lightParentObject = LightProbeParenting(terrain);
            Vector3    terrainSize       = terrain.terrainData.size;

            m_storedProbes = profile.lightProbesPerRow * profile.lightProbesPerRow;

            for (int row = 0; row < profile.lightProbesPerRow; ++row)
            {
                for (int columns = 0; columns < profile.lightProbesPerRow; ++columns)
                {
                    Vector3 newPosition = lightProbeObject.transform.position - lightProbeData.transform.position;
                    newPosition.x = ((columns + 1) * terrainSize.x / profile.lightProbesPerRow) - terrainSize.x / profile.lightProbesPerRow / 2f + terrain.transform.position.x;
                    newPosition.z = ((row + 1) * terrainSize.z / profile.lightProbesPerRow) - terrainSize.z / profile.lightProbesPerRow / 2f + terrain.transform.position.z;
                    float sampledHeight = terrain.SampleHeight(newPosition);
                    newPosition.y = sampledHeight + 2.5f;

                    List <Vector3> probePositions = new List <Vector3>(lightProbeData.probePositions);

                    if (sampledHeight > seaLevel)
                    {
                        probePositions.Add(newPosition);
                        newPosition += new Vector3(0f, 2.5f, 0f);
                        probePositions.Add(newPosition);
                        newPosition += new Vector3(0f, 10f, 0f);
                        probePositions.Add(newPosition);
                        lightProbeData.probePositions = probePositions.ToArray();
                        m_currentProbeCount++;
                    }
                }
            }

            lightProbeObject.transform.SetParent(lightParentObject.transform);
            EditorGUIUtility.PingObject(lightParentObject);
        }
Exemple #22
0
    public void Generate()
    {
        LightProbeGroup lightProbeGroup = GetComponent <LightProbeGroup>();
        List <Vector3>  positions       = new List <Vector3>();

        m_TriangleProps = new TriangleProps(m_Side);
        if (m_InnerRadius < kMinInnerRadius)
        {
            GenerateCylinder(m_TriangleProps, m_Radius, m_Height, m_Levels, positions);
        }
        else
        {
            GenerateRing(m_TriangleProps, m_Radius, m_InnerRadius, m_Height, m_Levels, positions);
        }
        lightProbeGroup.probePositions = positions.ToArray();
    }
Exemple #23
0
    void OnPostprocessModel(GameObject go)
    {
        ModelImporter importer = assetImporter as ModelImporter;

        if (importer == null)
        {
            return;
        }

        for (int i = 0; i < go.transform.childCount; i++)
        {
            Transform child = go.transform.GetChild(i);

            MeshFilter meshFilter = child.gameObject.GetComponent <MeshFilter>();
            if (meshFilter == null)
            {
                continue;
            }

            if (child.name.Contains("LPG_"))
            {
                List <Vector3> probePositions = new List <Vector3>();

                Vector3[] vertices = meshFilter.sharedMesh.vertices;
                foreach (var vert in vertices)
                {
                    probePositions.Add(vert);
                }

                foreach (var component in child.gameObject.GetComponents <Component>())
                {
                    if (component is Transform)
                    {
                        continue;
                    }
                    Editor.DestroyImmediate(component);
                }


                LightProbeGroup lightProbeGroup = child.gameObject.AddComponent <LightProbeGroup>();
                lightProbeGroup.probePositions = probePositions.ToArray();

                // For now we assume there is only one of these and end iteration
                return;
            }
        }
    }
Exemple #24
0
    public static int get_probePositions(IntPtr l)
    {
        int result;

        try
        {
            LightProbeGroup lightProbeGroup = (LightProbeGroup)LuaObject.checkSelf(l);
            LuaObject.pushValue(l, true);
            LuaObject.pushValue(l, lightProbeGroup.probePositions);
            result = 2;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
Exemple #25
0
    static int _CreateLightProbeGroup(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 0)
        {
            LightProbeGroup obj = new LightProbeGroup();
            LuaScriptMgr.Push(L, obj);
            return(1);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: LightProbeGroup.New");
        }

        return(0);
    }
    public void Generate()
    {
        LightProbeGroup lightProbeGroup = GetComponent <LightProbeGroup>();

        try
        {
            switch (m_BakeType)
            {
            case EBakeType.Grid:
                BakeGridProbes(lightProbeGroup);
                break;
            }
        }
        finally
        {
            UnityEngine.Debug.Log(String.Format("Generated {0} probes.", lightProbeGroup.probePositions.Length));
        }
    }
Exemple #27
0
    public static int set_probePositions(IntPtr l)
    {
        int result;

        try
        {
            LightProbeGroup lightProbeGroup = (LightProbeGroup)LuaObject.checkSelf(l);
            Vector3[]       probePositions;
            LuaObject.checkArray <Vector3>(l, 2, out probePositions);
            lightProbeGroup.probePositions = probePositions;
            LuaObject.pushValue(l, true);
            result = 1;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
    private void BakeGridProbes(LightProbeGroup probe)
    {
        Vector3 min = Vector3.zero - (m_Size * 0.5f);

        Vector3 probesPerAxis = Vector3.zero;

        probesPerAxis.x = Mathf.FloorToInt(m_Size.x / m_DistanceBetweenProbes);
        probesPerAxis.y = Mathf.FloorToInt(m_Size.y / m_DistanceBetweenProbes);
        probesPerAxis.z = Mathf.FloorToInt(m_Size.z / m_DistanceBetweenProbes);

        int amountOfProbesToCreate = Mathf.RoundToInt(probesPerAxis.x * probesPerAxis.y * probesPerAxis.z);
        {
            List <Vector3> probePositions = new List <Vector3>();

            Vector3 maxProbePositions = (probesPerAxis - Vector3.one) * m_DistanceBetweenProbes;
            Vector3 leftOver          = m_Size - maxProbePositions;
            Vector3 startPosition     = min + (leftOver * 0.5f);

            for (int x = 0; x < probesPerAxis.x; ++x)
            {
                for (int y = 0; y < probesPerAxis.y; ++y)
                {
                    for (int z = 0; z < probesPerAxis.z; ++z)
                    {
                        Vector3 probePosition = startPosition + (new Vector3(x, y, z) * m_DistanceBetweenProbes);

                        Vector3 worldProbePosition = transform.TransformPoint(probePosition);
                        if (!checkForCollisions || IsValidProbePosition(worldProbePosition))
                        {
                            probePositions.Add(probePosition);
                        }
                    }
                }
            }

            probe.probePositions = probePositions.ToArray();
        }
    }
Exemple #29
0
        public override void OnGUI()
        {
            _output = EditorGUILayout.ObjectField(new GUIContent("Output"), _output, typeof(LightProbeGroup), true) as LightProbeGroup;

            _layers = EditorGUILayout.IntField(new GUIContent("Layers"), _layers);

            _layerHeight = EditorGUILayout.FloatField(new GUIContent("Layer Height"), _layerHeight);

            _mergeDistance = EditorGUILayout.FloatField(new GUIContent("Merge Distance"), _mergeDistance);

            if (GUILayout.Button(new GUIContent("Generate")))
            {
                var _p = new LightProbePlacement
                {
                    mergeDistance = _mergeDistance,
                    probeObject   = _output,
                    layers        = _layers,
                    layerHeight   = _layerHeight,
                };

                _p.PlaceProbes();
            }
        }
Exemple #30
0
    static int set_probePositions(IntPtr L)
    {
        object o = LuaScriptMgr.GetLuaObject(L, 1);

        if (o == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name probePositions");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index probePositions on a nil value");
            }
        }

        LightProbeGroup obj = (LightProbeGroup)o;

        obj.probePositions = LuaScriptMgr.GetNetObject <Vector3[]>(L, 3);
        return(0);
    }