public void Draw(IBlockEffect effect) { foreach (var meshPart in MeshParts) { meshPart.Draw(effect); } }
void SetDirectionalLights(IBlockEffect effect) { effect.AmbientLightColor = AmbientLightColor; SetDirectionalLight(DirectionalLightModel0, effect.DirectionalLight0); SetDirectionalLight(DirectionalLightModel1, effect.DirectionalLight1); SetDirectionalLight(DirectionalLightModel2, effect.DirectionalLight2); }
/// <summary> /// 指定された IBlockEffect で描画します。 /// </summary> public void Draw(IBlockEffect effect) { if (!IsLoaded) { throw new InvalidOperationException("BlockMeshPart is not loaded."); } graphicsDevice.SetVertexBuffer(VertexBuffer, VertexOffset); graphicsDevice.Indices = IndexBuffer; effect.DiffuseColor = MeshMaterial.DiffuseColor; effect.EmissiveColor = MeshMaterial.EmissiveColor; effect.SpecularColor = MeshMaterial.SpecularColor; effect.SpecularPower = MeshMaterial.SpecularPower; effect.Pass.Apply(); graphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, NumVertices, StartIndex, PrimitiveCount); }
/// <summary> /// BlockMesh をロードします。 /// </summary> void LoadBlockMesh() { var blockLoader = new StringBlockLoader(blockData); var meshFactory = new BlockMeshFactory(GraphicsDevice); meshManager = new BlockMeshManager(blockLoader, meshFactory); // 通常の IBlockEffect をロードします。 blockEffect = new BasicBlockEffect(GraphicsDevice); blockEffect.EnableDefaultLighting(); // インスタンシング用の IBlockEffect をロードします。 var instancingEffect = Content.Load <Effect>("Effects/Instancing"); instancingBlockEffect = new InstancingBlockEffect(instancingEffect); instancingBlockEffect.EnableDefaultLighting(); // 実際のアプリケーションではファイルの Block から BlockMesh をロードします。 // BlockMesh をロードします。 mesh = meshManager.Load("Dummy", lodCount); }
public void Draw(IBlockEffect effect) { MeshLod.Draw(effect); }
/// <summary> /// BlockMesh をロードします。 /// </summary> void LoadBlockMesh() { var blockLoader = new StringBlockLoader(blockData); var meshFactory = new BlockMeshFactory(GraphicsDevice); meshManager = new BlockMeshManager(blockLoader, meshFactory); // 通常の IBlockEffect をロードします。 blockEffect = new BasicBlockEffect(GraphicsDevice); blockEffect.EnableDefaultLighting(); // インスタンシング用の IBlockEffect をロードします。 var instancingEffect = Content.Load<Effect>("Effects/Instancing"); instancingBlockEffect = new InstancingBlockEffect(instancingEffect); instancingBlockEffect.EnableDefaultLighting(); // 実際のアプリケーションではファイルの Block から BlockMesh をロードします。 // BlockMesh をロードします。 mesh = meshManager.Load("Dummy", lodCount); }
public void Draw(IBlockEffect effect) { foreach (var meshPart in MeshParts) meshPart.Draw(effect); }