The spica renderer
mipmap.h
1 #ifdef _MSC_VER
2 #pragma once
3 #endif
4 
5 #ifndef _SPICA_MIPMAP_H_
6 #define _SPICA_MIPMAP_H_
7 
8 #include <vector>
9 
10 #include "core/core.hpp"
11 
12 #include "core/common.h"
13 #include "core/image.h"
14 
15 namespace spica {
16 
17  enum class ImageWrap : int {
18  Black,
19  Clamp,
20  Repeat,
21  };
22 
23  class SPICA_EXPORTS MipMap {
24  public:
25  MipMap(const Image& image, ImageWrap imageWrap = ImageWrap::Repeat);
26 
27  Spectrum lookup(const Point2d& st, double width = 0.0) const;
28  Spectrum lookup(const Point2d& st, const Vector2d& dstdx, const Vector2d& dstdy) const;
29 
30  inline int levels() const { return static_cast<int>(pyramid_.size()); }
31 
32  private:
33  Spectrum bilinear(int level, const Point2d& st) const;
34  Spectrum texel(int level, int s, int t) const;
35 
36  ImageWrap imageWrap_;
37  std::vector<Image> pyramid_;
38  };
39 
40 } // namespace spica
41 
42 #endif // _SPICA_MIPMAP_H_
Definition: mipmap.h:23
RGB spectrum.
Definition: spectrum.h:18
Image class.
Definition: image.h:18