Modelef question - different skins, different frames - how?

Advanced OpenGL source port fork from ZDoom, picking up where ZDoomGL left off.
[Home] [Download] [Git builds (Win)] [Git builds (Mac)] [Wiki] [Repo] [Bugs&Suggestions]

Moderator: Graf Zahl

Locked
User avatar
Enjay
Developer
Developer
Posts: 4748
Joined: Tue Aug 30, 2005 23:19
Location: Scotland
Contact:

Modelef question - different skins, different frames - how?

Post by Enjay »

I've looked through the documentation, but didn't see how to do this:

I have a simple decoration (a security camera) that has 4 frames of animation where the "light" (read a few green pixels) on it is one colour, then another 4 frames of animation where it is a different colour (then it returns to the start). This works fine as a sprite, but I don't know how to get it to work as a model.

I've got the animation working just fine - the camera pans from side to side. However, in order to complete what I want, the camera also needs to be able to change colour on the second pan. How do I do this in modeldef? I think I somehow need to be able to define a second skin to be used by the model during the second set of frames, but I don't know how.

The animation is like this (all using frames CAME*0)

ABCBADED - the first colour

FGHGFIJI - the second colour

Currently my modeldef looks like this:

Model CameraPanning
{
Path "Models"
Model 0 "camera.md2"
Skin 0 "camera.png"
Scale 1.0 1.0 1.0

Frame CAME A 0 "camera1"
Frame CAME B 0 "camera2"
Frame CAME C 0 "camera3"
Frame CAME D 0 "camera4"
Frame CAME E 0 "camera5"
Frame CAME F 0 "camera1"
Frame CAME G 0 "camera2"
Frame CAME H 0 "camera3"
Frame CAME I 0 "camera4"
Frame CAME J 0 "camera5"
}

Thanks for any help.
User avatar
Nash
Developer
Developer
Posts: 1226
Joined: Sun Sep 25, 2005 1:49
Location: Kuala Lumpur, Malaysia
Contact:

Post by Nash »

It is cases like this where I wish there was a code pointer to change model skins on the fly.

The best hack I can think of is, first you have to add separate frames for your camera's DECORATE to differentiate the on an doff state. Since your camera is CAME*, add CAMO* (O for "on" :P) states to the DECORATE.

Now for the MODELDEF hackery:

Code: Select all

Model CameraPanning 
{ 
Path "Models" 
Model 0 "camera.md2" 
Skin 0 "camera.png" 
Scale 1.0 1.0 1.0 

Frame CAME A 0 "camera1" 
Frame CAME B 0 "camera2" 
Frame CAME C 0 "camera3" 
Frame CAME D 0 "camera4" 
Frame CAME E 0 "camera5" 
Frame CAME F 0 "camera1" 
Frame CAME G 0 "camera2" 
Frame CAME H 0 "camera3" 
Frame CAME I 0 "camera4" 
Frame CAME J 0 "camera5" 
} 

Model CameraPanning // uses different modelindex
{ 
Path "Models" 
Model 1 "camera.md2" 
Skin 1 "camera2.png" // different texture
Scale 1.0 1.0 1.0 

Frame CAMO A 1 "camera1" 
Frame CAMO B 1 "camera2" 
Frame CAMO C 1 "camera3" 
Frame CAMO D 1 "camera4" 
Frame CAMO E 1 "camera5" 
Frame CAMO F 1 "camera1" 
Frame CAMO G 1 "camera2" 
Frame CAMO H 1 "camera3" 
Frame CAMO I 1 "camera4" 
Frame CAMO J 1 "camera5" 
}
Be sure to put both in the same MODELDEFS.
User avatar
Enjay
Developer
Developer
Posts: 4748
Joined: Tue Aug 30, 2005 23:19
Location: Scotland
Contact:

Post by Enjay »

Exactly the information I needed. Thank you. :)
User avatar
Nash
Developer
Developer
Posts: 1226
Joined: Sun Sep 25, 2005 1:49
Location: Kuala Lumpur, Malaysia
Contact:

Post by Nash »

So does it work? To be honest, I made that post right after waking up and a lot of it was recalled vaguely from memory.
User avatar
Enjay
Developer
Developer
Posts: 4748
Joined: Tue Aug 30, 2005 23:19
Location: Scotland
Contact:

Post by Enjay »

Yup, it works just fine. :thumb:
Locked

Return to “GZDoom”