mirror of
https://github.com/DrBeef/RTCWQuest.git
synced 2025-04-23 07:20:51 +00:00
failed attempt at laser beam
This commit is contained in:
parent
04352f89be
commit
39aac7000e
4 changed files with 96 additions and 5 deletions
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.drbeef.rtcwquest"
|
||||
android:versionCode="8"
|
||||
android:versionName="0.8.0" android:installLocation="auto" >
|
||||
android:versionCode="9"
|
||||
android:versionName="0.9.0" android:installLocation="auto" >
|
||||
|
||||
<!-- Tell the system this app requires OpenGL ES 3.1. -->
|
||||
<uses-feature android:glEsVersion="0x00030001" android:required="true"/>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
|
||||
RTCW_BASE_CFLAGS = \
|
||||
-fsigned-char \
|
||||
-Ofast -fomit-frame-pointer -ffast-math -fno-strict-aliasing -fstrength-reduce -ftree-vectorize -fsingle-precision-constant \
|
||||
-fsigned-char -O0 \
|
||||
-Ofast -ffast-math -fno-strict-aliasing -fstrength-reduce -ftree-vectorize -fsingle-precision-constant \
|
||||
-pipe -DPANDORA -DHAVE_GLES -DARM -DC_ONLY
|
||||
|
||||
#-DNEON -mfpu=neon
|
||||
|
|
|
@ -42,7 +42,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
// q_shared.h -- included first by ALL program modules.
|
||||
// A user mod should never modify this file
|
||||
|
||||
#define Q3_VERSION "Wolf 1.41"
|
||||
#define Q3_VERSION "RTCWQuest 0.9.0 (Wolf 1.41)"
|
||||
// ver 1.0.0 - release
|
||||
// ver 1.0.1 - post-release work
|
||||
// ver 1.1.0 - patch 1 (12/12/01)
|
||||
|
|
|
@ -399,6 +399,95 @@ void RE_AddCoronaToScene( const vec3_t org, float r, float g, float b, float sca
|
|||
cor->flags = flags;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void rotateAboutOrigin(float x, float y, float rotation, vec2_t out);
|
||||
void convertFromVR(float worldscale, vec3_t in, vec3_t offset, vec3_t out)
|
||||
{
|
||||
vec3_t vrSpace;
|
||||
VectorSet(vrSpace, in[2], in[0], in[1] );
|
||||
|
||||
vec2_t r;
|
||||
rotateAboutOrigin(vrSpace[0], vrSpace[1], cl.viewangles[YAW] - vr.hmdorientation[YAW], r);
|
||||
vrSpace[0] = -r[0];
|
||||
vrSpace[1] = -r[1];
|
||||
|
||||
vec3_t temp;
|
||||
VectorScale(vrSpace, worldscale, temp);
|
||||
|
||||
if (offset) {
|
||||
VectorAdd(temp, offset, out);
|
||||
} else {
|
||||
VectorCopy(temp, out);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
RB_SurfaceBeam
|
||||
==============
|
||||
*/
|
||||
void R_LaserBeam( vec3_t vieworigin ) {
|
||||
#define NUM_BEAM_SEGS 6
|
||||
int i;
|
||||
vec3_t angles;
|
||||
vec3_t perpvec;
|
||||
vec3_t direction, normalized_direction;
|
||||
vec3_t start_points[NUM_BEAM_SEGS], end_points[NUM_BEAM_SEGS];
|
||||
vec3_t oldorigin, origin;
|
||||
|
||||
float worldscale = Cvar_VariableValue("cg_worldScale");
|
||||
float heightAdjust = Cvar_VariableValue("cg_heightAdjust");
|
||||
convertFromVR(worldscale, vr.weaponoffset, vieworigin, origin);
|
||||
origin[2] -= 24; // mmmmmmm magic number
|
||||
origin[2] += (vr.hmdposition[1] + heightAdjust) * worldscale;
|
||||
|
||||
VectorCopy(vr.weaponangles, angles);
|
||||
angles[YAW] += cl.viewangles[YAW] - vr.hmdorientation[YAW];
|
||||
|
||||
vec3_t forward;
|
||||
AngleVectors(angles, forward, NULL, NULL);
|
||||
VectorMA( origin, 256, forward, oldorigin );
|
||||
|
||||
normalized_direction[0] = direction[0] = oldorigin[0] - origin[0];
|
||||
normalized_direction[1] = direction[1] = oldorigin[1] - origin[1];
|
||||
normalized_direction[2] = direction[2] = oldorigin[2] - origin[2];
|
||||
|
||||
PerpendicularVector( perpvec, normalized_direction );
|
||||
|
||||
VectorScale( perpvec, 4, perpvec );
|
||||
|
||||
for ( i = 0; i < NUM_BEAM_SEGS ; i++ )
|
||||
{
|
||||
RotatePointAroundVector( start_points[i], normalized_direction, perpvec, ( 360.0 / NUM_BEAM_SEGS ) * i );
|
||||
VectorAdd( start_points[i], direction, end_points[i] );
|
||||
}
|
||||
|
||||
GL_Bind( tr.whiteImage );
|
||||
|
||||
GL_State( GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE );
|
||||
|
||||
qglColor3f( 1, 0, 0 );
|
||||
|
||||
GLboolean text = qglIsEnabled(GL_TEXTURE_COORD_ARRAY);
|
||||
GLboolean glcol = qglIsEnabled(GL_COLOR_ARRAY);
|
||||
if (glcol)
|
||||
qglDisableClientState(GL_COLOR_ARRAY);
|
||||
if (text)
|
||||
qglDisableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
GLfloat vtx[NUM_BEAM_SEGS*6+6];
|
||||
for ( i = 0; i <= NUM_BEAM_SEGS; i++ ) {
|
||||
memcpy(vtx+i*6, start_points[ i % NUM_BEAM_SEGS], sizeof(GLfloat)*3);
|
||||
memcpy(vtx+i*6+3, end_points[ i % NUM_BEAM_SEGS], sizeof(GLfloat)*3);
|
||||
}
|
||||
qglVertexPointer (3, GL_FLOAT, 0, vtx);
|
||||
qglDrawArrays(GL_TRIANGLE_STRIP, 0, NUM_BEAM_SEGS*2+2);
|
||||
if (glcol)
|
||||
qglEnableClientState(GL_COLOR_ARRAY);
|
||||
if (text)
|
||||
qglEnableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
}
|
||||
|
||||
/*
|
||||
@@@@@@@@@@@@@@@@@@@@@
|
||||
RE_RenderScene
|
||||
|
@ -568,6 +657,8 @@ void RE_RenderScene( const refdef_t *fd ) {
|
|||
|
||||
R_RenderView( &parms );
|
||||
|
||||
R_LaserBeam (fd->vieworg);
|
||||
|
||||
// the next scene rendered in this frame will tack on after this one
|
||||
r_firstSceneDrawSurf = tr.refdef.numDrawSurfs;
|
||||
r_firstSceneEntity = r_numentities;
|
||||
|
|
Loading…
Reference in a new issue