/* SetFaceTexdef_Q2 This doesn't mess with CONTENTS_DETAIL needed for Quake2 content flag */ void SetFaceTexdef_Q2 (face_t *f, texdef_t *texdef, bool bFitScale) { if(strcmp(f->texdef.GetName(), texdef->GetName()) != 0) // set shader here instead of Brush_Build Face_SetShader(f, texdef->GetName()); if (bFitScale) { f->texdef = *texdef; // fit the scaling of the texture on the actual plane vec3_t p1,p2,p3; // absolute coordinates // compute absolute coordinates ComputeAbsolute(f,p1,p2,p3); // compute the scale vec3_t vx,vy; VectorSubtract(p2,p1,vx); VectorNormalize(vx, vx); VectorSubtract(p3,p1,vy); VectorNormalize(vy, vy); // assign scale VectorScale(vx,texdef->scale[0],vx); VectorScale(vy,texdef->scale[1],vy); VectorAdd(p1,vx,p2); VectorAdd(p1,vy,p3); // compute back shift scale rot AbsoluteToLocal(f->plane,f,p1,p2,p3); } else { f->texdef = *texdef; } }
void RotateFaceTexture( face_s* f, int nAxis, float fDeg ) { edVec3_c p1, p2, p3, rota; p1.clear(); p2.clear(); p3.clear(); rota.clear(); ComputeAbsolute( f, p1, p2, p3 ); rota[nAxis] = fDeg; VectorRotate( p1, rota, select_origin, p1 ); VectorRotate( p2, rota, select_origin, p2 ); VectorRotate( p3, rota, select_origin, p3 ); edPlane_c normal2; edVec3_c vNormal; vNormal[0] = f->plane.normal[0]; vNormal[1] = f->plane.normal[1]; vNormal[2] = f->plane.normal[2]; VectorRotate( vNormal, rota, vNormal ); normal2.normal[0] = vNormal[0]; normal2.normal[1] = vNormal[1]; normal2.normal[2] = vNormal[2]; AbsoluteToLocal( normal2, f, p1, p2 , p3 ); }
void RotateFaceTexture(face_t* f, int nAxis, float fDeg) { vec3_t p1,p2,p3, rota; p1[0] = p1[1] = p1[2] = 0; VectorCopy(p1, p2); VectorCopy(p1, p3); VectorCopy(p1, rota); ComputeAbsolute(f, p1, p2, p3); rota[nAxis] = fDeg; VectorRotate(p1, rota, select_origin, p1); VectorRotate(p2, rota, select_origin, p2); VectorRotate(p3, rota, select_origin, p3); plane_t normal2; vec3_t vNormal; vNormal[0] = f->plane.normal[0]; vNormal[1] = f->plane.normal[1]; vNormal[2] = f->plane.normal[2]; VectorRotate(vNormal, rota, vNormal); normal2.normal[0] = vNormal[0]; normal2.normal[1] = vNormal[1]; normal2.normal[2] = vNormal[2]; AbsoluteToLocal(normal2, f, p1, p2 ,p3); }