本文整理汇总了C#中SceneNode类的典型用法代码示例。如果您正苦于以下问题:C# SceneNode类的具体用法?C# SceneNode怎么用?C# SceneNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SceneNode类属于命名空间,在下文中一共展示了SceneNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: User
public User(StateManager stateMgr, API.Geo.World world)
{
this.mStateMgr = stateMgr;
this.mWorld = world;
this.mTimeSinceGUIOpen = new Timer();
this.mCameraMan = null;
this.IsAllowedToMoveCam = true;
this.IsFreeCamMode = true;
Camera cam = this.mStateMgr.Camera;
cam.Position = new Vector3(-203, 633, -183);
cam.Orientation = new Quaternion(0.3977548f, -0.1096644f, -0.8781486f, -0.2421133f);
this.mCameraMan = new CameraMan(cam);
this.mSelectedAllies = new HashSet<VanillaNonPlayer>();
this.mRandom = new Random();
this.mFigures = new MOIS.KeyCode[10];
for (int i = 0; i < 9; i++)
this.mFigures[i] = (MOIS.KeyCode)System.Enum.Parse(typeof(MOIS.KeyCode), "KC_" + (i + 1));
this.mFigures[9] = MOIS.KeyCode.KC_0;
this.mWireCube = this.mStateMgr.SceneMgr.RootSceneNode.CreateChildSceneNode();
this.mWireCube.AttachObject(StaticRectangle.CreateRectangle(this.mStateMgr.SceneMgr, Vector3.UNIT_SCALE * Cst.CUBE_SIDE));
this.mWireCube.SetVisible(false);
this.Inventory = new Inventory(10, 4, new int[] { 3, 0, 1, 2 }, true);
}
示例2: WayPoint
public WayPoint()
{
_Orientation = Quaternion.IDENTITY;
_DisplayNameOffset = new Vector3(0, 0.2f, 0);
Entity = Engine.Singleton.SceneManager.CreateEntity("Spawn.mesh");
Node = Engine.Singleton.SceneManager.RootSceneNode.CreateChildSceneNode();
Node.AttachObject(Entity);
ConvexCollision collision = new MogreNewt.CollisionPrimitives.ConvexHull(Engine.Singleton.NewtonWorld,
Node,
Quaternion.IDENTITY,
0.1f,
Engine.Singleton.GetUniqueBodyId());
Vector3 inertia, offset;
collision.CalculateInertialMatrix(out inertia, out offset);
Inertia = inertia;
Body = new Body(Engine.Singleton.NewtonWorld, collision, true);
Body.AttachNode(Node);
Body.SetMassMatrix(0, inertia * 0);
Body.ForceCallback += BodyForceCallback;
Body.UserData = this;
Body.MaterialGroupID = Engine.Singleton.MaterialManager.WaypointMaterialID;
//Body.MaterialGroupID = Engine.Singleton.MaterialManager.CharacterMaterialID;
collision.Dispose();
}
示例3: CreateScene
/// <summary>
/// This method create the initial scene
/// </summary>
protected override void CreateScene()
{
#region Basics
physics = new Physics();
robot = new Robot(mSceneMgr);
robot.setPosition(new Vector3(000, 0, 300));
environment = new Environment(mSceneMgr, mWindow);
playerModel = new PlayerModel(mSceneMgr);
playerModel.setPosition(new Vector3(0, -80, 50));
playerModel.hRotate(new Vector3(600, 0, 0));
#endregion
#region Camera
cameraNode = mSceneMgr.CreateSceneNode();
cameraNode.AttachObject(mCamera);
playerModel.AddChild(cameraNode);
inputsManager.PlayerModel = playerModel;
#endregion
#region Part 9
PlayerStats playerStats = new PlayerStats();
gameHMD = new GameInterface(mSceneMgr, mWindow, playerStats);
#endregion
robots = new List<Robot>();
robots.Add(robot);
robotsToRemove = new List<Robot>();
bombs = new List<Bomb>();
bombsToRemove = new List<Bomb>();
physics.StartSimTimer();
}
示例4: MogreMotionState
/// <param name="thing">The connected lthing, used for updating sounds. You can pass null to skip updating sounds.</param>
public MogreMotionState(LThing thing, Vector3 position, Quaternion orientation, SceneNode node)
{
transform = new Matrix4(orientation);
transform.MakeTransform(position, Vector3.UNIT_SCALE, orientation);
this.node = node;
this.owner = thing;
}
示例5: CreateScene
public override void CreateScene()
{
TexturePtr mTexture = TextureManager.Singleton.CreateManual("RenderArea",
ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME, TextureType.TEX_TYPE_2D,
512, 512, 0, PixelFormat.PF_R8G8B8, (int)TextureUsage.TU_RENDERTARGET);
rttTex = mTexture.GetBuffer().GetRenderTarget();
rttTex.IsAutoUpdated = false;
{
// Create the camera
Camera camera2 = sceneMgr.CreateCamera("PlayerCam2");
camera2.Position = new Vector3(0, 0, 3);
camera2.LookAt(new Vector3(0.0f, 0.0f, 0.0f));
camera2.NearClipDistance = 1;
Viewport v = rttTex.AddViewport(camera2);
MaterialPtr mat = MaterialManager.Singleton.GetByName("CgTutorials/RenderToTexture_Material");
mat.GetTechnique(0).GetPass(0).GetTextureUnitState(0).SetTextureName("RenderArea");
v.BackgroundColour = new ColourValue(0.0f, 0.3f, 0.2f, 0.0f);
//v.SetClearEveryFrame(false);
//v.OverlaysEnabled = false;
rttTex.PreRenderTargetUpdate += new RenderTargetListener.PreRenderTargetUpdateHandler(RenderArea_PreRenderTargetUpdate);
rttTex.PostRenderTargetUpdate += new RenderTargetListener.PostRenderTargetUpdateHandler(RenderArea_PostRenderTargetUpdate);
}
node1 = base.sceneMgr.RootSceneNode.CreateChildSceneNode("TutorialRender2TexNode1");
node2 = base.sceneMgr.RootSceneNode.CreateChildSceneNode("TutorialRender2TexNode2");
manualObj1 = sceneMgr.CreateManualObject("TutorialRender2TexObject1");
manualObj2 = sceneMgr.CreateManualObject("TutorialRender2TexObject2");
node1.AttachObject(DrawTriangle1(manualObj1));
node2.AttachObject(DrawTriangle2(manualObj2));
}
示例6: BuildInternal
private SceneNode BuildInternal(object source, SceneNode parent, bool forceBuild,
ref bool cancelLoad)
{
SceneNode node = BuildNodeInternal(source, parent, forceBuild);
if (node == null)
return parent;
if (cancelLoad)
return node;
lock (s_lock)
{
// We must catch cyclic graphs to avoid infinite recursion.
if (s_ancestors.Contains(source))
return node;
try
{
s_ancestors.Add(source);
ISceneGraphHierarchy modelNode = source.As<ISceneGraphHierarchy>();
IEnumerable<object> children = (modelNode != null) ? modelNode.GetChildren() : m_treeView.GetChildren(source);
foreach (object child in children )
BuildInternal(child, node, false, ref cancelLoad);
}
finally
{
s_ancestors.Remove(source);
}
}
return node;
}
示例7: Add
public void Add(SceneNode node, uint duration, Vector3Df targetPosition, Vector3Df targetRotation, Vector3Df targetScale)
{
Remove(node);
irrDevice.Timer.Tick();
AnimationItem a = new AnimationItem();
a.Node = node;
a.Node.Grab();
a.Duration = duration;
a.StartTime = irrDevice.Timer.Time;
if (targetPosition != null)
{
a.TargetPosition = targetPosition;
a.StartPosition = node.Position;
}
if (targetRotation != null)
{
a.TargetRotation = targetRotation;
a.StartRotation = node.Rotation;
}
if (targetScale != null)
{
a.TargetScale = targetScale;
a.StartScale = node.Scale;
}
lock (animationItems)
{
animationItems.Add(a);
}
}
示例8: GrassPatchSceneNode
public GrassPatchSceneNode(SceneNode parent, SceneManager mgr, int id, bool createIfEmpty,
Vector3D gridPos, string filepath, Texture heightMap, Texture colourMap,
Texture grassMap, SceneNode terrain, WindGenerator wind)
: base(parent, mgr, id)
{
DrawDistance = GRASS_PATCH_SIZE * 1.5f;
MaxDensity = 800;
TerrainHeightMap = heightMap;
TerrainColourMap = colourMap;
TerrainGrassMap = grassMap;
Terrain = terrain;
WindGen = wind;
lastwindtime = 0;
lastdrawcount = 0;
redrawnextloop = true;
MaxFPS = 0;
_mgr = mgr;
WindRes = 5;
filename = string.Format("{0}/{1}.{2}.grass", filepath, gridpos.X, gridpos.Z);
gridpos = gridPos;
Position = new Vector3D(gridpos.X * GRASS_PATCH_SIZE, 0f,
gridpos.Z * GRASS_PATCH_SIZE);
ImageCount = new Dimension2D(4, 2);
if (!Load())
Create(createIfEmpty);
}
示例9: CameraControlSystem
private float _timeSinceLastFrameLastUpdate; // Time value passed to the last call of the method "Update"
#endregion Fields
#region Constructors
public CameraControlSystem(SceneManager sceneManager, string name, Camera camera = null, bool reCalcOnTargetMoving = true)
{
_sceneMgr = sceneManager;
_name = name;
_targetNode = null;
_targetNodeListener = null;
_recalcOnTargetMoving = reCalcOnTargetMoving;
_currentCameraMode = null;
_cameraNode = _sceneMgr.RootSceneNode.CreateChildSceneNode(_name + "SceneNode");
if (camera == null) {
_camera = _sceneMgr.CreateCamera(_name);
_isOwnCamera = true;
} else {
_camera = camera;
_isOwnCamera = false;
}
//Reset to default parameters
_camera.Position = Vector3.ZERO;
_camera.Orientation = Quaternion.IDENTITY;
// ... and attach the Ogre camera to the camera node
_cameraNode.AttachObject(_camera);
_cameraModes = new Dictionary<string, CameraMode>();
}
示例10: KnightyCamera
public KnightyCamera(string name)
: base(name)
{
var sceneMgr = LKernel.GetG<SceneManager>();
// make our camera and set some properties
Camera = sceneMgr.CreateCamera(name);
Camera.NearClipDistance = 0.1f;
Camera.FarClipDistance = 700f;
Camera.AutoAspectRatio = true;
// create the nodes we're going to interpolate
CameraNode = sceneMgr.RootSceneNode.CreateChildSceneNode(name + "_KnightyCameraNode", new Vector3(0, Settings.Default.CameraNodeYOffset, Settings.Default.CameraNodeZOffset));
TargetNode = sceneMgr.RootSceneNode.CreateChildSceneNode(name + "_KnightyCameraTargetNode", new Vector3(0, Settings.Default.CameraTargetYOffset, 0));
CameraNode.SetAutoTracking(true, TargetNode);
CameraNode.SetFixedYawAxis(true);
CameraNode.AttachObject(Camera);
// create the fixed nodes that are attached to the kart
followKart = LKernel.GetG<PlayerManager>().MainPlayer.Kart;
kartCamNode = followKart.RootNode.CreateChildSceneNode(name + "_KartKnightyCameraNode", new Vector3(0, Settings.Default.CameraNodeYOffset, Settings.Default.CameraNodeZOffset));
kartTargetNode = followKart.RootNode.CreateChildSceneNode(name + "_KartKnightyCameraTargetNode", new Vector3(0, Settings.Default.CameraTargetYOffset, 0));
CameraNode.Position = kartCamNode._getDerivedPosition();
TargetNode.Position = kartTargetNode._getDerivedPosition();
// initialise some stuff for the ray casting
rayLength = (CameraNode.Position - TargetNode.Position).Length;
world = LKernel.GetG<PhysicsMain>().World;
}
示例11: Add
public void Add(SceneNode parent, uint time)
{
ParticleSystemSceneNode ps = device.SceneManager.AddParticleSystemSceneNode(false, parent);
ParticleEmitter em = ps.CreateBoxEmitter(
new AABBox(parent.BoundingBox.MinEdge / 4, parent.BoundingBox.MaxEdge / 4),
new Vector3Df(0.0f, 0.025f, 0.0f),
100, 200,
new Color(0xffffffff), new Color(0xffffffff),
1500, 2500);
em.MinStartSize = new Dimension2Df(parent.BoundingBox.Extent.X, parent.BoundingBox.Extent.Y);
em.MaxStartSize = em.MinStartSize * 1.5f;
ps.Emitter = em;
em.Drop();
ParticleAffector paf = ps.CreateFadeOutParticleAffector();
ps.AddAffector(paf);
paf.Drop();
ps.SetMaterialFlag(MaterialFlag.Lighting, false);
ps.SetMaterialFlag(MaterialFlag.ZWrite, false);
ps.SetMaterialTexture(0, device.VideoDriver.GetTexture("../../media/fireball.bmp"));
ps.SetMaterialType(MaterialType.TransparentAddColor);
particleNodes.Add(new ParticleNode(ps, time));
}
示例12: AddClockNode
public static ClockNode AddClockNode(SceneNode parent)
{
ClockNode n = new ClockNode(parent, parent.SceneManager);
n.Drop();
return n;
}
示例13: Attach
public void Attach(SceneNode parent)
{
localParent = parent;
localRoot = parent = new SceneNode(parent);
var physicsComponent = Record.GetComponent<PhysicsComponent>();
if (physicsComponent != null) new DebugDrawNode(parent, physicsComponent.Body);
var transformComponent = Record.GetComponent<TransformComponent>();
if (meshData == null) return;
parent = new TransformNode(parent, transformComponent ?? new TransformComponent());
var animationComponent = Record.GetComponent(default(AnimationComponent), true);
if (animationComponent != null) parent = new AnimationNode(parent, animationComponent);
var tri = meshData.Submeshes[0].Triangles;
var vert = meshData.Submeshes[0].Vertices;
var vbo = new VertexBuffer(vert.Length * SkinnedVertex.Size, BufferTarget.ArrayBuffer,
BufferUsageHint.StaticDraw);
var ibo = new VertexBuffer(tri.Length * Vector3i.Size, BufferTarget.ElementArrayBuffer,
BufferUsageHint.StaticDraw);
vbo.Write(0, vert);
ibo.Write(0, tri);
var vboNode = new VBONode(parent, vbo, ibo);
foreach (var matGroup in from g in meshData.Submeshes group g by g.Material)
{
foreach (var geometry in matGroup)
{
var mat = matGroup.Key;
new SubmeshNode(new MaterialNode(vboNode, mat), geometry);
}
}
}
示例14: MovableText
public MovableText(string name, SceneManager sceneMgr, SceneNode node, Size size)
{
this.texture = TextureManager.Singleton.CreateManual(
name + "Texture",
ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME,
TextureType.TEX_TYPE_2D,
(uint)size.Width,
(uint)size.Height,
0,
PixelFormat.PF_A8R8G8B8);
this.material = MaterialManager.Singleton.Create(name + "Material", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME);
this.material.GetTechnique(0).GetPass(0).CreateTextureUnitState(this.texture.Name);
this.material.SetSceneBlending(SceneBlendType.SBT_TRANSPARENT_ALPHA);
this.material.SetDepthCheckEnabled(false);
this.billboardSet = sceneMgr.CreateBillboardSet();
this.billboardSet.SetMaterialName(this.material.Name);
this.billboardSet.RenderQueueGroup = (byte)RenderQueueGroupID.RENDER_QUEUE_OVERLAY;
this.billboard = this.billboardSet.CreateBillboard(Vector3.ZERO);
this.billboard.SetDimensions(size.Width, size.Height);
this.billboard.Colour = ColourValue.ZERO;
node.AttachObject(this.billboardSet);
this.sceneMgr = sceneMgr;
this.size = size;
}
示例15: CreateScene
public override void CreateScene()
{
// Set ambient light and fog
sceneMgr.AmbientLight = new ColourValue(0, 0, 0);
sceneMgr.SetFog(FogMode.FOG_LINEAR, skyColor, 0, 150, 300);
// Create sun-light
Light light = sceneMgr.CreateLight("Sun");
light.Type = Light.LightTypes.LT_POINT;
light.Position = new Vector3(150, 100, 150);
sceneMgr.ShadowTechnique = ShadowTechnique.SHADOWTYPE_STENCIL_MODULATIVE;
sceneMgr.ShadowFarDistance = 100;
sceneMgr.ShadowColour = new ColourValue(0.7f, 0.7f, 0.7f);
sceneMgr.SetShadowTextureSize(512);
// Ground
Plane ground = new Plane(Vector3.UNIT_Y, 1);
MeshManager.Singleton.CreatePlane("groundPlane", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME,
ground, 500, 500, 20, 20, true, 1, 1, 1, Vector3.UNIT_Z);
Entity groundEnt = sceneMgr.CreateEntity("groundPlaneEntity", "groundPlane");
groundEnt.CastShadows = true;
groundEnt.SetMaterialName("BoxMaterial/Ground");
planeNode = sceneMgr.RootSceneNode.CreateChildSceneNode();
planeNode.AttachObject(groundEnt);
physics = new Physics(sceneMgr);
}