本文整理汇总了C#中Axiom.Core.SceneNode类的典型用法代码示例。如果您正苦于以下问题:C# SceneNode类的具体用法?C# SceneNode怎么用?C# SceneNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SceneNode类属于Axiom.Core命名空间,在下文中一共展示了SceneNode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CreateScene
public override void CreateScene()
{
viewport.BackgroundColor = ColorEx.Black;
scene.AmbientLight = ColorEx.Gray;
Light light = scene.CreateLight( "MainLight" );
light.Position = new Vector3( 20, 80, 50 );
light.Diffuse = ColorEx.Blue;
scene.LoadWorldGeometry( "JigLibX_Terrain.xml" );
scene.SetFog( FogMode.Exp2, ColorEx.White, .008f, 0, 250 );
// water plane setup
Plane waterPlane = new Plane( Vector3.UnitY, 1.5f );
MeshManager.Instance.CreatePlane(
"WaterPlane",
ResourceGroupManager.DefaultResourceGroupName,
waterPlane,
2800, 2800,
20, 20,
true, 1,
10, 10,
Vector3.UnitZ );
Entity waterEntity = scene.CreateEntity( "Water", "WaterPlane" );
waterEntity.MaterialName = "Terrain/WaterPlane";
waterNode = scene.RootSceneNode.CreateChildSceneNode( "WaterNode" );
//waterNode.AttachObject( waterEntity );
waterNode.Translate( new Vector3( 1000, 0, 1000 ) );
}
开发者ID:WolfgangSt,项目名称:axiom,代码行数:34,代码来源:JigLibX.cs
示例2: SetupContent
/// <summary>
///
/// </summary>
protected override void SetupContent()
{
SceneManager.SetSkyBox( true, "Examples/EveningSkyBox", 5000 );
// dim orange ambient and two bright orange lights to match the skybox
SceneManager.AmbientLight = new ColorEx( 0.3f, 0.2f, 0.0f );
Light light = SceneManager.CreateLight( "Light1" );
light.Position = new Vector3( 2000, 1000, -1000 );
light.Diffuse = new ColorEx( 1.0f, 0.5f, 0.0f );
light = SceneManager.CreateLight( "Light2" );
light.Position = new Vector3( 2000, 1000, 1000 );
light.Diffuse = new ColorEx( 1.0f, 0.5f, 0.0f );
_pivot = SceneManager.RootSceneNode.CreateChildSceneNode(); // create a pivot node
// create a child node and attach ogre head and some smoke to it
SceneNode headNode = _pivot.CreateChildSceneNode( new Vector3( 100, 0, 0 ) );
headNode.AttachObject( SceneManager.CreateEntity( "Head", "ogrehead.mesh" ) );
headNode.AttachObject( ParticleSystemManager.Instance.CreateSystem( "Smoke", "Examples/Smoke" ) );
Camera.Position = new Vector3( 0.0f, 30.0f, 350.0f );
base.SetupContent();
}
开发者ID:WolfgangSt,项目名称:axiom,代码行数:28,代码来源:SmokeSample.cs
示例3: TestRecreationOfChildNodeAfterRemovalByReference
public void TestRecreationOfChildNodeAfterRemovalByReference()
{
Node node = new SceneNode( this.fakeSceneManager );
Node childNode = node.CreateChild( Name );
node.RemoveChild( childNode );
node.CreateChild( Name );
}
开发者ID:WolfgangSt,项目名称:axiom,代码行数:8,代码来源:SceneNodeRegressionTests.cs
示例4: MultiLights
public MultiLights(SceneManager pSceneManager, SceneNode pCamNode, MovingObject pPlayerShip, Int32 pNumberOfLights)
{
oldCamLightColor = CamLightColor = new ColorEx(0.13f, 0.1f, 0.05f);
PlayerLightColor = ColorEx.White;
camLights = new List<Light>(pNumberOfLights);
innerLights = (Int32)Math.Round(pNumberOfLights / 3.0f, MidpointRounding.AwayFromZero);
outerLights = pNumberOfLights - innerLights;
// create the playership's light.
playerLight = pSceneManager.CreateLight("playerSpotLight");
playerLight.Type = LightType.Spotlight;
playerLight.Diffuse = PlayerLightColor;
playerLight.Specular = ColorEx.White;
playerLight.SetSpotlightRange(0.0f, 120.0f);
playerLight.Direction = Vector3.NegativeUnitZ;
playerLightNode = pPlayerShip.Node.CreateChildSceneNode();
playerLightNode.AttachObject(playerLight);
playerLightNode.Position = new Vector3(0, 0, 0);
playerLightNode.SetDirection(new Vector3(1, 0, 0), TransformSpace.Local);
// create the camera spotlights around the camera's direction.
camInnerLightNode = pCamNode.CreateChildSceneNode();
camInnerLightNode.Position = new Vector3(0, 0, 0);
camOuterLightNode = pCamNode.CreateChildSceneNode();
camOuterLightNode.Position = new Vector3(0, 0, 0);
for (var i = 0; i < innerLights; i++)
{
var light = pSceneManager.CreateLight("camInnerLight " + (i + 1));
light.Type = LightType.Spotlight;
light.Diffuse = CamLightColor;
light.Specular = ColorEx.White;
light.SetSpotlightRange(0.0f, 25.0f);
light.Direction = Quaternion.FromAngleAxis(360.0 * i / innerLights * Constants.DegreesToRadians, Vector3.UnitZ) *
Quaternion.FromAngleAxis(10.0 * Constants.DegreesToRadians, Vector3.UnitX) *
Vector3.NegativeUnitZ;
camLights.Add(light);
camInnerLightNode.AttachObject(light);
}
for (var i = 0; i < outerLights; i++)
{
var light = pSceneManager.CreateLight("camOuterLight " + (i + 1));
light.Type = LightType.Spotlight;
light.Diffuse = CamLightColor;
light.Specular = ColorEx.White;
light.SetSpotlightRange(0.0f, 25.0f);
light.Direction = Quaternion.FromAngleAxis(360.0 * i / outerLights * Constants.DegreesToRadians, Vector3.UnitZ) *
Quaternion.FromAngleAxis(20.0 * Constants.DegreesToRadians, Vector3.UnitX) *
Vector3.NegativeUnitZ;
camLights.Add(light);
camOuterLightNode.AttachObject(light);
}
}
开发者ID:jonathandlo,项目名称:Evolution_War,代码行数:57,代码来源:MultiLights.cs
示例5: CreateScene
public void CreateScene()
{
_entity = _root.SceneManager.CreateEntity("BasicCube", PrefabEntity.Cube);
_entity.MaterialName = "Examples/TestImage";
_sceneNode = Root.Instance.SceneManager.RootSceneNode.CreateChildSceneNode();
_sceneNode.Position = new Vector3(150, 0, -300);
_sceneNode.AttachObject(_entity);
_sceneNode.Yaw(45);
}
开发者ID:Azerothian,项目名称:Illisian.Niva,代码行数:10,代码来源:BasicCube.cs
示例6: CreateScene
public override void CreateScene()
{
if ( !Root.Instance.RenderSystem.Capabilities.HasCapability( Capabilities.VertexPrograms ) ||
!Root.Instance.RenderSystem.Capabilities.HasCapability( Capabilities.FragmentPrograms ) )
{
throw new Exception( "Your hardware does not support vertex and fragment programs, so you cannot run this demo." );
}
// create a simple default point light
Light light = scene.CreateLight( "MainLight" );
light.Position = new Vector3( 20, 80, 50 );
rotNode = scene.RootSceneNode.CreateChildSceneNode();
rotNode.CreateChildSceneNode( new Vector3( 20, 40, 50 ), Quaternion.Identity ).AttachObject( light );
Entity entity = scene.CreateEntity( "Head", "ogrehead.mesh" );
camera.Position = new Vector3( 20, 0, 100 );
camera.LookAt( Vector3.Zero );
// eyes
SubEntity subEnt = entity.GetSubEntity( 0 );
subEnt.MaterialName = "Examples/CelShading";
subEnt.SetCustomParameter( CustomShininess, new Vector4( 35.0f, 0.0f, 0.0f, 0.0f ) );
subEnt.SetCustomParameter( CustomDiffuse, new Vector4( 1.0f, 0.3f, 0.3f, 1.0f ) );
subEnt.SetCustomParameter( CustomSpecular, new Vector4( 1.0f, 0.6f, 0.6f, 1.0f ) );
// skin
subEnt = entity.GetSubEntity( 1 );
subEnt.MaterialName = "Examples/CelShading";
subEnt.SetCustomParameter( CustomShininess, new Vector4( 10.0f, 0.0f, 0.0f, 0.0f ) );
subEnt.SetCustomParameter( CustomDiffuse, new Vector4( 0.0f, 0.5f, 0.0f, 1.0f ) );
subEnt.SetCustomParameter( CustomSpecular, new Vector4( 0.3f, 0.5f, 0.3f, 1.0f ) );
// earring
subEnt = entity.GetSubEntity( 2 );
subEnt.MaterialName = "Examples/CelShading";
subEnt.SetCustomParameter( CustomShininess, new Vector4( 25.0f, 0.0f, 0.0f, 0.0f ) );
subEnt.SetCustomParameter( CustomDiffuse, new Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) );
subEnt.SetCustomParameter( CustomSpecular, new Vector4( 1.0f, 1.0f, 0.7f, 1.0f ) );
// teeth
subEnt = entity.GetSubEntity( 3 );
subEnt.MaterialName = "Examples/CelShading";
subEnt.SetCustomParameter( CustomShininess, new Vector4( 20.0f, 0.0f, 0.0f, 0.0f ) );
subEnt.SetCustomParameter( CustomDiffuse, new Vector4( 1.0f, 1.0f, 0.7f, 1.0f ) );
subEnt.SetCustomParameter( CustomSpecular, new Vector4( 1.0f, 1.0f, 1.0f, 1.0f ) );
// add entity to the root scene node
scene.RootSceneNode.CreateChildSceneNode().AttachObject( entity );
window.GetViewport( 0 ).BackgroundColor = ColorEx.White;
}
开发者ID:WolfgangSt,项目名称:axiom,代码行数:54,代码来源:CelShading.cs
示例7: SetupContent
/// <summary>
///
/// </summary>
protected override void SetupContent()
{
this.ptex = TextureManager.Instance.CreateManual( "DynaTex", ResourceGroupManager.DefaultResourceGroupName,
TextureType.ThreeD, 64, 64, 64, 0, Media.PixelFormat.A8R8G8B8,
TextureUsage.Default, null );
SceneManager.AmbientLight = new ColorEx( 0.6f, 0.6f, 0.6f );
SceneManager.SetSkyBox( true, "Examples/MorningSkyBox", 50 );
Light light = SceneManager.CreateLight( "VolumeTextureSampleLight" );
light.Diffuse = new ColorEx( 0.75f, 0.75f, 0.80f );
light.Specular = new ColorEx( 0.9f, 0.9f, 1 );
light.Position = new Vector3( -100, 80, 50 );
SceneManager.RootSceneNode.AttachObject( light );
// Create volume renderable
this.snode = SceneManager.RootSceneNode.CreateChildSceneNode( Vector3.Zero );
this.vrend = new VolumeRendable( 32, 750, "DynaTex" );
this.snode.AttachObject( this.vrend );
this.trend = new ThingRendable( 90, 32, 7.5f );
this.trend.Material = (Material)MaterialManager.Instance.GetByName( "Examples/VTDarkStuff" );
this.trend.Material.Load();
this.snode.AttachObject( this.trend );
this.fnode = SceneManager.RootSceneNode.CreateChildSceneNode();
Entity head = SceneManager.CreateEntity( "head", "ogrehead.mesh" );
this.fnode.AttachObject( head );
Animation anim = SceneManager.CreateAnimation( "OgreTrack", 10 );
anim.InterpolationMode = InterpolationMode.Spline;
NodeAnimationTrack track = anim.CreateNodeTrack( 0, this.fnode );
TransformKeyFrame key = track.CreateNodeKeyFrame( 0 );
key.Translate = new Vector3( 0, -15, 0 );
key = track.CreateNodeKeyFrame( 5 );
key.Translate = new Vector3( 0, 15, 0 );
key = track.CreateNodeKeyFrame( 10 );
key.Translate = new Vector3( 0, -15, 0 );
this.animState = SceneManager.CreateAnimationState( "OgreTrack" );
this.animState.IsEnabled = true;
this.globalReal = 0.4f;
this.globalImag = 0.6f;
this.globalTheta = 0.0f;
CreateControls();
DragLook = true;
Generate();
}
开发者ID:ryan-bunker,项目名称:axiom3d,代码行数:56,代码来源:VolumeTextureSample.cs
示例8: ManagerContainsNode
private static bool ManagerContainsNode( SceneManager sceneManager, SceneNode childNode )
{
bool managerContainsChild = false;
foreach ( SceneNode sceneNode in sceneManager.SceneNodes )
{
if ( sceneNode.Equals( childNode ) )
{
managerContainsChild = true;
}
}
return managerContainsChild;
}
开发者ID:ryan-bunker,项目名称:axiom3d,代码行数:13,代码来源:PCZSceneManagerRegressionTests.cs
示例9: Boundary
public Boundary(String name)
{
points = new List<Vector2>();
semantics = new List<IBoundarySemantic>();
touchedPages = new List<PageCoord>();
this.name = name;
sceneNode = parentSceneNode.CreateChildSceneNode(name);
pageSize = TerrainManager.Instance.PageSize;
}
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:13,代码来源:Boundary.cs
示例10: WaterPlane
public WaterPlane(SceneNode parentSceneNode, XmlTextReader r)
{
FromXML(r);
// create a scene node
if (parentSceneNode == null)
{
parentSceneNode = TerrainManager.Instance.RootSceneNode;
}
waterSceneNode = parentSceneNode.CreateChildSceneNode(name);
// set up material
material = TerrainManager.Instance.WaterMaterial;
}
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:14,代码来源:WaterPlane.cs
示例11: CreateScene
protected override void CreateScene()
{
// set some ambient light
scene.AmbientLight = ColorEx.Gray;
// create an entity to have follow the path
Entity ogreHead = scene.CreateEntity("OgreHead", "ogrehead.mesh");
// create a scene node for the entity and attach the entity
SceneNode headNode = scene.RootSceneNode.CreateChildSceneNode();
headNode.AttachObject(ogreHead);
// // create a cool glowing green particle system
// ParticleSystem greenyNimbus = ParticleSystemManager.Instance.CreateSystem("GreenyNimbus", "ParticleSystems/GreenyNimbus");
// scene.RootSceneNode.CreateChildSceneNode().AttachObject(greenyNimbus);
ParticleSystem fireworks = ParticleSystemManager.Instance.CreateSystem("Fireworks", "Examples/Fireworks");
scene.RootSceneNode.CreateChildSceneNode().AttachObject(fireworks);
// shared node for the 2 fountains
fountainNode = scene.RootSceneNode.CreateChildSceneNode();
// create the first fountain
ParticleSystem fountain1 = ParticleSystemManager.Instance.CreateSystem("Fountain1", "Examples/PurpleFountain");
SceneNode node = fountainNode.CreateChildSceneNode();
node.Translate(new Vector3(200, -100, 0));
node.Rotate(Vector3.UnitZ, 20);
node.AttachObject(fountain1);
// create the second fountain
ParticleSystem fountain2 = ParticleSystemManager.Instance.CreateSystem("Fountain2", "Examples/PurpleFountain");
node = fountainNode.CreateChildSceneNode();
node.Translate(new Vector3(-200, -100, 0));
node.Rotate(Vector3.UnitZ, -20);
node.AttachObject(fountain2);
// create a rainstorm
ParticleSystem rain = ParticleSystemManager.Instance.CreateSystem("Rain", "Examples/Rain");
scene.RootSceneNode.CreateChildSceneNode(new Vector3(0, 1000, 0), Quaternion.Identity).AttachObject(rain);
rain.FastForward(5.0f);
// Aureola around Ogre perpendicular to the ground
ParticleSystem pSys5 = ParticleSystemManager.Instance.CreateSystem("Aureola",
"Examples/Aureola");
scene.RootSceneNode.CreateChildSceneNode().AttachObject(pSys5);
// Set nonvisible timeout
ParticleSystem.DefaultNonVisibleUpdateTimeout = 5;
}
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:48,代码来源:ParticleFX.cs
示例12: CreateScene
public override void CreateScene()
{
// set some ambient light
scene.AmbientLight = new ColorEx( 1.0f, 0.2f, 0.2f, 0.2f );
// create a skydome
scene.SetSkyDome( true, "Examples/CloudySky", 5, 8 );
// create a simple default point light
Light light = scene.CreateLight( "MainLight" );
light.Position = new Vector3( 20, 80, 50 );
// create a plane for the plane mesh
Plane plane = new Plane();
plane.Normal = Vector3.UnitY;
plane.D = 200;
// create a plane mesh
MeshManager.Instance.CreatePlane( "FloorPlane", ResourceGroupManager.DefaultResourceGroupName, plane, 200000, 200000, 20, 20, true, 1, 50, 50, Vector3.UnitZ );
// create an entity to reference this mesh
Entity planeEntity = scene.CreateEntity( "Floor", "FloorPlane" );
planeEntity.MaterialName = "Examples/RustySteel";
scene.RootSceneNode.CreateChildSceneNode().AttachObject( planeEntity );
// create an entity to have follow the path
Entity ogreHead = scene.CreateEntity( "OgreHead", "ogrehead.mesh" );
// create a scene node for the entity and attach the entity
headNode = scene.RootSceneNode.CreateChildSceneNode( "OgreHeadNode", Vector3.Zero, Quaternion.Identity );
headNode.AttachObject( ogreHead );
// make sure the camera tracks this node
camera.SetAutoTracking( true, headNode, Vector3.Zero );
// create a scene node to attach the camera to
SceneNode cameraNode = scene.RootSceneNode.CreateChildSceneNode( "CameraNode" );
cameraNode.AttachObject( camera );
// turn on some fog
scene.SetFog( FogMode.Exp, ColorEx.White, 0.0002f );
}
开发者ID:WolfgangSt,项目名称:axiom,代码行数:42,代码来源:MousePicking.cs
示例13: CreateScene
public override void CreateScene()
{
scene.AmbientLight = new ColorEx( .4f, .4f, .4f );
Light light = scene.CreateLight( "MainLight" );
light.Position = new Vector3( 50, 80, 0 );
Entity head = scene.CreateEntity( "OgreHead", "ogrehead.mesh" );
entityList.Add( head );
scene.RootSceneNode.CreateChildSceneNode().AttachObject( head );
Entity box = scene.CreateEntity( "Box1", "cube.mesh" );
entityList.Add( box );
scene.RootSceneNode.CreateChildSceneNode( new Vector3( -100, 0, 0 ), Quaternion.Identity ).AttachObject( box );
box = scene.CreateEntity( "Box2", "cube.mesh" );
entityList.Add( box );
scene.RootSceneNode.CreateChildSceneNode( new Vector3( 100, 0, -300 ), Quaternion.Identity ).AttachObject( box );
box = scene.CreateEntity( "Box3", "cube.mesh" );
entityList.Add( box );
scene.RootSceneNode.CreateChildSceneNode( new Vector3( -200, 100, -200 ), Quaternion.Identity ).AttachObject( box );
frustum = new Frustum( "PlayFrustum" );
frustum.Near = 10;
frustum.Far = 300;
// create a node for the frustum and attach it
frustumNode = scene.RootSceneNode.CreateChildSceneNode( new Vector3( 0, 0, 200 ), Quaternion.Identity );
// set the camera in a convenient position
camera.Position = new Vector3( 0, 759, 680 );
camera.LookAt( Vector3.Zero );
frustumNode.AttachObject( frustum );
frustumNode.AttachObject( camera2 );
}
开发者ID:WolfgangSt,项目名称:axiom,代码行数:37,代码来源:FrustumCulling.cs
示例14: RestoreRootSceneNode
public void RestoreRootSceneNode()
{
this.rootSceneNode = this.defaultRootNode;
}
开发者ID:mono-soc-2011,项目名称:axiom,代码行数:4,代码来源:SceneManager.cs
示例15: OverrideRootSceneNode
/// <summary>
/// If set, only the selected node is rendered.
/// To render all nodes, set to null.
/// </summary>
///
public void OverrideRootSceneNode( SceneNode node )
{
this.rootSceneNode = node;
}
开发者ID:mono-soc-2011,项目名称:axiom,代码行数:9,代码来源:SceneManager.cs
示例16: NotifyAutoTrackingSceneNode
/// <summary>
/// Internal method for notifying the manager that a SceneNode is autotracking.
/// </summary>
/// <param name="node">Scene node that is auto tracking another scene node.</param>
/// <param name="autoTrack">True if tracking, false if it is stopping tracking.</param>
internal void NotifyAutoTrackingSceneNode( SceneNode node, bool autoTrack )
{
if ( autoTrack )
{
this.autoTrackingSceneNodes.Add( node );
}
else
{
autoTrackingSceneNodes.Remove( node.Name );
}
}
开发者ID:mono-soc-2011,项目名称:axiom,代码行数:16,代码来源:SceneManager.cs
示例17: SetSkyPlane
//.........这里部分代码省略.........
string materialName,
float scale,
float tiling,
bool drawFirst,
float bow,
string groupName )
{
this.isSkyPlaneEnabled = enable;
if ( enable )
{
string meshName = "SkyPlane";
this.skyPlane = plane;
Material m = (Material)MaterialManager.Instance[ materialName ];
if ( m == null )
{
throw new AxiomException( string.Format( "Skyplane material '{0}' not found.", materialName ) );
}
// make sure the material doesn't update the depth buffer
m.DepthWrite = false;
m.Load();
this.isSkyPlaneDrawnFirst = drawFirst;
// set up the place
Mesh planeMesh = (Mesh)MeshManager.Instance[ meshName ];
// unload the old one if it exists
if ( planeMesh != null )
{
MeshManager.Instance.Unload( planeMesh );
}
// create up vector
Vector3 up = plane.Normal.Cross( Vector3.UnitX );
if ( up == Vector3.Zero )
{
up = plane.Normal.Cross( -Vector3.UnitZ );
}
if ( bow > 0 )
{
planeMesh = MeshManager.Instance.CreateCurvedIllusionPlane(
meshName,
groupName,
plane,
scale * 100,
scale * 100,
scale * bow * 100,
6,
6,
false,
1,
tiling,
tiling,
up );
}
else
{
planeMesh = MeshManager.Instance.CreatePlane( meshName,
groupName,
plane,
scale * 100,
scale * 100,
1,
1,
false,
1,
tiling,
tiling,
up );
}
if ( this.skyPlaneEntity != null )
{
this.RemoveEntity( this.skyPlaneEntity );
}
// create entity for the plane, using the mesh name
this.skyPlaneEntity = CreateEntity( meshName, meshName );
this.skyPlaneEntity.MaterialName = materialName;
// sky entities need not cast shadows
this.skyPlaneEntity.CastShadows = false;
if ( this.skyPlaneNode == null )
{
this.skyPlaneNode = this.CreateSceneNode( meshName + "Node" );
}
else
{
this.skyPlaneNode.DetachAllObjects();
}
// attach the skyplane to the new node
this.skyPlaneNode.AttachObject( this.skyPlaneEntity );
}
}
开发者ID:mono-soc-2011,项目名称:axiom,代码行数:101,代码来源:SceneManager.cs
示例18: SetSkyDome
/// <summary>
/// </summary>
public void SetSkyDome( bool isEnabled,
string materialName,
float curvature,
float tiling,
float distance,
bool drawFirst,
Quaternion orientation,
string groupName )
{
this.isSkyDomeEnabled = isEnabled;
if ( isEnabled )
{
Material material = (Material)MaterialManager.Instance[ materialName ];
if ( material == null )
{
throw new AxiomException( string.Format( "Could not find skydome material '{0}'", materialName ) );
}
// make sure the material doesn't update the depth buffer
material.DepthWrite = false;
// ensure loading
material.Load();
this.isSkyDomeDrawnFirst = drawFirst;
// create node
if ( this.skyDomeNode == null )
{
this.skyDomeNode = this.CreateSceneNode( "SkyDomeNode" );
}
else
{
this.skyDomeNode.DetachAllObjects();
}
// set up the dome (5 planes)
for ( int i = 0; i < 5; ++i )
{
Mesh planeMesh = this.CreateSkyDomePlane( (BoxPlane)i, curvature, tiling, distance, orientation, groupName );
string entityName = String.Format( "SkyDomePlane{0}", i );
// create entity
if ( this.skyDomeEntities[ i ] != null )
{
this.RemoveEntity( this.skyDomeEntities[ i ] );
}
this.skyDomeEntities[ i ] = CreateEntity( entityName, planeMesh.Name );
this.skyDomeEntities[ i ].MaterialName = material.Name;
// Sky entities need not cast shadows
this.skyDomeEntities[ i ].CastShadows = false;
// attach to node
this.skyDomeNode.AttachObject( this.skyDomeEntities[ i ] );
} // for each plane
}
}
开发者ID:mono-soc-2011,项目名称:axiom,代码行数:60,代码来源:SceneManager.cs
示例19: SetSkyBox
/// <summary>
/// Enables / disables a 'sky box' i.e. a 6-sided box at constant
/// distance from the camera representing the sky.
/// </summary>
/// <remarks>
/// You could create a sky box yourself using the standard mesh and
/// entity methods, but this creates a plane which the camera can
/// never get closer or further away from - it moves with the camera.
/// (you could create this effect by creating a world box which
/// was attached to the same SceneNode as the Camera too, but this
/// would only apply to a single camera whereas this skybox applies
/// to any camera using this scene manager).
/// <p/>
/// The material you use for the skybox can either contain layers
/// which are single textures, or they can be cubic textures, i.e.
/// made up of 6 images, one for each plane of the cube. See the
/// TextureLayer class for more information.
/// </remarks>
/// <param name="enable">True to enable the skybox, false to disable it</param>
/// <param name="materialName">The name of the material the box will use.</param>
/// <param name="distance">Distance in world coordinates from the camera to each plane of the box. </param>
/// <param name="drawFirst">
/// If true, the box is drawn before all other
/// geometry in the scene, without updating the depth buffer.
/// This is the safest rendering method since all other objects
/// will always appear in front of the sky. However this is not
/// the most efficient way if most of the sky is often occluded
/// by other objects. If this is the case, you can set this
/// parameter to false meaning it draws <em>after</em> all other
/// geometry which can be an optimisation - however you must
/// ensure that the distance value is large enough that no
/// objects will 'poke through' the sky box when it is rendered.
/// </param>
/// <param name="orientation">
/// Specifies the orientation of the box. By default the 'top' of the box is deemed to be
/// in the +y direction, and the 'front' at the -z direction.
/// You can use this parameter to rotate the sky if you want.
/// </param>
///<param name="groupName"></param>
public void SetSkyBox( bool enable,
string materialName,
float distance,
bool drawFirst,
Quaternion orientation,
string groupName )
{
// enable the skybox?
this.isSkyBoxEnabled = enable;
if ( enable )
{
Material m = (Material)MaterialManager.Instance[ materialName ];
if ( m == null )
{
this.isSkyBoxEnabled = false;
throw new AxiomException( string.Format( "Could not find skybox material '{0}'", materialName ) );
}
// Make sure the material doesn't update the depth buffer
m.DepthWrite = false;
// Ensure loaded
m.Load();
// ensure texture clamping to reduce fuzzy edges when using filtering
m.GetTechnique( 0 ).GetPass( 0 ).GetTextureUnitState( 0 ).SetTextureAddressingMode( TextureAddressing.Clamp );
this.isSkyBoxDrawnFirst = drawFirst;
if ( this.skyBoxNode == null )
{
this.skyBoxNode = this.CreateSceneNode( "SkyBoxNode" );
}
else
{
this.skyBoxNode.DetachAllObjects();
}
// need to create 6 plane entities for each side of the skybox
for ( int i = 0; i < 6; i++ )
{
Mesh planeModel = this.CreateSkyboxPlane( (BoxPlane)i, distance, orientation, groupName );
string entityName = "SkyBoxPlane" + i;
if ( this.skyBoxEntities[ i ] != null )
{
this.RemoveEntity( this.skyBoxEntities[ i ] );
}
// create an entity for this plane
this.skyBoxEntities[ i ] = CreateEntity( entityName, planeModel.Name );
// skyboxes need not cast shadows
this.skyBoxEntities[ i ].CastShadows = false;
// Have to create 6 materials, one for each frame
// Used to use combined material but now we're using queue we can't split to change frame
// This doesn't use much memory because textures aren't duplicated
Material boxMaterial = (Material)MaterialManager.Instance[ entityName ];
if ( boxMaterial == null )
//.........这里部分代码省略.........
开发者ID:mono-soc-2011,项目名称:axiom,代码行数:101,代码来源:SceneManager.cs
示例20: DestroySceneNode
/// <summary>
/// Internal method to destroy and remove a node from the scene.
/// Do not remove from parent by option.
/// </summary>
/// <param name="node"></param>
/// <param name="removeFromParent"></param>
internal void DestroySceneNode( SceneNode node, bool removeFromParent )
{
// Find any scene nodes which are tracking this node, and turn them off.
foreach ( SceneNode autoNode in this.autoTrackingSceneNodes.Values )
{
// Tracking this node
if ( autoNode.AutoTrackTarget == node )
{
// turn off, this will notify SceneManager to remove
autoNode.SetAutoTracking( false );
}
else if ( autoNode == node )
{
// node being removed is a tracker
autoTrackingSceneNodes.Remove( name );
}
}
if ( removeFromParent && node.Parent != null )
{
node.Parent.RemoveChild( node );
}
// removes the node from the list
sceneNodeList.Remove( node.Name );
}
开发者ID:mono-soc-2011,项目名称:axiom,代码行数:32,代码来源:SceneManager.cs
注:本文中的Axiom.Core.SceneNode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论