void CWindModifier::m_Update(float4 frame) { CGeometricObject::m_Update(frame); if (p_StrengthTrack) p_StrengthTrack->m_GetData(frame, &p_Strength); if (p_DecayTrack) p_DecayTrack->m_GetData(frame, &p_Decay); if (p_Decay<0) p_Decay=0; if (p_TurbolenceTrack) p_TurbolenceTrack->m_GetData(frame, &p_Turbolence); if (p_Turbolence<0) p_Turbolence=0; if (p_FrequencyTrack) p_FrequencyTrack->m_GetData(frame, &p_Frequency); if (p_Frequency<0) p_Frequency=0; if (p_ScaleTrack) p_ScaleTrack->m_GetData(frame, &p_Scale); if (p_Scale<0) p_Scale=0; mat_get_column(&p_WorldMatrix, 1, &p_Force); vect_auto_normalize(&p_Force); p_ScaledStrength=p_Strength*0.0001f*forceScaleFactor*1.5f; vect_scale(&p_Force, p_ScaledStrength, &p_ScaledForce); }
void renderperspective(Matrix *faces, double *eye, Matrix *colors) { double coors[6]; int c; double pz; KZ_Point p1 = (KZ_Point){0,0,0,0,0,0}, p2 = (KZ_Point){0,0,0,0,0,0}, p3 = (KZ_Point){0,0,0,0,0,0}; double tri[12]; for (c = 0; c < faces->cols; c += 3) { #if ENABLE_CULLING mat_get_column(faces, c, tri); mat_get_column(faces, c+1, tri+4); mat_get_column(faces, c+2, tri+8); if (culltri(tri, eye)) continue; #endif pz = mat_get_cell(faces, c, 2); coors[0] = mat_get_cell(faces, c, 0); coors[1] = mat_get_cell(faces, c, 1); p1.r = eye_distance(coors[0], coors[1], pz, eye); p1.kr = mat_get_cell(colors, c, 0); p1.kg = mat_get_cell(colors, c, 1); p1.kb = mat_get_cell(colors, c, 2); p1.ared = p1.kr * ambient_red; p1.agreen = p1.kg * ambient_green; p1.ablue = p1.kb * ambient_blue; perspectify(coors, coors+1, pz, eye); pz = mat_get_cell(faces, c+1, 2); coors[2] = mat_get_cell(faces, c+1, 0); coors[3] = mat_get_cell(faces, c+1, 1); p2.r = eye_distance(coors[2], coors[3], pz, eye); p2.kr = mat_get_cell(colors, c+1, 0); p2.kg = mat_get_cell(colors, c+1, 1); p2.kb = mat_get_cell(colors, c+1, 2); p2.ared = p2.kr * ambient_red; p2.agreen = p2.kg * ambient_green; p2.ablue = p2.kb * ambient_blue; perspectify(coors+2, coors+3, pz, eye); pz = mat_get_cell(faces, c+2, 2); coors[4] = mat_get_cell(faces, c+2, 0); coors[5] = mat_get_cell(faces, c+2, 1); p3.r = eye_distance(coors[4], coors[5], pz, eye); p3.kr = mat_get_cell(colors, c+2, 0); p3.kg = mat_get_cell(colors, c+2, 1); p3.kb = mat_get_cell(colors, c+2, 2); p3.ared = p3.kr * ambient_red; p3.agreen = p3.kg * ambient_green; p3.ablue = p3.kb * ambient_blue; perspectify(coors+4, coors+5, pz, eye); map_coors(coors, coors+1); map_coors(coors+2, coors+3); map_coors(coors+4, coors+5); p1.x = coors[0]; p1.y = coors[1]; p2.x = coors[2]; p2.y = coors[3]; p3.x = coors[4]; p3.y = coors[5]; draw_triangle(p1, p2, p3); } }