MCPcopy Create free account
hub / github.com/JACoders/OpenJK / Item_Model_Paint

Function Item_Model_Paint

code/ui/ui_shared.cpp:7113–7377  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7111extern void UI_SaberDrawBlades( itemDef_t *item, vec3_t origin, float curYaw );
7112
7113void Item_Model_Paint(itemDef_t *item)
7114{
7115 float x, y, w, h;
7116 refdef_t refdef;
7117 refEntity_t ent;
7118 vec3_t mins, maxs, origin;
7119 vec3_t angles;
7120 const modelDef_t *modelPtr = (modelDef_t*)item->typeData;
7121
7122 if (modelPtr == NULL)
7123 {
7124 return;
7125 }
7126
7127 // Fuck all the logic --eez
7128#ifdef JK2_MODE
7129 // setup the refdef
7130 memset( &refdef, 0, sizeof( refdef ) );
7131 refdef.rdflags = RDF_NOWORLDMODEL;
7132 AxisClear( refdef.viewaxis );
7133 x = item->window.rect.x+1;
7134 y = item->window.rect.y+1;
7135 w = item->window.rect.w-2;
7136 h = item->window.rect.h-2;
7137
7138 refdef.x = x * DC->xscale;
7139 refdef.y = y * DC->yscale;
7140 refdef.width = w * DC->xscale;
7141 refdef.height = h * DC->yscale;
7142
7143 DC->modelBounds( item->asset, mins, maxs );
7144
7145 origin[2] = -0.5 * ( mins[2] + maxs[2] );
7146 origin[1] = 0.5 * ( mins[1] + maxs[1] );
7147
7148 // calculate distance so the model nearly fills the box
7149 if (qtrue)
7150 {
7151 float len = 0.5 * ( maxs[2] - mins[2] );
7152 origin[0] = len / 0.268; // len / tan( fov/2 )
7153 //origin[0] = len / tan(w/2);
7154 }
7155 else
7156 {
7157 origin[0] = item->textscale;
7158 }
7159 // WTF..? --eez
7160 //refdef.fov_x = (modelPtr->fov_x) ? modelPtr->fov_x : w;
7161 //refdef.fov_y = (modelPtr->fov_y) ? modelPtr->fov_y : h;
7162
7163 refdef.fov_x = 45;
7164 refdef.fov_y = 45;
7165
7166 //refdef.fov_x = (int)((float)refdef.width / 640.0f * 90.0f);
7167 //xx = refdef.width / tan( refdef.fov_x / 360 * M_PI );
7168 //refdef.fov_y = atan2( refdef.height, xx );
7169 //refdef.fov_y *= ( 360 / M_PI );
7170

Callers 1

Item_PaintFunction · 0.70

Calls 7

AxisClearFunction · 0.85
VectorSetFunction · 0.85
AnglesToAxisFunction · 0.85
VectorCopyFunction · 0.85
UI_TalkingHeadFunction · 0.85
UI_SaberDrawBladesFunction · 0.70

Tested by

no test coverage detected