diff --git a/CMakeLists.txt b/CMakeLists.txt index 27ff1eb064f..be0194cdb3d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -98,9 +98,9 @@ link_directories("${LEVIATHAN_SRC}/build/bin") # Version set(PROGRAM_VERSION_STABLE 0) set(PROGRAM_VERSION_MAJOR 4) -set(PROGRAM_VERSION_MINOR 1) -set(PROGRAM_VERSION_PATCH 1) -set(PROGRAM_VERSION_SUFFIX "") +set(PROGRAM_VERSION_MINOR 2) +set(PROGRAM_VERSION_PATCH 0) +set(PROGRAM_VERSION_SUFFIX "-alpha") set(PROGRAM_VERSION_STR ${PROGRAM_VERSION_STABLE}.${PROGRAM_VERSION_MAJOR}.${PROGRAM_VERSION_MINOR}.${PROGRAM_VERSION_PATCH}${PROGRAM_VERSION_SUFFIX}) set(PROGRAM_VERSION ${PROGRAM_VERSION_STABLE}.${PROGRAM_VERSION_MAJOR}${PROGRAM_VERSION_MINOR}${PROGRAM_VERSION_PATCH}) @@ -143,10 +143,13 @@ file(GLOB THRIVE_SCRIPTS "scripts/*") file(COPY ${THRIVE_SCRIPTS} DESTINATION "${PROJECT_BINARY_DIR}/bin/Data/Scripts") InstallContentsOfFolder("scripts" "bin/Data/Scripts") -# Right now we only use what the engine needs -# # Copy javascript libraries -# file(GLOB THRIVE_VENDOR_SCRIPTS "assets/jsvendor/*") -# file(COPY ${THRIVE_VENDOR_SCRIPTS} DESTINATION "${PROJECT_BINARY_DIR}/bin/Data/jsvendor") +file(GLOB THRIVE_MATERIALS "materials/*") +file(COPY ${THRIVE_MATERIALS} DESTINATION "${PROJECT_BINARY_DIR}/bin/Data/Materials/") +InstallContentsOfFolder("materials" "bin/Data/Materials") + +file(GLOB THRIVE_SHADERS "shaders/*") +file(COPY ${THRIVE_SHADERS} DESTINATION "${PROJECT_BINARY_DIR}/bin/Data/Shaders/") +InstallContentsOfFolder("shaders" "bin/Data/Shaders") # Copy other data assets file(GLOB THRIVE_TEXTURES "assets/textures/*") @@ -158,11 +161,6 @@ file(GLOB THRIVE_FONTS "assets/fonts/*") file(COPY ${THRIVE_FONTS} DESTINATION "${PROJECT_BINARY_DIR}/bin/Data/Fonts/") InstallContentsOfFolder("assets/fonts" "bin/Data/Fonts") - -file(GLOB THRIVE_MATERIALS "assets/materials/*") -file(COPY ${THRIVE_MATERIALS} DESTINATION "${PROJECT_BINARY_DIR}/bin/Data/Materials/") -InstallContentsOfFolder("assets/materials" "bin/Data/Materials") - file(GLOB THRIVE_MODELS "assets/models/*") file(COPY ${THRIVE_MODELS} DESTINATION "${PROJECT_BINARY_DIR}/bin/Data/Models/") InstallContentsOfFolder("assets/models" "bin/Data/Models") diff --git a/materials/ER.material b/materials/ER.material new file mode 100644 index 00000000000..bda54dcac6e --- /dev/null +++ b/materials/ER.material @@ -0,0 +1,35 @@ +material ER +{ + receive_shadows on + + technique + { + pass ER + { + // lighting off + + scene_blend alpha_blend + depth_write off + + vertex_program_ref Organelle_VS + { + param_named_auto worldViewProj worldviewproj_matrix + param_named_auto time time_0_2pi 20 + param_named size float 0.05 + param_named maxRot float 15 + } + fragment_program_ref Organelle_PS + { + param_named tex int 0 + param_named_auto organelleColour custom 1 + } + + texture_unit + { + texture ER.png gamma + alpha_op_ex modulate src_manual src_texture 0.7 + colour_op_ex modulate src_manual src_texture 1.0 1.0 1.0 + } + } + } +} diff --git a/materials/agent_vacuole.material b/materials/agent_vacuole.material new file mode 100644 index 00000000000..141a695e86b --- /dev/null +++ b/materials/agent_vacuole.material @@ -0,0 +1,53 @@ + + +material AgentVacuoleMaterial3 +{ + receive_shadows on + + technique + { + pass AgentVacuoleMaterial3 + { + ambient 0.800000011920929 0.800000011920929 0.800000011920929 1.0 + diffuse 0.6400000190734865 0.6400000190734865 0.6400000190734865 1.0 + specular 0.0 0.0 0.0 1.0 12.5 + emissive 0.4000000059604645 0.4000000059604645 0.4000000059604645 1.0 + + alpha_to_coverage off + colour_write on + cull_hardware clockwise + depth_check on + depth_func less_equal + depth_write on + illumination_stage + light_clip_planes off + light_scissor off + // lighting on + // normalise_normals off + polygon_mode solid + scene_blend one zero + scene_blend_op add + shading gouraud + // transparent_sorting on + + vertex_program_ref Organelle_VS + { + param_named size float 0.01 + param_named maxRot float 180 + } + fragment_program_ref Organelle_PS + { + param_named tex int 0 + param_named_auto organelleColour custom 1 + } + texture_unit + { + texture AgentVacuole.png gamma + tex_address_mode wrap + scale 1.0 1.0 + tex_coord_set 0 + colour_op modulate + } + } + } +} diff --git a/materials/background.material b/materials/background.material new file mode 100644 index 00000000000..ce563b958ca --- /dev/null +++ b/materials/background.material @@ -0,0 +1,438 @@ +material Background +{ + //Epipelagic + technique + { + pass + { + // scene_blend alpha_blend + depth_write off + depth_check off + + vertex_program_ref Background_VS + { + } + fragment_program_ref Background_PS + { + } + texture_unit 0 + { + filtering none + tex_coord_set 0 + texture background/Thrive_ocean0.png 2d gamma + } + texture_unit 1 + { + filtering none + tex_coord_set 1 + texture background/Thrive_ocean1.png 2d gamma + } + texture_unit 2 + { + filtering none + tex_coord_set 2 + texture background/Thrive_ocean2.png 2d gamma + } + texture_unit 3 + { + filtering none + tex_coord_set 3 + texture background/Thrive_ocean3.png 2d gamma + } + } + } +} + +material Background_Vent +{ + technique + { + pass + { + // scene_blend alpha_blend + depth_write off + depth_check off + + vertex_program_ref Background_VS + { + } + fragment_program_ref Background_PS + { + } + texture_unit 0 + { + filtering none + tex_coord_set 0 + texture background/Thrive_vent0.png 2d gamma + } + texture_unit 1 + { + filtering none + tex_coord_set 1 + texture background/Thrive_vent1.png 2d gamma + } + texture_unit 2 + { + filtering none + tex_coord_set 2 + texture background/Thrive_vent2.png 2d gamma + } + texture_unit 3 + { + filtering none + tex_coord_set 3 + texture background/Thrive_vent3.png 2d gamma + } + } + } +} + +material Background_Bathypalagic +{ + technique + { + pass + { + // scene_blend alpha_blend + depth_write off + depth_check off + + vertex_program_ref Background_VS + { + } + fragment_program_ref Background_PS + { + } + texture_unit 0 + { + filtering none + tex_coord_set 0 + texture background/Thrive_abyss0.png 2d gamma + } + texture_unit 1 + { + filtering none + tex_coord_set 1 + texture background/Thrive_abyss1.png 2d gamma + } + texture_unit 2 + { + filtering none + tex_coord_set 2 + texture background/Thrive_abyss2.png 2d gamma + } + texture_unit 3 + { + filtering none + tex_coord_set 3 + texture background/Thrive_abyss3.png 2d gamma + } + } + } +} +material Background_Tidepool +{ + technique + { + pass + { + // scene_blend alpha_blend + depth_write off + depth_check off + + vertex_program_ref Background_VS + { + } + fragment_program_ref Background_PS + { + } + texture_unit 0 + { + filtering none + tex_coord_set 0 + texture background/Thrive_tidepool0.png 2d gamma + } + texture_unit 1 + { + filtering none + tex_coord_set 1 + texture background/Thrive_tidepool1.png 2d gamma + } + texture_unit 2 + { + filtering none + tex_coord_set 2 + texture background/Thrive_tidepool2.png 2d gamma + } + texture_unit 3 + { + filtering none + tex_coord_set 3 + texture background/Thrive_tidepool3.png 2d gamma + } + } + } +} +material Background_Coastal +{ + technique + { + pass + { + // scene_blend alpha_blend + depth_write off + depth_check off + + vertex_program_ref Background_VS + { + } + fragment_program_ref Background_PS + { + } + texture_unit 0 + { + filtering none + tex_coord_set 0 + texture background/Thrive_shallow0.png 2d gamma + } + texture_unit 1 + { + filtering none + tex_coord_set 1 + texture background/Thrive_shallow1.png 2d gamma + } + texture_unit 2 + { + filtering none + tex_coord_set 2 + texture background/Thrive_shallow2.png 2d gamma + } + texture_unit 3 + { + filtering none + tex_coord_set 3 + texture background/Thrive_shallow3.png 2d gamma + } + } + } +} + +material Background_Cave +{ + technique + { + pass + { + // scene_blend alpha_blend + depth_write off + depth_check off + + vertex_program_ref Background_VS + { + } + fragment_program_ref Background_PS + { + } + texture_unit 0 + { + filtering none + tex_coord_set 0 + texture background/Thrive_cave0.png 2d gamma + } + texture_unit 1 + { + filtering none + tex_coord_set 1 + texture background/Thrive_cave1.png 2d gamma + } + texture_unit 2 + { + filtering none + tex_coord_set 2 + texture background/Thrive_cave2.png 2d gamma + } + texture_unit 3 + { + filtering none + tex_coord_set 3 + texture background/Thrive_cave3.png 2d gamma + } + } + } +} + +material Background_Iceshelf +{ + technique + { + pass + { + // scene_blend alpha_blend + depth_write off + depth_check off + + vertex_program_ref Background_VS + { + } + fragment_program_ref Background_PS + { + } + texture_unit 0 + { + filtering none + tex_coord_set 0 + texture background/Thrive_iceshelf0.png 2d gamma + } + texture_unit 1 + { + filtering none + tex_coord_set 1 + texture background/Thrive_iceshelf1.png 2d gamma + } + texture_unit 2 + { + filtering none + tex_coord_set 2 + texture background/Thrive_iceshelf2.png 2d gamma + } + texture_unit 3 + { + filtering none + tex_coord_set 3 + texture background/Thrive_iceshelf3.png 2d gamma + } + } + } +} + +material Background_Mesopelagic +{ + technique + { + pass + { + // scene_blend alpha_blend + depth_write off + depth_check off + + vertex_program_ref Background_VS + { + } + fragment_program_ref Background_PS + { + } + texture_unit 0 + { + filtering none + tex_coord_set 0 + texture background/Thrive_meso0.png 2d gamma + } + texture_unit 1 + { + filtering none + tex_coord_set 1 + texture background/Thrive_meso1.png 2d gamma + } + texture_unit 2 + { + filtering none + tex_coord_set 2 + texture background/Thrive_meso2.png 2d gamma + } + texture_unit 3 + { + filtering none + tex_coord_set 3 + texture background/Thrive_meso3.png 2d gamma + } + } + } +} + +material Background_Estuary +{ + technique + { + pass + { + // scene_blend alpha_blend + depth_write off + depth_check off + + vertex_program_ref Background_VS + { + } + fragment_program_ref Background_PS + { + } + texture_unit 0 + { + filtering none + tex_coord_set 0 + texture background/Thrive_estuary0.png 2d gamma + } + texture_unit 1 + { + filtering none + tex_coord_set 1 + texture background/Thrive_estuary1.png 2d gamma + } + texture_unit 2 + { + filtering none + tex_coord_set 2 + texture background/Thrive_estuary2.png 2d gamma + } + texture_unit 3 + { + filtering none + tex_coord_set 3 + texture background/Thrive_estuary3.png 2d gamma + } + } + } +} + +material Background_Seafloor +{ + technique + { + pass + { + // scene_blend alpha_blend + depth_write off + depth_check off + + vertex_program_ref Background_VS + { + } + fragment_program_ref Background_PS + { + } + texture_unit 0 + { + filtering none + tex_coord_set 0 + texture background/Thrive_seafloor0.png 2d gamma + } + texture_unit 1 + { + filtering none + tex_coord_set 1 + texture background/Thrive_seafloor1.png 2d gamma + } + texture_unit 2 + { + filtering none + tex_coord_set 2 + texture background/Thrive_seafloor2.png 2d gamma + } + texture_unit 3 + { + filtering none + tex_coord_set 3 + texture background/Thrive_seafloor3.png 2d gamma + } + } + } +} diff --git a/materials/chemoplast.material b/materials/chemoplast.material new file mode 100644 index 00000000000..ba25032bccd --- /dev/null +++ b/materials/chemoplast.material @@ -0,0 +1,35 @@ +material chemoplast +{ + receive_shadows on + + technique + { + pass chemoplast + { + // lighting off + + scene_blend alpha_blend + depth_write off + + vertex_program_ref Organelle_VS + { + param_named_auto worldViewProj worldviewproj_matrix + param_named_auto time time_0_2pi 20 + param_named size float 0.05 + param_named maxRot float 15 + } + fragment_program_ref Organelle_PS + { + param_named tex int 0 + param_named_auto organelleColour custom 1 + } + + texture_unit + { + texture chemoplast.png gamma + alpha_op_ex modulate src_manual src_texture .7 + colour_op_ex modulate src_manual src_texture 1.0 1.0 1.0 + } + } + } +} diff --git a/materials/chemoproteins.material b/materials/chemoproteins.material new file mode 100644 index 00000000000..2d4025b969c --- /dev/null +++ b/materials/chemoproteins.material @@ -0,0 +1,36 @@ +material chemoproteins +{ + receive_shadows on + + technique + { + pass chemoproteins + { + // lighting off + + scene_blend alpha_blend + depth_write on + point_sprites on + + vertex_program_ref Organelle_VS + { + param_named_auto worldViewProj worldviewproj_matrix + param_named_auto time time_0_2pi 20 + param_named size float 0.05 + param_named maxRot float 15 + } + fragment_program_ref Organelle_PS + { + param_named tex int 0 + param_named_auto organelleColour custom 1 + } + + texture_unit + { + texture chemoproteins.png gamma + alpha_op_ex modulate src_manual src_texture .7 + colour_op_ex modulate src_manual src_texture 1.0 1.0 1.0 + } + } + } +} diff --git a/materials/chloroplast.material b/materials/chloroplast.material new file mode 100644 index 00000000000..1c5b5ccb7e0 --- /dev/null +++ b/materials/chloroplast.material @@ -0,0 +1,35 @@ +material chloroplast +{ + receive_shadows on + + technique + { + pass chloroplast + { + // lighting off + + scene_blend alpha_blend + depth_write off + + vertex_program_ref Organelle_VS + { + param_named_auto worldViewProj worldviewproj_matrix + param_named_auto time time_0_2pi 20 + param_named size float 0.05 + param_named maxRot float 15 + } + fragment_program_ref Organelle_PS + { + param_named tex int 0 + param_named_auto organelleColour custom 1 + } + + texture_unit + { + texture chloroplast.png gamma + alpha_op_ex modulate src_manual src_texture .7 + colour_op_ex modulate src_manual src_texture 1.0 1.0 1.0 + } + } + } +} diff --git a/materials/chromatophores.material b/materials/chromatophores.material new file mode 100644 index 00000000000..556f3a5edc4 --- /dev/null +++ b/materials/chromatophores.material @@ -0,0 +1,36 @@ +material chromatophores +{ + receive_shadows on + + technique + { + pass chromatophores + { + // lighting off + + scene_blend alpha_blend + depth_write on + point_sprites on + + vertex_program_ref Organelle_VS + { + param_named_auto worldViewProj worldviewproj_matrix + param_named_auto time time_0_2pi 20 + param_named size float 0.05 + param_named maxRot float 15 + } + fragment_program_ref Organelle_PS + { + param_named tex int 0 + param_named_auto organelleColour custom 1 + } + + texture_unit + { + texture chromatophores.png gamma + alpha_op_ex modulate src_manual src_texture .7 + colour_op_ex modulate src_manual src_texture 1.0 1.0 1.0 + } + } + } +} diff --git a/materials/editor_grid.material b/materials/editor_grid.material new file mode 100644 index 00000000000..2f2920ad7cb --- /dev/null +++ b/materials/editor_grid.material @@ -0,0 +1,51 @@ +vertex_program EditorGridVertex glsl +{ + source vertex_scaled_uv.glsl +} + +fragment_program EditorGridPixel glsl +{ + source basic_unlit_pixel.glsl +} + +material EditorGridMaterial +{ + technique + { + pass + { + scene_blend alpha_blend + + vertex_program_ref EditorGridVertex + { + param_named_auto worldViewProj worldviewproj_matrix + // This was in the original version but this seems to look wrong + // param_named scale float2 0.0012 0.000693 + param_named scale float2 0.12 0.0693 + } + + fragment_program_ref EditorGridPixel + { + param_named tex int 0 + } + + texture_unit + { + texture editor_grid.png gamma + } + } + } +} + +// hlms EditorGridMaterial unlit +// { +// scene_blend alpha_blend +// // diffuse_map editor_grid.png + + +// detail_map0 editor_grid.png +// detail_offset_scale0 0 0 0.0012 0.000693 +// //roughness_map editor_grid.png +// } + + diff --git a/materials/editor_hex.material b/materials/editor_hex.material new file mode 100644 index 00000000000..4ecc9a36e6c --- /dev/null +++ b/materials/editor_hex.material @@ -0,0 +1,13 @@ +// Material for the hex inside the cell editor +hlms EditorHexMaterial unlit +{ + diffuse_map single_hex.png +} + +hlms EditorHexMaterialInvalid unlit +{ + diffuse_map single_hex_invalid.png +} + + +// This is an alternative that has the icon of the organelle on it \ No newline at end of file diff --git a/materials/flagellum.material b/materials/flagellum.material new file mode 100644 index 00000000000..5ba1aec4e18 --- /dev/null +++ b/materials/flagellum.material @@ -0,0 +1,20 @@ + +// Dirty hack by using the same image for all maps to fix ItemIdentityException: +// Parameter called textureMaps[0] does not exist +hlms flagellum pbs +{ + // diffuse 1 1 1 + + // specular 1 1 1 + + // emissive 0.2 0.2 0.2 + + roughness 0.4 + fresnel 1.33 + + diffuse_map flagellum.png + normal_map flagellum.png + roughness_map flagellum.png + specular_map flagellum.png +} + diff --git a/materials/golgi.material b/materials/golgi.material new file mode 100644 index 00000000000..76bc1ad803b --- /dev/null +++ b/materials/golgi.material @@ -0,0 +1,35 @@ +material golgi +{ + receive_shadows on + + technique + { + pass golgi + { + // lighting off + + scene_blend alpha_blend + depth_write off + + vertex_program_ref Organelle_VS + { + param_named_auto worldViewProj worldviewproj_matrix + param_named_auto time time_0_2pi 20 + param_named size float 0.05 + param_named maxRot float 15 + } + fragment_program_ref Organelle_PS + { + param_named tex int 0 + param_named_auto organelleColour custom 1 + } + + texture_unit + { + texture GolgiApparatus.png gamma + alpha_op_ex modulate src_manual src_texture 0.7 + colour_op_ex modulate src_manual src_texture 1.0 1.0 1.0 + } + } + } +} diff --git a/materials/ice_crystal.material b/materials/ice_crystal.material new file mode 100644 index 00000000000..1c6eb401f93 --- /dev/null +++ b/materials/ice_crystal.material @@ -0,0 +1,22 @@ +hlms ice_crystal pbs +{ + roughness 0.01 + fresnel 5.0 + + diffuse_map ice_crystal.png + normal_map ice_crystal.png + roughness_map ice_crystal.png + specular_map ice_crystal.png +} + +hlms icecrystal pbs +{ + roughness 0.01 + fresnel 5.0 + + diffuse_map icecrystal.png + normal_map icecrystal.png + roughness_map icecrystal.png + specular_map icecrystal.png +} + diff --git a/materials/iron.material b/materials/iron.material new file mode 100644 index 00000000000..2750392e7e4 --- /dev/null +++ b/materials/iron.material @@ -0,0 +1,55 @@ +hlms iron_01 pbs +{ + roughness 1.33 + fresnel 0.04 + + diffuse_map iron_01.png + normal_map iron_bump.png + roughness_map iron_bump.png + specular_map iron_01.png +} + +hlms iron_02 pbs +{ + roughness 1.33 + fresnel 0.04 + + diffuse_map iron_01.png + normal_map iron_bump.png + roughness_map iron_bump.png + specular_map iron_01.png +} + +hlms iron_03 pbs +{ + roughness 1.33 + fresnel 0.04 + + diffuse_map iron_01.png + normal_map iron_bump.png + roughness_map iron_bump.png + specular_map iron_01.png +} + +hlms iron_04 pbs +{ + roughness 1.33 + fresnel 0.04 + + diffuse_map iron_01.png + normal_map iron_bump.png + roughness_map iron_bump.png + specular_map iron_01.png +} + +hlms iron_05 pbs +{ + roughness 1.33 + fresnel 0.04 + + diffuse_map iron_01.png + normal_map iron_bump.png + roughness_map iron_bump.png + specular_map iron_01.png +} + diff --git a/materials/membranes.material b/materials/membranes.material new file mode 100644 index 00000000000..f72c77c2327 --- /dev/null +++ b/materials/membranes.material @@ -0,0 +1,179 @@ +material Membrane +{ + technique + { + pass + { + // lighting on + scene_blend alpha_blend + depth_write off + // receive_shadows on + depth_check on + + vertex_program_ref Membrane_VS + { + param_named_auto worldViewProj worldviewproj_matrix + param_named_auto time time_0_2pi 7 + param_named_auto lightDiffuse light_diffuse_colour 0 + param_named_auto lightSpecular light_specular_colour 0 + param_named_auto lightPosition light_position 0 + param_named_auto lightDirection light_direction 0 + } + fragment_program_ref Membrane_PS + { + param_named membraneTex int 0 + param_named membraneTexDamaged int 1 + param_named membraneColour float4 1 1 1 1 + param_named healthPercentage float 1.0 + } + + texture_unit + { + texture FresnelGradient.png 2d gamma + alpha_op_ex add src_manual src_texture .05 + colour_op_ex modulate src_manual src_texture 1 1 1 + } + + texture_unit + { + texture FresnelGradientDamaged.png 2d gamma + alpha_op_ex add src_manual src_texture .05 + colour_op_ex modulate src_manual src_texture 1 1 1 + } + } + } +} + +material MembraneDouble +{ + technique + { + pass + { + // lighting on + scene_blend alpha_blend + depth_write off + // receive_shadows on + depth_check on + + vertex_program_ref Membrane_VS + { + param_named_auto worldViewProj worldviewproj_matrix + param_named_auto time time_0_2pi 7 + param_named_auto lightDiffuse light_diffuse_colour 0 + param_named_auto lightSpecular light_specular_colour 0 + param_named_auto lightPosition light_position 0 + param_named_auto lightDirection light_direction 0 + } + fragment_program_ref Membrane_PS + { + param_named membraneTex int 0 + param_named membraneTexDamaged int 1 + param_named membraneColour float4 1 1 1 1 + param_named healthPercentage float 1.0 + } + + texture_unit + { + texture DoubleCellMembrane.png 2d gamma + alpha_op_ex add src_manual src_texture .05 + colour_op_ex modulate src_manual src_texture 1 1 1 + } + + texture_unit + { + texture DoubleCellMembraneDamaged.png 2d gamma + alpha_op_ex add src_manual src_texture .05 + colour_op_ex modulate src_manual src_texture 1 1 1 + } + } + } +} + +material cellwall +{ + technique + { + pass + { + scene_blend alpha_blend + depth_write off + depth_check on + + vertex_program_ref cellwall_VS + { + param_named_auto worldViewProj worldviewproj_matrix + param_named_auto time time_0_2pi 7 + param_named_auto lightDiffuse light_diffuse_colour 0 + param_named_auto lightSpecular light_specular_colour 0 + param_named_auto lightPosition light_position 0 + param_named_auto lightDirection light_direction 0 + } + fragment_program_ref Membrane_PS + { + param_named membraneTex int 0 + param_named membraneTexDamaged int 1 + param_named membraneColour float4 1 1 1 1 + param_named healthPercentage float 1.0 + } + + texture_unit + { + texture CellWallGradient.png 2d gamma + alpha_op_ex add src_manual src_texture .05 + colour_op_ex modulate src_manual src_texture 1 1 1 + } + + texture_unit + { + texture CellWallGradientDamaged.png 2d gamma + alpha_op_ex add src_manual src_texture .05 + colour_op_ex modulate src_manual src_texture 1 1 1 + } + } + } +} + +material cellwallchitin +{ + technique + { + pass + { + scene_blend alpha_blend + depth_write off + depth_check on + + vertex_program_ref cellwall_VS + { + param_named_auto worldViewProj worldviewproj_matrix + param_named_auto time time_0_2pi 7 + param_named_auto lightDiffuse light_diffuse_colour 0 + param_named_auto lightSpecular light_specular_colour 0 + param_named_auto lightPosition light_position 0 + param_named_auto lightDirection light_direction 0 + } + fragment_program_ref Membrane_PS + { + param_named membraneTex int 0 + param_named membraneTexDamaged int 1 + param_named membraneColour float4 1 1 1 1 + param_named healthPercentage float 1.0 + } + + texture_unit + { + texture ChitinCellWallGradient.png 2d gamma + alpha_op_ex add src_manual src_texture .05 + colour_op_ex modulate src_manual src_texture 1 1 1 + } + + texture_unit + { + texture ChitinCellWallGradientDamaged.png 2d gamma + alpha_op_ex add src_manual src_texture .05 + colour_op_ex modulate src_manual src_texture 1 1 1 + } + } + } +} diff --git a/materials/metabolosome.material b/materials/metabolosome.material new file mode 100644 index 00000000000..18e9c5635e2 --- /dev/null +++ b/materials/metabolosome.material @@ -0,0 +1,35 @@ +material metabolosome +{ + receive_shadows on + + technique + { + pass metabolosome + { + // lighting off + + scene_blend alpha_blend + depth_write off + + vertex_program_ref Organelle_VS + { + param_named_auto worldViewProj worldviewproj_matrix + param_named_auto time time_0_2pi 20 + param_named size float 0.05 + param_named maxRot float 15 + } + fragment_program_ref Organelle_PS + { + param_named tex int 0 + param_named_auto organelleColour custom 1 + } + + texture_unit + { + texture metabolosome.png gamma + alpha_op_ex modulate src_manual src_texture .7 + colour_op_ex modulate src_manual src_texture 1.0 1.0 1.0 + } + } + } +} diff --git a/materials/missing.material b/materials/missing.material new file mode 100644 index 00000000000..8068fd9cfd5 --- /dev/null +++ b/materials/missing.material @@ -0,0 +1,18 @@ +// THIS IS WHERE THE THRIVE MISSING MATERIAL IS DEFINED (banana) +material _missing_material_ +{ + technique + { + pass + { + ambient 0.2 0.2 0.2 0.4 + diffuse 0.6 0.6 0.6 0.4 + specular 0.5 0.5 0.5 0.4 12.5 + emissive 0.3 0.3 0.3 0.4 + + // scene_blend alpha_blend + depth_write on + } + } +} + diff --git a/materials/mitochondrion.material b/materials/mitochondrion.material new file mode 100644 index 00000000000..84fcc7ce266 --- /dev/null +++ b/materials/mitochondrion.material @@ -0,0 +1,35 @@ +material mitochondrion +{ + receive_shadows on + + technique + { + pass mitochondrion + { + // lighting off + + scene_blend alpha_blend + depth_write off + + vertex_program_ref Organelle_VS + { + param_named_auto worldViewProj worldviewproj_matrix + param_named_auto time time_0_2pi 20 + param_named size float 0.05 + param_named maxRot float 15 + } + fragment_program_ref Organelle_PS + { + param_named tex int 0 + param_named_auto organelleColour custom 1 + } + + texture_unit + { + texture mitochondrion.png gamma + alpha_op_ex modulate src_manual src_texture .7 + colour_op_ex modulate src_manual src_texture 1.0 1.0 1.0 + } + } + } +} diff --git a/materials/nitrogenase.material b/materials/nitrogenase.material new file mode 100644 index 00000000000..37d1303e4ad --- /dev/null +++ b/materials/nitrogenase.material @@ -0,0 +1,36 @@ +material nitrogenase +{ + receive_shadows on + + technique + { + pass nitrogenase + { + // lighting off + + scene_blend alpha_blend + depth_write on + point_sprites on + + vertex_program_ref Organelle_VS + { + param_named_auto worldViewProj worldviewproj_matrix + param_named_auto time time_0_2pi 20 + param_named size float 0.05 + param_named maxRot float 15 + } + fragment_program_ref Organelle_PS + { + param_named tex int 0 + param_named_auto organelleColour custom 1 + } + + texture_unit + { + texture nitrogenase.png gamma + alpha_op_ex modulate src_manual src_texture .7 + colour_op_ex modulate src_manual src_texture 1.0 1.0 1.0 + } + } + } +} diff --git a/materials/nitrogenplastid.material b/materials/nitrogenplastid.material new file mode 100644 index 00000000000..5a8973a6c44 --- /dev/null +++ b/materials/nitrogenplastid.material @@ -0,0 +1,33 @@ +material nitrogenplastid +{ + technique + { + pass nitrogenplastid + { + // lighting off + + scene_blend alpha_blend + depth_write off + + vertex_program_ref Organelle_VS + { + param_named_auto worldViewProj worldviewproj_matrix + param_named_auto time time_0_2pi 20 + param_named size float 0.05 + param_named maxRot float 15 + } + fragment_program_ref Organelle_PS + { + param_named tex int 0 + param_named_auto organelleColour custom 1 + } + + texture_unit + { + texture nitrogenplastid.png gamma + alpha_op_ex modulate src_manual src_texture .7 + colour_op_ex modulate src_manual src_texture 1.0 1.0 1.0 + } + } + } +} diff --git a/materials/nucleus.material b/materials/nucleus.material new file mode 100644 index 00000000000..b7984f3b14e --- /dev/null +++ b/materials/nucleus.material @@ -0,0 +1,35 @@ +material nucleus +{ +receive_shadows on + + technique + { + pass nucleus + { + // lighting off + + scene_blend alpha_blend + depth_write off + + vertex_program_ref Organelle_VS + { + param_named_auto worldViewProj worldviewproj_matrix + param_named_auto time time_0_2pi 20 + param_named size float 0.05 + param_named maxRot float 15 + } + fragment_program_ref Organelle_PS + { + param_named tex int 0 + param_named_auto organelleColour custom 1 + } + + texture_unit + { + texture Nucleus.png gamma + alpha_op_ex modulate src_manual src_texture .7 + colour_op_ex modulate src_manual src_texture 1.0 1.0 1.0 + } + } + } +} diff --git a/materials/oxytoxy.material b/materials/oxytoxy.material new file mode 100644 index 00000000000..e6d827865e4 --- /dev/null +++ b/materials/oxytoxy.material @@ -0,0 +1,36 @@ +material oxytoxy +{ + receive_shadows on + + technique + { + pass oxytoxy + { + // lighting off + + scene_blend alpha_blend + depth_write on + point_sprites on + + vertex_program_ref Organelle_VS + { + param_named_auto worldViewProj worldviewproj_matrix + param_named_auto time time_0_2pi 20 + param_named size float 0.05 + param_named maxRot float 15 + } + fragment_program_ref Organelle_PS + { + param_named tex int 0 + param_named_auto organelleColour custom 1 + } + + texture_unit + { + texture oxytoxy.png gamma + alpha_op_ex modulate src_manual src_texture .7 + colour_op_ex modulate src_manual src_texture 1.0 1.0 1.0 + } + } + } +} diff --git a/materials/rusticyanin.material b/materials/rusticyanin.material new file mode 100644 index 00000000000..12840d98946 --- /dev/null +++ b/materials/rusticyanin.material @@ -0,0 +1,36 @@ +material rusticyanin +{ + receive_shadows on + + technique + { + pass rusticyanin + { + // lighting off + + scene_blend alpha_blend + depth_write on + point_sprites on + + vertex_program_ref Organelle_VS + { + param_named_auto worldViewProj worldviewproj_matrix + param_named_auto time time_0_2pi 20 + param_named size float 0.05 + param_named maxRot float 15 + } + fragment_program_ref Organelle_PS + { + param_named tex int 0 + param_named_auto organelleColour custom 1 + } + + texture_unit + { + texture rusticyanin.png gamma + alpha_op_ex modulate src_manual src_texture .7 + colour_op_ex modulate src_manual src_texture 1.0 1.0 1.0 + } + } + } +} diff --git a/materials/vacuole.material b/materials/vacuole.material new file mode 100644 index 00000000000..13eb339290b --- /dev/null +++ b/materials/vacuole.material @@ -0,0 +1,33 @@ +material vacuole +{ + technique + { + pass vacuole + { + // lighting off + + scene_blend alpha_blend + depth_write off + + vertex_program_ref Organelle_VS + { + param_named_auto worldViewProj worldviewproj_matrix + param_named_auto time time_0_2pi 20 + param_named size float 0.05 + param_named maxRot float 15 + } + fragment_program_ref Organelle_PS + { + param_named tex int 0 + param_named_auto organelleColour custom 1 + } + + texture_unit + { + texture Vacuole.png gamma + alpha_op_ex modulate src_manual src_texture .7 + colour_op_ex modulate src_manual src_texture 1.0 1.0 1.0 + } + } + } +} diff --git a/shaders/background.program b/shaders/background.program new file mode 100644 index 00000000000..596d8e5e7cd --- /dev/null +++ b/shaders/background.program @@ -0,0 +1,30 @@ +vertex_program Background_VS glsl +{ + source background_vertex.glsl + + default_params + { + param_named_auto cameraPos camera_position + param_named speed0 float 1100.0 + param_named speed01 float 2200.0 + param_named speed1 float 850.0 + param_named speed11 float 1700.0 + param_named speed2 float 600.0 + param_named speed21 float 1200.0 + param_named speed3 float 350.0 + param_named speed31 float 700.0 + } +} + +fragment_program Background_PS glsl +{ + source background_pixel.glsl + + default_params + { + param_named tex0 int 0 + param_named tex1 int 1 + param_named tex2 int 2 + param_named tex3 int 3 + } +} diff --git a/shaders/background_pixel.glsl b/shaders/background_pixel.glsl new file mode 100644 index 00000000000..b1dc24753f9 --- /dev/null +++ b/shaders/background_pixel.glsl @@ -0,0 +1,29 @@ +#version 330 + +uniform sampler2D tex0; +uniform sampler2D tex1; +uniform sampler2D tex2; +uniform sampler2D tex3; + +in vec2 UV0; +in vec2 UV1; +in vec2 UV2; +in vec2 UV3; + +out vec4 color; + +void main() +{ + vec4 layer0 = texture2D(tex0, UV0); + vec4 layer1 = texture2D(tex1, UV1); + vec4 layer2 = texture2D(tex2, UV2); + vec4 layer3 = texture2D(tex3, UV3); + + color.rgb = + layer0.rgb * layer0.a * 1.0f + + layer1.rgb * layer1.a * 0.7f + + layer2.rgb * layer2.a * 0.7f + + layer3.rgb * layer3.a * 0.7f; + + color.a = 1.0; +} diff --git a/shaders/background_vertex.glsl b/shaders/background_vertex.glsl new file mode 100644 index 00000000000..e714c61104e --- /dev/null +++ b/shaders/background_vertex.glsl @@ -0,0 +1,42 @@ +#version 330 + +uniform vec3 cameraPos; +uniform float speed0; +uniform float speed01; +uniform float speed1; +uniform float speed11; +uniform float speed2; +uniform float speed21; +uniform float speed3; +uniform float speed31; + +in vec4 vertex; +in vec4 uv0; +in vec4 uv1; +in vec4 uv2; +in vec4 uv3; + +out vec2 UV0; +out vec2 UV1; +out vec2 UV2; +out vec2 UV3; + +void main() +{ + // Our vertices are already in screenspace + gl_Position = vec4(vertex.xy, 0.0, 1.0); + + UV0.x = (uv0.x + cameraPos.x / speed01)*1.0f; + UV0.y = (uv0.y + cameraPos.z / speed0)*0.5f; + // Offsets are added to make it look less trippy around (0, 0, 0) + // And these are multiplied to make the textures bigger and blurry + + UV1.x = (0.12 + uv0.x + cameraPos.x / speed11)*2.0f; + UV1.y = (0.12 + uv0.y + cameraPos.z / speed1)*1.0f; + + UV2.x = (0.512 + uv0.x + cameraPos.x / speed21)*2.0f; + UV2.y = (0.512 + uv0.y + cameraPos.z / speed2)*1.0f; + + UV3.x = (0.05 + uv0.x + cameraPos.x / speed31)*2.0f; + UV3.y = (0.05 + uv0.y + cameraPos.z / speed3)*1.0f; +} diff --git a/shaders/basic_unlit_pixel.glsl b/shaders/basic_unlit_pixel.glsl new file mode 100644 index 00000000000..a0f719688ea --- /dev/null +++ b/shaders/basic_unlit_pixel.glsl @@ -0,0 +1,12 @@ +#version 330 + +uniform sampler2D tex; + +in vec2 UV; + +out vec4 color; + +void main() +{ + color = texture2D(tex, UV); +} diff --git a/shaders/cellwall_vertex.glsl b/shaders/cellwall_vertex.glsl new file mode 100644 index 00000000000..6cf0319cd1c --- /dev/null +++ b/shaders/cellwall_vertex.glsl @@ -0,0 +1,40 @@ +#version 330 + +uniform mat4 worldViewProj; +uniform float time; +in vec3 normal; +uniform vec4 lightSpecular, lightDiffuse, lightDirection, lightPosition; +in vec4 vertex; +in vec4 uv0; + +out vec2 UV; +out vec4 vp_color; + +void main() +{ + vec4 position = vertex; + position.z = vertex.z; + position.x = vertex.x; + gl_Position = worldViewProj * position; + + // vertex normal in world space + vec3 _normal = normalize(normal); + + // directional light direction + vec3 _lightDirection = normalize(lightPosition.xyz); + + //ndot + float _NdotL = max(dot(_normal, _lightDirection), 0.0); + + // compute diffuse term + vec4 _diffuse = _NdotL * lightDiffuse; + + // compute specular term + vec4 _specular = lightSpecular; + + + // resulting color (e.g. the light) will be interpolated over the triangle + vp_color = vec4((_diffuse + _specular).xyz, 1.0); + + UV = uv0.xy; +} diff --git a/shaders/compound_clouds.program b/shaders/compound_clouds.program new file mode 100644 index 00000000000..4a17cf2c416 --- /dev/null +++ b/shaders/compound_clouds.program @@ -0,0 +1,27 @@ +vertex_program CompoundCloud_VS glsl +{ + source compound_clouds_vertex.glsl + + default_params + { + param_named_auto worldViewProj worldviewproj_matrix + } +} + +fragment_program CompoundCloud_PS glsl +{ + source compound_clouds_pixel.glsl + scene_blend alpha_blend + + default_params + { + param_named cloudTexture int 0 + param_named perlinNoise int 1 + // Default to black to not affect the colour + param_named cloudColour1 float4 0 0 0 0 + param_named cloudColour2 float4 0 0 0 0 + param_named cloudColour3 float4 0 0 0 0 + param_named cloudColour4 float4 0 0 0 0 + } +} + diff --git a/shaders/compound_clouds_pixel.glsl b/shaders/compound_clouds_pixel.glsl new file mode 100644 index 00000000000..b50fceaa551 --- /dev/null +++ b/shaders/compound_clouds_pixel.glsl @@ -0,0 +1,38 @@ +#version 330 + +uniform sampler2D cloudTexture; +uniform sampler2D perlinNoise; + +uniform vec4 cloudColour1; +uniform vec4 cloudColour2; +uniform vec4 cloudColour3; +uniform vec4 cloudColour4; + +// Must match the names in compoundClouds.vs +in vec2 oUV0; + +out vec4 color; + +void main() +{ + float CLOUD_DISSIPATION = 6.0; + + vec4 concentrations = texture2D(cloudTexture, oUV0); + + float cloud1 = concentrations.r * pow(texture2D(perlinNoise, oUV0).r, CLOUD_DISSIPATION); + float cloud2 = concentrations.g * pow(texture2D(perlinNoise, oUV0 + 0.2f).r, CLOUD_DISSIPATION); + float cloud3 = concentrations.b * pow(texture2D(perlinNoise, oUV0 + 0.4f).r, CLOUD_DISSIPATION); + float cloud4 = concentrations.a * pow(texture2D(perlinNoise, oUV0 + 0.6f).r, CLOUD_DISSIPATION); + + color = + // first + cloudColour1 * cloud1 + + // second + cloudColour2 * cloud2 + + // third + cloudColour3 * cloud3 + + // fourth + cloudColour4 * cloud4; + + color.a = min(cloud1 + cloud2 + cloud3 + cloud4, 0.9f); +} diff --git a/shaders/compound_clouds_vertex.glsl b/shaders/compound_clouds_vertex.glsl new file mode 100644 index 00000000000..b814eed5abd --- /dev/null +++ b/shaders/compound_clouds_vertex.glsl @@ -0,0 +1,15 @@ +#version 330 + +uniform mat4 worldViewProj; + +in vec4 vertex; +in vec2 uv0; + +out vec2 oUV0; + +void main() +{ + gl_Position = worldViewProj * vertex; + + oUV0 = uv0; +} diff --git a/shaders/generic_vertex.glsl b/shaders/generic_vertex.glsl new file mode 100644 index 00000000000..c3f6c0b4b07 --- /dev/null +++ b/shaders/generic_vertex.glsl @@ -0,0 +1,14 @@ +#version 330 + +uniform mat4 worldViewProj; + +in vec4 vertex; +in vec4 uv0; + +out vec2 UV; + +void main() +{ + gl_Position = worldViewProj * vertex; + UV = uv0.xy; +} diff --git a/shaders/membrane_pixel.glsl b/shaders/membrane_pixel.glsl new file mode 100644 index 00000000000..e868c98b078 --- /dev/null +++ b/shaders/membrane_pixel.glsl @@ -0,0 +1,15 @@ +#version 330 + +uniform sampler2D membraneTex; +uniform sampler2D membraneTexDamaged; +uniform vec4 membraneColour; +uniform float healthPercentage; + +in vec2 UV; +out vec4 color; +in vec4 vp_color; + +void main() +{ + color = (texture2D(membraneTex, UV) * healthPercentage + texture2D(membraneTexDamaged, UV) * (1 - healthPercentage)) * membraneColour; +} diff --git a/shaders/membrane_vertex.glsl b/shaders/membrane_vertex.glsl new file mode 100644 index 00000000000..4725bc740d3 --- /dev/null +++ b/shaders/membrane_vertex.glsl @@ -0,0 +1,42 @@ +#version 330 + +uniform mat4 worldViewProj; +uniform float time; +in vec3 normal; +uniform vec4 lightSpecular, lightDiffuse, lightDirection, lightPosition; +in vec4 vertex; +in vec4 uv0; + +out vec2 UV; +out vec4 vp_color; + +void main() +{ + vec4 position = vertex; + + position.x = vertex.x + sin(vertex.z+sign(vertex.x)*time)/5; + position.z = vertex.z + sin(vertex.x-sign(vertex.z)*time)/5; + + gl_Position = worldViewProj * position; + + // vertex normal in world space + vec3 _normal = normalize(normal); + + // directional light direction + vec3 _lightDirection = normalize(lightPosition.xyz); + + //ndot + float _NdotL = max(dot(_normal, _lightDirection), 0.0); + + // compute diffuse term + vec4 _diffuse = _NdotL * lightDiffuse; + + // compute specular term + vec4 _specular = lightSpecular; + + + // resulting color (e.g. the light) will be interpolated over the triangle + vp_color = vec4((_diffuse + _specular).xyz, 1.0); + + UV = uv0.xy; +} diff --git a/shaders/membranes.program b/shaders/membranes.program new file mode 100644 index 00000000000..8d98e013433 --- /dev/null +++ b/shaders/membranes.program @@ -0,0 +1,15 @@ +vertex_program Membrane_VS glsl +{ + source membrane_vertex.glsl +} + +fragment_program Membrane_PS glsl +{ + source membrane_pixel.glsl +} + +vertex_program cellwall_VS glsl +{ + source cellwall_vertex.glsl +} + diff --git a/shaders/organelle.program b/shaders/organelle.program new file mode 100644 index 00000000000..d7da2ba031e --- /dev/null +++ b/shaders/organelle.program @@ -0,0 +1,9 @@ +vertex_program Organelle_VS glsl +{ + source organelle_vertex.glsl +} + +fragment_program Organelle_PS glsl +{ + source organelle_pixel.glsl +} \ No newline at end of file diff --git a/shaders/organelle_pixel.glsl b/shaders/organelle_pixel.glsl new file mode 100644 index 00000000000..dece728ec48 --- /dev/null +++ b/shaders/organelle_pixel.glsl @@ -0,0 +1,13 @@ +#version 330 + +uniform sampler2D tex; +uniform vec4 organelleColour = vec4(1.0, 1.0, 1.0, 1.0); + +in vec2 UV; + +out vec4 color; + +void main() +{ + color = texture2D(tex, UV) * 0.8f * organelleColour; +} diff --git a/shaders/organelle_vertex.glsl b/shaders/organelle_vertex.glsl new file mode 100644 index 00000000000..ad47e615367 --- /dev/null +++ b/shaders/organelle_vertex.glsl @@ -0,0 +1,30 @@ +#version 330 + +uniform mat4 worldViewProj; +uniform float time; +uniform float size; +uniform float maxRot; + +in vec4 vertex; +in vec4 uv0; + +out vec2 UV; + +void main() +{ + float pi = 3.1415927; + + vec4 tempVertex = vertex; + tempVertex.x = vertex.x + size*3*sin(3*time); + tempVertex.y = vertex.y + size*3*sin(2*time); + + float angle = cos(time)*pi*maxRot/360; + mat4 rotation = mat4( + vec4(cos(angle), -sin(angle), 0, 0), + vec4(sin(angle), cos(angle), 0, 0), + vec4(0,0,1,0), + vec4(0,0,0,1)); + + gl_Position = worldViewProj * (rotation * tempVertex); + UV = uv0.xy; +} diff --git a/shaders/vertex_scaled_uv.glsl b/shaders/vertex_scaled_uv.glsl new file mode 100644 index 00000000000..c992f6b84a7 --- /dev/null +++ b/shaders/vertex_scaled_uv.glsl @@ -0,0 +1,16 @@ +#version 330 + +uniform mat4 worldViewProj; +uniform vec2 scale; + +in vec4 vertex; +in vec4 uv0; + +out vec2 UV; + +void main() +{ + gl_Position = worldViewProj * vertex; + UV.x = uv0.x / scale.x; + UV.y = uv0.y / scale.y; +} diff --git a/src/microbe_stage/biomes.cpp b/src/microbe_stage/biomes.cpp index 77206662c2d..08bfdae0094 100644 --- a/src/microbe_stage/biomes.cpp +++ b/src/microbe_stage/biomes.cpp @@ -115,8 +115,8 @@ Biome::Biome(Json::Value value) // Add meshes Json::Value meshData = chunkData[chunkInternalName]["meshes"]; - for(int i = 0; i < meshData.size(); i++) { - chunk.meshes.push_back(meshData[i].asString()); + for(size_t i = 0; i < meshData.size(); i++) { + chunk.meshes.push_back(meshData[static_cast(i)].asString()); // LOG_INFO(meshData[i].asString()); } diff --git a/src/microbe_stage/biomes.h b/src/microbe_stage/biomes.h index a05d6f6e580..18448dda799 100644 --- a/src/microbe_stage/biomes.h +++ b/src/microbe_stage/biomes.h @@ -31,13 +31,13 @@ struct ChunkCompoundData { ChunkCompoundData() {} // Move constructor - ChunkCompoundData(ChunkCompoundData&& other) : - name(std::move(other.name)), amount(other.amount) + ChunkCompoundData(ChunkCompoundData&& other) noexcept : + amount(other.amount), name(std::move(other.name)) {} // Copy constructor ChunkCompoundData(const ChunkCompoundData& other) : - name(other.name), amount(other.amount) + amount(other.amount), name(other.name) {} ChunkCompoundData(double amount, std::string name) : @@ -60,7 +60,7 @@ struct ChunkData { std::map chunkCompounds; // Move constructor - ChunkData(ChunkData&& other) : + ChunkData(ChunkData&& other) noexcept : name(std::move(other.name)), density(other.density), dissolves(other.dissolves), radius(other.radius), chunkScale(other.chunkScale), mass(other.mass), size(other.size),