本文整理汇总了C#中SceneObject类的典型用法代码示例。如果您正苦于以下问题:C# SceneObject类的具体用法?C# SceneObject怎么用?C# SceneObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SceneObject类属于命名空间,在下文中一共展示了SceneObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InstanceEntity
/// <summary>
/// Creates a new instance of the InstanceEntity
/// </summary>
/// <param name = "name">The name of the instance</param>
/// <param name = "index">The index used in the SceneObject.SkinBones array</param>
/// <param name = "sceneObject">The SceneObject this instance pertains to</param>
/// <param name = "transform">The matrix used to place the instance in the world</param>
protected internal InstanceEntity(string name, int index, SceneObject sceneObject, Matrix transform)
: base(name, false)
{
Index = index;
Parent = sceneObject;
World = transform;
}
示例2: SceneInfo
/// <summary>
/// Initializes a new instance of the <see cref="WhatPumpkin.SceneInfo"/> class.
/// I'm using this constructor primarily for receiving save/load data.
/// </summary>
/// <param name="key">Key.</param>
/// <param name="sceneObjects">Scene objects.</param>
/*
public SceneInfo(string key, IEnumerable sceneObjects) {
_key = key;
}*/
/// <summary>
/// Initializes a new instance of the <see cref="WhatPumpkin.SceneInfo"/> class.
/// </summary>
/// <param name="key">Key.</param>
public SceneInfo(string key) {
_key = key;
// TODO: Abstract this data
foreach (Entity entity in GameObject.FindObjectsOfType<Entity>()) {
ISceneObject<string> item = (ISceneObject<string>)entity;
if (item != null) {
try {
SceneObject sceneObject = new SceneObject ();
_sceneObjects.Add (sceneObject);
sceneObject.ReceiveData(item);
} catch (System.Exception e) {
Debug.LogException(e);
}
}
}
}
示例3: CloneSO
/// <summary>
/// Creates new a scene object by cloning an existing object.
/// </summary>
/// <param name="so">Scene object to clone.</param>
/// <param name="description">Optional description of what exactly the command does.</param>
/// <returns>Cloned scene object.</returns>
public static SceneObject CloneSO(SceneObject so, string description = "")
{
if (so != null)
return Internal_CloneSO(so.GetCachedPtr(), description);
return null;
}
示例4: ApplyPrefab
/// <summary>
/// Updates the contents of the prefab with the contents of the provided prefab instance. If the provided object
/// is not a prefab instance nothing happens.
/// </summary>
/// <param name="obj">Prefab instance whose prefab to update.</param>
/// <param name="refreshScene">If true, all prefab instances in the current scene will be updated so they consistent
/// with the newly saved data.</param>
public static void ApplyPrefab(SceneObject obj, bool refreshScene = true)
{
if (obj == null)
return;
SceneObject prefabInstanceRoot = GetPrefabParent(obj);
if (prefabInstanceRoot == null)
return;
if (refreshScene)
{
SceneObject root = Scene.Root;
if (root != null)
Internal_RecordPrefabDiff(root.GetCachedPtr());
}
string prefabUUID = GetPrefabUUID(prefabInstanceRoot);
string prefabPath = ProjectLibrary.GetPath(prefabUUID);
Prefab prefab = ProjectLibrary.Load<Prefab>(prefabPath);
if (prefab != null)
{
IntPtr soPtr = prefabInstanceRoot.GetCachedPtr();
IntPtr prefabPtr = prefab.GetCachedPtr();
Internal_ApplyPrefab(soPtr, prefabPtr);
ProjectLibrary.Save(prefab);
}
if (refreshScene)
{
SceneObject root = Scene.Root;
if (root != null)
Internal_UpdateFromPrefab(root.GetCachedPtr());
}
}
示例5: Objekte
public Objekte(SceneObject Objekt, int Lebenspunkte, String Material)
{
objekt = Objekt;
lebenspunkte = Lebenspunkte;
setMaterial(Material);
}
示例6: NativeRigidbody
public NativeRigidbody(SceneObject linkedSO)
{
IntPtr linkedSOPtr = IntPtr.Zero;
if (linkedSO != null)
linkedSOPtr = linkedSO.GetCachedPtr();
Internal_CreateInstance(this, linkedSOPtr);
}
示例7: IsPrefabInstance
/// <summary>
/// Checks if a scene object has a prefab link. Scene objects with a prefab link will be automatically updated
/// when their prefab changes in order to reflect its changes.
/// </summary>
/// <param name="obj">Scene object to check if it has a prefab link.</param>
/// <returns>True if the object is a prefab instance (has a prefab link), false otherwise.</returns>
public static bool IsPrefabInstance(SceneObject obj)
{
if (obj == null)
return false;
IntPtr objPtr = obj.GetCachedPtr();
return Internal_HasPrefabLink(objPtr);
}
示例8: NativeRenderable
public NativeRenderable(SceneObject sceneObject)
{
IntPtr sceneObjPtr = IntPtr.Zero;
if (sceneObject != null)
sceneObjPtr = sceneObject.GetCachedPtr();
Internal_Create(this, sceneObjPtr);
}
示例9: SerializedSceneObject
/// <summary>
/// Records the current state of the provided scene object.
/// </summary>
/// <param name="so">Scene object to record the state for.</param>
/// <param name="hierarchy">If true, state will be recorded for the scene object and all of its children. Otherwise
/// the state will only be recorded for the provided scene object.</param>
public SerializedSceneObject(SceneObject so, bool hierarchy)
{
IntPtr soPtr = IntPtr.Zero;
if (so != null)
soPtr = so.GetCachedPtr();
Internal_CreateInstance(this, soPtr, hierarchy);
}
示例10: GetPrefabParent
/// <summary>
/// Returns the root object of the prefab instance that this object belongs to, if any.
/// </summary>
/// <param name="obj">Scene object to retrieve the prefab parent for.</param>
/// <returns>Prefab parent of the provided object, or null if the object is not part of a prefab instance.</returns>
public static SceneObject GetPrefabParent(SceneObject obj)
{
if (obj == null)
return null;
IntPtr objPtr = obj.GetCachedPtr();
return Internal_GetPrefabParent(objPtr);
}
示例11: BreakPrefab
/// <summary>
/// Breaks the link between a prefab instance and its prefab. Object will retain all current values but will
/// no longer be influenced by modifications to its parent prefab.
/// </summary>
/// <param name="obj">Prefab instance whose link to break.</param>
public static void BreakPrefab(SceneObject obj)
{
if (obj == null)
return;
IntPtr objPtr = obj.GetCachedPtr();
Internal_BreakPrefab(objPtr);
}
示例12: Form_Load
private void Form_Load(object sender, EventArgs e)
{
{
var camera = new Camera(
new vec3(0, 0, 5), new vec3(0, 0, 0), new vec3(0, 1, 0),
CameraType.Perspecitive, this.glCanvas1.Width, this.glCanvas1.Height);
var rotator = new SatelliteManipulater();
rotator.Bind(camera, this.glCanvas1);
this.scene = new Scene(camera, this.glCanvas1);
this.scene.RootViewPort.ClearColor = Color.SkyBlue;
this.glCanvas1.Resize += this.scene.Resize;
}
{
const int gridsPer2Unit = 20;
const int scale = 2;
var ground = GroundRenderer.Create(new GroundModel(gridsPer2Unit * scale));
ground.Scale = new vec3(scale, scale, scale);
var obj = new SceneObject();
obj.Renderer = ground;
this.scene.RootObject.Children.Add(obj);
}
{
SimpleRenderer movableRenderer = SimpleRenderer.Create(new Teapot());
movableRenderer.RotationAxis = new vec3(0, 1, 0);
movableRenderer.Scale = new vec3(0.1f, 0.1f, 0.1f);
this.movableRenderer = movableRenderer;
SceneObject obj = movableRenderer.WrapToSceneObject();
this.scene.RootObject.Children.Add(obj);
}
{
BillboardRenderer billboardRenderer = BillboardRenderer.Create(new BillboardModel());
SceneObject obj = billboardRenderer.WrapToSceneObject(new UpdateBillboardPosition(movableRenderer));
this.scene.RootObject.Children.Add(obj);
}
{
LabelRenderer labelRenderer = LabelRenderer.Create();
labelRenderer.Text = "Teapot - CSharpGL";
SceneObject obj = labelRenderer.WrapToSceneObject(new UpdateLabelPosition(movableRenderer));
this.scene.RootObject.Children.Add(obj);
}
{
var uiAxis = new UIAxis(AnchorStyles.Left | AnchorStyles.Bottom,
new Padding(3, 3, 3, 3), new Size(128, 128));
this.scene.RootUI.Children.Add(uiAxis);
}
{
var frmPropertyGrid = new FormProperyGrid(this.scene);
frmPropertyGrid.Show();
}
{
var frmPropertyGrid = new FormProperyGrid(this.glCanvas1);
frmPropertyGrid.Show();
}
{
this.scene.Start();
}
}
示例13: delWatcher
public void delWatcher(SceneObject obj)
{
for(int i=0; i<watcherobjs.Count; i++)
{
if(watcherobjs[i] == obj){
watcherobjs.RemoveAt(i);
return;
}
}
}
示例14: Initialize
public override void Initialize()
{
base.Initialize();
this.SO = new SceneObject(((ReadOnlyCollection<ModelMesh>)ResourceManager.GetModel("Model/SpaceObjects/planet_" + (object)this.moonType).Meshes)[0]);
this.SO.ObjectType = ObjectType.Static;
this.SO.Visibility = ObjectVisibility.Rendered;
this.WorldMatrix = ((Matrix.Identity * Matrix.CreateScale(this.scale)) * Matrix.CreateTranslation(new Vector3(this.Position, 2500f)));
this.SO.World = this.WorldMatrix;
base.Radius = this.SO.ObjectBoundingSphere.Radius * this.scale * 0.65f;
}
示例15: Scene
public Scene(Window window)
{
this.window = window;
eventManager = new EventManager(this);
SetupEventSystems();
rootSceneObject = new SceneObject("Root", this);
}