本文整理汇总了C#中IRenderable类的典型用法代码示例。如果您正苦于以下问题:C# IRenderable类的具体用法?C# IRenderable怎么用?C# IRenderable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IRenderable类属于命名空间,在下文中一共展示了IRenderable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetDisplayName
public static string GetDisplayName(IRenderable obj)
{
string name = obj.Name;
string[] parts = name.Split('/');
return parts[parts.Length-1];
}
示例2: setUp
public void setUp( Vector2 position, int width, int height, ILogic brain = null, BodyBase body = null, IRenderable renderer = null, IMovable mover = null )
{
// Start setUp.
if (!_setUp)
{ // Start not setup if.
_position = position;
_width = width;
_height = height;
_setUp = true;
if (brain != null)
_brain = brain;
if (body != null)
_body = body;
if (renderer != null)
_renderer = renderer;
if ( mover != null)
_mover = mover;
} // End not setup if.
}
示例3: EnqueueForRendering
public void EnqueueForRendering(IRenderable obj)
{
char[,] objImage = obj.ImageProfile;
int imageRows = objImage.GetLength(0);
int imageCols = objImage.GetLength(1);
Point objTopLeft = obj.Bounds.TopLeft;
int lastRow = Math.Min(objTopLeft.Y + imageRows, this.consoleHeight);
int lastCol = Math.Min(objTopLeft.X + imageCols, this.consoleWidth);
for (int row = objTopLeft.Y; row < lastRow; row++)
{
for (int col = objTopLeft.X; col < lastCol; col++)
{
if (row >= 0 && row < this.consoleHeight &&
col >= 0 && col < this.consoleWidth)
{
this.consoleMatrix[row, col] =
objImage[row - objTopLeft.Y, col - objTopLeft.X];
}
}
}
}
示例4: IconButton
public IconButton(IGameWindow window, Camera<OrthographicProjection> camera, Vector2 position, IRenderable renderable, Key? hotkey = null)
: base(window, camera, position)
{
Renderable = renderable;
IsSelected = false;
Hotkey = hotkey;
}
示例5: DrawObject
public void DrawObject(IRenderable obj)
{
Camera cam = (Camera) this.Game.Services.GetService(typeof(ICameraService));
Model m = obj.Model3D;
Matrix[] transforms = new Matrix[m.Bones.Count];
m.CopyAbsoluteBoneTransformsTo(transforms);
Matrix projection = cam.Projection;
Matrix view = cam.View;
foreach (ModelMesh mesh in m.Meshes)
{
foreach (BasicEffect effect in mesh.Effects)
{
effect.EnableDefaultLighting();
effect.View = view;
effect.Projection = projection;
effect.World = transforms[mesh.ParentBone.Index] * Matrix.CreateFromQuaternion(obj.Orientation) * Matrix.CreateTranslation(obj.Position + obj.PositionOffset);
}
mesh.Draw();
}
}
示例6: GeometryNode
/// <summary>
/// Initializes a new instance of GeometryNode.
/// </summary>
public GeometryNode(Renderer renderer, SceneGraph sceneGraph, Matrix localTransform,
IRenderable renderObject)
: base(renderer, sceneGraph)
{
this.localTransform = localTransform;
this.renderObject = renderObject;
}
示例7: AddRenderable
/// <summary>
/// Add a IRenderable to this group
/// </summary>
/// <param name="renderable">IRenderable instance</param>
internal void AddRenderable(IRenderable renderable)
{
Material material = renderable.Material;
if (!material.IsTransparent) _solids.Add(renderable);
else _transparents.Add(renderable);
}
示例8: ReplaceRenderable
public ReplaceRenderable(string NodeName, IRenderable NewRenderable)
{
this.NodeName = NodeName;
this.NewRenderable = NewRenderable;
OldRenderable = OutsideSimulatorApp.GetInstance().SceneRootNode.GetDescendant(NodeName).Renderable;
_isPerformed = false;
}
示例9: Add
public void Add(IRenderable renderable)
{
lock (mRenderables)
{
mRenderables.Add(renderable);
}
}
示例10: Add
public void Add(IRenderable renderable)
{
if(Children.Contains(renderable))
return;
Children.Add(renderable);
if(renderable is Mesh3d)
{
Mesh3d mesh = renderable as Mesh3d;
if(mesh.GetCollisionShape() != null || renderable is IPhysical)
{
lock(PhysicalWorld)
{
CollisionObjects.Add(renderable, mesh.CreateRigidBody());
mesh.PhysicalBody.SetSleepingThresholds(0, 0);
mesh.PhysicalBody.ContactProcessingThreshold = 0;
mesh.PhysicalBody.CcdMotionThreshold = 0;
PhysicalWorld.AddRigidBody(mesh.PhysicalBody);
}
}
}
else if(renderable is IPhysical)
{
IPhysical physicalObject = renderable as IPhysical;
lock(PhysicalWorld)
{
PhysicalWorld.AddRigidBody(physicalObject.GetRigidBody());
physicalObject.GetRigidBody().SetSleepingThresholds(0, 0);
physicalObject.GetRigidBody().ContactProcessingThreshold = 0;
physicalObject.GetRigidBody().CcdMotionThreshold = 0;
}
}
}
示例11: RenderableNode
public RenderableNode(IRenderable renderableObject)
: base(Text.GetCapitalLetters(typeof(RenderableNode).GetType().Name) + '_' + ++count, SceneNodeType.Renderable)
{
IsLeaf = true;
this.RenderableObject = renderableObject;
renderableObject.ParentNode = this;
}
示例12: CreateObject
/// <summary>
/// Create the action to create an object
/// </summary>
/// <param name="parent">The parent scene node to which to attach the object</param>
/// <param name="renderable">The renderable to provide to the node</param>
public CreateObject(IRenderable renderable, Matrix transform)
{
IsPerformed = false;
ParentNode = OutsideSimulatorApp.GetInstance().SceneRootNode;
ChildName = (ParentNode.GetHashCode() + DateTime.Now.GetHashCode()).ToString();
Renderable = renderable;
Transform = transform;
}
示例13: RenderPacket
/// <summary>
/// Initializes a new instance of RenderPacket.
/// </summary>
public RenderPacket( IRenderable renderObject, string materialName, Matrix localTransform,
List<object> extraData)
{
RenderObject = renderObject;
MaterialName = materialName;
LocalTransform = localTransform;
ExtraData = extraData;
}
示例14: Render
public void Render(IRenderable obj)
{
var image = this.AssetLoader.GetImage(obj.Type);
Canvas.SetLeft(image, obj.X);
Canvas.SetTop(image, obj.Y);
this.Canvas.Children.Add(image);
}
示例15: ApplyInstanceParameters
public void ApplyInstanceParameters(IRenderable rObject)
{
foreach (InstanceParameter p in instanceParameters.Values)
{
//VerboseEvent.InstanceParameterSetting.Log(rObject.Name, p.Type.ToString());
p.Apply(rObject);
}
}