DGL
https://delphigl.com/forum/

MDC Format - Return To Castle Wolfenstein
https://delphigl.com/forum/viewtopic.php?f=19&t=3411
Seite 1 von 1

Autor:  Stucuk [ Mi Okt 27, 2004 17:06 ]
Betreff des Beitrags:  MDC Format - Return To Castle Wolfenstein

Iv recently been able to load MDC files with minimal errors (loading errors, b4 it would always crash at rendering due to me loading sections wrong). Anyway there is still errors,

1st being that some surfaces arn't loaded due to them not having an ulindent of 7 (if indent is <> 7 then the rest of the surface header is corrupt/loaded wrong) but for some odd reason the first few surfaces are loaded with no visible errors.

2nd error is that all there surfaces tryangles seem to be drawn on top of each other.

Below is my MCDUnit and a PDF about MDC formats and the C surce for loading mdc's.

Dateianhänge:
Dateikommentar: UnitMDC.pas, Resources.zip(With PDF and 2 lots of source code on MDC and MDS loading)
MDC.zip [153.02 KiB]
381-mal heruntergeladen

Autor:  Stucuk [ Do Okt 28, 2004 04:20 ]
Betreff des Beitrags: 

MDC Info:
http://www.planetwolfenstein.com/themdcfile/intro.htm

I created a MDC view program (Displays the file in a TreeView) which is based on MDC View from the site above. Iv corrected some errors but the current 2 are:

1. TagFrames arn't the same in my MDC view as they are in the site's MDC view
2. Base frames are not loaded right

On an other note, anyone know how to stop a TTreeView from refreshing? The program hangs for about 10 secs while the data is shoved into the TTreeView.

Source Code, Exe's of Both MDC View's and Head.mdc from RTCW can be downloaded from:

Helios_MDCView.zip (330KB)

Autor:  rswm [ Do Okt 28, 2004 08:02 ]
Betreff des Beitrags: 

befor you start loading the data into the treeview, you have to call UpdateBegin (function of treeview) and after you loaded your data into the treeview you call UpdateEnd.

druing this time the treeview doesnt refresh so its faster !!!!

Autor:  Stucuk [ Mo Nov 01, 2004 05:05 ]
Betreff des Beitrags: 

MDC.CPP - void CMDC::PreparePointers (void)
Code:
  1.  
  2.  
  3.   lpTags = new Tag [lpFileHeader->ulNumTags];
  4.   for (ul = 0; ul < lpFileHeader->ulNumTags; ul++)
  5.   {
  6.     lpTags[ul].lpTagName   = &lpTagNames[ul];
  7.     lpTags[ul].lpTagFrames = (TagFrame *)
  8.       (
  9.         lpuc +
  10.         lpFileHeader->ulOffsetTagFrames +
  11.         ul * lpFileHeader->ulNumFrames * sizeof(TagFrame)
  12.       );
  13.   }
  14.  
  15.  


UNITMDC.PAS - Procedure LoadMDC(Var Model : TMDCFile; Const Filename : String);
Code:
  1.  
  2.  
  3. Seek(F,Model.Header.ulOffsetTagNames);
  4. If model.Header.ulNumTags > 0 then
  5. for x := 0 to Model.Header.ulNumTags-1 do
  6. BlockRead(f,Model.TagName[x],sizeof(TMDCTagName));
  7.  
  8. Seek(F,Model.Header.ulOffsetTagFrames);
  9. If model.Header.ulNumTags > 0 then
  10. for x := 0 to Model.Header.ulNumTags-1 do
  11. for y := 0 to Model.Header.ulNumFrames-1 do
  12. BlockRead(f,Model.TagFrame[x][y],sizeof(TMDCTagFrame));
  13.  
  14.  


Looking at the C code the delphi code seems to read from the right part of the file, dispite the fact that ulOffsetTagNames = ulOffsetTagFrames.

Autor:  Stucuk [ Mo Apr 11, 2005 08:40 ]
Betreff des Beitrags: 

:) At last i can now load mdc's! (TagFrames don't load right yet....)

Ill post the mdc code and an example once iv made the example and finished the mdc code.

Dateianhänge:
MapViewer10_MDC.jpg [59.2 KiB]
68-mal heruntergeladen

Autor:  Stucuk [ Mo Apr 11, 2005 23:34 ]
Betreff des Beitrags: 

Animation working and running smoothly (tho need to work out how to make it run at the same rate even with low fps). Still need to make example app.

Dateianhänge:
MapViewer13_MDC_Textured_Flags.JPG [54.31 KiB]
45-mal heruntergeladen
MapViewer10_MDC_Textured.jpg [96.18 KiB]
45-mal heruntergeladen

Autor:  Stucuk [ Mi Apr 13, 2005 01:19 ]
Betreff des Beitrags: 

OpenSource: MDC Viewer

Still to do
Load TagFrames, currently they don't load the data correctly. Used for things like Flash positions (cordinates that other models can be joined to if im correct)
Make it order the faces by depth. Currently some faces overlap faces when they shouldn't. (only seems to happen with shaders that use blending)

Download

- Exe
- Source (Attached to Post)

Edit:

Always helpful to forget the usage bit....

Usage
Extract rtcw's pk3 files to the directory called RTCW in the folder u place the exe. Or extract any model files u find on the net to there. Program uses <PROGRAM LOCATION>\RTCW\ as the base dir for loading textures and shaders.

Dateianhänge:
MDCModelViewer_Source.zip [136.58 KiB]
368-mal heruntergeladen
MDCModelViewer_Preview1.jpg [148.82 KiB]
24-mal heruntergeladen

Seite 1 von 1 Alle Zeiten sind UTC + 1 Stunde
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/