58 lines
1.3 KiB
C++
58 lines
1.3 KiB
C++
/*
|
|
This file is part of Nori, a simple educational ray tracer
|
|
|
|
Copyright (c) 2015 by Wenzel Jakob
|
|
|
|
Nori is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License Version 3
|
|
as published by the Free Software Foundation.
|
|
|
|
Nori is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
#pragma once
|
|
|
|
#include <nori/warp.h>
|
|
#include <nori/bitmap.h>
|
|
#include <map>
|
|
|
|
NORI_NAMESPACE_BEGIN
|
|
|
|
|
|
|
|
/**
|
|
* \brief MIPMAP Class
|
|
*/
|
|
struct Mipmap {
|
|
public:
|
|
|
|
Mipmap(){};
|
|
Mipmap(const std::string &filename);
|
|
|
|
float get(size_t x, size_t y, size_t size) const;
|
|
|
|
Color3f getColor(float x, float y) const;
|
|
|
|
size_t getSize() const {
|
|
return m_size;
|
|
}
|
|
float getPDFF() const {
|
|
return m_size*m_size;
|
|
}
|
|
|
|
private:
|
|
Bitmap m_img;
|
|
size_t m_size;
|
|
float* m_mm;
|
|
float m_maxv;
|
|
std::map<size_t,float*> m_stp;
|
|
|
|
void fill_mm(size_t size);
|
|
};
|
|
|
|
NORI_NAMESPACE_END |