public List <string> ToList() { return(new List <string>() { MaterialId.ToString(), MaterialName, Quantity.ToString() }); }
public void SetVector(MaterialId materialId, string propertyName, Vector4 value) { application.materialDatabase.SetInstanceProperty(element.id, materialId, propertyName, new MaterialPropertyValue2() { vectorValue = value }); }
public void SetTexture(MaterialId materialId, string propertyName, Texture texture) { application.materialDatabase.SetInstanceProperty(element.id, materialId, propertyName, new MaterialPropertyValue2() { texture = texture }); }
// base materials (the ones we imported) // static materials (the ones we overrode in styles, if any) // instance materials (the ones we override per element (also animations) ) public MaterialId CreateStaticMaterialOverride(MaterialId baseId, IList <MaterialValueOverride> propertyOverrides) { // get the base material (for now always a defined one) // make sure we actually override properties, if not dont create it // make new material clone of base // foreach property, set it // assign unique id to this material Material baseMaterial = baseMaterialInfos[baseId.baseId - 1].material; if (propertyOverrides.Count == 0) { return(baseId); } Material material = new Material(baseMaterial); RangeInt range = new RangeInt(materialProperties.Length, 0); for (int i = 0; i < propertyOverrides.Count; i++) { SetProperty(material, propertyOverrides[i]); } MaterialId newId = new MaterialId(baseId.baseId, materialIdGenerator++); MaterialInfo newInfo = new MaterialInfo() { keywords = default,
public void SetFloat(MaterialId materialId, string propertyName, float value) { application.materialDatabase.SetInstanceProperty(element.id, materialId, propertyName, new MaterialPropertyValue2() { floatValue = value }); }
public void 部材を削除する() { var app = new MaterialApplicationService(repository); var id = new MaterialId("12345678"); app.Delete(id); Assert.Equal(null, app.Find("12345678")); }
public void Select (GadgetMaterial gadget) { if (gadget.NotNull ()) { if (MaterialId.IsEmpty ()) { MaterialId = gadget.Id; Material = gadget.GadgetName; SetImage (gadget.GetImage ()); } } }
public Material Find(MaterialId id) { // バリューオブジェクトにGetHashCode()無いと、ちゃんと機能しない。 if (dataStore.TryGetValue(id, out var target)) { return(target); } else { return(null); } }
protected override void OnUpdate() { var gameData = GetSingleton <GameState>(); if (!gameData.IsGameActive) { return; } var spikeEntity = GetSingletonEntity <SpikeTag>(); var MaterialIdData = GetComponentDataFromEntity <MaterialId>(true); var TranslationData = GetComponentDataFromEntity <Translation>(true); var collisionOffsetY = this.collisionOffsetY; var ecb = new EntityCommandBuffer(Allocator.Temp); Entities .WithAll <SphereTag>() .WithNone <DestroyedTag>() .ForEach((ref Entity entity, ref Translation translation, ref MaterialId materialId) => { if (!MaterialIdData.HasComponent(spikeEntity)) { return; } if (!TranslationData.HasComponent(spikeEntity)) { return; } MaterialId spikeMaterial = MaterialIdData[spikeEntity]; Translation spikeTranslation = TranslationData[spikeEntity]; if (translation.Value.y <= spikeTranslation.Value.y + collisionOffsetY) { { if (materialId.currentMaterialId == spikeMaterial.currentMaterialId) { ecb.AddComponent <DestroyedTag>(entity); } else { ecb.AddComponent <DestroyedTag>(spikeEntity); } } } }).Run(); ecb.Playback(EntityManager); ecb.Dispose(); }
public void WriteTo(Stream stream) { MaterialId.WriteTo(stream); BinaryWriter writer = new BinaryWriter(stream); writer.Write(Unknown1); writer.Write(children.Count); writer.Write(Unknown2); foreach (odfMaterialPropertySet pSet in children) { pSet.WriteTo(stream); } }
public MaterialId SaveComponentMaterial(SeinCustomMaterial material) { if (root.Materials == null) { root.Materials = new List<GLTF.Schema.Material>(); } var mat = ExporterUtils.ConvertMaterial(material, this); root.Materials.Add(mat); var id = new MaterialId { Id = root.Materials.Count - 1, Root = root }; return id; }
public bool TryGetBaseMaterialId(CharSpan idSpan, out MaterialId materialId) { for (int i = 0; i < baseMaterialInfos.Length; i++) { if (baseMaterialInfos[i].materialName == idSpan) { materialId = new MaterialId(i + 1, 0); return(true); } } materialId = default; return(false); }
public void Destroy() { foreach (KeyValuePair <long, MaterialInfo> kvp in materialMap) { MaterialId materialId = (MaterialId)kvp.Key; if (materialId.instanceId != 0) { try { UnityEngine.Object.Destroy(kvp.Value.material); } catch (Exception e) { } } } }
public void WriteTo(Stream stream) { Name.WriteTo(stream); Id.WriteTo(stream); BinaryWriter writer = new BinaryWriter(stream); writer.Write(Unknown1); writer.Write(AlwaysZero1); MaterialId.WriteTo(stream); for (int i = 0; i < 4; i++) { TextureIds[i].WriteTo(stream); } writer.Write(Unknown31); writer.Write(AlwaysZero2); writer.Write(Unknown4); if (_FormatType < 10) { writer.Write(Unknown7); writer.Write(Unknown8); } else { writer.Write(NumVertices); writer.Write(NumVertexIndices); } writer.Write(Unknown5); writer.Write(Unknown6); if (_FormatType < 10) { writer.Write(NumVertices); writer.Write(NumVertexIndices); writer.Write(AlwaysZero3); } else { writer.Write(Unknown7); writer.Write(Unknown8); } foreach (odfVertex vert in VertexList) { vert.WriteTo(stream); } foreach (odfFace face in FaceList) { face.WriteTo(stream); } writer.Write(AlwaysZero4); }
public static Vector2 GetUV(MaterialId type) { switch (type) { case (MaterialId.Sand): { return(_UVs[(int)MaterialId.Sand]); } case (MaterialId.Rock): { return(_UVs[(int)MaterialId.Rock]); } case (MaterialId.Dirt): { return(_UVs[(int)MaterialId.Dirt]); } case (MaterialId.Bedrock): { return(_UVs[(int)MaterialId.Bedrock]); } default: { return(_UVs[(int)MaterialId.Air]); } } }
public bool TryGetMaterialProperty(MaterialId materialId, CharSpan propertySpan, out MaterialPropertyInfo materialPropertyInfo) { MaterialInfo materialInfo = baseMaterialInfos[materialId.baseId - 1]; for (int i = materialInfo.propertyRange.start; i < materialInfo.propertyRange.end; i++) { if (materialProperties[i].propertyName == propertySpan) { materialPropertyInfo = materialProperties[i]; return(true); } } materialPropertyInfo = default; return(false); }
public bool BakeGeometry(RhinoDoc doc, ObjectAttributes baking_attributes, out Guid obj_guid) { if (Value != null) { var att = baking_attributes.Duplicate(); var id_str = this.Id > 0 ? Id.ToString() : "0"; var grp_str = this.GroupId.ToString(); var mno_str = this.MaterialId.ToString(); var mrf_str = this.ReinforcementId.ToString(); var t_str = this.Thickness.ToString(); att.SetUserString("SOF_OBJ_TYPE", "SAR"); att.SetUserString("SOF_ID", id_str); att.SetUserString("SOF_T", Thickness.ToString()); if (GroupId > 0) { att.SetUserString("SOF_GRP", GroupId.ToString()); } if (MaterialId > 0) { att.SetUserString("SOF_MNO", MaterialId.ToString()); } if (ReinforcementId > 0) { att.SetUserString("SOF_MRF", ReinforcementId.ToString()); } if (DirectionLocalX.Length > 1.0e-6) { att.SetUserString("SOF_DRX", DirectionLocalX.X.ToString("F6")); att.SetUserString("SOF_DRX", DirectionLocalX.Y.ToString("F6")); att.SetUserString("SOF_DRZ", DirectionLocalX.Z.ToString("F6")); } obj_guid = doc.Objects.AddBrep(Value, att); } else { obj_guid = new Guid(); } return(true); }
public MaterialId SaveNormalMaterial(UnityEngine.Material material) { if (root.Materials == null) { root.Materials = new List<GLTF.Schema.Material>(); } var mid = material.GetInstanceID(); if (_material2ID.ContainsKey(mid)) { return _material2ID[mid]; } var mat = ExporterUtils.ConvertMaterial(material, this); root.Materials.Add(mat); var id = new MaterialId { Id = root.Materials.Count - 1, Root = root }; _material2ID.Add(mid, id); return id; }
protected override void OnUpdate() { var gameData = GetSingleton <GameData>(); if (gameData.currentGameState != GameState.Game) { return; } var spikeEntity = GetSingletonEntity <SpikeTag>(); var MaterialIdData = GetComponentDataFromEntity <MaterialId>(true); var TranslationData = GetComponentDataFromEntity <Translation>(true); MaterialId spikeMaterial = MaterialIdData[spikeEntity]; Translation spikeTranslation = TranslationData[spikeEntity]; var collisionOffsetY = this.collisionOffsetY; Entities .WithAll <SphereTag>() .WithNone <DestroyedTag>() .ForEach((ref Entity entity, ref Translation translation, ref MaterialId materialId) => { if (translation.Value.y <= spikeTranslation.Value.y + collisionOffsetY) { { if (materialId.currentMaterialId == spikeMaterial.currentMaterialId) { EntityManager.AddComponent <DestroyedTag>(entity); } else { EntityManager.AddComponent <DestroyedTag>(spikeEntity); } } } }).WithStructuralChanges().Run(); }
private void CustomDrawNodelCell(object sender, CustomDrawNodeCellEventArgs e) { if (MaterialIds.Count > 0) { foreach (var id in MaterialIds) { if (e.Node.GetValue("Material_Id").ToString() == id) { e.Appearance.BackColor = Color.Yellow; } } } else { if (MaterialId != 0) { if (e.Node.GetValue("Material_Id").ToString() == MaterialId.ToString()) { e.Appearance.BackColor = Color.Green; } } } }
// All Setup Keyword functions must be static. It allow to create script to automatically update the shaders with a script if code change static public void SetupLayeredLitKeywordsAndPass(Material material) { BaseLitGUI.SetupBaseLitKeywords(material); BaseLitGUI.SetupBaseLitMaterialPass(material); SetupLayersMappingKeywords(material); bool receiveSSR = material.GetSurfaceType() == SurfaceType.Opaque ? (material.HasProperty(kReceivesSSR) ? material.GetInt(kReceivesSSR) != 0 : false) : (material.HasProperty(kReceivesSSRTransparent) ? material.GetInt(kReceivesSSRTransparent) != 0 : false); BaseLitGUI.SetupStencil(material, receiveSSR, material.GetMaterialId() == MaterialId.LitSSS); if (material.HasProperty(kAddPrecomputedVelocity)) { CoreUtils.SetKeyword(material, "_ADD_PRECOMPUTED_VELOCITY", material.GetInt(kAddPrecomputedVelocity) != 0); } for (int i = 0; i < kMaxLayerCount; ++i) { NormalMapSpace normalMapSpace = ((NormalMapSpace)material.GetFloat(kNormalMapSpace + i)); CoreUtils.SetKeyword(material, "_NORMALMAP_TANGENT_SPACE" + i, normalMapSpace == NormalMapSpace.TangentSpace); if (normalMapSpace == NormalMapSpace.TangentSpace) { CoreUtils.SetKeyword(material, "_NORMALMAP" + i, material.GetTexture(kNormalMap + i) || material.GetTexture(kDetailMap + i)); CoreUtils.SetKeyword(material, "_BENTNORMALMAP" + i, material.GetTexture(kBentNormalMap + i)); } else { CoreUtils.SetKeyword(material, "_NORMALMAP" + i, material.GetTexture(kNormalMapOS + i) || material.GetTexture(kDetailMap + i)); CoreUtils.SetKeyword(material, "_BENTNORMALMAP" + i, material.GetTexture(kBentNormalMapOS + i)); } CoreUtils.SetKeyword(material, "_MASKMAP" + i, material.GetTexture(kMaskMap + i)); CoreUtils.SetKeyword(material, "_DETAIL_MAP" + i, material.GetTexture(kDetailMap + i)); CoreUtils.SetKeyword(material, "_HEIGHTMAP" + i, material.GetTexture(kHeightMap + i)); CoreUtils.SetKeyword(material, "_SUBSURFACE_MASK_MAP" + i, material.GetTexture(kSubsurfaceMaskMap + i)); CoreUtils.SetKeyword(material, "_THICKNESSMAP" + i, material.GetTexture(kThicknessMap + i)); } CoreUtils.SetKeyword(material, "_INFLUENCEMASK_MAP", material.GetTexture(kLayerInfluenceMaskMap) && material.GetFloat(kkUseMainLayerInfluence) != 0.0f); CoreUtils.SetKeyword(material, "_EMISSIVE_MAPPING_PLANAR", ((UVEmissiveMapping)material.GetFloat(kUVEmissive)) == UVEmissiveMapping.Planar && material.GetTexture(kEmissiveColorMap)); CoreUtils.SetKeyword(material, "_EMISSIVE_MAPPING_TRIPLANAR", ((UVEmissiveMapping)material.GetFloat(kUVEmissive)) == UVEmissiveMapping.Triplanar && material.GetTexture(kEmissiveColorMap)); CoreUtils.SetKeyword(material, "_EMISSIVE_MAPPING_BASE", ((UVEmissiveMapping)material.GetFloat(kUVEmissive)) == UVEmissiveMapping.SameAsBase && material.GetTexture(kEmissiveColorMap)); CoreUtils.SetKeyword(material, "_EMISSIVE_COLOR_MAP", material.GetTexture(kEmissiveColorMap)); // For migration of specular occlusion to specular mode we remove previous keyword // _ENABLESPECULAROCCLUSION is deprecated CoreUtils.SetKeyword(material, "_ENABLESPECULAROCCLUSION", false); int specOcclusionMode = material.GetInt(kSpecularOcclusionMode); CoreUtils.SetKeyword(material, "_SPECULAR_OCCLUSION_NONE", specOcclusionMode == 0); CoreUtils.SetKeyword(material, "_SPECULAR_OCCLUSION_FROM_BENT_NORMAL_MAP", specOcclusionMode == 2); CoreUtils.SetKeyword(material, "_MAIN_LAYER_INFLUENCE_MODE", material.GetFloat(kkUseMainLayerInfluence) != 0.0f); VertexColorMode VCMode = (VertexColorMode)material.GetFloat(kVertexColorMode); if (VCMode == VertexColorMode.Multiply) { CoreUtils.SetKeyword(material, "_LAYER_MASK_VERTEX_COLOR_MUL", true); CoreUtils.SetKeyword(material, "_LAYER_MASK_VERTEX_COLOR_ADD", false); } else if (VCMode == VertexColorMode.Add) { CoreUtils.SetKeyword(material, "_LAYER_MASK_VERTEX_COLOR_MUL", false); CoreUtils.SetKeyword(material, "_LAYER_MASK_VERTEX_COLOR_ADD", true); } else { CoreUtils.SetKeyword(material, "_LAYER_MASK_VERTEX_COLOR_MUL", false); CoreUtils.SetKeyword(material, "_LAYER_MASK_VERTEX_COLOR_ADD", false); } bool useHeightBasedBlend = material.GetFloat(kUseHeightBasedBlend) != 0.0f; CoreUtils.SetKeyword(material, "_HEIGHT_BASED_BLEND", useHeightBasedBlend); bool useDensityModeEnable = false; for (int i = 0; i < material.GetInt(kLayerCount); ++i) { useDensityModeEnable |= material.GetFloat(kOpacityAsDensity + i) != 0.0f; } CoreUtils.SetKeyword(material, "_DENSITY_MODE", useDensityModeEnable); MaterialId materialId = material.GetMaterialId(); CoreUtils.SetKeyword(material, "_MATERIAL_FEATURE_SUBSURFACE_SCATTERING", materialId == MaterialId.LitSSS); CoreUtils.SetKeyword(material, "_MATERIAL_FEATURE_TRANSMISSION", materialId == MaterialId.LitTranslucent || (materialId == MaterialId.LitSSS && material.GetFloat(kTransmissionEnable) > 0.0f)); }
public MaterialPropertyId(MaterialId materialId, int propertyId) { this.materialId = materialId; this.propertyId = propertyId; }
// All Setup Keyword functions must be static. It allow to create script to automatically update the shaders with a script if code change static public void SetupMaterialKeywordsAndPass(Material material) { BaseLitGUI.SetupBaseLitKeywords(material); BaseLitGUI.SetupBaseLitMaterialPass(material); BaseLitGUI.SetupStencil(material, material.GetInt(kReceivesSSR) != 0, material.GetMaterialId() == MaterialId.LitSSS); if (material.HasProperty(kNormalMapSpace)) { NormalMapSpace normalMapSpace = (NormalMapSpace)material.GetFloat(kNormalMapSpace); // Note: keywords must be based on Material value not on MaterialProperty due to multi-edit & material animation // (MaterialProperty value might come from renderer material property block) CoreUtils.SetKeyword(material, "_MAPPING_PLANAR", ((UVBaseMapping)material.GetFloat(kUVBase)) == UVBaseMapping.Planar); CoreUtils.SetKeyword(material, "_MAPPING_TRIPLANAR", ((UVBaseMapping)material.GetFloat(kUVBase)) == UVBaseMapping.Triplanar); CoreUtils.SetKeyword(material, "_NORMALMAP_TANGENT_SPACE", (normalMapSpace == NormalMapSpace.TangentSpace)); if (normalMapSpace == NormalMapSpace.TangentSpace) { // With details map, we always use a normal map and Unity provide a default (0, 0, 1) normal map for it CoreUtils.SetKeyword(material, "_NORMALMAP", material.GetTexture(kNormalMap) || material.GetTexture(kDetailMap)); CoreUtils.SetKeyword(material, "_TANGENTMAP", material.GetTexture(kTangentMap)); CoreUtils.SetKeyword(material, "_BENTNORMALMAP", material.GetTexture(kBentNormalMap)); } else // Object space { CoreUtils.SetKeyword(material, "_NORMALMAP", material.GetTexture(kNormalMapOS)); CoreUtils.SetKeyword(material, "_TANGENTMAP", material.GetTexture(kTangentMapOS)); CoreUtils.SetKeyword(material, "_BENTNORMALMAP", material.GetTexture(kBentNormalMapOS)); } } if (material.HasProperty(kMaskMap)) { CoreUtils.SetKeyword(material, "_MASKMAP", material.GetTexture(kMaskMap)); } if (material.HasProperty(kUVEmissive) && material.HasProperty(kEmissiveColorMap)) { CoreUtils.SetKeyword(material, "_EMISSIVE_MAPPING_PLANAR", ((UVBaseMapping)material.GetFloat(kUVEmissive)) == UVBaseMapping.Planar && material.GetTexture(kEmissiveColorMap)); CoreUtils.SetKeyword(material, "_EMISSIVE_MAPPING_TRIPLANAR", ((UVBaseMapping)material.GetFloat(kUVEmissive)) == UVBaseMapping.Triplanar && material.GetTexture(kEmissiveColorMap)); CoreUtils.SetKeyword(material, "_EMISSIVE_COLOR_MAP", material.GetTexture(kEmissiveColorMap)); } if (material.HasProperty(kEnableSpecularOcclusion)) { CoreUtils.SetKeyword(material, "_ENABLESPECULAROCCLUSION", material.GetFloat(kEnableSpecularOcclusion) > 0.0f); } if (material.HasProperty(kHeightMap)) { CoreUtils.SetKeyword(material, "_HEIGHTMAP", material.GetTexture(kHeightMap)); } if (material.HasProperty(kAnisotropyMap)) { CoreUtils.SetKeyword(material, "_ANISOTROPYMAP", material.GetTexture(kAnisotropyMap)); } if (material.HasProperty(kDetailMap)) { CoreUtils.SetKeyword(material, "_DETAIL_MAP", material.GetTexture(kDetailMap)); } if (material.HasProperty(kSubsurfaceMaskMap)) { CoreUtils.SetKeyword(material, "_SUBSURFACE_MASK_MAP", material.GetTexture(kSubsurfaceMaskMap)); } if (material.HasProperty(kThicknessMap)) { CoreUtils.SetKeyword(material, "_THICKNESSMAP", material.GetTexture(kThicknessMap)); } if (material.HasProperty(kIridescenceThicknessMap)) { CoreUtils.SetKeyword(material, "_IRIDESCENCE_THICKNESSMAP", material.GetTexture(kIridescenceThicknessMap)); } if (material.HasProperty(kSpecularColorMap)) { CoreUtils.SetKeyword(material, "_SPECULARCOLORMAP", material.GetTexture(kSpecularColorMap)); } if (material.HasProperty(kUVDetail) || material.HasProperty(kUVBase)) { bool needUV2 = (UVDetailMapping)material.GetFloat(kUVDetail) == UVDetailMapping.UV2 || (UVBaseMapping)material.GetFloat(kUVBase) == UVBaseMapping.UV2; bool needUV3 = (UVDetailMapping)material.GetFloat(kUVDetail) == UVDetailMapping.UV3 || (UVBaseMapping)material.GetFloat(kUVBase) == UVBaseMapping.UV3; if (needUV3) { material.DisableKeyword("_REQUIRE_UV2"); material.EnableKeyword("_REQUIRE_UV3"); } else if (needUV2) { material.EnableKeyword("_REQUIRE_UV2"); material.DisableKeyword("_REQUIRE_UV3"); } else { material.DisableKeyword("_REQUIRE_UV2"); material.DisableKeyword("_REQUIRE_UV3"); } } if (material.HasProperty(kMaterialID)) { MaterialId materialId = material.GetMaterialId(); CoreUtils.SetKeyword(material, "_MATERIAL_FEATURE_SUBSURFACE_SCATTERING", materialId == MaterialId.LitSSS); CoreUtils.SetKeyword(material, "_MATERIAL_FEATURE_TRANSMISSION", materialId == MaterialId.LitTranslucent || (materialId == MaterialId.LitSSS && material.GetFloat(kTransmissionEnable) > 0.0f)); CoreUtils.SetKeyword(material, "_MATERIAL_FEATURE_ANISOTROPY", materialId == MaterialId.LitAniso); // No material Id for clear coat, just test the attribute CoreUtils.SetKeyword(material, "_MATERIAL_FEATURE_CLEAR_COAT", material.GetFloat(kCoatMask) > 0.0 || material.GetTexture(kCoatMaskMap)); CoreUtils.SetKeyword(material, "_MATERIAL_FEATURE_IRIDESCENCE", materialId == MaterialId.LitIridescence); CoreUtils.SetKeyword(material, "_MATERIAL_FEATURE_SPECULAR_COLOR", materialId == MaterialId.LitSpecular); } if (material.HasProperty(kRefractionModel)) { var refractionModelValue = (ScreenSpaceRefraction.RefractionModel)material.GetFloat(kRefractionModel); // We can't have refraction in pre-refraction queue var canHaveRefraction = !HDRenderQueue.k_RenderQueue_PreRefraction.Contains(material.renderQueue); CoreUtils.SetKeyword(material, "_REFRACTION_PLANE", (refractionModelValue == ScreenSpaceRefraction.RefractionModel.Box) && canHaveRefraction); CoreUtils.SetKeyword(material, "_REFRACTION_SPHERE", (refractionModelValue == ScreenSpaceRefraction.RefractionModel.Sphere) && canHaveRefraction); CoreUtils.SetKeyword(material, "_TRANSMITTANCECOLORMAP", material.GetTexture(kTransmittanceColorMap) && canHaveRefraction); } if (material.HasProperty(kAddPrecomputedVelocity)) { CoreUtils.SetKeyword(material, "_ADD_PRECOMPUTED_VELOCITY", material.GetInt(kAddPrecomputedVelocity) != 0); } }
// All Setup Keyword functions must be static. It allow to create script to automatically update the shaders with a script if code change static public void SetupMaterialKeywordsAndPass(Material material) { BaseLitGUI.SetupBaseLitKeywords(material); BaseLitGUI.SetupBaseLitMaterialPass(material); SetupLayersMappingKeywords(material); BaseLitGUI.SetupStencil(material, material.GetInt(kReceivesSSR) != 0, material.GetMaterialId() == MaterialId.LitSSS); for (int i = 0; i < kMaxLayerCount; ++i) { NormalMapSpace normalMapSpace = ((NormalMapSpace)material.GetFloat(kNormalMapSpace + i)); CoreUtils.SetKeyword(material, "_NORMALMAP_TANGENT_SPACE" + i, normalMapSpace == NormalMapSpace.TangentSpace); if (normalMapSpace == NormalMapSpace.TangentSpace) { CoreUtils.SetKeyword(material, "_NORMALMAP" + i, material.GetTexture(kNormalMap + i) || material.GetTexture(kDetailMap + i)); CoreUtils.SetKeyword(material, "_BENTNORMALMAP" + i, material.GetTexture(kBentNormalMap + i)); } else { CoreUtils.SetKeyword(material, "_NORMALMAP" + i, material.GetTexture(kNormalMapOS + i) || material.GetTexture(kDetailMap + i)); CoreUtils.SetKeyword(material, "_BENTNORMALMAP" + i, material.GetTexture(kBentNormalMapOS + i)); } CoreUtils.SetKeyword(material, "_MASKMAP" + i, material.GetTexture(kMaskMap + i)); CoreUtils.SetKeyword(material, "_DETAIL_MAP" + i, material.GetTexture(kDetailMap + i)); CoreUtils.SetKeyword(material, "_HEIGHTMAP" + i, material.GetTexture(kHeightMap + i)); CoreUtils.SetKeyword(material, "_SUBSURFACE_MASK_MAP" + i, material.GetTexture(kSubsurfaceMaskMap + i)); CoreUtils.SetKeyword(material, "_THICKNESSMAP" + i, material.GetTexture(kThicknessMap + i)); } CoreUtils.SetKeyword(material, "_INFLUENCEMASK_MAP", material.GetTexture(kLayerInfluenceMaskMap) && material.GetFloat(kkUseMainLayerInfluence) != 0.0f); CoreUtils.SetKeyword(material, "_EMISSIVE_MAPPING_PLANAR", ((UVBaseMapping)material.GetFloat(kUVEmissive)) == UVBaseMapping.Planar && material.GetTexture(kEmissiveColorMap)); CoreUtils.SetKeyword(material, "_EMISSIVE_MAPPING_TRIPLANAR", ((UVBaseMapping)material.GetFloat(kUVEmissive)) == UVBaseMapping.Triplanar && material.GetTexture(kEmissiveColorMap)); CoreUtils.SetKeyword(material, "_EMISSIVE_COLOR_MAP", material.GetTexture(kEmissiveColorMap)); CoreUtils.SetKeyword(material, "_ENABLESPECULAROCCLUSION", material.GetFloat(kEnableSpecularOcclusion) > 0.0f); CoreUtils.SetKeyword(material, "_MAIN_LAYER_INFLUENCE_MODE", material.GetFloat(kkUseMainLayerInfluence) != 0.0f); VertexColorMode VCMode = (VertexColorMode)material.GetFloat(kVertexColorMode); if (VCMode == VertexColorMode.Multiply) { CoreUtils.SetKeyword(material, "_LAYER_MASK_VERTEX_COLOR_MUL", true); CoreUtils.SetKeyword(material, "_LAYER_MASK_VERTEX_COLOR_ADD", false); } else if (VCMode == VertexColorMode.Add) { CoreUtils.SetKeyword(material, "_LAYER_MASK_VERTEX_COLOR_MUL", false); CoreUtils.SetKeyword(material, "_LAYER_MASK_VERTEX_COLOR_ADD", true); } else { CoreUtils.SetKeyword(material, "_LAYER_MASK_VERTEX_COLOR_MUL", false); CoreUtils.SetKeyword(material, "_LAYER_MASK_VERTEX_COLOR_ADD", false); } bool useHeightBasedBlend = material.GetFloat(kUseHeightBasedBlend) != 0.0f; CoreUtils.SetKeyword(material, "_HEIGHT_BASED_BLEND", useHeightBasedBlend); bool useDensityModeEnable = false; for (int i = 0; i < material.GetInt(kLayerCount); ++i) { useDensityModeEnable |= material.GetFloat(kOpacityAsDensity + i) != 0.0f; } CoreUtils.SetKeyword(material, "_DENSITY_MODE", useDensityModeEnable); MaterialId materialId = material.GetMaterialId(); CoreUtils.SetKeyword(material, "_MATERIAL_FEATURE_SUBSURFACE_SCATTERING", materialId == MaterialId.LitSSS); CoreUtils.SetKeyword(material, "_MATERIAL_FEATURE_TRANSMISSION", materialId == MaterialId.LitTranslucent || (materialId == MaterialId.LitSSS && material.GetFloat(kTransmissionEnable) > 0.0f)); }
public override int GetHashCode() { return(Id.GetHashCode() & FechaEgreso.GetHashCode() & MaterialId.GetHashCode() & DeObraId.GetHashCode() & ParaObraId.GetHashCode() & EncargadoId.GetHashCode() & Cantidad.GetHashCode() & EstaEliminado.GetHashCode()); }
// a mesh *might* decode to multiple prims if there are submeshes private MeshPrimitive[] ExportPrimitive(GameObject gameObject) { var filter = gameObject.GetComponent <MeshFilter>(); var meshObj = filter.sharedMesh; var renderer = gameObject.GetComponent <MeshRenderer>(); var materialsObj = renderer.sharedMaterials; var prims = new MeshPrimitive[meshObj.subMeshCount]; // don't export any more accessors if this mesh is already exported MeshPrimitive[] primVariations; if (_meshToPrims.TryGetValue(meshObj, out primVariations) && meshObj.subMeshCount == primVariations.Length) { for (var i = 0; i < primVariations.Length; i++) { prims[i] = new MeshPrimitive(primVariations[i], _root) { Material = ExportMaterial(materialsObj[i]) }; } return(prims); } AccessorId aPosition = null, aNormal = null, aTangent = null, aTexcoord0 = null, aTexcoord1 = null, aColor0 = null; aPosition = ExportAccessor(SchemaExtensions.ConvertVector3CoordinateSpaceAndCopy(meshObj.vertices, SchemaExtensions.CoordinateSpaceConversionScale)); if (meshObj.normals.Length != 0) { aNormal = ExportAccessor(SchemaExtensions.ConvertVector3CoordinateSpaceAndCopy(meshObj.normals, SchemaExtensions.CoordinateSpaceConversionScale)); } if (meshObj.tangents.Length != 0) { aTangent = ExportAccessor(SchemaExtensions.ConvertVector4CoordinateSpaceAndCopy(meshObj.tangents, SchemaExtensions.TangentSpaceConversionScale)); } if (meshObj.uv.Length != 0) { aTexcoord0 = ExportAccessor(SchemaExtensions.FlipTexCoordArrayVAndCopy(meshObj.uv)); } if (meshObj.uv2.Length != 0) { aTexcoord1 = ExportAccessor(SchemaExtensions.FlipTexCoordArrayVAndCopy(meshObj.uv2)); } if (meshObj.colors.Length != 0) { aColor0 = ExportAccessor(meshObj.colors); } MaterialId lastMaterialId = null; for (var submesh = 0; submesh < meshObj.subMeshCount; submesh++) { var primitive = new MeshPrimitive(); var triangles = meshObj.GetTriangles(submesh); primitive.Indices = ExportAccessor(SchemaExtensions.FlipFacesAndCopy(triangles), true); primitive.Attributes = new Dictionary <string, AccessorId>(); primitive.Attributes.Add(SemanticProperties.POSITION, aPosition); if (aNormal != null) { primitive.Attributes.Add(SemanticProperties.NORMAL, aNormal); } if (aTangent != null) { primitive.Attributes.Add(SemanticProperties.TANGENT, aTangent); } if (aTexcoord0 != null) { primitive.Attributes.Add(SemanticProperties.TexCoord(0), aTexcoord0); } if (aTexcoord1 != null) { primitive.Attributes.Add(SemanticProperties.TexCoord(1), aTexcoord1); } if (aColor0 != null) { primitive.Attributes.Add(SemanticProperties.Color(0), aColor0); } if (submesh < materialsObj.Length) { primitive.Material = ExportMaterial(materialsObj[submesh]); lastMaterialId = primitive.Material; } else { primitive.Material = lastMaterialId; } prims[submesh] = primitive; } _meshToPrims[meshObj] = prims; return(prims); }
private MaterialId ExportMaterial(UnityEngine.Material materialObj) { MaterialId id = GetMaterialId(_root, materialObj); if (id != null) { return(id); } var material = new GLTF.Schema.Material(); if (ExportNames) { material.Name = materialObj.name; } if (materialObj.HasProperty("_Cutoff")) { material.AlphaCutoff = materialObj.GetFloat("_Cutoff"); } switch (materialObj.GetTag("RenderType", false, "")) { case "TransparentCutout": material.AlphaMode = AlphaMode.MASK; break; case "Transparent": material.AlphaMode = AlphaMode.BLEND; break; default: material.AlphaMode = AlphaMode.OPAQUE; break; } material.DoubleSided = materialObj.HasProperty("_Cull") && materialObj.GetInt("_Cull") == (float)UnityEngine.Rendering.CullMode.Off; if (materialObj.HasProperty("_EmissionColor")) { material.EmissiveFactor = materialObj.GetColor("_EmissionColor").ToNumericsColorRaw(); } if (materialObj.HasProperty("_EmissionMap")) { var emissionTex = materialObj.GetTexture("_EmissionMap"); if (emissionTex != null) { material.EmissiveTexture = ExportTextureInfo(emissionTex); ExportTextureTransform(material.EmissiveTexture, materialObj, "_EmissionMap"); } } if (materialObj.HasProperty("_BumpMap")) { var normalTex = materialObj.GetTexture("_BumpMap"); if (normalTex != null) { material.NormalTexture = ExportNormalTextureInfo(normalTex, materialObj); ExportTextureTransform(material.NormalTexture, materialObj, "_BumpMap"); } } if (materialObj.HasProperty("_OcclusionMap")) { var occTex = materialObj.GetTexture("_OcclusionMap"); if (occTex != null) { material.OcclusionTexture = ExportOcclusionTextureInfo(occTex, materialObj); ExportTextureTransform(material.OcclusionTexture, materialObj, "_OcclusionMap"); } } switch (materialObj.shader.name) { case "Standard": case "GLTF/GLTFStandard": material.PbrMetallicRoughness = ExportPBRMetallicRoughness(materialObj); break; case "GLTF/GLTFConstant": material.CommonConstant = ExportCommonConstant(materialObj); break; } _materials.Add(materialObj); id = new MaterialId { Id = _root.Materials.Count, Root = _root }; _root.Materials.Add(material); return(id); }
void DrawSurfaceInputsGUI() { UVBaseMapping uvBaseMapping = (UVBaseMapping)UVBase[m_LayerIndex].floatValue; float X, Y, Z, W; materialEditor.TexturePropertySingleLine(Styles.baseColorText, baseColorMap[m_LayerIndex], baseColor[m_LayerIndex]); // TODO: does not work with multi-selection MaterialId materialIdValue = materials[0].GetMaterialId(); if (materialIdValue == MaterialId.LitStandard || materialIdValue == MaterialId.LitAniso || materialIdValue == MaterialId.LitIridescence) { materialEditor.ShaderProperty(metallic[m_LayerIndex], Styles.metallicText); } if (maskMap[m_LayerIndex].textureValue == null) { materialEditor.ShaderProperty(smoothness[m_LayerIndex], Styles.smoothnessText); } else { float remapMin = smoothnessRemapMin[m_LayerIndex].floatValue; float remapMax = smoothnessRemapMax[m_LayerIndex].floatValue; EditorGUI.BeginChangeCheck(); EditorGUILayout.MinMaxSlider(Styles.smoothnessRemappingText, ref remapMin, ref remapMax, 0.0f, 1.0f); if (EditorGUI.EndChangeCheck()) { smoothnessRemapMin[m_LayerIndex].floatValue = remapMin; smoothnessRemapMax[m_LayerIndex].floatValue = remapMax; } float aoMin = aoRemapMin[m_LayerIndex].floatValue; float aoMax = aoRemapMax[m_LayerIndex].floatValue; EditorGUI.BeginChangeCheck(); EditorGUILayout.MinMaxSlider(Styles.aoRemappingText, ref aoMin, ref aoMax, 0.0f, 1.0f); if (EditorGUI.EndChangeCheck()) { aoRemapMin[m_LayerIndex].floatValue = aoMin; aoRemapMax[m_LayerIndex].floatValue = aoMax; } } materialEditor.TexturePropertySingleLine((materialIdValue == MaterialId.LitSpecular) ? Styles.maskMapSpecularText : Styles.maskMapSText, maskMap[m_LayerIndex]); materialEditor.ShaderProperty(normalMapSpace[m_LayerIndex], Styles.normalMapSpaceText); // Triplanar only work with tangent space normal if ((NormalMapSpace)normalMapSpace[m_LayerIndex].floatValue == NormalMapSpace.ObjectSpace && ((UVBaseMapping)UVBase[m_LayerIndex].floatValue == UVBaseMapping.Triplanar)) { EditorGUILayout.HelpBox(Styles.normalMapSpaceWarning.text, MessageType.Error); } // We have two different property for object space and tangent space normal map to allow // 1. to go back and forth // 2. to avoid the warning that ask to fix the object normal map texture (normalOS are just linear RGB texture if ((NormalMapSpace)normalMapSpace[m_LayerIndex].floatValue == NormalMapSpace.TangentSpace) { materialEditor.TexturePropertySingleLine(Styles.normalMapText, normalMap[m_LayerIndex], normalScale[m_LayerIndex]); materialEditor.TexturePropertySingleLine(Styles.bentNormalMapText, bentNormalMap[m_LayerIndex]); } else { // No scaling in object space materialEditor.TexturePropertySingleLine(Styles.normalMapOSText, normalMapOS[m_LayerIndex]); materialEditor.TexturePropertySingleLine(Styles.bentNormalMapOSText, bentNormalMapOS[m_LayerIndex]); } DisplacementMode displaceMode = (DisplacementMode)displacementMode.floatValue; if (displaceMode != DisplacementMode.None || (m_Features & Features.HeightMap) != 0) { EditorGUI.BeginChangeCheck(); materialEditor.TexturePropertySingleLine(Styles.heightMapText, heightMap[m_LayerIndex]); if (!heightMap[m_LayerIndex].hasMixedValue && heightMap[m_LayerIndex].textureValue != null && !displacementMode.hasMixedValue) { EditorGUI.indentLevel++; if (displaceMode == DisplacementMode.Pixel) { materialEditor.ShaderProperty(heightPoMAmplitude[m_LayerIndex], Styles.heightMapAmplitudeText); } else { materialEditor.ShaderProperty(heightParametrization[m_LayerIndex], Styles.heightMapParametrization); if (!heightParametrization[m_LayerIndex].hasMixedValue) { HeightmapParametrization parametrization = (HeightmapParametrization)heightParametrization[m_LayerIndex].floatValue; if (parametrization == HeightmapParametrization.MinMax) { EditorGUI.BeginChangeCheck(); materialEditor.ShaderProperty(heightMin[m_LayerIndex], Styles.heightMapMinText); if (EditorGUI.EndChangeCheck()) { heightMin[m_LayerIndex].floatValue = Mathf.Min(heightMin[m_LayerIndex].floatValue, heightMax[m_LayerIndex].floatValue); } EditorGUI.BeginChangeCheck(); materialEditor.ShaderProperty(heightMax[m_LayerIndex], Styles.heightMapMaxText); if (EditorGUI.EndChangeCheck()) { heightMax[m_LayerIndex].floatValue = Mathf.Max(heightMin[m_LayerIndex].floatValue, heightMax[m_LayerIndex].floatValue); } } else { EditorGUI.BeginChangeCheck(); materialEditor.ShaderProperty(heightTessAmplitude[m_LayerIndex], Styles.heightMapAmplitudeText); if (EditorGUI.EndChangeCheck()) { heightTessAmplitude[m_LayerIndex].floatValue = Mathf.Max(0f, heightTessAmplitude[m_LayerIndex].floatValue); } materialEditor.ShaderProperty(heightTessCenter[m_LayerIndex], Styles.heightMapCenterText); } materialEditor.ShaderProperty(heightOffset[m_LayerIndex], Styles.heightMapOffsetText); } } EditorGUI.indentLevel--; } // UI only updates intermediate values, this will update the values actually used by the shader. if (EditorGUI.EndChangeCheck()) { // Fetch the surface option block which contains the function to update the displacement datas var surfaceOptionUIBlock = FetchUIBlockInCurrentList <SurfaceOptionUIBlock>(); surfaceOptionUIBlock.UpdateDisplacement(m_LayerIndex); } } switch (materialIdValue) { case MaterialId.LitSSS: case MaterialId.LitTranslucent: ShaderSSSAndTransmissionInputGUI(); break; case MaterialId.LitStandard: // Nothing break; // Following mode are not supported by layered lit and will not be call by it // as the MaterialId enum don't define it case MaterialId.LitAniso: ShaderAnisoInputGUI(); break; case MaterialId.LitSpecular: ShaderSpecularColorInputGUI(); break; case MaterialId.LitIridescence: ShaderIridescenceInputGUI(); break; default: Debug.Assert(false, "Encountered an unsupported MaterialID."); break; } if (!isLayeredLit) { ShaderClearCoatInputGUI(); } EditorGUILayout.Space(); EditorGUI.BeginChangeCheck(); materialEditor.ShaderProperty(UVBase[m_LayerIndex], Styles.UVBaseMappingText); uvBaseMapping = (UVBaseMapping)UVBase[m_LayerIndex].floatValue; X = (uvBaseMapping == UVBaseMapping.UV0) ? 1.0f : 0.0f; Y = (uvBaseMapping == UVBaseMapping.UV1) ? 1.0f : 0.0f; Z = (uvBaseMapping == UVBaseMapping.UV2) ? 1.0f : 0.0f; W = (uvBaseMapping == UVBaseMapping.UV3) ? 1.0f : 0.0f; UVMappingMask[m_LayerIndex].colorValue = new Color(X, Y, Z, W); if ((uvBaseMapping == UVBaseMapping.Planar) || (uvBaseMapping == UVBaseMapping.Triplanar)) { materialEditor.ShaderProperty(TexWorldScale[m_LayerIndex], Styles.texWorldScaleText); } materialEditor.TextureScaleOffsetProperty(baseColorMap[m_LayerIndex]); if (EditorGUI.EndChangeCheck()) { // Precompute. InvTilingScale[m_LayerIndex].floatValue = 2.0f / (Mathf.Abs(baseColorMap[m_LayerIndex].textureScaleAndOffset.x) + Mathf.Abs(baseColorMap[m_LayerIndex].textureScaleAndOffset.y)); if ((uvBaseMapping == UVBaseMapping.Planar) || (uvBaseMapping == UVBaseMapping.Triplanar)) { InvTilingScale[m_LayerIndex].floatValue = InvTilingScale[m_LayerIndex].floatValue / TexWorldScale[m_LayerIndex].floatValue; } } }
// a mesh *might* decode to multiple prims if there are submeshes private MeshPrimitive[] ExportPrimitive(UnityEngine.Mesh meshObj, UnityEngine.Material[] materials, Skin skin = null) { MyLog.Log("Mesh属性:"); var skinnedMeshRender = this._target.GetComponent <SkinnedMeshRenderer>(); var root = skinnedMeshRender ? this._target.transform : null; var materialsObj = new List <UnityEngine.Material>(materials); var prims = new MeshPrimitive[meshObj.subMeshCount]; var byteOffset = _bufferWriter.BaseStream.Position; var bufferViewId = this._root.WriteBufferView(this._bufferId, 0, (int)(_bufferWriter.BaseStream.Position - byteOffset)); AccessorId aPosition = null, aNormal = null, aTangent = null, aColor0 = null, aTexcoord0 = null, aTexcoord1 = null, aBlendIndex = null, aBlendWeight = null; aPosition = this._root.WriteAccessor(this._bufferId, SchemaExtensions.ConvertVector3CoordinateSpaceAndCopy(meshObj.vertices, SchemaExtensions.CoordinateSpaceConversionScale), bufferViewId, false, null, this._bufferWriter); MyLog.Log("-------vertices:" + meshObj.vertices.Length); if (meshObj.normals.Length != 0 && (ExportSetting.instance.mesh.normal)) { MyLog.Log("-------normals:" + meshObj.normals.Length); aNormal = this._root.WriteAccessor(this._bufferId, SchemaExtensions.ConvertVector3CoordinateSpaceAndCopy(meshObj.normals, SchemaExtensions.CoordinateSpaceConversionScale), bufferViewId, true, null, this._bufferWriter); } if (meshObj.tangents.Length != 0 && (ExportSetting.instance.mesh.tangent)) { aTangent = this._root.WriteAccessor(this._bufferId, SchemaExtensions.ConvertVector4CoordinateSpaceAndCopy(meshObj.tangents, SchemaExtensions.TangentSpaceConversionScale), bufferViewId, true, this._bufferWriter); } if (meshObj.colors.Length != 0 && (ExportSetting.instance.mesh.color)) { MyLog.Log("-------colors:" + meshObj.colors.Length); aColor0 = this._root.WriteAccessor(this._bufferId, meshObj.colors, bufferViewId, this._bufferWriter); } if (meshObj.uv.Length != 0) { MyLog.Log("-------uv:" + meshObj.uv.Length); aTexcoord0 = this._root.WriteAccessor(this._bufferId, SchemaExtensions.FlipTexCoordArrayVAndCopy(meshObj.uv), bufferViewId, this._bufferWriter); } var meshRender = this._target.GetComponent <MeshRenderer>(); if (meshRender != null && meshRender.lightmapIndex >= 0) { MyLog.Log("-------uv2:" + meshObj.uv2.Length); aTexcoord1 = this._root.WriteAccessor(this._bufferId, SchemaExtensions.FlipTexCoordArrayVAndCopy(meshObj.uv2.Length > 0 ? meshObj.uv2 : meshObj.uv), bufferViewId, this._bufferWriter); // aTexcoord1 = ExportAccessor(ConvertLightMapUVAndCopy(meshObj.uv2.Length > 0 ? meshObj.uv2 : meshObj.uv, meshRender.lightmapScaleOffset), bufferViewId); } else { if (meshObj.uv2.Length != 0 && (ExportSetting.instance.mesh.uv2)) { MyLog.Log("-------uv2:" + meshObj.uv2.Length); aTexcoord1 = this._root.WriteAccessor(this._bufferId, SchemaExtensions.FlipTexCoordArrayVAndCopy(meshObj.uv2), bufferViewId, this._bufferWriter); } } if (meshObj.boneWeights.Length != 0 && (ExportSetting.instance.mesh.bone)) { MyLog.Log("-------bones:" + meshObj.boneWeights.Length); aBlendIndex = this._root.WriteAccessor(this._bufferId, SchemaExtensions.ConvertBlendIndexAndCopy(meshObj.boneWeights), null, false, this._bufferWriter); aBlendWeight = this._root.WriteAccessor(this._bufferId, SchemaExtensions.ConvertBlendWeightAndCopy(meshObj.boneWeights), null, false, this._bufferWriter); if (skin != null) { /*var index = 0; * var renderer = _target.GetComponent<SkinnedMeshRenderer>(); * var bindposes = new Matrix4x4[renderer.bones.Length]; * * foreach (var bone in renderer.bones) * { * for (var i = 0; i < 16; ++i) * { * bindposes[index][i] = bone.worldToLocalMatrix[i]; * } * index++; * } * skin.InverseBindMatrices = ExportAccessor(bindposes);*/ skin.InverseBindMatrices = this._root.WriteAccessor(this._bufferId, meshObj.bindposes, null, this._bufferWriter); } } this._root.BufferViews[bufferViewId.Id].ByteLength = (int)(this._bufferWriter.BaseStream.Position - byteOffset); MaterialId lastMaterialId = null; for (var submesh = 0; submesh < meshObj.subMeshCount; submesh++) { var primitive = new MeshPrimitive(); var triangles = meshObj.GetTriangles(submesh); primitive.Indices = this._root.WriteAccessor(this._bufferId, SchemaExtensions.FlipFacesAndCopy(triangles), true, this._bufferWriter); primitive.Attributes = new Dictionary <string, AccessorId>(); primitive.Attributes.Add(SemanticProperties.POSITION, aPosition); MyLog.Log("-------triangles:" + triangles.Length + " submesh:" + submesh); if (aNormal != null) { primitive.Attributes.Add(SemanticProperties.NORMAL, aNormal); } if (aTangent != null) { primitive.Attributes.Add(SemanticProperties.TANGENT, aTangent); } if (aColor0 != null) { primitive.Attributes.Add(SemanticProperties.Color(0), aColor0); } if (aTexcoord0 != null) { primitive.Attributes.Add(SemanticProperties.TexCoord(0), aTexcoord0); } if (aTexcoord1 != null) { primitive.Attributes.Add(SemanticProperties.TexCoord(1), aTexcoord1); } if (aBlendIndex != null && aBlendWeight != null) { primitive.Attributes.Add(SemanticProperties.Joint(0), aBlendIndex); primitive.Attributes.Add(SemanticProperties.Weight(0), aBlendWeight); } if (submesh < materialsObj.Count) { primitive.Material = new MaterialId { Id = materialsObj.IndexOf(materialsObj[submesh]), Root = _root }; lastMaterialId = primitive.Material; } else { primitive.Material = lastMaterialId; } prims[submesh] = primitive; } return(prims); }
public override int GetHashCode() { return(Id.GetHashCode() & UsuarioId.GetHashCode() & EstaEliminado.GetHashCode() & FechaActualizacion.GetHashCode() & PrecioCompra.GetHashCode() & MaterialId.GetHashCode()); }