예제 #1
0
 public Material(Texture2D color, Texture2D light)
 {
     RenderingType = RenderingType.Baked;
     baked         = true;
     textured      = false;
     colorTex      = color;
     lightTex      = light;
 }
예제 #2
0
        /// <summary>
        /// Load GPU kernels for planet rendering
        /// </summary>
        private void LoadKernels()
        {
            try
            {
                bool useSoftware = (_renderingType == RenderingType.OpenCLSoftware);

                _gpuClear = new GpuClear();

                _clProxy = new OpenCLProxy(useSoftware);

                if (Directory.Exists("Kernels"))
                {
                    KernelManager.GenerateKernels("Kernels");
                }
                else
                {
                    KernelManager.GenerateKernels("../../Kernels");
                }

                _clProxy.CreateIntArgument("resX", RenderUtils.ScreenWidth);
                _clProxy.CreateIntArgument("resY", RenderUtils.ScreenHeight);

                _clProxy.CreateDoubleArgument("cameraLeft", 0);
                _clProxy.CreateDoubleArgument("cameraTop", 0);

                _clProxy.CreateDoubleArgument("cameraWidth", 0);
                _clProxy.CreateDoubleArgument("cameraHeight", 0);

                _clProxy.CreateDoubleArgument("sunNormalX", 0);
                _clProxy.CreateDoubleArgument("sunNormalY", 0);

                _clProxy.CreateDoubleArgument("rotation", 0);

                _clProxy.CreateIntBuffer("image", new int[RenderUtils.ScreenArea], ComputeMemoryFlags.UseHostPointer);

                _gpuClear.Load(_clProxy);

                foreach (IGpuRenderable renderable in _massiveBodies)
                {
                    renderable.Load(_clProxy);
                }
            }
            catch (Exception)
            {
                _renderingType = RenderingType.GDIPlus;
            }
        }
예제 #3
0
        /// <summary>
        /// Load GPU kernels for planet rendering
        /// </summary>
        private void LoadKernels()
        {
            try
            {
                bool useSoftware = _renderingType == RenderingType.OpenCLSoftware;

                _gpuClear = new GpuClear();

                _clProxy = new OpenCLProxy(useSoftware);

                KernelManager.GenerateKernels(Directory.Exists("Kernels") ? "Kernels" : "../../Kernels");

                _clProxy.CreateIntArgument("resX", RenderUtils.ScreenWidth);
                _clProxy.CreateIntArgument("resY", RenderUtils.ScreenHeight);

                _clProxy.CreateDoubleArgument("cX", 0);
                _clProxy.CreateDoubleArgument("cY", 0);

                _clProxy.CreateDoubleArgument("cWidth", 0);
                _clProxy.CreateDoubleArgument("cHeight", 0);

                _clProxy.CreateDoubleArgument("cRot", 0);

                _clProxy.CreateDoubleArgument("sunNormalX", 0);
                _clProxy.CreateDoubleArgument("sunNormalY", 0);

                _clProxy.CreateDoubleArgument("bodyX", 0);
                _clProxy.CreateDoubleArgument("bodyY", 0);
                _clProxy.CreateDoubleArgument("bodyRot", 0);

                _clProxy.CreateIntBuffer("image", new int[RenderUtils.ScreenArea], ComputeMemoryFlags.UseHostPointer);

                _gpuClear.Load(_clProxy);

                foreach (IGpuRenderable renderable in _massiveBodies)
                {
                    renderable.Load(_clProxy);
                }
            }
            catch (Exception)
            {
                _renderingType = RenderingType.GDIPlus;
            }

            UpdateLoadingPercentage(100);
        }
예제 #4
0
        internal static string ToSerializedValue(this RenderingType value)
        {
            switch (value)
            {
            case RenderingType.NoGraph:
                return("NoGraph");

            case RenderingType.Table:
                return("Table");

            case RenderingType.TimeSeries:
                return("TimeSeries");

            case RenderingType.TimeSeriesPerInstance:
                return("TimeSeriesPerInstance");
            }
            return(null);
        }
예제 #5
0
 internal static void EndAllDrawing(RenderingType exclusion = RenderingType.None)
 {
     if (exclusion != RenderingType.Sprite)
     {
         if (Sprite.IsDrawing)
         {
             Sprite.Handle.End();
             Sprite.IsDrawing = false;
         }
     }
     if (exclusion != RenderingType.Line)
     {
         if (Line.IsDrawing)
         {
             Line.Handle.End();
             Line.IsDrawing = false;
         }
     }
 }
예제 #6
0
        public Material(Texture2D color, bool isTransparent = false, bool isAlphaAnimated = false)
        {
            if (isAlphaAnimated)
            {
                RenderingType = RenderingType.TextureAlphaAnimated;
            }
            else if (isTransparent)
            {
                RenderingType = RenderingType.TextureTransparent;
            }
            else
            {
                RenderingType = RenderingType.Texture;
            }

            baked           = false;
            textured        = true;
            colorTex        = color;
            IsTransparent   = isTransparent;
            IsAlphaAnimated = isAlphaAnimated;
        }
예제 #7
0
 /// <summary>
 /// Converts the <see cref="sourceValue" /> parameter to the <see cref="destinationType" /> parameter using <see cref="formatProvider"
 /// /> and <see cref="ignoreCase" />
 /// </summary>
 /// <param name="sourceValue">the <see cref="System.Object"/> to convert from</param>
 /// <param name="destinationType">the <see cref="System.Type" /> to convert to</param>
 /// <param name="formatProvider">not used by this TypeConverter.</param>
 /// <param name="ignoreCase">when set to <c>true</c>, will ignore the case when converting.</param>
 /// <returns>
 /// an instance of <see cref="RenderingType" />, or <c>null</c> if there is no suitable conversion.
 /// </returns>
 public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => RenderingType.CreateFrom(sourceValue);
 public Rendering(RenderingType type)
 {
     Type = type;
 }
예제 #9
0
 public LiteralKey(object value, RenderingType type)
 {
     this._value = value;
     this._type  = type;
 }
예제 #10
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Id.Length != 0)
            {
                hash ^= Id.GetHashCode();
            }
            if (LastModifiedTimestampMs != 0L)
            {
                hash ^= LastModifiedTimestampMs.GetHashCode();
            }
            if (Latitude != 0D)
            {
                hash ^= Latitude.GetHashCode();
            }
            if (Longitude != 0D)
            {
                hash ^= Longitude.GetHashCode();
            }
            if (OwnedByTeam != 0)
            {
                hash ^= OwnedByTeam.GetHashCode();
            }
            if (GuardPokemonId != 0)
            {
                hash ^= GuardPokemonId.GetHashCode();
            }
            if (GuardPokemonCp != 0)
            {
                hash ^= GuardPokemonCp.GetHashCode();
            }
            if (Enabled != false)
            {
                hash ^= Enabled.GetHashCode();
            }
            if (Type != 0)
            {
                hash ^= Type.GetHashCode();
            }
            if (GymPoints != 0L)
            {
                hash ^= GymPoints.GetHashCode();
            }
            if (IsInBattle != false)
            {
                hash ^= IsInBattle.GetHashCode();
            }
            hash ^= activeFortModifier_.GetHashCode();
            if (lureInfo_ != null)
            {
                hash ^= LureInfo.GetHashCode();
            }
            if (CooldownCompleteTimestampMs != 0L)
            {
                hash ^= CooldownCompleteTimestampMs.GetHashCode();
            }
            if (Sponsor != 0)
            {
                hash ^= Sponsor.GetHashCode();
            }
            if (RenderingType != 0)
            {
                hash ^= RenderingType.GetHashCode();
            }
            if (DeployLockoutEndMs != 0L)
            {
                hash ^= DeployLockoutEndMs.GetHashCode();
            }
            if (guardPokemonDisplay_ != null)
            {
                hash ^= GuardPokemonDisplay.GetHashCode();
            }
            if (Closed != false)
            {
                hash ^= Closed.GetHashCode();
            }
            if (raidInfo_ != null)
            {
                hash ^= RaidInfo.GetHashCode();
            }
            if (gymDisplay_ != null)
            {
                hash ^= GymDisplay.GetHashCode();
            }
            if (Visited != false)
            {
                hash ^= Visited.GetHashCode();
            }
            if (SameTeamDeployLockoutEndMs != 0L)
            {
                hash ^= SameTeamDeployLockoutEndMs.GetHashCode();
            }
            if (AllowCheckin != false)
            {
                hash ^= AllowCheckin.GetHashCode();
            }
            if (ImageUrl.Length != 0)
            {
                hash ^= ImageUrl.GetHashCode();
            }
            if (InEvent != false)
            {
                hash ^= InEvent.GetHashCode();
            }
            if (BannerUrl.Length != 0)
            {
                hash ^= BannerUrl.GetHashCode();
            }
            return(hash);
        }
예제 #11
0
        private void RenderTriangles(ref Paint paint,
                                     ref Scissor scissor,
                                     float width, float fringe, float strokeThr,
                                     RenderingType renderingType,
                                     ArraySegment <Vertex> verts,
                                     PrimitiveType primitiveType,
                                     bool indexed)
        {
            if (verts.Count <= 0 ||
                indexed && _indexesCount <= 0)
            {
                return;
            }

            var innerColor = premultiplyColor(paint.InnerColor);
            var outerColor = premultiplyColor(paint.OuterColor);

            _strokeMult = (width * 0.5f + fringe * 0.5f) / fringe;

            if (scissor.Extent.X < -0.5f || scissor.Extent.Y < -0.5f)
            {
                _scissorTransform.Zero();

                _scissorExt.X   = 1.0f;
                _scissorExt.Y   = 1.0f;
                _scissorScale.X = 1.0f;
                _scissorScale.Y = 1.0f;
            }
            else
            {
                _scissorTransform = scissor.Transform.BuildInverse();
                _scissorExt.X     = scissor.Extent.X;
                _scissorExt.Y     = scissor.Extent.Y;
                _scissorScale.X   =
                    (float)Math.Sqrt(scissor.Transform.T1 * scissor.Transform.T1 +
                                     scissor.Transform.T3 * scissor.Transform.T3) / fringe;
                _scissorScale.Y =
                    (float)Math.Sqrt(scissor.Transform.T2 * scissor.Transform.T2 +
                                     scissor.Transform.T4 * scissor.Transform.T4) / fringe;
            }

            var transform = paint.Transform.BuildInverse();

            var transformMatrix = transform.ToMatrix();

            _viewSizeParam.SetValue(new Vector2(_device.PresentationParameters.Bounds.Width,
                                                _device.PresentationParameters.Bounds.Height));
            _scissorMatParam.SetValue(_scissorTransform.ToMatrix());
            _scissorExtParam.SetValue(_scissorExt);
            _scissorScaleParam.SetValue(_scissorScale);
            _paintMatParam.SetValue(transformMatrix);
            _extentParam.SetValue(new Vector4(paint.Extent.X, paint.Extent.Y, 0.0f, 0.0f));
            _radiusParam.SetValue(new Vector4(paint.Radius, 0.0f, 0.0f, 0.0f));
            _featherParam.SetValue(new Vector4(paint.Feather, 0.0f, 0.0f, 0.0f));
            _innerColParam.SetValue(innerColor.ToVector4());
            _outerColParam.SetValue(outerColor.ToVector4());
            // _effect.Parameters["strokeMult"].SetValue(new Vector4(_strokeMult, 0.0f, 0.0f, 0.0f));

            if (paint.Image > 0)
            {
                var texture = GetTextureById(paint.Image);
                _textureParam.SetValue(texture);
            }

            var technique = _techniques[(int)renderingType];

            _effect.CurrentTechnique = technique;
            foreach (var pass in _effect.CurrentTechnique.Passes)
            {
                pass.Apply();

                if (indexed)
                {
                    _device.DrawUserIndexedPrimitives(primitiveType, verts.Array, verts.Offset, verts.Count,
                                                      _indexes, 0, _indexesCount / 3);
                }
                else
                {
                    var primitiveCount =
                        primitiveType == PrimitiveType.TriangleList ? verts.Count / 3 : verts.Count - 2;
                    _device.DrawUserPrimitives(primitiveType, verts.Array, verts.Offset, primitiveCount);
                }
            }

            _vertexes.Clear();
        }
예제 #12
0
 public void GivenRenderingTo(string Type)
 {
     Rendering = ParseEnum <RenderingType>(Type);
 }
예제 #13
0
        public void Awake()
        {
            //mpb = new MaterialPropertyBlock();
            Vector3[] vertexes;

            Renderer       singleRenderer = GetComponent <Renderer> ();
            SpriteRenderer spriteRenderer = singleRenderer as SpriteRenderer;
            MeshRenderer   meshRenderer   = singleRenderer as MeshRenderer;

            if (singleRenderer == null || (spriteRenderer == null && meshRenderer == null))
            {
                Debug.LogError("Danmaku Prefab (" + name + ") has neither SpriteRenderer or MeshRenderer. Attach one or the other to it.");
                Destroy(this);
                return;
            }

            singleRenderer.enabled = false;

            foreach (Component otherComponent in GetComponentsInChildren <Component>())
            {
                if (otherComponent != this && !(otherComponent is Transform))
                {
                    Destroy(otherComponent);
                }
            }

            foreach (Transform child in transform)
            {
                Destroy(child.gameObject);
            }

            cachedScale = transform.localScale;
            cachedTag   = gameObject.tag;
            cachedLayer = gameObject.layer;

            if (danmakuSystemPrefab != null)
            {
                runtimeSystem = Instantiate(danmakuSystemPrefab);
            }
            if (runtimeSystem == null)
            {
                GameObject runtimeObject = Instantiate(Resources.Load("Danmaku Particle System")) as GameObject;
                if (runtimeObject == null)
                {
                    runtimeObject = new GameObject(name);
                }
                if (runtimeSystem == null)
                {
                    runtimeSystem = runtimeObject.GetComponent <ParticleSystem>();
                }
                if (runtimeSystem == null)
                {
                    runtimeSystem = runtimeObject.AddComponent <ParticleSystem> ();
                }
            }

            Transform runtimeTransform = runtimeSystem.transform;

            //runtimeTransform.parent = null;
            runtimeTransform.localPosition = Vector3.zero;

            runtimeRenderer = runtimeSystem.GetComponent <ParticleSystemRenderer> ();

            renderMesh = new Mesh();

            if (meshRenderer == null)
            {
                renderingType      = RenderingType.Sprite;
                singleRenderer     = spriteRenderer;
                cachedSprite       = spriteRenderer.sprite;
                cachedColor        = spriteRenderer.color;
                cachedMaterial     = spriteRenderer.sharedMaterial;
                cachedSortingLayer = spriteRenderer.sortingLayerID;
                cachedSortingOrder = spriteRenderer.sortingOrder;

                //renderMaterial = cachedMaterial;

                renderMaterial             = new Material(cachedMaterial);
                renderMaterial.mainTexture = Sprite.texture;

                if (cachedSprite == null)
                {
                    runtimeRenderer.mesh = null;
                }
                else
                {
                    var verts = cachedSprite.vertices;
                    var tris  = cachedSprite.triangles;

                    vertexes = new Vector3[verts.Length];
                    int[] triangles = new int[tris.Length];

                    for (int i = 0; i < verts.Length; i++)
                    {
                        vertexes [i] = (Vector3)verts [i];
                    }

                    for (int i = 0; i < tris.Length; i++)
                    {
                        triangles [i] = (int)tris [i];
                    }

                    renderMesh.vertices  = vertexes;
                    renderMesh.uv        = cachedSprite.uv;
                    renderMesh.triangles = triangles;
                }
            }
            else
            {
                renderingType      = RenderingType.Mesh;
                singleRenderer     = meshRenderer;
                cachedSprite       = null;
                cachedColor        = Color.white;
                cachedMaterial     = meshRenderer.sharedMaterial;
                cachedSortingLayer = meshRenderer.sortingLayerID;
                cachedSortingOrder = meshRenderer.sortingOrder;

                renderMaterial = meshRenderer.sharedMaterial;
                MeshFilter filter = meshRenderer.GetComponent <MeshFilter>();
                if (filter == null)
                {
                    Debug.LogError("Danmaku Prefab (" + name + ") is trying to use a MeshRenderer as a base, but no MeshFilter is found. Please add one.");
                }
                else
                {
                    Mesh filterMesh = filter.mesh;
                    renderMesh.vertices  = filterMesh.vertices;
                    renderMesh.uv        = filterMesh.uv;
                    renderMesh.triangles = filterMesh.triangles;
                    renderMesh.colors    = filterMesh.colors;
                    renderMesh.normals   = filterMesh.normals;
                    renderMesh.tangents  = filterMesh.tangents;
                }
            }

            if (renderMesh != null)
            {
                Matrix4x4 transformMatrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, transform.localScale);
                vertexes = renderMesh.vertices;
                for (int i = 0; i < vertexes.Length; i++)
                {
                    vertexes[i] = transformMatrix * vertexes[i];
                }
                renderMesh.vertices = vertexes;
                renderMesh.Optimize();
            }

            runtimeRenderer.mesh = renderMesh;

            foreach (Behaviour comp in GetComponentsInChildren <Behaviour>())
            {
                if (comp != this)
                {
                    comp.enabled = false;
                }
            }

            runtimeSystem.simulationSpace = ParticleSystemSimulationSpace.World;
            runtimeSystem.startColor      = cachedColor;
            runtimeSystem.startSize       = 1;
            runtimeSystem.startLifetime   = float.PositiveInfinity;
            runtimeSystem.gravityModifier = 0f;
            runtimeSystem.startSpeed      = 0f;
            runtimeSystem.enableEmission  = false;

            currentDanmaku = new HashSet <Danmaku> ();
            particles      = new ParticleSystem.Particle[runtimeSystem.particleCount];
            for (int i = 0; i < extraControllers.Length; i++)
            {
                controllerAggregate += extraControllers[i].Update;
            }

            runtimeRenderer.mesh       = renderMesh;
            runtimeRenderer.renderMode = ParticleSystemRenderMode.Mesh;

            runtimeRenderer.sharedMaterial       = renderMaterial;
            runtimeRenderer.sortingLayerID       = cachedSortingLayer;
            runtimeRenderer.sortingOrder         = cachedSortingOrder;
            runtimeRenderer.reflectionProbeUsage = UnityEngine.Rendering.ReflectionProbeUsage.Off;
            runtimeRenderer.receiveShadows       = false;
            runtimeRenderer.shadowCastingMode    = UnityEngine.Rendering.ShadowCastingMode.Off;
            runtimeRenderer.lightProbeUsage      = UnityEngine.Rendering.LightProbeUsage.Off;

            gameObject.hideFlags = HideFlags.HideInHierarchy;
            runtimeSystem.gameObject.hideFlags = HideFlags.HideInHierarchy;
        }
예제 #14
0
        public static RenderingKey Parse(string key, RenderingType expectedType)
        {
            if (key.StartsWith("!"))
            {
                if (expectedType != RenderingType.Bool && expectedType != RenderingType.Any)
                {
                    throw new Exception("expected bool");
                }

                key = key.Substring(1);
                var body = Parse(key, expectedType);
                return(new NegationKey(body));
            }

            string operatorMatch = null;
            int    operatorIndex = -1;

            foreach (var symbol in operatorSymbols.Keys)
            {
                var index = key.IndexOf(symbol);

                if (index >= 0)
                {
                    if (operatorMatch != null && GetOperatorPriority(symbol) <= GetOperatorPriority(operatorMatch))
                    {
                        continue;
                    }

                    operatorIndex = index;
                    operatorMatch = symbol;
                }
            }

            if (operatorMatch != null)
            {
                var leftText = key.Substring(0, operatorIndex).Trim();
                var righText = key.Substring(operatorIndex + operatorMatch.Length).Trim();

                var op = operatorSymbols[operatorMatch];
                return(new CompositeRenderingKey(op, leftText, righText));
            }

            if (key.StartsWith("@"))
            {
                return(new GlobalKey(key.Substring(1)));
            }

            switch (key)
            {
            case "true":
                if (expectedType != RenderingType.Bool && expectedType != RenderingType.Any)
                {
                    throw new Exception("expected bool");
                }

                return(new LiteralKey(true, RenderingType.Bool));

            case "false":
                if (expectedType != RenderingType.Bool && expectedType != RenderingType.Any)
                {
                    throw new Exception("expected bool");
                }

                return(new LiteralKey(false, RenderingType.Bool));

            case "this":
                return(new SelfKey());
            }

            if (key.StartsWith("'") && key.EndsWith("'"))
            {
                if (expectedType != RenderingType.String && expectedType != RenderingType.Any)
                {
                    throw new Exception("unexpected string");
                }

                var str = key.Substring(1, key.Length - 2);
                return(new LiteralKey(str, RenderingType.String));
            }

            decimal number;

            if (decimal.TryParse(key, out number))
            {
                if (expectedType != RenderingType.Numeric && expectedType != RenderingType.Any)
                {
                    throw new Exception("expected number");
                }

                return(new LiteralKey(number, RenderingType.Numeric));
            }

            if (key.StartsWith("this."))
            {
                key = key.Substring(5);
                return(RenderingKey.Parse(key, expectedType));
            }

            return(new PathRenderingKey(key));
        }
예제 #15
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Id.Length != 0)
            {
                hash ^= Id.GetHashCode();
            }
            if (LastModifiedTimestampMs != 0L)
            {
                hash ^= LastModifiedTimestampMs.GetHashCode();
            }
            if (Latitude != 0D)
            {
                hash ^= Latitude.GetHashCode();
            }
            if (Longitude != 0D)
            {
                hash ^= Longitude.GetHashCode();
            }
            if (Enabled != false)
            {
                hash ^= Enabled.GetHashCode();
            }
            if (Type != 0)
            {
                hash ^= Type.GetHashCode();
            }
            if (OwnedByTeam != 0)
            {
                hash ^= OwnedByTeam.GetHashCode();
            }
            if (GuardPokemonId != 0)
            {
                hash ^= GuardPokemonId.GetHashCode();
            }
            if (GuardPokemonCp != 0)
            {
                hash ^= GuardPokemonCp.GetHashCode();
            }
            if (GymPoints != 0L)
            {
                hash ^= GymPoints.GetHashCode();
            }
            if (IsInBattle != false)
            {
                hash ^= IsInBattle.GetHashCode();
            }
            if (CooldownCompleteTimestampMs != 0L)
            {
                hash ^= CooldownCompleteTimestampMs.GetHashCode();
            }
            if (Sponsor != 0)
            {
                hash ^= Sponsor.GetHashCode();
            }
            if (RenderingType != 0)
            {
                hash ^= RenderingType.GetHashCode();
            }
            if (ActiveFortModifier.Length != 0)
            {
                hash ^= ActiveFortModifier.GetHashCode();
            }
            if (lureInfo_ != null)
            {
                hash ^= LureInfo.GetHashCode();
            }
            return(hash);
        }
 public static string ToSerialString(this RenderingType value) => value switch
 {
예제 #17
0
        internal static string ToSerializedValue(this RenderingType value)
        {
            switch (value)
            {
            case RenderingType.NoGraph:
                return("NoGraph");

            case RenderingType.Table:
                return("Table");

            case RenderingType.TimeSeries:
                return("TimeSeries");

            case RenderingType.TimeSeriesPerInstance:
                return("TimeSeriesPerInstance");

            case RenderingType.PieChart:
                return("PieChart");

            case RenderingType.DataSummary:
                return("DataSummary");

            case RenderingType.Email:
                return("Email");

            case RenderingType.Insights:
                return("Insights");

            case RenderingType.DynamicInsight:
                return("DynamicInsight");

            case RenderingType.Markdown:
                return("Markdown");

            case RenderingType.Detector:
                return("Detector");

            case RenderingType.DropDown:
                return("DropDown");

            case RenderingType.Card:
                return("Card");

            case RenderingType.Solution:
                return("Solution");

            case RenderingType.Guage:
                return("Guage");

            case RenderingType.Form:
                return("Form");

            case RenderingType.ChangeSets:
                return("ChangeSets");

            case RenderingType.ChangeAnalysisOnboarding:
                return("ChangeAnalysisOnboarding");

            case RenderingType.ChangesView:
                return("ChangesView");

            case RenderingType.AppInsight:
                return("AppInsight");

            case RenderingType.DependencyGraph:
                return("DependencyGraph");

            case RenderingType.DownTime:
                return("DownTime");

            case RenderingType.SummaryCard:
                return("SummaryCard");

            case RenderingType.SearchComponent:
                return("SearchComponent");

            case RenderingType.AppInsightEnablement:
                return("AppInsightEnablement");
            }
            return(null);
        }
예제 #18
0
        /// <summary>
        /// Load GPU kernels for planet rendering
        /// </summary>
        private void LoadKernels()
        {
            try
            {
                bool useSoftware = (_renderingType == RenderingType.OpenCLSoftware);

                _gpuClear = new GpuClear();

                _clProxy = new OpenCLProxy(useSoftware);

                if (Directory.Exists("Kernels"))
                {
                    KernelManager.GenerateKernels("Kernels");
                }
                else
                {
                    KernelManager.GenerateKernels("../../Kernels");
                }

                _clProxy.CreateIntArgument("resX", RenderUtils.ScreenWidth);
                _clProxy.CreateIntArgument("resY", RenderUtils.ScreenHeight);

                _clProxy.CreateDoubleArgument("cameraLeft", 0);
                _clProxy.CreateDoubleArgument("cameraTop", 0);

                _clProxy.CreateDoubleArgument("cameraWidth", 0);
                _clProxy.CreateDoubleArgument("cameraHeight", 0);

                _clProxy.CreateDoubleArgument("sunNormalX", 0);
                _clProxy.CreateDoubleArgument("sunNormalY", 0);

                _clProxy.CreateDoubleArgument("rotation", 0);

                _clProxy.CreateIntBuffer("image", new int[RenderUtils.ScreenArea], ComputeMemoryFlags.UseHostPointer);

                _gpuClear.Load(_clProxy);

                foreach (IGpuRenderable renderable in _massiveBodies)
                {
                    renderable.Load(_clProxy);
                }
            }
            catch (Exception)
            {
                _renderingType = RenderingType.GDIPlus;
            }
        }
 /// <summary>
 /// Constructs a new instance of this attribute
 /// </summary>
 /// <param name="type">The HTML5 type to use when rendering the field</param>
 public HtmlRenderAttribute(RenderingType type)
 {
     this.Type = type;
 }