[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [20925] branches/soc-2009-chingachgook/ source/blender/collada/DocumentExporter.cpp: Exporter applies the first image in the scene to all objects which have
Chingiz Dyussenov
chingiz.ds at gmail.com
Tue Jun 16 10:58:33 CEST 2009
Revision: 20925
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20925
Author: chingachgook
Date: 2009-06-16 10:58:33 +0200 (Tue, 16 Jun 2009)
Log Message:
-----------
Exporter applies the first image in the scene to all objects which have
uv coordinates.
Modified Paths:
--------------
branches/soc-2009-chingachgook/source/blender/collada/DocumentExporter.cpp
Modified: branches/soc-2009-chingachgook/source/blender/collada/DocumentExporter.cpp
===================================================================
--- branches/soc-2009-chingachgook/source/blender/collada/DocumentExporter.cpp 2009-06-16 08:54:38 UTC (rev 20924)
+++ branches/soc-2009-chingachgook/source/blender/collada/DocumentExporter.cpp 2009-06-16 08:58:33 UTC (rev 20925)
@@ -113,7 +113,7 @@
if (checkTexcoords == true)
{
COLLADASW::Input input4(COLLADASW::TEXCOORD,
- getUrlBySemantics(geom_name, COLLADASW::TEXCOORD), 1);
+ getUrlBySemantics(geom_name, COLLADASW::TEXCOORD), 1, 1);
til.push_back(input4);
//XXX
tris.setMaterial("material-symbol");
@@ -377,12 +377,12 @@
void exportScene(Scene *sce) {
//<library_visual_scenes><visual_scene>
openVisualScene(sce->id.name, "");
-
+
//<node> for each mesh object
Base *base= (Base*) sce->base.first;
while(base) {
Object *ob = base->object;
-
+
if (ob->type == OB_MESH && ob->data) {
COLLADASW::Node node(mSW);
node.start();
@@ -396,15 +396,20 @@
instGeom.setUrl(COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING,
ob_name));
//XXX hardcoded
- /*COLLADASW::BindMaterial bm(mSW);
+ Image *image = (Image*)G.main->image.first;
+
+ COLLADASW::BindMaterial& bm = instGeom.getBindMaterial();
COLLADASW::InstanceMaterialList& iml = bm.getInstanceMaterialList();
- std::string matid = "material";
+
+ std::string matid = std::string(image->id.name) + "-material";
COLLADASW::InstanceMaterial im("material-symbol", COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, matid));
+ COLLADASW::BindVertexInput bvi("myUVs", "TEXCOORD", 1);
+ im.push_back(bvi);
iml.push_back(im);
- instGeom.getBindMaterial() = bm;*/
+
+ //
+ instGeom.add();
- instGeom.add();
-
node.end();
}
base= base->next;
@@ -418,7 +423,7 @@
};
/*----------------------------------------------------------*/
-//class for exporting textures
+//class for exporting images
class ImagesExporter: COLLADASW::LibraryImages
{
public:
@@ -464,7 +469,7 @@
ep.openProfile();
//<newparam> <surface> <init_from>
- COLLADASW::Surface surface(COLLADASW::Surface::SURFACE_TYPE_2D);
+ COLLADASW::Surface surface(COLLADASW::Surface::SURFACE_TYPE_2D, image->id.name + COLLADASW::Surface::SURFACE_SID_SUFFIX);
COLLADASW::SurfaceInitOption sio(COLLADASW::SurfaceInitOption::INIT_FROM);
sio.setImageReference(image->id.name);
surface.setInitOption(sio);
@@ -474,7 +479,7 @@
//<lambert> <diffuse> <texture>
COLLADASW::Texture texture(image->id.name);
- texture.setTexcoord("myUVS");
+ texture.setTexcoord("myUVs");
texture.setSurface(surface);
texture.setSampler(sampler);
More information about the Bf-blender-cvs
mailing list