Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backwards compatible multi texture support in pms format. #80

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

BranDougherty
Copy link
Member

The Soldat portion of PMS multi texture support tested as working with multitexture_ctf_Ash.pms from here: multitexture.zip

I made the map with a janky test program which is also attached (run with fpc MapFile.pas && ./MapFile SomeRandom.pms, it will apply different textures to the polies).

To store the additional texture filenames it reuses the Scenery array like helloer suggested in #79, I think this is the best option. Adding another array at the end of the file seems fragile, and PolyWorks is putting some data about lights and sketch lines there so that approach would probably wind up ugly.

To distinguish between scenery and textures in that array I'm checking for a long prefix ('SOLDATTEX_') on the filename. This works but reduces the max number of characters for texture filenames. It would be better to use a sentinel value of the Date on TMapScenery if one exists but I haven't looked into that yet.

For the per-polygon texture indexes it uses first byte of TMapPolygon.Normals[1].z. None of the normal z coordinates are used so this should be fine. If the map only has one texture, every polygon's texture index is set to 0 like it was before for backwards compatibility.

I'd like to try and use a Date sentinel, and figure out what a good value for MAX_TEXTURES is, or if we should have a limit on that. When those things are resolved this will be good to merge.

@BranDougherty BranDougherty linked an issue Dec 30, 2021 that may be closed by this pull request
@helloer
Copy link
Contributor

helloer commented Dec 30, 2021

To distinguish between scenery and textures in that array I'm checking for a long prefix ('SOLDATTEX_') on the filename. This works but reduces the max number of characters for texture filenames. It would be better to use a sentinel value of the Date on TMapScenery if one exists but I haven't looked into that yet.

Date field seems to be of no use anymore, so repurposing it could work. Don't we already have data in .PMS needed to distinguish these(iterate over polygons or props array and check which is which)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multi texture support
2 participants