Пример #1
0
        public CharacterEntity3d(string rFileBase)
        {
            var tObj = Media.LoadObjectAsset(rFileBase + ".dae", false, true, Guid.NewGuid().ToString());

            Agk.SetObjectScalePermanent(tObj.ResourceNumber, 30.0f, 30.0f, 30.0f);
            Agk.RotateObjectGlobalY(tObj.ResourceNumber, 180.0f);
            Agk.FixObjectPivot(tObj.ResourceNumber);

            var fx = Media.GetShaderAsset("media/shaders/SurfaceDiffSpecBone.vs", "media/shaders/SurfaceDiffSpec.ps", true);

            Agk.SetShaderConstantByName(fx.ResourceNumber, "u_normalSize", 1.0f, 0, 0, 0);
            Agk.SetShaderConstantByName(fx.ResourceNumber, "u_specularPower", 10.0f, 0, 0, 0);
            Agk.SetObjectShader(tObj.ResourceNumber, fx.ResourceNumber);

            var tImg = Media.GetImageAsset(rFileBase + "_d.png", 1.0f, 1.0f);

            Agk.SetObjectImage(tObj.ResourceNumber, tImg.ResourceNumber, 0);
            tImg = Media.GetImageAsset(rFileBase + "_n.png", 1.0f, 1.0f);
            Agk.SetObjectImage(tObj.ResourceNumber, tImg.ResourceNumber, 1);
            tImg = Media.GetImageAsset(rFileBase + "_s.png", 1.0f, 1.0f);
            Agk.SetObjectImage(tObj.ResourceNumber, tImg.ResourceNumber, 2);

            Properties.ResourceNumber = tObj.ResourceNumber;
            Properties.IsObject       = true;
            Properties.Filebase       = rFileBase;
            Properties.Shader         = fx;
            Properties.Height         = Agk.GetObjectSizeMaxY(Properties.ResourceNumber) - Agk.GetObjectSizeMinY(Properties.ResourceNumber);

            CharacterHandler3d.CharacterList.Add(this);
        }