コード例 #1
0
ファイル: Effect.cs プロジェクト: 0x0ade/FNA-Legacy
        protected Effect(Effect cloneSource)
        {
            GraphicsDevice = cloneSource.GraphicsDevice;

            // Send the parsed data to be cloned and recompiled by MojoShader
            glEffect = GraphicsDevice.GLDevice.CloneEffect(
                cloneSource.glEffect
            );

            // Double the ugly, double the fun!
            INTERNAL_parseEffectStruct();

            // The default technique is whatever the current technique was.
            for (int i = 0; i < cloneSource.Techniques.Count; i += 1)
            {
                if (cloneSource.Techniques[i] == cloneSource.CurrentTechnique)
                {
                    CurrentTechnique = Techniques[i];
                }
            }

            // Pin the state changes so .NET doesn't move it around
            stateChanges = new MojoShader.MOJOSHADER_effectStateChanges();
            stateChanges.render_state_change_count = 0;
            stateChanges.sampler_state_change_count = 0;
            stateChanges.vertex_sampler_state_change_count = 0;
            stateChangesHandle = GCHandle.Alloc(stateChanges, GCHandleType.Pinned);
        }
コード例 #2
0
ファイル: Effect.cs プロジェクト: 0x0ade/FNA-Legacy
        public Effect(GraphicsDevice graphicsDevice, byte[] effectCode)
        {
            GraphicsDevice = graphicsDevice;

            // Send the blob to the GLDevice to be parsed/compiled
            glEffect = graphicsDevice.GLDevice.CreateEffect(effectCode);

            // This is where it gets ugly...
            INTERNAL_parseEffectStruct();

            // The default technique is the first technique.
            CurrentTechnique = Techniques[0];

            // Pin the state changes so .NET doesn't move it around
            stateChanges = new MojoShader.MOJOSHADER_effectStateChanges();
            stateChanges.render_state_change_count = 0;
            stateChanges.sampler_state_change_count = 0;
            stateChanges.vertex_sampler_state_change_count = 0;
            stateChangesHandle = GCHandle.Alloc(stateChanges, GCHandleType.Pinned);
        }