[�렪吏�]
1 소개 #IGame는 MAX SDK상에 데이타 export에 주로 촛점을 맞춘 상위 수준의 API를 제공합니다. 이 인터페이스의 제공목적은 초보 MAX 개발자들이 최소한의 노력으로 MAX로부터 데이타를 추출하도록 하는 인터페이스들을 제공하는 것입니다. 게임회사들이 이러한 부류에 속하는데... (나중에 번역! 원문 : Games companies fall into this category, often developers’ move onto different areas of the pipeline leaving some one unfamiliar with max to maintain or write a new exporter.) IGame 인터페이스는 콘트롤러(controller)와 Mesh 객체와 같은 일반적인 MAX 구성요소들을 감싸는 단순한 wrapper 클래스들을 제공하며, 개발자들에게 표준 MAX lookup 및 데이타 변환(이들을 실행하면 MAX에 대한 몇몇 세부지식을 얻을 수 있습니다)을 제외한 모든 데이타를 제공합니다. (IGame provides simple wrappers around common max elements such as controllers and Mesh objects and provides the developer all the data without the standard max lookups and data conversions, which can take some detailed knowledge of max to perform.) 아래에 주어진 예제는 콘트롤러로부터 키 프레임 데이타를 추출하는 내용을 담고 있습니다. Control * cont = node->GetTMController()->GetPositionController() if (!cont) // Bug out if no controller. return; int i; IKeyControl *ikc = NULL; ikc = GetKeyControlInterface(cont); // TCB point3 if (ikc && cont->ClassID() == Class_ID(TCBINTERP_POINT3_CLASS_ID, 0)) { for (i=0; i<ikc->GetNumKeys(); i++) { ITCBPoint3Key key; ikc->GetKey(i, &key); // do as you wish with the data } IGame을 사용하면 다음과 같은 방법으로 같은 데이타를 얻을 수 있습니다. (정말 간단합니다!) IGameKeyTab poskeys; IGameControl * pGameControl = gameNode->GetIGameControl(); pGameControl->GetBezierKeys(poskeys,IGAME_POS)); IGame은 현재 다음과 같은 MAX 구성요소에 대한 접근을 제공하고 있습니다.
[�렪吏�]
2 매시(Mesh) 접근 #IGame 인터페이스는 보다 훨씬 간단한 mesh 접근에 대한 인터페이스를 제공합니다. 이것은 mesh로 객체를 변환하는데 필요한 일반적인 MAX 사전준비작업(house keeping)의 대부분에 해당합니다. 주된 확장된 요소는 Face 클래스의 확장으로서, 단순한 형태로 모든 일반적인 mesh 데이타가 제공된다는 점입니다. 클래스 FaceEx내에서 모든 정점 컬러, 알파값, Illumination, 노멀(Normal)값 및 텍스쳐 좌표들을 직접 접근하고 관리할 수 있습니다. 담겨있는 모든 데이타는 미러링에 대한 고전적인 문제점을 고려하고 있으므로, export에 있어서 개발자는 안심해도 됩니다. (즉, 이미 이러한 결점들이 보완되어있다는 뜻입니다.) 데이타는 다양한 데이타 배열들에 대한 룩업을 제공합니다... (번역요! 원문 : The data provides a lookup into the various data arrays, which is similar to how max does it now, but currently in max, for normals and color information the developer has to go looking for it.) 사실 MAX는 개발자가 export하려는 정점 노멀값 집합조차도 관리하지 않으므로, 이러한 모든 값들은 face의 smoothing 그룹에 기초해서 계산되어야만 합니다. IGame는 여러분들을 위해 이러한 것들 모두를 돌보고 있습니다(물론, 정확한 정점 노멀값들을 계산하는 것도 수행합니다.) mesh상의 노멀값 추출을 위한 전형적인 IGame 인터페이스에 대한 접근은 아래와 같습니다. IGameObject * obj = gameNode->GetIGameObject(); if(obj->GetIGameType()==IGameObject::IGAME_MESH) { IGameMesh * gM = (IGameMesh*)obj; int numNorms = gm->GetNumberOfNormals(); for(int i = 0;i<numNorms;i++) { Point3 n = gm->GetNormal(i); } int numFaces = gm->GetNumberOfFaces(); for(int i = 0;i<numFaces;i++) { FaceEx * f = gm->GetFace(i); DebugPrint("Normals %d %d %d\n",f->norm[0],f->norm[1],f->norm[2]); } } 기본적인 mesh 데이타에 덧붙여서 모든 애니메이션되는 정점 데이타들 역시 추출하는 것이 가능하고 IGameControl포맷상에서 제공되므로, 여러분은 쉽게 각 데이타에 접근할 수 있습니다. ShapeObject에 대한 유사한 인터페이스를 사용할 수 있습니다. [�렪吏�]
3 컨트롤러(Controller) 접근 #이미 강조했지만, MAX SDK를 통한 컨트롤러에 대한 접근은 다루기 난처할정도로 까다롭습니다. IGameControl 인터페이스는 개발자들에게 이러한 모든 복잡함을 숨겨줍니다. 대부분의 게임 개발회사는 자사의 게임 엔진에서 사용하는 특정 타입의 컨트롤러를 가지고 있으므로, export할 때 이들 컨트롤러에 대해 직접적인 접근을 원하게 됩니다. IGame 인터페이스는 개발자들이 모든 베지어 위치 데이타를 묻는 것을 허가함으로서 이 기능을 제공합니다. (IGame provides this by allowing the developer to ask for all the Bezier Position data in one go.) 그러면 간단한 export를 위해 모든 키 데이타를 얻을 수 있게 됩니다. export할 동안의 융통성을 위해서 한번에 한 키값씩 데이타에 접근하는 기능도 제공됩니다. IGameControl * pGameControl = gameNode->GetIGameControl(); DWORD T = pGameControl->GetControlType(IGAME_POS); if(T==IGAME_MAXSTD && pGameControl->GetBezierKeys(poskeys,IGAME_POS)) { DumpBezierKeys(IGAME_POS,poskeys,prsNode); } else if(T==IGAME_POS_CONSTRAINT) { IGameConstraint * cnst = pGameControl->GetConstraint(IGAME_POS); DumpConstraints(prsNode,cnst); } else { pGameControl->GetSampledKeys(poskey,1,IGAME_POS); } 또한 동일한 시스템으로 오일러(Euler) 컨트롤러, 바이패드(Biped) 및 constraint 시스템에 대한 접근도 제공합니다. 현재 Biped는 사용자 정의된 비율에 기초하여 샘플링되고 있지만, TCB 데이타에 대한 접근이 계획중에 있습니다. Constraints are also supported under a unified system, all the constraining nodes and weights can be accessed. Again the other data specific to each constraint is exposed via IParamBlock2, so the appropriate data in the Properties file (see later) needs to be added to gain access to these. [�렪吏�]
4 Modifier 접근 #Any modifier in the objects stack is available for the developer; this allows simpler access to any special data such as LocalModData that may be stored with the modifier. It should be pointed out that IGame does not support LocalModData, however it provides access to the max modifier, so the developer can access it from here. It does hoever, take away the problems of having to look for derived objects and enumerating the stack for modifiers, another common cause of problems.. Apart from simple access, IGame also provides extended support for Skin and Physique. The developer can ask the object whether is it is skinned, and then ask for the IGameSkin interface. All weights and bone data for skin and physique are provided via the same interface. [�렪吏�]
5 Parameter 접근 #The heart of IGame is the IGameProperty. Any IGame export entity provides an interface to extract properties from the entity. This means that any max node that maintains an IParamBlock or IParamBlock2 interface will have the data extracted and stored as an IGameProperty. This includes Custom Attributes that host their data in a paramblock as well. An IGameProperty, still provides access to the underlying paramblock (if required), but also provides an IGameControl and methods to extract the data, similar to Get/SetValue in the paramblock system. The benefit to using the IGame get/set is that you will not get any asserts thrown for an incompatible data type. An example of finding all the parameters on an object is given below. IGameConstraint * cnst = pGameControl->GetConstraint(IGAME_POS); for(i=0;i<cnst->GetIPropertyContainer()->GetNumberOfProperties();i++) { IGameProperty prop = cnst->GetIPropertyContainer()->GetProperty(i); } This is kind of access is the heart of so many problems to new developers; so providing this kind of extraction at a C++ level was crucial. IGame uses an XML file to hold the parameters that it should be looking for. This allows any custom objects or modifiers to be included in the search tree. The developer can then either loop for all the found properties, or query directly based on the supplied ID for the parameter. This means that an exporter does not need to be rewritten if a modifier has a new parameter, as only the property xml file needs to be updated to include information on the new property, so it will automatically be collected by IGame. More information on the IGameProperty.xml file can be found in a separate document. IGame will be ship with a Property file that has most of the standard max properties already defined. There will be an editor and max plugin to help create additional entries. [�렪吏�]
6 재질 및 비트맵 접근 #In general material export using the max sdk is fairly simple, the material is directly accessible from the node, and a simple set of APIs provide access to most data. The current materials in Max are mainly based on the IParamBlock2 system, so the main access for export on materials for IGame is via the IGameProperty. This means that it can take advantage of this new system so that custom materials can be handled by IGame very easily, as the underlying material algorithm is not needed just the material properties. IGame does provide some direct access to the Standard Material. It simply provides some wrappers around the IGameProperty so that the correct property is accessed and returns it to the user. IGame does provide support for Multi/SubObject materials. With this support it does mean that things like the Clipping data from a BitmapTexture can be exported easily, you just need to tell IGame, via the xml file, that you want to export this data. IGameMaterial * subMat = pIgame->GetSubMaterial(0); int num = subMat->GetNumberBitmapTex(); for(int I=0; i<num; i++) { IGameBitmapTex * tex = subMat->GetIGameBitmapTex(i); // Get that clipping data IGameProperty * clipProp = GetClipUData(); Float val; ClipProp->GetPropertyValue(val); } |
DirectX