private void loadModel(string filename) { //MessageBox.Show(Environment.GetCommandLineArgs()[0] + " " + Environment.GetCommandLineArgs()[1]); Stream meshStream = File.OpenRead(filename); MadScience.Render.modelInfo newModel = MadScience.Render.Helpers.geomToModel(meshStream); meshStream.Close(); renderWindow1.statusLabel.Text = "Loaded " + filename; renderWindow1.setModel(newModel); renderWindow1.resetDevice(); // If loading from command line, set mode to wireframe renderWindow1.CurrentFillMode = 0; renderWindow1.RenderEnabled = true; toolStripStatusLabel1.Text = "Loaded " + filename; }
private void openToolStripMenuItem_Click(object sender, EventArgs e) { openFileDialog1.Filter = "Sims 3 Geometry Mesh|*.simgeom"; if (openFileDialog1.ShowDialog() == DialogResult.OK && openFileDialog1.FileName.Trim() != "") { Stream meshStream = File.OpenRead(openFileDialog1.FileName); MadScience.Render.modelInfo newModel = MadScience.Render.Helpers.geomToModel(meshStream); meshStream.Close(); renderWindow1.statusLabel.Text = "Loaded " + openFileDialog1.FileName; renderWindow1.setModel(newModel); renderWindow1.resetDevice(); // If loading from command line, set mode to wireframe renderWindow1.CurrentFillMode = 0; renderWindow1.RenderEnabled = true; } }
private void Render_Load(object sender, EventArgs e) { if (Environment.GetCommandLineArgs().Length > 1) { //MessageBox.Show(Environment.GetCommandLineArgs()[0] + " " + Environment.GetCommandLineArgs()[1]); Stream meshStream = File.OpenRead(Environment.GetCommandLineArgs()[1].ToString()); MadScience.Render.modelInfo newModel = MadScience.Render.Helpers.geomToModel(meshStream); meshStream.Close(); renderWindow1.statusLabel.Text = "Loaded " + Environment.GetCommandLineArgs()[1].ToString(); renderWindow1.setModel(newModel); renderWindow1.resetDevice(); renderWindow1.RenderEnabled = true; } else { logMessageToFile("RenderEnabled: true"); renderWindow1.RenderEnabled = true; logMessageToFile("loadDefaultTextures"); //renderWindow1.loadDefaultTextures(); renderWindow1.resetDevice(); } }
public void reload3D(xmlChunkDetails details) { if (listView1.SelectedItems.Count == 1 && cEnable3DPreview.Checked == true) { // Get the Mesh links for the first LOD List <Stream> meshStreams = new List <Stream>(); // Use the VPXY to get the mesh lod Stream vpxyStream = KeyUtils.findKey(casPartSrc.tgi64list[casPartSrc.tgiIndexVPXY], 0); if (StreamHelpers.isValidStream(vpxyStream)) { VPXYFile vpxyFile = new VPXYFile(vpxyStream); // Get the first VPXY internal link if (vpxyFile.vpxy.linkEntries.Count >= 1 && vpxyFile.vpxy.linkEntries[0].tgiList.Count >= 1) { for (int i = 0; i < vpxyFile.vpxy.linkEntries[0].tgiList.Count; i++) { meshStreams.Add(KeyUtils.findKey(vpxyFile.vpxy.linkEntries[0].tgiList[i], 0)); } } vpxyStream.Close(); } if (meshStreams.Count == 0) // || ((casPartSrc.typeFlag & 0x1) == 0x1)) { ResourceKey findKey = findDefaultMeshes(casPartNew.ageGenderFlag, casPartNew.typeFlag); if (findKey.groupId != 0 && findKey.instanceId != 0) { meshStreams.Add(KeyUtils.findKey(findKey, 0)); } } const uint cBody = 4; const uint cTop = 5; const uint cBottom = 6; const uint cFeet = 7; //Load missing meshes. For example if we show a bottom, load a nude top and nude feet switch (casPartNew.clothingType) { case cBody: meshStreams.Add(findMesh(casPartNew.ageGenderFlag, "Feet")); break; case cTop: meshStreams.Add(findMesh(casPartNew.ageGenderFlag, "Feet")); meshStreams.Add(findMesh(casPartNew.ageGenderFlag, "Bottom")); break; case cBottom: meshStreams.Add(findMesh(casPartNew.ageGenderFlag, "Feet")); meshStreams.Add(findMesh(casPartNew.ageGenderFlag, "Top")); break; case cFeet: meshStreams.Add(findMesh(casPartNew.ageGenderFlag, "Top")); meshStreams.Add(findMesh(casPartNew.ageGenderFlag, "Bottom")); break; } if (meshStreams.Count > 0) { renderWindow1.BackgroundColour = MadScience.Colours.convertColour(MadScience.Helpers.getRegistryValue("renderBackgroundColour")); // For each model, go through, get the model info and send it to the render window for (int i = 0; i < meshStreams.Count; i++) { MadScience.Render.modelInfo newModel = MadScience.Render.Helpers.geomToModel(meshStreams[i]); newModel.name = txtMeshName.Text; //renderWindow1.loadDefaultTextures(); renderWindow1.setModel(newModel, i); } reloadTextures(details); renderWindow1.RenderEnabled = true; } else { renderWindow1.statusLabel.Text = "Sorry, we could not find a mesh!"; } } }