Update C sources, add new functions

This commit is contained in:
Milan Nikolic 2018-05-06 09:34:11 +02:00
parent e6a1abb290
commit a6d36a3699
98 changed files with 7964 additions and 2985 deletions

View file

@ -23,4 +23,4 @@ void main()
// Calculate final vertex position
gl_Position = mvp*vec4(vertexPosition, 1.0);
}
}

View file

@ -13,8 +13,9 @@ out vec4 finalColor;
// NOTE: Add here your custom variables
const float renderWidth = 800.0; // HARDCODED for example!
const float renderHeight = 480.0; // Use uniforms instead...
// NOTE: Render size values should be passed from code
const float renderWidth = 800;
const float renderHeight = 450;
float radius = 250.0;
float angle = 0.8;

View file

@ -62,13 +62,13 @@ func main() {
raylib.BeginTextureMode(target) // Enable drawing to texture
raylib.Begin3dMode(camera)
raylib.BeginMode3D(camera)
raylib.DrawModel(dwarf, position, 2.0, raylib.White) // Draw 3d model with texture
raylib.DrawGrid(10, 1.0) // Draw a grid
raylib.End3dMode()
raylib.EndMode3D()
raylib.DrawText("TEXT DRAWN IN RENDER TEXTURE", 200, 10, 30, raylib.Red)
@ -77,7 +77,7 @@ func main() {
raylib.BeginShaderMode(shader)
// NOTE: Render texture must be y-flipped due to default OpenGL coordinates (left-bottom)
raylib.DrawTextureRec(target.Texture, raylib.NewRectangle(0, 0, target.Texture.Width, -target.Texture.Height), raylib.NewVector2(0, 0), raylib.White)
raylib.DrawTextureRec(target.Texture, raylib.NewRectangle(0, 0, float32(target.Texture.Width), float32(-target.Texture.Height)), raylib.NewVector2(0, 0), raylib.White)
raylib.EndShaderMode()

View file

@ -23,4 +23,4 @@ void main()
// Calculate final vertex position
gl_Position = mvp*vec4(vertexPosition, 1.0);
}
}

View file

@ -40,13 +40,13 @@ func main() {
raylib.ClearBackground(raylib.RayWhite)
raylib.Begin3dMode(camera)
raylib.BeginMode3D(camera)
raylib.DrawModel(dwarf, position, 2.0, raylib.White) // Draw 3d model with texture
raylib.DrawGrid(10, 1.0) // Draw a grid
raylib.End3dMode()
raylib.EndMode3D()
raylib.DrawText("(c) Dwarf 3D model by David Moreno", screenWidth-200, screenHeight-20, 10, raylib.Gray)

View file

@ -102,13 +102,13 @@ func main() {
raylib.BeginTextureMode(target) // Enable drawing to texture
raylib.Begin3dMode(camera)
raylib.BeginMode3D(camera)
raylib.DrawModel(dwarf, position, 2.0, raylib.White) // Draw 3d model with texture
raylib.DrawGrid(10, 1.0) // Draw a grid
raylib.End3dMode()
raylib.EndMode3D()
raylib.EndTextureMode() // End drawing to texture (now we have a texture available for next passes)
@ -116,7 +116,7 @@ func main() {
raylib.BeginShaderMode(shaders[currentShader])
// NOTE: Render texture must be y-flipped due to default OpenGL coordinates (left-bottom)
raylib.DrawTextureRec(target.Texture, raylib.NewRectangle(0, 0, target.Texture.Width, -target.Texture.Height), raylib.NewVector2(0, 0), raylib.White)
raylib.DrawTextureRec(target.Texture, raylib.NewRectangle(0, 0, float32(target.Texture.Width), float32(-target.Texture.Height)), raylib.NewVector2(0, 0), raylib.White)
raylib.EndShaderMode()

View file

@ -23,4 +23,4 @@ void main()
// Calculate final vertex position
gl_Position = mvp*vec4(vertexPosition, 1.0);
}
}