Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
ftl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nicolas Pope
ftl
Commits
9d074859
Commit
9d074859
authored
5 years ago
by
Nicolas Pope
Browse files
Options
Downloads
Patches
Plain Diff
Compute actual z
parent
2aa70966
No related branches found
No related tags found
1 merge request
!151
Implements #216 triangle renderer
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
components/renderers/cpp/src/triangle_render.cu
+13
-1
13 additions, 1 deletion
components/renderers/cpp/src/triangle_render.cu
with
13 additions
and
1 deletion
components/renderers/cpp/src/triangle_render.cu
+
13
−
1
View file @
9d074859
...
...
@@ -90,6 +90,17 @@ __device__ static
barycentricCoord
.
z
>=
0.0
&&
barycentricCoord
.
z
<=
1.0
;
}
/**
* For a given barycentric coordinate, compute the corresponding z position
* (i.e. depth) on the triangle.
*/
__device__
static
float
getZAtCoordinate
(
const
float3
&
barycentricCoord
,
const
float
(
&
tri
)[
3
])
{
return
(
barycentricCoord
.
x
*
tri
[
0
]
+
barycentricCoord
.
y
*
tri
[
1
]
+
barycentricCoord
.
z
*
tri
[
2
]);
}
/*
* Convert source screen position to output screen coordinates.
*/
...
...
@@ -155,7 +166,8 @@ __device__ static
float new_depth = (maxlen == 0.0f) ? d[0] : (d[0]*dist1 + d[1]*dist2 + d[2]*dist3) / (dist1+dist2+dist3);
//if (new_depth < params.camera.minDepth || new_depth > params.camera.maxDepth) continue;*/
float
new_depth
=
d
[
0
];
//float new_depth = d[0]; //(A > 0) ? (B > 0) ? 6.0f : 5.0f : (B > 0) ? 4.0f : 3.0f;
float
new_depth
=
getZAtCoordinate
(
baryCentricCoordinate
,
d
);
atomicMin
(
&
depth_out
(
sx
,
sy
),
int
(
new_depth
*
1000.0
f
));
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment