protected override void OnInitialize() { this.globalSettings.BaseFrame = new Renderer.SkeletalFrame(null); this.globalSettings.BaseFrame.LoadBones(this.skeleton); animatedSkeleton = new Renderer.AnimatedSkeleton(this.globalSettings.BaseFrame, animationData); this.globalSettings.CurrentFrame = animatedSkeleton; this.globalSettings.CurrentFrame.LoadBones(this.skeleton); this.globalSettings.ViewMatrix = Matrix.LookAtRH( new Vector3(0, 0, 10f), new Vector3(0, 0, 0f), new Vector3(0, 1, 0)); this.globalSettings.ViewITMatrix = Matrix.Invert(this.globalSettings.ViewMatrix); this.globalSettings.ViewITMatrix = Matrix.Transpose(this.globalSettings.ViewITMatrix); var visSkel = new Renderer.VisualSkeleton(this.globalSettings.CurrentFrame) { Enabled = true }; renderList.Add(visSkel); this.globalSettings.ShaderManager.UsePixelShader = false; }
protected override void OnInitialize() { this.globalSettings.IsSkinning = true; var skel = this.modelData.Skeleton.FindChild <DatDigger.Sections.Skeleton.SkeletonSection>(); this.globalSettings.BaseFrame = new Renderer.SkeletalFrame(null); this.globalSettings.BaseFrame.LoadBones(skel); currentSkeletonFrame = new AnimatedSkeleton(this.globalSettings.BaseFrame, mtbSection); this.globalSettings.CurrentFrame = currentSkeletonFrame; this.globalSettings.CurrentFrame.LoadBones(skel); this.globalSettings.ViewMatrix = Matrix.LookAtRH( new Vector3(0, 0, 10f), new Vector3(0, 0, 0f), new Vector3(0, 1, 0)); this.globalSettings.ViewITMatrix = Matrix.Invert(this.globalSettings.ViewMatrix); this.globalSettings.ViewITMatrix = Matrix.Transpose(this.globalSettings.ViewITMatrix); this.globalSettings.PointLightPositions[0] = new Vector4(-50, 50, 50, 1); this.globalSettings.PointLightPositions[1] = new Vector4(-10, 10, 10, 1); this.globalSettings.PointLightColors[0] = new Vector4(0.5f, 0.5f, 0.5f, 0); this.globalSettings.PointLightColors[1] = new Vector4(0, 0, 0, 0); this.globalSettings.PointLightParameters[0] = new Vector4(1, 1, 1000f, 0.1f); this.globalSettings.PointLightParameters[1] = new Vector4(1, 1, 1000f, 0.1f); this.globalSettings.DirLightColors[0] = new Vector4(1f, 1f, 1f, 0); this.globalSettings.DirLightColors[1] = new Vector4(0.2f, 0.2f, 0.2f, 0); this.globalSettings.DirLightDirections[0] = new Vector4(0, -1, 0, 0); this.globalSettings.DirLightDirections[1] = new Vector4(1, -1, 0, 0); BoundingBox aabb = new BoundingBox(); bool isFirst = true; for (var i = 0; i < maxNumModels; i++) { if (this.models[i] == null) { continue; } textureUI[i] = new Element(); textureUI[i].Label = string.Format("[{2}] {0} - 1/{1}", (ModelPart)i, this.textures[i].Count, i + 1); this.UserInterface.Container.Add(textureUI[i]); var allTextures = this.textures[i]; var currentTextures = allTextures[textureIndices[i]]; this.globalSettings.TextureManager.AddRange(currentTextures); this.models[i].Init(); if (isFirst) { aabb = this.models[i].BoundingBox; } else { aabb = BoundingBox.Merge(aabb, this.models[i].BoundingBox); } } sceneOffset.X = -(0.5f * aabb.Maximum.X + 0.5f * aabb.Minimum.X); sceneOffset.Y = -(0.5f * aabb.Maximum.Y + 0.5f * aabb.Minimum.Y); sceneOffset.Z = -(0.5f * aabb.Maximum.Z + 0.5f * aabb.Minimum.Z); if (this.modelData.ModelCommon != null) { this.globalSettings.TextureManager.AddRange(this.modelData.ModelCommon.FindAllChildren <DatDigger.Sections.Texture.TextureSection>()); } this.skeleton = new VisualSkeleton(this.globalSettings.CurrentFrame); this.renderList.Add(this.skeleton); }