本文整理汇总了C#中SceneNode.SetInitialState方法的典型用法代码示例。如果您正苦于以下问题:C# SceneNode.SetInitialState方法的具体用法?C# SceneNode.SetInitialState怎么用?C# SceneNode.SetInitialState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SceneNode
的用法示例。
在下文中一共展示了SceneNode.SetInitialState方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetViewModel
public List<String> SetViewModel(String _model)
{
String nameOnly = Path.GetFileNameWithoutExtension(_model);
String filename = Path.GetFileName(_model);
String modelDir = Path.GetDirectoryName(_model);
AddResourcesDirectory(nameOnly, modelDir);
if (sceneMgr.HasEntity(nameOnly))
sceneMgr.DestroyEntity(nameOnly);
modelEntity = sceneMgr.CreateEntity(nameOnly, filename, nameOnly);
if (sceneMgr.HasSceneNode(MODEL_NODE))
sceneMgr.DestroySceneNode(MODEL_NODE);
modelNode = sceneMgr.RootSceneNode.CreateChildSceneNode(MODEL_NODE);
modelNode.SetInitialState();
modelNode.DetachAllObjects();
modelNode.AttachObject(modelEntity);
// check for material textures
foreach (var subMesh in modelEntity.GetMesh().GetSubMeshIterator())
{
bool needsReload = false;
var matPtr = (MaterialPtr)MaterialManager.Singleton.GetByName(subMesh.MaterialName);
if (matPtr != null)
{
foreach (var mtrPass in matPtr.GetTechnique(0).GetPassIterator())
{
foreach (var mtrTex in mtrPass.GetTextureUnitStateIterator())
{
if (mtrTex.IsTextureLoadFailing)
{
mtrTex.SetTextureName(mtrTex.TextureName.Replace(".png", ".dds"));
needsReload = true;
}
}
}
}
if (needsReload) matPtr.Reload();
}
//if (modelEntity.HasSkeleton)
//{
// foreach (String skltFiles in Directory.GetFiles(modelDir, "*.skeleton"))
// {
// try
// {
// SkeletonPtr source = SkeletonManager.Singleton.Load(Path.GetFileName(skltFiles), "General");
// Skeleton.BoneHandleMap boneHandleMap = new Skeleton.BoneHandleMap();
// source._buildMapBoneByHandle(source, boneHandleMap);
// modelEntity.Skeleton._mergeSkeletonAnimations(source, boneHandleMap);
// modelEntity.Skeleton._refreshAnimationState(modelEntity.AllAnimationStates);
// }
// catch { }
// }
// modelEntity.DisplaySkeleton = true;
//}
SetInitialCamera(modelEntity, modelNode);
if (sceneMgr.HasLight("SimpleLight"))
sceneMgr.DestroyLight("SimpleLight");
Light light = sceneMgr.CreateLight("SimpleLight");
sceneMgr.RootSceneNode.AttachObject(light);
light.DiffuseColour = new ColourValue(1f, 1f, 1f);
light.Position = this.camera.Position;
light.Direction = this.camera.Direction;
return GetAnimationNames(modelEntity);
}