0e3982591e
MyBuiltinTexturedScene (number 7) displays a cube that loads its faces from a hard-coded texture. Mipmaping is supported. Just use the XXX_MIPMAP_XXX Min/Mag filters to use it. TODO next is combining lighting and textures and then up after that is shadows. I may just do lighting and shadows before lighting, shadows, and textures.
64 lines
1.4 KiB
C++
64 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include <vector>
|
|
|
|
#include "Texture.h"
|
|
#include "Sampler.h"
|
|
#include "TextureFactory.h"
|
|
|
|
namespace charcoal
|
|
{
|
|
namespace builtin
|
|
{
|
|
namespace texturegenerator
|
|
{
|
|
Texture* gen_quick_cube_texture()
|
|
{
|
|
std::vector<unsigned char> values;
|
|
|
|
// Front
|
|
values.emplace_back(255);
|
|
values.emplace_back(255);
|
|
values.emplace_back(255);
|
|
values.emplace_back(255);
|
|
|
|
// Right
|
|
values.emplace_back(255);
|
|
values.emplace_back(255);
|
|
values.emplace_back(0);
|
|
values.emplace_back(255);
|
|
|
|
// Back
|
|
values.emplace_back(255);
|
|
values.emplace_back(0);
|
|
values.emplace_back(255);
|
|
values.emplace_back(255);
|
|
|
|
// Left
|
|
values.emplace_back(0);
|
|
values.emplace_back(255);
|
|
values.emplace_back(255);
|
|
values.emplace_back(255);
|
|
|
|
// Top
|
|
values.emplace_back(255);
|
|
values.emplace_back(0);
|
|
values.emplace_back(0);
|
|
values.emplace_back(255);
|
|
|
|
// Bottom
|
|
values.emplace_back(0);
|
|
values.emplace_back(255);
|
|
values.emplace_back(0);
|
|
values.emplace_back(255);
|
|
|
|
return TextureFactory::gen_texture(Texture::Format::RGBA, Texture::Type::UNSIGNED_BYTE, 6, 1, values, Texture::InternalFormat::RGBA);
|
|
}
|
|
|
|
Sampler* gen_quick_sampler()
|
|
{
|
|
return TextureFactory::gen_sampler(Sampler::Wrap::REPEAT, Sampler::Wrap::REPEAT, Sampler::MagFilter::NEAREST, Sampler::MinFilter::NEAREST);
|
|
}
|
|
}
|
|
}
|
|
} |