Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - ponut64

Pages: 1 ... 10 11 [12] 13 14 15
166
Share your code / Re: Model converter (.ZTP) -0.05 - WIP
« on: June 07, 2018, 04:41:44 am »
The bag has no depth to it, right? Just a plane?
In that case I would guess there's nothing you can do except make it dual-plane.

167
Share your code / Re: Model converter (.ZTP) -0.05 - WIP
« on: June 06, 2018, 09:46:13 pm »
Looks to me like there are just too many quads, but hey, you've probably done more with this than I have :)

168
Very sensible. And exciting.

While I haven't gotten any further, I may have found out that the fetches (NwFread) are what bog the system down (A bus) and the system probably isn't waiting for these functions to complete to continue, they just bog down the A bus and they end up waiting for one another to complete since the A bus is busy. So it should be simple to schedule the fetch from CD buffer in a user-defined 'acceptable fetch chunk' per frame. More can be done.

169
I got it working now. For some reason though I need to put it in a function that is in a jo callback area (as in, run it when jo_core is running). /e: Do note that is the INTENDED USE, ANYWAY.
I still need to work in some refinements, like getting it to load sector-by-sector and file-by-file so it doesn't pause everything else.
I might even see about doing memcpy in smaller increments.

Some manner of smooth file streaming like that must be possible, not for any specific purpose, just a technical curiosity. Thanks for your help XL2. You were right about the offset.

Code: [Select]
//Experimental
void * ztFileStream(Sint8 * filename, void * startAddress, entity_t * model, Sint8 dummy)
{

    memset_l((void*)startAddress,0x0000, (0xFFFE - ((Uint32)startAddress-(Uint32)LWRAM)));  //Not 100% necessary, since data can just be overwritten, but good for testing and see how much data a level takes
    void * currentAddress;
    currentAddress = startAddress;
//Data of read structure
    Sint32 fid = GFS_NameToId((Sint8*)filename);
GfsHn gfs;
Sint32 nsct;
Sint32 fsize;
//Sector step of reading.
Uint8 rd_step = 2;
//Data of read-in-process
Sint32 stat;
Sint32 rdsize;

Sint32 i;

//Model Data is the destination of data in the work area.
modelData_t bufModel;
//Destination address?
    void * ptr = &bufModel;

//Loading follows
gfs = GFS_Open(fid);
//Get sectors
GFS_GetFileSize(gfs, &nsct, NULL, NULL);
GFS_GetFileInfo(gfs, NULL, NULL, &fsize, NULL);
//Buffers are the destination of data in the CD area.
Uint32 buf1[rd_step * nsct / 4];
Uint8 *proc_bp;

// jo_printf(0, 18, "(%i)", nsct);
// jo_printf(0, 20, "(%i)", fsize);
// jo_printf(0, 22, "(%i)", proc_bp);
// jo_printf(0, 24, "(%i)", rdsize);

//Read from CD to CD buffer

GFS_NwCdRead(gfs, fsize);
GFS_SetTransPara(gfs, nsct);
GFS_NwFread(gfs, nsct, (Uint32*)currentAddress, fsize);
do{
GFS_NwExecOne(gfs);
GFS_NwGetStat(gfs, &stat, &rdsize);

}while (stat != GFS_SVR_COMPLETED && rdsize < fsize);

GFS_Close(gfs);

/**Copy gfs to modelData_t bufmodel???**/
memcpy_l((Sint32*)ptr, (Sint32*)(currentAddress), sizeof(modelData_t));

    /**ADDED**/
    model->pos[X]=bufModel.Origin[X]; model->pos[Y]=bufModel.Origin[Y]; model->pos[Z]=bufModel.Origin[Z];
    model->length[X]=bufModel.Length[X]; model->length[Y]=bufModel.Length[Y]; model->length[Z]=bufModel.Length[Z];
    model->nbMeshes=bufModel.TOTAL_MESH;

Uint16 first_texture = loadTextures(currentAddress, &bufModel);
Sint32 bytesOff = bufModel.TEXT_SIZE+(sizeof(modelData_t));
currentAddress = (void*)(currentAddress + bytesOff);
currentAddress = loadPDATA((void*)(currentAddress), model, &bufModel);
currentAddress = (void*)(currentAddress + (bufModel.PDATA_SIZE + sizeof(modelData_t)));
setTextures(first_texture, model, bufModel.TOTAL_MESH, true);

// jo_printf(0, 6, "(%i)", bufModel->TOTAL_MESH);
// jo_printf(0, 8, "(%i)", bufModel->PDATA_SIZE);
// jo_printf(0, 12, "(%i)", model->nbMeshes);

    return currentAddress;

}

Of course, make sure this only runs once.

170
Thinking out here again. I'm debugging things a little more closely. I've come to this.

It reads the correct amount of data to the CD buffer.
It completes and does not crash.
memcpy successfully copies the CD buffer data to the struct buffer from ptr.
The data copied is correct.
After setting the entity_t data from the modelData_t buffer using your commands, the data is correct.
But after it finishes loading binaries, it is gone. The mesh does not have any data, whether or not I load something else.

I am missing something very simple... something that if I understood it, I could probably use jo engine async reading system.

Quote
//Experimental
void * ztFileStream(Sint8 * filename, void * startAddress, entity_t * model, Sint8 dummy)
{
   
    memset_l((void*)startAddress,0x0000, (0xFFFE - ((Uint32)startAddress-(Uint32)LWRAM)));  //Not 100% necessary, since data can just be overwritten, but good for testing and see how much data a level takes
    void * currentAddress;
    currentAddress = startAddress;
//Data of read structure
    Sint32 fid = GFS_NameToId((Sint8*)filename);
   GfsHn gfs;
   Sint32 nsct;
   Sint32 fsize;
//Data of read-in-process
   Sint32 stat;
   Sint32 rdsize;
//Model Data is the destination of data in the work area.
   modelData_t bufModel;
//Destination address?
    void * ptr = &bufModel;
//Loading follows
   gfs = GFS_Open(fid);
//Get sectors
   GFS_GetFileSize(gfs, &nsct, NULL, NULL);
   GFS_GetFileInfo(gfs, NULL, NULL, &fsize, NULL);
   
jo_printf(0, 18, "(%i)", nsct);
jo_printf(0, 20, "(%i)", fsize);
jo_printf(0, 22, "(%i)", proc_bp);

   
//Read from CD to CD buffer

   GFS_NwCdRead(gfs, fsize);
   GFS_SetTransPara(gfs, nsct);
   GFS_NwFread(gfs, nsct, (Uint32*)currentAddress, fsize);
   do{
      GFS_NwExecOne(gfs);
      GFS_NwGetStat(gfs, &stat, &rdsize);
jo_printf(0, 24, "(%i)", rdsize);
   }while (stat != GFS_SVR_COMPLETED && rdsize < fsize);
   
   GFS_Close(gfs);
   
   /**Copy gfs to modelData_t bufmodel???**/
   memcpy_l((Sint32*)ptr, (Sint32*)(currentAddress), sizeof(modelData_t));
   
    /**ADDED**/
    model->pos[X]=bufModel.Origin[X]; model->pos[Y]=bufModel.Origin[Y]; model->pos[Z]=bufModel.Origin[Z];
    model->length[X]=bufModel.Length[X]; model->length[Y]=bufModel.Length[Y]; model->length[Z]=bufModel.Length[Z];
    model->nbMeshes=bufModel.TOTAL_MESH;
   
    Uint16 first_texture = loadTextures(startAddress, &bufModel);
    Sint32 bytesOff = bufModel.TEXT_SIZE+(sizeof(modelData_t)) - (bytesOff*2048);
   currentAddress = (void*)(currentAddress + bytesOff);
   currentAddress = loadPDATA((void*)(currentAddress), model, &bufModel);
   currentAddress = startAddress;
    setTextures(first_texture, model, bufModel.TOTAL_MESH, true);
   
   jo_printf(0, 14, "(%i)", bufModel.TOTAL_MESH);
   jo_printf(0, 16, "(%i)", bufModel.PDATA_SIZE);
   jo_printf(0, 10, "(%i)", model->nbMeshes);
   
          return currentAddress;
   
}

171
My man, I'm sure I speak for a lot of folks who may not even post here. I really appreciate what you do, and what Jo has done for all of us wanting to make games for the Saturn.
Binary model files of any kind was a huge step toward creating a fully fledged 3D game for the Saturn.. rather modularly
I hadn't any time to work on what I was doing today either, but at least I can write code that compiles

172
You know the way I was doing isn't technically how I wanted to do it anyway. I want to use the CD Buffer, and for that I need to first use NwCdRead then fetch from CD buffer into the work area.
I guess that's one way to potentially use the CD buffer as some sort of RAM.

173
Upon further reading, I can't think of why this would not work.
What happens? It does not load. All loading stops.

Code: [Select]
//Experimental
void * ztFileStream(Sint8 * filename, void * startAddress, entity_t * model, Sint8 dummy)
{

    memset_l((void*)startAddress,0x0000, (0xFFFE - ((Uint32)startAddress-(Uint32)LWRAM)));  //Not 100% necessary, since data can just be overwritten, but good for testing and see how much data a level takes
    void * currentAddress;
    currentAddress = startAddress;

    Sint32 fid = GFS_NameToId((Sint8*)filename);
GfsHn gfs;
Sint32 stat;
Sint32 nsct;
Sint32 bsize;
//Model Data is the destination of data.
modelData_t bufModel;
//Destination address?
    void * ptr = &bufModel;

//Loading follows
gfs = GFS_Open(fid);
//Get sectors
GFS_GetFileSize(gfs, &nsct, NULL, NULL);
bsize = 2048 * nsct;
// nsct = GFS_ByteToSct(gfs, bytesOf);

//modelData_t has an assumed size?
GFS_NwFread(gfs, nsct, (Uint32*)currentAddress, bsize);

//For loop is blank because this will run until GFS_Close, AKA always run until GFS_Close.
for(;;)
{
stat = GFS_NwExecOne(gfs);
if(stat == GFS_SVR_COMPLETED)
{
break;
}
//Copy gfs to modelData_t bufmodel???
memcpy_l((Sint32*)ptr, (Sint32*)(startAddress), (sizeof(modelData_t)));

    /**ADDED**/
    model->pos[X]=bufModel.Origin[X]; model->pos[Y]=bufModel.Origin[Y]; model->pos[Z]=bufModel.Origin[Z];
    model->length[X]=bufModel.Length[X]; model->length[Y]=bufModel.Length[Y]; model->length[Z]=bufModel.Length[Z];
    model->nbMeshes=bufModel.TOTAL_MESH;

    /**Load the texture list (using an offset to allow DMA transfer)**/
    Uint16 first_texture = loadTextures(startAddress, &bufModel);

    /**Load PDATA**/
    Sint32 bytesOff = bufModel.TEXT_SIZE+(sizeof(modelData_t)) - (bytesOff*2048);
    currentAddress = (void*)(currentAddress + bytesOff);

    currentAddress = loadPDATA((void*)currentAddress, model, &bufModel);

    /**Set textures**/
    setTextures(first_texture, model, bufModel.TOTAL_MESH, true);


}
GFS_Close(gfs);
    return currentAddress;

}

So what do we do:

1 - we set a new address so we don't overwrite the last data
2 - that address is now the current address
3 - we get a file ID from the file name
4 - variable and struct setup
? I question why bufModel is modelData_t and not entity_t, tried it one way or another it doesn't function properly
5 - Set GFS and GFS handler
6 - Get the file size in sectors, we don't need anything else (they are NULL).
6 - Set the size in bytes based on the sector size
7 - Queue the command NwFread for the file with current Address as the buffer area
8 - Execute NwFread in the open gfs
9 - When the server is complete with the file, stop the execution and
10 - memcpy destination bufModel, the source startAddress (which has never been set separate from currentAddress at this point BUT setting it to current causes unknown code crash), the size copied is the size of... you know.
? Why would current crash when it is no different from start...
? It doesn't crash or halt if everything past memcpy before GFS_Close is commented out.
11 What follows,
taking the contents of the buffered model data and putting it into the model which is the desired entity_t struct.

Truly, I know I don't really understand what is happening. Especially not enough to make a callback that could put the binary data into an entity_t struct from the Jo engine async read function.
I'm thinking in a forum post.

174
Returning before closing the file.. yeah that one is on me, I should have known that would halt the function and thus halt the CD system on that file.
That change, plus commenting everything else out, allows everything else to load as normal.

Jo engine ASYNC loading does in fact use NwFread so I will look that over.

/e
It looks to me whether using what I've written or what Jo engine does, I'd just need to get the read data where its supposed to go.
Could be handled in the callback in the jo engine async read function or in that part of the written code between break and GFS close.

175
Hey,

I've got the GFS_NwFread function and structure from the Workshop 95 slides, and it compiles and "runs".
Of course what I am trying to do is use it to read XL2's ZTP files, which have segmented data meant for a modelData_t struct.

It seems XL2 loads these in segments with GFS_Load, loading one segment has information relevant to loading the next segment.
Of course I'm here because I don't understand how exactly that works, I'm guessing the reason this doesn't work with GFS_NwFread is because I'm not arranging the memory addresses right.
I say that because it doesn't load any of the other models using the current Address variable called after my dysfunctional '"ztFileStream" function is run.

I imagine all I should need to do is read from the buffer into the address for a modelData_t struct...
..
but i don't know how to do that...

/e: Oh, you should probably know that the function is in ZT_LOAD_MODEL.c  in ZT folder.

Code: [Select]
//Experimental
void * ztFileStream(Sint8 * filename, void * startAddress, entity_t * model)
{

    memset_l((void*)startAddress,0x0000, (0xFFFE - ((Uint32)startAddress-(Uint32)LWRAM)));  //Not 100% necessary, since data can just be overwritten, but good for testing and see how much data a level takes
    void * currentAddress;
    currentAddress = startAddress;

    Sint32 fid = GFS_NameToId((Sint8*)filename);
GfsHn gfs;
Sint32 stat;
Sint32 nsct;
Sint32 bsize;
//Model Data is the destination of data.
modelData_t bufModel;
//Destination address?
    void * ptr = &bufModel;

//Loading follows
gfs = GFS_Open(fid);
//Get sectors
GFS_GetFileSize(gfs, nsct, NULL, NULL);
bsize = 2048 * nsct;
// nsct = GFS_ByteToSct(gfs, bytesOf);

//modelData_t has an assumed size?
GFS_NwFread(gfs, nsct, (Uint32*)currentAddress, bsize);

//For loop is blank because this will run until GFS_Close, AKA always run until GFS_Close.
for(;;)
{
stat = GFS_NwExecOne(gfs);
if(stat == GFS_SVR_COMPLETED)
{
break;
}
//Copy gfs to modelData_t bufmodel???
memcpy_l((Sint32*)ptr, (Sint32*)(startAddress), (sizeof(modelData_t)));

/**ADDED**/
model->pos[X]=bufModel.Origin[X]; model->pos[Y]=bufModel.Origin[Y]; model->pos[Z]=bufModel.Origin[Z];
model->length[X]=bufModel.Length[X]; model->length[Y]=bufModel.Length[Y]; model->length[Z]=bufModel.Length[Z];
model->nbMeshes=bufModel.TOTAL_MESH;

//Get textures from GFS
Uint16 first_texture = loadTextures(startAddress, &bufModel);
//Get PDATA from GFS
// Sint32 bytesOff = (bufModel.TEXT_SIZE+(sizeof(modelData_t)))/2048;

// bytesOff = bufModel.TEXT_SIZE+(sizeof(modelData_t)) - (bytesOff*2048);
// currentAddress = (void*)(currentAddress + bytesOff);

currentAddress = loadPDATA((void*)currentAddress, model, &bufModel);
//Set textures from GFS
setTextures(first_texture, model, bufModel.TOTAL_MESH, true);

    return currentAddress;
}
GFS_Close(gfs);

}

176
Thanks for the update.
Have you seen a single game doing paletted gouraud?
Also, have you seen a game using RBG1?

MechWarrior 2 ACE, as I understand it, has RBG0 as the ground plane and RBG1 as the sky plane.

177
General Jo Engine Help / Re: More on ZTP
« on: May 26, 2018, 04:25:52 pm »
The problem is some models (as frames of an animation, but they are models all the same) do not display and/or load. There's something wrong with how I convert them.

- IIRC slInitGourad would be what you are talking about, and it is the last thing that main does.
- I was afraid that Blender would do that.
- 564 KB is being loaded to the best of my knowledge
- I changed the directory order and ... i think that was it, gimme a sec

/e: Yes, it was too many files in the same directory. Thanks for the tip. I figured it was something simple.
I do wonder what the upper limit really is because some animations may end up being around 30 frames.
Eh, things can always be chunked up.
As always I appreciate what you do.

178
General Jo Engine Help / More on ZTP
« on: May 26, 2018, 03:40:17 pm »
Hello mostly XL2,

As your tool is a work-in-progress I'd like to share a project file where I am having some issues.

Some models exported from my animations to be converted in to ZTP files are not loading. This seems non-nonsensical, as the only thing that has changed about the model is its pose.
Another conundrum is it happens in a way spread out across the range of entities. Some in a range stop loading, then models start loading again, then they have problems again.
There is something wrong with my OBJ files and I am not sure what it is.

The issue can be found in &entities[5] through to &entities[10] (and other sequences). In the binary model converter folder (starting from top level), this is RTURP05 to RTURP10. It does NOT happen for those same frames when mirrored (pose copied from L bones to R bones, some other numbers inverted some not, then exported as OBJ) on LTURN05 to LTURN10 / &entities[15] to &entities[20]. Should be noted that the LTURN is the original animation that was copied.

Thank you for reading.

179
Project announcement / Re: Virtua Skimmer
« on: May 18, 2018, 09:05:08 pm »
https://youtu.be/M00oA1ZEKU0

This may not be conclusive but it was easy to do.

You know what, I'll just try and throw in something that really should break it if it works like we think it does. Give me a minute.

/e: Yep, as you expected, things get culled when they would be otherwised blocked in the models' rest position.

https://i.imgur.com/2JassMX.png?1

I'd guess some way of compressing the normals is important

There is probably a really good reason why the animations in Quake are like they are.
Hopefully we can at least prevent writing redundant textures.

180
Project announcement / Re: Virtua Skimmer
« on: May 18, 2018, 07:57:31 pm »
I had it working using header files as given, however I didn't circum-rotate the mesh much I just saw it working in a few perspectives.
It may be I just didn't move the mesh enough to see anything go wrong. This wasn't with the real-time gourad shading.

When you do have time, take a test of the header files in my previous post (specifically pony.h). Still needs XPDATA for every frame rather than PDATA ( jo engine mesh data ) but that shouldn't take long to do, just only change vertices data.
/e: Now I realize my test was without XPDATA, so I guess I wasn't really testing what we were talking about. With PDATA it did work.
I guess later today I am going to take a closer look at how it works with XPDATA / real time shading.

Pages: 1 ... 10 11 [12] 13 14 15
SMF spam blocked by CleanTalk