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

Function RotateModelPoints

model/newstyle.cpp:897–1016  ·  view source on GitHub ↗

Rotates all of the points of a submodel, plus supplies color info

Source from the content-addressed store, hash-verified

895
896// Rotates all of the points of a submodel, plus supplies color info
897void RotateModelPoints(poly_model *pm, bsp_info *sm) {
898
899 // Figure out lighting
900 if (Polymodel_light_type == POLYMODEL_LIGHTING_STATIC) {
901 if ((Polymodel_use_effect && (Polymodel_effect.type & PEF_DEFORM)) || (sm->flags & SOF_JITTER)) {
902 for (int i = 0; i < sm->nverts; i++) {
903 vector vec = sm->verts[i];
904
905 float val = ((ps_rand() % 1000) - 500.0) / 500.0;
906 vec *= 1.0 + (Polymodel_effect.deform_range * val);
907
908 g3_RotatePoint(&Robot_points[i], &vec);
909 }
910 } else {
911 for (int i = 0; i < sm->nverts; i++)
912 g3_RotatePoint(&Robot_points[i], &sm->verts[i]);
913 }
914 } else if (Polymodel_light_type == POLYMODEL_LIGHTING_LIGHTMAP) {
915 if ((Polymodel_use_effect && (Polymodel_effect.type & PEF_DEFORM)) || (sm->flags & SOF_JITTER)) {
916 for (int i = 0; i < sm->nverts; i++) {
917 vector vec = sm->verts[i];
918 float val = ((ps_rand() % 1000) - 500.0) / 500.0;
919 vec *= 1.0 + (Polymodel_effect.deform_range * val);
920
921 g3_RotatePoint(&Robot_points[i], &vec);
922
923 Robot_points[i].p3_r = 1.0;
924 Robot_points[i].p3_g = 1.0;
925 Robot_points[i].p3_b = 1.0;
926 }
927 } else {
928 for (int i = 0; i < sm->nverts; i++) {
929 g3_RotatePoint(&Robot_points[i], &sm->verts[i]);
930 Robot_points[i].p3_r = 1.0;
931 Robot_points[i].p3_g = 1.0;
932 Robot_points[i].p3_b = 1.0;
933 }
934 }
935 } else if (Polymodel_light_type == POLYMODEL_LIGHTING_GOURAUD) {
936 if (Polymodel_use_effect && Polymodel_effect.type & PEF_COLOR) {
937 if ((Polymodel_use_effect && (Polymodel_effect.type & PEF_DEFORM)) || (sm->flags & SOF_JITTER)) {
938 for (int i = 0; i < sm->nverts; i++) {
939 vector vec = sm->verts[i];
940 float val = ((ps_rand() % 1000) - 500.0) / 500.0;
941 vec *= 1.0 + (Polymodel_effect.deform_range * val);
942
943 g3_RotatePoint(&Robot_points[i], &vec);
944
945 vector normvec = sm->vertnorms[i];
946 val = (-vm_DotProduct(Polymodel_light_direction, &normvec) + 1.0) / 2;
947
948 Robot_points[i].p3_r = Polymodel_effect.r * val * Polylighting_static_red;
949 Robot_points[i].p3_g = Polymodel_effect.g * val * Polylighting_static_green;
950 Robot_points[i].p3_b = Polymodel_effect.b * val * Polylighting_static_blue;
951 }
952 } else {
953 if ((Polymodel_use_effect && (Polymodel_effect.type & PEF_DEFORM)) || (sm->flags & SOF_JITTER)) {
954 for (int i = 0; i < sm->nverts; i++) {

Callers 1

RenderSubmodelFunction · 0.85

Calls 4

ps_randFunction · 0.85
g3_RotatePointFunction · 0.85
vm_DotProductFunction · 0.50
rend_SetColorModelFunction · 0.50

Tested by

no test coverage detected