mirror of
https://github.com/TheRedShip/RT_GPU.git
synced 2025-09-27 10:48:34 +02:00
+ | Texture better coede
This commit is contained in:
@ -24,8 +24,8 @@ pl 0 -2 0 0 1 0 2 // floor
|
||||
|
||||
qu -1 1.999 -1 2 0 0 0 0 2 6
|
||||
|
||||
OBJ obj/Dragon_800K.obj -0.5 0 0.55 5 0 90 0
|
||||
OBJ obj/Dragon_800K.obj 0.5 0 -0.55 5 0 -90 0
|
||||
OBJ scenes/obj/Dragon_800K.obj -0.5 0 0.55 5 0 90 0
|
||||
OBJ scenes/obj/Dragon_800K.obj 0.5 0 -0.55 5 0 -90 0
|
||||
|
||||
|
||||
# OBJ obj/Model.obj
|
||||
|
@ -91,8 +91,8 @@ bool intersectTriangle(Ray ray, GPUTriangle obj, out hitInfo hit)
|
||||
hit.v = v;
|
||||
hit.t = t;
|
||||
hit.position = ray.origin + ray.direction * t;
|
||||
// hit.normal = vec3(u, v, 1 - (u + v)); //texture mapping
|
||||
hit.normal = obj.normal * sign(-dot(ray.direction, obj.normal));
|
||||
// hit.normal = vec3(u, v, 1 - (u + v)); //texture mapping
|
||||
|
||||
return (valid);
|
||||
}
|
||||
|
@ -113,9 +113,7 @@ vec3 getTextureColor(int texture_index, hitInfo hit)
|
||||
|
||||
void calculateLightColor(GPUMaterial mat, hitInfo hit, inout vec3 color, inout vec3 light, inout uint rng_state)
|
||||
{
|
||||
if (mat.texture_index != -1)
|
||||
color *= getTextureColor(mat.texture_index, hit);
|
||||
|
||||
color *= mat.texture_index == -1 ? vec3(1.0) : getTextureColor(mat.texture_index, hit);
|
||||
color *= mat.color;
|
||||
light += mat.emission * mat.color;
|
||||
// light += sampleLights(hit.position, rng_state);
|
||||
|
@ -80,10 +80,8 @@ Ray transparencyRay(hitInfo hit, Ray ray, GPUMaterial mat, inout uint rng_state)
|
||||
|
||||
Ray newRay(hitInfo hit, Ray ray, inout uint rng_state)
|
||||
{
|
||||
GPUObject obj;
|
||||
GPUMaterial mat;
|
||||
|
||||
obj = objects[hit.obj_index];
|
||||
mat = materials[hit.mat_index];
|
||||
|
||||
if (mat.type == 0)
|
||||
|
@ -67,7 +67,7 @@ Shader::Shader(std::string vertexPath, std::string fragmentPath, std::string com
|
||||
const char *fragmentCode = loadFileWithIncludes(fragmentPath);
|
||||
const char *computeCode = loadFileWithIncludes(computePath);
|
||||
|
||||
// printWithLineNumbers(computeCode);
|
||||
printWithLineNumbers(computeCode);
|
||||
|
||||
_vertex = glCreateShader(GL_VERTEX_SHADER);
|
||||
|
||||
|
Reference in New Issue
Block a user