void LoadScene(TiXmlElement *element) { for ( TiXmlElement *child = element->FirstChildElement(); child!=NULL; child = child->NextSiblingElement() ) { if ( COMPARE( child->Value(), "background" ) ) { Color c(1,1,1); ReadColor( child, c ); background.SetColor(c); printf("Background %f %f %f\n",c.r,c.g,c.b); background.SetTexture( ReadTexture(child) ); } else if ( COMPARE( child->Value(), "environment" ) ) { Color c(1,1,1); ReadColor( child, c ); environment.SetColor(c); printf("Environment %f %f %f\n",c.r,c.g,c.b); environment.SetTexture( ReadTexture(child) ); } else if ( COMPARE( child->Value(), "object" ) ) { LoadNode( &rootNode, child ); } else if ( COMPARE( child->Value(), "material" ) ) { LoadMaterial( child ); } else if ( COMPARE( child->Value(), "light" ) ) { LoadLight( child ); } } }
void StencilComp::Read (istream& in) { GraphicComp::Read(in); Bitmap* image = ReadBitmap(in); Bitmap* mask = nil; Skip(in); int m; in >> m; if (m == valid_mask) { mask = ReadBitmap(in); } else if (m == mask_equals_image) { mask = image; } UStencil* stencil = new UStencil(image, mask); stencil->FillBg(ReadBgFilled(in)); PSColor* fg = ReadColor(in); PSColor* bg = ReadColor(in); stencil->SetColors(fg, bg); Transformer* t = ReadTransformer(in); stencil->SetTransformer(t); Unref(t); SetGraphic(stencil); _filename = ReadString(in); }
void SceneImporter<real>::ReadLightHeader( std::istream& stream, Light<real>* ioLight ) { ReadLightNodeHeader( stream, ioLight ); ReadNextExactToken( stream, "," ); ioLight->SetIntensity( ReadColor( stream ) ); ReadNextExactToken( stream, "," ); ioLight->SetAmbient( ReadColor( stream ) ); }
void compatibleReadStyle() { char styleFile[MAX_PATH]; strcpy(styleFile, stylePath()); ReadFont(styleFile); mSkin.borderWidth = ReadInt(styleFile, "borderWidth:", 1); mSkin.borderWidth = ReadInt(styleFile, "window.frame.borderWidth:", mSkin.borderWidth); strcpy(borderColorAsString, ReadString(styleFile, "borderColor:", "0x000000")); mSkin.focus_borderColor = ReadColor(styleFile, "window.frame.focus.borderColor:", borderColorAsString); mSkin.unfocus_borderColor = ReadColor(styleFile, "window.frame.unfocus.borderColor:", borderColorAsString); mSkin.handleHeight = ReadInt(styleFile, "handleWidth:", 5); mSkin.handleHeight = ReadInt(styleFile, "window.handleHeight:", mSkin.handleHeight); ReadStyleElement(styleFile, &mSkin.windowTitleFocus, "window.title.focus"); ReadStyleElement(styleFile, &mSkin.windowLabelFocus, "window.label.focus"); ReadStyleElement(styleFile, &mSkin.windowHandleFocus, "window.handle.focus"); ReadStyleElement(styleFile, &mSkin.windowGripFocus, "window.grip.focus"); ReadStyleElement(styleFile, &mSkin.windowButtonFocus, "window.button.focus"); ReadStyleElement(styleFile, &mSkin.windowButtonPressed, "window.button.pressed"); ReadStyleElement(styleFile, &mSkin.windowTitleUnfocus, "window.title.unfocus"); ReadStyleElement(styleFile, &mSkin.windowLabelUnfocus, "window.label.unfocus"); ReadStyleElement(styleFile, &mSkin.windowHandleUnfocus, "window.handle.unfocus"); ReadStyleElement(styleFile, &mSkin.windowGripUnfocus, "window.grip.unfocus"); ReadStyleElement(styleFile, &mSkin.windowButtonUnfocus, "window.button.unfocus"); }
void LinkComp::Read (istream& in) { GraphicComp::Read(in); Line* line = new Line(0, 0, 1, 1); Transformer* t = ReadTransformer(in); line->SetTransformer(t); Unref(t); _conn1 = (Connector*) unidraw->GetCatalog()->ReadComponent(in); _conn2 = (Connector*) unidraw->GetCatalog()->ReadComponent(in); Graphic* parent = new Picture; parent->FillBg(ReadBgFilled(in)); PSColor* fg = ReadColor(in); PSColor* bg = ReadColor(in); parent->SetColors(fg, bg); parent->SetBrush(ReadBrush(in)); t = ReadTransformer(in); parent->SetTransformer(t); Unref(t); parent->Append(line, _conn1->GetGraphic(), _conn2->GetGraphic()); SetGraphic(parent); }
void HighlightSetup::LoadHlStyles(const char *s) { CParser p(s); try { while(!p.IsEof()) { String id = p.ReadId(); Color c = ReadColor(p); bool bold = false; bool italic = false; bool underline = false; for(;;) if(p.Id("bold")) bold = true; else if(p.Id("italic")) italic = true; else if(p.Id("underline")) underline = true; else break; for(int i = 0; i < HL_COUNT; i++) if(id == s_hl_color[i]) { SetHlStyle(i, c, bold, italic, underline); break; } p.PassChar(';'); } } catch(CParser::Error) { DefaultHlStyles(); } }
Variant Deserializer::ReadVariant(VariantType type) { switch (type) { case VAR_INT: return Variant(ReadInt()); case VAR_BOOL: return Variant(ReadBool()); case VAR_FLOAT: return Variant(ReadFloat()); case VAR_VECTOR2: return Variant(ReadVector2()); case VAR_VECTOR3: return Variant(ReadVector3()); case VAR_VECTOR4: return Variant(ReadVector4()); case VAR_QUATERNION: return Variant(ReadQuaternion()); case VAR_COLOR: return Variant(ReadColor()); case VAR_STRING: return Variant(ReadString()); case VAR_BUFFER: return Variant(ReadBuffer()); case VAR_PTR: ReadUInt(); return Variant((void*)0); case VAR_RESOURCEREF: return Variant(ReadResourceRef()); case VAR_RESOURCEREFLIST: return Variant(ReadResourceRefList()); case VAR_VARIANTVECTOR: return Variant(ReadVariantVector()); case VAR_VARIANTMAP: return Variant(ReadVariantMap()); case VAR_INTRECT: return Variant(ReadIntRect()); case VAR_INTVECTOR2: return Variant(ReadIntVector2()); default: return Variant(); } }
void C3DSLoader::ReadNextMatChunk(t3DModel *pModel, tChunk *pPreChunk) { int buffer[50000] = {0}; m_CurrentChunk = new tChunk; while (pPreChunk->bytesRead < pPreChunk->length) { ReadChunk(m_CurrentChunk); switch (m_CurrentChunk->ID) { case MATNAME: m_CurrentChunk->bytesRead += fread(pModel->pMaterials[pModel->numOfMaterials - 1].strName, 1, m_CurrentChunk->length - m_CurrentChunk->bytesRead, m_FilePointer); break; case MATDIFFUSE: ReadColor(&(pModel->pMaterials[pModel->numOfMaterials - 1]), m_CurrentChunk); break; case MATMAP: ReadNextMatChunk(pModel, m_CurrentChunk); break; case MATMAPFILE: m_CurrentChunk->bytesRead += fread(pModel->pMaterials[pModel->numOfMaterials - 1].strFile, 1, m_CurrentChunk->length - m_CurrentChunk->bytesRead, m_FilePointer); break; default: m_CurrentChunk->bytesRead += fread(buffer, 1, m_CurrentChunk->length - m_CurrentChunk->bytesRead, m_FilePointer); break; } pPreChunk->bytesRead += m_CurrentChunk->bytesRead; } delete m_CurrentChunk; m_CurrentChunk = pPreChunk; }
INLINE UINT32 gdi_GetPixel(HGDI_DC hdc, UINT32 nXPos, UINT32 nYPos) { HGDI_BITMAP hBmp = (HGDI_BITMAP) hdc->selectedObject; BYTE* data = &(hBmp->data[(nYPos * hBmp->scanline) + nXPos * GetBytesPerPixel( hBmp->format)]); return ReadColor(data, hBmp->format); }
bool Settings_t::Read(void) { klPrintf("Reading settings\r"); // Sound names if(!ReadString("Sound", "KeyBeep", "lock.ini", Settings.SndKeyBeep, FNAME_LNG_MAX)) return false; if(!ReadString("Sound", "KeyDrop", "lock.ini", Settings.SndKeyDrop, FNAME_LNG_MAX)) return false; if(!ReadString("Sound", "KeyCrash", "lock.ini", Settings.SndKeyCrash, FNAME_LNG_MAX)) return false; if(!ReadString("Sound", "PassError", "lock.ini", Settings.SndPassError, FNAME_LNG_MAX)) return false; if(!ReadString("Sound", "Open", "lock.ini", Settings.SndOpen, FNAME_LNG_MAX)) return false; if(!ReadString("Sound", "Close", "lock.ini", Settings.SndClose, FNAME_LNG_MAX)) return false; // ======= Codes ======= // If length == 0 then code is empty. If code is negative (-1 for examle) then side is crashed // === Code A === if(!ReadString("Code", "CodeA", "lock.ini", Settings.CodeA, CODE_LNG_MAX)) return false; Settings.CodeALength = strlen(Settings.CodeA); if (Settings.CodeALength != 0) { if (Settings.CodeA[0] == 'N') Settings.CodeALength = 0; // Check if None if (Settings.CodeA[0] == '-') Settings.CodeALength = -1; // Check if crashed } // === Code B === if(!ReadString("Code", "CodeB", "lock.ini", Settings.CodeB, CODE_LNG_MAX)) return false; Settings.CodeBLength = strlen(Settings.CodeB); if (Settings.CodeBLength !=0) { if (Settings.CodeB[0] == 'N') Settings.CodeBLength = 0; // Check if None if (Settings.CodeB[0] == '-') Settings.CodeBLength = -1; // Check if crashed } // === Service code === if(!ReadString("Code", "ServiceCode", "lock.ini", Settings.ServiceCode, CODE_LNG_MAX)) return false; // Complexity if(!ReadString("Code", "Complexity", "lock.ini", Settings.Complexity, 3)) return false; // Colors if(!ReadColor("Colors", "DoorOpen", "lock.ini", &Settings.ColorDoorOpen)) return false; if(!ReadColor("Colors", "DoorOpening", "lock.ini", &Settings.ColorDoorOpening)) return false; if(!ReadColor("Colors", "DoorClosed", "lock.ini", &Settings.ColorDoorClosed)) return false; if(!ReadColor("Colors", "DoorClosing", "lock.ini", &Settings.ColorDoorClosing)) return false; if(!ReadUint32("Colors", "BlinkDelay", "lock.ini", &Settings.BlinkDelay)) return false; // Timings if(!ReadUint32("Timings", "DoorCloseDelay", "lock.ini", &Settings.DoorCloseDelay)) return false; if(!ReadUint32("Timings", "KeyDropDelay", "lock.ini", &Settings.KeyDropDelay)) return false; return true; }
//加载配置 bool __cdecl CSkinButtonAttribute::LoadSkinOption() { //读取字体颜色 m_crTextColor=ReadColor(SKIN_BUTTON_CRTEXTCOLOR,DEF_TEXT_COLOR); m_ImageBack.SetLoadInfo(IDB_SKIN_BUTTON_BACK,GetModuleHandle(SKIN_CONTROL_DLL_NAME)); return true; }
//加载配置 bool __cdecl CSkinListAttribute::LoadSkinOption() { //读取配置 m_crHeadText=ReadColor(SKIN_LIST_CRHEADTEXT,DEF_HEADTEXT_COLOR); m_ImageHead.SetLoadInfo(IDB_SKIN_HEAD_TITLE,GetModuleHandle(SKIN_CONTROL_DLL_NAME)); return true; }
TextureMap* ReadTexture(TiXmlElement *element) { const char* texName = element->Attribute("texture"); if ( texName == NULL ) return NULL; Texture *tex = NULL; if ( COMPARE(texName,"checkerboard") ) { TextureChecker *ctex = new TextureChecker; tex = ctex; printf(" Texture: Checker Board\n"); for ( TiXmlElement *child = element->FirstChildElement(); child!=NULL; child = child->NextSiblingElement() ) { if ( COMPARE( child->Value(), "color1" ) ) { Color c(0,0,0); ReadColor( child, c ); ctex->SetColor1(c); printf(" color1 %f %f %f\n",c.r,c.g,c.b); } else if ( COMPARE( child->Value(), "color2" ) ) { Color c(0,0,0); ReadColor( child, c ); ctex->SetColor2(c); printf(" color2 %f %f %f\n",c.r,c.g,c.b); } } textureList.Append( tex, texName ); } else { printf(" Texture: File \"%s\"",texName); tex = textureList.Find( texName ); if ( tex == NULL ) { TextureFile *ftex = new TextureFile; tex = ftex; ftex->SetName(texName); if ( ! ftex->Load() ) { printf(" -- Error loading file!"); delete tex; tex = NULL; } else { textureList.Append( tex, texName ); } } printf("\n"); } TextureMap *map = new TextureMap(tex); LoadTransform(map,element,1); return map; }
Material* SceneImporter<real>::ReadBlinnPhongMaterial( std::istream& stream, const std::string& name ) { BlinnPhongMaterial<real>* material = new BlinnPhongMaterial<real>; material->SetSurface( ReadColor( stream ) ); ReadNextExactToken( stream, "," ); material->SetAmbient( ReadColor( stream ) ); ReadNextExactToken( stream, "," ); material->SetDiffuse( ReadColor( stream ) ); ReadNextExactToken( stream, "," ); material->SetSpecular( ReadColor( stream ) ); ReadNextExactToken( stream, "," ); material->SetMetallic( ReadColor( stream ) ); ReadNextExactToken( stream, "," ); material->SetReflection( ReadColor( stream ) ); ReadNextExactToken( stream, "," ); material->SetRefraction( ReadColor( stream ) ); ReadNextExactToken( stream, "," ); material->SetRefractionIndex( ReadReal( stream ) ); ReadNextExactToken( stream, "," ); material->SetShininess( ReadReal( stream ) ); ReadNextExactToken( stream, "," ); material->SetWireframe( ReadBoolean( stream ) ); ReadNextExactToken( stream, "," ); material->SetTexture( GetTexture( ReadNextToken( stream ) ) ); ReadNextExactToken( stream, "," ); Texture<real>* environment = GetTexture( ReadNextToken( stream ) ); if ( environment && ( environment->GetTextureType() != Texture<real>::TypeCubeMap ) ) throw "Environment must be a CubeMap"; material->SetEnvironment( (CubeMap<real>*)environment ); material->SetName( name ); return material; }
void ColorProperty::Read(CParser& p) { if(p.Id("Null")) { editor.SetData(Null); return; } p.Char(':'); editor.SetData(ReadColor(p)); }
void LoadMaterial(TiXmlElement *element) { Material *mtl = NULL; // name const char* name = element->Attribute("name"); printf("Material ["); if ( name ) printf("%s",name); printf("]"); // type const char* type = element->Attribute("type"); if ( type ) { if ( COMPARE(type,"blinn") ) { printf(" - Blinn\n"); MtlBlinn *m = new MtlBlinn(); mtl = m; for ( TiXmlElement *child = element->FirstChildElement(); child!=NULL; child = child->NextSiblingElement() ) { Color c(1,1,1); float f=1; if ( COMPARE( child->Value(), "diffuse" ) ) { ReadColor( child, c ); m->SetDiffuse(c); printf(" diffuse %f %f %f\n",c.r,c.g,c.b); } else if ( COMPARE( child->Value(), "specular" ) ) { ReadColor( child, c ); m->SetSpecular(c); printf(" specular %f %f %f\n",c.r,c.g,c.b); } else if ( COMPARE( child->Value(), "glossiness" ) ) { ReadFloat( child, f ); m->SetGlossiness(f); printf(" glossiness %f\n",f); } } } else { printf(" - UNKNOWN\n"); } } if ( mtl ) { mtl->SetName(name); materials.push_back(mtl); } }
void LineComp::Read (istream& in) { GraphicComp::Read(in); Coord x0, y0, x1, y1; in >> x0 >> y0 >> x1 >> y1; Line* line = new Line(x0, y0, x1, y1); line->FillBg(ReadBgFilled(in)); PSColor* fg = ReadColor(in); PSColor* bg = ReadColor(in); line->SetColors(fg, bg); line->SetBrush(ReadBrush(in)); Transformer* t = ReadTransformer(in); line->SetTransformer(t); Unref(t); SetGraphic(line); }
void RectComp::Read (istream& in) { GraphicComp::Read(in); Coord x0, y0, x1, y1; in >> x0 >> y0 >> x1 >> y1; SF_Rect* rect = new SF_Rect(x0, y0, x1, y1); rect->FillBg(ReadBgFilled(in)); PSColor* fg = ReadColor(in); PSColor* bg = ReadColor(in); rect->SetColors(fg, bg); rect->SetBrush(ReadBrush(in)); rect->SetPattern(ReadPattern(in)); Transformer* t = ReadTransformer(in); rect->SetTransformer(t); Unref(t); SetGraphic(rect); }
void LoadTexColorsCompiled (int i, CFile& cf) { int j; // get the default colors if (gameStates.app.bD2XLevel) { INIT_PROGRESS_LOOP (i, j, MAX_WALL_TEXTURES); for (; i < j; i++) ReadColor (cf, gameData.render.color.textures + i, gameData.segs.nLevelVersion <= 15, gameStates.render.nLightingMethod); } }
void EllipseComp::Read (istream& in) { GraphicComp::Read(in); Coord x0, y0; int r1, r2; in >> x0 >> y0 >> r1 >> r2; SF_Ellipse* ellipse = new SF_Ellipse(x0, y0, r1, r2); ellipse->FillBg(ReadBgFilled(in)); PSColor* fg = ReadColor(in); PSColor* bg = ReadColor(in); ellipse->SetColors(fg, bg); ellipse->SetBrush(ReadBrush(in)); ellipse->SetPattern(ReadPattern(in)); Transformer* t = ReadTransformer(in); ellipse->SetTransformer(t); Unref(t); SetGraphic(ellipse); }
void TextComp::Read (istream& in) { GraphicComp::Read(in); int lineHt; in >> lineHt; char* string = ReadString(in); TextGraphic* text = new TextGraphic(string, lineHt); delete string; text->FillBg(ReadBgFilled(in)); PSColor* fg = ReadColor(in); PSColor* bg = ReadColor(in); text->SetColors(fg, bg); text->SetFont(ReadFont(in)); Transformer* t = ReadTransformer(in); text->SetTransformer(t); Unref(t); SetGraphic(text); }
void PadComp::Read (istream& in) { Connector::Read(in); Coord l, b, r, t; int mobility; in >> l >> b >> r >> t >> mobility; PadGraphic* pad = new PadGraphic(l, b, r, t); _mobility = Mobility(mobility); pad->FillBg(ReadBgFilled(in)); PSColor* fg = ReadColor(in); PSColor* bg = ReadColor(in); pad->SetColors(fg, bg); pad->SetBrush(ReadBrush(in)); Transformer* xf = ReadTransformer(in); pad->SetTransformer(xf); Unref(xf); SetGraphic(pad); }
void PinComp::Read (istream& in) { Connector::Read(in); Coord x0, y0; int mobility; in >> x0 >> y0 >> mobility; PinGraphic* pin = new PinGraphic(x0, y0); _mobility = Mobility(mobility); pin->FillBg(ReadBgFilled(in)); PSColor* fg = ReadColor(in); PSColor* bg = ReadColor(in); pin->SetColors(fg, bg); pin->SetBrush(ReadBrush(in)); Transformer* t = ReadTransformer(in); pin->SetTransformer(t); Unref(t); SetGraphic(pin); }
void FbxParser::ProcessMesh(FbxNode* pNode,std::vector<GS::BaseMesh*>& meshs) { FbxMesh* lMesh = (FbxMesh*) pNode->GetNodeAttribute (); if (lMesh == NULL) return ; int triangleCount = lMesh->GetPolygonCount(); int vertexCounter = 0; if (triangleCount ==0) return ; GS::BaseMesh* pMesh = new GS::BaseMesh(); GS::double3 p0, p1, p2; int vertexId = 0; GS::VertexInfo v1, v2, v3; for(int i = 0 ; i < triangleCount ; ++i) { int ctrlPointIndex = lMesh->GetPolygonVertex(i , 0); ReadVertex(lMesh, ctrlPointIndex, v1.pos); ReadColor(lMesh, ctrlPointIndex, vertexId, v1.color); ReadNormal(lMesh, ctrlPointIndex, vertexId++, v1.normal); // read the second vertex ctrlPointIndex = lMesh->GetPolygonVertex(i , 1); ReadVertex(lMesh, ctrlPointIndex, v2.pos); ReadColor(lMesh, ctrlPointIndex, vertexId, v2.color); ReadNormal(lMesh, ctrlPointIndex, vertexId++, v2.normal); // read the third vertex ctrlPointIndex = lMesh->GetPolygonVertex(i , 2); ReadVertex(lMesh, ctrlPointIndex, v3.pos); ReadColor(lMesh, ctrlPointIndex, vertexId, v3.color); ReadNormal(lMesh, ctrlPointIndex, vertexId++, v3.normal); pMesh->Add(v1, v2, v3); } pMesh->GenID(); //pMesh->GenSurface(); pMesh->GenAABB(true); meshs.push_back(pMesh); }
void SplineComp::Read (istream& in) { VerticesComp::Read(in); Coord* x, *y; int count; ReadVertices(in, x, y, count); SFH_OpenBSpline* spline = new SFH_OpenBSpline(x, y, count); delete x; delete y; spline->FillBg(ReadBgFilled(in)); PSColor* fg = ReadColor(in); PSColor* bg = ReadColor(in); spline->SetColors(fg, bg); spline->SetBrush(ReadBrush(in)); spline->SetPattern(ReadPattern(in)); Transformer* t = ReadTransformer(in); spline->SetTransformer(t); Unref(t); SetGraphic(spline); }
void MultiLineComp::Read (istream& in) { VerticesComp::Read(in); Coord* x, *y; int count; ReadVertices(in, x, y, count); SF_MultiLine* ml = new SF_MultiLine(x, y, count); delete x; delete y; ml->FillBg(ReadBgFilled(in)); PSColor* fg = ReadColor(in); PSColor* bg = ReadColor(in); ml->SetColors(fg, bg); ml->SetBrush(ReadBrush(in)); ml->SetPattern(ReadPattern(in)); Transformer* t = ReadTransformer(in); ml->SetTransformer(t); Unref(t); SetGraphic(ml); }
//搜索腐蚀中心 static int SearchCentre(unsigned int *x,unsigned int *y,const TARGET_CONDI *Condition,const SEARCH_AREA *Area) { unsigned int SpaceX,SpaceY,i,j,k,FailCount=0; COLOR_RGB Rgb; COLOR_HSL Hsl; SpaceX = Condition->WIDTH_MIN/3; SpaceY = Condition->HIGHT_MIN/3; for(i=Area->Y_Start;i<Area->Y_End;i+=SpaceY) { for(j=Area->X_Start;j<Area->X_End;j+=SpaceX) { FailCount=0; for(k=0;k<SpaceX+SpaceY;k++) { if(k<SpaceX) ReadColor(j+k,i+SpaceY/2,&Rgb); else ReadColor(j+SpaceX/2,i+(k-SpaceX),&Rgb); RGBtoHSL(&Rgb,&Hsl); if(!ColorMatch(&Hsl,Condition)) FailCount++; if(FailCount>((SpaceX+SpaceY)>>ALLOW_FAIL_PER)) break; } if(k==SpaceX+SpaceY) { *x = j+SpaceX/2; *y = i+SpaceY/2; return 1; } } } return 0; }
void sb7fbxmodel::ProcessMesh(FbxNode* pNode) { fbxsdk::FbxMesh* pMesh = pNode->GetMesh(); if(pMesh == NULL) { return; } int triangleCount = pMesh->GetPolygonCount(); int vertexCounter = 0; sub_mesh sm; sm.count = 3 * triangleCount; sm.va = (vetex_attr*)malloc(sizeof(vetex_attr) * sm.count); m_vass.push_back(sm); for(int i = 0 ; i < triangleCount ; ++i) { for(int j = 0 ; j < 3 ; j++) { vetex_attr va; int ctrlPointIndex = pMesh->GetPolygonVertex(i , j); // Read the vertex ReadVertex(pMesh , ctrlPointIndex , va.vertex); // Read the color of each vertex ReadColor(pMesh , ctrlPointIndex , vertexCounter , va.color); // Read the UV of each vertex for(int k = 0 ; k < 2 ; ++k) { ReadUV(pMesh , ctrlPointIndex , pMesh->GetTextureUVIndex(i, j) , k , va.uv[k]); } // Read the normal of each vertex ReadNormal(pMesh , ctrlPointIndex , vertexCounter , va.normal); // Read the tangent of each vertex ReadTangent(pMesh , ctrlPointIndex , vertexCounter , va.tangent); sm.va[vertexCounter] = va; vertexCounter++; } // 根据读入的信息组装三角形,并以某种方式使用即可,比如存入到列表中、保存到文件等... } }
void L3DS::ReadLight(const LChunk &parent) { float t; LVector3 v; LLight light; light.SetName(m_objName); v.x = ReadFloat(); v.y = ReadFloat(); v.z = ReadFloat(); light.SetPosition(v); LChunk chunk = ReadChunk(); while (chunk.end <= parent.end) { switch (chunk.id) { case COLOR_24: case COLOR_F: case LIN_COLOR_F: case LIN_COLOR_24: light.SetColor(ReadColor(chunk)); break; case SPOTLIGHT: v.x = ReadFloat(); v.y = ReadFloat(); v.z = ReadFloat(); light.SetTarget(v); t = ReadFloat(); light.SetHotspot(t); t = ReadFloat(); light.SetFalloff(t); break; case LIT_INRANGE: light.SetAttenuationstart(ReadFloat()); break; case LIT_OUTRANGE: light.SetAttenuationend(ReadFloat()); break; default: break; } SkipChunk(chunk); if (chunk.end >= parent.end) break; chunk = ReadChunk(); } m_lights.push_back(light); }
void LoadVertLightsCompiled (int i, CFile& cf) { int j; gameData.render.shadows.nLights = 0; if (gameStates.app.bD2XLevel) { INIT_PROGRESS_LOOP (i, j, gameData.segs.nVertices); for (; i < j; i++) { #if DBG if (i == nDbgVertex) nDbgVertex = nDbgVertex; #endif ReadColor (cf, gameData.render.color.ambient + i, gameData.segs.nLevelVersion <= 14, 1); } } }