private void textureOpenFileDialog_FileOk(object sender, CancelEventArgs e) { System.Windows.Forms.OpenFileDialog dlg = (OpenFileDialog)sender; String filename = dlg.FileName; String text = parameterComboBox1.Text; uint paramName = GodzUtil.GetHashCode(text); MaterialParameter mp = mMaterial.getParameter(paramName); if (mp == null) { MessageBox.Show("Could not find the parameter!"); return; } //next, import the texture bool isLoaded = mp.loadTexture(mMaterial.getPackage(), filename); if (!isLoaded) { MessageBox.Show("Could not load the texture!"); return; } //populate the textbox parameterTextBox.Text = filename; }
public static MaterialParameter[] GetPublicParameters(MaterialBase material) { var materialParameters = material.Parameters; int parameterCount = 0; for (int i = 0; i < materialParameters.Length; i++) { if (!materialParameters[i].IsPublic) { continue; } parameterCount++; } var publicParameters = new MaterialParameter[parameterCount]; for (int i = 0, j = 0; i < materialParameters.Length; i++) { if (!materialParameters[i].IsPublic) { continue; } publicParameters[j] = materialParameters[i]; j++; } return(publicParameters); }
public IEnumerator FiddleColor(MaterialParameter param) { Color o = material.GetColor(param.parameterName); Color c = o; float i = 0f; while (i < 1f) { i += Time.deltaTime * 6f; material.SetColor(param.parameterName, Color.HSVToRGB(0f, 0.9f, 0.9f)); yield return(new WaitForEndOfFrame()); } while (t < fiddleTime) { param.valueC = Color.HSVToRGB(Mathf.Repeat(tf * param.repeat, 1f), 0.9f, 0.9f); material.SetColor(param.parameterName, param.valueC); yield return(new WaitForEndOfFrame()); } i = 0f; while (i < 1f) { i += Time.deltaTime * 6f; material.SetColor(param.parameterName, Color.Lerp(c, o, i)); yield return(new WaitForEndOfFrame()); } material.SetColor(param.parameterName, o); currentParameterIndex = currentParameterIndex + 1; StartCoroutine(Unfiddle()); }
public void ManualFiddle() { if (currentParameterIndex < 0) { return; } MaterialParameter param = parameters[currentParameterIndex]; if (material.HasProperty(param.parameterName)) { switch (param.type) { case MaterialParameter.MaterialParamType.number: material.SetFloat(param.parameterName, param.value); break; case MaterialParameter.MaterialParamType.color: material.SetColor(param.parameterName, param.valueC); break; case MaterialParameter.MaterialParamType.vector: material.SetVector(param.parameterName, param.value4); break; case MaterialParameter.MaterialParamType.texture: if (param.textures.Count > 0) { material.SetTexture(param.parameterName, param.textures[param.texID]); } break; default: break; } } }
public static void Material(MaterialFace face, MaterialParameter pname, Vector4 @params) { unsafe { Material(face, pname, (float *)&@params.X); } }
public static void TextureMaterialEXT(MaterialFace face, MaterialParameter mode) { Debug.Assert(Delegates.pglTextureMaterialEXT != null, "pglTextureMaterialEXT not implemented"); Delegates.pglTextureMaterialEXT((Int32)face, (Int32)mode); LogCommand("glTextureMaterialEXT", null, face, mode); DebugCheckErrors(null); }
public void ManualRead() { if (currentParameterIndex < 0) { return; } MaterialParameter param = parameters[currentParameterIndex]; if (material.HasProperty(param.parameterName)) { switch (param.type) { case MaterialParameter.MaterialParamType.number: param.value = material.GetFloat(param.parameterName); break; case MaterialParameter.MaterialParamType.color: param.valueC = material.GetColor(param.parameterName); break; case MaterialParameter.MaterialParamType.vector: param.value4 = material.GetVector(param.parameterName); break; case MaterialParameter.MaterialParamType.texture: break; default: break; } } }
private static float[] GetMaterial(MaterialFace materialFace, MaterialParameter materialParameter) { var @params = new float[4]; GL.GetMaterial(materialFace, materialParameter, @params); return(@params); }
public static void FragmentColorMaterialSGIX(MaterialFace face, MaterialParameter mode) { Debug.Assert(Delegates.pglFragmentColorMaterialSGIX != null, "pglFragmentColorMaterialSGIX not implemented"); Delegates.pglFragmentColorMaterialSGIX((int)face, (int)mode); LogCommand("glFragmentColorMaterialSGIX", null, face, mode); DebugCheckErrors(null); }
public static void FragmentMaterialSGIX(MaterialFace face, MaterialParameter pname, int param) { Debug.Assert(Delegates.pglFragmentMaterialiSGIX != null, "pglFragmentMaterialiSGIX not implemented"); Delegates.pglFragmentMaterialiSGIX((int)face, (int)pname, param); LogCommand("glFragmentMaterialiSGIX", null, face, pname, param); DebugCheckErrors(null); }
public static void Material(MaterialFace face, MaterialParameter pname, Color4 @params) { unsafe { GL.Material(face, pname, (float *)&@params); } }
public Param(byte[] bytes, int pos) { paramType = (MaterialParameter)Utility.ReadInt32BigEndian(bytes, pos); pos += 4; unk = Utility.ReadInt32BigEndian(bytes, pos); pos += 4; dataSizeDividedBy4 = Utility.ReadInt32BigEndian(bytes, pos); pos += 4; dataOffset = Utility.ReadInt32BigEndian(bytes, pos); }
private void pickTextureButton_Click(object sender, EventArgs e) { //get the parameter type String text = parameterComboBox1.Text; uint paramName = GodzUtil.GetHashCode(text); MaterialParameter mp = mMaterial.getParameter(paramName); if (mp != null) { MaterialParameterType ty = mp.getType(); if (ty == MaterialParameterType.MaterialParameter_Texture) { textureOpenFileDialog.ShowDialog(); } else { mp.clearValues(); String value = parameterTextBox.Text; // Split string on comma - tokenize string[] words = value.Split(','); foreach (string word in words) { float v = float.Parse(word); mp.addValue(v); } mp.submitValues(); } } }
public static void FragmentColorMaterialSGIX(MaterialFace face, MaterialParameter mode) { Debug.Assert(Delegates.pglFragmentColorMaterialSGIX != null, "pglFragmentColorMaterialSGIX not implemented"); Delegates.pglFragmentColorMaterialSGIX((Int32)face, (Int32)mode); LogFunction("glFragmentColorMaterialSGIX({0}, {1})", face, mode); DebugCheckErrors(null); }
public static void FragmentMaterialSGIX(MaterialFace face, MaterialParameter pname, Int32 param) { Debug.Assert(Delegates.pglFragmentMaterialiSGIX != null, "pglFragmentMaterialiSGIX not implemented"); Delegates.pglFragmentMaterialiSGIX((Int32)face, (Int32)pname, param); LogFunction("glFragmentMaterialiSGIX({0}, {1}, {2})", face, pname, param); DebugCheckErrors(null); }
public MaterialParameter(MaterialParameter other) { parameterName = other.parameterName; displayName = other.displayName; repeat = other.repeat; type = other.type; min = other.min; max = other.max; min4 = other.min4; max4 = other.max4; textures = new List <Texture>(other.textures); }
public static void FragmentMaterialSGIX(MaterialFace face, MaterialParameter pname, float[] @params) { unsafe { fixed(float *p_params = @params) { Debug.Assert(Delegates.pglFragmentMaterialfvSGIX != null, "pglFragmentMaterialfvSGIX not implemented"); Delegates.pglFragmentMaterialfvSGIX((Int32)face, (Int32)pname, p_params); LogCommand("glFragmentMaterialfvSGIX", null, face, pname, @params); } } DebugCheckErrors(null); }
public static void GetFragmentMaterialSGIX(MaterialFace face, MaterialParameter pname, [Out] Int32[] @params) { unsafe { fixed(Int32 *p_params = @params) { Debug.Assert(Delegates.pglGetFragmentMaterialivSGIX != null, "pglGetFragmentMaterialivSGIX not implemented"); Delegates.pglGetFragmentMaterialivSGIX((Int32)face, (Int32)pname, p_params); LogFunction("glGetFragmentMaterialivSGIX({0}, {1}, {2})", face, pname, LogValue(@params)); } } DebugCheckErrors(null); }
public static void GetFragmentMaterialSGIX(MaterialFace face, MaterialParameter pname, [Out] int[] @params) { unsafe { fixed(int *p_params = @params) { Debug.Assert(Delegates.pglGetFragmentMaterialivSGIX != null, "pglGetFragmentMaterialivSGIX not implemented"); Delegates.pglGetFragmentMaterialivSGIX((int)face, (int)pname, p_params); LogCommand("glGetFragmentMaterialivSGIX", null, face, pname, @params); } } DebugCheckErrors(null); }
public IEnumerator FiddleTexture(MaterialParameter param) { Texture o = material.GetTexture(param.parameterName); while (t < fiddleTime) { int id = ( int )Mathf.Floor(tf * param.textures.Count); param.value = Mathf.Clamp01((float)id / (float)param.textures.Count); material.SetTexture(param.parameterName, param.textures[id]); yield return(new WaitForEndOfFrame()); } material.SetTexture(param.parameterName, o); currentParameterIndex = currentParameterIndex + 1; StartCoroutine(Unfiddle()); }
public IEnumerator FiddleVector(MaterialParameter param) { Vector4 o = material.GetVector(param.parameterName); while (t < fiddleTime) { float v = -Mathf.Cos(tf * Mathf.PI * 1.5f * param.repeat) * 0.5f + 0.5f; param.value4 = Vector4.Lerp(param.min4, param.max4, v); material.SetVector(param.parameterName, param.value4); yield return(new WaitForEndOfFrame()); } material.SetVector(param.parameterName, o); currentParameterIndex = currentParameterIndex + 1; StartCoroutine(Unfiddle()); }
public void FiddleParameter() { MaterialParameter p = parameters[currentParameterIndex]; if (material.HasProperty(p.parameterName)) { switch (p.type) { case MaterialParameter.MaterialParamType.number: StartCoroutine(FiddleFloat(p)); break; case MaterialParameter.MaterialParamType.color: StartCoroutine(FiddleColor(p)); break; case MaterialParameter.MaterialParamType.texture: StartCoroutine(FiddleTexture(p)); break; case MaterialParameter.MaterialParamType.vector: StartCoroutine(FiddleVector(p)); break; } } else { Debug.Log("Material Parameter Not Found: " + p.parameterName); } }
void Update() { if (rdrs != null && tempMats != null && parameters != null) { for (int i = 0; i < tempMats.Length; ++i) { for (int j = 0; j < parameters.Length; ++j) { MaterialParameter param = parameters[j]; switch (param.paramType) { case EMaterialParameterType.数值: tempMats[i].SetFloat(param.paramName, param.paramFloatValue); break; case EMaterialParameterType.颜色: tempMats[i].SetColor(param.paramName, param.paramColorValue); break; } } } } }
private void parameterComboBox1_SelectedIndexChanged(object sender, EventArgs e) { //get the parameter type String text = parameterComboBox1.Text; uint paramName = GodzUtil.GetHashCode(text); MaterialParameter mp = mMaterial.getParameter(paramName); if (mp != null) { parameterTextBox.Text = ""; //select the type MaterialParameterType ty = mp.getType(); if (ty == MaterialParameterType.MaterialParameter_Texture) { parameterTypeComboBox.SelectedIndex = 0; } else { parameterTypeComboBox.SelectedIndex = 1; //set float value.... String text2 = ""; uint num = mp.getNumFloats(); for (uint i = 0; i < num; i++) { text2 += mp.getFloat(i).ToString(); if (i < num - 1) { text2 += ","; } } parameterTextBox.Text = text2; } } }
public IEnumerator FiddleFloat(MaterialParameter p) { float o = material.GetFloat(p.parameterName); p.value = o; float i = 0f; while (i < 1f) { i += Time.deltaTime * 6f; p.value = Mathf.Lerp(p.value, 0f, i); material.SetFloat(p.parameterName, p.value); yield return(new WaitForEndOfFrame()); } while (t < fiddleTime) { float v = -Mathf.Cos(tf * Mathf.PI * 1.5f * p.repeat) * 0.5f + 0.5f; p.value = Mathf.Lerp(p.min, p.max, v); material.SetFloat(p.parameterName, p.value); yield return(new WaitForEndOfFrame()); } i = 0f; while (i < 1f) { i += Time.deltaTime * 6f; p.value = Mathf.Lerp(p.value, o, i); material.SetFloat(p.parameterName, p.value); yield return(new WaitForEndOfFrame()); } currentParameterIndex = currentParameterIndex + 1; StartCoroutine(Unfiddle()); }
public RenderPrefabs() { GizmoRed = new IMaterial(); GizmoBlue = new IMaterial(); GizmoGreen = new IMaterial(); GizmoRed.MaterialName.String = "GizmoRed"; GizmoRed.MaterialName.Hash = 1337; GizmoBlue.MaterialName.String = "GizmoBlue"; GizmoBlue.MaterialName.Hash = 1338; GizmoGreen.MaterialName.String = "GizmoGreen"; GizmoGreen.MaterialName.Hash = 1339; GizmoRed.ShaderID = GizmoBlue.ShaderID = GizmoGreen.ShaderID = 3854590933660942049; GizmoRed.ShaderHash = GizmoBlue.ShaderHash = GizmoGreen.ShaderHash = 601151254; MaterialParameter param = new MaterialParameter(); param.ID = "C002"; param.Paramaters = new float[4] { 1.0f, 0.0f, 0.0f, 1.0f }; GizmoRed.Parameters.Add(param); param = new MaterialParameter(); param.ID = "C002"; param.Paramaters = new float[4] { 0.0f, 0.0f, 1.0f, 1.0f }; GizmoBlue.Parameters.Add(param); param = new MaterialParameter(); param.ID = "C002"; param.Paramaters = new float[4] { 0.0f, 1.0f, 0.0f, 1.0f }; GizmoGreen.Parameters.Add(param); }
internal static extern void glMaterialf(MaterialFace face, MaterialParameter pname, Single param);
public static extern void Materialfv( MaterialFace face, MaterialParameter pname, float[] @params );
public static extern void Materialf( MaterialFace face, MaterialParameter pname, float param );
public static void Material(MaterialFace face, MaterialParameter pname, float param) { Debug.Assert(Delegates.pglMaterialf != null, "pglMaterialf not implemented"); Delegates.pglMaterialf((Int32)face, (Int32)pname, param); LogFunction("glMaterialf({0}, {1}, {2})", face, pname, param); }
public static void Material(GLFace face, MaterialParameter pname, int[] parameters) { gl.glMaterialiv((int)face, (int)pname, parameters); }
internal static extern void glMaterialiv(MaterialFace face, MaterialParameter pname, [OutAttribute] Int32* @params);
public abstract void FragmentColorMaterial([Flow(FlowDirection.In)] SGIX face, [Flow(FlowDirection.In)] MaterialParameter mode);
public static extern void TextureMaterialEXT( MaterialFace face, MaterialParameter mode );
public static void GetFragmentMaterialivSGIX( MaterialFace face, MaterialParameter pname, [Out]int[] @params ) { if (_GetFragmentMaterialivSGIX == null) throw new Exception( "Extension method GetFragmentMaterialivSGIX not found" ); _GetFragmentMaterialivSGIX( face, pname, @params ); }
public static extern void GetMaterialiv( MaterialFace face, MaterialParameter pname, [Out]int[] @params );
public static extern void Materialiv( MaterialFace face, MaterialParameter pname, int[] @params );
public static void Material(MaterialFace face, MaterialParameter pname, Int32 param) { Debug.Assert(Delegates.pglMateriali != null, "pglMateriali not implemented"); Delegates.pglMateriali((Int32)face, (Int32)pname, param); CallLog("glMateriali({0}, {1}, {2})", face, pname, param); }
public abstract unsafe void FragmentMaterial([Flow(FlowDirection.In)] SGIX face, [Flow(FlowDirection.In)] MaterialParameter pname, [Count(Computed = "pname"), Flow(FlowDirection.In)] int * @params);
internal static extern void glMaterialfv(MaterialFace face, MaterialParameter pname, [OutAttribute] Single* @params);
public static void Material(MaterialFace face, MaterialParameter pname, Color4 @params) { unsafe { GL.Material(face, pname, (float*)&@params); } }
internal static extern void glMateriali(MaterialFace face, MaterialParameter pname, Int32 param);
public static uint BindMaterialParameterEXT( MaterialFace face, MaterialParameter value ) { if (_BindMaterialParameterEXT == null) throw new Exception( "Extension method BindMaterialParameterEXT not found" ); return _BindMaterialParameterEXT( face, value ); }
public static void TextureMaterialEXT(MaterialFace face, MaterialParameter mode) { Debug.Assert(Delegates.pglTextureMaterialEXT != null, "pglTextureMaterialEXT not implemented"); Delegates.pglTextureMaterialEXT((Int32)face, (Int32)mode); CallLog("glTextureMaterialEXT({0}, {1})", face, mode); DebugCheckErrors(); }
public static void Material(MaterialFace face, MaterialParameter pname, Vector4 @params) { unsafe { Material(face, pname, (float*)&@params.X); } }
public static void GetFragmentMaterialSGIX(MaterialFace face, MaterialParameter pname, [Out] Int32[] @params) { unsafe { fixed (Int32* p_params = @params) { Debug.Assert(Delegates.pglGetFragmentMaterialivSGIX != null, "pglGetFragmentMaterialivSGIX not implemented"); Delegates.pglGetFragmentMaterialivSGIX((Int32)face, (Int32)pname, p_params); LogFunction("glGetFragmentMaterialivSGIX({0}, {1}, {2})", face, pname, LogValue(@params)); } } DebugCheckErrors(null); }
public void Material(GLFace face, MaterialParameter pname, int param) { gl.glMateriali((int)face, (int)pname, param); // Don't check for error, because this is called between // glBegin()/glEnd() //CheckException(); }
public static UInt32 BindMaterialParameterEXT(MaterialFace face, MaterialParameter value) { UInt32 retValue; Debug.Assert(Delegates.pglBindMaterialParameterEXT != null, "pglBindMaterialParameterEXT not implemented"); retValue = Delegates.pglBindMaterialParameterEXT((Int32)face, (Int32)value); CallLog("glBindMaterialParameterEXT({0}, {1}) = {2}", face, value, retValue); DebugCheckErrors(); return (retValue); }
public static void Material(MaterialFace face, MaterialParameter pname, float[] @params) { unsafe { fixed (float* p_params = @params) { Debug.Assert(Delegates.pglMaterialfv != null, "pglMaterialfv not implemented"); Delegates.pglMaterialfv((Int32)face, (Int32)pname, p_params); LogFunction("glMaterialfv({0}, {1}, {2})", face, pname, LogValue(@params)); } } DebugCheckErrors(null); }
public static extern void Materiali( MaterialFace face, MaterialParameter pname, int param );
public static void FragmentColorMaterialSGIX( MaterialFace face, MaterialParameter mode ) { if (_FragmentColorMaterialSGIX == null) throw new Exception( "Extension method FragmentColorMaterialSGIX not found" ); _FragmentColorMaterialSGIX( face, mode ); }
public static void Material(GLFace face, MaterialParameter pname, float param) { gl.glMaterialf((int)face, (int)pname, param); }
public abstract void FragmentMaterial([Flow(FlowDirection.In)] SGIX face, [Flow(FlowDirection.In)] MaterialParameter pname, [Flow(FlowDirection.In)] int param);
public static void FragmentMaterialfvSGIX( MaterialFace face, MaterialParameter pname, float[] @params ) { if (_FragmentMaterialfvSGIX == null) throw new Exception( "Extension method FragmentMaterialfvSGIX not found" ); _FragmentMaterialfvSGIX( face, pname, @params ); }
public abstract void GetFragmentMaterial([Flow(FlowDirection.In)] SGIX face, [Flow(FlowDirection.In)] MaterialParameter pname, [Count(Computed = "pname"), Flow(FlowDirection.Out)] out int @params);
public static void FragmentMaterialiSGIX( MaterialFace face, MaterialParameter pname, int param ) { if (_FragmentMaterialiSGIX == null) throw new Exception( "Extension method FragmentMaterialiSGIX not found" ); _FragmentMaterialiSGIX( face, pname, param ); }
public static void Material(MaterialFace face, MaterialParameter pname, Int32[] @params) { unsafe { fixed (Int32* p_params = @params) { Debug.Assert(Delegates.pglMaterialiv != null, "pglMaterialiv not implemented"); Delegates.pglMaterialiv((Int32)face, (Int32)pname, p_params); CallLog("glMaterialiv({0}, {1}, {2})", face, pname, @params); } } DebugCheckErrors(); }
public static void GetFragmentMaterialSGIX(MaterialFace face, MaterialParameter pname, [Out] float[] @params) { unsafe { fixed (float* p_params = @params) { Debug.Assert(Delegates.pglGetFragmentMaterialfvSGIX != null, "pglGetFragmentMaterialfvSGIX not implemented"); Delegates.pglGetFragmentMaterialfvSGIX((Int32)face, (Int32)pname, p_params); CallLog("glGetFragmentMaterialfvSGIX({0}, {1}, {2})", face, pname, @params); } } DebugCheckErrors(); }