本文整理汇总了C#中IrrlichtNETCP.SceneNode.SetMaterialFlag方法的典型用法代码示例。如果您正苦于以下问题:C# SceneNode.SetMaterialFlag方法的具体用法?C# SceneNode.SetMaterialFlag怎么用?C# SceneNode.SetMaterialFlag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IrrlichtNETCP.SceneNode
的用法示例。
在下文中一共展示了SceneNode.SetMaterialFlag方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Load
public override void Load()
{
node = Render.Scene.AddSphereSceneNode(0.1f, 32, Root);
node.SetMaterialFlag(MaterialFlag.Lighting, true);
base.Load();
}
示例2: WaterSceneNode
public WaterSceneNode(SceneNode parent, SceneManager mgr, Dimension2Df tileSize,
Dimension2D tileCount, Dimension2D precision, int id) :
base(parent, mgr, id)
{
_scene = mgr;
_driver = mgr.VideoDriver;
AnimatedMesh wmesh = _scene.AddHillPlaneMesh("watermesh" + _current,
tileSize,
tileCount, 0,
new Dimension2Df(0, 0),
new Dimension2Df(1, 1));
_current++;
int dmat = (int)MaterialType.Reflection2Layer;
if(_driver.DriverType == DriverType.OpenGL)
dmat = _driver.GPUProgrammingServices.AddHighLevelShaderMaterial(
WATER_VERTEX_GLSL, "main", VertexShaderType._1_1, WATER_FRAGMENT_GLSL,
"main", PixelShaderType._1_1, OnShaderSet, MaterialType.TransparentAlphaChannel, 0);
else
dmat = _driver.GPUProgrammingServices.AddHighLevelShaderMaterial(
WATER_HLSL, "vertexMain", VertexShaderType._2_0, WATER_HLSL,
"pixelMain", PixelShaderType._2_0, OnShaderSet, MaterialType.TransparentAlphaChannel, 2);
if (_driver.DriverType == DriverType.OpenGL)
ClampShader = _driver.GPUProgrammingServices.AddHighLevelShaderMaterial(
CLAMP_VERTEX_GLSL, "main", VertexShaderType._1_1, CLAMP_FRAGMENT_GLSL,
"main", PixelShaderType._1_1, OnShaderSet, MaterialType.TransparentAlphaChannel, 1);
else
ClampShader = _driver.GPUProgrammingServices.AddHighLevelShaderMaterial(
CLAMP_HLSL, "vertexMain", VertexShaderType._2_0, CLAMP_HLSL,
"pixelMain", PixelShaderType._2_0, OnShaderSet, MaterialType.TransparentAlphaChannel, 3);
_waternode = _scene.AddMeshSceneNode(wmesh.GetMesh(0), this, -1);
_waternode.SetMaterialType(dmat);
_waternode.SetMaterialFlag(MaterialFlag.BackFaceCulling, false);
_waternode.SetMaterialFlag(MaterialFlag.Lighting, false);
_waternode.SetMaterialFlag(MaterialFlag.FogEnable, false);
_rt = _driver.CreateRenderTargetTexture(precision);
_waternode.SetMaterialTexture(0, _rt);
CameraSceneNode oldcam = _scene.ActiveCamera;
_fixedcam = _scene.AddCameraSceneNode(null);
if(oldcam != null)
_scene.ActiveCamera = oldcam;
}
示例3: Load
public override int Load()
{
const string filename = "sea_shader_low.fx";
int res = -1;
string path = shaderDirectory + filename;
if (System.IO.File.Exists(path))
{
try
{
res = Reference.VideoDriver.GPUProgrammingServices.AddHighLevelShaderMaterialFromFiles(
path, "VS", VertexShaderType._2_0,
path, "PS", PixelShaderType._2_0,
ShaderEvent, MaterialType.TransparentAlphaChannel, 0
);
}
catch (Exception e)
{
Reference.Log.Fatal("Load", e);
}
if (res > 0)
Reference.Log.Debug("Load: Loaded" + path);
else
Reference.Log.Error("Load: not Loaded:" + path);
}
else
{
Reference.Log.Warn("Load: File not exsit:" + path);
}
if (res > 0)
{
const string meshName = "sea001.x";
if (System.IO.File.Exists(modelDirectory + meshName))
{
AnimatedMesh mesh = Reference.SceneManager.GetMesh(modelDirectory + meshName);
node = Reference.SceneManager.AddMeshSceneNode(mesh.GetMesh(0), parentNode, -1);
node.Position = new Vector3D(128, 0, 128);
node.SetMaterialFlag(MaterialFlag.BackFaceCulling, false);
}
}
return res;
}
示例4: Load
public override int Load()
{
string filename = "sky_shader.fx";
if (Reference.Viewer.SkyQuality == Viewer.ShaderLevelType.Low)
{
filename = "sky_shader_low.fx";
}
int res = -1;
string path = shaderDirectory + filename;
if (System.IO.File.Exists(path))
{
try
{
res = Reference.VideoDriver.GPUProgrammingServices.AddHighLevelShaderMaterialFromFiles(
path, "VS", VertexShaderType._2_0,
path, "PS", PixelShaderType._2_0,
ShaderEvent, MaterialType.Solid, 0
);
}
catch (Exception e)
{
Reference.Log.Fatal("Load", e);
res = -1;
}
if (res > 0)
{
Reference.Log.Debug("Load: Loaded" + path);
}
else
{
Reference.Log.Debug("Load: not Loaded:" + path);
}
}
else
{
Reference.Log.Warn("Load: File not exsit:" + path);
}
if (res > 0)
{
// Create sun.
sunNode = Reference.SceneManager.AddBillboardSceneNode(parentNode, new Dimension2Df(256, 256), -1);
sunNode.SetMaterialTexture(0, Reference.VideoDriver.GetTexture(textureDirectory + @"sun.bmp"));
sunNode.SetMaterialType(MaterialType.TransparentAddColor);
sunNode.Position = new Vector3D(1, 1, 0) * 8000;
sunNode.SetMaterialType(MaterialType.TransparentAddColor);
sunNode.SetMaterialFlag(MaterialFlag.Lighting, false);
// Create moon.
moonNode = Reference.SceneManager.AddBillboardSceneNode(parentNode, new Dimension2Df(512, 512), -1);
moonNode.SetMaterialTexture(0, Reference.VideoDriver.GetTexture(textureDirectory + @"moon.bmp"));
moonNode.SetMaterialType(MaterialType.TransparentAddColor);
moonNode.Position = new Vector3D(-1, 1, 0) * 8000;
moonNode.SetMaterialType(MaterialType.TransparentAddColor);
moonNode.SetMaterialFlag(MaterialFlag.Lighting, false);
if (Reference.Viewer.SkyQuality == Viewer.ShaderLevelType.High)
{
const string memisphereMeshName = "sky.x";
if (System.IO.File.Exists(modelDirectory + memisphereMeshName))
{
AnimatedMesh animMesh = Reference.SceneManager.GetMesh(modelDirectory + memisphereMeshName);
if (animMesh != null)
{
Mesh mesh = animMesh.GetMesh(0);
skyNode = Reference.SceneManager.AddMeshSceneNode(mesh, parentNode, -1);
skyNode.Position = new Vector3D(128, 0, 128);
skyNode.Scale = new Vector3D(1.1f, 1.1f, 1.1f);
skyNode.SetMaterialFlag(MaterialFlag.BackFaceCulling, false);
skyNode.SetMaterialFlag(MaterialFlag.FogEnable, false);
skyNode.SetMaterialType(res);
#if YK_UNUSE_MULTI_TEXTURE_STAR
const string starTextureName = "star.tga";
Texture tex = Reference.VideoDriver.GetTexture(modelDirectory + starTextureName);
skyNode.SetMaterialTexture(1, tex);
#endif
}
}
}
else if (Reference.Viewer.SkyQuality == Viewer.ShaderLevelType.Low)
{
SceneNode node = Reference.SceneManager.AddSkyBoxSceneNode(
parentNode,
new Texture[]
{
Reference.VideoDriver.GetTexture(textureDirectory + "sea_sky_UP.jpg"),
Reference.VideoDriver.GetTexture(textureDirectory + "sea_sky_DN.jpg"),
Reference.VideoDriver.GetTexture(textureDirectory + "sea_sky_LF.jpg"),
Reference.VideoDriver.GetTexture(textureDirectory + "sea_sky_RT.jpg"),
Reference.VideoDriver.GetTexture(textureDirectory + "sea_sky_FR.jpg"),
Reference.VideoDriver.GetTexture(textureDirectory + "sea_sky_BK.jpg"),
},
-1
);
//.........这里部分代码省略.........