-
Notifications
You must be signed in to change notification settings - Fork 188
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
move cameras to per-map files #169
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
(-347.3, -278.2, -90.1) (-0.489, -0.685, -0.540) | ||
(1171.9, -1010.7, -369.2) (-0.764, 0.588, -0.266) | ||
(1004.4, 1200.4, -694.4) (-0.713, -0.619, -0.329) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
(1302.4, -2342.9, -70.1) (-0.672, 0.635, -0.381) | ||
(139.6, -1240.8, 262.9) (-0.532, -0.722, -0.442) | ||
(-529.9, -1038.6, 201.4) (-0.565, 0.653, -0.504) | ||
(-913.2, 215.9, 230.7) (-0.814, -0.457, -0.358) | ||
(618.1, -2516.6, -11.7) (-0.692, -0.575, -0.436) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
(-1049.7, -121.4, 115.1) (0.590, -0.539, -0.601) | ||
(-2167.2, -573.2, 305.4) (-0.224, 0.900, -0.374) | ||
(-1550.7, -875.6, 8.4) (-0.835, -0.441, -0.329) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
(-1095.1, -793.7, -102.4) (0.738, 0.557, -0.380) | ||
(-424.1, 296.2, 355.7) (0.898, 0.115, -0.424) | ||
(-1342.3, 321.9, 280.1) (-0.700, -0.004, -0.714) | ||
(1102.8, 173.4, 226.9) (0.626, 0.642, -0.442) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
(-603.2, -514.6, 951.3) (0.288, 0.930, -0.228) | ||
(691.6, -887.2, 895.8) (-0.694, 0.484, -0.533) | ||
(1404.9, -1161.3, 513.6) (0.538, 0.843, 0.005) | ||
(-618.4, 911.7, 352.7) (0.600, 0.656, -0.458) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
(94.6, 128.2, 325.2) (-0.002, -0.733, -0.681) | ||
(207.4, 1169.9, 308.3) (-0.615, -0.392, -0.684) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
(-2008.9, 678.2, 206.1) (0.001, -0.810, -0.586) | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/* | ||
Copyright (C) 2021, NVIDIA CORPORATION. All rights reserved. | ||
|
||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 2 of the License, or | ||
(at your option) any later version. | ||
|
||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
|
||
You should have received a copy of the GNU General Public License along | ||
with this program; if not, write to the Free Software Foundation, Inc., | ||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
*/ | ||
|
||
#include "cameras.h" | ||
#include "vkpt.h" | ||
|
||
#include <string.h> | ||
|
||
void | ||
vkpt_cameras_load(bsp_mesh_t* wm, const char* map_name) | ||
{ | ||
wm->num_cameras = 0; | ||
|
||
char* filebuf = NULL; | ||
|
||
char filename[MAX_QPATH]; | ||
Q_snprintf(filename, sizeof(filename), "maps/cameras/%s.txt", map_name); | ||
FS_LoadFile(filename, (void**)&filebuf); | ||
|
||
if (!filebuf) | ||
{ | ||
Com_DPrintf("Couldn't read %s\n", filename); | ||
return; | ||
} | ||
|
||
char const * ptr = (char const *)filebuf; | ||
char linebuf[1024]; | ||
|
||
while (sgets(linebuf, sizeof(linebuf), &ptr)) | ||
{ | ||
{ char* t = strchr(linebuf, '#'); if (t) *t = 0; } // remove comments | ||
{ char* t = strchr(linebuf, '\n'); if (t) *t = 0; } // remove newline | ||
|
||
vec3_t pos, dir; | ||
|
||
if (sscanf(linebuf, "(%f, %f, %f) (%f, %f, %f)", &pos[0], &pos[1], &pos[2], &dir[0], &dir[1], &dir[2]) == 6) | ||
{ | ||
if (wm->num_cameras < MAX_CAMERAS) | ||
{ | ||
VectorCopy(pos, wm->cameras[wm->num_cameras].pos); | ||
VectorCopy(dir, wm->cameras[wm->num_cameras].dir); | ||
wm->num_cameras++; | ||
} | ||
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. Could be helpful for map authors to print a message if |
||
} | ||
} | ||
|
||
Z_Free(filebuf); | ||
} | ||
|
||
static void Camera_Cmd_f(void) | ||
{ | ||
vec3_t forward; | ||
AngleVectors(vkpt_refdef.fd->viewangles, forward, NULL, NULL); | ||
|
||
Com_Printf("(%f, %f, %f) (%f, %f, %f)\n", vkpt_refdef.fd->vieworg[0], vkpt_refdef.fd->vieworg[1], vkpt_refdef.fd->vieworg[2], forward[0], forward[1], forward[2]); | ||
} | ||
|
||
static const cmdreg_t cmds[] = { | ||
{ "camera", &Camera_Cmd_f, NULL }, | ||
{ NULL, NULL, NULL } | ||
}; | ||
|
||
void vkpt_cameras_init(void) | ||
{ | ||
Cmd_Register(cmds); | ||
} | ||
|
||
void vkpt_cameras_shutdown(void) | ||
{ | ||
Cmd_RemoveCommand("camera"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
Copyright (C) 2021, NVIDIA CORPORATION. All rights reserved. | ||
|
||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 2 of the License, or | ||
(at your option) any later version. | ||
|
||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
|
||
You should have received a copy of the GNU General Public License along | ||
with this program; if not, write to the Free Software Foundation, Inc., | ||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
*/ | ||
|
||
#ifndef __CAMERAS_H_ | ||
#define __CAMERAS_H_ | ||
|
||
typedef struct bsp_mesh_s bsp_mesh_t; | ||
|
||
void vkpt_cameras_init(void); | ||
void vkpt_cameras_shutdown(void); | ||
void vkpt_cameras_load(bsp_mesh_t* wm, const char* map_name); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 to original
cameras.txt
had a comment for the "lab" map.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.
oops, thanks