@CoffeeGrunt:
Good question... I completely forgot to tell everyone how to use that feature. (The gun-camera)
Okay, here's how it works:
You set it up through the gun's gunspec.txt file
Here is the section of the gunspec that will set everything up
;Ply's Mod Camera
usercamera = 0
cameratex = gun_D.dds
cameratexx = 666
cameratexy = 33
cameratexxsize = 35
cameratexysize = 103
cameratexrotation = -1
cameratexquality = 5
cameratexuseshader = 1
cameratexshaderstage = 6
"usercamera" tells the engine what camera it will be using for the gun-camera. Giving it a value of "0"
WILL NOT turn it off!! A value of "0" tells the engine to use the player's camera.
"cameratex" tells the engine what texture file (located in the same directory as the gunspec) it should use to put the gun-camera on. This does not have to be the same as the "textured" option. FYI, this option means nothing at all if you are using a shader with the weapon.
"cameratexx" and "cameratexy" will tell the engine what location ON the texture specified it should place the camera image. This coordinate will be the
top-left corner of the camera's desired area.
This should ALWAYS be the top-left corner of the desired area, even if you are wanting to rotate the camera image.
"cameratexxsize" and "cameratexysize" will tell the engine how large the camera texture should be. Alter these to make the camera image form-fit to the desired area.
NOTE: These values should reflect the size of the image BEFORE rotation occurs.
"cameratexrotation" tells the engine how it should rotate the camera image before it is placed onto the texture. This needs to be an
integer value from -1 to 2. The rotation will be 90 degrees multiplied by this value, so a value of 1 will rotate it 90 degrees clockwise, a value of 2 will rotate it 180 degrees, and a value of -1 will rotate it -90 degrees (or 270, same thing).
"cameratexquality" determines the
framerate of the camera image on your gun. A value of 5 will make the camera image update every 5 frames. A value of 20 will make the camera update every 20 frames. So, to have a "perfect" framerate with your gun-camera, make the value 0, which will have the camera update every frame.
If you experience lag with the camera, try increasing the quality value, so that the camera updates less frequently.
"cameratexuseshader" will tell the engine whether or not the camera image will be placed onto the diffuse texture (the texture specified in either "textured" or "cameratex") or if it will have it's own pre-made texture to be used with a shader. If you want to use a shader with your gun, you DO NOT have to set this value to 1. Setting this to 1 assumes that you are using a shader DESIGNED for use with this feature.
NOTE: Setting this to 1 will save on framerate, but you will need to use a shader that can use this feature. See below for an example shader that this feature will work with
"cameratexshaderstage" will tell the engine what texture stage the camera image will be placed in, assuming you have set the previous option to 1. If "cameratexuseshader" is not set to 1, then this option will be meaningless and won't be necessary. This option will need to be set to the appropriate texture stage that your shader will be using for the camera image. If you have set "cameratexuseshader" to 1 and neglect to set this option, you may experience undesired results, such as a pure black weapon that only has the camera image visible.
There, that's everything explained about how this system works and how to set it up.
The options I displayed above in the code snippet work for the stock scifi/assaultrifle. I have attached to this post a texture for the assault rifle that you may use with this system. You will notice that the LCD display that USED to be on the rifle has been removed and replaced with a black square... that is the area that the camera image will be placed. If you load it up into an image editor, you will notice that the
top-left coordinate of that black area is the same coordinate that is specified in the "cameratexx" and "cameratexy" setup options. You will also notice that it is the same SIZE as the size settings I've given in the setup options, but are
reversed. This is because I wanted the camera image to be rotated by -90 degrees, and the camera's size is set BEFORE the rotation occurs.
So, since the camera's size is bigger in the y direction (up and down) than it is in the x direction (side to side), the camera image will be tall and somewhat thin.
One last note for the sizing:
You may use whatever size you want for the camera image. It WILL NOT stretch the original image at all, the leftover areas will just be cropped off, so as to maintain the original aspect ratio of the camera. This lets the camera attain ANY size, without losing aspect quality.
If you're wanting to use the "cameratexuseshader" option to boost your framerate a little bit, you may use the "BumpCubeReflectIlluminateSpecOver" shader that I made since that was designed to be used for this, as well as let you use pretty much every other special shader effect. The texture stage that the camera should use is 6.
Thank you, that is all.
*disappears back into the shadows*
The one and only,