TSShape* TSShapeLoader::generateShape(const Torque::Path& path) { shapePath = path; shape = new TSShape(); shape->mExporterVersion = 124; shape->mSmallestVisibleSize = 999999; shape->mSmallestVisibleDL = 0; shape->mReadVersion = 24; shape->mFlags = 0; shape->mSequencesConstructed = 0; // Get all nodes, objects and sequences in the shape updateProgress(Load_EnumerateScene, "Enumerating scene..."); enumerateScene(); if (!subshapes.size()) { delete shape; Con::errorf("Failed to load shape \"%s\", no subshapes found", path.getFullPath().c_str()); return NULL; } // Create the TSShape::Node hierarchy generateSubshapes(); // Create objects (meshes and details) generateObjects(); // Generate initial object states and node transforms generateDefaultStates(); // Generate skins generateSkins(); // Generate material list generateMaterialList(); // Generate animation sequences generateSequences(); // Sort detail levels and meshes updateProgress(Load_InitShape, "Initialising shape..."); sortDetails(); // Install the TS memory helper into a TSShape object. install(); return shape; }
bool CompilGenerator::generate() { generateObject(mDocument->mainFile()); generateObjects(mDocument->objects()); return serializeStreams(); }
void CompilGenerator::generateObject(const ObjectSPtr& pObject) { switch (pObject->runtimeObjectId().value()) { case EObjectId::kImport: { ImportSPtr pImport = boost::static_pointer_cast<Import>(pObject); generateImport(pImport); break; } case EObjectId::kEnumeration: { EnumerationSPtr pEnumeration = boost::static_pointer_cast<Enumeration>(pObject); generateEnumerationPrefix(pEnumeration); const std::vector<EnumerationValueSPtr>& enumerationValues = pEnumeration->enumerationValues(); std::vector<EnumerationValueSPtr>::const_iterator it; for (it = enumerationValues.begin(); it != enumerationValues.end(); ++it) { generateEnumerationValuePrefix(*it); generateEnumerationValueSuffix(*it); } generateEnumerationSuffix(pEnumeration); break; } case EObjectId::kSpecimen: { SpecimenSPtr pSpecimen = boost::static_pointer_cast<Specimen>(pObject); generateSpecimenPrefix(pSpecimen); generateSpecimenSuffix(pSpecimen); break; } case EObjectId::kFactory: { FactorySPtr pFactory = boost::static_pointer_cast<Factory>(pObject); generateFactoryPrefix(pFactory); generateFactorySuffix(pFactory); break; } case EObjectId::kFile: { FileSPtr file = boost::static_pointer_cast<File>(pObject); generateFile(file); break; } case EObjectId::kStructure: { StructureSPtr pStructure = boost::static_pointer_cast<Structure>(pObject); generateStructurePrefix(pStructure); generateObjects(pStructure->objects()); generateStructureSuffix(pStructure); break; } case EObjectId::kAlter: break; case EObjectId::kField: { FieldSPtr pField = boost::static_pointer_cast<Field>(pObject); generateFieldPrefix(pField); generateFieldSuffix(pField); break; } case EObjectId::kIdentification: { IdentificationSPtr pIdentification = boost::static_pointer_cast<Identification>(pObject); generateIdentificationPrefix(pIdentification); generateIdentificationSuffix(pIdentification); break; } case EObjectId::kInterface: { InterfaceSPtr pInterface = boost::static_pointer_cast<Interface>(pObject); generateInterfacePrefix(pInterface); generateObjects(pInterface->objects()); generateInterfaceSuffix(pInterface); break; } case EObjectId::kMethod: { MethodSPtr pMethod = boost::static_pointer_cast<Method>(pObject); generateMethodPrefix(pMethod); generateObjects(pMethod->objects()); generateMethodSuffix(pMethod); break; } case EObjectId::kParameter: { ParameterSPtr pParameter = boost::static_pointer_cast<Parameter>(pObject); generateParameterPrefix(pParameter); generateParameterSuffix(pParameter); break; } default: assert(false); } }