C++ 튜토리얼 5번 예제를 보면
3D에 텍스처를 입히는 게 나오는데,
#define SHOW_HOW_TO_USE_TCI
를 정의하게 되면 u, v 좌표계를 사용해서 텍스처를 입히는 게 아닌, 그냥 내부 연산으로만 텍스처를 표현하는 게 있습니다. 당연히 정상적인 텍스처의 원통 모양이 아닌, 그냥 일반 텍스처 배경에 원통 모양의 유리로 그 텍스처를 보는 모습이 나오는데요,
연산 부분이 잘 이해가 가지 않네요.
해당 소스는 다음과 같긴 하는데, 정확한 의미를 아시는 분??? -1에서 1의 좌표를 0에서 1의 좌표로 바꾼다는데..
#ifdef SHOW_HOW_TO_USE_TCI
// Note: to use D3D texture coordinate generation, use the stage state
// D3DTSS_TEXCOORDINDEX, as shown below. In this example, we are using
// the position of the vertex in camera space to generate texture
// coordinates. The tex coord index (TCI) parameters are passed into a
// texture transform, which is a 4x4 matrix which transforms the x,y,z
// TCI coordinates into tu, tv texture coordinates.
// In this example, the texture matrix is setup to
// transform the texture from (-1,+1) position coordinates to (0,1)
// texture coordinate space:
// tu = 0.5*x + 0.5
// tv = -0.5*y + 0.5
D3DXMATRIXA16 mat;
mat._11 = 0.25f; mat._12 = 0.00f; mat._13 = 0.00f; mat._14 = 0.00f;
mat._21 = 0.00f; mat._22 =-0.25f; mat._23 = 0.00f; mat._24 = 0.00f;
mat._31 = 0.00f; mat._32 = 0.00f; mat._33 = 1.00f; mat._34 = 0.00f;
mat._41 = 0.50f; mat._42 = 0.50f; mat._43 = 0.00f; mat._44 = 1.00f;
g_pd3dDevice->SetTransform( D3DTS_TEXTURE0, &mat );
g_pd3dDevice->SetTextureStageState( 0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT2 );
g_pd3dDevice->SetTextureStageState( 0, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_CAMERASPACEPOSITION );
#endif
다이렉트 엑스는 수치(아는걸로는 경사나 뭐더라 잘 생각은 안나지만)계산을 0에서 1사이에 놓고 플로트 혹은 더블(확실한건 아님)로 연산을
처리하는 걸로 배웠습니다. 참고로 1을 넘는 연산이라 하더라도 1.0f이상으로 잡아버리면 캐릭이나 물체가 굉장히 빠르죠 다이렉트 엑스는여.
그리고 제가 배운게 쿠세(버릇)이 아닌가 모르겠습니다만
셋 트렌스폼이 &매트, 디삼디에스월드? 혹은 다른거 로 배웠습니다.
글구보니 전 9.0c 2004 october(사실은 2004 사마-(여름))버전을 쓰고있긴 합니다만(엠오에 저장해서 인스톨 쓰는 관계로... 코드가
많이 바뀌어서 공부 다시하기도 지금 힘든상황이기두 하구여...
개인적으로 소스코드 작성 레퍼런스를 보았지만, 매번 조금씩은 바뀌더군요 나올때마다... 아무튼 그 이상은 저도 다시 훓어보징않고선 답변하기 힘들겠군여.