当前位置: 首页>>代码示例>>C#>>正文


C# RenderManager.Intersect方法代码示例

本文整理汇总了C#中RenderManager.Intersect方法的典型用法代码示例。如果您正苦于以下问题:C# RenderManager.Intersect方法的具体用法?C# RenderManager.Intersect怎么用?C# RenderManager.Intersect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RenderManager的用法示例。


在下文中一共展示了RenderManager.Intersect方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RenderInstance

 public static void RenderInstance(ref Building b, RenderManager.CameraInfo cameraInfo, ushort buildingID,
     int layerMask)
 {
     if ((b.m_flags & (Building.Flags.Created | Building.Flags.Deleted | Building.Flags.Hidden)) != Building.Flags.Created)
         return;
     BuildingInfo info = b.Info;
     //begin mod
     if (info == null)
     {
         return;
     }
     var ai = info.m_buildingAI;
     if ((layerMask & 1 << info.m_prefabDataLayer) == 0 && !(ai is PlayerBuildingAI || ai is DecorationBuildingAI/* || ai is DummyBuildingAI*/)) //TODO(earalov): do we need to uncomment that?
         //end mod
         return;
     Vector3 point = b.m_position;
     float radius = info.m_renderSize + (float)b.m_baseHeight * 0.5f;
     point.y += (float)(((double)info.m_size.y - (double)b.m_baseHeight) * 0.5);
     if (!cameraInfo.Intersect(point, radius))
         return;
     RenderManager instance = Singleton<RenderManager>.instance;
     uint instanceIndex;
     if (!instance.RequireInstance((uint)buildingID, 1U, out instanceIndex))
         return;
     RenderInstance(ref b, cameraInfo, buildingID, layerMask, info, ref instance.m_instances[(uint)instanceIndex]);
 }
开发者ID:earalov,项目名称:Skylines-AdaptivePropVisibilityDistance,代码行数:26,代码来源:BuildingDetour.cs

示例2: BeginOverlayImpl

        protected void BeginOverlayImpl(RenderManager.CameraInfo cameraInfo)
        {
            var g = GameAreaManager.instance;
            float m_borderAlpha = (float)g.GetType().GetField("m_borderAlpha", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).GetValue(g);
            float m_areaAlpha = (float)g.GetType().GetField("m_areaAlpha", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).GetValue(g);
            Material m_borderMaterial = (Material)g.GetType().GetField("m_borderMaterial", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).GetValue(g);
            Material m_areaMaterial = (Material)g.GetType().GetField("m_areaMaterial", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).GetValue(g);
            Material m_decorationMaterial = (Material)g.GetType().GetField("m_decorationMaterial", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).GetValue(g);
            Mesh m_borderMesh = (Mesh)g.GetType().GetField("m_borderMesh", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).GetValue(g);

            int ID_Color = (int)g.GetType().GetField("ID_Color", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).GetValue(g);
            int ID_AreaMapping = (int)g.GetType().GetField("ID_AreaMapping", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).GetValue(g);

            if ((double)m_borderAlpha >= 1.0 / 1000.0 && (UnityEngine.Object)m_borderMaterial != (UnityEngine.Object)null)
            {
                Quaternion rotation = Quaternion.AngleAxis(90f, Vector3.up);
                Color color = Color.white;
                ToolController toolController = Singleton<ToolManager>.instance.m_properties;
                if ((UnityEngine.Object)toolController != (UnityEngine.Object)null && (toolController.CurrentTool.GetErrors() & ToolBase.ToolErrors.OutOfArea) != ToolBase.ToolErrors.None)
                    color = Color.red;
                color.a = m_borderAlpha;
                for (int z = 0; z < GRID; z +=1)
                {
                    for (int x = 0; x < GRID; x +=1)
                    {
                        bool flag1 = g.GetArea(x, z) > 0;
                        bool flag2 = g.GetArea(x, z - 1) > 0;
                        bool flag3 = g.GetArea(x - 1, z) > 0;
                        if (flag1 != flag2)
                        {
                            Vector3 vector3 = new Vector3((float)(((double)x - 4.5 + 0.5) * 1920.0), 0.0f, (float)(((double)z - 4.5) * 1920.0));
                            Vector3 size = new Vector3(1920f, 1024f, 100f);
                            Bounds bounds = new Bounds(vector3 + new Vector3(0.0f, size.y * 0.5f, 0.0f), size);
                            if (cameraInfo.Intersect(bounds))
                            {
                                Singleton<TerrainManager>.instance.SetWaterMaterialProperties(vector3, m_borderMaterial);
                                m_borderMaterial.SetColor(ID_Color, color);
                                if (m_borderMaterial.SetPass(0))
                                {
                                    ++Singleton<GameAreaManager>.instance.m_drawCallData.m_overlayCalls;
                                    Graphics.DrawMeshNow(m_borderMesh, vector3, rotation);
                                }
                            }
                        }
                        if (flag1 != flag3)
                        {
                            Vector3 vector3 = new Vector3((float)(((double)x - 4.5) * 1920.0), 0.0f, (float)(((double)z - 4.5 + 0.5) * 1920.0));
                            Vector3 size = new Vector3(100f, 1024f, 1920f);
                            Bounds bounds = new Bounds(vector3 + new Vector3(0.0f, size.y * 0.5f, 0.0f), size);
                            if (cameraInfo.Intersect(bounds))
                            {
                                Singleton<TerrainManager>.instance.SetWaterMaterialProperties(vector3, m_borderMaterial);
                                m_borderMaterial.SetColor(ID_Color, color);
                                if (m_borderMaterial.SetPass(0))
                                {
                                    ++Singleton<GameAreaManager>.instance.m_drawCallData.m_overlayCalls;
                                    Graphics.DrawMeshNow(m_borderMesh, vector3, Quaternion.identity);
                                }
                            }
                        }
                    }
                }
            }
            if (m_areaAlpha < 1.0 / 1000.0 || !((UnityEngine.Object)m_areaMaterial != (UnityEngine.Object)null))
                return;
            Vector4 vector;
            vector.z = 1 / (float)(1920f * TEXSIZE); //6.510417E-05f;
            vector.x = (GRID + 2) / (float)(TEXSIZE * 2); // 0.5f;
            vector.y = (GRID + 2)/ (float)(TEXSIZE * 2); // 0.5f;
            vector.w = 0.125f;
            m_areaMaterial.mainTexture = (Texture)m_areaTex;
            m_areaMaterial.SetColor(ID_Color, new Color(1f, 1f, 1f, m_areaAlpha));
            m_areaMaterial.SetVector(ID_AreaMapping, vector);
            Bounds freeBounds = GetFreeBounds();
            freeBounds.size = freeBounds.size + new Vector3(100f, 1f, 100f);
            ++Singleton<GameAreaManager>.instance.m_drawCallData.m_overlayCalls;
            Singleton<RenderManager>.instance.OverlayEffect.DrawEffect(cameraInfo, m_areaMaterial, 0, freeBounds);
        }
开发者ID:EmperorOfDoom,项目名称:cities-skylines-unlimiter-1,代码行数:78,代码来源:FakeGameAreaManager.cs

示例3: RenderInstance

        public static bool RenderInstance(ref CitizenInstance instance, RenderManager.CameraInfo cameraInfo, ushort instanceID)
        {
            if ((instance.m_flags & CitizenInstance.Flags.Character) == CitizenInstance.Flags.None)
                return false;
            CitizenInfo info = instance.Info;
            if ((UnityEngine.Object)info == (UnityEngine.Object)null)
                return false;
            uint num = Singleton<SimulationManager>.instance.m_referenceFrameIndex - ((uint)instanceID << 4) / 65536U;
            CitizenInstance.Frame frameData1 = instance.GetFrameData(num - 32U);
            float maxDistance = Mathf.Min(RenderManager.LevelOfDetailFactor * 800f, info.m_maxRenderDistance + cameraInfo.m_height * 0.5f);
            if (!cameraInfo.CheckRenderDistance(frameData1.m_position, maxDistance) || !cameraInfo.Intersect(frameData1.m_position, 10f))
                return false;

            CitizenInstance.Frame frameData2 = instance.GetFrameData(num - 16U);
            float t = (float)(((double)(num & 15U) + (double)Singleton<SimulationManager>.instance.m_referenceTimer) * (1.0 / 16.0));
            bool flag1 = frameData2.m_underground && frameData1.m_underground;
            bool flag2 = frameData2.m_insideBuilding && frameData1.m_insideBuilding;
            bool flag3 = frameData2.m_transition || frameData1.m_transition;
            if (flag2 && !flag3 || flag1 && !flag3 && (cameraInfo.m_layerMask & 1 << Singleton<CitizenManager>.instance.m_undergroundLayer) == 0)
                return false;
            //begin mod
            info = GetUpdatedInfo(instance, instanceID);
            //end mod
            Vector3 vector3 = new Bezier3()
            {
                a = frameData1.m_position,
                b = (frameData1.m_position + frameData1.m_velocity * 0.333f),
                c = (frameData2.m_position - frameData2.m_velocity * 0.333f),
                d = frameData2.m_position
            }.Position(t);
            Quaternion quaternion = Quaternion.Lerp(frameData1.m_rotation, frameData2.m_rotation, t);
            Color color = info.m_citizenAI.GetColor(instanceID, ref instance, Singleton<InfoManager>.instance.CurrentMode);
            if (cameraInfo.CheckRenderDistance(vector3, info.m_lodRenderDistance))
            {
                InstanceID id = InstanceID.Empty;
                id.CitizenInstance = instanceID;
                CitizenInfo citizenInfo = info.ObtainPrefabInstance<CitizenInfo>(id, (int)byte.MaxValue);
                if ((UnityEngine.Object)citizenInfo != (UnityEngine.Object)null)
                {
                    Vector3 velocity = Vector3.Lerp(frameData1.m_velocity, frameData2.m_velocity, t);
                    //begin mod
                    if (info.m_subCulture == Citizen.SubCulture.Generic)
                    {
                        citizenInfo.m_citizenAI.SetRenderParameters(cameraInfo, instanceID, ref instance, vector3,
                            quaternion, velocity, color,
                            (flag1 || flag3) &&
                            (cameraInfo.m_layerMask & 1 << Singleton<CitizenManager>.instance.m_undergroundLayer) != 0);
                    }
                    else
                    {
                        citizenInfo.SetRenderParameters(vector3, quaternion, velocity, color, 5,
                            (flag1 || flag3) &&
                            (cameraInfo.m_layerMask & 1 << Singleton<CitizenManager>.instance.m_undergroundLayer) != 0);
                    }
                    //end mod
                    return true;
                }
            }
            if (flag1 || flag3)
            {
                info.m_undergroundLodLocations[info.m_undergroundLodCount].SetTRS(vector3, quaternion, Vector3.one);
                info.m_undergroundLodColors[info.m_undergroundLodCount] = color;
                info.m_undergroundLodMin = Vector3.Min(info.m_undergroundLodMin, vector3);
                info.m_undergroundLodMax = Vector3.Max(info.m_undergroundLodMax, vector3);
                if (++info.m_undergroundLodCount == info.m_undergroundLodLocations.Length)
                    CitizenInstance.RenderUndergroundLod(cameraInfo, info);
            }
            if (!flag1 || flag3)
            {
                info.m_lodLocations[info.m_lodCount].SetTRS(vector3, quaternion, Vector3.one);
                info.m_lodColors[info.m_lodCount] = color;
                info.m_lodMin = Vector3.Min(info.m_lodMin, vector3);
                info.m_lodMax = Vector3.Max(info.m_lodMax, vector3);
                if (++info.m_lodCount == info.m_lodLocations.Length)
                    CitizenInstance.RenderLod(cameraInfo, info);
            }
            return true;
        }
开发者ID:earalov,项目名称:Skylines-MoreDiverseCrowd,代码行数:78,代码来源:CitizenInstanceDetour.cs

示例4: BuildingRenderInstance

 private void BuildingRenderInstance(Building building, RenderManager.CameraInfo cameraInfo, ushort buildingID, int layerMask)
 {
     if (building.m_flags == Building.Flags.None)
     {
         return;
     }
     BuildingInfo info = building.Info;
     if ((layerMask & 1 << info.m_prefabDataLayer) == 0)
     {
         return;
     }
     Vector3 position = building.m_position;
     float radius = info.m_renderSize + (float)building.m_baseHeight * 0.5f;
     position.y += (info.m_size.y - (float)building.m_baseHeight) * 0.5f;
     if (!cameraInfo.Intersect(position, radius))
     {
         return;
     }
     RenderManager instance = Singleton<RenderManager>.instance;
     uint num;
     if (instance.RequireInstance((uint)buildingID, 1u, out num))
     {
         BuildingRenderInstance(building, cameraInfo, buildingID, layerMask, info, ref instance.m_instances[(int)((UIntPtr)num)]);
     }
 }
开发者ID:abdulrahmanwaly,项目名称:Skylines-Daybreak,代码行数:25,代码来源:BuildingGlowRenderer.cs


注:本文中的RenderManager.Intersect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。