// public override void RenderFrame(GraphicsPipeline3D pipeline, BufferedGeometryData[] gBuffers) // { // Matrix wvp = pipeline.WorldMatrix * pipeline.ViewMatrix * pipeline.ProjectionMatrix; // Matrix iv = Matrix.Invert(pipeline.ViewMatrix); // effect.SetValue("worldViewProj", wvp); // effect.SetValue("viewInverse", iv); // effect.SetValue("worldInverseTranspose", Matrix.TransposeMatrix(iv)); // effect.SetValue("diffuseTexture2", vTexture); // effect.SetValue("lightDir", new float[] { 1, 1, -1, 1 }); // effect.SetValue("lightColor", new float[] { 1, 1, 1, 1 }); // effect.SetValue("materialDiffuse", new float[] { 1, 1, 1, 1 }); // effect.SetValue("noiseScale", 0.1f); // effect.Technique = technique; // effect.Begin(FX.None); // effect.BeginPass(0); // foreach (BufferedGeometryData buffer in gBuffers) // { // buffer.DrawBuffers(pipeline); // } // effect.EndPass(); // effect.End(); // } public override void RenderFrame(GraphicsPipeline3D pipeline, MoleculeRenderingScheme scheme, bool alphaPass) { Matrix wvp = pipeline.WorldMatrix * pipeline.ViewMatrix * pipeline.ProjectionMatrix; Matrix iv = Matrix.Invert(pipeline.ViewMatrix); effect.SetValue("worldViewProj", wvp); effect.SetValue("viewInverse", iv); effect.SetValue("worldInverseTranspose", Matrix.TransposeMatrix(Matrix.Invert(pipeline.WorldMatrix))); // do light passes effect.Technique = technique; effect.Begin(FX.None); effect.BeginPass(0); // render everything from the scheme scheme.RenderAtoms(false, false); scheme.RenderBonds(false, false); effect.EndPass(); effect.End(); }
public void SetScheme(MoleculeRenderingScheme scheme, CompleteOutputDescription coDesc) { latestCoDesc = new CompleteOutputDescription(coDesc); sceneManger.SetScheme(scheme); sceneManger.SetOutputDesc(coDesc); scheme.device = device; // build preview via thread if (generatorThread.ThreadState == ThreadState.Running) { // abort thread generatorThread.Abort(); generatorThread.Join(); } generatorThread = new Thread(GeneratePreviewProcess); generatorThread.Start(); wantPreview = true; }
// public abstract bool DesiredGeomDataFields(out DataFields[] fields, bool exclusive); public abstract void RenderFrame(GraphicsPipeline3D pipeline, MoleculeRenderingScheme scheme, bool alphaPass);
public void SetScheme(MoleculeRenderingScheme scheme) { this.scheme = scheme; }
public override void RenderFrame(GraphicsPipeline3D pipeline, MoleculeRenderingScheme scheme, bool alphaPass) { Effect cEffect; if (lod == 0) cEffect = effect1; else if (lod == 1) cEffect = effect2; else return; Matrix wvp = pipeline.WorldMatrix * pipeline.ViewMatrix * pipeline.ProjectionMatrix; Matrix iv = Matrix.Invert(pipeline.ViewMatrix); cEffect.SetValue("worldViewProj", wvp); cEffect.SetValue("viewInverse", iv); cEffect.SetValue("worldInverseTranspose", Matrix.TransposeMatrix(iv)); cEffect.SetValue("shininess", 3); cEffect.SetValue("diffuseTexture", testTexture); if (alphaPass) { cEffect.Technique = alphaTechnique; cEffect.Begin(FX.None); cEffect.BeginPass(0); scheme.RenderAtoms(false, false); cEffect.EndPass(); cEffect.End(); } else { // do light passes cEffect.Technique = technique; cEffect.Begin(FX.None); cEffect.BeginPass(0); //effect.SetValue("diffuseTexture", texture); foreach (NuGenSVisualLib.Rendering.Lighting.Light light in setup.lights) { if (!light.Enabled) continue; if (light is DirectionalLight) { DirectionalLight dLight = (DirectionalLight)light; cEffect.SetValue("lightDir", new Vector4(dLight.Direction.X, dLight.Direction.Y, dLight.Direction.Z, 1.0f)); cEffect.SetValue("lightColor", ColorValue.FromColor(dLight.Clr)); // render everything from the scheme scheme.RenderAtoms(false, false); if (scheme.LightBonds) scheme.RenderBonds(false, false); } } cEffect.EndPass(); cEffect.End(); } //if (!scheme.LightBonds) //{ // effect.Technique = lineTechnique; // effect.Begin(FX.None); // effect.BeginPass(0); // scheme.RenderBonds(); // effect.EndPass(); // effect.End(); //} //device.SetTexture(0, null); }