MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / DrawItemModel

Function DrawItemModel

editor/ObjectDialog.cpp:936–971  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

934}
935
936void DrawItemModel(grHardwareSurface *surf, int model_num) {
937 vector zero_vector = {0, 0, 0};
938 vector view_pos = {0, 0, 0};
939 matrix id_matrix, rot_matrix;
940
941 poly_model *pm = GetPolymodelPointer(model_num);
942
943 // Calculate viewer position
944 vector maxs = pm->maxs, mins = pm->mins;
945 view_pos.x = -(mins.x + maxs.x) / 2;
946 view_pos.y = (mins.y + maxs.y) / 2;
947 maxs.x += view_pos.x;
948 maxs.y -= view_pos.y;
949 maxs.z = 0;
950 view_pos.z = -2.5 * vm_GetMagnitude(&maxs);
951
952 // Set viewer and object orientations
953 vm_MakeIdentity(&id_matrix);
954 vm_AnglesToMatrix(&rot_matrix, 0, 32768, 0);
955
956 // Set up surface & vuewport
957 surf->clear();
958 grViewport *vport = new grViewport(surf);
959 vport->clear();
960
961 // Draw to our surface
962 StartEditorFrame(vport, &view_pos, &id_matrix, D3_DEFAULT_ZOOM);
963 DrawPolygonModel(&zero_vector, &rot_matrix, model_num, NULL, 0, 1.0, 1.0, 1.0);
964 EndEditorFrame();
965
966 // Copy to the screen
967 Desktop_surf->blt(0, 0, surf);
968
969 // Delete our viewport
970 delete vport;
971}
972
973void CObjectDialog::OnObjpadResetCurobjHeight() {
974 if (Cur_object_index == -1) {

Callers 1

DrawPictureMethod · 0.85

Calls 9

GetPolymodelPointerFunction · 0.85
StartEditorFrameFunction · 0.85
DrawPolygonModelFunction · 0.85
EndEditorFrameFunction · 0.85
vm_GetMagnitudeFunction · 0.50
vm_MakeIdentityFunction · 0.50
vm_AnglesToMatrixFunction · 0.50
clearMethod · 0.45
bltMethod · 0.45

Tested by

no test coverage detected