Fixed colors in shaders.
This commit is contained in:
@ -97,7 +97,8 @@ void ShaderProgram::setBoolean(shaderparameter_t uni, bool value) {
|
||||
}
|
||||
|
||||
void ShaderProgram::setColor(shaderparameter_t uniform, struct Color color) {
|
||||
glUniform4f(uniform, color.r, color.g, color.b, color.a);
|
||||
auto precise = color.precision();
|
||||
glUniform4f(uniform, precise.r, precise.g, precise.b, precise.a);
|
||||
}
|
||||
|
||||
void ShaderProgram::setVector3(shaderparameter_t uniform, glm::vec3 vector) {
|
||||
|
@ -43,8 +43,8 @@ namespace Dawn {
|
||||
camera = Camera::create(this);
|
||||
camera->fov = 0.436332f;
|
||||
camera->transform->lookAt(glm::vec3(10, 10, 10), glm::vec3(0, 0, 0));
|
||||
// auto gameCamera = camera->item->addComponent<GameCamera>();
|
||||
// gameCamera->player = player->player;
|
||||
auto gameCamera = camera->item->addComponent<GameCamera>();
|
||||
gameCamera->player = player->player;
|
||||
}
|
||||
|
||||
std::vector<Asset*> getRequiredAssets() override {
|
||||
|
@ -21,8 +21,8 @@ int32_t TextureTool::start() {
|
||||
if(!in.open(FILE_MODE_READ)) return 1;
|
||||
|
||||
int w, h, channels;
|
||||
auto dataImage = stbi_load_from_file(in.file, &w, &h, &channels, STBI_rgb_alpha);
|
||||
if(dataImage == NULL) {
|
||||
auto imageRaw = stbi_load_from_file(in.file, &w, &h, &channels, STBI_rgb_alpha);
|
||||
if(imageRaw == NULL) {
|
||||
std::cout << "Failed to load input texture!" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
@ -30,6 +30,12 @@ int32_t TextureTool::start() {
|
||||
|
||||
// Convert to floating points
|
||||
size_t len = STBI_rgb_alpha * w * h;
|
||||
uint8_t *dataImage = (uint8_t*)malloc(sizeof(uint8_t) * len);
|
||||
for(size_t i = 0; i < len; i++) {
|
||||
auto dataIn = imageRaw[i];
|
||||
dataImage[i] = dataIn;
|
||||
}
|
||||
stbi_image_free(imageRaw);
|
||||
|
||||
// Open and create output
|
||||
File out(flags["output"] + ".texture");
|
||||
@ -55,7 +61,7 @@ int32_t TextureTool::start() {
|
||||
std::cout << "Failed to write texture data for " << out.filename << std::endl;
|
||||
return 1;
|
||||
}
|
||||
stbi_image_free(dataImage);
|
||||
free(dataImage);
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user