本文整理汇总了C#中Skeleton类的典型用法代码示例。如果您正苦于以下问题:C# Skeleton类的具体用法?C# Skeleton怎么用?C# Skeleton使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Skeleton类属于命名空间,在下文中一共展示了Skeleton类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteSkeletonToFile
public float[] WriteSkeletonToFile(Skeleton skeleton, SkeletonFrame skeletonFrame, System.IO.StreamWriter file)
{
int count = 2;
float[] dataLine = new float[63];
System.Text.StringBuilder sb = new System.Text.StringBuilder(150);
string str_framenum = skeletonFrame.FrameNumber.ToString();
dataLine[0] = float.Parse(str_framenum);
sb.Append(str_framenum);
sb.Append(" , ");
string str_timestamp = skeletonFrame.Timestamp.ToString();
dataLine[1] = float.Parse(str_timestamp);
sb.Append(str_timestamp);
sb.Append(" , ");
foreach (Joint joint in skeleton.Joints){
dataLine[count] = joint.Position.X;
sb.Append(joint.Position.X.ToString());
sb.Append(" , ");
dataLine[count + 1] = joint.Position.Y;
sb.Append(joint.Position.Y.ToString());
sb.Append(" , ");
dataLine[count + 2] = joint.Position.Z;
sb.Append(joint.Position.Z.ToString());
sb.Append(" , ");
count = count + 3;
}
string str = sb.ToString();
file.WriteLine(str);
return dataLine;
}
示例2: ViewPropertiesOfInputElement_Form
public ViewPropertiesOfInputElement_Form(string path_to_xml)
{
InitializeComponent();
try
{
current_skelet_loaded = ViewProperties_Form.Read_from_xml(path_to_xml);
element_list = new Classes.Element[current_skelet_loaded.list_of_cell.Count];
Bitmap bm = new Bitmap(current_skelet_loaded.Size.X, current_skelet_loaded.Size.Y);
foreach (Skeleton.cell sc in current_skelet_loaded.list_of_cell)
{
foreach (Skeleton.node sn in sc.list_of_node)
{
bm.SetPixel(sn.x, sn.y, Color.White);
}
}
ibReader.Image = new Image<Gray, byte>(bm);
listBox1.Items.Clear();
for (int i = 0; i < current_skelet_loaded.list_of_cell.Count; i++)
listBox1.Items.Add(i);
}
catch (Exception ex)
{
MessageBox.Show("Error: Could not read file from disk. Original error: " + ex.Message);
}
}
示例3: Import
public override IAsset Import (string pathToFile)
{
boneNames = new Dictionary<string, Assimp.Bone>();
//rootBones = new List<Node> ();
Assimp.Node rootBone=null;
foreach (var mesh in scene.Meshes)
foreach (var bone in mesh.Bones)
boneNames.Add (bone.Name,bone);
foreach(var boneName in boneNames.Keys){
var boneNode=scene.RootNode.FindNode (boneName);
if (boneNode.Parent == null || !boneNames.ContainsKey (boneNode.Parent.Name)) {
rootBone = boneNode.Parent;
break;
}
}
var skele = new Skeleton ();
skele.Name = "_Skeleton";
skele[rootBone.Name]=CreateBoneTree (ref skele, rootBone,null);
//bvh_to_vertices (skele[rootBone.Name],);
//Console.WriteLine ("/n Start bone list: /n"+rootBone.Name);
return skele;
}
示例4: ForceBuild
public void ForceBuild()
{
skeletonDataAsset.ForceUpdate();
skeleton = new Skeleton(skeletonDataAsset.GetSkeletonData());
UpdateMesh();
}
示例5: Apply
/// <summary>
/// Sets the value(s) for the specified time.
/// </summary>
/// <param name="skeleton">The skeleton.</param>
/// <param name="time">The time.</param>
/// <param name="alpha">The alpha.</param>
public override void Apply(Skeleton skeleton, float time, float alpha)
{
float[] frames = Frames;
if (time < frames[0])
{
// Time is before first frame.
return;
}
Bone bone = skeleton.Bones[BoneIndex];
if (time >= frames[frames.Length - 3])
{
// Time is after last frame.
bone.ScaleX += (bone.Data.ScaleX - 1 + frames[frames.Length - 2] - bone.ScaleX) * alpha;
bone.ScaleY += (bone.Data.ScaleY - 1 + frames[frames.Length - 1] - bone.ScaleY) * alpha;
return;
}
// Interpolate between the last frame and the current frame.
int frameIndex = Animation.BinarySearch(frames, time, 3);
float lastFrameX = frames[frameIndex - 2];
float lastFrameY = frames[frameIndex - 1];
float frameTime = frames[frameIndex];
float percent = 1 - ((time - frameTime) / (frames[frameIndex + lastFrameTime] - frameTime));
percent = this.GetCurvePercent((frameIndex / 3) - 1, percent < 0 ? 0 : (percent > 1 ? 1 : percent));
bone.ScaleX += (bone.Data.ScaleX - 1 + lastFrameX + ((frames[frameIndex + TranslateTimeline.frameX] - lastFrameX) * percent) - bone.ScaleX) * alpha;
bone.ScaleY += (bone.Data.ScaleY - 1 + lastFrameY + ((frames[frameIndex + TranslateTimeline.frameY] - lastFrameY) * percent) - bone.ScaleY) * alpha;
}
示例6: CreateBoneTree
private Bone CreateBoneTree(ref Skeleton skele, Node node, Bone parent) {
var internalNode = new Bone {
Name = node.Name, Parent = parent,
};
if (boneNames.ContainsKey (node.Name)) {
boneNames [node.Name].OffsetMatrix.Transpose ();
internalNode.Offset = FromMatrix (boneNames [node.Name].OffsetMatrix);
}if (internalNode.Name == "") {
internalNode.Name = "bone_" + _i++;
}
//skele[internalNode.Name] = internalNode;
var trans = node.Transform;
trans.Transpose(); //drectx stuff
internalNode.LocalTransform =FromMatrix(trans);
internalNode.OriginalLocalTransform = internalNode.LocalTransform;
CalculateBoneToWorldTransform(internalNode);
internalNode.Children = new List<Bone> ();
for (var i = 0; i < node.ChildCount; i++) {
var child = CreateBoneTree(ref skele,node.Children[i], internalNode);
if (child != null) {
internalNode.Children.Add(child);
}
}
return internalNode;
}
示例7: Reset
public virtual void Reset () {
if (meshFilter != null) meshFilter.sharedMesh = null;
if (mesh != null) DestroyImmediate(mesh);
if (renderer != null) renderer.sharedMaterial = null;
mesh = null;
mesh1 = null;
mesh2 = null;
lastVertexCount = 0;
vertices = null;
colors = null;
uvs = null;
sharedMaterials = new Material[0];
submeshMaterials.Clear();
submeshes.Clear();
skeleton = null;
valid = false;
if (!skeletonDataAsset) {
Debug.LogError("Missing SkeletonData asset.", this);
return;
}
SkeletonData skeletonData = skeletonDataAsset.GetSkeletonData(false);
if (skeletonData == null) return;
valid = true;
meshFilter = GetComponent<MeshFilter>();
mesh1 = newMesh();
mesh2 = newMesh();
vertices = new Vector3[0];
skeleton = new Skeleton(skeletonData);
if (initialSkinName != null && initialSkinName.Length > 0 && initialSkinName != "default")
skeleton.SetSkin(initialSkinName);
}
示例8: Form1
public Form1()
{
ClientSize = new Size(640, 480);
Text = "Ijw.Skeletal.Viewer";
Visible = true;
device = GraphicsDevice.Create(this, ClientSize.Width, ClientSize.Height, true, true,
Surfaces.Color | Surfaces.Depth);
shader = new Shader(device, File.OpenRead("../../../res/shader.fx"));
wireframe = new Shader(device, File.OpenRead("../../../res/wire.fx"));
points = new Shader(device, File.OpenRead("../../../res/point.fx"));
meshes = new Cache<string,CoreMesh>(
x => new CoreMesh("../../../res/" + x + ".xmf", coreSkeleton ));
animations = new Cache<string, CoreAnimation>(
x => new CoreAnimation("../../../res/" + x + ".xaf", coreSkeleton));
vertices = new FvfVertexBuffer<Vertex>(device, 1024,
VertexFormat.Position | VertexFormat.Normal | VertexFormat.Texture);
haxVerts = new FvfVertexBuffer<Vector3>(device, 1024,
VertexFormat.Position);
indices = new IndexBuffer(device, 1024);
textures = new Cache<string, Texture>(
x => Texture.Create(File.OpenRead("../../../res/" + x), device));
skeleton = new Skeleton(coreSkeleton);
mixer.Play(animations["walk"]).Looping().WithWeight(0.3f);
mixer.Play(animations["aim"]).Looping();
}
示例9: SkeletonAnalyzer
public SkeletonAnalyzer(long millis)
{
this.millis = millis;
this.history = new Queue<Tuple<Skeleton,long>>();
skeleton = null;
}
示例10: Test3
public void Test3()
{
var skeleton = new CoreSkeleton(skelPath);
var animation = new CoreAnimation(animPath, skeleton);
var skelInstance = new Skeleton(skeleton);
}
示例11: Main
static void Main( string[] args )
{
IShoutable shouter = new Shouter();
Skeleton skeleton = new Skeleton( 6010, shouter );
skeleton.Start();
}
示例12: SkeletonViewer
public SkeletonViewer(Skeleton _skel)
{
InitializeComponent();
skelet = _skel;
sdi = new SkeletDrawInfo(skelet, ClientRectangle);
}
示例13: GetSkeletons
public static Skeleton[] GetSkeletons(this SkeletonFrame frame)
{
if (frame == null)
return null;
var skeletons = new Skeleton[frame.SkeletonArrayLength];
frame.CopySkeletonDataTo(skeletons);
return skeletons;
}
示例14: BVHLoader
//public string debugString;
//constructor
public BVHLoader()
{
FSkeleton = new Skeleton();
FFrames = new List<List<float>>();
FChannelCountOfSkeleton = 0;
FJointCounter = 0;
}
示例15: Initialize
/*
*/
private void Initialize()
{
mesh = new Mesh();
GetComponent<MeshFilter>().mesh = mesh;
mesh.name = "tk2dSkeleton Mesh";
mesh.hideFlags = HideFlags.HideAndDontSave;
state = new Spine.AnimationState(skeletonDataAsset.GetAnimationStateData());
skeleton = new Skeleton(skeletonDataAsset.GetSkeletonData());
}