private void tbtnGuardar_Click(object sender, EventArgs e) { if (txtNombre.Text != "" || txtDescripcion.Text != "" || txtCapturarIdSubCategoria.Text != "") { nMaterial objMaterial = new nMaterial(); objMaterial.Nombre = txtNombre.Text; objMaterial.Descripcion = txtDescripcion.Text; objMaterial.IdSubcategoria = Convert.ToInt32(txtCapturarIdSubCategoria.Text); //objMaterial.crearMaterial(); MessageBox.Show("Material ingresado con exito"); } else { MessageBox.Show("No deben haber campos vacios"); } MaterialDGV(dgvMaterial); }
private void readMatsSection() { UInt32 size = bReader.ReadUInt32(); Skip(4); UInt32 nMaterials = bReader.ReadUInt32(); UInt32 control = bReader.ReadUInt32(); if (nMaterials != control) throw new Exception("Strange problem occured"); Skip(4); for (UInt32 i = 0; i < nMaterials; i++) { Skip(95); byte nMaps = bReader.ReadByte(); nMaterial mat = new nMaterial(bReader.ReadChars(bReader.ReadInt32())); for (UInt32 j = 0; j < nMaps; j++) { Skip(26); byte xmacMapType = bReader.ReadByte(); Skip(1); char[] buf = new char[4]; //_itoa_s((j + 1), buf, 4, 10); no idea what this is //rmMap map((string("Map Nr. ").append(string(buf))), fs.readString(fs.readLong()).append(string(".jpg"))); char[] bf1 = bReader.ReadChars(bReader.ReadInt32()); nMap.nMapType t = nMap.nMapType.Diffuse; if (xmacMapType == 2) { // Diffuse. t = nMap.nMapType.Diffuse; } else if (xmacMapType == 3) { // Specular. t = nMap.nMapType.Specular; } else if (xmacMapType == 5) { // Normal. t = nMap.nMapType.Normal; } mat.Maps.Add(new nMap(chrTostr(bf1), t)); } Materials.Add(mat); } }