示例#1
0
        protected override void OnInitialize()
        {
            this.globalSettings.Actor = this.actor;
            LoadSkeleton();

            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);

            LoadCommonTextures();
            LoadModel(actor.HelmModel, ModelPart.Met);
            LoadModel(actor.TopModel, ModelPart.Top);
            LoadModel(actor.BottomModel, ModelPart.Dwn);
            LoadModel(actor.GloveModel, ModelPart.Glv);
            LoadModel(actor.ShoeModel, ModelPart.Sho);
            LoadModel(actor.BeltModel, ModelPart.Pch);
            LoadFace(actor.Face);
            LoadHair(actor.Hair);

            DetermineConfiguration();
            HideHiddenModels();

            BoundingBox aabb    = new BoundingBox();
            bool        isFirst = true;

            for (var i = 0; i < (int)ModelPart.NumModelParts; i++)
            {
                if (this.models[i] == null)
                {
                    continue;
                }

                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);

            this.skeleton = new VisualSkeleton(this.globalSettings.CurrentFrame);
            this.renderList.Add(this.skeleton);
        }
示例#2
0
        protected override void Dispose(bool disposeManagedResources)
        {
            base.Dispose(disposeManagedResources);

            if (disposeManagedResources)
            {
                this.models   = null;
                this.skeleton = null;
            }
        }
示例#3
0
        protected override void Dispose(bool disposeManagedResources)
        {
            base.Dispose(disposeManagedResources);

            if (disposeManagedResources)
            {
                this.modelData.Skeleton = null;
                for (var i = 0; i < this.modelData.Models.Length; i++)
                {
                    this.modelData.Models[i]   = null;
                    this.modelData.Textures[i] = null;
                }

                this.modelData.ModelCommon = null;
                this.models   = null;
                this.skeleton = null;
                this.textures = null;
            }
        }
示例#4
0
        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);
            this.globalSettings.CurrentFrame = new Renderer.SkeletalFrame(this.globalSettings.BaseFrame);
            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);
        }