/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param> protected override void SolveInstance(IGH_DataAccess DA) { MaterialProperties mp = null; if (!DA.GetData(0, ref mp)) { return; } //Copy to each analysis plugin - extracts material properties from MP input double fc = mp.fC; double Ec = mp.EC; double ec = mp.eC; double rhoc = mp.rhoC; double EEc = mp.EEC; double fy = mp.fY; double Es = mp.ES; double es = mp.eS; double rhos = mp.rhoS; double EEs = mp.EES; DA.SetData(0, fc); DA.SetData(1, Ec); DA.SetData(2, ec); DA.SetData(3, rhoc); DA.SetData(4, EEc); DA.SetData(5, fy); DA.SetData(6, Es); DA.SetData(7, es); DA.SetData(8, rhos); DA.SetData(9, EEs); }
private void RenderSplineMesh(Camera cam) { MaterialProperties.Clear(); if (Profile.EnableReflection) { MaterialProperties.SetTexture(PMat.REFLECTION_TEX, GetReflectionRt(cam)); } MaterialProperties.SetTexture(PMat.NOISE_TEX, PPoseidonSettings.Instance.NoiseTexture); PMat.SetActiveMaterial(MaterialToRender); PMat.SetKeywordEnable(PMat.KW_BACK_FACE, false); PMat.SetKeywordEnable(PMat.KW_MESH_NOISE, meshNoise != 0); PMat.SetFloat(PMat.MESH_NOISE, meshNoise); PMat.SetActiveMaterial(null); List <PSplineSegment> segments = Spline.Segments; for (int i = 0; i < segments.Count; ++i) { Graphics.DrawMesh( segments[i].Mesh, transform.localToWorldMatrix, MaterialToRender, gameObject.layer, cam, 0, MaterialProperties, ShadowCastingMode.Off, false, null, LightProbeUsage.BlendProbes, null); } }
protected override void PrepareProperties(MaterialProperties materialProperties) { base.PrepareProperties(materialProperties); positionsProperty = materialProperties.GetComputeBufferProperty("_Positions"); positionsLengthProperty = materialProperties.GetFloatProperty("_PositionsLength"); widthProperty = materialProperties.GetFloatProperty("_Width"); }
/// <summary> /// Single Primitive Constructor with custom MaterialProperty /// </summary> /// <param name="position">Initial Body Position</param> /// <param name="scale">Scale</param> /// <param name="primative">Primitive to add to Skin</param> /// <param name="prop">Material Properties of Primitive</param> public Gobject(Vector3 position, Vector3 scale, Primitive primative, MaterialProperties prop, Model model, string asset) : this() { Skin.AddPrimitive(primative, prop); CommonInit(position, scale, model, true, asset); }
private void CreateMaterial_Click(object sender, EventArgs e) { prop = new MaterialProperties(FemapModel); SyncGUI ui = new SyncGUI(FemapModel); try { if (Auto.IsChecked) { materials.First(w => w.title == materialLibraryComboBox.Text).Put(FemapModel.feMatl.CountSet() + 1); FemapModel.feView.Regenerate(); SQLControl(materialLibraryComboBox.Text, materials.First(w => w.title == materialLibraryComboBox.Text).Ex, materials.First(w => w.title == materialLibraryComboBox.Text).Gx, materials.First(w => w.title == materialLibraryComboBox.Text).Nuxy); } else if (Manual.IsChecked) { prop.SetManualMaterial(TitleBox.Text, ui.DParse(EBox), ui.DParse(GBox), ui.DParse(NuBox)); SQLControl(TitleBox.Text, ui.DParse(EBox), ui.DParse(GBox), ui.DParse(NuBox)); } Close(); } catch (Exception) { } }
public static void SetDrawProperties(int shaderID, CelestialBodyType celestialBody, float defaultSpecularPower = -1f) { CelestialBody body = CelestialBodies[celestialBody]; if (body.TextureMap != null) { body.TextureMap.Bind(); } if (body.SpecularMap != null) { Game.SetSpecularMapEnabled(shaderID, true); body.SpecularMap.Bind(); } else { Game.SetSpecularMapEnabled(shaderID, false); } if (body.SpecularPower >= 0f) { //MaterialProperties.SetSpecular(shaderID, new Vector3(body.SpecularReflectivity)); MaterialProperties.SetShininess(shaderID, body.SpecularPower); } else { MaterialProperties.SetShininess(shaderID, defaultSpecularPower); } }
private void InitTerrainTypeMaterialProperties(TerrainType[] terrainTypesValues) { foreach (TerrainType terrainType in terrainTypesValues) { MaterialProperties materialProperties = MaterialPropertiesFactory.GetProperties(terrainType); _materialProperties.Add(terrainType, materialProperties); } }
public void OnSaveTypeEditing() { MaterialProperties materialProperties = TileTypeDataEditor.FinishEditing(); _materialProperties[CurrentlySelectedTerrainType] = materialProperties; CleanupEditingState(); }
public MaterialBatch(Shader shader, MaterialPermutation permutation, MaterialProperties properties) { Properties = properties; Permutation = permutation; _decals = new List <DecalRenderInstance>(); BoundingSpheres = new BoundingSphere[16]; Decals = new ReadOnlyCollection <DecalRenderInstance>(_decals); var material = new Material(shader) { hideFlags = HideFlags.DontSave }; if (permutation.LayerMode == LayerMode.Single) { material.EnableKeyword("LAYERS_SINGLE"); } else if (permutation.LayerMode == LayerMode.Triplanar) { material.EnableKeyword("LAYERS_TRIPLANAR"); } if (permutation.LayerProjectionMode == ProjectionMode.Local) { material.EnableKeyword("LAYER_PROJECTION_LOCAL"); } else { material.EnableKeyword("LAYER_PROJECTION_WORLD"); } if (permutation.EnableJitter) { material.EnableKeyword("JITTER_LAYERS"); } if (permutation.Shape == DecalShape.Sphere) { material.EnableKeyword("SHAPE_CIRCLE"); } else if (permutation.Shape == DecalShape.Cube) { material.EnableKeyword("SHAPE_SQUARE"); } else if (permutation.Shape == DecalShape.Mesh) { material.EnableKeyword("SHAPE_MESH"); } else { throw new InvalidOperationException("Unknown decal shape `" + permutation.Shape + "`"); } properties.LoadInto(material); _material = material; }
public void AddRenderable(IMesh mesh, Matrix worldCm, MaterialProperties materialProperties, int materialResourcesIndex, Color color) { AddRenderable(mesh, new RenderJobDescription { WorldTransform = worldCm, MaterialProperties = materialProperties, MaterialResourcesIndex = materialResourcesIndex, Color = color }); }
protected override void PrepareProperties(MaterialProperties materialProperties) { base.PrepareProperties(materialProperties); positionsProperty = materialProperties.GetComputeBufferProperty("_Positions"); positionsLengthProperty = materialProperties.GetFloatProperty("_PositionsLength"); widthProperty = materialProperties.GetFloatProperty("_Width"); objectToClipProperty = materialProperties.GetMatrixProperty("objectToClip"); clipToObjectProperty = materialProperties.GetMatrixProperty("clipToObject"); }
public ImmovablePickupObject(string id, ActorType actorType, Transform3D transform, EffectParameters effectParameters, Model model, Model lowPolygonModel, MaterialProperties materialProperties, PickupParameters pickupParameters) : base(id, actorType, transform, effectParameters, model, lowPolygonModel, materialProperties) { this.pickupParameters = pickupParameters; //register for callback on CDCR this.Body.CollisionSkin.callbackFn += CollisionSkin_callbackFn; }
public TriangleMeshObject(string id, ActorType actorType, Transform3D transform, BasicEffect effect, Color color, float alpha, Texture2D texture, Model model, MaterialProperties materialProperties) : base(id, actorType, transform, effect, color, alpha, texture, model) { //get the primitive mesh which forms the skin TriangleMesh triangleMesh = GetTriangleMesh(this.Model, this.Transform3D); //add the primitive mesh to the collision skin this.Body.CollisionSkin.AddPrimitive(triangleMesh, materialProperties); }
public void SetPortraitOffset(Vector2 offset, int index, string mattexprop) { MaterialProperties matprop = new MaterialProperties { m_MaterialIndex = index, m_MaterialPropertyName = mattexprop }; if (this.CheckValidMaterialProperties(matprop)) { this.m_PortraitRenderer.materials[matprop.m_MaterialIndex].SetTextureOffset(matprop.m_MaterialPropertyName, offset); } }
public void SetPortraitTiling(Vector2 tiling, int index, string mattexprop) { MaterialProperties matprop = new MaterialProperties { m_MaterialIndex = index, m_MaterialPropertyName = mattexprop }; if (this.CheckValidMaterialProperties(matprop)) { this.m_PortraitRenderer.materials[matprop.m_MaterialIndex].SetTextureScale(matprop.m_MaterialPropertyName, tiling); } }
public void Init(MaterialProperties props, float mass, float temperature) { var oldMtl = Material; Material = props; Mass = mass; _heatCapacity = props.SpecificHeat * mass; Temperature = temperature; _lastUpdate = null; MaterialChanged?.Invoke(oldMtl, Material); OverheatDamageMultiplier = 1; }
public Triangle3D(Vertex v1, Vertex v2, Vertex v3, Vector3D normal, MaterialProperties mp) { _Vertexes = new Vertex[VERTEXES_COUNT + 1]; _Vertexes[V1_INDEX] = new Vertex(v1); _Vertexes[V2_INDEX] = new Vertex(v2); _Vertexes[V3_INDEX] = new Vertex(v3); _Vertexes[VA_INDEX] = _Vertexes[V1_INDEX]; _Normal = new Vector3D(normal); _MaterialProperties = mp; }
private void SetMaterialProperties(MaterialProperties properties) { List <Slider> componentsInChildren = GetComponentsInChildren <Slider>().ToList(); SetValue(componentsInChildren, "LowHeatContentSlider", properties.LowHeatContent); SetValue(componentsInChildren, "TotalMineralContentSlider", properties.TotalMineralContent); SetValue(componentsInChildren, "EffectiveMineralContentSlider", properties.EffectiveMineralContent); SetValue(componentsInChildren, "OvenDryParticleDensitySlider", properties.OvenDryParticleDensity); SetValue(componentsInChildren, "SurfaceAreaToVolumeRatioSlider", properties.SurfaceAreaToVolumeRatio); SetValue(componentsInChildren, "OvenDryFuelLoadSlider", properties.OvenDryFuelLoad); SetValue(componentsInChildren, "FuelBedDepthSlider", properties.FuelBedDepth); SetValue(componentsInChildren, "DeadFuelMoistureOfExtinctionSlider", properties.DeadFuelMoistureOfExtinction); }
public static void InitMaterialLookup() { var tempWear = new WearNTear(); foreach (WearNTear.MaterialType material in Enum.GetValues(typeof(WearNTear.MaterialType))) { tempWear.m_materialType = material; MaterialProperties props = default(MaterialProperties); tempWear.GetMaterialProperties(out props.maxSupport, out props.minSupport, out props.horizontalLoss, out props.verticalLoss); materialLookup.Add(material, props); } }
public MaterialPropertyForm(model FemapModel) { InitializeComponent(); this.FemapModel = FemapModel; Check(); prop = new MaterialProperties(FemapModel); materials = prop.GetMatLibrary(); foreach (var title in materials.Select(s => s.title)) { titlesList.Add(new ListData(title)); } materialLibraryComboBox.DataSource = titlesList; }
private bool CheckValidMaterialProperties(MaterialProperties matprop) { if (this.m_PortraitRenderer == null) { Debug.LogError("No portrait mesh renderer set."); return(false); } if (matprop.m_MaterialIndex >= this.m_PortraitRenderer.materials.Length) { Debug.LogError(string.Format("Unable to find material index {0}", matprop.m_MaterialIndex)); return(false); } return(true); }
private void DrawIndexedMaterialMenu(MaterialPropsAndBuffer propsAndBuffer) { MaterialProperties props = propsAndBuffer.Properties; float intensity = props.SpecularIntensity.X; float reflectivity = props.Reflectivity; if (ImGui.SliderFloat("Intensity", ref intensity, 0f, 10f, intensity.ToString(), 1f) | ImGui.SliderFloat("Power", ref props.SpecularPower, 0f, 1000f, props.SpecularPower.ToString(), 1f) | ImGui.SliderFloat("Reflectivity", ref props.Reflectivity, 0f, 1f, props.Reflectivity.ToString(), 1f)) { props.SpecularIntensity = new Vector3(intensity); propsAndBuffer.Properties = props; } }
private void ApplyPortraitTexture(string name, UnityEngine.Object obj, object userdata) { this.m_PortraitLoaded = true; MaterialProperties properties = userdata as MaterialProperties; Texture texture = obj as Texture; if (texture == null) { Debug.LogError(string.Format("Unable to load portrait texture {0}.", name), obj); } else { this.m_PortraitRenderer.materials[properties.m_MaterialIndex].SetTexture(properties.m_MaterialPropertyName, texture); } }
protected override void PrepareProperties(MaterialProperties properties) { if (Randomize) { Strength = Random.Range(0, Strength); DistanceStrength = Random.Range(0, DistanceStrength); StrengthDecreaseSpeed = Random.Range(0, StrengthDecreaseSpeed); } strengthProperty = properties.GetFloatProperty("_Strength"); distanceStrengthProperty = properties.GetFloatProperty("_DistanceStrength"); axisProperty = properties.GetVectorProperty("_Axis"); axisProperty.Value = Vector3.forward; properties.GetVectorProperty("_Origin").Value = Origin; }
/// <summary> /// Constructor. /// </summary> /// <param name="root">Root object to which the component belongs.</param> /// <param name="name">Name of the component.</param> public DefaultPhysicsComponent(Root root, string name) : base(root, name) { mBody = new PhysicsBody(); mBody.Owner = this; mCollisionSkin = new CollisionSkin(mBody); mBody.CollisionSkin = mCollisionSkin; mCollisionSkin.callbackFn += new CollisionCallbackFn(HandleCollisionDetection); mMaterialProperties = new MaterialProperties(0.8f, 0.8f, 0.7f); mDensity = 1; mCenterOfMass = new Vector3(); mLocalForceCache = new Vector3(); mWorldForceCache = new Vector3(); mLocalTorqueCache = new Vector3(); mWorldTorqueCache = new Vector3(); }
public void SetPortraitTexture(string texturename, int index, string mattexprop) { if ((texturename != null) && (texturename.Length != 0)) { texturename = FileUtils.GameAssetPathToName(texturename); MaterialProperties matprop = new MaterialProperties { m_MaterialIndex = index, m_MaterialPropertyName = mattexprop }; if (this.CheckValidMaterialProperties(matprop)) { this.m_PortraitLoaded = false; AssetLoader.Get().LoadTexture(texturename, new AssetLoader.ObjectCallback(this.ApplyPortraitTexture), matprop, false); } } }
/// <summary> /// Compute amount of a voxel material to vaporize /// </summary> /// <param name="properties">Material</param> /// <param name="energy">kJ</param> /// <param name="radius">m</param> /// <param name="rate">scalar 0-1</param> private static void AmountToVaporize(MaterialProperties properties, float energy, out double radius, out double rate) { var kgVaporized = energy / properties.EnthalpyOfFusion; var cubicMetersVaporized = kgVaporized / properties.DensitySolid; rate = MathHelper.Clamp(cubicMetersVaporized / 2f, 0.25f, 1f); // Vaporized = pi^2 * r / 2 radius = (cubicMetersVaporized / (rate * Math.PI * Math.PI / 2)); if (radius > Settings.MaxVoxelRadius) { rate = Math.Min(radius / Settings.MaxVoxelRadius, 1); radius = Settings.MaxVoxelRadius; } }
/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param> protected override void SolveInstance(IGH_DataAccess DA) { MaterialProperties mp = null; List <Curve> crvAg = new List <Curve>(); List <Curve> crvAs = new List <Curve>(); if (!DA.GetData(0, ref mp)) { return; } if (!DA.GetDataList(1, crvAg)) { return; } if (!DA.GetDataList(2, crvAs)) { return; } //Copy to each analysis plugin - extracts material properties from MP input double fc = mp.fC; double Ec = mp.EC; double ec = mp.eC; double rhoc = mp.rhoC; double EEc = mp.EEC; double fy = mp.fY; double Es = mp.ES; double es = mp.eS; double rhos = mp.rhoS; double EEs = mp.EES; List <Brep> brepBeam = new List <Brep>(); Point3d guide = crvAg[0].PointAtStart; List <Point3d> guides = new List <Point3d>(); Brep[] brepC = Brep.CreateFromLoft(crvAg, Point3d.Unset, Point3d.Unset, LoftType.Normal, false); Brep clsBrepC = brepC[0].CapPlanarHoles(DocumentTolerance()); brepBeam.Add(clsBrepC); double massC = Math.Abs(clsBrepC.GetVolume()) * rhoc; double totEEc = massC * EEc; Brep[] brepS = Brep.CreateFromLoft(crvAs, Point3d.Unset, Point3d.Unset, LoftType.Normal, false); Brep clsBrepS = brepS[0].CapPlanarHoles(DocumentTolerance()); brepBeam.Add(clsBrepS); double massS = Math.Abs(clsBrepS.GetVolume()) * rhos; double totEEs = massS * EEs; double totVol = clsBrepS.GetVolume() + clsBrepC.GetVolume(); double totMass = massC + massS; double totEE = totEEc + totEEs; DA.SetData(0, totEE); DA.SetData(1, totMass); DA.SetDataList(2, brepBeam); //DA.SetDataList(2, TESTbrepC); }
public void OnInteraction(IntPtr properties, IntPtr body0, IntPtr body1, IntPtr contact, float normalImpact) { MaterialContactInfo contactInfo = (MaterialContactInfo)Marshal.PtrToStructure(contact, typeof(MaterialContactInfo)); MaterialProperties properties_ = (MaterialProperties)Marshal.PtrToStructure(properties, typeof(MaterialProperties)); //NewtonBody body0_ = (NewtonBody)Marshal.PtrToStructure(body0, typeof(NewtonBody)); //NewtonBody body1_ = (NewtonBody)Marshal.PtrToStructure(body1, typeof(NewtonBody)); NewtonBody body0_ = (NewtonBody)GCHandle.FromIntPtr(body0).Target; NewtonBody body1_ = (NewtonBody)GCHandle.FromIntPtr(body1).Target; //Debug.Log("On interaction"); if (m_callback != null) { m_callback(ref properties_, contactInfo, normalImpact, body0_, body1_); } Marshal.StructureToPtr(properties_, properties, false); }
public MaterialNode(MaterialProperties props) : base("Material", new MaterialNodeControl(), Colors.Yellow) { (Control as MaterialNodeControl).UpdateData = (MaterialProperties prop) => { properties = prop; }; (Control as MaterialNodeControl).SetMaterialProps(props); AddSocket("Diffuse", InputNodeSocket.Create <DColor>(this)); AddSocket("Normal", InputNodeSocket.Create <DColor>(this)); AddSocket("Height", InputNodeSocket.Create <DColor>(this)); AddSocket("Roughness", InputNodeSocket.Create <DColor>(this)); AddSocket("Metallic", InputNodeSocket.Create <DColor>(this)); AddSocket("AO", InputNodeSocket.Create <DColor>(this)); AddSocket("Emissive", InputNodeSocket.Create <DColor>(this)); }
public Material() { defaultProperties = new MaterialProperties(); _properties = defaultProperties; }
/// <summary> /// Internal class to create engine-related sources /// Do not call unless you know exactly what you're doing /// </summary> public static void CreateResources() { #region Important materials for the normal workings of the engine //Create some useful materials Utilities.ErrorTex = GenerateErrorTex(); Utilities.White = GenerateColor(Color.White); Utilities.Black = GenerateColor(Color.Black); Utilities.NormalTex = GenerateNormalTex(); Utilities.SpecTex = Utilities.White; Utilities.AlphaTex = Utilities.White; Utilities.DefaultSkyboxTex = GenerateSolidSkybox(Color.Black); Utilities.ErrorMat = new Material(Utilities.ErrorTex, "default"); Utilities.NormalMat = new Material(Utilities.NormalTex, "default"); #endregion #region Basic/Debug models Vertex[] verts; int[] elements; Mesh.BoundingBox boundingbox; Resource.InsertMesh("engine/quad.obj", CreateNewQuadMesh()); MeshGenerator.LoadOBJFromString(Box, out verts, out elements, out boundingbox); Mesh mBox = new Mesh(verts, elements); mBox.BBox = boundingbox; Resource.InsertMesh("engine/box.obj", mBox); MeshGenerator.LoadOBJFromString(Ball, out verts, out elements, out boundingbox); Mesh mBall = new Mesh(verts, elements); mBall.BBox = boundingbox; Resource.InsertMesh("engine/ball.obj", mBall); MeshGenerator.LoadOBJFromString(Skybox, out verts, out elements, out boundingbox); Mesh mSkybox = new Mesh(verts, elements); mSkybox.BBox = boundingbox; Resource.InsertMesh("engine/skybox.obj", mSkybox); #endregion #region Engine-based and 'utility' materials MaterialProperties properties = new MaterialProperties(); properties.ShaderProgram = Resource.GetProgram("default_lighting"); properties.BaseTexture = Utilities.White; Material white = new Material(properties); Resource.InsertMaterial("engine/white", white); properties = new MaterialProperties(); properties.ShaderProgram = Resource.GetProgram("default"); properties.BaseTexture = Utilities.White; Material white_simple = new Material(properties); Resource.InsertMaterial("engine/white_simple", white_simple); properties = new MaterialProperties(); properties.ShaderProgram = Resource.GetProgram("default_lighting"); properties.BaseTexture = Utilities.White; properties.SpecularPower = 32.0f; properties.SpecularIntensity = 4.0f; Material white_shiny = new Material(properties); Resource.InsertMaterial("engine/white_shiny", white_shiny); properties = new MaterialProperties(); properties.ShaderProgram = Resource.GetProgram("depthtest"); Material depthtest = new Material(properties); Resource.InsertMaterial("engine/depth", depthtest); #endregion }
public void OnUpdate() { //base.OnInitialize(); string text = "Test text! "+Engine.current.deltaTime; Font font = new Font("Verdana", 12, FontStyle.Regular, GraphicsUnit.Point); Bitmap measureBitmap = new Bitmap(2, 2); Bitmap bitmap = null; System.Drawing.Graphics measureGraphics = System.Drawing.Graphics.FromImage(measureBitmap); measureGraphics.PageUnit = GraphicsUnit.Pixel; measureGraphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; measureGraphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias; SizeF size = measureGraphics.MeasureString(text, font); measureGraphics.Dispose(); measureBitmap.Dispose(); bitmap = new Bitmap((int)size.Width, (int)size.Height); System.Drawing.Graphics drawGraphics = System.Drawing.Graphics.FromImage(bitmap); drawGraphics.PageUnit = GraphicsUnit.Pixel; drawGraphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; drawGraphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias; drawGraphics.Clear(System.Drawing.Color.FromArgb(255, 0, 0, 0)); drawGraphics.DrawString(text, font, new SolidBrush(System.Drawing.Color.White), 0, 0); drawGraphics.Dispose(); if (texture) { texture.Dispose(); } texture = new Texture2D(bitmap, false, Texture2D.MemoryResidence.GPU); bitmap.Dispose(); if (mesh) { mesh.Dispose(); } positionVboData[0] = new Vector3f(0, 0, 0); positionVboData[1] = new Vector3f(0, texture.height, 0); positionVboData[2] = new Vector3f(texture.width, texture.height, 0); positionVboData[3] = new Vector3f(texture.width, 0, 0); mesh = new Mesh(); mesh.AddBuffer<VertexBufferObject3f>("vertex"); mesh.SetBuffer3f("vertex", positionVboData); mesh.AddBuffer<VertexBufferObject3f>("normal"); mesh.SetBuffer3f("normal", normalVboData); mesh.AddBuffer<VertexBufferObject2f>("uv0"); mesh.SetBuffer2f("uv0", uvVboData); mesh.SetIndices(indicesVboData, 0, Graphics.PrimitiveType.Triangles); MeshRenderer meshRenderer = sceneObject.GetModule<MeshRenderer>(); if (meshRenderer) { MaterialProperties properties = new MaterialProperties(); MaterialPropertyTexture2D texProperty = properties.AddProperty<MaterialPropertyTexture2D>("colorTexture"); texProperty.value = texture; meshRenderer.mesh = mesh; meshRenderer.overrideProperties = properties; } }
// for lazy loading and parsing of the material's XML file private void CheckMaterialCache() { if (m_cachedProperties != null) return; string fileName; if (Url.IsAbsoluteUri) fileName = Url.LocalPath; else fileName = Url.OriginalString; m_cachedProperties = new MaterialProperties(fileName); }
//-------------------------------------------------------------- /// <summary> /// Gets the <see cref="MaterialProperties"/> for the given rigid body, position and shape /// feature. /// </summary> /// <param name="body">The rigid body.</param> /// <param name="positionLocal"> /// The local position on the rigid body for which the material properties should be returned. /// </param> /// <param name="featureIndex"> /// The index of the shape feature from which the material properties are needed. For a /// <see cref="CompositeShape"/> the feature index is the index of the child of the composite /// shape. For a <see cref="TriangleMeshShape"/> the feature index is the index of a triangle. /// </param> /// <returns> /// The <see cref="MaterialProperties"/> of the given rigid body at the given position and /// child feature. /// </returns> public MaterialProperties GetProperties(RigidBody body, Vector3F positionLocal, int featureIndex) { MaterialProperties parameters = new MaterialProperties( StaticFriction, DynamicFriction, Restitution, SupportsSurfaceMotion, SurfaceMotion); return parameters; }
/// <summary> /// Initializes a new instance of the <see cref="UniformMaterial"/> class from a given material. /// </summary> /// <param name="name">The name of the material. Can be <see langword="null"/>.</param> /// <param name="material">The material from which the properties are copied.</param> public UniformMaterial(string name, MaterialProperties material) { Name = name; DynamicFriction = material.DynamicFriction; StaticFriction = material.StaticFriction; Restitution = material.Restitution; SupportsSurfaceMotion = material.SupportsSurfaceMotion; _surfaceMotion = material.SurfaceMotion; }