restructure

This commit is contained in:
Nishi 2026-01-07 04:35:00 +09:00
commit 2c4198fbc6
Signed by: nishi
GPG key ID: 27EF69B208EB9343
5 changed files with 13 additions and 1 deletions

View file

@ -4,6 +4,16 @@ project(assaultfish)
include(GNUInstallDirs)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
macro(install_target name)
install(
TARGETS ${name}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endmacro()
add_subdirectory(external/glad)
add_subdirectory(net)

View file

@ -12,3 +12,5 @@ target_include_directories(gbnet PRIVATE ${ZLIB_INCLUDE_DIRS})
target_link_options(gbnet PRIVATE ${ZLIB_LDFLAGS_OTHER})
target_link_directories(gbnet PRIVATE ${ZLIB_LIBRARY_DIRS})
target_link_libraries(gbnet PRIVATE ${ZLIB_LIBRARIES})
install_target(gbnet)

19
engine/resource/shadow.fs Normal file
View file

@ -0,0 +1,19 @@
#version 110
uniform sampler2DShadow texture;
varying vec4 shadow;
varying vec4 color;
uniform float solid_color;
uniform sampler2D texture_in;
void main (void){
vec4 c;
if(solid_color > 0.5){
c = color;
}else{
c = texture2D(texture_in, gl_TexCoord[1].st);
}
gl_FragColor = (shadow + (gl_Color - shadow) * shadow2DProj(texture, gl_TexCoord[0])) * c;
}

28
engine/resource/shadow.vs Normal file
View file

@ -0,0 +1,28 @@
#version 110
varying vec4 shadow;
varying vec4 color;
void main(void){
vec3 position = vec3(gl_ModelViewMatrix * gl_Vertex);
vec3 normal = normalize(gl_NormalMatrix * gl_Normal);
vec3 light = normalize(gl_LightSource[0].position.xyz - position);
float diffuse = dot(light, normal);
color = gl_Color;
gl_FrontColor = gl_LightSource[0].ambient;
shadow = gl_FrontColor;
if (diffuse > 0.0){
vec3 view = normalize(position);
vec3 halfway = normalize(light - view);
float specular = pow(max(dot(normal, halfway), 0.0), gl_FrontMaterial.shininess);
vec4 temp = gl_LightSource[0].diffuse * diffuse;
shadow += temp * 0.2;
gl_FrontColor += temp + gl_FrontLightProduct[0].specular * specular;
}
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_ModelViewMatrix * gl_Vertex;
gl_TexCoord[1] = gl_MultiTexCoord0;
gl_Position = ftransform();
}