• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ShaderProgram类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ShaderProgram的典型用法代码示例。如果您正苦于以下问题:C# ShaderProgram类的具体用法?C# ShaderProgram怎么用?C# ShaderProgram使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ShaderProgram类属于命名空间,在下文中一共展示了ShaderProgram类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: init

        public static void init()
        {
            if (shaderUniversal == null){
                shaderUniversal = new ShaderProgram("/Application/shaders/Universal.cgx");

                shaderUniversal.SetAttributeBinding(0, "a_Position");
                shaderUniversal.SetAttributeBinding(1, "a_VertexColor");
                shaderUniversal.SetAttributeBinding(2, "a_TexCoord");

                shaderUniversal.SetUniformBinding(0, "u_SceneMatrix");
                shaderUniversal.SetUniformBinding(1, "u_ScreenMatrix");
                shaderUniversal.SetUniformBinding(2, "u_Alpha");

                texture = new Texture2D("/Application/assets/texturepack/rymdkapsel-hd.png", false);
                texture.SetFilter(TextureFilterMode.Disabled);
                texture.SetWrap(TextureWrapMode.ClampToEdge);
                texture.SetMaxAnisotropy(0);
            }

            if (shaderColored == null){
                shaderColored = new ShaderProgram("/Application/shaders/Colored.cgx");

                shaderColored.SetAttributeBinding(0, "a_Position");
                shaderColored.SetAttributeBinding(1, "a_VertexColor");

                shaderColored.SetUniformBinding(0, "u_SceneMatrix");
                shaderColored.SetUniformBinding(1, "u_ScreenMatrix");
                shaderColored.SetUniformBinding(2, "u_Alpha");
            }
        }
开发者ID:JimmyDeemo,项目名称:openfl-psm,代码行数:30,代码来源:RendererUniversal.cs


示例2: SetUniform

 /// <summary>
 /// Set uniform's value to GPU.(And maybe alsoe reset <see cref="Updated"/> property.)
 /// </summary>
 /// <param name="program"></param>
 public void SetUniform(ShaderProgram program)
 {
     if (this.Updated)
     {
         this.DoSetUniform(program);
     }
 }
开发者ID:bitzhuwei,项目名称:CSharpGL,代码行数:11,代码来源:UniformVariable.cs


示例3: Sprite

        public Sprite(GraphicsContext graphics, Texture2D texture)
        {
            if(shaderProgram == null)
            {
                shaderProgram = new ShaderProgram("/Application/shaders/Sprite.cgx");
                shaderProgram.SetUniformBinding(0, "u_WorldMatrix");
            }

            if (texture == null)
            {
                throw new Exception("ERROR: texture is null.");
            }

            this.graphics = graphics;
            this.texture = texture;
            this.width = texture.Width;
            this.height = texture.Height;

            indices = new ushort[indexSize];
            indices[0] = 0;
            indices[1] = 1;
            indices[2] = 2;
            indices[3] = 3;

            vertexBuffer = new VertexBuffer(4, indexSize, VertexFormat.Float3,
                                            VertexFormat.Float2, VertexFormat.Float4);
        }
开发者ID:andierocca,项目名称:destructive-santa,代码行数:27,代码来源:Sprite.cs


示例4: Viewport

        public Viewport(Resolution resolution, Vector2? position = null, Camera camera = null)
        {
            this.Resolution = resolution;
            this.Position = position ?? Vector2.Zero;

            var pos = new Vector3[] {
                new Vector3 (this.Resolution.Width, 0, 0),
                new Vector3 (this.Resolution.Width, this.Resolution.Height, 0),
                new Vector3 (0, this.Resolution.Height, 0),
                new Vector3 (0, 0, 0),
            };

            var tex = new Vector2[] {
                new Vector2 (1.0f, 0.0f),
                new Vector2 (1.0f, 1.0f),
                new Vector2 (0.0f, 1.0f),
                new Vector2 (0.0f, 0.0f),
            };

            ViewportShader = Game.ContentManager.Load<ShaderProgram> ("viewport");

            this.ViewportTarget = new Model (new Geometry (BeginMode.Quads)
                                                    .AddBuffer ("v_pos", new GLBuffer<Vector3> (GLBufferSettings.StaticDraw3FloatArray, pos))
                                                    .AddBuffer ("v_tex", new GLBuffer<Vector2> (GLBufferSettings.StaticDraw2FloatArray, tex)));

            Matrix = Matrix4.CreateOrthographicOffCenter (0, this.Resolution.Width, 0, this.Resolution.Height, 0, 16);
        }
开发者ID:splitandthechro,项目名称:nginz,代码行数:27,代码来源:Viewport.cs


示例5: Planet

        public Planet(string dataBaseName, PlanetParameters param, Planet parent, MeshVBOs vbos, Texture t, ShaderProgram shader, ShaderProgram lineShader)
            : base(vbos, t, shader)
        {
            this.parent = parent;
            this.lineShader = lineShader;
            this.RevolutionOrientation = -1;
            this.AxisTilt = Matrix4.Identity;
            this.DrawAxisTilt = true;

            this.ScenicDistance = param.DFSScenic[dataBaseName];
            this.HoursPerRotation = param.RotationPeriod[dataBaseName];
            this.AxisTilt = Matrix4.CreateFromAxisAngle(new Vector3(0, 0, -1), (float)MathHelper.DegreesToRadians(param.AxialTilt[dataBaseName]));
            this.RealisticRadius = param.RadiusRealistic[dataBaseName];
            this.ScenicRadius = param.RadiusScenic[dataBaseName];
            this.Scale = (float)ScenicRadius;
            this.OrbitalPeriod = param.OrbitalPeriod[dataBaseName];
            this.inclinationAngle = param.InclinationAngle[dataBaseName];
            this.longitudeAscendingNode = param.LongitudeAscendingNode[dataBaseName];
            this.longitudePerihelion = param.LongitudePerihelion[dataBaseName];
            this.eccentricity = param.Eccentricity[dataBaseName];
            this.longitudeAscendingNodeRadians = MathHelper.DegreesToRadians(longitudeAscendingNode);
            this.longitudePerihelionRadians = MathHelper.DegreesToRadians(longitudePerihelion);
            this.inclinationAngleRadians = MathHelper.DegreesToRadians(inclinationAngle);
            this.newRadius = 0;
            this.PeriodAngle = longitudePerihelionRadians;
            this.eccentricAnomaly = 0;
            this.createTransform();
            if (parent != null)
                this.Orbit = new Orbit(this, parent.Position, this.ScenicDistance, 360, lineShader, this.inclinationAngle, this.longitudeAscendingNode, this.longitudePerihelion, this.eccentricity);
            float[] axisVerts = { 0, -2, 0, 0, 2, 0 };
            this.axisLine = new VBO<float>(axisVerts, BufferTarget.ArrayBuffer, VBO<float>.PointerType.vertex);
        }
开发者ID:Raptor2277,项目名称:Solar_System,代码行数:32,代码来源:Planet.cs


示例6: TextureRenderer

        /// コンストラクタ
        public TextureRenderer()
        {
            shaderTexture = new ShaderProgram( "/Application/shaders/Texture.cgx" );
            shaderTexture.SetAttributeBinding( 0, "a_Position" );
            shaderTexture.SetAttributeBinding( 1, "a_TexCoord" );
            idWVP = shaderTexture.FindUniform( "WorldViewProj" );
            shaderCurrent = shaderTexture;

            vertices = new VertexBuffer( 4, VertexFormat.Float3, VertexFormat.Float2 );

            float[] positions = {
            0.0f, 0.0f, 0.0f,
            0.0f, -1.0f, 0.0f,
            1.0f, 0.0f, 0.0f,
            1.0f, -1.0f, 0.0f,
            };
            float[] texcoords = {
            0.0f, 1.0f,
            0.0f, 0.0f,
            1.0f, 1.0f,
            1.0f, 0.0f,
            };

            vertices.SetVertices( 0, positions );
            vertices.SetVertices( 1, texcoords );
        }
开发者ID:hatano0x06,项目名称:Coroppoxus,代码行数:27,代码来源:TextureRenderer.cs


示例7: SetConstantBuffers

        internal void SetConstantBuffers(GraphicsDevice device, ShaderProgram shaderProgram)
#endif
        {
            // If there are no constant buffers then skip it.
            if (_valid == 0)
                return;

            var valid = _valid;

            for (var i = 0; i < _buffers.Length; i++)
            {
                var buffer = _buffers[i];
                if (buffer != null && !buffer.IsDisposed)
                {
#if DIRECTX
                    buffer.PlatformApply(device, _stage, i);
#elif OPENGL || WEB
                    buffer.PlatformApply(device, shaderProgram);
#endif
                }

                // Early out if this is the last one.
                valid &= ~(1 << i);
                if (valid == 0)
                    return;
            }
        }
开发者ID:procfxgen,项目名称:MGShaderEditor,代码行数:27,代码来源:ConstantBufferCollection.cs


示例8: PatternGrid

        public PatternGrid(GraphicsContext graphics, Texture2D texture, Vector2 position, Vector2 size)
        {
            if(shaderProgram == null)
            {
                //shaderProgram=CreateSimpleSpriteShader();
                shaderProgram = new ShaderProgram("/Application/shaders/Sprite.cgx");
                shaderProgram.SetUniformBinding(0, "u_WorldMatrix");
            }

            //if (texture == null)
            //{
            //	throw new Exception("ERROR: texture is null.");
            //}

            this.graphics = graphics;
            //this.texture = texture;
            this.texture = new Texture2D("/Application/resources/textures512.png", false);
            this.width = size.X;
            this.height = size.Y;
            this.origin = position;

            //@e                                                Vertex coordinate,               Texture coordinate,     Vertex color
            //vertexBuffer = new VertexBuffer(4, indexSize, VertexFormat.Float3, VertexFormat.Float2, VertexFormat.Float4);
            vertexBuffer = new VertexBuffer(NUMVERTICES, VertexFormat.Float3, VertexFormat.Float2, VertexFormat.Float4);
        }
开发者ID:james7780,项目名称:PXDrumVita,代码行数:25,代码来源:PatternGrid.cs


示例9: Grid

        public Grid(Renderer renderer, ShaderProgram shader)
        {
            // Render state for grid
            RenderState = renderer.RenderFactory.CreateRenderState();
            RenderState.DepthTest = true;
            RenderState.DepthMask = true;
            this.Shader = shader;
            // Define the format of the control point to render the line
            VertexDeclaration vd = new VertexDeclaration();
            vd.AddField(VertexFieldDataType.FVector3, VertexFieldSemantic.Position);
            // and create a vertex buffer for storing this kind of data
            this.VertexBuffer = renderer.RenderFactory.CreateVertexBuffer(vd);
            // Draw the primitive as lines
            this.DrawOperation = DrawOperation.Lines;
            this.RenderGroup = RenderQueueGroupId.Geometries;

            List<FVector3> lines = new List<FVector3>();
            for (int i = -10; i <= 10; i++)
            {
                // Draw - line
                lines.Add(new FVector3(i, 0, -10));
                lines.Add(new FVector3(i,0, 10));


                // Draw | line
                lines.Add(new FVector3(-10, 0, i));
                lines.Add(new FVector3(10, 0, i));
            }
            // Put it to vertex buffer
            VertexBuffer.LoadData(lines.ToArray());
        }
开发者ID:aspose-3d,项目名称:Aspose.3D-for-.NET,代码行数:31,代码来源:Grid.cs


示例10: Initialise

        /// <summary>
        /// Initialises the scene.
        /// </summary>
        /// <param name="gl">The OpenGL instance.</param>
        /// <param name="width">The width of the screen.</param>
        /// <param name="height">The height of the screen.</param>
        public void Initialise(OpenGL gl, float width, float height)
        {
            //  Set a blue clear colour.
            gl.ClearColor(0.4f, 0.6f, 0.9f, 0.0f);

            //  Create the shader program.
            var vertexShaderSource = ManifestResourceLoader.LoadTextFile("Shader.vert");
            var fragmentShaderSource = ManifestResourceLoader.LoadTextFile("Shader.frag");
            shaderProgram = new ShaderProgram();
            shaderProgram.Create(gl, vertexShaderSource, fragmentShaderSource, null);
            shaderProgram.BindAttributeLocation(gl, attributeIndexPosition, "in_Position");
            shaderProgram.BindAttributeLocation(gl, attributeIndexColour, "in_Color");
            shaderProgram.AssertValid(gl);

            //  Create a perspective projection matrix.
            const float rads = (60.0f / 360.0f) * (float)Math.PI * 2.0f;
            projectionMatrix = glm.perspective(rads, width / height, 0.1f, 100.0f);

            //  Create a view matrix to move us back a bit.
            viewMatrix = glm.translate(new mat4(1.0f), new vec3(0.0f, 0.0f, -5.0f));

            //  Create a model matrix to make the model a little bigger.
            modelMatrix = glm.scale(new mat4(1.0f), new vec3(2.5f));

            //  Now create the geometry for the square.
            CreateVerticesForSquare(gl);
        }
开发者ID:chantsunman,项目名称:sharpgl,代码行数:33,代码来源:Scene.cs


示例11: Init

 /// シェーダのセット
 public static void Init( string vshName, string fshName )
 {
     // vertex color shader
     debShader = new ShaderProgram( vshName, fshName );
     debShader.SetAttributeBinding( 0, "a_Position" );
     debUIdWVP = debShader.FindUniform( "WorldViewProj" );
 }
开发者ID:hatano0x06,项目名称:Coroppoxus,代码行数:8,代码来源:RenderGeometry.cs


示例12: Sun

        public Sun(string dataBaseName, PlanetParameters param, Planet parent, MeshVBOs vbos, Texture t, ShaderProgram shader, ShaderProgram lineShader)
            : base(dataBaseName, param, parent, vbos, t, shader, lineShader)
        {
            bufferVerts = new VBO<float>(new float[] { -1, 1, 0, 1, 1, 0, 1, -1, 0, -1, -1, 0 }, BufferTarget.ArrayBuffer, VBO<float>.PointerType.vertex);
            bufferElems = new VBO<ushort>(new ushort[] { 0, 1, 2, 3 }, BufferTarget.ElementArrayBuffer, VBO<ushort>.PointerType.element);

            squareUvs = new VBO<float>(new float[] { 0, 1, 1, 1, 1, 0, 0, 0 }, BufferTarget.ArrayBuffer, VBO<float>.PointerType.texCoord);
            squareVerts = new VBO<float>(new float[] { -2, 2, 0, 2f, 2f, 0, 2f, -2f, 0, -2f, -2f, 0 }, BufferTarget.ArrayBuffer, VBO<float>.PointerType.vertex);
            squareElems = new VBO<ushort>(new ushort[] { 0, 1, 2, 3 }, BufferTarget.ElementArrayBuffer, VBO<ushort>.PointerType.element);

            this.coronaShader = new ShaderProgram(File.ReadAllText("content/shaders/coronaShader.vert"), File.ReadAllText("content/shaders/coronaShader.frag"), "coronaShader");
            Console.WriteLine(coronaShader.ProgramInfoLog);
            coronaShader.setUniform("proj", Form1.projectionMatrix);
            coronaShader.setUniform("model", Matrix4.Identity);

            this.billboardShader = new ShaderProgram(File.ReadAllText("content/shaders/billboardShader.vert"), File.ReadAllText("content/shaders/billboardShader.frag"), "billboardShader");
            Console.WriteLine(billboardShader.ProgramInfoLog);
            billboardShader.setUniform("proj", Form1.projectionMatrix);
            billboardShader.setUniform("model", Matrix4.Identity);

            frameBufferTime = 0;
            bufferResolution = new Vector2(1024, 1024);

            bufferTexture = GL.GenTexture();
            GL.BindTexture(TextureTarget.Texture2D, bufferTexture);
            GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, (int)bufferResolution.X, (int)bufferResolution.Y, 0, PixelFormat.Rgba, PixelType.UnsignedByte, IntPtr.Zero);
            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);
            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);

            frameBuffer = GL.GenFramebuffer();
            GL.BindFramebuffer(FramebufferTarget.Framebuffer, frameBuffer);
            GL.FramebufferTexture2D(FramebufferTarget.Framebuffer, FramebufferAttachment.ColorAttachment0, TextureTarget.Texture2D, bufferTexture, 0);
            GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0); // make sure to set the framebuffer back to the default, or else bugs,
            //bugs that take two hours to debug
        }
开发者ID:Raptor2277,项目名称:Solar_System,代码行数:35,代码来源:Sun.cs


示例13: Initialize

		public static void Initialize ()
		{
			// Set up the graphics system
			graphics = new GraphicsContext ();
#if BUILD_FOR_PSV
			program = new ShaderProgram("/Application/shaders/Texture.cgx");
#else
			program = new ShaderProgram("/Application/shaders/Texture_sim.cgx");
#endif
			program.SetUniformBinding(0, "WorldViewProj");
			program.SetAttributeBinding(0, "a_Position");
			program.SetAttributeBinding(1, "a_TexCoord");
			vertices = new VertexBuffer(4, VertexFormat.Float3, VertexFormat.Float2);

			float[] positions = {
				-1.0f, 1.0f, 0.0f,
				-1.0f, -1.0f, 0.0f,
				1.0f, 1.0f, 0.0f,
				1.0f, -1.0f, 0.0f,
			};
			float[] texcoords = {
				0.0f, 0.0f,
				0.0f, 1.0f,
				1.0f, 0.0f,
				1.0f, 1.0f,
			};
			vertices.SetVertices(0, positions);
			vertices.SetVertices(1, texcoords);
			texture = new Texture2D(256, 224, false, PixelFormat.Rgb565);
			
			SampleDraw.Init(graphics);
			
		}
开发者ID:Theswweet,项目名称:PSV-FC,代码行数:33,代码来源:AppMain.cs


示例14: Load

        public virtual void Load(int width, int height)
        {
            Width = width;
            Height = height;
            _page = new Texture();
            GUIShader = Assets.Fetch<ShaderProgram>("GUI");
            GUIShader.AddUniform("scale");
            VBO = new VBO<VertexPositionNormalTexture>();
            VAO = new VAO<VertexPositionNormalTexture>();
            VBO.Buffer(new[]{
                new VertexPositionNormalTexture{Position = new Vector3(0, Height, 0f),Normal = Vector3.UnitZ,TexCoord = new Vector2(0, Height)},
                new VertexPositionNormalTexture{Position = new Vector3(Width, Height, 0f),Normal = Vector3.UnitZ,TexCoord = new Vector2(Width, Height)},
                new VertexPositionNormalTexture{Position = new Vector3(Width, 0, 0f),Normal = Vector3.UnitZ,TexCoord = new Vector2(Width, 0)},
                new VertexPositionNormalTexture{Position = new Vector3(0, 0, 0),Normal = Vector3.UnitZ,TexCoord = new Vector2(0,0)}
            });
            VAO.Setup(GUIShader, VBO);
            _webView = WebCore.CreateWebView(Width, Height);
            WebCore.BaseDirectory = Path.Combine(Directory.GetCurrentDirectory(), "GUI");
            _webView.FlushAlpha = false;
            _webView.IsTransparent = true;
            _webView.CreateObject("console");
            _webView.SetObjectCallback("console", "log", (sender, e) => Bus.Add(new DebugMessage(Timer.LastTickTime, e.Arguments[0].ToString())));

            _webView.CreateObject("GUI");
            _webView.CreateObject("Bus");

            _webView.LoadFile("index.htm");
        }
开发者ID:veggielane,项目名称:SharpEngine,代码行数:28,代码来源:AwesomiumGUI.cs


示例15: SolidColorBrush

 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="graphics">Handle to the GraphicsContext.</param>
 public SolidColorBrush(GraphicsContext graphics)
     : base(graphics)
 {
     this.shader = typeof(SolidColorBrush).Assembly.LoadShaderProgram(
         graphics,
         "Samurai.Graphics.Canvas2D.BasicCanvasShader.vert",
         "Samurai.Graphics.Canvas2D.SolidColorBrush.frag");
 }
开发者ID:HaKDMoDz,项目名称:Samurai,代码行数:12,代码来源:SolidColorBrush.cs


示例16: DoInitialize

        protected override void DoInitialize()
        {
            var shaderCode = new ShaderCode(File.ReadAllText(
            @"shaders\ImageProcessingRenderer\ImageProcessing.comp"), ShaderType.ComputeShader);
            ShaderProgram computeProgram = shaderCode.CreateProgram();

            this.computeProgram = computeProgram;
        }
开发者ID:bitzhuwei,项目名称:CSharpGL,代码行数:8,代码来源:ImageProcessingComputeRenderer.cs


示例17: InitializeShader

        protected void InitializeShader(out ShaderProgram shaderProgram)
        {
            var vertexShaderSource = ManifestResourceLoader.LoadTextFile(@"Renderers.Cloud.vert");
            var fragmentShaderSource = ManifestResourceLoader.LoadTextFile(@"Renderers.Cloud.frag");

            shaderProgram = new ShaderProgram();
            shaderProgram.Create(vertexShaderSource, fragmentShaderSource, null);
        }
开发者ID:xinfushe,项目名称:CSharpGL,代码行数:8,代码来源:CloudRenderer.cs


示例18: CreateLineShader

        //@e Initialization of shader program
        //@j シェーダープログラムの初期化。
        public static ShaderProgram CreateLineShader()
        {
            Byte[] dataBuffer=Utility.ReadEmbeddedFile("TutoLib.shaders.Line.cgx");
            ShaderProgram shaderProgram = new ShaderProgram(dataBuffer);
            shaderProgram.SetUniformBinding(0, "u_WorldMatrix");

            return shaderProgram;
        }
开发者ID:Transwarmer,项目名称:Transwarmer,代码行数:10,代码来源:LineB.cs


示例19: Orbit

        public Orbit(Planet parent, Vector3 center, double radius, int sides, ShaderProgram shader, double ia, double lan, double lp, double ecc)
        {
            this.eccentricAnomaly = 0;
            this.shader = shader;
            this.parent = parent;
            this.Positon = center;
            this.Radius = (float)radius;
            this.Sides = sides;

            this.inclinationAngleRadians = MathHelper.DegreesToRadians(ia);
            this.longitudeAscendingNodeRadians = MathHelper.DegreesToRadians(lan);
            this.longitudePerihelionRadians = MathHelper.DegreesToRadians(lp);
            this.eccentricity = ecc;

            float step = MathHelper.DegreesToRadians(360f / sides);

            List<float> verts = new List<float>();
            List<float> angles = new List<float>();
            List<ushort> elements = new List<ushort>();

            float alpha = (float)longitudePerihelionRadians;
            ushort count = 0;
            while (alpha < Math.PI * 2f + longitudePerihelionRadians)
            {
                if (alpha < Math.PI + longitudePerihelionRadians)
                    this.eccentricAnomaly += step;
                if (alpha > Math.PI + longitudePerihelionRadians)
                    this.eccentricAnomaly -= step;
                this.newRadius = (float)((radius / (1 - this.eccentricity)) * (1 - (this.eccentricity * Math.Cos(this.eccentricAnomaly))));
                //verts.Add((float)Math.Cos(alpha) * Radius + center.X);
                //verts.Add(0f + center.Y);
                //verts.Add((float)Math.Sin(alpha) * Radius + center.Z);
                //verts.Add(Radius * ((float)Math.Cos(alpha + longitudeAscendingNodeRadians) - (float)Math.Sin(alpha + longitudeAscendingNodeRadians) * (float)Math.Cos(inclinationAngleRadians)) + center.Z);
                //verts.Add(Radius * ((float)Math.Sin(alpha + longitudeAscendingNodeRadians) * (float)Math.Sin(inclinationAngleRadians)) + center.Y);
                //verts.Add(Radius * ((float)Math.Sin(alpha + longitudeAscendingNodeRadians) + (float)Math.Cos(alpha + longitudeAscendingNodeRadians) * (float)Math.Cos(inclinationAngleRadians)) + center.X);

                //verts.Add(newRadius * ((float)Math.Cos(alpha) * (float)Math.Cos(longitudeAscendingNodeRadians) - (float)Math.Sin(longitudeAscendingNodeRadians) * (float)Math.Sin(alpha) * (float)Math.Sin(inclinationAngleRadians) ) + center.X);
                //verts.Add(newRadius * ((float)Math.Sin(alpha) * (float)Math.Sin(inclinationAngleRadians)) + center.Y);
                //verts.Add(newRadius * ((float)Math.Sin(alpha) * (float)Math.Cos(longitudeAscendingNodeRadians) + (float)Math.Cos(longitudeAscendingNodeRadians) * (float)Math.Sin(alpha) * (float)Math.Cos(inclinationAngleRadians)) + center.Z);

                verts.Add(newRadius * (float)Math.Cos(alpha) + center.X);
                verts.Add(newRadius * (float)inclinationAngleRadians * (float)Math.Sin(alpha - longitudeAscendingNodeRadians) + center.Y);
                verts.Add(newRadius * (float)Math.Sin(alpha) + center.Z);

                elements.Add(count);
                angles.Add(alpha);
                alpha += step;
                count++;
            }

            float[] vertsf = verts.ToArray();
            float[] anglesf = angles.ToArray();
            ushort[] elementsf = elements.ToArray();

            this.vertsBuffer = new VBO<float>(vertsf, BufferTarget.ArrayBuffer, VBO<float>.PointerType.vertex);
            this.anglesBuffer = new VBO<float>(anglesf, BufferTarget.ArrayBuffer, VBO<float>.PointerType.color);
            this.elementsBuffer = new VBO<ushort>(elementsf, BufferTarget.ElementArrayBuffer, VBO<ushort>.PointerType.element);
        }
开发者ID:Raptor2277,项目名称:Solar_System,代码行数:58,代码来源:Orbit.cs


示例20: ShaderVariable

        public ShaderVariable(ShaderProgram program, int index, string name)
        {
            this.program = program;
            this.index = index;
            this.Name = name;

            Apply = setNothing;
            valueArrayObject = new WeakReference(null);
        }
开发者ID:reignstudios,项目名称:ReignSDK,代码行数:9,代码来源:ShaderVariable.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ShaderResourceView类代码示例发布时间:2022-05-24
下一篇:
C# ShaderMixinSource类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap