private void cbWriteMask_CheckStateChanged(object sender, EventArgs e) { if (_populating) { return; } // update the write mask. Bootstrap.MaterialPass.WriteChannel writeMask = 0; if (cbRedMask.Checked) { writeMask |= Bootstrap.MaterialPass.WriteChannel.Red; } if (cbGreenMask.Checked) { writeMask |= Bootstrap.MaterialPass.WriteChannel.Green; } if (cbBlueMask.Checked) { writeMask |= Bootstrap.MaterialPass.WriteChannel.Blue; } if (cbAlphaMask.Checked) { writeMask |= Bootstrap.MaterialPass.WriteChannel.Alpha; } if (cbDepthMask.Checked) { writeMask |= Bootstrap.MaterialPass.WriteChannel.Depth; } // set the write mask. _materialPass.WriteMask = writeMask; }
private void UpdateControls() { // protect against unintentional changes to settings. _populating = true; // update the shader drop-downs. UpdateShaderDropDowns(); // now update other controls. cbLightShader.Text = _materialPass.Shader; cbAmbientShader.Text = _materialPass.AmbientShader; // update the color mod/add values. Util.Drawing.FillPictureBox(pbMinLightResponse, _materialPass.MinLightResponse); Util.Drawing.FillPictureBox(pbMaxLightResponse, _materialPass.MaxLightResponse); Util.Drawing.FillPictureBox(pbVertexColorMod, _materialPass.VertexColorMod); Util.Drawing.FillPictureBox(pbVertexColorAdd, _materialPass.VertexColorAdd); // update the shadow checkboxes. cbCastShadow.Checked = _materialPass.CastShadow; cbReceiveShadow.Checked = _materialPass.ReceiveShadow; // update the write mask checkboxes. Bootstrap.MaterialPass.WriteChannel writeMask = _materialPass.WriteMask; cbRedMask.Checked = (writeMask & Bootstrap.MaterialPass.WriteChannel.Red) != 0; cbGreenMask.Checked = (writeMask & Bootstrap.MaterialPass.WriteChannel.Green) != 0; cbBlueMask.Checked = (writeMask & Bootstrap.MaterialPass.WriteChannel.Blue) != 0; cbAlphaMask.Checked = (writeMask & Bootstrap.MaterialPass.WriteChannel.Alpha) != 0; cbDepthMask.Checked = (writeMask & Bootstrap.MaterialPass.WriteChannel.Depth) != 0; _materialPass.WriteMask = writeMask; if (_materialPass.Textures.Rotate != null) { tbRotate.Text = _materialPass.Textures.Rotate.Decompile(); } else { tbRotate.Text = "0.0"; } UpdateScriptPreview(tbScaleU, _materialPass.Textures.ScaleS, "1.0"); UpdateScriptPreview(tbScaleV, _materialPass.Textures.ScaleT, "1.0"); UpdateScriptPreview(tbTranslateU, _materialPass.Textures.TranslateS, "0.0"); UpdateScriptPreview(tbTranslateV, _materialPass.Textures.TranslateT, "0.0"); UpdateScriptPreview(tbRotate, _materialPass.Textures.Rotate, "0.0"); UpdateScriptPreview(tbRotateCenterU, _materialPass.Textures.RotateCenterS, "0.0"); UpdateScriptPreview(tbRotateCenterV, _materialPass.Textures.RotateCenterT, "0.0"); _populating = false; }