Esempio n. 1
0
        protected override void onAwake()
        {
            avatarService = Service.Get <AvatarService>();
            Rig component = GetComponent <Rig>();
            SkinnedMeshDefinition skinnedMeshDefinition = new SkinnedMeshDefinition(UseGpuSkinning);

            skinnedMeshDefinition.RootBoneName = component.RootBone.name;
            skinnedMeshDefinition.BoneNames    = new string[component.Bones.Length];
            for (int i = 0; i < component.Bones.Length; i++)
            {
                skinnedMeshDefinition.BoneNames[i] = component.Bones[i].name;
            }
            meshDef = skinnedMeshDefinition;
            rend    = meshDef.CreateRenderer(base.gameObject);
            Model.Definition.RenderProperties.Apply(rend);
        }
Esempio n. 2
0
        public void SetupRenderer(GameObject gameObject, AvatarModel model, ref Renderer rend)
        {
            if (rend == null)
            {
                rend = MeshDef.CreateRenderer(gameObject);
                model.Definition.RenderProperties.Apply(rend);
            }
            Material material = GetMaterial();
            BodyColorMaterialProperties bodyColorMaterialProperties = new BodyColorMaterialProperties(model.BeakColor, model.BellyColor, model.BodyColor);

            bodyColorMaterialProperties.Apply(material);
            ApplyMaterialProperties(material);
            ComponentExtensions.DestroyIfInstance(rend.sharedMaterial);
            rend.sharedMaterial = material;
            MeshDef.ApplyMesh(gameObject);
        }