public static void SetLive2DCubism3CVVTuberSettings_Koharu()
        {
            GameObject koharu = GameObject.Find("Koharu");

            if (koharu != null)
            {
                CubismModel live2DCubism3Model = koharu.GetComponent <CubismModel> ();

                Animator animator = koharu.GetComponent <Animator>();


                CubismRenderController cubisumRenderController = koharu.GetComponent <CubismRenderController>();
                Undo.RecordObject(cubisumRenderController, "Set CubismSortingMode.BackToFrontOrder to cubisumRenderController.SortingMode");
                cubisumRenderController.SortingMode = CubismSortingMode.BackToFrontOrder;
                EditorUtility.SetDirty(cubisumRenderController);
                foreach (var renderer in cubisumRenderController.Renderers)
                {
                    EditorUtility.SetDirty(renderer);
                    // HACK Get mesh renderer directly.
                    EditorUtility.SetDirty(renderer.GetComponent <MeshRenderer>());
                }


                Undo.RecordObject(animator, "Set AnimatorControlle to animator.runtimeAnimatorController");
                animator.runtimeAnimatorController = Resources.Load <RuntimeAnimatorController>("Animation/Koharu_Animation");
                EditorUtility.SetDirty(animator);


                Live2DCubism3HeadRotationController headRotationController = FindObjectOfType <Live2DCubism3HeadRotationController> ();
                if (headRotationController != null)
                {
                    Undo.RecordObject(headRotationController, "Set live2DCubism3Model to headRotationController.target");
                    headRotationController.target = live2DCubism3Model;

                    EditorUtility.SetDirty(headRotationController);
                }

                Live2DCubism3FaceAnimationController faceAnimationController = FindObjectOfType <Live2DCubism3FaceAnimationController> ();
                if (faceAnimationController != null)
                {
                    Undo.RecordObject(faceAnimationController, "Set live2DCubism3Model to faceAnimationController.live2DCubism3Model");
                    faceAnimationController.live2DCubism3Model = live2DCubism3Model;

                    EditorUtility.SetDirty(faceAnimationController);
                }

                Live2DCubism3KeyInputExpressionController keyInputExpressionController = FindObjectOfType <Live2DCubism3KeyInputExpressionController>();
                if (keyInputExpressionController != null)
                {
                    Undo.RecordObject(keyInputExpressionController, "Set Animator to keyInputExpressionController.target");
                    keyInputExpressionController.target = animator;

                    EditorUtility.SetDirty(keyInputExpressionController);
                }
            }
            else
            {
                Debug.LogError("There is no \"Live2DCubism3Model_Koharu\" prefab in the scene. Please add \"Live2DCubism3Model_Koharu\" prefab to the scene.");
            }
        }
Beispiel #2
0
    /// <summary>
    /// load model from list
    /// </summary>
    /// <param name="filepath">target file path</param>
    public async void LoadModelFromDB(string filepath)
    {
        if (!downloader.GetDownloadStatus())
        {
            DownloadedFile data = null;
            await Task.Run(() =>
            {
                data = downloader.DownloadFileFromStorage(filepath, auth.User).Result;
            });

            var taggedObject = GameObject.FindGameObjectsWithTag("Player");
            foreach (GameObject current in taggedObject)
            {
                Destroy(current);
            }
            //loading model
            if (data.Type == "application/json")
            {
                Debug.Log("Stasrt loading Live2D");
                live2dloader.LoadModelFromCompressor(data.File);
                //add Vtuber system to this model
                await Task.Delay(500);

                CubismModel target = GameObject.FindGameObjectWithTag("Player").GetComponent <CubismModel>();
                target.gameObject.AddComponent <ObjectMover>();
                target.gameObject.AddComponent <LookAround>();
                target.transform.Translate(0, 1.5f, 0);
            }
        }
        else
        {
            Debug.LogError("Download in progress");
        }
    }
Beispiel #3
0
        // Use this for initialization
        void Start()
        {
            createController();
            palmPos = new Vector3();
            model   = GetComponentInParent <CubismModel>();


            posdatas = new List <GameObject>();
            foreach (var e in palmPositionPosePoints)
            {
                posdatas.Add(Instantiate(testprehub, e.position, Quaternion.identity));
            }
            palmtester     = Instantiate(testprehub, palmPos, Quaternion.identity);
            targetertester = Instantiate(testprehub, new Vector3(0, 0, 0), Quaternion.identity);


            fingerLevels = new List <float>();

            fingerParams = new List <List <FingerExtendParameter> >();
            for (int i = 0; i <= (int)Finger.FingerType.TYPE_PINKY; i++)
            {
                fingerLevels.Add(0f);
                fingerParams.Add(new List <FingerExtendParameter>());
                foreach (var e in model.GetComponentsInChildren <FingerExtendParameter>())
                {
                    if ((e.type == (Finger.FingerType)i) && e.isLeft == isLeft)
                    {
                        fingerParams[i].Add(e);
                    }
                }
            }

            Debug.Log("StandAlone : Start()");
        }
        public CubismRenderer(CubismModel model, IEnumerable <Texture> textures)
        {
            this.model    = model;
            this.textures = textures.ToList();

            foreach (var drawable in model.Drawables)
            {
                if (drawable.Masks.Length <= 0)
                {
                    drawableClippingContexts.Add(null);
                    continue;
                }

                ClippingContext newClippingContext = null;
                int[]           maskIds            = drawable.Masks.Distinct().OrderBy(x => x).ToArray();
                foreach (var target in allClippingContexts)
                {
                    if (maskIds.SequenceEqual(target.ClippingIds))
                    {
                        newClippingContext = target;
                        break;
                    }
                }

                if (newClippingContext == null)
                {
                    newClippingContext = new ClippingContext(maskIds);
                    allClippingContexts.Add(newClippingContext);
                }

                newClippingContext.ClippedDrawables.Add(drawable);
                drawableClippingContexts.Add(newClippingContext);
            }
        }
Beispiel #5
0
 /// <summary>
 /// Called when a new Model is loaded.
 /// </summary>
 /// <param name="sender">The Sender/CubismViewer.</param>
 /// <param name="model">The new Model.</param>
 private void OnNewModel(CubismViewer sender, CubismModel model)
 {
     // Clear animation list when new model is loaded.
     animDropdown.ClearOptions();
     animDropdown.captionText.text = "Load one motion first";
     animDropdown.enabled          = false;
 }
        public CubismPhysics(CubismModel model, CubismPhysicsSetting setting)
        {
            this.model = model;

            physicsRig = new PhysicsRig
            {
                Gravity = setting.Meta.EffectiveForces.Gravity,
                Wind    = setting.Meta.EffectiveForces.Wind,
                SubRigs = new PhysicsSubRig[setting.Meta.PhysicsSettingCount],
            };

            for (int i = 0; i < physicsRig.SubRigs.Length; ++i)
            {
                physicsRig.SubRigs[i] = new PhysicsSubRig
                {
                    Gravity       = physicsRig.Gravity,
                    Wind          = physicsRig.Wind,
                    Input         = readInputs(setting.PhysicsSettings[i].Input.ToArray()),
                    Output        = readOutputs(setting.PhysicsSettings[i].Output.ToArray()),
                    Particles     = readParticles(setting.PhysicsSettings[i].Vertices.ToArray()),
                    Normalization = readNormalization(setting.PhysicsSettings[i].Normalization),
                };
            }

            physicsRig.Initialize();
        }
        private static void CopyUserData(CubismModel source, CubismModel destination, bool copyComponentsOnly = false)
        {
            // Give parameters, parts, and drawables special treatment.
            CopyUserData(source.Parameters, destination.Parameters, copyComponentsOnly);
            CopyUserData(source.Parts, destination.Parts, copyComponentsOnly);
            CopyUserData(source.Drawables, destination.Drawables, copyComponentsOnly);


            // Copy components.
            foreach (var sourceComponent in source.GetComponents(typeof(Component)))
            {
                // Skip non-movable components.
                if (!sourceComponent.MoveOnCubismReimport(copyComponentsOnly))
                {
                    continue;
                }


                // Copy component.
                var destinationComponent = destination.GetOrAddComponent(sourceComponent.GetType());


                EditorUtility.CopySerialized(sourceComponent, destinationComponent);
            }
        }
    // Use this for initialization
    void Start()
    {
        startScale    = transform.localScale;
        startposition = transform.position;
        AttackPhase   = 0;
        nowHP         = _HP;
        enemyHpbar    = GetComponent <EnemyHpbar>();
        enemyHpbar.SetBarValue(_HP, nowHP);
        patrolType                 = 0;
        playerObject               = GameObject.FindGameObjectWithTag("Player");
        playerController           = playerObject.GetComponent <PlayerController>();
        targetPosition             = _AttackPosition.transform.position;
        _collisionDisplacePosition = transform.position.x - _WaitPosition.transform.position.x;


        _AttackPosition.transform.parent = null;
        _AttackPosition.SetActive(false);
        _WaitPosition.transform.parent = null;
        _WaitPosition.SetActive(false);

        animator    = GetComponent <Animator>();
        Model       = this.FindCubismModel();
        rb          = GetComponent <Rigidbody2D>();
        cameraShake = GameObject.Find("Main Camera").GetComponent <CameraShake>();

        int i = 0;

        foreach (var skl in _sickle)
        {
            attackEffect[i++] = skl.transform.GetChild(0).gameObject;
            attackEffect[i++] = skl.transform.GetChild(1).gameObject;
        }
        cubismRender = GetComponent <CubismRenderController>();
    }
Beispiel #9
0
    void Start()
    {
        inputManager    = InputManager.Instance;
        playerManager   = PlayerManager.Instance;
        jumpTimeCounter = playerManager.JumpTime;
        rb                     = GetComponent <Rigidbody2D>();
        startMoveSpeed         = playerManager.MoveSpeed;
        HP                     = _maxHP;
        _HPbar.maxValue        = _maxHP;
        _HPbar.value           = HP;
        _bulletsRemain.text    = " ∞ ";
        _bulletsRemain.enabled = false;
        cam                    = GameObject.Find("Main Camera");
        SoundManagerV2.Instance.PlayBGM(0);

        //アニメーション関連
        Model      = this.FindCubismModel();
        animator   = GetComponent <Animator>();
        Shot1Layer = animator.GetLayerIndex("Shot1 Layer");
        Shot2Layer = animator.GetLayerIndex("Shot2 Layer");
        Shot3Layer = animator.GetLayerIndex("Shot3 Layer");
        weight1    = 0f;
        weight2    = 0f;
        weight3    = 0f;
        SetState(State.None, first: true);
    }
Beispiel #10
0
    // Use this for initialization
    void Start()
    {
        jsondata = CubismModel3Json.LoadAtPath(loadingModelJsonPath, normalFileLoad);
        cmodel   = jsondata.ToModel();

        var renderController = cmodel.gameObject.GetComponent <CubismRenderController>();

        renderController.SortingMode = CubismSortingMode.BackToFrontOrder;

        var AutoBlinkController = cmodel.gameObject.AddComponent <CubismAutoEyeBlinkInput>();

        AutoBlinkController.enabled = true;

        var BlinkController = cmodel.gameObject.GetComponent <CubismEyeBlinkController>();

        BlinkController.BlendMode = CubismParameterBlendMode.Override;


        var animeController = cmodel.gameObject.AddComponent <Animation>();

        animeController.playAutomatically = false;

        var nowPlayAudio = cmodel.gameObject.AddComponent <AudioSource>();

        nowPlayAudio.playOnAwake = false;

        var breathController = cmodel.gameObject.AddComponent <CubismBreathController>();
        var breathParam      = cmodel.Parameters.FindById("PARAM_BREATH");

        breathController.enabled = true;
        breathParam.gameObject.AddComponent <CubismBreathParameter>();
    }
Beispiel #11
0
        /// <summary>
        /// Called by Unity.
        /// </summary>
        private void OnEnable()
        {
            _model = this.FindCubismModel();

            // Get cubism update controller.
            _hasUpdateController = (GetComponent <CubismUpdateController>() != null);
        }
Beispiel #12
0
    /// <summary>
    /// Called by Unity. Initializes instance.
    /// </summary>
    void Start()
    {
        // Get model.
        model = gameObject.GetComponent <CubismModel>();
        if (model == null)
        {
            model = gameObject.GetComponentInChildren <CubismModel>();
        }

        // BUG: Live2D physics will not work if it's enabled from the beginning.
        model.GetComponent <CubismPhysicsController>().enabled = true;

        // Find all trackable parameters in model.
        CubismParams = new List <CubismParameter>();

        foreach (CubismParameter p in model.Parameters)
        {
            foreach (string name in paramNames)
            {
                if (p.Id == name)
                {
                    CubismParams.Add(p);
                }
            }
        }
    }
Beispiel #13
0
        /// <summary>
        /// Called when a new Model is loaded.
        /// </summary>
        /// <param name="sender">The Sender/CubismViewer.</param>
        /// <param name="model">The new Model.</param>
        private void OnNewModel(CubismViewer sender, CubismModel model)
        {
            // Check if old model is currently loaded.
            if (CubismParamsInfo != null)
            {
                // Destroy all old UI elements if they exist.
                foreach (CubismParameterInfo param in CubismParamsInfo)
                {
                    GameObject.Destroy(param.Slider.gameObject.transform.parent.gameObject);
                }
            }

            // Get template for parameter entries (find over parent because it's not enabled)
            GameObject paramEntryTemplate = GameObject.Find("paramScroll").transform.Find("paramEntryTemplate").gameObject;

            // Get scroll view content box. Parameter sliders are instantiated inside of this.
            GameObject paramScrollContent = GameObject.Find("paramScrollContent");

            CubismParamsInfo = new List <CubismParameterInfo>();

            // Populate parameter UI scroll view.
            foreach (CubismParameter p in model.Parameters)
            {
                // Instantiate from template.
                GameObject newParam = (GameObject)Instantiate(paramEntryTemplate);
                newParam.transform.SetParent(paramScrollContent.transform);
                newParam.SetActive(true);
                newParam.name = p.Id;

                // Set slider values.
                Slider s = newParam.GetComponentInChildren <Slider>();
                s.maxValue = p.MaximumValue;
                s.minValue = p.MinimumValue;
                s.value    = p.Value;

                // Set text fields.
                Text t = newParam.GetComponentsInChildren <Text>()[3];
                newParam.GetComponentsInChildren <Text>()[0].text = p.Id;
                newParam.GetComponentsInChildren <Text>()[1].text = p.MinimumValue.ToString();
                newParam.GetComponentsInChildren <Text>()[2].text = p.MaximumValue.ToString();
                t.text = p.Value.ToString();

                Toggle to  = newParam.GetComponentInChildren <Toggle>();
                Image  img = newParam.GetComponent <Image>();

                // Create list of all CubismParameters and their respective UI elements/override state.
                CubismParameterInfo param = new CubismParameterInfo(p, to, t, img, s, false, false, p.Value);
                CubismParamsInfo.Add(param);

                // Listeners for slider and toggle button.
                to.onValueChanged.AddListener(delegate(bool newValue) { ParamActiveStatusChanged(newValue, param); });
                s.onValueChanged.AddListener(delegate(float newValue) { ParamValueChanged(newValue, param); });
            }

            // HACK Manually set scroll content height to height of children. Correct way to do this?
            int paramEntryHeight = (int)((RectTransform)paramEntryTemplate.transform).rect.height * model.Parameters.Length;

            ((RectTransform)paramScrollContent.transform).sizeDelta = new Vector2(0, paramEntryHeight);
        }
 /// <summary>
 /// Customizes model importing.
 /// </summary>
 /// <param name="sender">Event source.</param>
 /// <param name="model">Imported model.</param>
 private static void OnModelImport(CubismModel3JsonImporter sender, CubismModel model)
 {
     // Lets pretend we want to change the vertex colors of all drawables to green...
     foreach (var renderer in model.Drawables.Select(d => d.GetComponent <CubismRenderer>()))
     {
         renderer.color = Color.green;
     }
 }
    void Start()
    {
        _model = this.FindCubismModel();

        _param = _model.Parameters.FindById(ParameterID);

        Debug.Log(_param.Value);
    }
 protected override CubismSprite CreateSprite(CubismModel model, IEnumerable <Texture> textures) => new CubismSpriteWithEyeblinkEffect(model, textures)
 {
     Canvas = new CanvasOptions
     {
         Y     = 1.75f,
         Scale = 7.5f,
         RelativePositionAxes = Axes.Y,
     }
 };
Beispiel #17
0
    // Use this for initialization
    void Start()
    {
        _model = this.FindCubismModel();

        udp = new UdpClient(PORT);
        udp.Client.ReceiveTimeout = 0xFFFFFFF;
        thread = new Thread(new ThreadStart(ThreadMethod));
        thread.Start();
    }
        /// <summary>
        /// update hidden part opacity.
        /// </summary>
        public void Refresh()
        {
            _model = this.FindCubismModel();

            // Fail silently...
            if (_model == null)
            {
                return;
            }

            var tags = _model
                       .Parts
                       .GetComponentsMany <CubismPosePart>();

            for (var i = 0; i < tags.Length; ++i)
            {
                var groupIndex = tags[i].GroupIndex;
                var partIndex  = tags[i].PartIndex;

                if (_poseData == null || _poseData.Length <= groupIndex)
                {
                    Array.Resize(ref _poseData, groupIndex + 1);
                }

                if (_poseData[groupIndex] == null || _poseData[groupIndex].Length <= partIndex)
                {
                    Array.Resize(ref _poseData[groupIndex], partIndex + 1);
                }

                _poseData[groupIndex][partIndex].PosePart = tags[i];
                _poseData[groupIndex][partIndex].Part     = tags[i].GetComponent <CubismPart>();

                defaultPoseIndex = (defaultPoseIndex < 0) ? 0 : defaultPoseIndex;
                if (partIndex != defaultPoseIndex)
                {
                    _poseData[groupIndex][partIndex].Part.Opacity = 0.0f;
                }

                _poseData[groupIndex][partIndex].Opacity = _poseData[groupIndex][partIndex].Part.Opacity;

                if (tags[i].Link == null || tags[i].Link.Length == 0)
                {
                    continue;
                }

                _poseData[groupIndex][partIndex].LinkParts = new CubismPart[tags[i].Link.Length];

                for (var j = 0; j < tags[i].Link.Length; ++j)
                {
                    var linkId = tags[i].Link[j];
                    _poseData[groupIndex][partIndex].LinkParts[j] = _model.Parts.FindById(linkId);
                }
            }

            // Get cubism update controller.
            _hasUpdateController = (GetComponent <CubismUpdateController>() != null);
        }
        /// <summary>
        /// Initialize expression data from <see cref="CubismExpressionData"/>.
        /// </summary>
        /// <param name="model">model.</param>
        /// <param name="expressionData">Source.</param>
        public static CubismPlayingExpression Create(CubismModel model, CubismExpressionData expressionData)
        {
            // Fail silently...
            if (model == null || expressionData == null)
            {
                return(null);
            }

            var ret = new CubismPlayingExpression();

            ret.Type = expressionData.Type;

            ret.FadeInTime = (expressionData.FadeInTime <= 0.0f)
                                ? 1.0f
                                : expressionData.FadeInTime;

            ret.FadeOutTime = (expressionData.FadeOutTime <= 0.0f)
                                ? 1.0f
                                : expressionData.FadeOutTime;

            ret.Weight             = 0.0f;
            ret.ExpressionUserTime = 0.0f;
            ret.ExpressionEndTime  = 0.0f;

            var parameterCount = expressionData.Parameters.Length;

            ret.Destinations = new CubismParameter[parameterCount];
            ret.Value        = new float[parameterCount];
            ret.Blend        = new CubismParameterBlendMode[parameterCount];

            for (var i = 0; i < parameterCount; ++i)
            {
                ret.Destinations[i] = model.Parameters.FindById(expressionData.Parameters[i].Id);
                ret.Value[i]        = expressionData.Parameters[i].Value;
                switch (expressionData.Parameters[i].Blend)
                {
                case "Add":
                    ret.Blend[i] = CubismParameterBlendMode.Additive;
                    break;

                case "Multiply":
                    ret.Blend[i] = CubismParameterBlendMode.Multiply;
                    break;

                case "Overwrite":
                    ret.Blend[i] = CubismParameterBlendMode.Override;
                    break;

                default:
                    ret.Blend[i] = CubismParameterBlendMode.Additive;
                    break;
                }
            }

            return(ret);
        }
        /// <summary>
        /// Safely triggers <see cref="OnDidImportModel"/>.
        /// </summary>
        /// <param name="importer">Importer.</param>
        /// <param name="model">Imported model.</param>
        internal static void SendModelImportEvent(CubismModel3JsonImporter importer, CubismModel model)
        {
            if (OnDidImportModel == null)
            {
                return;
            }


            OnDidImportModel(importer, model);
        }
        private static void CopyUserData(CubismModel source, CubismModel destination, bool copyComponentsOnly = false)
        {
            // Give parameters, parts, and drawables special treatment.
            CopyUserData(source.Parameters, destination.Parameters, copyComponentsOnly);
            CopyUserData(source.Parts, destination.Parts, copyComponentsOnly);
            CopyUserData(source.Drawables, destination.Drawables, copyComponentsOnly);


            // Copy children if copy all.
            if (!copyComponentsOnly)
            {
                foreach (var child in source.transform
                         .GetComponentsInChildren <Transform>()
                         .Where(t => t != source.transform)
                         .Select(t => t.gameObject))
                {
                    // Skip parameters, parts, and drawables.
                    if (child.name == "Parameters")
                    {
                        continue;
                    }

                    if (child.name == "Parts")
                    {
                        continue;
                    }

                    if (child.name == "Drawables")
                    {
                        continue;
                    }


                    Object.Instantiate(child, destination.transform);
                }
            }


            // Copy components.
            foreach (var sourceComponent in source.GetComponents(typeof(Component)))
            {
                // Skip non-movable components.
                if (!sourceComponent.MoveOnCubismReimport(copyComponentsOnly))
                {
                    continue;
                }


                // Copy component.
                var destinationComponent = destination.GetOrAddComponent(sourceComponent.GetType());


                EditorUtility.CopySerialized(sourceComponent, destinationComponent);
            }
        }
 public void SetPosing(CubismModel target, float weight = 1f)
 {
     foreach (KeyValuePair <string, float> e in setting)
     {
         var param = target.Parameters.FindById(e.Key);
         if (param != null)
         {
             param.SetToValue(e.Value, weight);
         }
     }
 }
Beispiel #23
0
 public void Reset(CubismModel root)
 {
     foreach (var x in Values)
     {
         var parameter = root.Parameters[x.Index];
         if (parameter != null)
         {
             parameter.Value = parameter.DefaultValue;
         }
     }
 }
Beispiel #24
0
 public virtual void Refresh()
 {
     SettingSide();
     model = GetComponent <CubismModel>();
     if (model == null)
     {
         model = GetComponentInParent <CubismModel>();
     }
     leapmotionInputer = GameObject.FindObjectOfType <LeapmotionInputer>();
     Debug.Log("LMHandControllBase : Start()");
 }
Beispiel #25
0
 public static void DemosaicHook(CubismModel __instance)
 {
     foreach (var renderer in __instance.gameObject.GetComponentsInChildren <MeshRenderer>())
     {
         if (renderer != null && renderer.material != null && MozaicTools.IsMozaicName(renderer.material.name))
         {
             _instance.Logger.Log(LogLevel.Info, $"Removing mozaic material from renderer {renderer.transform.name}");
             renderer.material = null;
             renderer.enabled  = false;
         }
     }
 }
Beispiel #26
0
 public void Apply(CubismModel root, float value)
 {
     foreach (var x in Values)
     {
         var parameter = root.Parameters[x.Index];
         if (parameter != null)
         {
             var target = Mathf.Lerp(parameter.DefaultValue, x.Weight, value);
             parameter.Value = Mathf.Clamp(target, parameter.MinimumValue, parameter.MaximumValue);
         }
     }
 }
Beispiel #27
0
    public void SelectModel(int modelIndex)
    {
        currentModelType = (ModelInfos.Type)modelIndex;

        foreach (GameObject obj in modelObjects)
        {
            obj.SetActive(false);
        }

        cubismModel = modelObjects[modelIndex].GetComponent <CubismModel>();
        modelObjects[modelIndex].SetActive(true);
    }
        public CubismRendererOpenGL(ShaderManager shaders, CubismModel model, IEnumerable <Texture> textures)
            : base(model, textures)
        {
            this.shaders.Add(shaders.Load(@"VertShaderSrcSetupMask", @"FragShaderSrcSetupMask"));

            this.shaders.Add(shaders.Load(@"VertShaderSrc", @"FragShaderSrc"));
            this.shaders.Add(shaders.Load(@"VertShaderSrcMasked", @"FragShaderSrcMask"));
            this.shaders.Add(shaders.Load(@"VertShaderSrcMasked", @"FragShaderSrcMaskInverted"));
            this.shaders.Add(shaders.Load(@"VertShaderSrc", @"FragShaderSrcPremultipliedAlpha"));
            this.shaders.Add(shaders.Load(@"VertShaderSrcMasked", @"FragShaderSrcMaskPremultipliedAlpha"));
            this.shaders.Add(shaders.Load(@"VertShaderSrcMasked", @"FragShaderSrcMaskInvertedPremultipliedAlpha"));
        }
 public CubismSpriteWithMotion(CubismModel model, IEnumerable <Texture> textures, bool disposeModel = false)
     : base(model, textures, disposeModel)
 {
     using var reader = new StreamReader(TestResources.GetModelResource(@"motions/Hiyori_m02.motion3.json"));
     motion           = new CubismMotion(model, JsonSerializer.Deserialize <CubismMotionSetting>(reader.ReadToEnd()))
     {
         Weight               = 1.0,
         LoopFading           = true,
         GlobalFadeInSeconds  = 0.5,
         GlobalFadeOutSeconds = 0.5,
     };
 }
Beispiel #30
0
    void Start()
    {
        //Load model.
        var path       = Application.streamingAssetsPath + "/18-8-18_Live2d_MeidoChan.model3.json";
        var model3Json = CubismModel3Json.LoadAtPath(path, BuiltinLoadAssetAtPath);

        model = model3Json.ToModel();


        model.transform.localScale = new Vector3(1.3F, 1.3F, 1);
        model.transform.position   = new Vector3(-0.2F, -0.5F, 0);
    }