From 5e95d6e3b5e73bb2e19313e3e88dced4cc108031 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 8 Oct 2008 11:30:18 +0000 Subject: [PATCH] Added Texture1D(Image*) and Texture3D(Image*) constructors --- include/osg/Texture1D | 2 ++ include/osg/Texture3D | 2 ++ src/osg/Texture1D.cpp | 7 +++++++ src/osg/Texture3D.cpp | 10 ++++++++++ 4 files changed, 21 insertions(+) diff --git a/include/osg/Texture1D b/include/osg/Texture1D index ca14d3baa..b62ae9111 100644 --- a/include/osg/Texture1D +++ b/include/osg/Texture1D @@ -30,6 +30,8 @@ class OSG_EXPORT Texture1D : public Texture Texture1D(); + Texture1D(Image* image); + /** Copy constructor using CopyOp to manage deep vs shallow copy. */ Texture1D(const Texture1D& text,const CopyOp& copyop=CopyOp::SHALLOW_COPY); diff --git a/include/osg/Texture3D b/include/osg/Texture3D index 70ee4e5f4..8392dbeb8 100644 --- a/include/osg/Texture3D +++ b/include/osg/Texture3D @@ -32,6 +32,8 @@ class OSG_EXPORT Texture3D : public Texture Texture3D(); + Texture3D(Image* image); + /** Copy constructor using CopyOp to manage deep vs shallow copy. */ Texture3D(const Texture3D& text,const CopyOp& copyop=CopyOp::SHALLOW_COPY); diff --git a/src/osg/Texture1D.cpp b/src/osg/Texture1D.cpp index 73622a6aa..3eb2667db 100644 --- a/src/osg/Texture1D.cpp +++ b/src/osg/Texture1D.cpp @@ -26,6 +26,13 @@ Texture1D::Texture1D(): { } +Texture1D::Texture1D(osg::Image* image): + _textureWidth(0), + _numMipmapLevels(0) +{ + setImage(image); +} + Texture1D::Texture1D(const Texture1D& text,const CopyOp& copyop): Texture(text,copyop), _image(copyop(text._image.get())), diff --git a/src/osg/Texture3D.cpp b/src/osg/Texture3D.cpp index 24f0f7977..3c724c394 100644 --- a/src/osg/Texture3D.cpp +++ b/src/osg/Texture3D.cpp @@ -31,6 +31,16 @@ Texture3D::Texture3D(): { } + +Texture3D::Texture3D(Image* image): + _textureWidth(0), + _textureHeight(0), + _textureDepth(0), + _numMipmapLevels(0) +{ + setImage(image); +} + Texture3D::Texture3D(const Texture3D& text,const CopyOp& copyop): Texture(text,copyop), _image(copyop(text._image.get())),