本文整理汇总了C++中utArray类的典型用法代码示例。如果您正苦于以下问题:C++ utArray类的具体用法?C++ utArray怎么用?C++ utArray使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了utArray类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: finalizeAssemblyLoad
void LSLuaState::finalizeAssemblyLoad(Assembly *assembly, utArray<Type *>& types)
{
for (UTsize j = 0; j < types.size(); j++)
{
Type *type = types.at(j);
if (type->isNative() || type->hasStaticNativeMember())
{
// we're native
NativeInterface::resolveScriptType(type);
}
}
declareLuaTypes(types);
initializeLuaTypes(types);
// we avoid runtime validation on mobile, this works but should be unnecessary
// as issues with be caught on OSX/WINDOWS development platforms
#if LOOM_PLATFORM == LOOM_PLATFORM_OSX || LOOM_PLATFORM == LOOM_PLATFORM_WIN32
for (UTsize j = 0; j < types.size(); j++)
{
Type *type = types.at(j);
TypeValidatorRT tv(this, type);
tv.validate();
}
#endif
assembly->bootstrap();
}
示例2: initializeLuaTypes
void LSLuaState::initializeLuaTypes(const utArray<Type *>& types)
{
for (UTsize i = 0; i < types.size(); i++)
{
types[i]->cache();
}
// initialize all classes
for (UTsize i = 0; i < types.size(); i++)
{
initializeClass(types[i]);
}
// run static initializers now that all classes have been initialized
for (UTsize i = 0; i < types.size(); i++)
{
lsr_classinitializestatic(VM(), types[i]);
}
}
示例3: akMeshLoaderUtils_getVertexGroups
void akMeshLoaderUtils_getVertexGroups(Blender::Mesh* bmesh, Blender::Object* bobj, utArray<utString>& vgroups)
{
if(bmesh->dvert)
{
Blender::bDeformGroup* dg = (Blender::bDeformGroup*)bobj->defbase.first;
while(dg)
{
vgroups.push_back(dg->name);
dg = dg->next;
}
}
}
示例4: findMembers
void Type::findMembers(const MemberTypes& memberTypes,
utArray<MemberInfo *>& membersOut, bool includeBases, bool includePropertyGetterSetters)
{
if (!includeBases)
{
membersOut.clear();
}
for (size_t i = 0; i < members.size(); i++)
{
MemberInfo *m = members.at((int)i);
if (m->isConstructor() && memberTypes.constructor)
{
membersOut.push_back(m);
}
if (m->isMethod() && memberTypes.method)
{
membersOut.push_back(m);
}
if (m->isField() && memberTypes.field)
{
membersOut.push_back(m);
}
if (m->isProperty() && memberTypes.property)
{
membersOut.push_back(m);
if (includePropertyGetterSetters)
{
PropertyInfo *p = (PropertyInfo *)m;
if (p->getter && (p->getter->getDeclaringType() == p->getDeclaringType()))
{
membersOut.push_back(p->getter);
}
if (p->setter && (p->setter->getDeclaringType() == p->getDeclaringType()))
{
membersOut.push_back(p->setter);
}
}
}
}
if (baseType && includeBases)
{
baseType->findMembers(memberTypes, membersOut, true, includePropertyGetterSetters);
}
}
示例5: declareLuaTypes
void LSLuaState::declareLuaTypes(const utArray<Type *>& types)
{
for (UTsize i = 0; i < types.size(); i++)
{
declareClass(types[i]);
}
// validate/initialize native types
for (UTsize i = 0; i < types.size(); i++)
{
Type *type = types.at(i);
if (type->isNative() || type->hasStaticNativeMember())
{
NativeTypeBase *ntb = NativeInterface::getNativeType(type);
if (!ntb)
{
LSError("Unable to get NativeTypeBase for type %s", type->getFullName().c_str());
}
if (type->isNativeManaged() != ntb->isManaged())
{
if (type->isNativeManaged())
{
LSError("Managed mismatch for type %s, script declaration specifies native while native bindings are unmanaged", type->getFullName().c_str());
}
else
{
LSError("Managed mismatch for type %s, script declaration specifies unmanaged while native bindings are managed", type->getFullName().c_str());
}
}
ntb->validate(type);
type->setCTypeName(ntb->getCTypeName());
}
}
}
示例6: akMeshLoaderUtils_getSmoothFaces
void akMeshLoaderUtils_getSmoothFaces(Blender::Mesh* bmesh, utArray<utArray<UTuint32> >& faces)
{
faces.resize(bmesh->totvert);
for (int i = 0; i< bmesh->totvert; i++)
{
for (int j = 0; j< bmesh->totface; j++)
{
const Blender::MFace& bface = bmesh->mface[j];
if( (bface.flag & ME_SMOOTH) &&
(bface.v1 == i ||
bface.v2 == i ||
bface.v3 == i ||
bface.v4 == i ))
{
faces[i].push_back(j);
}
}
}
}
示例7: postAllFiles
/**
* Post all known files to all clients, or if specified, a single client.
*
* Useful for fully synching client with the current asset state.
*
* TODO: Optimize to use hashes to only transmit modified data, based on
* client's starting assets.
*/
static void postAllFiles(int clientId = -1)
{
lmLog(gAssetAgentLogGroup, "Queueing all files for client %d.", clientId);
loom_mutex_lock(gFileScannerLock);
// Walk all the files.
utArray<FileEntry> *list = lmNew(NULL) utArray<FileEntry>();
platform_walkFiles(".", handleFileStateWalkCallback, list);
// Queue them all to be sent.
for (UTsize i = 0; i < list->size(); i++)
{
FileModificationNote note;
note.path = stringtable_insert((*list)[i].path.c_str());
note.lastSeenTime = 0;
note.onlyForClient = clientId;
gPendingModifications.push_back(note);
}
loom_mutex_unlock(gFileScannerLock);
}
示例8: akMeshLoaderUtils_getShapeKeysNormals
void akMeshLoaderUtils_getShapeKeysNormals(Blender::Mesh* bmesh, UTuint32 numshape, utArray<btAlignedObjectArray<akVector3> >& shapenormals)
{
Blender::Key* bk = bmesh->key;
if(bk)
{
shapenormals.resize(numshape);
Blender::KeyBlock* bkb = (Blender::KeyBlock*)bk->block.first;
// skip first shape key (basis)
UTuint32 shape=0;
if(bkb) bkb = bkb->next;
while(bkb)
{
if(bkb->type == KEY_RELATIVE)
{
Blender::KeyBlock* basis = (Blender::KeyBlock*)bk->block.first;
for(int i=0; basis && i<bkb->relative; i++)
basis = basis->next;
if(basis)
{
float* pos = (float*)bkb->data;
shapenormals[shape].resize(bmesh->totface);
for(int i=0; i<bmesh->totface; i++)
{
const Blender::MFace& bface = bmesh->mface[i];
akVector3 normal = akMeshLoaderUtils_calcMorphNormal(bface, pos);
shapenormals[shape][i]=normal;
}
shape++;
}
}
bkb = bkb->next;
}
}
}
示例9: akMeshLoaderUtils_getShapeKeys
void akMeshLoaderUtils_getShapeKeys(Blender::Mesh* bmesh, utArray<utString>& shapes)
{
Blender::Key* bk = bmesh->key;
if(bk)
{
Blender::KeyBlock* bkb = (Blender::KeyBlock*)bk->block.first;
// skip first shape key (basis)
if(bkb) bkb = bkb->next;
while(bkb)
{
if(bkb->type == KEY_RELATIVE)
{
Blender::KeyBlock* basis = (Blender::KeyBlock*)bk->block.first;
for(int i=0; basis && i<bkb->relative; i++)
basis = basis->next;
if(basis)
shapes.push_back(bkb->name);
}
bkb = bkb->next;
}
}
}
示例10: assetAgent_command
void DLLEXPORT assetAgent_command(const char *cmd)
{
if (strstr(cmd, ".sendall") != 0)
{
postAllFiles();
}
else if (strstr(cmd, ".clients") != 0)
{
listClients();
}
else if (strstr(cmd, ".telemetry") != 0)
{
TelemetryServer::isRunning() ? TelemetryServer::stop() : TelemetryServer::start();
assetAgent_command(TelemetryServer::isRunning() ? "telemetryEnable" : "telemetryDisable");
}
else if (cmd[0] != 0)
{
loom_mutex_lock(gActiveSocketsMutex);
if (gActiveHandlers.size() == 0)
{
if (strcmp(cmd, "terminate") != 0) sendIgnoredError();
}
for (UTsize i = 0; i < gActiveHandlers.size(); i++)
{
gActiveHandlers[i]->sendCommand(cmd);
}
loom_mutex_unlock(gActiveSocketsMutex);
}
}
示例11: loom_asset_pump
void loom_asset_pump()
{
// Currently we only want to do this on the main thread so piggy back on the
// native delegate sanity check to bail if on secondary thread.
if(platform_getCurrentThreadId() != LS::NativeDelegate::smMainThreadID && LS::NativeDelegate::smMainThreadID != 0xBAADF00D)
return;
loom_mutex_lock(gAssetLock);
// Talk to the asset server.
loom_asset_serviceServer();
// For now just blast all the data from each file into the asset.
while(gAssetLoadQueue.size())
{
loom_asset_t *asset = gAssetLoadQueue.front();
// Figure out the type from the path.
utString path = asset->name;
int type = loom_asset_recognizeAssetTypeFromPath(path);
if(type == 0)
{
lmLog(gAssetLogGroup, "Could not infer type of resource '%s', skipping it...", path.c_str());
asset->state = loom_asset_t::Unloaded;
gAssetLoadQueue.erase((UTsize)0, true);
continue;
}
// Open the file.
void *ptr;
long size;
if(!platform_mapFile(asset->name.c_str(), &ptr, &size))
{
lmAssert(false, "Could not open file '%s'.", asset->name.c_str());
}
// Deserialize it.
LoomAssetCleanupCallback dtor = NULL;
void *assetBits = loom_asset_deserializeAsset(path, type, size, ptr, &dtor);
// Close the file.
platform_unmapFile(ptr);
// Instate the asset.
asset->instate(type, assetBits, dtor);
// Done! Update queue.
gAssetLoadQueue.erase((UTsize)0, true);
}
loom_mutex_unlock(gAssetLock);
}
示例12: loom_asset_registerType
void loom_asset_registerType(unsigned int type, LoomAssetDeserializeCallback deserializer, LoomAssetRecognizerCallback recognizer)
{
lmAssert(gAssetDeserializerMap.find(type) == UT_NPOS, "Asset type already registered!");
gAssetDeserializerMap.insert(type, deserializer);
gRecognizerList.push_back(recognizer);
}
示例13: loom_asset_initialize
void loom_asset_initialize(const char *rootUri)
{
// Set up the lock for the mutex.
lmAssert(gAssetLock == NULL, "Double initialization!");
gAssetLock = loom_mutex_create();
// Note the CWD.
char tmpBuff[1024];
platform_getCurrentWorkingDir(tmpBuff, 1024);
lmLog(gAssetLogGroup, "Current working directory ='%s'", tmpBuff);
// And the allocator.
//gAssetAllocator = loom_allocator_initializeTrackerProxyAllocator(loom_allocator_getGlobalHeap());
gAssetAllocator = (loom_allocator_getGlobalHeap());
// Clear, it might have been filled up before (for unit tests)
gAssetLoadQueue.clear();
gAssetHash.clear();
// Asset server connection state.
gAssetServerSocketLock = loom_mutex_create();
// And set up some default asset types.
loom_asset_registerType(LATText, loom_asset_textDeserializer, loom_asset_textRecognizer);
loom_asset_registerType(LATBinary, loom_asset_binaryDeserializer, loom_asset_binaryRecognizer);
loom_asset_registerImageAsset();
loom_asset_registerSoundAsset();
loom_asset_registerScriptAsset();
// Listen to log and send it if we have a connection.
loom_log_addListener(loom_asset_logListener, NULL);
}
示例14: loom_asset_reload
void loom_asset_reload(const char *name)
{
loom_mutex_lock(gAssetLock);
loom_asset_t *asset = loom_asset_getAssetByName(name, 1);
// Put it in the queue, this will trigger a new blob to be loaded.
gAssetLoadQueue.push_back(asset);
loom_mutex_unlock(gAssetLock);
}
示例15: loom_asset_shutdown
void loom_asset_shutdown()
{
loom_asset_flushAll();
// Clear out our queues and maps.
gAssetDeserializerMap.clear();
gRecognizerList.clear();
lmAssert(gAssetLock != NULL, "Shutdown without being initialized!");
loom_mutex_destroy(gAssetLock);
gAssetLock = NULL;
}