public void SetHardwareSkinningParam(int boneCount, int weightCount, SkinningType skinningType, bool correctAntipodalityHandling, bool scalingShearingSupport) { this.skinningType = skinningType; if (skinningType == RTShaderSystem.SkinningType.DualQuaternion) { if (this.dualQuat == null) { this.dualQuat = new DualQuaternionSkinning(); } this.activeTechnique = this.dualQuat; } else { if (this.linear == null) { this.linear = new LinearSkinning(); } this.activeTechnique = this.linear; } this.activeTechnique.SetHardwareSkinningParam(boneCount, weightCount, correctAntipodalityHandling, scalingShearingSupport); }
public void SetHardwareSkinningParam( int boneCount, int weightCount, SkinningType skinningType, bool correctAntipodalityHandling, bool scalingShearingSupport ) { this.skinningType = skinningType; if ( skinningType == RTShaderSystem.SkinningType.DualQuaternion ) { if ( this.dualQuat == null ) { this.dualQuat = new DualQuaternionSkinning(); } this.activeTechnique = this.dualQuat; } else { if ( this.linear == null ) { this.linear = new LinearSkinning(); } this.activeTechnique = this.linear; } this.activeTechnique.SetHardwareSkinningParam( boneCount, weightCount, correctAntipodalityHandling, scalingShearingSupport ); }
/// <summary> /// Called when a basic effect is encountered and potentially replaced by /// BasicPaletteEffect (if not overridden). This is called afer effects have been processed. /// </summary> /// <param name="skinningType">The the skinning type of the meshpart.</param> /// <param name="meshPart">The MeshPart that contains the BasicMaterialContent.</param> protected virtual void ReplaceBasicEffect(SkinningType skinningType, ModelMeshPartContent meshPart) { BasicMaterialContent basic = meshPart.Material as BasicMaterialContent; if (basic != null) { // Create a new PaletteSourceCode object and set its palette size // based on the platform since xbox has fewer registers. PaletteSourceCode source; if (context.TargetPlatform != TargetPlatform.Xbox360) { source = new PaletteSourceCode(56); } else { source = new PaletteSourceCode(40); } // Process the material and set the meshPart material to the new // material. PaletteInfoProcessor processor = new PaletteInfoProcessor(); meshPart.Material = processor.Process( new PaletteInfo(source.SourceCode4BonesPerVertex, source.PALETTE_SIZE, basic), context); } }
public void PrepareEntityForSkinning(Entity entity, SkinningType skinningType, bool correctAntipodalityHandling, bool shearScale) { if (entity != null) { //TODO! int lodLevels = entity.MeshLodIndex + 1; for (int indexLod = 0; indexLod < lodLevels; indexLod++) { Entity curEntity = entity; if (indexLod > 0) { // curEntity = entity.GetManualLodLevel(indexLod - 1); } int boneCount = 0; int weightCount = 0; bool isValid = ExtractSkeletonData(curEntity, out boneCount, out weightCount); int numSubEntites = curEntity.SubEntityCount; for (int indexSub = 0; indexSub < numSubEntites; indexSub++) { SubEntity subEntity = curEntity.GetSubEntity(indexSub); Material mat = subEntity.Material; ImprintSkeletonData(mat, isValid, boneCount, weightCount, skinningType, correctAntipodalityHandling, shearScale); } } } }
public void setHardwareSkinningParam(ushort boneCount, ushort weightCount, SkinningType skinningType) { RTShaderPINVOKE.HardwareSkinning_setHardwareSkinningParam__SWIG_2(swigCPtr, boneCount, weightCount, (int)skinningType); if (RTShaderPINVOKE.SWIGPendingException.Pending) { throw RTShaderPINVOKE.SWIGPendingException.Retrieve(); } }
public void setHardwareSkinningParam(ushort boneCount, ushort weightCount, SkinningType skinningType, bool correctAntipodalityHandling) { RTShaderPINVOKE.HardwareSkinning_setHardwareSkinningParam__SWIG_1(swigCPtr, boneCount, weightCount, (int)skinningType, correctAntipodalityHandling); if (RTShaderPINVOKE.SWIGPendingException.Pending) { throw RTShaderPINVOKE.SWIGPendingException.Retrieve(); } }
public virtual void setCustomShadowReceiverMaterials(SkinningType skinningType, MaterialPtr receiver1Weight, MaterialPtr receiver2Weight, MaterialPtr receiver3Weight, MaterialPtr receiver4Weight) { RTShaderPINVOKE.HardwareSkinningFactory_setCustomShadowReceiverMaterials(swigCPtr, (int)skinningType, MaterialPtr.getCPtr(receiver1Weight), MaterialPtr.getCPtr(receiver2Weight), MaterialPtr.getCPtr(receiver3Weight), MaterialPtr.getCPtr(receiver4Weight)); if (RTShaderPINVOKE.SWIGPendingException.Pending) { throw RTShaderPINVOKE.SWIGPendingException.Retrieve(); } }
public void prepareEntityForSkinning(Entity pEntity, SkinningType skinningType) { RTShaderPINVOKE.HardwareSkinningFactory_prepareEntityForSkinning__SWIG_2(swigCPtr, Entity.getCPtr(pEntity), (int)skinningType); if (RTShaderPINVOKE.SWIGPendingException.Pending) { throw RTShaderPINVOKE.SWIGPendingException.Retrieve(); } }
public void prepareEntityForSkinning(Entity pEntity, SkinningType skinningType, bool correctAntidpodalityHandling, bool shearScale) { RTShaderPINVOKE.HardwareSkinningFactory_prepareEntityForSkinning__SWIG_0(swigCPtr, Entity.getCPtr(pEntity), (int)skinningType, correctAntidpodalityHandling, shearScale); if (RTShaderPINVOKE.SWIGPendingException.Pending) { throw RTShaderPINVOKE.SWIGPendingException.Retrieve(); } }
protected bool ImprintSkeletonData(Material material, bool isValid, int boneCount, int weightCount, SkinningType skinningType, bool correctAntipodalityHandling, bool scalingShearingSupport) { bool isUpdated = false; if (material.TechniqueCount > 0) { SkinningData data = null; //Get the previous skinning data if available //TODO! /* * * dynamic binding = null; //material.GetTechnique(0).getUserObjectBindings(); * * if (binding != null) * { * if (binding is SkinningData) * { * data = binding as SkinningData; * } * } * if (data != null) * { * if ((data.IsValid == true) && (isValid == false) || (data.MaxBoneCount < boneCount) || (data.MaxWeightCount < weightCount)) * { * //update the data * isUpdated = true; * data.IsValid &= isValid; * data.MaxBoneCount = Axiom.Math.Utility.Max(data.MaxBoneCount, boneCount); * data.MaxWeightCount = Axiom.Math.Utility.Max(data.MaxWeightCount, weightCount); * data.SkinningType = skinningType; * data.CorrectAntipodalityHandling = correctAntipodalityHandling; * data.ScalingShearingSupport = scalingShearingSupport; * * //update the data in the material and invalidate it in the RTShader system * //do it will be regenerating * * //TODO * //binding.SetUserAny(HardwareSkinning.HsDataBindName, data); * * int schemeCount = ShaderGenerator.Instance.RTShaderSchemeCount; * for (int i = 0; i < schemeCount; i++) * { * //invalidate the material so it will bre recreated with the correct amount of bones and weights * string schemName = ShaderGenerator.Instance.GetRTShaderScheme(i); * Axiom.Components.RTShaderSystem.ShaderGenerator.Instance.InvalidateMaterial(schemName, material.Name, material.Group); * } * } * } */ } return(isUpdated); }
public SkinningType getSkinningType() { SkinningType ret = (SkinningType)RTShaderPINVOKE.HardwareSkinning_getSkinningType(swigCPtr); if (RTShaderPINVOKE.SWIGPendingException.Pending) { throw RTShaderPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public MaterialPtr getCustomShadowReceiverMaterial(SkinningType skinningType, ushort index) { MaterialPtr ret = new MaterialPtr(RTShaderPINVOKE.HardwareSkinningFactory_getCustomShadowReceiverMaterial(swigCPtr, (int)skinningType, index), false); if (RTShaderPINVOKE.SWIGPendingException.Pending) { throw RTShaderPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public SkinningData( bool isValid, int maxBoneCount, int maxWeightCount, SkinningType sType, bool correctAntipodality, bool scalingShearingSupport ) { this.IsValid = isValid; this.MaxBoneCount = maxBoneCount; this.MaxWeightCount = maxWeightCount; this.SkinningType = sType; this.CorrectAntipodalityHandling = correctAntipodality; this.ScalingShearingSupport = scalingShearingSupport; }
public SkinningData(bool isValid, int maxBoneCount, int maxWeightCount, SkinningType sType, bool correctAntipodality, bool scalingShearingSupport) { this.IsValid = isValid; this.MaxBoneCount = maxBoneCount; this.MaxWeightCount = maxWeightCount; this.SkinningType = sType; this.CorrectAntipodalityHandling = correctAntipodality; this.ScalingShearingSupport = scalingShearingSupport; }
internal Material GetCustomShadowReceiverMaterial(SkinningType skinningType, int index) { if (skinningType == SkinningType.DualQuaternion) { return(this.customShadowReceiverMaterialsDualQuaternion[index]); } else { return(this.customShadowReceiverMaterialsLinear[index]); } }
// Go through the modelmeshes and replace all basic effects for skinned models // with BasicPaletteEffect. private void ReplaceBasicEffects(ModelMeshContent input) { foreach (ModelMeshPartContent part in input.MeshParts) { SkinningType skinType = ContentUtil.GetSkinningType(part.GetVertexDeclaration()); if (skinType != SkinningType.None) { ReplaceBasicEffect(skinType, part); } } }
// Go through the modelmeshes and replace all basic effects for skinned models // with BasicPaletteEffect. private void ReplaceBasicEffects(ModelMeshContent input) { foreach (ModelMeshPartContent part in input.MeshParts) { #if XNA4 SkinningType skinType = ContentUtil.GetSkinningType(part.VertexBuffer.VertexDeclaration.VertexElements); #else SkinningType skinType = ContentUtil.GetSkinningType(part.GetVertexDeclaration()); #endif if (skinType != SkinningType.None) { ReplaceBasicEffect(skinType, part); } } }
public static SkillId GetSkill(SkinningType skinType) { switch (skinType) { case SkinningType.Skinning: return(SkillId.Skinning); case SkinningType.Engineering: return(SkillId.Engineering); case SkinningType.Herbalism: return(SkillId.Herbalism); case SkinningType.Mining: return(SkillId.Mining); } return(SkillId.Skinning); }
public void SetCustomShadowReceiverMaterials(SkinningType skinningType, Material receiver1Weight, Material receiver2Weight, Material receiver3Weight, Material receiver4Weight) { if (skinningType == SkinningType.DualQuaternion) { this.customShadowReceiverMaterialsDualQuaternion[0] = receiver1Weight; this.customShadowReceiverMaterialsDualQuaternion[1] = receiver2Weight; this.customShadowReceiverMaterialsDualQuaternion[2] = receiver3Weight; this.customShadowReceiverMaterialsDualQuaternion[3] = receiver4Weight; } else { this.customShadowReceiverMaterialsLinear[0] = receiver1Weight; this.customShadowReceiverMaterialsLinear[1] = receiver2Weight; this.customShadowReceiverMaterialsLinear[2] = receiver3Weight; this.customShadowReceiverMaterialsLinear[3] = receiver4Weight; } }
public static SkillId GetSkill(SkinningType skinType) { switch (skinType) { case SkinningType.Skinning: return SkillId.Skinning; case SkinningType.Engineering: return SkillId.Engineering; case SkinningType.Herbalism: return SkillId.Herbalism; case SkinningType.Mining: return SkillId.Mining; } return SkillId.Skinning; }
public HardwareSkinning() { this.creator = null; this.skinningType = RTShaderSystem.SkinningType.Linear; }
protected bool ImprintSkeletonData( Material material, bool isValid, int boneCount, int weightCount, SkinningType skinningType, bool correctAntipodalityHandling, bool scalingShearingSupport ) { bool isUpdated = false; if ( material.TechniqueCount > 0 ) { SkinningData data = null; //Get the previous skinning data if available //TODO! /* * dynamic binding = null; //material.GetTechnique(0).getUserObjectBindings(); if (binding != null) { if (binding is SkinningData) { data = binding as SkinningData; } } if (data != null) { if ((data.IsValid == true) && (isValid == false) || (data.MaxBoneCount < boneCount) || (data.MaxWeightCount < weightCount)) { //update the data isUpdated = true; data.IsValid &= isValid; data.MaxBoneCount = Axiom.Math.Utility.Max(data.MaxBoneCount, boneCount); data.MaxWeightCount = Axiom.Math.Utility.Max(data.MaxWeightCount, weightCount); data.SkinningType = skinningType; data.CorrectAntipodalityHandling = correctAntipodalityHandling; data.ScalingShearingSupport = scalingShearingSupport; //update the data in the material and invalidate it in the RTShader system //do it will be regenerating //TODO //binding.SetUserAny(HardwareSkinning.HsDataBindName, data); int schemeCount = ShaderGenerator.Instance.RTShaderSchemeCount; for (int i = 0; i < schemeCount; i++) { //invalidate the material so it will bre recreated with the correct amount of bones and weights string schemName = ShaderGenerator.Instance.GetRTShaderScheme(i); Axiom.Components.RTShaderSystem.ShaderGenerator.Instance.InvalidateMaterial(schemName, material.Name, material.Group); } } } */ } return isUpdated; }
public void PrepareEntityForSkinning( Entity entity, SkinningType skinningType, bool correctAntipodalityHandling, bool shearScale ) { if ( entity != null ) { //TODO! int lodLevels = entity.MeshLodIndex + 1; for ( int indexLod = 0; indexLod < lodLevels; indexLod++ ) { Entity curEntity = entity; if ( indexLod > 0 ) { // curEntity = entity.GetManualLodLevel(indexLod - 1); } int boneCount = 0; int weightCount = 0; bool isValid = ExtractSkeletonData( curEntity, out boneCount, out weightCount ); int numSubEntites = curEntity.SubEntityCount; for ( int indexSub = 0; indexSub < numSubEntites; indexSub++ ) { SubEntity subEntity = curEntity.GetSubEntity( indexSub ); Material mat = subEntity.Material; ImprintSkeletonData( mat, isValid, boneCount, weightCount, skinningType, correctAntipodalityHandling, shearScale ); } } } }
internal Material GetCustomShadowReceiverMaterial( SkinningType skinningType, int index ) { if ( skinningType == SkinningType.DualQuaternion ) { return this.customShadowReceiverMaterialsDualQuaternion[ index ]; } else { return this.customShadowReceiverMaterialsLinear[ index ]; } }
public void SetCustomShadowReceiverMaterials( SkinningType skinningType, Material receiver1Weight, Material receiver2Weight, Material receiver3Weight, Material receiver4Weight ) { if ( skinningType == SkinningType.DualQuaternion ) { this.customShadowReceiverMaterialsDualQuaternion[ 0 ] = receiver1Weight; this.customShadowReceiverMaterialsDualQuaternion[ 1 ] = receiver2Weight; this.customShadowReceiverMaterialsDualQuaternion[ 2 ] = receiver3Weight; this.customShadowReceiverMaterialsDualQuaternion[ 3 ] = receiver4Weight; } else { this.customShadowReceiverMaterialsLinear[ 0 ] = receiver1Weight; this.customShadowReceiverMaterialsLinear[ 1 ] = receiver2Weight; this.customShadowReceiverMaterialsLinear[ 2 ] = receiver3Weight; this.customShadowReceiverMaterialsLinear[ 3 ] = receiver4Weight; } }
public override SubRenderState CreateInstance(Scripting.Compiler.ScriptCompiler compiler, Scripting.Compiler.AST.PropertyAbstractNode prop, Pass pass, SGScriptTranslator stranslator) { if (prop.Name == "hardware_skinning") { bool hasError = false; int boneCount = 0; int weightCount = 0; string skinningType = string.Empty; SkinningType skinType = SkinningType.Linear; bool correctAntipodalityHandling = false; bool scalingShearingSupport = false; if (prop.Values.Count >= 2) { int it = 0; if (SGScriptTranslator.GetInt(prop.Values[it], out boneCount) == false) { hasError = true; } it++; if (SGScriptTranslator.GetInt(prop.Values[it], out weightCount) == false) { hasError = true; } if (prop.Values.Count >= 5) { it++; SGScriptTranslator.GetString(prop.Values[it], out skinningType); it++; SGScriptTranslator.GetBoolean(prop.Values[it], out correctAntipodalityHandling); it++; SGScriptTranslator.GetBoolean(prop.Values[it], out scalingShearingSupport); } //If the skinningType is not specified or is specified incorretly, default to linear if (skinningType == "dual_quaternion") { skinType = SkinningType.DualQuaternion; } else { skinType = SkinningType.Linear; } } if (hasError) { //TODO //compiler.AddError(...); return(null); } else { //create and update the hardware skinning sub render state SubRenderState subRenderState = CreateOrRetrieveInstance(stranslator); var hardSkinSrs = (HardwareSkinning)subRenderState; hardSkinSrs.SetHardwareSkinningParam(boneCount, weightCount, skinType, correctAntipodalityHandling, scalingShearingSupport); return(subRenderState); } } return(null); }