Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
VkCV Framework
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
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
Vulkan2021
VkCV Framework
Commits
fd1f745f
Commit
fd1f745f
authored
3 years ago
by
Vanessa Karolek
Browse files
Options
Downloads
Patches
Plain Diff
[
#94
] replace vkcv::sfrScene::TextureData by vkcv::asset::Texture
parent
8bf8f8e0
No related branches found
No related tags found
1 merge request
!77
Resolve "SAF-R Module"
Pipeline
#26984
passed
3 years ago
Stage: build
Stage: deploy
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
projects/saf_r/src/main.cpp
+1
-1
1 addition, 1 deletion
projects/saf_r/src/main.cpp
projects/saf_r/src/safrScene.cpp
+5
-4
5 additions, 4 deletions
projects/saf_r/src/safrScene.cpp
projects/saf_r/src/safrScene.hpp
+1
-11
1 addition, 11 deletions
projects/saf_r/src/safrScene.hpp
with
7 additions
and
16 deletions
projects/saf_r/src/main.cpp
+
1
−
1
View file @
fd1f745f
...
...
@@ -101,7 +101,7 @@ int main(int argc, const char** argv) {
lights
.
push_back
(
safrScene
::
Light
(
glm
::
vec3
(
30
,
20
,
30
),
1.7
));
//create the raytracer image for rendering
safrScene
scene
;
safrScene
::
Texture
Data
texData
=
scene
.
render
(
spheres
,
lights
);
vkcv
::
asset
::
Texture
texData
=
scene
.
render
(
spheres
,
lights
);
vkcv
::
Image
texture
=
core
.
createImage
(
vk
::
Format
::
eR8G8B8A8Unorm
,
texData
.
width
,
texData
.
height
);
texture
.
fill
(
texData
.
data
.
data
());
...
...
This diff is collapsed.
Click to expand it.
projects/saf_r/src/safrScene.cpp
+
5
−
4
View file @
fd1f745f
...
...
@@ -56,7 +56,7 @@ glm::vec3 safrScene::castRay(const glm::vec3& orig, const glm::vec3& dir, const
glm
::
vec3
(
1.
,
1.
,
1.
)
*
specular_light_intensity
*
material
.
albedo
[
1
]
+
reflect_color
*
material
.
albedo
[
2
];
}
safrScene
::
Texture
Data
safrScene
::
render
(
const
std
::
vector
<
safrScene
::
Sphere
>&
spheres
,
const
std
::
vector
<
safrScene
::
Light
>&
lights
)
{
vkcv
::
asset
::
Texture
safrScene
::
render
(
const
std
::
vector
<
safrScene
::
Sphere
>&
spheres
,
const
std
::
vector
<
safrScene
::
Light
>&
lights
)
{
//constants for the image data
const
int
width
=
800
;
const
int
height
=
600
;
...
...
@@ -86,12 +86,13 @@ safrScene::TextureData safrScene::render(const std::vector<safrScene::Sphere>& s
data
.
push_back
(
static_cast
<
uint8_t
>
(
255.
f
));
}
safrScene
::
TextureData
textureData
;
vkcv
::
asset
::
Texture
textureData
;
textureData
.
width
=
width
;
textureData
.
height
=
height
;
textureData
.
c
omponentCount
=
4
;
textureData
.
c
hannels
=
4
;
textureData
.
data
.
resize
(
textureData
.
width
*
textureData
.
height
*
textureData
.
c
omponentCount
);
textureData
.
data
.
resize
(
textureData
.
width
*
textureData
.
height
*
textureData
.
c
hannels
);
memcpy
(
textureData
.
data
.
data
(),
data
.
data
(),
textureData
.
data
.
size
());
return
textureData
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
projects/saf_r/src/safrScene.hpp
+
1
−
11
View file @
fd1f745f
...
...
@@ -14,16 +14,6 @@ class safrScene {
public:
/**
* WORKAROUND
* moved the texture data struct from the old asset loader version, because it is necessary for our rendering for now
*/
struct
TextureData
{
int
width
;
int
height
;
int
componentCount
;
std
::
vector
<
char
*>
data
;
};
/*
* Light struct with a position and intensity of the light source
*/
...
...
@@ -79,7 +69,7 @@ public:
* @param vector: all light sources in the scene
* @return TextureData: texture data for the buffers
*/
Texture
Data
render
(
const
std
::
vector
<
Sphere
>&
spheres
,
const
std
::
vector
<
Light
>&
lights
);
vkcv
::
asset
::
Texture
render
(
const
std
::
vector
<
Sphere
>&
spheres
,
const
std
::
vector
<
Light
>&
lights
);
private
:
/*
...
...
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