static public GLMeshWirePlugin Get(Mesh mesh, double nonPlanarAngleRequired = 0, Action meshChanged = null)
        {
            object meshData;

            mesh.PropertyBag.TryGetValue(GLMeshWirePluginName, out meshData);
            if (meshData is GLMeshWirePlugin plugin)
            {
                if (mesh.ChangedCount == plugin.meshUpdateCount &&
                    nonPlanarAngleRequired == plugin.nonPlanarAngleRequired)
                {
                    return(plugin);
                }

                // else we need to rebuild the data
                plugin.meshUpdateCount = mesh.ChangedCount;
                mesh.PropertyBag.Remove(GLMeshWirePluginName);
            }

            GLMeshWirePlugin newPlugin = new GLMeshWirePlugin();

            newPlugin.CreateRenderData(mesh, nonPlanarAngleRequired, meshChanged);
            newPlugin.meshUpdateCount = mesh.ChangedCount;
            mesh.PropertyBag.Add(GLMeshWirePluginName, newPlugin);

            return(newPlugin);
        }
示例#2
0
        static public GLMeshWirePlugin Get(Mesh meshToGetDisplayListFor, double nonPlanarAngleRequired = 0)
        {
            GLMeshWirePlugin plugin;

            meshesWithCacheData.TryGetValue(meshToGetDisplayListFor, out plugin);

            if (plugin != null &&
                (meshToGetDisplayListFor.ChangedCount != plugin.meshUpdateCount ||
                 nonPlanarAngleRequired != plugin.nonPlanarAngleRequired))
            {
                plugin.meshUpdateCount = meshToGetDisplayListFor.ChangedCount;
                plugin.AddRemoveData();
                plugin.CreateRenderData(meshToGetDisplayListFor, nonPlanarAngleRequired);
                plugin.meshUpdateCount        = meshToGetDisplayListFor.ChangedCount;
                plugin.nonPlanarAngleRequired = nonPlanarAngleRequired;
            }

            if (plugin == null)
            {
                GLMeshWirePlugin newPlugin = new GLMeshWirePlugin();
                meshesWithCacheData.Add(meshToGetDisplayListFor, newPlugin);
                newPlugin.CreateRenderData(meshToGetDisplayListFor, nonPlanarAngleRequired);
                newPlugin.meshUpdateCount        = meshToGetDisplayListFor.ChangedCount;
                newPlugin.nonPlanarAngleRequired = nonPlanarAngleRequired;

                return(newPlugin);
            }

            return(plugin);
        }
示例#3
0
		static public GLMeshWirePlugin Get(Mesh meshToGetDisplayListFor, double nonPlanarAngleRequired = 0)
		{
			GLMeshWirePlugin plugin;
			meshesWithCacheData.TryGetValue(meshToGetDisplayListFor, out plugin);

			if (plugin != null
				&& (meshToGetDisplayListFor.ChangedCount != plugin.meshUpdateCount
				|| nonPlanarAngleRequired != plugin.nonPlanarAngleRequired))
			{
				plugin.meshUpdateCount = meshToGetDisplayListFor.ChangedCount;
				plugin.AddRemoveData();
				plugin.CreateRenderData(meshToGetDisplayListFor, nonPlanarAngleRequired);
				plugin.meshUpdateCount = meshToGetDisplayListFor.ChangedCount;
				plugin.nonPlanarAngleRequired = nonPlanarAngleRequired;
			}

			if (plugin == null)
			{
				GLMeshWirePlugin newPlugin = new GLMeshWirePlugin();
				meshesWithCacheData.Add(meshToGetDisplayListFor, newPlugin);
				newPlugin.CreateRenderData(meshToGetDisplayListFor, nonPlanarAngleRequired);
				newPlugin.meshUpdateCount = meshToGetDisplayListFor.ChangedCount;
				newPlugin.nonPlanarAngleRequired = nonPlanarAngleRequired;

				return newPlugin;
			}

			return plugin;
		}