MinusculeRender/src/phone_material.h

37 lines
877 B
C++

// Copyright 2024 SquareBlock Inc. All Rights Reserved.
// Author: tianlei.richard@qq.com (tianlei.richard)
#pragma once
#include <filesystem>
#include <opencv2/core/core.hpp>
#include <vector>
#include "common.h"
#include "texture.h"
// Bling-Phone Matrerial
class PhoneMaterial {
public:
PhoneMaterial(const std::unordered_map<Texture::TextureType,
std::shared_ptr<Texture>> &textures,
const std::shared_ptr<Lamp> &lamp);
cv::Vec3b shade(const Vertex &shading_point, const Point3d &view_point) const;
private:
static constexpr int defaultAttenuationFactor = 16;
private:
std::shared_ptr<Lamp> point_lamp_;
std::unordered_map<Texture::TextureType, std::shared_ptr<Texture>> textures_;
// Ambient Related
cv::Vec3b Ka;
// Specular Related
cv::Vec3b Ks;
int specular_attenuation_factor_;
};