Skip to content

Commit

Permalink
Update the handing of texture mapping class with shared_ptr.
Browse files Browse the repository at this point in the history
  • Loading branch information
tatsy committed Mar 26, 2016
1 parent ca759c0 commit cc5bff5
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion sources/image/film.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void Film::save(int id) const {
const char* format = filename_.c_str();
sprintf(savefile, format, id);

if (ext == ".hdr") {
if (ext != ".hdr") {
GammaTmo tmo(2.2);
res = tmo.apply(res);
}
Expand Down
4 changes: 2 additions & 2 deletions sources/texture/imagemap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
namespace spica {

ImageTexture::ImageTexture(const Image& image,
std::unique_ptr<TextureMapping2D> texmap,
const std::shared_ptr<TextureMapping2D>& texmap,
ImageWrap wrap)
: mipmap_{ std::make_unique<MipMap>(image, wrap) }
, texmap_{ std::move(texmap) } {
, texmap_{ texmap } {
}

Spectrum ImageTexture::evaluate(const SurfaceInteraction& intr) const {
Expand Down
6 changes: 3 additions & 3 deletions sources/texture/imagemap.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@

namespace spica {

class ImageTexture : public Texture<Spectrum> {
class SPICA_EXPORTS ImageTexture : public Texture<Spectrum> {
public:
ImageTexture(const Image& image,
std::unique_ptr<TextureMapping2D> texmap,
const std::shared_ptr<TextureMapping2D>& texmap,
ImageWrap wrap);

Spectrum evaluate(const SurfaceInteraction& intr) const;

private:
// Private field
std::unique_ptr<MipMap> mipmap_;
std::unique_ptr<TextureMapping2D> texmap_;
std::shared_ptr<TextureMapping2D> texmap_;
};

} // namespace spica
Expand Down
1 change: 1 addition & 0 deletions sources/texture/spica_texture.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include "texture.h"
#include "constant.h"
#include "imagemap.h"
#include "uv.h"

#endif // _SPICA_TEXTURE_HEADERS_H_

0 comments on commit cc5bff5

Please sign in to comment.