-
Notifications
You must be signed in to change notification settings - Fork 0
Update from task 19d0844b-cf70-4f49-b1c1-dde4fc49e516 #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
419f521
94dfd17
3528f49
fc8fe9d
31d332e
971bbfb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,68 @@ | ||
| Nothing should be ignored based on the provided file changes. The only modified file is README.md, which is a source/config file and should not be added to .gitignore. | ||
| ``` | ||
| # Compiled and build artifacts | ||
| *.o | ||
| *.obj | ||
| *.exe | ||
| *.dll | ||
| *.so | ||
| *.a | ||
| *.out | ||
| build/ | ||
| dist/ | ||
| target/ | ||
|
|
||
| # Dependencies | ||
| node_modules/ | ||
| venv/ | ||
| .venv/ | ||
| __pycache__/ | ||
| .mypy_cache/ | ||
| .pytest_cache/ | ||
| .gradle/ | ||
| julia-*/ | ||
| zig*/ | ||
|
|
||
| # Editors and IDEs | ||
| .vscode/ | ||
| .idea/ | ||
| *.swp | ||
| *.swo | ||
| *.tmp | ||
|
|
||
| # System files | ||
| .DS_Store | ||
| Thumbs.db | ||
| .env | ||
| .env.local | ||
| *.env.* | ||
|
|
||
| # Logs and coverage | ||
| *.log | ||
| coverage/ | ||
| htmlcov/ | ||
| .coverage | ||
|
|
||
| # Compressed files | ||
| *.zip | ||
| *.gz | ||
| *.tar | ||
| *.tgz | ||
| *.bz2 | ||
| *.xz | ||
| *.7z | ||
| *.rar | ||
| *.zst | ||
| *.lz4 | ||
| *.lzh | ||
| *.cab | ||
| *.arj | ||
| *.rpm | ||
| *.deb | ||
| *.Z | ||
| *.lz | ||
| *.lzo | ||
| *.tar.gz | ||
| *.tar.bz2 | ||
| *.tar.xz | ||
| *.tar.zst | ||
| ``` | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| #version 450 | ||
|
|
||
| // Fragment shader básico para sprites 2D | ||
| layout(location = 0) in vec2 fragTexCoord; | ||
| layout(location = 1) in vec4 fragColor; | ||
|
|
||
| layout(location = 0) out vec4 outColor; | ||
|
|
||
| layout(binding = 1) uniform sampler2D spriteTexture; | ||
|
|
||
| void main() { | ||
| vec4 texColor = texture(spriteTexture, fragTexCoord); | ||
|
|
||
| // Alpha test para recortes | ||
| if (texColor.a < 0.1) { | ||
| discard; | ||
| } | ||
|
|
||
| outColor = texColor * fragColor; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| #version 450 | ||
|
|
||
| // Vertex shader básico para sprites 2D | ||
| layout(location = 0) in vec2 inPosition; | ||
| layout(location = 1) in vec2 inTexCoord; | ||
| layout(location = 2) in vec4 inColor; | ||
|
|
||
| layout(location = 0) out vec2 fragTexCoord; | ||
| layout(location = 1) out vec4 fragColor; | ||
|
|
||
| layout(binding = 0) uniform MVP { | ||
| mat4 model; | ||
| mat4 view; | ||
| mat4 projection; | ||
| }; | ||
|
|
||
| void main() { | ||
| gl_Position = projection * view * model * vec4(inPosition, 0.0, 1.0); | ||
| fragTexCoord = inTexCoord; | ||
| fragColor = inColor; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| #version 450 | ||
|
|
||
| // Fragment shader para terreno 3D con PBR básico | ||
| layout(location = 0) in vec3 fragPosition; | ||
| layout(location = 1) in vec3 fragNormal; | ||
| layout(location = 2) in vec2 fragTexCoord; | ||
| layout(location = 3) in mat4 fragTBN; | ||
|
|
||
| layout(location = 0) out vec4 outColor; | ||
|
|
||
| layout(binding = 1) uniform sampler2D albedoMap; | ||
| layout(binding = 2) uniform sampler2D normalMap; | ||
| layout(binding = 3) uniform sampler2D roughnessMap; | ||
| layout(binding = 4) uniform sampler2D metalnessMap; | ||
|
|
||
| layout(binding = 5) uniform LightData { | ||
| vec3 position; | ||
| vec3 color; | ||
| float intensity; | ||
| vec3 ambientColor; | ||
| float ambientIntensity; | ||
| }; | ||
|
|
||
| // PBR helper functions | ||
| vec3 getNormalFromMap() { | ||
| vec3 tangentNormal = texture(normalMap, fragTexCoord).xyz * 2.0 - 1.0; | ||
| return normalize(fragTBN * vec4(tangentNormal, 0.0)).xyz; | ||
| } | ||
|
|
||
| float calculateShadow(vec3 lightDir) { | ||
| // Simplified shadow calculation | ||
| return 1.0; | ||
| } | ||
|
|
||
| void main() { | ||
| // Albedo | ||
| vec3 albedo = texture(albedoMap, fragTexCoord).rgb; | ||
|
|
||
| // Normal | ||
| vec3 normal = getNormalFromMap(); | ||
|
|
||
| // Material properties | ||
| float roughness = texture(roughnessMap, fragTexCoord).r; | ||
| float metalness = texture(metalnessMap, fragTexCoord).r; | ||
|
|
||
| // Lighting | ||
| vec3 lightDir = normalize(position - fragPosition); | ||
| vec3 viewDir = normalize(cameraPosition - fragPosition); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| vec3 halfDir = normalize(lightDir + viewDir); | ||
|
Comment on lines
+46
to
+49
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 4. Terrain shader missing uniform terrain.frag.glsl uses cameraPosition but never declares it as a uniform/input, so the shader will not compile. This blocks using the terrain shader for lighting calculations. Agent Prompt
|
||
|
|
||
| // Diffuse (Lambert) | ||
| float NdotL = max(dot(normal, lightDir), 0.0); | ||
| vec3 diffuse = albedo * NdotL; | ||
|
|
||
| // Specular (Blinn-Phong simplificado) | ||
| float NdotH = max(dot(normal, halfDir), 0.0); | ||
| float specPow = pow(2.0, (1.0 - roughness) * 10.0); | ||
| vec3 specular = vec3(pow(NdotH, specPow)) * metalness; | ||
|
|
||
| // Shadow | ||
| float shadow = calculateShadow(lightDir); | ||
|
|
||
| // Final lighting | ||
| vec3 lighting = (diffuse + specular) * color * intensity * shadow; | ||
| lighting += albedo * ambientColor * ambientIntensity; | ||
|
|
||
| outColor = vec4(lighting, 1.0); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| #version 450 | ||
|
|
||
| // Vertex shader para terreno 3D | ||
| layout(location = 0) in vec3 inPosition; | ||
| layout(location = 1) in vec3 inNormal; | ||
| layout(location = 2) in vec2 inTexCoord; | ||
| layout(location = 3) in vec4 inTangent; | ||
|
|
||
| layout(location = 0) out vec3 fragPosition; | ||
| layout(location = 1) out vec3 fragNormal; | ||
| layout(location = 2) out vec2 fragTexCoord; | ||
| layout(location = 3) out mat4 fragTBN; | ||
|
|
||
| layout(binding = 0) uniform UniformBuffer { | ||
| mat4 model; | ||
| mat4 view; | ||
| mat4 projection; | ||
| vec3 cameraPosition; | ||
| float time; | ||
| }; | ||
|
|
||
| void main() { | ||
| vec4 worldPos = model * vec4(inPosition, 1.0); | ||
| fragPosition = worldPos.xyz; | ||
|
|
||
| // Normal mapping | ||
| vec3 normal = normalize(mat3(model) * inNormal); | ||
| vec3 tangent = normalize(mat3(model) * inTangent.xyz); | ||
| vec3 bitangent = cross(normal, tangent) * inTangent.w; | ||
| fragTBN = mat4(tangent, bitangent, normal, vec4(0, 0, 0, 1)); | ||
|
|
||
| fragNormal = normal; | ||
| fragTexCoord = inTexCoord; | ||
|
|
||
| gl_Position = projection * view * worldPos; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| #include "ECS.h" | ||
|
|
||
| namespace FarmEngine { | ||
|
|
||
| ECS::ECS() { | ||
| entities.reserve(MAX_ENTITIES); | ||
| } | ||
|
|
||
| ECS::~ECS() = default; | ||
|
|
||
| EntityID ECS::createEntity() { | ||
| EntityID id; | ||
|
|
||
| if (!availableIDs.empty()) { | ||
| id = availableIDs.back(); | ||
| availableIDs.pop_back(); | ||
| entities[id].active = true; | ||
| } else { | ||
| id = static_cast<EntityID>(entities.size()); | ||
| entities.emplace_back(id); | ||
| } | ||
|
|
||
| return id; | ||
| } | ||
|
|
||
| void ECS::destroyEntity(EntityID entity) { | ||
| if (entity >= entities.size()) return; | ||
|
|
||
| entities[entity].active = false; | ||
| entities[entity].mask.reset(); | ||
|
|
||
| // Limpiar componentes | ||
| for (auto& componentList : components) { | ||
| if (componentList.second && entity < componentList.second->size()) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In C++, |
||
| (*componentList.second)[entity].reset(); | ||
| } | ||
| } | ||
|
|
||
| availableIDs.push_back(entity); | ||
| } | ||
|
|
||
| void ECS::update(float deltaTime) { | ||
| // Actualizar sistemas basados en ECS | ||
| (void)deltaTime; | ||
| } | ||
|
|
||
| } // namespace FarmEngine | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
.gitignorefile contains markdown code block backticks (```) at the beginning and end. These are not valid syntax for a.gitignorefile and will cause git to misinterpret the entries or ignore the file entirely.