Yes that's what I thought - the client gets a read-only view of entities, and I remember trying to get the texture data for models or sprites but couldn't find a way.
Nice work with the big maps - looking forward to the tutorial.
Created 5 years ago2019-01-16 00:46:21 UTC by Admer456
"I remember trying to get the texture data for models or sprites but couldn't find a way."At that point I'd probably do a MDL and SPR parser, if I just wanted to read the texture data. It'd be easy too, there are several open-source apps doing that stuff, so, we can use it as a reference / steal the code.
At that point I'd probably do a MDL and SPR parser, if I just wanted to read the texture data. It'd be easy too, there are several open-source apps doing that stuff, so, we can use it as a reference / steal the code.Oh agreed - I was just hoping the data was modifiable at runtime.
BOLIDHINT
works. BOLIDHINT
is apparently the same as SOLIDHINT
. However, now let's look at the clipnode counts:NULL
- 7148 clipnodesBEVEL
- 4318 clipnodesSOLIDHINT
- 7158 clipnodesBOLIDHINT
- 4122 clipnodesNULL
and SOLIDHINT
aren't supposed to create the same number of clipnodes, considering the fact that SOLIDHINT
generally produces less wpolys. Keep that in mind.SOLIDHINT
and BOLIDHINT
compared to the other two.studiohdr_t
pointer (header
in the example code), we can access the bodygroup, then the submodel of said bodygroup, and then the vertices of the submodel.
void StudioExampleStuff( studiohdr_t* header, mstudiobodyparts_t* bodygroup, mstudiomodel_t* submodel, Vector& vert, int cntr )
{
static float flWave = 0.0;
flWave += M_PI/240.0;
if ( flWave > M_PI )
flWave *= -1;
if ( header )
{
bodygroup = (mstudiobodyparts_t*)((byte*)header + header->bodypartindex);
if ( bodygroup )
{
submodel = (mstudiomodel_t*)((byte*)header + bodygroup->modelindex);
if ( submodel )
{
for ( int i = 0; i < submodel->numverts; i++ )
{
float* vertFl = (float*)((byte*)header + submodel->vertindex) + i;
float indexWave = (float)i / (float)submodel->numverts;
float indexOffset = (indexWave * 2.0) - 1.0;
indexWave *= 4.0 * M_PI;
vertFl[ 2 ] += sin(flWave + indexWave) * 0.004 * (indexOffset*2.0) + sin(flWave*4.0 + indexWave)*0.01;
}
}
}
}
}
So, they aren't read-only.models/something.mdl
and you change the vertices on it, you will change it on them all. Maybe some mods will have a use for this, where for example, if the player damages one object and its vertices bend, it affects basically every other object in the map.539
1330
4 0 123 (28672.000000 12288.000000 0.000000) (32768.000000 12288.000000 0.000000) (32768.000000 12288.000000 16384.000000) (28672.000000 12288.000000 16384.000000)
4 1 122 (28672.000000 12288.000000 16384.000000) (28672.000000 12288.000000 20480.000000) (20480.000000 12288.000000 20480.000000) (20480.000000 12288.000000 16384.000000)
4 1 28 (20480.000000 12288.000000 16384.000000) (20480.000000 12288.000000 20480.000000) (20480.000000 28672.000000 20480.000000) (20480.000000 28672.000000 16384.000000)
4 2 10 (26624.000000 28672.000000 1419.636364) (26624.000000 28672.000000 16384.000000) (26624.000000 30208.000000 16384.000000) (26624.000000 30208.000000 1280.000000)
mapname_viscache.prt:
539
1330
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
4 0 123 (28672.000000 12288.000000 0.000000) (32768.000000 12288.000000 0.000000) (32768.000000 12288.000000 16384.000000) (28672.000000 12288.000000 16384.000000)
4 1 122 (28672.000000 12288.000000 16384.000000) (28672.000000 12288.000000 20480.000000) (20480.000000 12288.000000 20480.000000) (20480.000000 12288.000000 16384.000000)
4 1 28 (20480.000000 12288.000000 16384.000000) (20480.000000 12288.000000 20480.000000) (20480.000000 28672.000000 20480.000000) (20480.000000 28672.000000 16384.000000)
4 2 10 (26624.000000 28672.000000 1419.636364) (26624.000000 28672.000000 16384.000000) (26624.000000 30208.000000 16384.000000) (26624.000000 30208.000000 1280.000000)
539 stands for the number of visleaves, 1330 is the number of visportals.water
or !
, but I'm thinking of potential applications of this elsewhere too.GLint myNewTexture;
... // after some TGA parsing with DevIL and texture creation via gl functions
texture->gl_texturenum = myNewTexture;
As for resizing, i.e. updating the original texture, we'll see. I am definitely thinking of writing some tutorials about this.Truevision Targa - .tga
Tagged Image File Format - .tif
Gamecube Texture - .tpl
Unreal Texture - .utx
Quake 2 Texture - .wal
Valve Texture Format - .vtf
Oh, look at that, one can potentially implement Source texture support in a HL mod. mextrasurf_s
but rather this:
typedef struct texture_s
{
char name[16];
unsigned int width, height;
int gl_texturenum;
struct msurface_s *texturechain; // for gl_texsort drawing
int anim_total; // total tenths in sequence ( 0 = no)
int anim_min, anim_max; // time for this frame min <=time< max
struct texture_s *anim_next; // in the animation sequence
struct texture_s *alternate_anims; // bmodels in frame 1 use these
unsigned short fb_texturenum; // auto-luma texturenum
unsigned short dt_texturenum; // detail-texture binding
struct mextrasurf_s *lightchain; // used for drawing spotlights
unsigned int unused[2]; // reserved
} texture_t;
Allegedly, this works just fine with vanilla GoldSrc. I found this texture_s
version with gl_texturenum
in it on accident, in a Russian tutorial about mirrors. gl_texturenum = dt_texturenum;
or if that doesn't work, I grab the actual texture handled by gl_texturenum
and replace it with the one from dt_texturenum
using OpenGL commands. It'd be pretty interesting to experiment with these.