void SpawnRandomProp(const dMatrix& location) const { NewtonWorld* const world = GetWorld(); DemoEntityManager* const scene = (DemoEntityManager*) NewtonWorldGetUserData(world); //scene->SetCurrent(); static PrimitiveType proSelection[] = {_SPHERE_PRIMITIVE, _BOX_PRIMITIVE, _CAPSULE_PRIMITIVE, _CYLINDER_PRIMITIVE, _CONE_PRIMITIVE, _CHAMFER_CYLINDER_PRIMITIVE, _RANDOM_CONVEX_HULL_PRIMITIVE, _REGULAR_CONVEX_HULL_PRIMITIVE}; PrimitiveType type = PrimitiveType (dRand() % (sizeof (proSelection) / sizeof (proSelection[0]))); dVector size (0.35f, 0.25f, 0.25f, 0.0f); NewtonCollision* const collision = CreateConvexCollision (world, dGetIdentityMatrix(), size, type, 0); DemoMesh* const geometry = new DemoMesh("prop", collision, "smilli.tga", "smilli.tga", "smilli.tga"); dMatrix matrix (location); matrix.m_posit.m_y += 0.5f; NewtonBody* const prop = CreateSimpleSolid (scene, geometry, 30.0f, matrix, collision, 0); NewtonDestroyCollision(collision); geometry->Release(); dFloat initialSpeed = 20.0f; dVector veloc (matrix.m_front.Scale (initialSpeed)); NewtonBodySetVelocity(prop, &veloc[0]); NewtonBodySetLinearDamping(prop, 0); }
void CoreSchema::initCoreSchema(Schema &schema) { assert (schema.size() == 0); schema.addPrimitiveType<char>("char"); // 0 schema.addPrimitiveType<int8>("int8"); // 1 schema.addPrimitiveType<int16>("int16"); // 2 schema.addPrimitiveType<int32>("int32"); // 3 schema.addPrimitiveType<int64>("int64"); // 4 schema.addPrimitiveType<uint8>("uint8"); // 5 schema.addPrimitiveType<uint16>("uint16"); // 6 schema.addPrimitiveType<uint32>("uint32"); // 7 schema.addPrimitiveType<uint64>("uint64"); // 8 schema.addPrimitiveType<float32>("float32"); // 9 schema.addPrimitiveType<float64>("float64"); // 10 schema.addPrimitiveType<RawPointer>("pointer"); // 11 schema.addPrimitiveType<RawPointer>("tagged_pointer"); // 12 schema << FieldType(); // 13 schema << Field(); // 14 schema << PrimitiveType(); // 15 schema << CustomType(); // 16 schema << Schema(); // 17 // FIRST_USER_TYPEID is 256 schema.setFreeTypeID(FIRST_USER_TYPEID); // from 0x000d to 0x00ff, the types are reserved // custom types should start from 0x0100 }
void ISymbol::MergeTypeInfo(ISymbolPtr c) { c->TypeName() = Name(); // Ignore, Name(), Namespace(), and Type() c->Abstract() = Abstract(); c->Atomic() = Atomic(); c->Attributes() = Attributes(); c->BaseTypeName() = BaseTypeName(); c->Compositor() = Compositor(); c->DerivedType() = DerivedType(); c->Enumerations() = Enumerations(); c->FacetKinds() = FacetKinds(); c->Facets() = Facets(); c->Global() = Global(); c->Level() = Level(); c->List() = List(); c->ListSize() = ListSize(); c->ListType() = ListType(); c->Optional() = Optional(); c->Parent() = Parent(); c->Parsed() = Parsed(); c->PrimitiveType() = PrimitiveType(); c->Required() = Required(); c->SimpleContent() = SimpleContent(); c->SimpleType() = SimpleType(); c->SqlCount() = SqlCount(); c->SqlType() = SqlType(); c->SubstitutionGroupAffiliation() = SubstitutionGroupAffiliation(); c->SubstitutionList() = SubstitutionList(); c->SubTypes() = SubTypes(); c->SuperTypes() = SuperTypes(); c->Variable() = Variable(); c->Visited() = Visited(); c->XercesType() = XercesType(); // These are element particle definitions // c->Dimension() = Dimension(); // always 1 //c->LowerBounds() = LowerBounds(); //c->UpperBounds() = UpperBounds(); //c->OuterElementName() = OuterElementName(); // c->OuterElementTypeName() = OuterElementTypeName(); }
void ISymbol::DeepCopy(ISymbolPtr c) { c->Name()=Name(); c->Abstract() = Abstract(); c->Atomic() = Atomic(); c->Attributes() = Attributes(); c->BaseTypeName() = BaseTypeName(); c->Compositor() = Compositor(); c->DerivedType() = DerivedType(); c->Dimension() = Dimension(); c->Enumerations() = Enumerations(); c->FacetKinds() = FacetKinds(); c->Facets() = Facets(); c->Global() = Global(); c->Level() = Level(); c->List() = List(); c->ListSize() = ListSize(); c->ListType() = ListType(); c->LowerBounds() = LowerBounds(); c->Namespace() = Namespace(); c->Optional() = Optional(); c->OuterElementName() = OuterElementName(); c->OuterElementTypeName() = OuterElementTypeName(); c->Parent() = Parent(); c->Parsed() = Parsed(); c->PrimitiveType() = PrimitiveType(); c->Required() = Required(); c->SimpleContent() = SimpleContent(); c->SimpleType() = SimpleType(); c->SqlCount() = SqlCount(); c->SqlType() = SqlType(); c->SubstitutionGroupAffiliation() = SubstitutionGroupAffiliation(); c->SubstitutionList() = SubstitutionList(); c->SubTypes() = SubTypes(); c->SuperTypes() = SuperTypes(); c->Type() = Type(); c->TypeName() = TypeName(); c->UpperBounds() = UpperBounds(); c->Variable() = Variable(); c->Visited() = Visited(); c->XercesType() = XercesType(); }
bool ArrayMesh::_set(const StringName &p_name, const Variant &p_value) { String sname = p_name; if (p_name == "blend_shape/names") { PoolVector<String> sk = p_value; int sz = sk.size(); PoolVector<String>::Read r = sk.read(); for (int i = 0; i < sz; i++) add_blend_shape(r[i]); return true; } if (p_name == "blend_shape/mode") { set_blend_shape_mode(BlendShapeMode(int(p_value))); return true; } if (sname.begins_with("surface_")) { int sl = sname.find("/"); if (sl == -1) return false; int idx = sname.substr(8, sl - 8).to_int() - 1; String what = sname.get_slicec('/', 1); if (what == "material") surface_set_material(idx, p_value); else if (what == "name") surface_set_name(idx, p_value); return true; } if (!sname.begins_with("surfaces")) return false; int idx = sname.get_slicec('/', 1).to_int(); String what = sname.get_slicec('/', 2); if (idx == surfaces.size()) { //create Dictionary d = p_value; ERR_FAIL_COND_V(!d.has("primitive"), false); if (d.has("arrays")) { //old format ERR_FAIL_COND_V(!d.has("morph_arrays"), false); add_surface_from_arrays(PrimitiveType(int(d["primitive"])), d["arrays"], d["morph_arrays"]); } else if (d.has("array_data")) { PoolVector<uint8_t> array_data = d["array_data"]; PoolVector<uint8_t> array_index_data; if (d.has("array_index_data")) array_index_data = d["array_index_data"]; ERR_FAIL_COND_V(!d.has("format"), false); uint32_t format = d["format"]; uint32_t primitive = d["primitive"]; ERR_FAIL_COND_V(!d.has("vertex_count"), false); int vertex_count = d["vertex_count"]; int index_count = 0; if (d.has("index_count")) index_count = d["index_count"]; Vector<PoolVector<uint8_t> > blend_shapes; if (d.has("blend_shape_data")) { Array blend_shape_data = d["blend_shape_data"]; for (int i = 0; i < blend_shape_data.size(); i++) { PoolVector<uint8_t> shape = blend_shape_data[i]; blend_shapes.push_back(shape); } } ERR_FAIL_COND_V(!d.has("aabb"), false); AABB aabb = d["aabb"]; Vector<AABB> bone_aabb; if (d.has("skeleton_aabb")) { Array baabb = d["skeleton_aabb"]; bone_aabb.resize(baabb.size()); for (int i = 0; i < baabb.size(); i++) { bone_aabb[i] = baabb[i]; } } add_surface(format, PrimitiveType(primitive), array_data, vertex_count, array_index_data, index_count, aabb, blend_shapes, bone_aabb); } else { ERR_FAIL_V(false); } if (d.has("material")) { surface_set_material(idx, d["material"]); } if (d.has("name")) { surface_set_name(idx, d["name"]); } return true; } return false; }
bool Mesh::_set(const StringName& p_name, const Variant& p_value) { String sname=p_name; if (p_name=="morph_target/names") { DVector<String> sk=p_value; int sz = sk.size(); DVector<String>::Read r = sk.read(); for(int i=0;i<sz;i++) add_morph_target(r[i]); return true; } if (p_name=="morph_target/mode") { set_morph_target_mode(MorphTargetMode(int(p_value))); return true; } if (sname.begins_with("surface_")) { int sl=sname.find("/"); if (sl==-1) return false; int idx=sname.substr(8,sl-8).to_int()-1; String what = sname.get_slice("/",1); if (what=="material") surface_set_material(idx,p_value); else if (what=="name") surface_set_name(idx,p_value); return true; } if (sname=="custom_aabb/custom_aabb") { set_custom_aabb(p_value); return true; } if (!sname.begins_with("surfaces")) return false; int idx=sname.get_slice("/",1).to_int(); String what=sname.get_slice("/",2); if (idx==surfaces.size()) { if (what=="custom") { add_custom_surface(p_value); return true; } //create Dictionary d=p_value; ERR_FAIL_COND_V(!d.has("primitive"),false); ERR_FAIL_COND_V(!d.has("arrays"),false); ERR_FAIL_COND_V(!d.has("morph_arrays"),false); bool alphasort = d.has("alphasort") && bool(d["alphasort"]); add_surface(PrimitiveType(int(d["primitive"])),d["arrays"],d["morph_arrays"],alphasort); if (d.has("material")) { surface_set_material(idx,d["material"]); } if (d.has("name")) { surface_set_name(idx,d["name"]); } return true; } if (what=="custom_aabb") { surface_set_custom_aabb(idx,p_value); return true; } return false; }