Ejemplo n.º 1
0
        public InstancingRenderer(GameObject go)
        {
            ReceiveShadow = false;
            CastShadow    = ShadowCastingMode.Off;

            CreateFromPrefab(go, null);
        }
Ejemplo n.º 2
0
 public RendererProperties(Renderer renderer)
 {
     this.ReceiveShadows       = renderer.receiveShadows;
     this.ReflectionProbeUsage = renderer.reflectionProbeUsage;
     this.ShadowCastingMode    = renderer.shadowCastingMode;
     this.UseLightProbes       = (renderer.lightProbeUsage == LightProbeUsage.BlendProbes);
 }
Ejemplo n.º 3
0
 public Options(ShadowCastingMode castShadows, bool receiveShadows, int layer, Camera camera)
 {
     CastShadows    = castShadows;
     ReceiveShadows = receiveShadows;
     Layer          = layer;
     Camera         = camera;
 }
Ejemplo n.º 4
0
 public RendererProperties(Renderer renderer)
 {
     ReceiveShadows       = renderer.receiveShadows;
     ReflectionProbeUsage = renderer.reflectionProbeUsage;
     ShadowCastingMode    = renderer.shadowCastingMode;
     UseLightProbes       = renderer.lightProbeUsage == LightProbeUsage.BlendProbes;
 }
        /// <summary>
        /// Construct a <see cref="RenderMeshDescription"/> using the given values.
        /// </summary>
        public RenderMeshDescription(
            Mesh mesh,
            Material material,
            ShadowCastingMode shadowCastingMode = ShadowCastingMode.Off,
            bool receiveShadows = false,
            MotionVectorGenerationMode motionVectorGenerationMode = MotionVectorGenerationMode.Camera,
            int layer                       = 0,
            int subMeshIndex                = 0,
            uint renderingLayerMask         = 1,
            LightProbeUsage lightProbeUsage = LightProbeUsage.Off)
        {
            Debug.Assert(material != null, "Must have a non-null Material to create RenderMeshDescription.");
            Debug.Assert(mesh != null, "Must have a non-null Mesh to create RenderMeshDescription.");

            var needMotionVectorPass =
                (motionVectorGenerationMode == MotionVectorGenerationMode.Object) ||
                (motionVectorGenerationMode == MotionVectorGenerationMode.ForceNoMotion);

            RenderMesh = new RenderMesh
            {
                mesh                 = mesh,
                material             = material,
                subMesh              = subMeshIndex,
                layer                = layer,
                castShadows          = shadowCastingMode,
                receiveShadows       = receiveShadows,
                needMotionVectorPass = needMotionVectorPass,
            };

            RenderingLayerMask = renderingLayerMask;
            FlipWinding        = false;
            MotionMode         = motionVectorGenerationMode;
            LightProbeUsage    = lightProbeUsage;
        }
Ejemplo n.º 6
0
        public void Config
        (
            ComputeBuffer drawArgsBuffer,
            ComputeBuffer getPointsBuffer,
            MudRendererBase renderer
        )
        {
            m_indirectDrawArgsData = new int[4];
            drawArgsBuffer.GetData(m_indirectDrawArgsData);

            m_numVerts      = m_indirectDrawArgsData[0];
            m_aGenPointData = new GenPoint[m_numVerts];
            getPointsBuffer.GetData(m_aGenPointData);

            RenderMaterial    = renderer.RenderMaterial;
            MasterColor       = renderer.MasterColor;
            MasterEmission    = renderer.MasterEmission;
            MasterMetallic    = renderer.MasterMetallic;
            MasterSmoothness  = renderer.MasterSmoothness;
            m_renderBoundsCs  = renderer.RenderBoundsCs;
            m_renderMode      = renderer.RenderMode;
            m_voxelDensity    = renderer.VoxelDensity;
            SplatSize         = renderer.SplatSize;
            SplatRotation     = renderer.SplatRotationJitter;
            SplatCameraFacing = renderer.SplatCameraFacing;

            CastShadows    = renderer.CastShadows;
            ReceiveShadows = renderer.ReceiveShadows;

            m_hash = Codec.Hash(GetHashCode());
            m_hash = Codec.HashConcat(m_hash, DateTime.Now.Ticks);

            Validate();
        }
        /// <summary>
        /// Function to enable/disable shadow from female limbs and accessories
        /// </summary>
        internal static void FemaleShadow()
        {
            if (!flags)
            {
                return;
            }

            ShadowCastingMode femaleShadowMode = HideFemaleShadow.Value ? ShadowCastingMode.Off : ShadowCastingMode.On;

            foreach (ChaControl female in lstFemale)
            {
                foreach (Transform child in female.objTop.transform)
                {
                    if (child.name == "p_cf_body_bone")
                    {
                        foreach (MeshRenderer mesh in child.GetComponentsInChildren <MeshRenderer>(true))
                        {
                            mesh.shadowCastingMode = femaleShadowMode;
                        }
                    }
                    else
                    {
                        foreach (SkinnedMeshRenderer mesh in child.GetComponentsInChildren <SkinnedMeshRenderer>(true))
                        {
                            if (mesh.name != "o_shadowcaster")
                            {
                                mesh.shadowCastingMode = femaleShadowMode;
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 8
0
 private void SetShadowCastingMode(Transform root, ShadowCastingMode mode)
 {
     foreach (MeshRenderer renderer in root.GetComponentsInChildren <MeshRenderer>())
     {
         renderer.shadowCastingMode = mode;
     }
 }
Ejemplo n.º 9
0
 public void Render(Vector3 observerPos, float visibleDistance, Vector3[] frustumPlanesNormals, float[] frustumPlanesDistances)
 {
     if (rebuild)
     {
         if (!Application.isPlaying || Time.frameCount - lastRebuildFrame > 10)
         {
             lastRebuildFrame = Time.frameCount;
             RebuildZoneRenderingLists(observerPos, visibleDistance);
             rebuild = false;
         }
     }
     for (int k = 0; k < batchedMeshes.count; k++)
     {
         BatchedMesh       batchedMesh       = batchedMeshes.values [k];
         VoxelDefinition   vd                = batchedMesh.voxelDefinition;
         Mesh              mesh              = vd.mesh;
         Material          material          = batchedMesh.material;
         ShadowCastingMode shadowCastingMode = vd.castShadows ? ShadowCastingMode.On : ShadowCastingMode.Off;
         for (int j = 0; j < batchedMesh.batches.count; j++)
         {
             Batch batch = batchedMesh.batches.values [j];
             if (GeometryUtilityNonAlloc.TestPlanesAABB(frustumPlanesNormals, frustumPlanesDistances, ref batch.boundsMin, ref batch.boundsMax))
             {
                 Graphics.DrawMeshInstanced(mesh, 0, material, batch.matrices, batch.instancesCount, batch.materialPropertyBlock, shadowCastingMode, vd.receiveShadows, env.layerVoxels);
             }
         }
     }
                 #if UNITY_EDITOR
     // required to fix a bug by which Draw Calls skyrocket in Stats windows when some voxel uses GPU instancing when "Render In SceneView" is enabled and the scene has just loaded in Editor
     UnityEditor.EditorUtility.SetDirty(env.gameObject);
                 #endif
 }
Ejemplo n.º 10
0
        GameObject CreateStem(string name, PFStem stem, ShadowCastingMode shadowCastingMode, bool receiveShadows, Func <float, float> f, float height, float bend, bool visible)
        {
            var controls = GetControls(4, height, bend);
            var mesh     = stem.Build(controls, f);

            return(CreateBase(name, PFPartType.Stover, mesh, stemData.material, stemData.shadowCastingMode, stemData.receiveShadows, visible));
        }
Ejemplo n.º 11
0
        protected override void ReadFromImpl(object obj)
        {
            base.ReadFromImpl(obj);
            Terrain uo = (Terrain)obj;

            terrainData                  = ToID(uo.terrainData);
            treeDistance                 = uo.treeDistance;
            treeBillboardDistance        = uo.treeBillboardDistance;
            treeCrossFadeLength          = uo.treeCrossFadeLength;
            treeMaximumFullLODCount      = uo.treeMaximumFullLODCount;
            detailObjectDistance         = uo.detailObjectDistance;
            detailObjectDensity          = uo.detailObjectDensity;
            heightmapPixelError          = uo.heightmapPixelError;
            heightmapMaximumLOD          = uo.heightmapMaximumLOD;
            basemapDistance              = uo.basemapDistance;
            lightmapIndex                = uo.lightmapIndex;
            realtimeLightmapIndex        = uo.realtimeLightmapIndex;
            lightmapScaleOffset          = uo.lightmapScaleOffset;
            realtimeLightmapScaleOffset  = uo.realtimeLightmapScaleOffset;
            freeUnusedRenderingResources = uo.freeUnusedRenderingResources;
            reflectionProbeUsage         = uo.reflectionProbeUsage;
            materialTemplate             = ToID(uo.materialTemplate);
            drawHeightmap                = uo.drawHeightmap;
            drawTreesAndFoliage          = uo.drawTreesAndFoliage;
            patchBoundsMultiplier        = uo.patchBoundsMultiplier;
            treeLODBiasMultiplier        = uo.treeLODBiasMultiplier;
            collectDetailPatches         = uo.collectDetailPatches;
            editorRenderFlags            = uo.editorRenderFlags;
            preserveTreePrototypeLayers  = uo.preserveTreePrototypeLayers;
            allowAutoConnect             = uo.allowAutoConnect;
            groupingID        = uo.groupingID;
            drawInstanced     = uo.drawInstanced;
            shadowCastingMode = uo.shadowCastingMode;
        }
Ejemplo n.º 12
0
 public static void SetShadowMode(GameObject go, ShadowCastingMode shadowCastingMode)
 {
     Renderer[] renderers = go.GetComponentsInChildren <Renderer>(true);
     foreach (Renderer renderer in renderers)
     {
         renderer.shadowCastingMode = shadowCastingMode;
     }
 }
Ejemplo n.º 13
0
 public override void Setup()
 {
     this.shadows  = ((Renderer)this.component).get_shadowCastingMode();
     this.material = ((Renderer)this.component).get_sharedMaterial();
     this.mesh     = this.component.get_sharedMesh();
     this.bounds   = this.component.get_localBounds();
     this.RefreshCache();
 }
Ejemplo n.º 14
0
 private void SetShadowCastingMode(ShadowCastingMode newMode)
 {
     Renderer[] rends = normalInstancesParent.GetComponentsInChildren <Renderer>();
     for (int i = 0; i < rends.Length; i++)
     {
         rends[i].shadowCastingMode = newMode;
     }
 }
 public override void Setup()
 {
     this.shadows  = this.component.shadowCastingMode;
     this.material = this.component.sharedMaterial;
     this.mesh     = this.component.sharedMesh;
     this.bounds   = this.component.localBounds;
     this.RefreshCache();
 }
Ejemplo n.º 16
0
        public void Render(Vector3 observerPos, float visibleDistance, Vector3[] frustumPlanesNormals, float[] frustumPlanesDistances)
        {
                        #if DEBUG_BATCHES
            int batches        = 0;
            int instancesCount = 0;
                        #endif

            for (int k = 0; k <= cells.lastIndex; k++)
            {
                BatchedCell cell = cells.values [k];
                if (cell == null)
                {
                    continue;
                }
                if (!GeometryUtilityNonAlloc.TestPlanesAABB(frustumPlanesNormals, frustumPlanesDistances, ref cell.boundsMin, ref cell.boundsMax))
                {
                    continue;
                }

                if (cell.rebuild)
                {
                    if (!Application.isPlaying || Time.frameCount - cell.lastRebuildFrame > 10)
                    {
                        cell.lastRebuildFrame = Time.frameCount;
                        RebuildCellRenderingLists(cell, observerPos, visibleDistance);
                        cell.rebuild = false;
                    }
                }

                for (int j = 0; j <= cell.batchedMeshes.lastIndex; j++)
                {
                    BatchedMesh batchedMesh = cell.batchedMeshes.values [j];
                    if (batchedMesh == null)
                    {
                        continue;
                    }
                    VoxelDefinition   vd   = batchedMesh.voxelDefinition;
                    Mesh              mesh = vd.mesh;
                    ShadowCastingMode shadowCastingMode = (vd.castShadows && env.enableShadows) ? ShadowCastingMode.On : ShadowCastingMode.Off;
                    bool              receiveShadows    = vd.receiveShadows && env.enableShadows;
                    for (int i = 0; i < batchedMesh.batches.count; i++)
                    {
                        Batch batch = batchedMesh.batches.values [i];
                        if (GeometryUtilityNonAlloc.TestPlanesAABB(frustumPlanesNormals, frustumPlanesDistances, ref batch.boundsMin, ref batch.boundsMax))
                        {
                            Graphics.DrawMeshInstancedIndirect(mesh, 0, batch.instancedMaterial, batch.bounds, batch.argsBuffer, 0, null, shadowCastingMode, receiveShadows, env.layerVoxels);
                                                        #if DEBUG_BATCHES
                            batches++;
                            instancesCount += batch.instancesCount;
                                                        #endif
                        }
                    }
                }
            }
                        #if DEBUG_BATCHES
            Debug.Log("Batches: " + batches + " Instances: " + instancesCount);
                        #endif
        }
Ejemplo n.º 17
0
    public bool                                  receiveShadows;     /// Does this object receive shadows?


    public RenderSurfaceSettings(DebugSurfaceType debugSurfaceType)
    {
        UnityEngine.Debug.Assert(debugSurfaceType != DebugSurfaceType.None);
        layer = 0;
        renderingLayerMask    = 0;
        shadowCastingMode     = ShadowCastingMode.Off;
        receiveShadows        = false;
        this.debugSurfaceType = debugSurfaceType;
    }
Ejemplo n.º 18
0
        public static void DrawMeshInstanced(Mesh mesh, int submeshIndex, Material material, List <Matrix4x4> matrices, MaterialPropertyBlock properties)
        {
            Camera            camera         = null;
            int               layer          = 0;
            bool              receiveShadows = true;
            ShadowCastingMode castShadows    = ShadowCastingMode.On;

            DrawMeshInstanced(mesh, submeshIndex, material, matrices, properties, castShadows, receiveShadows, layer, camera);
        }
Ejemplo n.º 19
0
        public static void DrawMeshInstancedIndirect(Mesh mesh, int submeshIndex, Material material, Bounds bounds, ComputeBuffer bufferWithArgs, int argsOffset, MaterialPropertyBlock properties)
        {
            Camera            camera         = null;
            int               layer          = 0;
            bool              receiveShadows = true;
            ShadowCastingMode castShadows    = ShadowCastingMode.On;

            DrawMeshInstancedIndirect(mesh, submeshIndex, material, bounds, bufferWithArgs, argsOffset, properties, castShadows, receiveShadows, layer, camera);
        }
Ejemplo n.º 20
0
    void SetShadowCasters(ShadowCastingMode mode)
    {
        var obj = Object.FindObjectsOfType <MeshRenderer> ();

        foreach (var item in obj)
        {
            item.shadowCastingMode = mode;
        }
    }
Ejemplo n.º 21
0
    public void UpdateShadowCastingMode(ShadowCastingMode sMode)
    {
        var list = GetComponentsInChildren <Renderer>();

        foreach (var item in list)
        {
            item.shadowCastingMode = sMode;
        }
    }
Ejemplo n.º 22
0
 // Token: 0x06000CC1 RID: 3265 RVA: 0x0005E02C File Offset: 0x0005C42C
 public static void drawTile(FoliageTile tile, int sqrDistance, float density, Camera camera)
 {
     if (tile == null)
     {
         return;
     }
     if (tile.hasInstances)
     {
         foreach (KeyValuePair <AssetReference <FoliageInstancedMeshInfoAsset>, FoliageInstanceList> keyValuePair in tile.instances)
         {
             FoliageInstanceList value = keyValuePair.Value;
             value.loadAsset();
             Mesh mesh = value.mesh;
             if (!(mesh == null))
             {
                 Material material = value.material;
                 if (!(material == null))
                 {
                     bool castShadows = value.castShadows;
                     if (!value.tileDither)
                     {
                         density = 1f;
                     }
                     density *= FoliageSettings.instanceDensity;
                     if (value.sqrDrawDistance == -1 || sqrDistance <= value.sqrDrawDistance)
                     {
                         if (FoliageSettings.forceInstancingOff || !SystemInfo.supportsInstancing)
                         {
                             foreach (List <Matrix4x4> list in value.matrices)
                             {
                                 int num = Mathf.RoundToInt((float)list.Count * density);
                                 for (int i = 0; i < num; i++)
                                 {
                                     Graphics.DrawMesh(mesh, list[i], material, LayerMasks.ENVIRONMENT, camera, 0, null, castShadows, true);
                                 }
                             }
                         }
                         else
                         {
                             ShadowCastingMode castShadows2 = (!castShadows) ? ShadowCastingMode.Off : ShadowCastingMode.On;
                             foreach (List <Matrix4x4> list2 in value.matrices)
                             {
                                 int count = Mathf.RoundToInt((float)list2.Count * density);
                                 Graphics.DrawMeshInstanced(mesh, 0, material, list2.GetInternalArray <Matrix4x4>(), count, null, castShadows2, true, LayerMasks.ENVIRONMENT, camera);
                             }
                         }
                     }
                 }
             }
         }
     }
     else
     {
         tile.readInstancesJob();
     }
 }
Ejemplo n.º 23
0
    void Start()
    {
        mesh = GetComponent <MeshFilter>().mesh;
        mat  = GetComponent <Renderer>().material;
        //matrix = new Matrix4x4[2] { obj.transform.localToWorldMatrix, this.transform.localToWorldMatrix };
        castShadows = ShadowCastingMode.On;


        //Graphics.DrawMeshInstanced(mesh, 0, mat, matrix, matrix.Length, null, castShadows, true, 0, null);
    }
        public void EnableShadows(bool enabled)
        {
            tileShadowCastingMode = (enabled) ? ShadowCastingMode.On : ShadowCastingMode.Off;

            MeshRenderer[] existingTiles = GetComponentsInChildren <MeshRenderer>();
            foreach (var renderer in existingTiles)
            {
                renderer.shadowCastingMode = tileShadowCastingMode;
            }
        }
Ejemplo n.º 25
0
 public virtual void SetShadowMode(ShadowCastingMode mode)
 {
     if (Renderers != null)
     {
         foreach (var item in Renderers)
         {
             item.shadowCastingMode = mode;
         }
     }
 }
Ejemplo n.º 26
0
        public static void DrawMeshInstanced(Mesh mesh, int submeshIndex, Material material, Matrix4x4[] matrices, int count)
        {
            Camera                camera         = null;
            int                   layer          = 0;
            bool                  receiveShadows = true;
            ShadowCastingMode     castShadows    = ShadowCastingMode.On;
            MaterialPropertyBlock properties     = null;

            Graphics.DrawMeshInstanced(mesh, submeshIndex, material, matrices, count, properties, castShadows, receiveShadows, layer, camera);
        }
Ejemplo n.º 27
0
 extern private void SetRuntimeData(VFXExpressionSheetInternal sheet,
                                    VFXEditorSystemDesc[] systemDesc,
                                    VFXEventDesc[] eventDesc,
                                    VFXGPUBufferDesc[] bufferDesc,
                                    VFXTemporaryGPUBufferDesc[] temporaryBufferDesc,
                                    VFXCPUBufferDesc[] cpuBufferDesc,
                                    VFXShaderSourceDesc[] shaderSourceDesc,
                                    ShadowCastingMode shadowCastingMode,
                                    MotionVectorGenerationMode motionVectorGenerationMode,
                                    uint version);
Ejemplo n.º 28
0
        public void CopySettingsFrom(Terrain terrain)
        {
            if (terrain == null)
            {
                return;
            }

            // base settings
            GroupingID           = terrain.groupingID;
            AutoConnect          = terrain.allowAutoConnect;
            DrawHeightmap        = terrain.drawHeightmap;
            DrawInstanced        = terrain.drawInstanced;
            PixelError           = terrain.heightmapPixelError;
            BaseMapDistance      = terrain.basemapDistance;
            ShadowCastingMode    = terrain.shadowCastingMode;
            MaterialTemplate     = terrain.materialTemplate;
            ReflectionProbeUsage = terrain.reflectionProbeUsage;
#if UNITY_2019_2_OR_NEWER
#else
            MaterialType    = terrain.materialType;
            LegacySpecular  = terrain.legacySpecular;
            LegacyShininess = terrain.legacyShininess;
#endif

            // mesh resolution
            TerrainWidth             = terrain.terrainData.size.x;
            TerrainHeight            = terrain.terrainData.size.y;
            TerrainLength            = terrain.terrainData.size.z;
            DetailResolutaion        = terrain.terrainData.detailResolution;
            DetailResolutionPerPatch = terrain.terrainData.detailResolutionPerPatch;

            // texture resolution
            BaseTextureResolution = terrain.terrainData.baseMapResolution;
            AlphaMapResolution    = terrain.terrainData.alphamapResolution;
            HeightMapResolution   = terrain.terrainData.heightmapResolution;

            // tree and details
            DrawTreesAndFoliage         = terrain.drawTreesAndFoliage;
            BakeLightProbesForTrees     = terrain.bakeLightProbesForTrees;
            DeringLightProbesForTrees   = terrain.deringLightProbesForTrees;
            PreserveTreePrototypeLayers = terrain.preserveTreePrototypeLayers;
            DetailObjectDistance        = terrain.detailObjectDistance;
            CollectDetailPatches        = terrain.collectDetailPatches;
            DetailObjectDensity         = terrain.detailObjectDensity;
            TreeDistance            = terrain.treeDistance;
            TreeBillboardDistance   = terrain.treeBillboardDistance;
            TreeCrossFadeLength     = terrain.treeCrossFadeLength;
            TreeMaximumFullLODCount = terrain.treeMaximumFullLODCount;

            // grass wind
            WavingGrassStrength = terrain.terrainData.wavingGrassStrength;
            WavingGrassSpeed    = terrain.terrainData.wavingGrassSpeed;
            WavingGrassAmount   = terrain.terrainData.wavingGrassAmount;
            WavingGrassTint     = terrain.terrainData.wavingGrassTint;
        }
Ejemplo n.º 29
0
 private void Reset()
 {
     _spriteRenderer   = null;
     shadowCastingMode = ShadowCastingMode.TwoSided;
     receiveShadows    = true;
     SetValuesToSpriteRenderer();
     if (Sprite == null)
     {
         Sprite = Aura.ResourcesCollection.defaultSprite;
     }
 }
Ejemplo n.º 30
0
        public void CopySettingsFrom(TerrainSettings other)
        {
            if (other == null)
            {
                return;
            }

            GroupingID           = other.GroupingID;
            AutoConnect          = other.AutoConnect;
            DrawHeightmap        = other.DrawHeightmap;
            DrawInstanced        = other.DrawInstanced;
            PixelError           = other.PixelError;
            BaseMapDistance      = other.BaseMapDistance;
            ShadowCastingMode    = other.ShadowCastingMode;
            MaterialTemplate     = other.MaterialTemplate;
            ReflectionProbeUsage = other.ReflectionProbeUsage;
#if UNITY_2019_2_OR_NEWER
#else
            MaterialType    = other.MaterialType;
            LegacySpecular  = other.LegacySpecular;
            LegacyShininess = other.LegacyShininess;
#endif

            // mesh resolution
            TerrainWidth             = other.TerrainWidth;
            TerrainHeight            = other.TerrainHeight;
            TerrainLength            = other.TerrainLength;
            DetailResolutaion        = other.DetailResolutaion;
            DetailResolutionPerPatch = other.DetailResolutionPerPatch;

            // texture resolution
            BaseTextureResolution = other.BaseTextureResolution;
            AlphaMapResolution    = other.AlphaMapResolution;
            HeightMapResolution   = other.HeightMapResolution;

            // tree and details
            DrawTreesAndFoliage         = other.DrawTreesAndFoliage;
            BakeLightProbesForTrees     = other.BakeLightProbesForTrees;
            DeringLightProbesForTrees   = other.DeringLightProbesForTrees;
            PreserveTreePrototypeLayers = other.PreserveTreePrototypeLayers;
            DetailObjectDistance        = other.DetailObjectDistance;
            CollectDetailPatches        = other.CollectDetailPatches;
            DetailObjectDensity         = other.DetailObjectDensity;
            TreeDistance            = other.TreeDistance;
            TreeBillboardDistance   = other.TreeBillboardDistance;
            TreeCrossFadeLength     = other.TreeCrossFadeLength;
            TreeMaximumFullLODCount = other.TreeMaximumFullLODCount;

            // grass wind
            WavingGrassStrength = other.WavingGrassStrength;
            WavingGrassSpeed    = other.WavingGrassSpeed;
            WavingGrassAmount   = other.WavingGrassAmount;
            WavingGrassTint     = other.WavingGrassTint;
        }
Ejemplo n.º 31
0
 public static void DrawMesh(Mesh mesh, Matrix4x4 matrix, Material material, int layer, Camera camera, int submeshIndex, MaterialPropertyBlock properties, ShadowCastingMode castShadows, [DefaultValue("true")] bool receiveShadows, [DefaultValue("null")] Transform probeAnchor)
 {
   Graphics.Internal_DrawMeshMatrix(ref new Internal_DrawMeshMatrixArguments()
   {
     matrix = matrix,
     layer = layer,
     submeshIndex = submeshIndex,
     castShadows = (int) castShadows,
     receiveShadows = !receiveShadows ? 0 : 1,
     reflectionProbeAnchorInstanceID = !((Object) probeAnchor != (Object) null) ? 0 : probeAnchor.GetInstanceID()
   }, properties, material, mesh, camera);
 }
Ejemplo n.º 32
0
 public static void DrawMesh(Mesh mesh, Matrix4x4 matrix, Material material, int layer, Camera camera, int submeshIndex, MaterialPropertyBlock properties, ShadowCastingMode castShadows)
 {
   Transform probeAnchor = (Transform) null;
   bool receiveShadows = true;
   Graphics.DrawMesh(mesh, matrix, material, layer, camera, submeshIndex, properties, castShadows, receiveShadows, probeAnchor);
 }
Ejemplo n.º 33
0
 public static void DrawMesh(Mesh mesh, Vector3 position, Quaternion rotation, Material material, int layer, Camera camera, int submeshIndex, MaterialPropertyBlock properties, ShadowCastingMode castShadows, bool receiveShadows)
 {
   Transform probeAnchor = (Transform) null;
   Graphics.DrawMesh(mesh, position, rotation, material, layer, camera, submeshIndex, properties, castShadows, receiveShadows, probeAnchor);
 }
Ejemplo n.º 34
0
 public static void DrawMesh(Mesh mesh, Vector3 position, Quaternion rotation, Material material, int layer, Camera camera, int submeshIndex, MaterialPropertyBlock properties, ShadowCastingMode castShadows, [UnityEngine.Internal.DefaultValue("true")] bool receiveShadows, [UnityEngine.Internal.DefaultValue("null")] Transform probeAnchor)
 {
     Internal_DrawMeshTRArguments arguments = new Internal_DrawMeshTRArguments {
         position = position,
         rotation = rotation,
         layer = layer,
         submeshIndex = submeshIndex,
         castShadows = (int) castShadows,
         receiveShadows = !receiveShadows ? 0 : 1,
         reflectionProbeAnchorInstanceID = (probeAnchor == null) ? 0 : probeAnchor.GetInstanceID()
     };
     Internal_DrawMeshTR(ref arguments, properties, material, mesh, camera);
 }
Ejemplo n.º 35
0
 public static void DrawMeshInstanced(Mesh mesh, int submeshIndex, Material material, List<Matrix4x4> matrices, MaterialPropertyBlock properties, ShadowCastingMode castShadows)
 {
     Camera camera = null;
     int layer = 0;
     bool receiveShadows = true;
     DrawMeshInstanced(mesh, submeshIndex, material, matrices, properties, castShadows, receiveShadows, layer, camera);
 }
Ejemplo n.º 36
0
 private static extern void Internal_DrawMeshInstancedList(Mesh mesh, int submeshIndex, Material material, object matrixList, MaterialPropertyBlock properties, ShadowCastingMode castShadows, bool receiveShadows, int layer, Camera camera);
 public override void Setup(Renderer render, IFPV_Object parent)
 {
     base.Setup(render, parent);
     rendererShadowCastMode = render.shadowCastingMode;
 }
Ejemplo n.º 38
0
 public static void DrawMesh(Mesh mesh, Matrix4x4 matrix, Material material, int layer, Camera camera, int submeshIndex, MaterialPropertyBlock properties, ShadowCastingMode castShadows, bool receiveShadows)
 {
     bool useLightProbes = true;
     Transform probeAnchor = null;
     DrawMesh(mesh, matrix, material, layer, camera, submeshIndex, properties, castShadows, receiveShadows, probeAnchor, useLightProbes);
 }
Ejemplo n.º 39
0
 public static void DrawMeshInstanced(Mesh mesh, int submeshIndex, Material material, Matrix4x4[] matrices, int count, MaterialPropertyBlock properties, ShadowCastingMode castShadows, bool receiveShadows, int layer)
 {
     Camera camera = null;
     DrawMeshInstanced(mesh, submeshIndex, material, matrices, count, properties, castShadows, receiveShadows, layer, camera);
 }
Ejemplo n.º 40
0
 /// <summary>
 /// <para>Draw a mesh.</para>
 /// </summary>
 /// <param name="mesh">The Mesh to draw.</param>
 /// <param name="position">Position of the mesh.</param>
 /// <param name="rotation">Rotation of the mesh.</param>
 /// <param name="materialIndex">Subset of the mesh to draw.</param>
 /// <param name="matrix">Transformation matrix of the mesh (combines position, rotation and other transformations).</param>
 /// <param name="material">Material to use.</param>
 /// <param name="layer"> to use.</param>
 /// <param name="camera">If null (default), the mesh will be drawn in all cameras. Otherwise it will be rendered in the given camera only.</param>
 /// <param name="submeshIndex">Which subset of the mesh to draw. This applies only to meshes that are composed of several materials.</param>
 /// <param name="properties">Additional material properties to apply onto material just before this mesh will be drawn. See MaterialPropertyBlock.</param>
 /// <param name="castShadows">Should the mesh cast shadows?</param>
 /// <param name="receiveShadows">Should the mesh receive shadows?</param>
 /// <param name="useLightProbes">Should the mesh use light probes?</param>
 /// <param name="probeAnchor">If used, the mesh will use this Transform's position to sample light probes and find the matching reflection probe.</param>
 public static void DrawMesh(Mesh mesh, Matrix4x4 matrix, Material material, int layer, Camera camera, int submeshIndex, MaterialPropertyBlock properties, ShadowCastingMode castShadows, [UnityEngine.Internal.DefaultValue("true")] bool receiveShadows, [UnityEngine.Internal.DefaultValue("null")] Transform probeAnchor, [UnityEngine.Internal.DefaultValue("true")] bool useLightProbes)
 {
     Internal_DrawMeshMatrixArguments arguments = new Internal_DrawMeshMatrixArguments {
         matrix = matrix,
         layer = layer,
         submeshIndex = submeshIndex,
         castShadows = (int) castShadows,
         receiveShadows = !receiveShadows ? 0 : 1,
         reflectionProbeAnchorInstanceID = (probeAnchor == null) ? 0 : probeAnchor.GetInstanceID(),
         useLightProbes = useLightProbes
     };
     Internal_DrawMeshMatrix(ref arguments, properties, material, mesh, camera);
 }
Ejemplo n.º 41
0
 public static void DrawMesh(Mesh mesh, Vector3 position, Quaternion rotation, Material material, int layer, Camera camera, int submeshIndex, MaterialPropertyBlock properties, ShadowCastingMode castShadows, bool receiveShadows, Transform probeAnchor)
 {
     bool useLightProbes = true;
     DrawMesh(mesh, position, rotation, material, layer, camera, submeshIndex, properties, castShadows, receiveShadows, probeAnchor, useLightProbes);
 }
Ejemplo n.º 42
0
    static void LoadPrefs()
    {
        pbStripProBuilderOnBuild 			= pb_Preferences_Internal.GetBool(pb_Constant.pbStripProBuilderOnBuild);
        pbDisableAutoUV2Generation 			= pb_Preferences_Internal.GetBool(pb_Constant.pbDisableAutoUV2Generation);
        pbShowSceneInfo 					= pb_Preferences_Internal.GetBool(pb_Constant.pbShowSceneInfo);
        defaultOpenInDockableWindow 		= pb_Preferences_Internal.GetBool(pb_Constant.pbDefaultOpenInDockableWindow);
        pbDragCheckLimit 					= pb_Preferences_Internal.GetBool(pb_Constant.pbDragCheckLimit);
        pbForceConvex 						= pb_Preferences_Internal.GetBool(pb_Constant.pbForceConvex);
        pbForceGridPivot 					= pb_Preferences_Internal.GetBool(pb_Constant.pbForceGridPivot);
        pbForceVertexPivot 					= pb_Preferences_Internal.GetBool(pb_Constant.pbForceVertexPivot);
        pbPerimeterEdgeBridgeOnly 			= pb_Preferences_Internal.GetBool(pb_Constant.pbPerimeterEdgeBridgeOnly);
        pbPBOSelectionOnly 					= pb_Preferences_Internal.GetBool(pb_Constant.pbPBOSelectionOnly);
        pbCloseShapeWindow 					= pb_Preferences_Internal.GetBool(pb_Constant.pbCloseShapeWindow);
        pbUVEditorFloating 					= pb_Preferences_Internal.GetBool(pb_Constant.pbUVEditorFloating);
        // pbShowSceneToolbar 					= pb_Preferences_Internal.GetBool(pb_Constant.pbShowSceneToolbar);
        pbShowEditorNotifications 			= pb_Preferences_Internal.GetBool(pb_Constant.pbShowEditorNotifications);
        pbUniqueModeShortcuts 				= pb_Preferences_Internal.GetBool(pb_Constant.pbUniqueModeShortcuts);
        pbIconGUI 							= pb_Preferences_Internal.GetBool(pb_Constant.pbIconGUI);
        pbShiftOnlyTooltips 				= pb_Preferences_Internal.GetBool(pb_Constant.pbShiftOnlyTooltips);
        pbDrawAxisLines 					= pb_Preferences_Internal.GetBool(pb_Constant.pbDrawAxisLines);
        pbMeshesAreAssets 					= pb_Preferences_Internal.GetBool(pb_Constant.pbMeshesAreAssets);
        pbElementSelectIsHamFisted			= pb_Preferences_Internal.GetBool(pb_Constant.pbElementSelectIsHamFisted);
        pbDragSelectWholeElement			= pb_Preferences_Internal.GetBool(pb_Constant.pbDragSelectWholeElement);

        pbDefaultFaceColor 					= pb_Preferences_Internal.GetColor( pb_Constant.pbDefaultFaceColor );
        pbDefaultEdgeColor 					= pb_Preferences_Internal.GetColor( pb_Constant.pbDefaultEdgeColor );
        pbDefaultSelectedVertexColor 		= pb_Preferences_Internal.GetColor( pb_Constant.pbDefaultSelectedVertexColor );
        pbDefaultVertexColor 				= pb_Preferences_Internal.GetColor( pb_Constant.pbDefaultVertexColor );

        pbUVGridSnapValue 					= pb_Preferences_Internal.GetFloat(pb_Constant.pbUVGridSnapValue);
        pbVertexHandleSize 					= pb_Preferences_Internal.GetFloat(pb_Constant.pbVertexHandleSize);

        defaultColliderType 				= pb_Preferences_Internal.GetEnum<ColliderType>(pb_Constant.pbDefaultCollider);
        pbToolbarLocation	 				= pb_Preferences_Internal.GetEnum<SceneToolbarLocation>(pb_Constant.pbToolbarLocation);
        pbDefaultEntity	 					= pb_Preferences_Internal.GetEnum<EntityType>(pb_Constant.pbDefaultEntity);
        #if !UNITY_4_7
        pbShadowCastingMode					= pb_Preferences_Internal.GetEnum<ShadowCastingMode>(pb_Constant.pbShadowCastingMode);
        #endif

        pbDefaultMaterial 					= pb_Preferences_Internal.GetMaterial(pb_Constant.pbDefaultMaterial);

        defaultShortcuts 					= pb_Preferences_Internal.GetShortcuts().ToArray();
    }
 /// <summary>
 /// Manualy change the custom shadowCastingMode of this renderer.
 /// </summary>
 /// <param name="mode"></param>
 public void SetShadowCastingMode(ShadowCastingMode mode)
 {
     rendererShadowCastMode = mode;
 }
Ejemplo n.º 44
0
    public static void PreferencesGUI()
    {
        // Load the preferences
        if (!prefsLoaded) {
            LoadPrefs();
            prefsLoaded = true;
            OnWindowResize();
        }

        settingsScroll = EditorGUILayout.BeginScrollView(settingsScroll, GUILayout.MaxHeight(200));

        EditorGUI.BeginChangeCheck();

        /**
         * GENERAL SETTINGS
         */
        GUILayout.Label("General Settings", EditorStyles.boldLabel);

        pbStripProBuilderOnBuild = EditorGUILayout.Toggle(new GUIContent("Strip PB Scripts on Build", "If true, when building an executable all ProBuilder scripts will be stripped from your built product."), pbStripProBuilderOnBuild);
        pbDisableAutoUV2Generation = EditorGUILayout.Toggle(new GUIContent("Disable Auto UV2 Generation", "Disables automatic generation of UV2 channel.  If Unity is sluggish when working with large ProBuilder objects, disabling UV2 generation will improve performance.  Use `Actions/Generate UV2` or `Actions/Generate Scene UV2` to build lightmap UVs prior to baking."), pbDisableAutoUV2Generation);
        pbShowSceneInfo = EditorGUILayout.Toggle(new GUIContent("Show Scene Info", "Displays the selected object vertex and triangle counts in the scene view."), pbShowSceneInfo);
        pbShowEditorNotifications = EditorGUILayout.Toggle("Show Editor Notifications", pbShowEditorNotifications);

        /**
         * TOOLBAR SETTINGS
         */
        GUILayout.Label("Toolbar Settings", EditorStyles.boldLabel);

        pbIconGUI = EditorGUILayout.Toggle(new GUIContent("Use Icon GUI", "Toggles the ProBuilder window interface between text and icon versions."), pbIconGUI);
        pbShiftOnlyTooltips = EditorGUILayout.Toggle(new GUIContent("Shift Key Tooltips", "Tooltips will only show when the Shift key is held"), pbShiftOnlyTooltips);
        pbToolbarLocation = (SceneToolbarLocation) EditorGUILayout.EnumPopup("Toolbar Location", pbToolbarLocation);

        pbUniqueModeShortcuts = EditorGUILayout.Toggle(new GUIContent("Unique Mode Shortcuts", "When off, the G key toggles between Object and Element modes and H enumerates the element modes.  If on, G, H, J, and K are shortcuts to Object, Vertex, Edge, and Face modes respectively."), pbUniqueModeShortcuts);
        defaultOpenInDockableWindow = EditorGUILayout.Toggle("Open in Dockable Window", defaultOpenInDockableWindow);

        /**
         * DEFAULT SETTINGS
         */
        GUILayout.Label("Defaults", EditorStyles.boldLabel);

        pbDefaultMaterial = (Material) EditorGUILayout.ObjectField("Default Material", pbDefaultMaterial, typeof(Material), false);

        GUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel("Default Entity");
            pbDefaultEntity = ((EntityType)EditorGUILayout.EnumPopup( (EntityType)pbDefaultEntity ));
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel("Default Collider");
            defaultColliderType = ((ColliderType)EditorGUILayout.EnumPopup( (ColliderType)defaultColliderType ));
        GUILayout.EndHorizontal();

        if((ColliderType)defaultColliderType == ColliderType.MeshCollider)
            pbForceConvex = EditorGUILayout.Toggle("Force Convex Mesh Collider", pbForceConvex);

        #if !UNITY_4_7
        GUILayout.BeginHorizontal();
        EditorGUILayout.PrefixLabel("Shadow Casting Mode");
        pbShadowCastingMode = (ShadowCastingMode) EditorGUILayout.EnumPopup(pbShadowCastingMode);
        GUILayout.EndHorizontal();
        #endif

        /**
         * MISC. SETTINGS
         */
        GUILayout.Label("Misc. Settings", EditorStyles.boldLabel);

        pbDragCheckLimit = EditorGUILayout.Toggle(new GUIContent("Limit Drag Check to Selection", "If true, when drag selecting faces, only currently selected pb-Objects will be tested for matching faces.  If false, all pb_Objects in the scene will be checked.  The latter may be slower in large scenes."), pbDragCheckLimit);
        pbPBOSelectionOnly = EditorGUILayout.Toggle(new GUIContent("Only PBO are Selectable", "If true, you will not be able to select non probuilder objects in Geometry and Texture mode"), pbPBOSelectionOnly);
        pbCloseShapeWindow = EditorGUILayout.Toggle(new GUIContent("Close shape window after building", "If true the shape window will close after hitting the build button"), pbCloseShapeWindow);
        pbDrawAxisLines = EditorGUILayout.Toggle(new GUIContent("Dimension Overlay Lines", "When the Dimensions Overlay is on, this toggle shows or hides the axis lines."), pbDrawAxisLines);

        GUILayout.Space(4);

        /**
         * GEOMETRY EDITING SETTINGS
         */
        GUILayout.Label("Geometry Editing Settings", EditorStyles.boldLabel);

        pbElementSelectIsHamFisted = !EditorGUILayout.Toggle(new GUIContent("Precise Element Selection", "When enabled you will be able to select object faces when in Vertex of Edge mode by clicking the center of a face.  When disabled, edge and vertex selection will always be restricted to the nearest element."), !pbElementSelectIsHamFisted);
        pbDragSelectWholeElement = EditorGUILayout.Toggle("Precise Drag Select", pbDragSelectWholeElement);
        pbDefaultFaceColor = EditorGUILayout.ColorField("Selected Face Color", pbDefaultFaceColor);
        pbDefaultEdgeColor = EditorGUILayout.ColorField("Edge Wireframe Color", pbDefaultEdgeColor);
        pbDefaultVertexColor = EditorGUILayout.ColorField("Vertex Color", pbDefaultVertexColor);
        pbDefaultSelectedVertexColor = EditorGUILayout.ColorField("Selected Vertex Color", pbDefaultSelectedVertexColor);
        pbVertexHandleSize = EditorGUILayout.Slider("Vertex Handle Size", pbVertexHandleSize, 0f, 3f);
        pbForceVertexPivot = EditorGUILayout.Toggle(new GUIContent("Force Pivot to Vertex Point", "If true, new objects will automatically have their pivot point set to a vertex instead of the center."), pbForceVertexPivot);
        pbForceGridPivot = EditorGUILayout.Toggle(new GUIContent("Force Pivot to Grid", "If true, newly instantiated pb_Objects will be snapped to the nearest point on grid.  If ProGrids is present, the snap value will be used, otherwise decimals are simply rounded to whole numbers."), pbForceGridPivot);
        pbPerimeterEdgeBridgeOnly = EditorGUILayout.Toggle(new GUIContent("Bridge Perimeter Edges Only", "If true, only edges on the perimeters of an object may be bridged.  If false, you may bridge any between any two edges you like."), pbPerimeterEdgeBridgeOnly);

        GUILayout.Space(4);

        GUILayout.Label("Experimental", EditorStyles.boldLabel);

        pbMeshesAreAssets = EditorGUILayout.Toggle(new GUIContent("Meshes Are Assets", "Experimental!  Instead of storing mesh data in the scene, this toggle creates a Mesh cache in the Project that ProBuilder will use."), pbMeshesAreAssets);

        GUILayout.Space(4);

        /**
         * UV EDITOR SETTINGS
         */
        GUILayout.Label("UV Editing Settings", EditorStyles.boldLabel);
        pbUVGridSnapValue = EditorGUILayout.FloatField("UV Snap Increment", pbUVGridSnapValue);
        pbUVGridSnapValue = Mathf.Clamp(pbUVGridSnapValue, .015625f, 2f);
        pbUVEditorFloating = EditorGUILayout.Toggle(new GUIContent("Editor window floating", "If true UV   Editor window will open as a floating window"), pbUVEditorFloating);

        EditorGUILayout.EndScrollView();

        GUILayout.Space(4);

        GUILayout.Label("Shortcut Settings", EditorStyles.boldLabel);

        if(GUI.Button(resetRect, "Use defaults"))
            ResetToDefaults();

        ShortcutSelectPanel();
        ShortcutEditPanel();

        // Save the preferences
        if (EditorGUI.EndChangeCheck())
            SetPrefs();
    }
Ejemplo n.º 45
0
		public static void DrawMesh(Mesh mesh, Vector3 position, Quaternion rotation, Material material, int layer, Camera camera, int submeshIndex, MaterialPropertyBlock properties, ShadowCastingMode castShadows, [UnityEngine.Internal.DefaultValue("true")] bool receiveShadows, [UnityEngine.Internal.DefaultValue("null")] Transform probeAnchor)
		{
			Internal_DrawMeshTRArguments internal_DrawMeshTRArguments = default(Internal_DrawMeshTRArguments);
			internal_DrawMeshTRArguments.position = position;
			internal_DrawMeshTRArguments.rotation = rotation;
			internal_DrawMeshTRArguments.layer = layer;
			internal_DrawMeshTRArguments.submeshIndex = submeshIndex;
			internal_DrawMeshTRArguments.castShadows = (int)castShadows;
			internal_DrawMeshTRArguments.receiveShadows = ((!receiveShadows) ? 0 : 1);
			internal_DrawMeshTRArguments.reflectionProbeAnchorInstanceID = ((!(probeAnchor != null)) ? 0 : probeAnchor.GetInstanceID());
			Graphics.Internal_DrawMeshTR(ref internal_DrawMeshTRArguments, properties, material, mesh, camera);
		}
Ejemplo n.º 46
0
		public static void DrawMesh(Mesh mesh, Matrix4x4 matrix, Material material, int layer, Camera camera, int submeshIndex, MaterialPropertyBlock properties, ShadowCastingMode castShadows, [UnityEngine.Internal.DefaultValue("true")] bool receiveShadows)
		{
			Internal_DrawMeshMatrixArguments internal_DrawMeshMatrixArguments = default(Internal_DrawMeshMatrixArguments);
			internal_DrawMeshMatrixArguments.matrix = matrix;
			internal_DrawMeshMatrixArguments.layer = layer;
			internal_DrawMeshMatrixArguments.submeshIndex = submeshIndex;
			internal_DrawMeshMatrixArguments.castShadows = (int)castShadows;
			internal_DrawMeshMatrixArguments.receiveShadows = ((!receiveShadows) ? 0 : 1);
			Graphics.Internal_DrawMeshMatrix(ref internal_DrawMeshMatrixArguments, properties, material, mesh, camera);
		}
Ejemplo n.º 47
0
 /// <summary>
 /// <para>Draw a mesh.</para>
 /// </summary>
 /// <param name="mesh">The Mesh to draw.</param>
 /// <param name="position">Position of the mesh.</param>
 /// <param name="rotation">Rotation of the mesh.</param>
 /// <param name="materialIndex">Subset of the mesh to draw.</param>
 /// <param name="matrix">Transformation matrix of the mesh (combines position, rotation and other transformations).</param>
 /// <param name="material">Material to use.</param>
 /// <param name="layer"> to use.</param>
 /// <param name="camera">If null (default), the mesh will be drawn in all cameras. Otherwise it will be rendered in the given camera only.</param>
 /// <param name="submeshIndex">Which subset of the mesh to draw. This applies only to meshes that are composed of several materials.</param>
 /// <param name="properties">Additional material properties to apply onto material just before this mesh will be drawn. See MaterialPropertyBlock.</param>
 /// <param name="castShadows">Should the mesh cast shadows?</param>
 /// <param name="receiveShadows">Should the mesh receive shadows?</param>
 /// <param name="useLightProbes">Should the mesh use light probes?</param>
 /// <param name="probeAnchor">If used, the mesh will use this Transform's position to sample light probes and find the matching reflection probe.</param>
 public static void DrawMesh(Mesh mesh, Vector3 position, Quaternion rotation, Material material, int layer, Camera camera, int submeshIndex, MaterialPropertyBlock properties, ShadowCastingMode castShadows, [UnityEngine.Internal.DefaultValue("true")] bool receiveShadows, [UnityEngine.Internal.DefaultValue("null")] Transform probeAnchor, [UnityEngine.Internal.DefaultValue("true")] bool useLightProbes)
 {
     DrawMesh(mesh, Matrix4x4.TRS(position, rotation, Vector3.one), material, layer, camera, submeshIndex, properties, castShadows, receiveShadows, probeAnchor, useLightProbes);
 }