#!/usr/bin/env python print 'Not implemented yet' #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include # typedef std.vector< osg.ref_ptr > ImageList # example ReadOperator # struct ReadOperator # { # inline void luminance(float l) const { rgba(l,l,l,1.0); } # inline void alpha(float a) const { rgba(1.0,1.0,1.0,a); } # inline void luminance_alpha(float l,float a) const { rgba(l,l,l,a); } # inline void rgb(float r,float g,float b) const { rgba(r,g,b,1.0); } # inline void rgba(float r,float g,float b,float a) const { std.cout<<"pixel("< void readImage(osg.Image* image, const O& operation) { if (!image) return for(int r=0;r void _modifyRow(unsigned int num, GLenum pixelFormat, T* data,float scale, const M& operation) { float inv_scale = 1.0/scale switch(pixelFormat) { case(GL_LUMINANCE): { for(unsigned int i=0;i void modifyRow(unsigned int num, GLenum pixelFormat, GLenum dataType, unsigned char* data, const M& operation) { switch(dataType) { case(GL_BYTE): _modifyRow(num,pixelFormat, (char*)data, 1.0/128.0, operation); break case(GL_UNSIGNED_BYTE): _modifyRow(num,pixelFormat, (unsigned char*)data, 1.0/255.0, operation); break case(GL_SHORT): _modifyRow(num,pixelFormat, (short*) data, 1.0/32768.0, operation); break case(GL_UNSIGNED_SHORT): _modifyRow(num,pixelFormat, (unsigned short*)data, 1.0/65535.0, operation); break case(GL_INT): _modifyRow(num,pixelFormat, (int*) data, 1.0/2147483648.0, operation); break case(GL_UNSIGNED_INT): _modifyRow(num,pixelFormat, (unsigned int*) data, 1.0/4294967295.0, operation); break case(GL_FLOAT): _modifyRow(num,pixelFormat, (float*) data, 1.0, operation); break } } template void modifyImage(osg.Image* image, const M& operation) { if (!image) return for(int r=0;r normalmap_3d = new osg.Image normalmap_3d.allocateImage(image_3d.s(),image_3d.t(),image_3d.r(), GL_RGBA,GL_UNSIGNED_BYTE) if (osg.getCpuByteOrder()==osg.LittleEndian) alphaOffset = sourcePixelIncrement-alphaOffset-1 for(int r=1;r& image_3d, osg.ref_ptr& normalmap_3d, osg.Texture.InternalFormatMode internalFormatMode, float xSize, float ySize, float zSize, float xMultiplier, float yMultiplier, float zMultiplier, unsigned int numSlices=500, float sliceEnd=1.0, float alphaFuncValue=0.02) { bool two_pass = normalmap_3d.valid() && (image_3d.getPixelFormat()==GL_RGB || image_3d.getPixelFormat()==GL_RGBA) osg.Group* group = new osg.Group osg.TexGenNode* texgenNode_0 = new osg.TexGenNode texgenNode_0.setTextureUnit(0) texgenNode_0.getTexGen().setMode(osg.TexGen.EYE_LINEAR) texgenNode_0.getTexGen().setPlane(osg.TexGen.S, osg.Vec4(xMultiplier,0.0,0.0,0.5)) texgenNode_0.getTexGen().setPlane(osg.TexGen.T, osg.Vec4(0.0,yMultiplier,0.0,0.5)) texgenNode_0.getTexGen().setPlane(osg.TexGen.R, osg.Vec4(0.0,0.0,zMultiplier,0.5)) if (two_pass) { osg.TexGenNode* texgenNode_1 = new osg.TexGenNode texgenNode_1.setTextureUnit(1) texgenNode_1.getTexGen().setMode(osg.TexGen.EYE_LINEAR) texgenNode_1.getTexGen().setPlane(osg.TexGen.S, texgenNode_0.getTexGen().getPlane(osg.TexGen.S)) texgenNode_1.getTexGen().setPlane(osg.TexGen.T, texgenNode_0.getTexGen().getPlane(osg.TexGen.T)) texgenNode_1.getTexGen().setPlane(osg.TexGen.R, texgenNode_0.getTexGen().getPlane(osg.TexGen.R)) texgenNode_1.addChild(texgenNode_0) group.addChild(texgenNode_1) } else { group.addChild(texgenNode_0) } osg.BoundingBox bb(-xSize*0.5,-ySize*0.5,-zSize*0.5,xSize*0.5,ySize*0.5,zSize*0.5) osg.ClipNode* clipnode = new osg.ClipNode clipnode.addChild(createCube(1.0,1.0, numSlices,sliceEnd)) clipnode.createClipBox(bb) { # set up the Geometry to enclose the clip volume to prevent near/far clipping from affecting billboard osg.Geometry* geom = new osg.Geometry osg.Vec3Array* coords = new osg.Vec3Array() coords.push_back(bb.corner(0)) coords.push_back(bb.corner(1)) coords.push_back(bb.corner(2)) coords.push_back(bb.corner(3)) coords.push_back(bb.corner(4)) coords.push_back(bb.corner(5)) coords.push_back(bb.corner(6)) coords.push_back(bb.corner(7)) geom.setVertexArray(coords) osg.Vec4Array* colors = new osg.Vec4Array(1) (*colors)[0].set(1.0,1.0,1.0,1.0) geom.setColorArray(colors) geom.setColorBinding(osg.Geometry.BIND_OVERALL) geom.addPrimitiveSet(new osg.DrawArrays(osg.PrimitiveSet.POINTS,0,coords.size())) osg.Geode* geode = new osg.Geode geode.addDrawable(geom) clipnode.addChild(geode) } texgenNode_0.addChild(clipnode) osg.StateSet* stateset = texgenNode_0.getOrCreateStateSet() stateset.setMode(GL_LIGHTING,osg.StateAttribute.ON) stateset.setMode(GL_BLEND,osg.StateAttribute.ON) stateset.setAttribute(new osg.AlphaFunc(osg.AlphaFunc.GREATER,alphaFuncValue)) osg.Material* material = new osg.Material material.setDiffuse(osg.Material.FRONT_AND_BACK,osg.Vec4(1.0,1.0,1.0,1.0)) stateset.setAttributeAndModes(material) osg.Vec3 lightDirection(1.0,-1.0,1.0) lightDirection.normalize() if (normalmap_3d.valid()) { if (two_pass) { # set up normal texture osg.Texture3D* bump_texture3D = new osg.Texture3D bump_texture3D.setFilter(osg.Texture3D.MIN_FILTER,osg.Texture3D.LINEAR) bump_texture3D.setFilter(osg.Texture3D.MAG_FILTER,osg.Texture3D.LINEAR) bump_texture3D.setWrap(osg.Texture3D.WRAP_R,osg.Texture3D.CLAMP) bump_texture3D.setWrap(osg.Texture3D.WRAP_S,osg.Texture3D.CLAMP) bump_texture3D.setWrap(osg.Texture3D.WRAP_T,osg.Texture3D.CLAMP) bump_texture3D.setImage(normalmap_3d.get()) bump_texture3D.setInternalFormatMode(internalFormatMode) stateset.setTextureAttributeAndModes(0,bump_texture3D,osg.StateAttribute.ON) osg.TexEnvCombine* tec = new osg.TexEnvCombine tec.setConstantColorAsLightDirection(lightDirection) tec.setCombine_RGB(osg.TexEnvCombine.DOT3_RGB) tec.setSource0_RGB(osg.TexEnvCombine.CONSTANT) tec.setOperand0_RGB(osg.TexEnvCombine.SRC_COLOR) tec.setSource1_RGB(osg.TexEnvCombine.TEXTURE) tec.setOperand1_RGB(osg.TexEnvCombine.SRC_COLOR) tec.setCombine_Alpha(osg.TexEnvCombine.REPLACE) tec.setSource0_Alpha(osg.TexEnvCombine.PRIMARY_COLOR) tec.setOperand0_Alpha(osg.TexEnvCombine.SRC_ALPHA) tec.setSource1_Alpha(osg.TexEnvCombine.TEXTURE) tec.setOperand1_Alpha(osg.TexEnvCombine.SRC_ALPHA) stateset.setTextureAttributeAndModes(0, tec, osg.StateAttribute.OVERRIDE|osg.StateAttribute.ON) stateset.setTextureMode(0,GL_TEXTURE_GEN_S,osg.StateAttribute.ON) stateset.setTextureMode(0,GL_TEXTURE_GEN_T,osg.StateAttribute.ON) stateset.setTextureMode(0,GL_TEXTURE_GEN_R,osg.StateAttribute.ON) # set up color texture osg.Texture3D* texture3D = new osg.Texture3D texture3D.setFilter(osg.Texture3D.MIN_FILTER,osg.Texture3D.LINEAR) texture3D.setFilter(osg.Texture3D.MAG_FILTER,osg.Texture3D.LINEAR) texture3D.setWrap(osg.Texture3D.WRAP_R,osg.Texture3D.CLAMP) texture3D.setWrap(osg.Texture3D.WRAP_S,osg.Texture3D.CLAMP) texture3D.setWrap(osg.Texture3D.WRAP_T,osg.Texture3D.CLAMP) if (image_3d.getPixelFormat()==GL_ALPHA || image_3d.getPixelFormat()==GL_LUMINANCE) { texture3D.setInternalFormatMode(osg.Texture3D.USE_USER_DEFINED_FORMAT) texture3D.setInternalFormat(GL_INTENSITY) } else { texture3D.setInternalFormatMode(internalFormatMode) } texture3D.setImage(image_3d.get()) stateset.setTextureAttributeAndModes(1,texture3D,osg.StateAttribute.ON) stateset.setTextureMode(1,GL_TEXTURE_GEN_S,osg.StateAttribute.ON) stateset.setTextureMode(1,GL_TEXTURE_GEN_T,osg.StateAttribute.ON) stateset.setTextureMode(1,GL_TEXTURE_GEN_R,osg.StateAttribute.ON) stateset.setTextureAttributeAndModes(1,new osg.TexEnv(),osg.StateAttribute.ON) } else { osg.ref_ptr normalmap_3d = createNormalMapTexture(image_3d.get()) osg.Texture3D* bump_texture3D = new osg.Texture3D bump_texture3D.setFilter(osg.Texture3D.MIN_FILTER,osg.Texture3D.LINEAR) bump_texture3D.setFilter(osg.Texture3D.MAG_FILTER,osg.Texture3D.LINEAR) bump_texture3D.setWrap(osg.Texture3D.WRAP_R,osg.Texture3D.CLAMP) bump_texture3D.setWrap(osg.Texture3D.WRAP_S,osg.Texture3D.CLAMP) bump_texture3D.setWrap(osg.Texture3D.WRAP_T,osg.Texture3D.CLAMP) bump_texture3D.setImage(normalmap_3d.get()) bump_texture3D.setInternalFormatMode(internalFormatMode) stateset.setTextureAttributeAndModes(0,bump_texture3D,osg.StateAttribute.ON) osg.TexEnvCombine* tec = new osg.TexEnvCombine tec.setConstantColorAsLightDirection(lightDirection) tec.setCombine_RGB(osg.TexEnvCombine.DOT3_RGB) tec.setSource0_RGB(osg.TexEnvCombine.CONSTANT) tec.setOperand0_RGB(osg.TexEnvCombine.SRC_COLOR) tec.setSource1_RGB(osg.TexEnvCombine.TEXTURE) tec.setOperand1_RGB(osg.TexEnvCombine.SRC_COLOR) tec.setCombine_Alpha(osg.TexEnvCombine.MODULATE) tec.setSource0_Alpha(osg.TexEnvCombine.PRIMARY_COLOR) tec.setOperand0_Alpha(osg.TexEnvCombine.SRC_ALPHA) tec.setSource1_Alpha(osg.TexEnvCombine.TEXTURE) tec.setOperand1_Alpha(osg.TexEnvCombine.SRC_ALPHA) stateset.setTextureAttributeAndModes(0, tec, osg.StateAttribute.OVERRIDE|osg.StateAttribute.ON) stateset.setTextureMode(0,GL_TEXTURE_GEN_S,osg.StateAttribute.ON) stateset.setTextureMode(0,GL_TEXTURE_GEN_T,osg.StateAttribute.ON) stateset.setTextureMode(0,GL_TEXTURE_GEN_R,osg.StateAttribute.ON) image_3d = normalmap_3d } } else { # set up the 3d texture itself, # note, well set the filtering up so that mip mapping is disabled, # gluBuild3DMipsmaps doesn't do a very good job of handled the # inbalanced dimensions of the 256x256x4 texture. osg.Texture3D* texture3D = new osg.Texture3D texture3D.setFilter(osg.Texture3D.MIN_FILTER,osg.Texture3D.LINEAR) texture3D.setFilter(osg.Texture3D.MAG_FILTER,osg.Texture3D.LINEAR) texture3D.setWrap(osg.Texture3D.WRAP_R,osg.Texture3D.CLAMP) texture3D.setWrap(osg.Texture3D.WRAP_S,osg.Texture3D.CLAMP) texture3D.setWrap(osg.Texture3D.WRAP_T,osg.Texture3D.CLAMP) if (image_3d.getPixelFormat()==GL_ALPHA || image_3d.getPixelFormat()==GL_LUMINANCE) { texture3D.setInternalFormatMode(osg.Texture3D.USE_USER_DEFINED_FORMAT) texture3D.setInternalFormat(GL_INTENSITY) } else { texture3D.setInternalFormatMode(internalFormatMode) } texture3D.setImage(image_3d.get()) stateset.setTextureAttributeAndModes(0,texture3D,osg.StateAttribute.ON) stateset.setTextureMode(0,GL_TEXTURE_GEN_S,osg.StateAttribute.ON) stateset.setTextureMode(0,GL_TEXTURE_GEN_T,osg.StateAttribute.ON) stateset.setTextureMode(0,GL_TEXTURE_GEN_R,osg.StateAttribute.ON) stateset.setTextureAttributeAndModes(0,new osg.TexEnv(),osg.StateAttribute.ON) } return group } struct FindRangeOperator { FindRangeOperator(): _rmin(FLT_MAX), _rmax(-FLT_MAX), _gmin(FLT_MAX), _gmax(-FLT_MAX), _bmin(FLT_MAX), _bmax(-FLT_MAX), _amin(FLT_MAX), _amax(-FLT_MAX) {} mutable float _rmin, _rmax, _gmin, _gmax, _bmin, _bmax, _amin, _amax inline void luminance(float l) const { rgb(l,l,l); } inline void alpha(float a) const { _amin = osg.minimum(a,_amin); _amax = osg.maximum(a,_amax); } inline void luminance_alpha(float l,float a) const { rgb(l,l,l); alpha(a); } inline void rgb(float r,float g,float b) const { _rmin = osg.minimum(r,_rmin); _rmax = osg.maximum(r,_rmax); _gmin = osg.minimum(g,_gmin); _gmax = osg.maximum(g,_gmax); _bmin = osg.minimum(b,_bmin); _bmax = osg.maximum(b,_bmax); } inline void rgba(float r,float g,float b,float a) const { rgb(r,g,b); alpha(a); } } struct ScaleOperator { ScaleOperator():_scale(1.0) {} ScaleOperator(float scale):_scale(scale) {} ScaleOperator(const ScaleOperator& so):_scale(so._scale) {} ScaleOperator& operator = (const ScaleOperator& so) { _scale = so._scale; return *this; } float _scale inline void luminance(float& l) const { l*= _scale; } inline void alpha(float& a) const { a*= _scale; } inline void luminance_alpha(float& l,float& a) const { l*= _scale; a*= _scale; } inline void rgb(float& r,float& g,float& b) const { r*= _scale; g*=_scale; b*=_scale; } inline void rgba(float& r,float& g,float& b,float& a) const { r*= _scale; g*=_scale; b*=_scale; a*=_scale; } } struct RecordRowOperator { RecordRowOperator(unsigned int num):_colours(num),_pos(0) {} mutable std.vector _colours mutable unsigned int _pos inline void luminance(float l) const { rgba(l,l,l,1.0); } inline void alpha(float a) const { rgba(1.0,1.0,1.0,a); } inline void luminance_alpha(float l,float a) const { rgba(l,l,l,a); } inline void rgb(float r,float g,float b) const { rgba(r,g,b,1.0); } inline void rgba(float r,float g,float b,float a) const { _colours[_pos++].set(r,g,b,a); } } struct WriteRowOperator { WriteRowOperator():_pos(0) {} WriteRowOperator(unsigned int num):_colours(num),_pos(0) {} std.vector _colours mutable unsigned int _pos inline void luminance(float& l) const { l = _colours[_pos++].red(); } inline void alpha(float& a) const { a = _colours[_pos++].alpha(); } inline void luminance_alpha(float& l,float& a) const { l = _colours[_pos].red(); a = _colours[_pos++].alpha(); } inline void rgb(float& r,float& g,float& b) const { r = _colours[_pos].red(); g = _colours[_pos].green(); b = _colours[_pos].blue(); } inline void rgba(float& r,float& g,float& b,float& a) const { r = _colours[_pos].red(); g = _colours[_pos].green(); b = _colours[_pos].blue(); a = _colours[_pos++].alpha(); } } osg.Image* readRaw(int sizeX, int sizeY, int sizeZ, int numberBytesPerComponent, int numberOfComponents, const std.string& endian, const std.string& raw_filename) { std.ifstream fin(raw_filename.c_str()) if (!fin) return 0 GLenum pixelFormat switch(numberOfComponents) { case 1 : pixelFormat = GL_LUMINANCE; break case 2 : pixelFormat = GL_LUMINANCE_ALPHA; break case 3 : pixelFormat = GL_RGB; break case 4 : pixelFormat = GL_RGBA; break default : osg.notify(osg.NOTICE)<<"Error: numberOfComponents="< image = new osg.Image image.allocateImage(sizeS, sizeT, sizeR, pixelFormat, dataType) bool endianSwap = (osg.getCpuByteOrder()==osg.BigEndian) ? (endian!="big") : (endian=="big") unsigned int r_offset = (sizeZ new_image = new osg.Image new_image.allocateImage(sizeS, sizeT, sizeR, pixelFormat, GL_UNSIGNED_BYTE) RecordRowOperator readOp(sizeS) WriteRowOperator writeOp for(int r=0;r","Number of slices to create.") arguments.getApplicationUsage().addCommandLineOption("--xSize ","Relative width of rendered brick.") arguments.getApplicationUsage().addCommandLineOption("--ySize ","Relative length of rendered brick.") arguments.getApplicationUsage().addCommandLineOption("--zSize ","Relative height of rendered brick.") arguments.getApplicationUsage().addCommandLineOption("--xMultiplier ","Tex coord x mulitplier.") arguments.getApplicationUsage().addCommandLineOption("--yMultiplier ","Tex coord y mulitplier.") arguments.getApplicationUsage().addCommandLineOption("--zMultiplier ","Tex coord z mulitplier.") arguments.getApplicationUsage().addCommandLineOption("--clip ","clip volume as a ratio, 0.0 clip all, 1.0 clip none.") arguments.getApplicationUsage().addCommandLineOption("--maxTextureSize ","Set the texture maximum resolution in the s,t,r (x,y,z) dimensions.") arguments.getApplicationUsage().addCommandLineOption("--s_maxTextureSize ","Set the texture maximum resolution in the s (x) dimension.") arguments.getApplicationUsage().addCommandLineOption("--t_maxTextureSize ","Set the texture maximum resolution in the t (y) dimension.") arguments.getApplicationUsage().addCommandLineOption("--r_maxTextureSize ","Set the texture maximum resolution in the r (z) dimension.") arguments.getApplicationUsage().addCommandLineOption("--compressed","Enable the usage of compressed textures") arguments.getApplicationUsage().addCommandLineOption("--compressed-arb","Enable the usage of OpenGL ARB compressed textures") arguments.getApplicationUsage().addCommandLineOption("--compressed-dxt1","Enable the usage of S3TC DXT1 compressed textures") arguments.getApplicationUsage().addCommandLineOption("--compressed-dxt3","Enable the usage of S3TC DXT3 compressed textures") arguments.getApplicationUsage().addCommandLineOption("--compressed-dxt5","Enable the usage of S3TC DXT5 compressed textures") arguments.getApplicationUsage().addCommandLineOption("--modulate-alpha-by-luminance","For each pixel multiple the alpha value by the luminance.") arguments.getApplicationUsage().addCommandLineOption("--replace-alpha-with-luminance","For each pixel mSet the alpha value to the luminance") # arguments.getApplicationUsage().addCommandLineOption("--raw ","read a raw image data") # construct the viewer. osgProducer.Viewer viewer(arguments) # set up the value with sensible default event handlers. viewer.setUpViewer(osgProducer.Viewer.STANDARD_SETTINGS) # get details on keyboard and mouse bindings used by the viewer. viewer.getUsage(*arguments.getApplicationUsage()) # if user request help write it out to cout. if (arguments.read("-h") || arguments.read("--help")) { arguments.getApplicationUsage().write(std.cout) return 1 } std.string outputFile while (arguments.read("-o",outputFile)) {} unsigned int numSlices=500 while (arguments.read("-s",numSlices)) {} float sliceEnd=1.0 while (arguments.read("--clip",sliceEnd)) {} float alphaFunc=0.02 while (arguments.read("--alphaFunc",alphaFunc)) {} bool createNormalMap = false while (arguments.read("-n")) createNormalMap=true float xSize=1.0, ySize=1.0, zSize=1.0 while (arguments.read("--xSize",xSize)) {} while (arguments.read("--ySize",ySize)) {} while (arguments.read("--zSize",zSize)) {} float xMultiplier=1.0, yMultiplier=1.0, zMultiplier=1.0 while (arguments.read("--xMultiplier",xMultiplier)) {} while (arguments.read("--yMultiplier",yMultiplier)) {} while (arguments.read("--zMultiplier",zMultiplier)) {} int s_maximumTextureSize = 256 int t_maximumTextureSize = 256 int r_maximumTextureSize = 256 int maximumTextureSize = 256 while(arguments.read("--maxTextureSize",maximumTextureSize)) { s_maximumTextureSize = maximumTextureSize t_maximumTextureSize = maximumTextureSize r_maximumTextureSize = maximumTextureSize } while(arguments.read("--s_maxTextureSize",s_maximumTextureSize)) {} while(arguments.read("--t_maxTextureSize",t_maximumTextureSize)) {} while(arguments.read("--r_maxTextureSize",r_maximumTextureSize)) {} osg.Texture.InternalFormatMode internalFormatMode = osg.Texture.USE_IMAGE_DATA_FORMAT while(arguments.read("--compressed") || arguments.read("--compressed-arb")) { internalFormatMode = osg.Texture.USE_ARB_COMPRESSION; } while(arguments.read("--compressed-dxt1")) { internalFormatMode = osg.Texture.USE_S3TC_DXT1_COMPRESSION; } while(arguments.read("--compressed-dxt3")) { internalFormatMode = osg.Texture.USE_S3TC_DXT3_COMPRESSION; } while(arguments.read("--compressed-dxt5")) { internalFormatMode = osg.Texture.USE_S3TC_DXT5_COMPRESSION; } # set up colour space operation. ColourSpaceOperation colourSpaceOperation = NO_COLOUR_SPACE_OPERATION osg.Vec4 colourModulate(0.25,0.25,0.25,0.25) while(arguments.read("--modulate-alpha-by-luminance")) { colourSpaceOperation = MODULATE_ALPHA_BY_LUMINANCE; } while(arguments.read("--modulate-alpha-by-colour", colourModulate.x(),colourModulate.y(),colourModulate.z(),colourModulate.w() )) { colourSpaceOperation = MODULATE_ALPHA_BY_COLOUR; } while(arguments.read("--replace-alpha-with-luminance")) { colourSpaceOperation = REPLACE_ALPHA_WITH_LUMINACE; } osg.ref_ptr image_3d int sizeX, sizeY, sizeZ, numberBytesPerComponent, numberOfComponents std.string endian, raw_filename while (arguments.read("--raw", sizeX, sizeY, sizeZ, numberBytesPerComponent, numberOfComponents, endian, raw_filename)) { image_3d = readRaw(sizeX, sizeY, sizeZ, numberBytesPerComponent, numberOfComponents, endian, raw_filename) } while (arguments.read("--images")) { ImageList imageList for(int pos=1;pos normalmap_3d = createNormalMap ? createNormalMapTexture(image_3d.get()) : 0 # create a model from the images. osg.Node* rootNode = createModel(image_3d, normalmap_3d, internalFormatMode, xSize, ySize, zSize, xMultiplier, yMultiplier, zMultiplier, numSlices, sliceEnd, alphaFunc) if (!outputFile.empty()) { std.string ext = osgDB.getFileExtension(outputFile) std.string name_no_ext = osgDB.getNameLessExtension(outputFile) if (ext=="osg") { if (image_3d.valid()) { image_3d.setFileName(name_no_ext + ".dds") osgDB.writeImageFile(*image_3d, image_3d.getFileName()) } if (normalmap_3d.valid()) { normalmap_3d.setFileName(name_no_ext + "_normalmap.dds") osgDB.writeImageFile(*normalmap_3d, normalmap_3d.getFileName()) } osgDB.writeNodeFile(*rootNode, outputFile) } else if (ext=="ive") { osgDB.writeNodeFile(*rootNode, outputFile) } else if (ext=="dds") { osgDB.writeImageFile(*image_3d, outputFile) } else { std.cout<<"Extension not support for file output, not file written."<