domCOLLADA* ColladaShapeLoader::readColladaFile(const String& path) { // Check if this file is already loaded into the database domCOLLADA* root = sDAE.getRoot(path.c_str()); if (root) return root; // Load the Collada file into memory FileObject fo; if (!fo.readMemory(path)) { daeErrorHandler::get()->handleError(avar("Could not read %s into memory", path.c_str())); return NULL; } root = sDAE.openFromMemory(path.c_str(), (const char*)fo.buffer()); if (!root || !root->getLibrary_visual_scenes_array().getCount()) { daeErrorHandler::get()->handleError(avar("Could not parse %s", path.c_str())); return NULL; } // Fixup issues in the model ColladaUtils::applyConditioners(root); // Recursively load external DAE references TSShapeLoader::updateProgress(TSShapeLoader::Load_ExternalRefs, "Loading external references..."); for (S32 iRef = 0; iRef < root->getDocument()->getReferencedDocuments().getCount(); iRef++) { String refPath = (daeString)root->getDocument()->getReferencedDocuments()[iRef]; if (refPath.endsWith(".dae") && !readColladaFile(refPath)) daeErrorHandler::get()->handleError(avar("Failed to load external reference: %s", refPath.c_str())); } return root; }
void LensFlare::initialize(SimManager *manager) { initialized = true; ResourceManager &rm = *SimResource::get(manager); hMaterialList = rm.load(filename); AssertFatal((bool)hMaterialList, avar("Error reading materialList file \"%s\"", filename)); AssertFatal(hMaterialList->getMaterialsCount() > 0, avar("material list \"%s\" is empty", filename)); hMaterialList->load(rm, true); const GFXBitmap *bitmap = hMaterialList->getMaterial(0).getTextureMap(); float dScale = 1.0f; if (flares.size() == 0) { flares.push_back(FlareInfo(1, -0.150f*dScale, 0.9f, 0.9f, true)); flares.push_back(FlareInfo(0, 0.000f*dScale, 0.001f, 0.8f, false)); flares.push_back(FlareInfo(1, 0.136f*dScale, 1.2f, 1.2f, true)); flares.push_back(FlareInfo(2, 0.182f*dScale, 1.0f, 1.0f, true)); flares.push_back(FlareInfo(4, 0.304f*dScale, 1.0f, 1.0f, true)); flares.push_back(FlareInfo(4, 0.405f*dScale, 1.0f, 1.0f, true)); flares.push_back(FlareInfo(3, 0.606f*dScale, 1.0f, 1.0f, true)); flares.push_back(FlareInfo(3, 0.682f*dScale, 0.7f, 0.7f, true)); flares.push_back(FlareInfo(5, 0.841f*dScale, 0.7f, 0.7f, true)); flares.push_back(FlareInfo(1, 0.932f*dScale, 0.7f, 0.7f, true)); flares.push_back(FlareInfo(1, 1.000f*dScale, 1.0f, 1.0f, true)); } }
Bool GFXFont::read( const char *in_name ) { Bool success; HANDLE fileHandle; // handle of opened file fileHandle = CreateFile(in_name, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL ); if ( fileHandle == INVALID_HANDLE_VALUE ) { AssertWarn(0, avar("GFXFont::load: Unable to load font %s, CreateFile for reading failed.", in_name)); return FALSE; } FileRStream frs(fileHandle); success = read( &frs ); frs.close(); CloseHandle( fileHandle ); if ( success ) return TRUE; else { AssertWarn(0, avar("GFXFont::load: Unable to load font %s, StreamIO for reading failed.", in_name)); return FALSE; } }
void InspectDlg::updateView() { Point2I *tile = parent->getSelectedTile(); TextureInfo *tex = parent->getTileTexture(*tile); if (!tex) { SetDlgItemText(getHandle(),EDT_TILE_INDEX, "none"); SendMessage(GetDlgItem(getHandle(),CHK_ROTATE), BM_SETCHECK, 0, 0L); SendMessage(GetDlgItem(getHandle(),CHK_FLIP_X), BM_SETCHECK, 0, 0L); SendMessage(GetDlgItem(getHandle(),CHK_FLIP_Y), BM_SETCHECK, 0, 0L); } else { switch (tex->textureID) { case -1: SetDlgItemText(getHandle(),EDT_TILE_INDEX, "hole"); break; default: SetDlgItemText(getHandle(),EDT_TILE_INDEX, avar("%d",tex->textureID)); } SendMessage(GetDlgItem(getHandle(),CHK_ROTATE), BM_SETCHECK, tex->flags & GridBlock::Material::Rotate, 0L); SendMessage(GetDlgItem(getHandle(),CHK_FLIP_X), BM_SETCHECK, tex->flags & GridBlock::Material::FlipX, 0L); SendMessage(GetDlgItem(getHandle(),CHK_FLIP_Y), BM_SETCHECK, tex->flags & GridBlock::Material::FlipY, 0L); } SetDlgItemText(getHandle(),EDT_NAME, parent->getStampName()); SetDlgItemText(getHandle(),EDT_DML_NAME, parent->getDML_Name()); SetDlgItemText(getHandle(),EDT_CLAMP, avar("%d",parent->getStampClampValue())); SendMessage(GetDlgItem(getHandle(),CHK_FLAT), BM_SETCHECK, parent->isTileFlat(*tile), 0L); }
bool VolumetricFogRTManager::Init() { if (mIsInitialized) { Con::errorf("VolumetricFogRTManager allready initialized!!"); return true; } GuiCanvas* cv = dynamic_cast<GuiCanvas*>(Sim::findObject("Canvas")); if (cv == NULL) { Con::errorf("VolumetricFogRTManager::Init() - Canvas not found!!"); return false; } mPlatformWindow = cv->getPlatformWindow(); mPlatformWindow->getScreenResChangeSignal().notify(this,&VolumetricFogRTManager::ResizeRT); if (mTargetScale < 1 || GFX->getAdapterType() == Direct3D11) mTargetScale = 1; mWidth = mFloor(mPlatformWindow->getClientExtent().x / mTargetScale); mHeight = mFloor(mPlatformWindow->getClientExtent().y / mTargetScale); mDepthBuffer = GFXTexHandle(mWidth, mHeight, GFXFormatR32F, &GFXRenderTargetProfile, avar("%s() - mDepthBuffer (line %d)", __FUNCTION__, __LINE__)); if (!mDepthBuffer.isValid()) { Con::errorf("VolumetricFogRTManager Fatal Error: Unable to create Depthbuffer"); return false; } if (!mDepthTarget.registerWithName("volfogdepth")) { Con::errorf("VolumetricFogRTManager Fatal Error : Unable to register Depthbuffer"); return false; } mDepthTarget.setTexture(mDepthBuffer); mFrontBuffer = GFXTexHandle(mWidth, mHeight, GFXFormatR32F, &GFXRenderTargetProfile, avar("%s() - mFrontBuffer (line %d)", __FUNCTION__, __LINE__)); if (!mFrontBuffer.isValid()) { Con::errorf("VolumetricFogRTManager Fatal Error: Unable to create front buffer"); return false; } if (!mFrontTarget.registerWithName("volfogfront")) { Con::errorf("VolumetricFogRTManager Fatal Error : Unable to register Frontbuffer"); return false; } mFrontTarget.setTexture(mFrontBuffer); Con::setVariable("$VolumetricFog::density", "0.0"); mIsInitialized = true; return true; }
void TSShapeAlloc::checkGuard() { bool check32 = checkGuard32(); bool check16 = checkGuard16(); bool check8 = checkGuard8(); AssertFatal(check32,avar("TSShapeAlloc::checkGuard32: found %i, wanted %i",getSaveGuard32(),getPrevGuard32())); AssertFatal(check16,avar("TSShapeAlloc::checkGuard16: found %i, wanted %i",getSaveGuard16(),getPrevGuard16())); AssertFatal(check8 ,avar("TSShapeAlloc::checkGuard8: found %i, wanted %i",getSaveGuard8() ,getPrevGuard8())); }
Var* GBufferConditionerGLSL::_unconditionInput( Var *conditionedInput, MultiLine *meta ) { Var *retVar = new Var; retVar->setType("float4"); retVar->setName("_gbUnconditionedInput"); LangElement *outputDecl = new DecOp( retVar ); switch(mNormalStorageType) { case CartesianXYZ: meta->addStatement( new GenOp( " // g-buffer unconditioner: float4(normal.xyz, depth)\r\n" ) ); meta->addStatement( new GenOp( " @ = float4(@, @.a);\r\n", outputDecl, _posnegDecode(new GenOp("@.xyz", conditionedInput)), conditionedInput ) ); break; case CartesianXY: meta->addStatement( new GenOp( " // g-buffer unconditioner: float4(normal.xy, depth Hi + z-sign, depth Lo)\r\n" ) ); meta->addStatement( new GenOp( " @ = float4(@, @.a);\r\n", outputDecl, _posnegDecode(new GenOp("@.xyz", conditionedInput)), conditionedInput ) ); meta->addStatement( new GenOp( " @.z *= sqrt(1.0 - dot(@.xy, @.xy));\r\n", retVar, retVar, retVar ) ); break; case Spherical: meta->addStatement( new GenOp( " // g-buffer unconditioner: float4(normal.theta, normal.phi, depth Hi, depth Lo)\r\n" ) ); meta->addStatement( new GenOp( " float2 spGPUAngles = @;\r\n", _posnegDecode(new GenOp("@.xy", conditionedInput)) ) ); meta->addStatement( new GenOp( " float2 sincosTheta;\r\n" ) ); meta->addStatement( new GenOp( " sincos(spGPUAngles.x * 3.14159265358979323846f, sincosTheta.x, sincosTheta.y);\r\n" ) ); meta->addStatement( new GenOp( " float2 sincosPhi = float2(sqrt(1.0 - spGPUAngles.y * spGPUAngles.y), spGPUAngles.y);\r\n" ) ); meta->addStatement( new GenOp( " @ = float4(sincosTheta.y * sincosPhi.x, sincosTheta.x * sincosPhi.x, sincosPhi.y, @.a);\r\n", outputDecl, conditionedInput ) ); break; case LambertAzimuthal: // Note we're casting to half to use partial precision // sqrt which is much faster on older Geforces while // still being acceptable for normals. // meta->addStatement( new GenOp( " // g-buffer unconditioner: float4(normal.X, normal.Y, depth Hi, depth Lo)\r\n" ) ); meta->addStatement( new GenOp( " float2 _inpXY = @;\r\n", _posnegDecode(new GenOp("@.xy", conditionedInput)) ) ); meta->addStatement( new GenOp( " float _xySQ = dot(_inpXY, _inpXY);\r\n" ) ); meta->addStatement( new GenOp( " @ = float4( sqrt(half(1.0 - (_xySQ / 4.0))) * _inpXY, -1.0 + (_xySQ / 2.0), @.a).xzyw;\r\n", outputDecl, conditionedInput ) ); break; } // Recover depth from encoding if(mNormalStorageType != CartesianXYZ) { const U64 maxValPerChannel = 1 << mBitsPerChannel; meta->addStatement( new GenOp( " \r\n // Decode depth\r\n" ) ); meta->addStatement( new GenOp( avar( " @.w = dot( @.zw, float2(1.0, 1.0/%llu.0));\r\n", maxValPerChannel - 1 ), retVar, conditionedInput ) ); } AssertFatal( retVar != NULL, avar( "Cannot uncondition input from buffer format: %s", GFXStringTextureFormat[getBufferFormat()] ) ); return retVar; }
const String &ConditionerFeature::getShaderMethodName( MethodType methodType ) { if ( mConditionMethodName.isEmpty() ) { const U32 hash = getName().getHashCaseInsensitive(); mUnconditionMethodName = avar("autogen%s_%08x", "Uncondition", hash ); mConditionMethodName = avar("autogen%s_%08x", "Condition", hash ); } return methodType == UnconditionMethod ? mUnconditionMethodName : mConditionMethodName; }
void AbstractClassRep::init() { // Only add the renderable and selectable globals for // classes derived from SceneObject which are the only // objects for which these work. if ( isSubclassOf( "SceneObject" ) ) { Con::addVariable( avar( "$%s::isRenderable", getClassName() ), TypeBool, &mIsRenderEnabled, "@brief Disables rendering of all instances of this type.\n\n" ); Con::addVariable( avar( "$%s::isSelectable", getClassName() ), TypeBool, &mIsSelectionEnabled, "@brief Disables selection of all instances of this type.\n\n" ); } }
//----------------------------------------------------------------------------- void Platform::openFolder(const char* path ) { // TODO: users can still run applications by calling openfolder on an app bundle. // this may be a bad thing. if(!Platform::isDirectory(path)) { Con::errorf(avar("Error: not a directory: %s",path)); return; } const char* arg = avar("open '%s'", path); U32 ret = system(arg); if(ret != 0) Con::printf(strerror(errno)); }
GFXTextureObject *RenderPassManager::getDepthTargetTexture() { // If this is OpenGL, or something else has set the depth buffer, return the pointer if( mDepthBuff.isValid() ) { // If this is OpenGL, make sure the depth target matches up // with the active render target. Otherwise recreate. if( GFX->getAdapterType() == OpenGL ) { GFXTarget* activeRT = GFX->getActiveRenderTarget(); AssertFatal( activeRT, "Must be an active render target to call 'getDepthTargetTexture'" ); Point2I activeRTSize = activeRT->getSize(); if( mDepthBuff.getWidth() == activeRTSize.x && mDepthBuff.getHeight() == activeRTSize.y ) return mDepthBuff.getPointer(); } else return mDepthBuff.getPointer(); } if(GFX->getAdapterType() == OpenGL) { AssertFatal(GFX->getActiveRenderTarget(), "Must be an active render target to call 'getDepthTargetTexture'"); const Point2I rtSize = GFX->getActiveRenderTarget()->getSize(); mDepthBuff.set(rtSize.x, rtSize.y, GFXFormatD24S8, &GFXDefaultZTargetProfile, avar("%s() - mDepthBuff (line %d)", __FUNCTION__, __LINE__)); return mDepthBuff.getPointer(); } // Default return value return GFXTextureTarget::sDefaultDepthStencil; }
U32 GuiImageList::Insert( const char* texturePath, GFXTextureProfile *Type ) { TextureEntry *t = new TextureEntry; if ( ! t ) return -1; t->TexturePath = StringTable->insert(texturePath); if ( *t->TexturePath ) { t->Handle = GFXTexHandle(t->TexturePath, Type, avar("%s() - t->Handle (line %d)", __FUNCTION__, __LINE__)); if ( t->Handle ) { t->id = ++mUniqueId; mTextures.push_back( t ); return t->id; } } // Free Texture Entry. delete t; // Return Failure. return -1; }
void ClipMap::texCB( GTexCallbackCode code, void *userData ) { ClipMap *acm = (ClipMap*)userData; AssertFatal(acm, "ClipMap::texCB - got null userData"); if( code == GZombify ) { // Deallocate our textures. for(S32 i=0; i<acm->mLevels.size(); i++) acm->mLevels[i].mTex = NULL; return; } if( code == GResurrect ) { // Reallocate our textures. U32 numMips = GRAPHIC->getCardProfiler()->queryProfile("autoMipMapLevel", true) ? 0 : 1; GTextureProfile *texProfile = acm->mImageCache->isRenderToTargetCache() ? &ClipMapTextureRTProfile : &ClipMapTextureProfile; for(S32 i=0; i<acm->mLevels.size(); i++) acm->mLevels[i].mTex.set(acm->mClipMapSize, acm->mClipMapSize, GFormatR8G8B8X8, texProfile, avar("%s() - acm->mLevels[%d].mTex (line %d)", __FUNCTION__, i, __LINE__), numMips); // Mark the clipmap for refilling; triggers on next recenter(). acm->mNeedRefill = true; return; } }
void gglPerformBinds() { if(!OpenGLCompat) glewExperimental = GL_TRUE; GLenum err = glewInit(); AssertFatal(GLEW_OK == err, avar("Error: %s\n", glewGetErrorString(err)) ); }
bool GFXGLShader::initShader( const Torque::Path &file, bool isVertex, const Vector<GFXShaderMacro> ¯os ) { PROFILE_SCOPE(GFXGLShader_CompileShader); GLuint activeShader = glCreateShader(isVertex ? GL_VERTEX_SHADER : GL_FRAGMENT_SHADER); if(isVertex) mVertexShader = activeShader; else mPixelShader = activeShader; glAttachShader(mProgram, activeShader); // Ok it's not in the shader gen manager, so ask Torque for it FileStream stream; if ( !stream.open( file, Torque::FS::File::Read ) ) { AssertISV(false, avar("GFXGLShader::initShader - failed to open shader '%s'.", file.getFullPath().c_str())); if ( smLogErrors ) Con::errorf( "GFXGLShader::initShader - Failed to open shader file '%s'.", file.getFullPath().c_str() ); return false; } if ( !_loadShaderFromStream( activeShader, file, &stream, macros ) ) return false; GLint compile; glGetShaderiv(activeShader, GL_COMPILE_STATUS, &compile); // Dump the info log to the console U32 logLength = 0; glGetShaderiv(activeShader, GL_INFO_LOG_LENGTH, (GLint*)&logLength); GLint compileStatus = GL_TRUE; if ( logLength ) { FrameAllocatorMarker fam; char* log = (char*)fam.alloc(logLength); glGetShaderInfoLog(activeShader, logLength, NULL, log); // Always print errors glGetShaderiv( activeShader, GL_COMPILE_STATUS, &compileStatus ); if ( compileStatus == GL_FALSE ) { if ( smLogErrors ) { Con::errorf( "GFXGLShader::initShader - Error compiling shader!" ); Con::errorf( "Program %s: %s", file.getFullPath().c_str(), log ); } } else if ( smLogWarnings ) Con::warnf( "Program %s: %s", file.getFullPath().c_str(), log ); } return compileStatus != GL_FALSE; }
void RemoteCreateEvent::unpack(SimManager *manager, PacketStream *ps, BitStream *bstream) { if(!verifyNotServer(manager)) return; DWORD tag; int posDelta = -bstream->getCurPos(); tag = (DWORD) bstream->readInt( 10); SimNetObject *obj = (SimNetObject *) Persistent::create(tag); obj->unpackUpdate(ps->getGhostManager(), bstream); posDelta += bstream->getCurPos(); PacketStream::getStats()->addBits(PacketStats::Receive, posDelta, obj->getPersistTag()); PacketStream::getStats()->addBits(PacketStats::Receive, -posDelta, RemoteCreateEventType); #ifdef DEBUG_NET int checksum = bstream->readInt(32); AssertFatal( (checksum ^ DebugChecksum) == tag, avar("unpackUpdate did not match packUpdate for object of class %s.", obj->getClassName()) ); #endif manager->addObject(obj); }
GenOp* GBufferConditionerGLSL::_posnegEncode( GenOp *val ) { if(mNormalStorageType == LambertAzimuthal) return mCanWriteNegativeValues ? val : new GenOp(avar("(%f * (@ + %f))", 1.0f/(M_SQRT2_F * 2.0f), M_SQRT2_F), val); else return mCanWriteNegativeValues ? val : new GenOp("(0.5 * (@ + 1.0))", val); }
bool RenderTexTargetBinManager::_updateTargets() { PROFILE_SCOPE(RenderTexTargetBinManager_updateTargets); bool ret = true; mNamedTarget.release(); // Update the target size for( U32 i = 0; i < mTargetChainLength; i++ ) { AssertFatal( mTargetChain != NULL, "RenderTexTargetBinManager - target chain not set up" ); if( !mTargetChain[i] ) mTargetChain[i] = GFX->allocRenderToTextureTarget(); for( U32 j = 0; j < mNumRenderTargets; j++ ) { // try reuse of old color texture if( mTargetChainTextures[i][j].getWidthHeight() != mTargetSize || mTargetChainTextures[i][j].getFormat() != mTargetFormat) { ret &= mTargetChainTextures[i][j].set( mTargetSize.x, mTargetSize.y, mTargetFormat, &GFXDefaultRenderTargetProfile, avar( "%s() - (line %d)", __FUNCTION__, __LINE__ ), 1, GFXTextureManager::AA_MATCH_BACKBUFFER ); mTargetChain[i]->attachTexture( GFXTextureTarget::RenderSlot(GFXTextureTarget::Color0 + j), mTargetChainTextures[i][j] ); } } } return ret; }
Bool FileRWStream::open(const char* in_filename, bool readOnly) { if(!readOnly && assertIsv) { AssertISV(ResourceManager::sm_pManager == NULL || ResourceManager::sm_pManager->isValidWriteFileName(in_filename) == true, avar("Attempted write to file: %s.\n" "File is not in a writable directory.", in_filename)); } close(); // Try to open the file for binary writing. // if the file exists truncate it. // if the file does not exist, then instruct open // to create a file with RW attributes if(!readOnly) hFile = CreateFile(in_filename, GENERIC_WRITE|GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); else hFile = CreateFile( in_filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if ( hFile == INVALID_HANDLE_VALUE) { setStatus(); return FALSE; } clrStatus(); isMine = YES; return TRUE; }
void ConditionerFeature::printHeaderComment( MethodType methodType, const String &methodName, Stream &stream, MultiLine *meta ) { meta->addStatement( new GenOp( "//------------------------------------------------------------------------------\r\n" ) ); meta->addStatement( new GenOp( avar( "// Autogenerated '%s' %s Method\r\n", getName().c_str(), methodType == ConditionMethod ? "Condition" : "Uncondition" ) ) ); meta->addStatement( new GenOp( "//------------------------------------------------------------------------------\r\n" ) ); }
static mng_bool mngFatalErrorFn(mng_handle mng, mng_int32 code, mng_int8 severity, mng_chunkid chunktype, mng_uint32 chunkseq, mng_int32 extra1, mng_int32 extra2, mng_pchar text) { mng_cleanup(&mng); AssertISV(false, avar("Error reading MNG file:\n %s", (const char*)text)); return MNG_FALSE; }
void GuiControlProfile::incLoadCount() { if( !mLoadCount ) { #ifdef DEBUG_SPEW Platform::outputDebugString( "[GuiControlProfile] Loading profile %i:%s (%s:%s)", getId(), getClassName(), getName(), getInternalName() ); #endif sFontCacheDirectory = Con::getVariable( "$GUI::fontCacheDirectory" ); // Load font (if not already loaded). if( mFont == NULL ) loadFont(); // if (mBitmapName && mBitmapName[0] && dStricmp(mBitmapName, "texhandle") != 0 && !mTextureObject.set( mBitmapName, &GFXDefaultPersistentProfile, avar("%s() - mTextureObject (line %d)", __FUNCTION__, __LINE__) )) Con::errorf("Failed to load profile bitmap (%s)",mBitmapName); constructBitmapArray(); } mLoadCount ++; // Quick check to make sure our children profile is up-to-date getChildrenProfile(); }
void MainMenuDelegate::onNewContentControl(Control *, Control *newGui) { //CMDConsole* console = CMDConsole::getLocked(); curGui = newGui; //set the help control SimGui::Canvas *root; if (curGui) root = curGui->getCanvas(); if (root) { SimGui::HelpCtrl *hc = root->getHelpCtrl(); if (! hc) { FearGui::FGHelpCtrl *helpCtrl = new FearGui::FGHelpCtrl(); root->setHelpCtrl(helpCtrl); } } //set the version text SimGui::SimpleText *vc = dynamic_cast<SimGui::SimpleText*>(curGui->findControlWithTag(IDCTG_SRVR_INFO_VERSION)); if (vc) { vc->setText(avar("Version %s", FearVersion)); } }
GenOp* GBufferConditionerGLSL::_posnegDecode( GenOp *val ) { if(mNormalStorageType == LambertAzimuthal) return mCanWriteNegativeValues ? val : new GenOp(avar("(@ * %f - %f)", M_SQRT2_F * 2.0f, M_SQRT2_F), val); else return mCanWriteNegativeValues ? val : new GenOp("(@ * 2.0 - 1.0)", val); }
void GFXD3D9Device::logVertexBuffers() { // NOTE: This function should be called on the destructor of this class and ONLY then // otherwise it'll produce the wrong output if( mNumAllocatedVertexBuffers == 0 ) return; FileStream fs; fs.open( "vertexbuffer.log", Torque::FS::File::Write ); char buff[256]; fs.writeLine( (U8 *)avar("-- Vertex buffer memory leak report -- time = %d", Platform::getRealMilliseconds()) ); dSprintf( (char *)&buff, sizeof( buff ), "%d un-freed vertex buffers", mNumAllocatedVertexBuffers ); fs.writeLine( (U8 *)buff ); GFXD3D9VertexBuffer *walk = mVBListHead; while( walk != NULL ) { dSprintf( (char *)&buff, sizeof( buff ), "[Name: %s] Size: %d", walk->name, walk->mNumVerts ); fs.writeLine( (U8 *)buff ); walk = walk->next; } fs.writeLine( (U8 *)"-- End report --" ); fs.close(); }
//------------------------------------------------------------------------------ void Sky::load() { if (manager->isServer()) { // don't load sky resources in server setMaskBits(Modified); return; } unload(); if ( dmlName[0] ) { ResourceManager &rm = *SimResource::get(manager); // const char *filename = SimTagDictionary::getString(manager, matListTag); // load the material list from file hMaterialList = rm.load(dmlName); // don't want to bring down the mission editor, so if an invalid // dml is given, set the color to ugly AssertWarn((bool)hMaterialList, avar("Error reading materialList file \"%s\"", dmlName)); if ((bool)hMaterialList && hMaterialList->getMaterialsCount() > 0) { loaded = true; hMaterialList->load(rm, true); if (initialize() == false) addToSet(SimTimerSetId); } else // set ugly color if dml wasn't found set(ColorF(1.0f, 0.0f, 0.0f)); } setMaskBits(Modified); }
//================================================================ // NAME // GFXBitmapArray::read // // DESCRIPTION // // // ARGUMENTS // // // RETURNS // // // NOTES // //================================================================ Bool GFXBitmapArray::read(const char *in_filename, DWORD in_flags) { Bool result; HANDLE fileHandle; fileHandle = CreateFile(in_filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL ); if (fileHandle == INVALID_HANDLE_VALUE) { AssertWarn(0, avar("GFXBitmapArray::load: Unable to open file %s, CreateFile for reading failed.", in_filename)); return (FALSE); } FileRStream frs(fileHandle); result = read(&frs, in_flags); frs.close(); CloseHandle(fileHandle); return(result); }
bool ParticleData::reload(char errorBuffer[256]) { bool error = false; if (textureName && textureName[0]) { textureHandle = GFXTexHandle(textureName, &GFXDefaultStaticDiffuseProfile, avar("%s() - textureHandle (line %d)", __FUNCTION__, __LINE__)); if (!textureHandle) { dSprintf(errorBuffer, 256, "Missing particle texture: %s", textureName); error = true; } } /* numFrames = 0; for( int i=0; i<PDC_MAX_TEX; i++ ) { if( textureNameList[i] && textureNameList[i][0] ) { textureList[i] = TextureHandle( textureNameList[i], MeshTexture ); if (!textureList[i].getName()) { dSprintf(errorBuffer, 256, "Missing particle texture: %s", textureNameList[i]); error = true; } numFrames++; } } */ return !error; }
Var *ConditionerFeature::printMethodHeader( MethodType methodType, const String &methodName, Stream &stream, MultiLine *meta ) { Var *methodVar = new Var; methodVar->setName(methodName); DecOp *methodDecl = new DecOp(methodVar); const bool isCondition = (methodType == ConditionerFeature::ConditionMethod); Var *paramVar = new Var; paramVar->setName(avar("%sconditioned%sput", isCondition ? "un" : "", isCondition ? "Out" : "In")); DecOp *paramDecl = new DecOp(paramVar); if(GFX->getAdapterType() == OpenGL) { methodVar->setType("vec4"); paramVar->setType("vec4"); } else { methodVar->setType("inline float4"); paramVar->setType("in float4"); } // Method header and opening bracket meta->addStatement( new GenOp( "@(@)\r\n", methodDecl, paramDecl ) ); meta->addStatement( new GenOp( "{\r\n" ) ); return paramVar; }
void XMLExport::exportEntryTypes() { const char *typeNames [] = { "ScriptCallbackType", "GroupMarker", "OverloadMarker", "InvalidFunctionType", "ConsoleFunctionType", "StringCallbackType", "IntCallbackType", "FloatCallbackType", "VoidCallbackType", "BoolCallbackType" }; S32 typeIds [] = { Namespace::Entry::ScriptCallbackType, Namespace::Entry::GroupMarker, Namespace::Entry::InvalidFunctionType, Namespace::Entry::ConsoleFunctionType, Namespace::Entry::StringCallbackType, Namespace::Entry::IntCallbackType, Namespace::Entry::FloatCallbackType, Namespace::Entry::VoidCallbackType, Namespace::Entry::BoolCallbackType }; mXML->pushNewElement("EntryTypes"); S32 numElements = sizeof(typeIds) / sizeof ( S32); for (S32 i = 0; i < numElements; i++) { mXML->pushNewElement("EntryType"); mXML->setAttribute("name", typeNames[i]); mXML->setAttribute("id", avar("%i", typeIds[i])); mXML->popElement(); } mXML->popElement(); // EntryTypes }