public MainVisual(IRenderState renderState, IContentLoader contentLoader) { renderState.Set(new ClearColorState(1, 1, 1, 1)); renderState.Set(new DepthTest(true)); renderState.Set(new FaceCullingModeState(FaceCullingMode.BACK_SIDE)); var envMap = contentLoader.Load <ITexture2D>("beach"); envMap.WrapFunction = TextureWrapFunction.MirroredRepeat; envMap.Filter = TextureFilterMode.Linear; var textureBinding = new TextureBinding[] { new TextureBinding(nameof(envMap), envMap) }; var sphere = Meshes.CreateSphere(1f, 4); var skySphere = sphere.Transform(Transformation.Scale(200f)).SwitchTriangleMeshWinding(); var shaderBackground = contentLoader.Load <IShaderProgram>("background.*"); visuals.Add(new MeshVisual(skySphere, shaderBackground, textureBinding)); #if SOLUTION var shaderEnvMap = contentLoader.Load <IShaderProgram>("envMapping.*"); var visSphere = new MeshVisual(sphere, shaderEnvMap, textureBinding); visSphere.SetUniform("reflective", 1f); visuals.Add(visSphere); var suzanne = contentLoader.Load <DefaultMesh>("suzanne"); var visSuzanne = new MeshVisual(suzanne.Transform(Transformation.Translation(0, -1.5f, 0)), shaderEnvMap, textureBinding); visSuzanne.SetUniform("reflective", 0.4f); visuals.Add(visSuzanne); #endif }
/// <summary> /// /// </summary> /// <param name="resid"></param> public void SetupWeapon(int resid) { if (!DataManager.WeaponTable.ContainsKey(resid)) { return; } WeaponTableItem weaponTab = DataManager.WeaponTable[resid] as WeaponTableItem; if (weaponTab == null) { GameDebug.LogError(" WeaponTable没有找到武器 id = " + resid.ToString()); return; } if (resid != mResid) { if (mWeapon != null) { mWeapon.Destroy(); } mResid = resid; mWeapon = new MeshVisual(); mWeapon.CreateWithConfig(AssetConfig.WeaponPath + weaponTab.modelname, OnVisualSuccess, OnVisualFailed, false); } }
virtual protected bool ChangeModel(int model) { if (model == -1) { return(false); } if (!DataManager.ModelTable.ContainsKey(model)) { return(false); } ModelTableItem modelTab = DataManager.ModelTable[model] as ModelTableItem; if (modelTab == null) { GameDebug.LogError(dbgGetIdentifier() + " 没有找到模型 id = " + model.ToString()); return(false); } DestroyVisual(); mModelResID = model; mVisual = new MeshVisual(); mVisual.CreateWithConfig(modelTab.filename, onVisualSucess, onVisualFail, true); return(true); }
public uint AttachEffect(int id, string mountname) { if (!DataManager.EffectTable.ContainsKey(id)) { return(uint.MaxValue); } EffectTableItem effectitem = DataManager.EffectTable[id] as EffectTableItem; bool nullmount = string.IsNullOrEmpty(mountname); MeshVisual attachparent = mVisual; if (!nullmount) { if (mountname[0] == '%') { attachparent = mWeapon; } mountname = mountname.Substring(1); } Transform bone = attachparent.GetBoneByName(mountname); if (bone == null) { bone = attachparent.VisualTransform; } TransformData trans = new TransformData(); trans.Scale = Vector3.one * effectitem.scale; trans.notFollow = effectitem.notFollow; return(SceneManager.Instance.GetCurScene().GetParticleManager().AddParticle(effectitem.effect_name, effectitem.loop, bone, trans, effectitem.limitry)); }
public void ChangeAttach(AttachMountType type, string path, string mount) { MeshVisual visual = new MeshVisual(); visual.CreateWithConfig(path, null, null, false); ChangeAttach(type, visual, mount); }
public void SetupWing(int resid) { if (!DataManager.WingCommonTable.ContainsKey(resid)) { return; } WingCommonTableItem wingtable = DataManager.WingCommonTable[resid] as WingCommonTableItem; if (wingtable == null) { GameDebug.LogError("WingTable 没有找到 id = " + resid.ToString()); return; } if (resid != mResid) { if (mWing != null) { mWing.Destroy(); } mResid = resid; mWing = new MeshVisual(); WingItemData itemData = PlayerDataPool.Instance.MainData.mWingData.GetWingItemDataById(mResid); string modleName = WingModule.GetModelName(itemData.id, itemData.level); //mWing.CreateWithConfig(AssetConfig.WeaponPath + modleName, } }
protected virtual void DestroyVisual() { if (mVisual != null) { mVisual.Destroy(); mVisual = null; } }
public override void Destroy() { if (mWing != null) { mWing.Destroy(); } mWing = null; base.Destroy(); }
public override void Destroy() { if (mWeapon != null) { mWeapon.Destroy(); } mWeapon = null; base.Destroy(); }
/// <summary> /// 对玩家, 只改变模型; 其他单位模型和武器技能都被改变. /// </summary> public override bool ChangeWeapon(int weaponID) { if (!CanChangeWeapon() || mActiveFlagsContainer[ActiveFlagsDef.DisableChangeWeaponModel] != 0) { return(false); } if (weaponID == -1) { return(false); } //测试武器 if (!DataManager.WeaponTable.ContainsKey(weaponID)) { GameDebug.LogError(dbgGetIdentifier() + " not find weapon id=" + weaponID.ToString()); return(false); } if (mWeaponAttach != null) { DetachVisual(mWeaponAttach); mWeaponAttach.visual.Destroy(); mWeaponAttach = null; } RemoveAttach(AttachMountType.Weapon); if (mWeaponVisual != null) { mWeaponVisual.Destroy(); mWeaponVisual = null; } if (mLastWeaponBuffID != uint.MaxValue) { ErrorHandler.Parse( RemoveSkillBuffByResID(mLastWeaponBuffID), "failed to remove skill buff on skill stopped" ); mLastWeaponBuffID = uint.MaxValue; } mWeaopnRes = DataManager.WeaponTable[weaponID] as WeaponTableItem; mWeaponVisual = new MeshVisual(); if (string.IsNullOrEmpty(mWeaopnRes.modelname)) { onWeaponVisualSucess(); } else { mWeaponVisual.CreateWithConfig(AssetConfig.WeaponPath + mWeaopnRes.modelname, onWeaponVisualSucess, onWeaponVisualFail, false); } return(true); }
public void MeshVisualConstructor() { tlog.Debug(tag, $"MeshVisualConstructor START"); var testingTarget = new MeshVisual(); Assert.IsNotNull(testingTarget, "Can't create success object MeshVisual"); Assert.IsInstanceOf <MeshVisual>(testingTarget, "Should be an instance of MeshVisual type."); testingTarget.Dispose(); tlog.Debug(tag, $"MeshVisualConstructor END (OK)"); }
public static uint AddEffect2MV(MeshVisual visual, int effectid, string mount, SceneParticleManager mng) { if (!DataManager.EffectTable.ContainsKey(effectid)) { return(uint.MaxValue); } if (!string.IsNullOrEmpty(mount)) { mount = mount.Replace("%", ""); } EffectTableItem item = DataManager.EffectTable[effectid] as EffectTableItem; if (item == null) { return(uint.MaxValue); } Transform trans = visual.GetBoneByName(mount); if (trans == null) { trans = visual.VisualTransform; } TransformData data = new TransformData(); data.notFollow = item.notFollow; data.Scale = new Vector3(item.scale, item.scale, item.scale); //不跟随释放者的特效,取挂点的方向 if (item.notFollow && trans != null) { if (trans != null) { data.Rot = trans.rotation.eulerAngles; } else { data.Rot = Vector3.zero; } } if (!string.IsNullOrEmpty(item.soundId)) { string[] array = item.soundId.Split('|'); SoundManager.Instance.Play( int.Parse(array[UnityEngine.Random.Range(0, array.Length)]), item.soundDelay ); } return(mng.AddParticle(item.effect_name, item.loop, trans, data, item.limitry)); }
public void btnCreatePlayer() { //PlayerInitParam param = new PlayerInitParam(); //param.player_data = new PlayerData(); //param.player_data.classs = 1; //player = new Player(); //player.Init(param); //player.LoadModel(); MeshVisual visual = new MeshVisual(); visual.CreateWithConfig("role_male_roledefault", null, null); }
public void MeshVisualShadingMode() { tlog.Debug(tag, $"MeshVisualShadingMode START"); var testingTarget = new MeshVisual(); Assert.IsNotNull(testingTarget, "Can't create success object MeshVisual"); Assert.IsInstanceOf <MeshVisual>(testingTarget, "Should be an instance of MeshVisual type."); testingTarget.ShadingMode = MeshVisualShadingModeValue.TexturedWithDetailedSpecularLighting; Assert.AreEqual(MeshVisualShadingModeValue.TexturedWithDetailedSpecularLighting, testingTarget.ShadingMode, "Retrieved ShadingMode should be equal to set value"); testingTarget.Dispose(); tlog.Debug(tag, $"MeshVisualShadingMode END (OK)"); }
public void Resize(int width, int height) { var texNormalMaterial = Texture2dGL.Create(width, height, 4, true); var texPosition = Texture2dGL.Create(width, height, 4, true); mrtSurface = new FBOwithDepth(texNormalMaterial); mrtSurface.Attach(texPosition); var bindings = new List <TextureBinding>() { new TextureBinding(nameof(texNormalMaterial), texNormalMaterial), new TextureBinding(nameof(texPosition), texPosition), }; lightsVisual = new MeshVisual(lightsVisual.Drawable, lightsVisual.ShaderProgram, bindings); }
public void MeshVisualUseSoftNormals() { tlog.Debug(tag, $"MeshVisualUseSoftNormals START"); var testingTarget = new MeshVisual(); Assert.IsNotNull(testingTarget, "Can't create success object MeshVisual"); Assert.IsInstanceOf <MeshVisual>(testingTarget, "Should be an instance of MeshVisual type."); testingTarget.UseSoftNormals = true; Assert.AreEqual(true, testingTarget.UseSoftNormals, "Retrieved UseSoftNormals should be equal to set value"); testingTarget.Dispose(); tlog.Debug(tag, $"MeshVisualUseSoftNormals END (OK)"); }
public void Destroy() { if (mVisual != null) { mVisual.Destroy(); mVisual = null; } if (mWeapon != null) { mWeapon.Destroy(); mWeapon = null; } mCharacter = null; }
public void MeshVisualTexturesPath() { tlog.Debug(tag, $"MeshVisualTexturesPath START"); var testingTarget = new MeshVisual(); Assert.IsNotNull(testingTarget, "Can't create success object MeshVisual"); Assert.IsInstanceOf <MeshVisual>(testingTarget, "Should be an instance of MeshVisual type."); string url = "TexturesPath"; testingTarget.TexturesPath = url; Assert.AreEqual(url, testingTarget.TexturesPath, "Retrieved TexturesPath should be equal to set value"); testingTarget.Dispose(); tlog.Debug(tag, $"MeshVisualTexturesPath END (OK)"); }
public void MeshVisualMaterialtURL() { tlog.Debug(tag, $"MeshVisualMaterialtURL START"); var testingTarget = new MeshVisual(); Assert.IsNotNull(testingTarget, "Can't create success object MeshVisual"); Assert.IsInstanceOf <MeshVisual>(testingTarget, "Should be an instance of MeshVisual type."); string url = "MaterialtURL"; testingTarget.MaterialtURL = url; Assert.AreEqual(url, testingTarget.MaterialtURL, "Retrieved MaterialtURL should be equal to set value"); testingTarget.Dispose(); tlog.Debug(tag, $"MeshVisualMaterialtURL END (OK)"); }
public MainVisual(IRenderContext renderContext, IContentLoader contentLoader) { renderContext.RenderState.Set(new DepthTest(true)); renderContext.RenderState.Set(new FaceCullingModeState(FaceCullingMode.BACK_SIDE)); var mesh = Meshes.CreatePlane(2, 2, 1024, 1024); var texHeightfield = contentLoader.Load <ITexture2D>("mountain_height"); var bindings = new TextureBinding[] { new TextureBinding("texHeightfield", texHeightfield), new TextureBinding("texColor", contentLoader.Load <ITexture2D>("mountain_color")), new TextureBinding("texStone", contentLoader.Load <ITexture2D>("stone")), }; var shaderProgram = contentLoader.Load <IShaderProgram>("shader.*"); mountain = new MeshVisual(mesh, shaderProgram, bindings); }
public void SetupCharacter(int resid, int[] equiplist, int wingid, uint winglevel) { if (!DataManager.ModelTable.ContainsKey(resid)) { return; } ModelTableItem modelTab = DataManager.ModelTable[resid] as ModelTableItem; if (modelTab == null) { GameDebug.LogError(" DataManager没有找到模型 id = " + resid.ToString()); return; } if (resid != mResid) { if (mVisual != null) { mVisual.Destroy(); } mResid = resid; mVisual = new MeshVisual(); mVisual.CreateWithConfig(modelTab.filename, OnVisualSuccess, OnVisualFailed, true); } else { mInvalidAnim = true; } //切换装备 //TODO:装备相关的表和数据都还没有做好,做好了在这里处理 ApplyEquipConfig(equiplist); if (wingid < 0) { RemoveAttach(AttachMountType.Wing); } else { ChangeWing(wingid, winglevel); } }
public void MeshVisualLightPosition() { tlog.Debug(tag, $"MeshVisualLightPosition START"); var testingTarget = new MeshVisual(); Assert.IsNotNull(testingTarget, "Can't create success object MeshVisual"); Assert.IsInstanceOf <MeshVisual>(testingTarget, "Should be an instance of MeshVisual type."); using (Vector3 vector3 = new Vector3(1.0f, 1.0f, 1.0f)) { testingTarget.LightPosition = vector3; Assert.AreEqual(1.0f, testingTarget.LightPosition.X, "Retrieved LightPosition.X should be equal to set value"); Assert.AreEqual(1.0f, testingTarget.LightPosition.Y, "Retrieved LightPosition.Y should be equal to set value"); Assert.AreEqual(1.0f, testingTarget.LightPosition.Z, "Retrieved LightPosition.Z should be equal to set value"); } testingTarget.Dispose(); tlog.Debug(tag, $"MeshVisualLightPosition END (OK)"); }
public MainVisual(IRenderState renderState, IContentLoader contentLoader) { this.renderState = renderState; var shaderMaterial = contentLoader.Load <IShaderProgram>("material.*"); var plane = Meshes.CreatePlane(4, 4, 1, 1); meshVisuals.Add(new MeshVisual(plane, shaderMaterial)); var instanceMesh = contentLoader.Load <DefaultMesh>("suzanne").Transform(Transformation.Scale(0.03f)); var instanceData = CreateInstancePositionMaterial(20, 20); var suzanneInstances = VAOLoader.FromMesh(instanceMesh, shaderMaterial); suzanneInstances.SetAttribute(shaderMaterial.GetResourceLocation(ShaderResourceType.Attribute, nameof(instanceData)), instanceData, true); meshVisuals.Add(new MeshVisual(suzanneInstances, shaderMaterial)); var shaderLighting = contentLoader.Load <IShaderProgram>("lighting.*"); var lightMesh = Meshes.CreateSphere(1f, 2); // either make it bigger or you need good subdivision to avoid border artifacts var lightGeometry = VAOLoader.FromMesh(lightMesh, shaderLighting); lightGeometry.SetAttribute(shaderLighting.GetResourceLocation(ShaderResourceType.Attribute, "lightData"), instanceData, true); lightsVisual = new MeshVisual(lightGeometry, shaderLighting); }
public void ChangeWing(int wingid, uint winglv) { if (mWingID == wingid && mWingLv == winglv) { return; } mWingID = wingid; mWingLv = winglv; WingCommonTableItem commonRes = DataManager.WingCommonTable[wingid] as WingCommonTableItem; if (commonRes == null) { return; } string modelName = WingModule.GetModelName(wingid, winglv); MeshVisual visual = new MeshVisual(); visual.CreateWithConfig(AssetConfig.WeaponPath + modelName, null, null, false); ChangeAttach(AttachMountType.Wing, visual, commonRes.modelSlot); }
public override void PlayWingAnim(string statename) { AttachMent attach = GetAttach(AttachMountType.Wing); if (attach == null) { return; } MeshVisual wingVisual = attach.visual as MeshVisual; if (wingVisual != null && wingVisual.AnimManager != null && wingVisual.AnimManager.Property != null) { int stateid = wingVisual.AnimManager.Property.GetStateHash(statename); if (stateid == 0) { stateid = wingVisual.AnimManager.Property.GetStateHash("Base Layer.emptyState"); } wingVisual.AnimManager.Anim.SetInteger("state", stateid); } }
public void ChangeWeapon(int weaponid) { if (weaponid == mWeaponID) { return; } BehaviourUtil.StopCoroutine(ChangeWeapon_impl(mWeaponID)); if (!DataManager.WeaponTable.ContainsKey(weaponid)) { return; } if (mWeapon != null) { mWeapon.Destroy(); } foreach (uint effectid in mShowEffect) { SceneManager.Instance.GetCurScene().GetParticleManager().RemoveParticle(effectid); } mShowEffect.Clear(); mWeaponID = weaponid; //BehaviourUtil.StartCoroutine(ChangeWeapon_impl(weaponid)); WeaponTableItem mWeaopnRes = DataManager.WeaponTable[weaponid] as WeaponTableItem; mWeapon = new MeshVisual(); mWeapon.CreateWithConfig(AssetConfig.WeaponPath + mWeaopnRes.modelname, null, OnWeaponFailed, false); TransformData trans = new TransformData(); trans.Rot = new Vector3(90, 0, 0); trans.Scale = Vector3.one * mWeaopnRes.scale; ChangeAttach(AttachMountType.Weapon, mWeapon, mWeaopnRes.mountpoint, trans); }
private IEnumerator ChangeWeapon_impl(int weaponid) { WeaponTableItem mWeaopnRes = DataManager.WeaponTable[weaponid] as WeaponTableItem; if (mWeapon != null) { mWeapon.Destroy(); } if (mWeaopnRes == null) { yield break; } while (mVisual == null || !mVisual.IsCompleteOrDestroy) { yield return(1); } mChangingWeaponID = weaponid; mWeapon = new MeshVisual(); mWeapon.CreateWithConfig(AssetConfig.WeaponPath + mWeaopnRes.modelname, OnWeaponSuccess, OnWeaponFailed, false); }
private void UpdateWingAnim(uint elapsed) { AttachMent attach = GetAttach(AttachMountType.Wing); if (attach == null) { return; } MeshVisual wingVisual = attach.visual as MeshVisual; if (wingVisual != null && wingVisual.AnimManager != null && wingVisual.AnimManager.Property != null) { AnimatorStateInfo info = wingVisual.AnimManager.Anim.GetCurrentAnimatorStateInfo(0); if (!info.IsName(AnimationNameDef.WingDefault) && !info.IsName(AnimationNameDef.WingEmpty) && info.normalizedTime >= 1 && !info.loop) { int stateid = wingVisual.AnimManager.Property.GetStateHash(AnimationNameDef.WingDefault); if (stateid == 0) { stateid = wingVisual.AnimManager.Property.GetStateHash(AnimationNameDef.WingEmpty); } wingVisual.AnimManager.Anim.SetInteger("state", stateid); } mWaveWingTime += elapsed; if (mWaveWingTime >= GameConfig.WaveWingFrequency * 1000 && (info.IsName(AnimationNameDef.WingDefault) || info.IsName(AnimationNameDef.WingEmpty))) { mWaveWingTime = 0; int stateid = wingVisual.AnimManager.Property.GetStateHash(AnimationNameDef.WingFei); if (stateid != 0) { wingVisual.AnimManager.Anim.SetInteger("state", stateid); } } } }
/// <summary> /// The method to create visual map for different kinds of primitives /// </summary> /// <param name="visualType"> The Visual type </param> /// <returns> The VisualMap to the Visual of the given type </returns> private VisualMap CreateVisualMap(string visualType) { VisualMap ThisVisualMap = null; switch (visualType) { case "Border": BorderVisual ThisBorderVisual = new BorderVisual(); /// obligatory properties ThisBorderVisual.Color = Color.Blue; ThisBorderVisual.BorderSize = 15.0f; ThisVisualMap = ThisBorderVisual; break; case "Color": ColorVisual ThisColorVisual = new ColorVisual(); /// obligatory properties ThisColorVisual.MixColor = new Color(0.2f, 0.0f, 1.0f, 0.7f); /// optional properties ThisColorVisual.CornerRadius = 35.0f; ThisVisualMap = ThisColorVisual; break; case "RadialGradient": GradientVisual ThisRadialGradientVisual = new GradientVisual(); /// obligatory properties /// coordinate system: top-left - (-0.5,-0.5); bottom-right - (0.5,0.5) ThisRadialGradientVisual.Center = new Vector2(0.0f, 0.0f); ThisRadialGradientVisual.Radius = 0.9f; /// optional properties PropertyArray ThisStopColor = new PropertyArray(); ThisStopColor.Add(new PropertyValue(Color.Yellow)); ThisStopColor.Add(new PropertyValue(Color.Blue)); ThisStopColor.Add(new PropertyValue(new Color(0.0f, 1.0f, 0.0f, 1.0f))); ThisStopColor.Add(new PropertyValue(new Vector4(120.0f, 0.0f, 255.0f, 255.0f) / 255.0f)); ThisRadialGradientVisual.StopColor = ThisStopColor; PropertyArray ThisStopOffset = new PropertyArray(); ThisStopOffset.Add(new PropertyValue(0.0f)); ThisStopOffset.Add(new PropertyValue(0.2f)); ThisStopOffset.Add(new PropertyValue(0.4f)); ThisStopOffset.Add(new PropertyValue(0.6f)); ThisRadialGradientVisual.StopOffset = ThisStopOffset; ThisVisualMap = ThisRadialGradientVisual; break; case "LinearGradient": GradientVisual ThisLinearGradientVisual = new GradientVisual(); /// obligatory properties /// coordinate system: top-left - (-0.5,-0.5); bottom-right - (0.5,0.5) ThisLinearGradientVisual.StartPosition = new Vector2(-0.5f, 0.5f); ThisLinearGradientVisual.EndPosition = new Vector2(0.5f, -0.5f); /// optional properties ThisLinearGradientVisual.StopColor = new PropertyArray(); ThisLinearGradientVisual.StopColor.Add(new PropertyValue(Color.Green)); ThisLinearGradientVisual.StopColor.Add(new PropertyValue(Color.Blue)); ThisVisualMap = ThisLinearGradientVisual; break; case "Image": ImageVisual ThisImageVisual = new ImageVisual(); /// obligatory properties ThisImageVisual.URL = ImageUrl + "belt.jpg"; /// optional properties ThisImageVisual.Origin = Visual.AlignType.TopBegin; ThisImageVisual.AnchorPoint = Visual.AlignType.TopBegin; ThisImageVisual.RelativePosition = new RelativeVector2(0.1f, 0.1f); ThisVisualMap = ThisImageVisual; break; case "NPatch": NPatchVisual ThisNPatchVisual = new NPatchVisual(); /// obligatory properties ThisNPatchVisual.URL = ImageUrl + "heartsframe.png"; /// optional properties (for all visual types) ThisNPatchVisual.Origin = Visual.AlignType.Center; ThisNPatchVisual.AnchorPoint = Visual.AlignType.Center; ThisNPatchVisual.RelativePosition = new RelativeVector2(0.0f, 0.0f); ThisVisualMap = ThisNPatchVisual; break; case "SVG": SVGVisual ThisSvgVisual = new SVGVisual(); /// obligatory properties ThisSvgVisual.URL = ImageUrl + "tiger.svg"; /// optional properties (for all visual types) ThisSvgVisual.Origin = Visual.AlignType.BottomBegin; ThisSvgVisual.AnchorPoint = Visual.AlignType.BottomBegin; ThisSvgVisual.RelativePosition = new RelativeVector2(0.1f, -0.1f); ThisVisualMap = ThisSvgVisual; break; case "Animated": AnimatedImageVisual ThisAnimatedVisual = new AnimatedImageVisual(); /// obligatory properties ThisAnimatedVisual.URL = ImageUrl + "buble.gif"; /// optional properties (for all visual types) ThisAnimatedVisual.Origin = Visual.AlignType.TopEnd; ThisAnimatedVisual.AnchorPoint = Visual.AlignType.TopEnd; ThisAnimatedVisual.RelativePosition = new RelativeVector2(-0.1f, 0.1f); ThisVisualMap = ThisAnimatedVisual; break; case "Mesh": MeshVisual ThisMeshVisual = new MeshVisual(); /// obligatory properties ThisMeshVisual.ObjectURL = ImageUrl + "Dino.obj"; ThisMeshVisual.MaterialtURL = ImageUrl + "Dino.mtl"; ThisMeshVisual.TexturesPath = ImageUrl + "textures/"; /// optional properties (for all visual map types) ThisMeshVisual.Origin = Visual.AlignType.BottomEnd; ThisMeshVisual.AnchorPoint = Visual.AlignType.BottomEnd; ThisMeshVisual.RelativePosition = new RelativeVector2(0, -0.03f); ThisVisualMap = ThisMeshVisual; break; } /// properties common for visuals groups switch (visualType) { case "Border": case "Color": case "RadialGradient": case "LinearGradient": ThisVisualMap.RelativeSize = new RelativeVector2(0.3f, 0.2f); ThisVisualMap.Origin = Visual.AlignType.TopBegin; ThisVisualMap.AnchorPoint = Visual.AlignType.TopBegin; break; case "Image": case "NPatch": case "SVG": case "Animated": ThisVisualMap.RelativeSize = new RelativeVector2(ImageRelativeWidth, ImageRelativeHeight); break; case "Mesh": ThisVisualMap.RelativeSize = new RelativeVector2(2 * ImageRelativeWidth, 2 * ImageRelativeHeight); break; case "Sphere": case "ConicalFrustum": case "Cone": case "Cylinder": case "BeveledCube": case "Octahedron": case "Cube": ThisVisualMap = CreatePrimitiveVisual(visualType); ThisVisualMap.RelativeSize = new RelativeVector2(PrimitiveRelativeWidth, PrimitiveRelativeHeight); ThisVisualMap.Origin = Visual.AlignType.TopCenter; ThisVisualMap.AnchorPoint = Visual.AlignType.Center; break; } return(ThisVisualMap); }
public void btnLoadSkeletal() { visual = new MeshVisual(); visual.CreateWithConfig(animInput.value, null, null, true); }