Example #1
0
		RID MeshBufferParser::parse(JSONReader& reader, int childIndex) {
			MeshBufferDescriptor descriptor;
			reader.get(childIndex, "size", &descriptor.size);
			const char* indexBufferName = reader.get_string(childIndex, "index_buffer");
			descriptor.indexBuffer = find(indexBufferName, ResourceType::INDEXBUFFER);
			const char* constantBufferName = reader.get_string(childIndex, "constant_buffer");
			descriptor.constantBuffer = find(constantBufferName, ResourceType::CONSTANTBUFFER);
			const char* vertexBufferName = reader.get_string(childIndex, "vertex_buffer");
			descriptor.vertexBuffer = find(vertexBufferName, ResourceType::VERTEXBUFFER);
			const char* materialName = reader.get_string(childIndex, "material");
			descriptor.material = find(materialName, ResourceType::MATERIAL);
			const char* name = reader.get_string(childIndex, "name");
			return createMeshBuffer(name, descriptor);
		}
Example #2
0
		RID BlendStateParser::parse(JSONReader& reader, int childIndex) {
			BlendStateDescriptor descriptor;
			const char* entry = reader.get_string(childIndex, "src_blend");
			descriptor.srcBlend = findBlendStateMapping(entry);
			entry = reader.get_string(childIndex, "dest_blend");
			descriptor.destBlend = findBlendStateMapping(entry);
			entry = reader.get_string(childIndex, "src_blend_alpha");
			descriptor.srcAlphaBlend = findBlendStateMapping(entry);
			entry = reader.get_string(childIndex, "dest_blend_alpha");
			descriptor.destAlphaBlend = findBlendStateMapping(entry);
			reader.get(childIndex, "alpha_enabled", &descriptor.alphaEnabled);
			const char* name = reader.get_string(childIndex, "name");
			return createBlendState(name, descriptor);
		}
Example #3
0
	bool SpriteSheet::loadData(const JSONReader& loader) {
		int categories[256];
		int num = loader.get_categories(categories, 256);
		for (int i = 0; i < num; ++i) {
			Rect r;
			loader.get(categories[i], "rect", &r);
			const char* sn = loader.get_string(categories[i], "name");
			add(sn, r);
		}
		return true;
	}
Example #4
0
	bool SpriteSheet::reloadData(const JSONReader& loader) {
		int categories[256];
		int num = loader.get_categories(categories, 256);
		for (int i = 0; i < num; ++i) {
			Rect r;
			loader.get(categories[i], "rect", &r);
			const char* sn = loader.get_string(categories[i], "name");
			int idx = findIndex(sn);
			if (idx == -1) {
				add(sn, r);
			}
			else {
				SheetEntry& se = _entries[idx];
				se.texture = Texture(r);
			}
		}
		return true;
	}
Example #5
0
		RID IndexBufferParser::parse(JSONReader& reader, int childIndex) {
			IndexBufferDescriptor descriptor;
			reader.get(childIndex, "size", &descriptor.size);
			const char* name = reader.get_string(childIndex, "name");
			return createIndexBuffer(name, descriptor);
		}
Example #6
0
		RID ParticleManagerParser::parse(JSONReader& reader, int childIndex) {
			ParticleSystemsDescriptor descriptor;
			reader.get(childIndex, "sprite_buffer", &descriptor.spriteBuffer);
			const char* name = reader.get_string(childIndex, "name");
			return createParticleManager(descriptor);
		}