what done?
1
particlelab/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/build
|
27
particlelab/build.gradle
Normal file
@ -0,0 +1,27 @@
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 23
|
||||
buildToolsVersion "23.0.2"
|
||||
defaultConfig {
|
||||
applicationId "com.example.particlelab"
|
||||
minSdkVersion 12
|
||||
targetSdkVersion 23
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
productFlavors {
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile fileTree(include: ['*.jar'], dir: 'libs')
|
||||
testCompile 'junit:junit:4.12'
|
||||
compile 'com.android.support:appcompat-v7:23.1.1'
|
||||
}
|
102
particlelab/particlelab.iml
Normal file
@ -0,0 +1,102 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.id=":particlelab" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="EndlessRoll" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="android-gradle" name="Android-Gradle">
|
||||
<configuration>
|
||||
<option name="GRADLE_PROJECT_PATH" value=":particlelab" />
|
||||
</configuration>
|
||||
</facet>
|
||||
<facet type="android" name="Android">
|
||||
<configuration>
|
||||
<option name="SELECTED_BUILD_VARIANT" value="debug" />
|
||||
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
|
||||
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
|
||||
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
|
||||
<afterSyncTasks>
|
||||
<task>generateDebugSources</task>
|
||||
</afterSyncTasks>
|
||||
<option name="ALLOW_USER_CONFIGURATION" value="false" />
|
||||
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
|
||||
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
|
||||
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
|
||||
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
|
||||
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
|
||||
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/test/debug" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/shaders" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/jni" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Android API 23 Platform" jdkType="Android SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" exported="" name="support-v4-23.1.1" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="hamcrest-core-1.3" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="junit-4.12" level="project" />
|
||||
<orderEntry type="library" exported="" name="support-annotations-23.1.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="appcompat-v7-23.1.1" level="project" />
|
||||
</component>
|
||||
</module>
|
17
particlelab/proguard-rules.pro
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in C:\Users\Julian\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt
|
||||
# You can edit the include path and order by changing the proguardFiles
|
||||
# directive in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# Add any project specific keep options here:
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
@ -0,0 +1,13 @@
|
||||
package com.example.particlelab;
|
||||
|
||||
import android.app.Application;
|
||||
import android.test.ApplicationTestCase;
|
||||
|
||||
/**
|
||||
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
|
||||
*/
|
||||
public class ApplicationTest extends ApplicationTestCase<Application> {
|
||||
public ApplicationTest() {
|
||||
super(Application.class);
|
||||
}
|
||||
}
|
27
particlelab/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1,27 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.particlelab">
|
||||
|
||||
<uses-feature
|
||||
android:glEsVersion="0x00020000"
|
||||
android:required="true" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
|
||||
<activity
|
||||
android:name=".main.MainActivity"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden"
|
||||
android:screenOrientation="landscape">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
177
particlelab/src/main/assets/allSettings.pe
Normal file
@ -0,0 +1,177 @@
|
||||
Untitled
|
||||
- Delay -
|
||||
active: true
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
- Duration -
|
||||
lowMin: 1000.0
|
||||
lowMax: 1000.0
|
||||
- Count -
|
||||
min: 0
|
||||
max: 25
|
||||
- Emission -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 50.0
|
||||
highMax: 50.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Life -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 500.0
|
||||
highMax: 500.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Life Offset -
|
||||
active: true
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 0.0
|
||||
highMax: 0.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- X Offset -
|
||||
active: true
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 0.0
|
||||
highMax: 0.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Y Offset -
|
||||
active: true
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 0.0
|
||||
highMax: 0.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Spawn Shape -
|
||||
shape: square
|
||||
- Spawn Width -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 0.0
|
||||
highMax: 0.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Spawn Height -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 0.0
|
||||
highMax: 0.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Scale -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 32.0
|
||||
highMax: 32.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Velocity -
|
||||
active: true
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 0.0
|
||||
highMax: 0.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Angle -
|
||||
active: true
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 0.0
|
||||
highMax: 0.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Rotation -
|
||||
active: true
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 0.0
|
||||
highMax: 0.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Wind -
|
||||
active: true
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 0.0
|
||||
highMax: 0.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Gravity -
|
||||
active: true
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 0.0
|
||||
highMax: 0.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Tint -
|
||||
colorsCount: 3
|
||||
colors0: 1.0
|
||||
colors1: 0.12156863
|
||||
colors2: 0.047058824
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Transparency -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 1.0
|
||||
highMax: 1.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Options -
|
||||
attached: false
|
||||
continuous: false
|
||||
aligned: false
|
||||
additive: true
|
||||
behind: false
|
||||
premultipliedAlpha: false
|
||||
- Image Path -
|
||||
particle.png
|
113
particlelab/src/main/assets/colors.pe
Normal file
@ -0,0 +1,113 @@
|
||||
Untitled
|
||||
- Delay -
|
||||
active: true
|
||||
lowMin: 2500.0
|
||||
lowMax: 2500.0
|
||||
- Duration -
|
||||
lowMin: 1000.0
|
||||
lowMax: 1000.0
|
||||
- Count -
|
||||
min: 0
|
||||
max: 25
|
||||
- Emission -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 1.0
|
||||
highMax: 1.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Life -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 3000.0
|
||||
highMax: 3000.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Life Offset -
|
||||
active: false
|
||||
- X Offset -
|
||||
active: false
|
||||
- Y Offset -
|
||||
active: false
|
||||
- Spawn Shape -
|
||||
shape: point
|
||||
- Spawn Width -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 0.0
|
||||
highMax: 0.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Spawn Height -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 0.0
|
||||
highMax: 0.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Scale -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 32.0
|
||||
highMax: 32.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Velocity -
|
||||
active: false
|
||||
- Angle -
|
||||
active: false
|
||||
- Rotation -
|
||||
active: false
|
||||
- Wind -
|
||||
active: false
|
||||
- Gravity -
|
||||
active: false
|
||||
- Tint -
|
||||
colorsCount: 9
|
||||
colors0: 1.0
|
||||
colors1: 0.047058824
|
||||
colors2: 0.047058824
|
||||
colors3: 0.047058824
|
||||
colors4: 0.11372549
|
||||
colors5: 1.0
|
||||
colors6: 1.0
|
||||
colors7: 1.0
|
||||
colors8: 1.0
|
||||
timelineCount: 3
|
||||
timeline0: 0.0
|
||||
timeline1: 0.3414252
|
||||
timeline2: 1.0
|
||||
- Transparency -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 1.0
|
||||
highMax: 1.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Options -
|
||||
attached: false
|
||||
continuous: true
|
||||
aligned: false
|
||||
additive: true
|
||||
behind: false
|
||||
premultipliedAlpha: false
|
||||
- Image Path -
|
||||
particle.png
|
135
particlelab/src/main/assets/conti.pe
Normal file
@ -0,0 +1,135 @@
|
||||
Untitled
|
||||
- Delay -
|
||||
active: false
|
||||
- Duration -
|
||||
lowMin: 5000.0
|
||||
lowMax: 5000.0
|
||||
- Count -
|
||||
min: 0
|
||||
max: 200
|
||||
- Emission -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 1.0
|
||||
highMax: 1.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Life -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 2000.0
|
||||
highMax: 2000.0
|
||||
relative: false
|
||||
scalingCount: 3
|
||||
scaling0: 1.0
|
||||
scaling1: 1.0
|
||||
scaling2: 1.0
|
||||
timelineCount: 3
|
||||
timeline0: 0.0
|
||||
timeline1: 0.66
|
||||
timeline2: 1.0
|
||||
- Life Offset -
|
||||
active: false
|
||||
- X Offset -
|
||||
active: false
|
||||
- Y Offset -
|
||||
active: false
|
||||
- Spawn Shape -
|
||||
shape: point
|
||||
- Spawn Width -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 0.0
|
||||
highMax: 0.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Spawn Height -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 0.0
|
||||
highMax: 0.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Scale -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 40.0
|
||||
highMax: 40.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Velocity -
|
||||
active: true
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 40.0
|
||||
highMax: 40.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Angle -
|
||||
active: true
|
||||
lowMin: 90.0
|
||||
lowMax: 90.0
|
||||
highMin: 90.0
|
||||
highMax: 90.0
|
||||
relative: false
|
||||
scalingCount: 3
|
||||
scaling0: 1.0
|
||||
scaling1: 1.0
|
||||
scaling2: 1.0
|
||||
timelineCount: 3
|
||||
timeline0: 0.0
|
||||
timeline1: 0.8082192
|
||||
timeline2: 1.0
|
||||
- Rotation -
|
||||
active: false
|
||||
- Wind -
|
||||
active: false
|
||||
- Gravity -
|
||||
active: false
|
||||
- Tint -
|
||||
colorsCount: 3
|
||||
colors0: 1.0
|
||||
colors1: 0.12156863
|
||||
colors2: 0.047058824
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Transparency -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 1.0
|
||||
highMax: 1.0
|
||||
relative: false
|
||||
scalingCount: 4
|
||||
scaling0: 0.0
|
||||
scaling1: 1.0
|
||||
scaling2: 0.75
|
||||
scaling3: 0.0
|
||||
timelineCount: 4
|
||||
timeline0: 0.0
|
||||
timeline1: 0.2
|
||||
timeline2: 0.8
|
||||
timeline3: 1.0
|
||||
- Options -
|
||||
attached: false
|
||||
continuous: true
|
||||
aligned: false
|
||||
additive: true
|
||||
behind: false
|
||||
premultipliedAlpha: false
|
||||
- Image Path -
|
||||
testparticle.png
|
182
particlelab/src/main/assets/explosion.pe
Normal file
@ -0,0 +1,182 @@
|
||||
Untitled
|
||||
- Delay -
|
||||
active: true
|
||||
lowMin: 500.0
|
||||
lowMax: 500.0
|
||||
- Duration -
|
||||
lowMin: 500.0
|
||||
lowMax: 500.0
|
||||
- Count -
|
||||
min: 0
|
||||
max: 1000
|
||||
- Emission -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 500.0
|
||||
highMax: 500.0
|
||||
relative: false
|
||||
scalingCount: 4
|
||||
scaling0: 1.0
|
||||
scaling1: 0.74509805
|
||||
scaling2: 0.3137255
|
||||
scaling3: 0.0
|
||||
timelineCount: 4
|
||||
timeline0: 0.0
|
||||
timeline1: 0.5205479
|
||||
timeline2: 0.8630137
|
||||
timeline3: 1.0
|
||||
- Life -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 500.0
|
||||
highMax: 800.0
|
||||
relative: false
|
||||
scalingCount: 3
|
||||
scaling0: 1.0
|
||||
scaling1: 1.0
|
||||
scaling2: 0.3
|
||||
timelineCount: 3
|
||||
timeline0: 0.0
|
||||
timeline1: 0.66
|
||||
timeline2: 1.0
|
||||
- Life Offset -
|
||||
active: false
|
||||
- X Offset -
|
||||
active: false
|
||||
- Y Offset -
|
||||
active: false
|
||||
- Spawn Shape -
|
||||
shape: square
|
||||
- Spawn Width -
|
||||
lowMin: 200.0
|
||||
lowMax: 200.0
|
||||
highMin: 20.0
|
||||
highMax: 20.0
|
||||
relative: false
|
||||
scalingCount: 2
|
||||
scaling0: 0.0
|
||||
scaling1: 0.0
|
||||
timelineCount: 2
|
||||
timeline0: 0.0
|
||||
timeline1: 1.0
|
||||
- Spawn Height -
|
||||
lowMin: 200.0
|
||||
lowMax: 200.0
|
||||
highMin: 20.0
|
||||
highMax: 20.0
|
||||
relative: false
|
||||
scalingCount: 2
|
||||
scaling0: 0.0
|
||||
scaling1: 0.0
|
||||
timelineCount: 2
|
||||
timeline0: 0.0
|
||||
timeline1: 1.0
|
||||
- Scale -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 32.0
|
||||
highMax: 32.0
|
||||
relative: false
|
||||
scalingCount: 2
|
||||
scaling0: 1.0
|
||||
scaling1: 0.66853935
|
||||
timelineCount: 2
|
||||
timeline0: 0.0
|
||||
timeline1: 1.0
|
||||
- Velocity -
|
||||
active: true
|
||||
lowMin: 100.0
|
||||
lowMax: 100.0
|
||||
highMin: 500.0
|
||||
highMax: 700.0
|
||||
relative: false
|
||||
scalingCount: 2
|
||||
scaling0: 1.0
|
||||
scaling1: 0.0
|
||||
timelineCount: 2
|
||||
timeline0: 0.0
|
||||
timeline1: 1.0
|
||||
- Angle -
|
||||
active: true
|
||||
lowMin: 90.0
|
||||
lowMax: 90.0
|
||||
highMin: 0.0
|
||||
highMax: 360.0
|
||||
relative: false
|
||||
scalingCount: 3
|
||||
scaling0: 1.0
|
||||
scaling1: 1.0
|
||||
scaling2: 1.0
|
||||
timelineCount: 3
|
||||
timeline0: 0.0
|
||||
timeline1: 0.51369864
|
||||
timeline2: 1.0
|
||||
- Rotation -
|
||||
active: false
|
||||
- Wind -
|
||||
active: true
|
||||
lowMin: -50.0
|
||||
lowMax: 50.0
|
||||
highMin: -100.0
|
||||
highMax: 100.0
|
||||
relative: false
|
||||
scalingCount: 2
|
||||
scaling0: 0.0
|
||||
scaling1: 1.0
|
||||
timelineCount: 2
|
||||
timeline0: 0.0
|
||||
timeline1: 1.0
|
||||
- Gravity -
|
||||
active: false
|
||||
- Tint -
|
||||
colorsCount: 18
|
||||
colors0: 0.07058824
|
||||
colors1: 0.67058825
|
||||
colors2: 1.0
|
||||
colors3: 1.0
|
||||
colors4: 0.7176471
|
||||
colors5: 0.07058824
|
||||
colors6: 1.0
|
||||
colors7: 0.7411765
|
||||
colors8: 0.07058824
|
||||
colors9: 1.0
|
||||
colors10: 0.12156863
|
||||
colors11: 0.07058824
|
||||
colors12: 1.0
|
||||
colors13: 0.12156863
|
||||
colors14: 0.07058824
|
||||
colors15: 0.39607844
|
||||
colors16: 0.047058824
|
||||
colors17: 0.02745098
|
||||
timelineCount: 6
|
||||
timeline0: 0.0
|
||||
timeline1: 0.024096385
|
||||
timeline2: 0.034096383
|
||||
timeline3: 0.28743544
|
||||
timeline4: 0.4423408
|
||||
timeline5: 1.0
|
||||
- Transparency -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 1.0
|
||||
highMax: 1.0
|
||||
relative: false
|
||||
scalingCount: 4
|
||||
scaling0: 0.10526316
|
||||
scaling1: 1.0
|
||||
scaling2: 0.75
|
||||
scaling3: 0.0
|
||||
timelineCount: 4
|
||||
timeline0: 0.0
|
||||
timeline1: 0.2
|
||||
timeline2: 0.8
|
||||
timeline3: 1.0
|
||||
- Options -
|
||||
attached: false
|
||||
continuous: true
|
||||
aligned: false
|
||||
additive: true
|
||||
behind: false
|
||||
premultipliedAlpha: false
|
||||
- Image Path -
|
||||
particle.png
|
135
particlelab/src/main/assets/fire.pe
Normal file
@ -0,0 +1,135 @@
|
||||
Untitled
|
||||
- Delay -
|
||||
active: false
|
||||
- Duration -
|
||||
lowMin: 3000.0
|
||||
lowMax: 3000.0
|
||||
- Count -
|
||||
min: 0
|
||||
max: 200
|
||||
- Emission -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 250.0
|
||||
highMax: 250.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Life -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 500.0
|
||||
highMax: 1000.0
|
||||
relative: false
|
||||
scalingCount: 3
|
||||
scaling0: 1.0
|
||||
scaling1: 1.0
|
||||
scaling2: 0.3
|
||||
timelineCount: 3
|
||||
timeline0: 0.0
|
||||
timeline1: 0.66
|
||||
timeline2: 1.0
|
||||
- Life Offset -
|
||||
active: false
|
||||
- X Offset -
|
||||
active: false
|
||||
- Y Offset -
|
||||
active: false
|
||||
- Spawn Shape -
|
||||
shape: point
|
||||
- Spawn Width -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 0.0
|
||||
highMax: 0.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Spawn Height -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 0.0
|
||||
highMax: 0.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Scale -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 32.0
|
||||
highMax: 32.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Velocity -
|
||||
active: true
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 30.0
|
||||
highMax: 300.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Angle -
|
||||
active: true
|
||||
lowMin: 90.0
|
||||
lowMax: 90.0
|
||||
highMin: 45.0
|
||||
highMax: 135.0
|
||||
relative: false
|
||||
scalingCount: 3
|
||||
scaling0: 1.0
|
||||
scaling1: 0.0
|
||||
scaling2: 0.0
|
||||
timelineCount: 3
|
||||
timeline0: 0.0
|
||||
timeline1: 0.5
|
||||
timeline2: 1.0
|
||||
- Rotation -
|
||||
active: false
|
||||
- Wind -
|
||||
active: false
|
||||
- Gravity -
|
||||
active: false
|
||||
- Tint -
|
||||
colorsCount: 3
|
||||
colors0: 1.0
|
||||
colors1: 0.12156863
|
||||
colors2: 0.047058824
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Transparency -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 1.0
|
||||
highMax: 1.0
|
||||
relative: false
|
||||
scalingCount: 4
|
||||
scaling0: 0.0
|
||||
scaling1: 1.0
|
||||
scaling2: 0.75
|
||||
scaling3: 0.0
|
||||
timelineCount: 4
|
||||
timeline0: 0.0
|
||||
timeline1: 0.2
|
||||
timeline2: 0.8
|
||||
timeline3: 1.0
|
||||
- Options -
|
||||
attached: false
|
||||
continuous: false
|
||||
aligned: false
|
||||
additive: true
|
||||
behind: false
|
||||
premultipliedAlpha: false
|
||||
- Image Path -
|
||||
particle.png
|
33
particlelab/src/main/assets/fragmentShader.glsl
Normal file
@ -0,0 +1,33 @@
|
||||
precision mediump float;
|
||||
|
||||
uniform sampler2D texture;
|
||||
uniform float alpha;
|
||||
uniform vec2 texAtlasSize;
|
||||
uniform float texAtlasIndex;
|
||||
uniform vec3 color;
|
||||
|
||||
varying vec2 pass_TexCoords;
|
||||
|
||||
vec2 getTexCoordsInAtlas(in float atlasIndex);
|
||||
|
||||
void main() {
|
||||
|
||||
vec2 texAtlasCoords = getTexCoordsInAtlas(texAtlasIndex);
|
||||
gl_FragColor = texture2D(texture, texAtlasCoords);
|
||||
gl_FragColor.a = min(gl_FragColor.a, alpha);
|
||||
if(color != vec3(-1, -1, -1)){
|
||||
gl_FragColor.rgb = color;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
vec2 getTexCoordsInAtlas(in float atlasIndex){
|
||||
|
||||
vec2 texAtlasCoords = vec2(0.0, 0.0);
|
||||
texAtlasCoords.x = mod(pass_TexCoords.x, 1.0) / texAtlasSize.x;
|
||||
texAtlasCoords.x += mod(atlasIndex, texAtlasSize.x) / texAtlasSize.x;
|
||||
texAtlasCoords.y = mod(pass_TexCoords.y, 1.0) / texAtlasSize.y;
|
||||
texAtlasCoords.y += floor(atlasIndex / texAtlasSize.y) / texAtlasSize.y;
|
||||
return texAtlasCoords;
|
||||
|
||||
}
|
157
particlelab/src/main/assets/gravity.pe
Normal file
@ -0,0 +1,157 @@
|
||||
Untitled
|
||||
- Delay -
|
||||
active: false
|
||||
- Duration -
|
||||
lowMin: 5000.0
|
||||
lowMax: 5000.0
|
||||
- Count -
|
||||
min: 0
|
||||
max: 200
|
||||
- Emission -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 250.0
|
||||
highMax: 250.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Life -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 500.0
|
||||
highMax: 1000.0
|
||||
relative: false
|
||||
scalingCount: 3
|
||||
scaling0: 1.0
|
||||
scaling1: 1.0
|
||||
scaling2: 0.3
|
||||
timelineCount: 3
|
||||
timeline0: 0.0
|
||||
timeline1: 0.66
|
||||
timeline2: 1.0
|
||||
- Life Offset -
|
||||
active: false
|
||||
- X Offset -
|
||||
active: false
|
||||
- Y Offset -
|
||||
active: false
|
||||
- Spawn Shape -
|
||||
shape: point
|
||||
- Spawn Width -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 0.0
|
||||
highMax: 0.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Spawn Height -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 0.0
|
||||
highMax: 0.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Scale -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 32.0
|
||||
highMax: 32.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Velocity -
|
||||
active: true
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 30.0
|
||||
highMax: 300.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Angle -
|
||||
active: true
|
||||
lowMin: 90.0
|
||||
lowMax: 90.0
|
||||
highMin: 45.0
|
||||
highMax: 135.0
|
||||
relative: false
|
||||
scalingCount: 3
|
||||
scaling0: 1.0
|
||||
scaling1: 0.0
|
||||
scaling2: 0.0
|
||||
timelineCount: 3
|
||||
timeline0: 0.0
|
||||
timeline1: 0.5
|
||||
timeline2: 1.0
|
||||
- Rotation -
|
||||
active: false
|
||||
- Wind -
|
||||
active: true
|
||||
lowMin: 1.0
|
||||
lowMax: 1.0
|
||||
highMin: 400.0
|
||||
highMax: 400.0
|
||||
relative: false
|
||||
scalingCount: 2
|
||||
scaling0: 0.0
|
||||
scaling1: 1.0
|
||||
timelineCount: 2
|
||||
timeline0: 0.0
|
||||
timeline1: 1.0
|
||||
- Gravity -
|
||||
active: true
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 400.0
|
||||
highMax: 400.0
|
||||
relative: false
|
||||
scalingCount: 2
|
||||
scaling0: 1.0
|
||||
scaling1: 0.0
|
||||
timelineCount: 2
|
||||
timeline0: 0.0
|
||||
timeline1: 1.0
|
||||
- Tint -
|
||||
colorsCount: 3
|
||||
colors0: 1.0
|
||||
colors1: 0.12156863
|
||||
colors2: 0.047058824
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Transparency -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 1.0
|
||||
highMax: 1.0
|
||||
relative: false
|
||||
scalingCount: 4
|
||||
scaling0: 0.0
|
||||
scaling1: 1.0
|
||||
scaling2: 0.75
|
||||
scaling3: 0.0
|
||||
timelineCount: 4
|
||||
timeline0: 0.0
|
||||
timeline1: 0.2
|
||||
timeline2: 0.8
|
||||
timeline3: 1.0
|
||||
- Options -
|
||||
attached: false
|
||||
continuous: true
|
||||
aligned: false
|
||||
additive: true
|
||||
behind: false
|
||||
premultipliedAlpha: false
|
||||
- Image Path -
|
||||
star.png
|
145
particlelab/src/main/assets/magnet.pe
Normal file
@ -0,0 +1,145 @@
|
||||
Untitled
|
||||
- Delay -
|
||||
active: false
|
||||
- Duration -
|
||||
lowMin: 1000.0
|
||||
lowMax: 1000.0
|
||||
- Count -
|
||||
min: 0
|
||||
max: 500
|
||||
- Emission -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 10.0
|
||||
highMax: 10.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Life -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 2000.0
|
||||
highMax: 3000.0
|
||||
relative: false
|
||||
scalingCount: 3
|
||||
scaling0: 1.0
|
||||
scaling1: 1.0
|
||||
scaling2: 1.0
|
||||
timelineCount: 3
|
||||
timeline0: 0.0
|
||||
timeline1: 0.66
|
||||
timeline2: 1.0
|
||||
- Life Offset -
|
||||
active: false
|
||||
- X Offset -
|
||||
active: false
|
||||
- Y Offset -
|
||||
active: false
|
||||
- Spawn Shape -
|
||||
shape: point
|
||||
- Spawn Width -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 0.0
|
||||
highMax: 0.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Spawn Height -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 0.0
|
||||
highMax: 0.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Scale -
|
||||
lowMin: 15.0
|
||||
lowMax: 15.0
|
||||
highMin: 25.0
|
||||
highMax: 30.0
|
||||
relative: false
|
||||
scalingCount: 3
|
||||
scaling0: 0.0
|
||||
scaling1: 0.0
|
||||
scaling2: 1.0
|
||||
timelineCount: 3
|
||||
timeline0: 0.0
|
||||
timeline1: 0.37671232
|
||||
timeline2: 1.0
|
||||
- Velocity -
|
||||
active: true
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 30.0
|
||||
highMax: 50.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Angle -
|
||||
active: true
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 0.0
|
||||
highMax: 360.0
|
||||
relative: false
|
||||
scalingCount: 3
|
||||
scaling0: 1.0
|
||||
scaling1: 1.0
|
||||
scaling2: 1.0
|
||||
timelineCount: 3
|
||||
timeline0: 0.0
|
||||
timeline1: 0.7191781
|
||||
timeline2: 1.0
|
||||
- Rotation -
|
||||
active: false
|
||||
- Wind -
|
||||
active: false
|
||||
- Gravity -
|
||||
active: false
|
||||
- Tint -
|
||||
colorsCount: 6
|
||||
colors0: 1.0
|
||||
colors1: 0.92941177
|
||||
colors2: 0.047058824
|
||||
colors3: 1.0
|
||||
colors4: 0.58431375
|
||||
colors5: 0.047058824
|
||||
timelineCount: 2
|
||||
timeline0: 0.0
|
||||
timeline1: 1.0
|
||||
- Transparency -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 1.0
|
||||
highMax: 1.0
|
||||
relative: false
|
||||
scalingCount: 5
|
||||
scaling0: 0.0
|
||||
scaling1: 0.0
|
||||
scaling2: 0.98245615
|
||||
scaling3: 0.5263158
|
||||
scaling4: 0.0
|
||||
timelineCount: 5
|
||||
timeline0: 0.0
|
||||
timeline1: 0.36886302
|
||||
timeline2: 0.55379456
|
||||
timeline3: 0.7876712
|
||||
timeline4: 1.0
|
||||
- Options -
|
||||
attached: false
|
||||
continuous: true
|
||||
aligned: false
|
||||
additive: true
|
||||
behind: false
|
||||
premultipliedAlpha: false
|
||||
- Image Path -
|
||||
particle.png
|
166
particlelab/src/main/assets/offset.pe
Normal file
@ -0,0 +1,166 @@
|
||||
Untitled
|
||||
- Delay -
|
||||
active: false
|
||||
- Duration -
|
||||
lowMin: 3000.0
|
||||
lowMax: 3000.0
|
||||
- Count -
|
||||
min: 0
|
||||
max: 200
|
||||
- Emission -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 250.0
|
||||
highMax: 250.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Life -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 500.0
|
||||
highMax: 700.0
|
||||
relative: false
|
||||
scalingCount: 3
|
||||
scaling0: 1.0
|
||||
scaling1: 1.0
|
||||
scaling2: 1.0
|
||||
timelineCount: 3
|
||||
timeline0: 0.0
|
||||
timeline1: 0.66
|
||||
timeline2: 1.0
|
||||
- Life Offset -
|
||||
active: false
|
||||
- X Offset -
|
||||
active: true
|
||||
lowMin: -10.0
|
||||
lowMax: 30.0
|
||||
highMin: 0.0
|
||||
highMax: 0.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Y Offset -
|
||||
active: true
|
||||
lowMin: -15.0
|
||||
lowMax: 10.0
|
||||
highMin: 0.0
|
||||
highMax: 0.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Spawn Shape -
|
||||
shape: point
|
||||
- Spawn Width -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 0.0
|
||||
highMax: 0.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Spawn Height -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 0.0
|
||||
highMax: 0.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Scale -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 32.0
|
||||
highMax: 32.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Velocity -
|
||||
active: true
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 30.0
|
||||
highMax: 30.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Angle -
|
||||
active: true
|
||||
lowMin: 90.0
|
||||
lowMax: 90.0
|
||||
highMin: 70.0
|
||||
highMax: 110.0
|
||||
relative: false
|
||||
scalingCount: 3
|
||||
scaling0: 1.0
|
||||
scaling1: 0.0
|
||||
scaling2: 0.0
|
||||
timelineCount: 3
|
||||
timeline0: 0.0
|
||||
timeline1: 0.5
|
||||
timeline2: 1.0
|
||||
- Rotation -
|
||||
active: true
|
||||
lowMin: 180.0
|
||||
lowMax: 180.0
|
||||
highMin: 0.0
|
||||
highMax: 0.0
|
||||
relative: false
|
||||
scalingCount: 3
|
||||
scaling0: 1.0
|
||||
scaling1: 0.7647059
|
||||
scaling2: 0.0
|
||||
timelineCount: 3
|
||||
timeline0: 0.0
|
||||
timeline1: 0.51369864
|
||||
timeline2: 0.9931507
|
||||
- Wind -
|
||||
active: false
|
||||
- Gravity -
|
||||
active: false
|
||||
- Tint -
|
||||
colorsCount: 3
|
||||
colors0: 1.0
|
||||
colors1: 0.12156863
|
||||
colors2: 0.047058824
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Transparency -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 1.0
|
||||
highMax: 1.0
|
||||
relative: false
|
||||
scalingCount: 4
|
||||
scaling0: 0.0
|
||||
scaling1: 1.0
|
||||
scaling2: 0.75
|
||||
scaling3: 0.0
|
||||
timelineCount: 4
|
||||
timeline0: 0.0
|
||||
timeline1: 0.2
|
||||
timeline2: 0.8
|
||||
timeline3: 1.0
|
||||
- Options -
|
||||
attached: false
|
||||
continuous: true
|
||||
aligned: false
|
||||
additive: true
|
||||
behind: false
|
||||
premultipliedAlpha: false
|
||||
- Image Path -
|
||||
star.png
|
135
particlelab/src/main/assets/oneDirection.pe
Normal file
@ -0,0 +1,135 @@
|
||||
Untitled
|
||||
- Delay -
|
||||
active: false
|
||||
- Duration -
|
||||
lowMin: 3000.0
|
||||
lowMax: 3000.0
|
||||
- Count -
|
||||
min: 0
|
||||
max: 200
|
||||
- Emission -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 250.0
|
||||
highMax: 250.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Life -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 500.0
|
||||
highMax: 1000.0
|
||||
relative: false
|
||||
scalingCount: 3
|
||||
scaling0: 1.0
|
||||
scaling1: 1.0
|
||||
scaling2: 0.3
|
||||
timelineCount: 3
|
||||
timeline0: 0.0
|
||||
timeline1: 0.66
|
||||
timeline2: 1.0
|
||||
- Life Offset -
|
||||
active: false
|
||||
- X Offset -
|
||||
active: false
|
||||
- Y Offset -
|
||||
active: false
|
||||
- Spawn Shape -
|
||||
shape: point
|
||||
- Spawn Width -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 0.0
|
||||
highMax: 0.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Spawn Height -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 0.0
|
||||
highMax: 0.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Scale -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 32.0
|
||||
highMax: 32.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Velocity -
|
||||
active: true
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 30.0
|
||||
highMax: 300.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Angle -
|
||||
active: true
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 180.0
|
||||
highMax: 180.0
|
||||
relative: false
|
||||
scalingCount: 3
|
||||
scaling0: 1.0
|
||||
scaling1: 1.0
|
||||
scaling2: 1.0
|
||||
timelineCount: 3
|
||||
timeline0: 0.0
|
||||
timeline1: 0.49315068
|
||||
timeline2: 1.0
|
||||
- Rotation -
|
||||
active: false
|
||||
- Wind -
|
||||
active: false
|
||||
- Gravity -
|
||||
active: false
|
||||
- Tint -
|
||||
colorsCount: 3
|
||||
colors0: 1.0
|
||||
colors1: 0.12156863
|
||||
colors2: 0.047058824
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Transparency -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 1.0
|
||||
highMax: 1.0
|
||||
relative: false
|
||||
scalingCount: 4
|
||||
scaling0: 0.0
|
||||
scaling1: 1.0
|
||||
scaling2: 0.75
|
||||
scaling3: 0.0
|
||||
timelineCount: 4
|
||||
timeline0: 0.0
|
||||
timeline1: 0.2
|
||||
timeline2: 0.8
|
||||
timeline3: 1.0
|
||||
- Options -
|
||||
attached: false
|
||||
continuous: false
|
||||
aligned: false
|
||||
additive: true
|
||||
behind: false
|
||||
premultipliedAlpha: false
|
||||
- Image Path -
|
||||
particle.png
|
BIN
particlelab/src/main/assets/particle.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
153
particlelab/src/main/assets/pe.pe
Normal file
@ -0,0 +1,153 @@
|
||||
Untitled
|
||||
- Delay -
|
||||
active: false
|
||||
- Duration -
|
||||
lowMin: 1000.0
|
||||
lowMax: 1000.0
|
||||
- Count -
|
||||
min: 0
|
||||
max: 500
|
||||
- Emission -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 20.0
|
||||
highMax: 40.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Life -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 600.0
|
||||
highMax: 1500.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Life Offset -
|
||||
active: false
|
||||
- X Offset -
|
||||
active: false
|
||||
- Y Offset -
|
||||
active: false
|
||||
- Spawn Shape -
|
||||
shape: square
|
||||
- Spawn Width -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 100.0
|
||||
highMax: 100.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Spawn Height -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 11.0
|
||||
highMax: 11.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Scale -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 32.0
|
||||
highMax: 32.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Velocity -
|
||||
active: true
|
||||
lowMin: 90.0
|
||||
lowMax: 90.0
|
||||
highMin: 90.0
|
||||
highMax: 90.0
|
||||
relative: true
|
||||
scalingCount: 2
|
||||
scaling0: 1.0
|
||||
scaling1: 0.16292135
|
||||
timelineCount: 2
|
||||
timeline0: 0.0
|
||||
timeline1: 1.0
|
||||
- Angle -
|
||||
active: true
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: -135.0
|
||||
highMax: -52.0
|
||||
relative: false
|
||||
scalingCount: 2
|
||||
scaling0: 1.0
|
||||
scaling1: 1.0
|
||||
timelineCount: 2
|
||||
timeline0: 0.0
|
||||
timeline1: 0.48630136
|
||||
- Rotation -
|
||||
active: false
|
||||
- Wind -
|
||||
active: false
|
||||
- Gravity -
|
||||
active: false
|
||||
- Tint -
|
||||
colorsCount: 24
|
||||
colors0: 1.0
|
||||
colors1: 0.23529412
|
||||
colors2: 0.105882354
|
||||
colors3: 1.0
|
||||
colors4: 0.23529412
|
||||
colors5: 0.105882354
|
||||
colors6: 0.65882355
|
||||
colors7: 1.0
|
||||
colors8: 0.105882354
|
||||
colors9: 0.105882354
|
||||
colors10: 0.21568628
|
||||
colors11: 1.0
|
||||
colors12: 1.0
|
||||
colors13: 0.23529412
|
||||
colors14: 0.105882354
|
||||
colors15: 1.0
|
||||
colors16: 0.23529412
|
||||
colors17: 0.105882354
|
||||
colors18: 0.105882354
|
||||
colors19: 0.67058825
|
||||
colors20: 1.0
|
||||
colors21: 1.0
|
||||
colors22: 0.23529412
|
||||
colors23: 0.105882354
|
||||
timelineCount: 8
|
||||
timeline0: 0.0
|
||||
timeline1: 0.012048192
|
||||
timeline2: 0.2685026
|
||||
timeline3: 0.45094663
|
||||
timeline4: 0.686747
|
||||
timeline5: 0.83476764
|
||||
timeline6: 0.97590363
|
||||
timeline7: 1.0
|
||||
- Transparency -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 1.0
|
||||
highMax: 1.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Options -
|
||||
attached: false
|
||||
continuous: true
|
||||
aligned: false
|
||||
additive: true
|
||||
behind: false
|
||||
premultipliedAlpha: false
|
||||
- Image Path -
|
||||
particle.png
|
123
particlelab/src/main/assets/rotation.pe
Normal file
@ -0,0 +1,123 @@
|
||||
Untitled
|
||||
- Delay -
|
||||
active: false
|
||||
- Duration -
|
||||
lowMin: 1000.0
|
||||
lowMax: 1000.0
|
||||
- Count -
|
||||
min: 0
|
||||
max: 25
|
||||
- Emission -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 1.0
|
||||
highMax: 1.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Life -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 3000.0
|
||||
highMax: 3000.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Life Offset -
|
||||
active: false
|
||||
- X Offset -
|
||||
active: false
|
||||
- Y Offset -
|
||||
active: false
|
||||
- Spawn Shape -
|
||||
shape: point
|
||||
- Spawn Width -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 0.0
|
||||
highMax: 0.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Spawn Height -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 0.0
|
||||
highMax: 0.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Scale -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 30.0
|
||||
highMax: 30.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Velocity -
|
||||
active: true
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 30.0
|
||||
highMax: 30.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Angle -
|
||||
active: false
|
||||
- Rotation -
|
||||
active: true
|
||||
lowMin: 180.0
|
||||
lowMax: 180.0
|
||||
highMin: 0.0
|
||||
highMax: 0.0
|
||||
relative: false
|
||||
scalingCount: 2
|
||||
scaling0: 1.0
|
||||
scaling1: 0.0
|
||||
timelineCount: 2
|
||||
timeline0: 0.0
|
||||
timeline1: 1.0
|
||||
- Wind -
|
||||
active: false
|
||||
- Gravity -
|
||||
active: false
|
||||
- Tint -
|
||||
colorsCount: 3
|
||||
colors0: 1.0
|
||||
colors1: 0.12156863
|
||||
colors2: 0.047058824
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Transparency -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 1.0
|
||||
highMax: 1.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Options -
|
||||
attached: false
|
||||
continuous: true
|
||||
aligned: false
|
||||
additive: true
|
||||
behind: false
|
||||
premultipliedAlpha: false
|
||||
- Image Path -
|
||||
star.png
|
24
particlelab/src/main/assets/short.pe
Normal file
@ -0,0 +1,24 @@
|
||||
- Tint -
|
||||
colors0: 1.0
|
||||
colors1: 0.23529412
|
||||
colors2: 0.105882354
|
||||
timeline0: 0.0
|
||||
- Transparency -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 1.0
|
||||
highMax: 1.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Options -
|
||||
attached: false
|
||||
continuous: true
|
||||
aligned: false
|
||||
additive: true
|
||||
behind: false
|
||||
premultipliedAlpha: false
|
||||
- Image Path -
|
||||
particle.png
|
BIN
particlelab/src/main/assets/star.png
Normal file
After Width: | Height: | Size: 11 KiB |
135
particlelab/src/main/assets/test.txt
Normal file
@ -0,0 +1,135 @@
|
||||
Untitled
|
||||
- Delay -
|
||||
active: false
|
||||
- Duration -
|
||||
lowMin: 3000.0
|
||||
lowMax: 3000.0
|
||||
- Count -
|
||||
min: 0
|
||||
max: 200
|
||||
- Emission -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 1.0
|
||||
highMax: 1.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Life -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 2000.0
|
||||
highMax: 2000.0
|
||||
relative: false
|
||||
scalingCount: 3
|
||||
scaling0: 1.0
|
||||
scaling1: 1.0
|
||||
scaling2: 0.3
|
||||
timelineCount: 3
|
||||
timeline0: 0.0
|
||||
timeline1: 0.66
|
||||
timeline2: 1.0
|
||||
- Life Offset -
|
||||
active: false
|
||||
- X Offset -
|
||||
active: false
|
||||
- Y Offset -
|
||||
active: false
|
||||
- Spawn Shape -
|
||||
shape: point
|
||||
- Spawn Width -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 0.0
|
||||
highMax: 0.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Spawn Height -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 0.0
|
||||
highMax: 0.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Scale -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 32.0
|
||||
highMax: 32.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Velocity -
|
||||
active: true
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 30.0
|
||||
highMax: 30.0
|
||||
relative: false
|
||||
scalingCount: 1
|
||||
scaling0: 1.0
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Angle -
|
||||
active: true
|
||||
lowMin: 90.0
|
||||
lowMax: 90.0
|
||||
highMin: 45.0
|
||||
highMax: 135.0
|
||||
relative: false
|
||||
scalingCount: 3
|
||||
scaling0: 1.0
|
||||
scaling1: 0.0
|
||||
scaling2: 0.0
|
||||
timelineCount: 3
|
||||
timeline0: 0.0
|
||||
timeline1: 0.5
|
||||
timeline2: 1.0
|
||||
- Rotation -
|
||||
active: false
|
||||
- Wind -
|
||||
active: false
|
||||
- Gravity -
|
||||
active: false
|
||||
- Tint -
|
||||
colorsCount: 3
|
||||
colors0: 1.0
|
||||
colors1: 0.12156863
|
||||
colors2: 0.047058824
|
||||
timelineCount: 1
|
||||
timeline0: 0.0
|
||||
- Transparency -
|
||||
lowMin: 0.0
|
||||
lowMax: 0.0
|
||||
highMin: 1.0
|
||||
highMax: 1.0
|
||||
relative: false
|
||||
scalingCount: 4
|
||||
scaling0: 0.0
|
||||
scaling1: 1.0
|
||||
scaling2: 0.75
|
||||
scaling3: 0.0
|
||||
timelineCount: 4
|
||||
timeline0: 0.0
|
||||
timeline1: 0.2
|
||||
timeline2: 0.8
|
||||
timeline3: 1.0
|
||||
- Options -
|
||||
attached: false
|
||||
continuous: false
|
||||
aligned: false
|
||||
additive: true
|
||||
behind: false
|
||||
premultipliedAlpha: false
|
||||
- Image Path -
|
||||
particle.png
|
BIN
particlelab/src/main/assets/testparticle.png
Normal file
After Width: | Height: | Size: 90 B |
20
particlelab/src/main/assets/vertexShader.glsl
Normal file
@ -0,0 +1,20 @@
|
||||
uniform mat4 mvpMatrix;
|
||||
uniform mat4 transformationMatrix;
|
||||
uniform float isTerrain;
|
||||
|
||||
attribute vec4 position;
|
||||
attribute vec2 texCoords;
|
||||
|
||||
varying vec2 pass_TexCoords;
|
||||
|
||||
void main() {
|
||||
|
||||
vec4 transformatedPosition = transformationMatrix * position;
|
||||
gl_Position = mvpMatrix * transformatedPosition;
|
||||
pass_TexCoords = texCoords;
|
||||
if(isTerrain == 1.0){
|
||||
pass_TexCoords = (transformationMatrix * vec4(texCoords, 0.0, 0.0)).xy;
|
||||
pass_TexCoords *= vec2(3.0, 3.0);
|
||||
pass_TexCoords.y = clamp(pass_TexCoords.y, 0.0, 1.0) + 0.01;
|
||||
}
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package com.example.particlelab.data;
|
||||
|
||||
/**
|
||||
* Created by Julian on 02.08.2016.
|
||||
*/
|
||||
public class Color {
|
||||
|
||||
private float r, g, b;
|
||||
|
||||
public Color() {
|
||||
}
|
||||
|
||||
public Color(float r, float g, float b){
|
||||
this.r = r;
|
||||
this.g = g;
|
||||
this.b = b;
|
||||
}
|
||||
|
||||
public Color(Color other) {
|
||||
this.r = other.getR();
|
||||
this.g = other.getG();
|
||||
this.b = other.getB();
|
||||
}
|
||||
|
||||
public Color mix(float leftValue, float rightValue, Color color2) {
|
||||
Color mySelf = new Color(this);
|
||||
Color second = new Color(color2);
|
||||
mySelf.mul(leftValue);
|
||||
second.mul(rightValue);
|
||||
mySelf.add(second);
|
||||
return mySelf;
|
||||
}
|
||||
|
||||
private void mul(float a) {
|
||||
r *= a;
|
||||
g *= a;
|
||||
b *= a;
|
||||
}
|
||||
|
||||
private void add(Color other) {
|
||||
r += other.getR();
|
||||
g += other.getG();
|
||||
b += other.getB();
|
||||
}
|
||||
|
||||
public float getR() {
|
||||
return r;
|
||||
}
|
||||
|
||||
public void setR(float r) {
|
||||
this.r = r;
|
||||
}
|
||||
|
||||
public float getG() {
|
||||
return g;
|
||||
}
|
||||
|
||||
public void setG(float g) {
|
||||
this.g = g;
|
||||
}
|
||||
|
||||
public float getB() {
|
||||
return b;
|
||||
}
|
||||
|
||||
public void setB(float b) {
|
||||
this.b = b;
|
||||
}
|
||||
}
|
@ -0,0 +1,101 @@
|
||||
package com.example.particlelab.data;
|
||||
|
||||
/**
|
||||
* Created by Julian on 01.12.2015.
|
||||
*/
|
||||
public class Vector {
|
||||
|
||||
public float x, y;
|
||||
|
||||
public Vector() {
|
||||
this(0, 0);
|
||||
}
|
||||
|
||||
public Vector(Vector other) {
|
||||
this(other.x, other.y);
|
||||
}
|
||||
|
||||
public Vector(float x, float y) {
|
||||
set(x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Vector(" + x + ", " + y + ")";
|
||||
}
|
||||
|
||||
public Vector set(float x, float y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
return this;
|
||||
}
|
||||
|
||||
public float length() {
|
||||
return (float) Math.sqrt(x * x + y * y);
|
||||
}
|
||||
|
||||
public Vector normalize() {
|
||||
float length = this.length();
|
||||
x /= length;
|
||||
y /= length;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Vector translate(Vector other) {
|
||||
this.x += other.x;
|
||||
this.y += other.y;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Vector translate(float x, float y) {
|
||||
this.x += x;
|
||||
this.y += y;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Vector mul(float z) {
|
||||
x *= z;
|
||||
y *= z;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Vector mul(Vector other) {
|
||||
this.x *= other.x;
|
||||
this.y *= other.y;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Vector mul(float x, float y) {
|
||||
this.x *= x;
|
||||
this.y *= y;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Vector negate() {
|
||||
this.x *= -1;
|
||||
this.y *= -1;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Vector vectorTo(Vector other) {
|
||||
float x = other.x - this.x;
|
||||
float y = other.y - this.y;
|
||||
return new Vector(x, y);
|
||||
}
|
||||
|
||||
public void setX(float x) {
|
||||
this.x = x;
|
||||
}
|
||||
|
||||
public void setY(float y) {
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public float getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public float getY() {
|
||||
return y;
|
||||
}
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
package com.example.particlelab.entities;
|
||||
|
||||
import com.example.particlelab.data.Color;
|
||||
import com.example.particlelab.entities.textures.Texture;
|
||||
import com.example.particlelab.data.Vector;
|
||||
|
||||
/**
|
||||
* Created by Julian on 20.11.2015.
|
||||
*/
|
||||
public class Entity extends Quad {
|
||||
|
||||
private Color color;
|
||||
private Texture texture;
|
||||
private Vector movement;
|
||||
private float rotation;
|
||||
private float dynamicRotation;
|
||||
private float alpha = 1.0f;
|
||||
private boolean destroyed;
|
||||
|
||||
public Entity(Texture texture, Vector position, float width, float height) {
|
||||
super(position, width, height);
|
||||
this.texture = texture;
|
||||
this.movement = new Vector();
|
||||
}
|
||||
|
||||
public Entity(Texture texture, Color color, Vector position, float width, float height) {
|
||||
super(position, width, height);
|
||||
this.texture = texture;
|
||||
this.color = color;
|
||||
this.movement = new Vector();
|
||||
}
|
||||
|
||||
public void move(Vector movement) {
|
||||
position.translate(movement);
|
||||
}
|
||||
|
||||
public void rotate(float factor) {
|
||||
rotation += factor;
|
||||
}
|
||||
|
||||
public Texture getTexture() {
|
||||
return texture;
|
||||
}
|
||||
|
||||
public void setTexture(Texture texture) {
|
||||
this.texture = texture;
|
||||
}
|
||||
|
||||
public Vector getMovement() {
|
||||
return movement;
|
||||
}
|
||||
|
||||
public void setMovement(Vector movement) {
|
||||
this.movement = movement;
|
||||
}
|
||||
|
||||
public float getRotation() {
|
||||
return rotation;
|
||||
}
|
||||
|
||||
public void setRotation(float rotation) {
|
||||
this.rotation = rotation;
|
||||
}
|
||||
|
||||
public void setAlpha(float alpha) {
|
||||
this.alpha = alpha;
|
||||
}
|
||||
|
||||
public float getAlpha() {
|
||||
return alpha;
|
||||
}
|
||||
|
||||
public void setColor(Color color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public Color getColor() {
|
||||
return color;
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
package com.example.particlelab.entities;
|
||||
|
||||
import com.example.particlelab.data.Vector;
|
||||
|
||||
/**
|
||||
* Created by Julian on 01.12.2015.
|
||||
*/
|
||||
public class Quad {
|
||||
|
||||
protected Vector position;
|
||||
protected float width, height;
|
||||
|
||||
public Quad(Vector position, float width, float height) {
|
||||
this.position = position;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public float getRightEdge() {
|
||||
return position.x + width / 2;
|
||||
}
|
||||
|
||||
public float getLeftEdge() {
|
||||
return position.x - width / 2;
|
||||
}
|
||||
|
||||
public float getTopEdge() {
|
||||
return position.y + height / 2;
|
||||
}
|
||||
|
||||
public float getBottomEdge() {
|
||||
return position.y - height / 2;
|
||||
}
|
||||
|
||||
public Vector getPosition() {
|
||||
return position;
|
||||
}
|
||||
|
||||
public void setPosition(Vector position) {
|
||||
this.position = position;
|
||||
}
|
||||
|
||||
public float getWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
public void setWidth(float width) {
|
||||
this.width = width;
|
||||
}
|
||||
|
||||
public float getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
public void setHeight(float height) {
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
package com.example.particlelab.entities.particles;
|
||||
|
||||
import com.example.particlelab.data.Vector;
|
||||
import com.example.particlelab.entities.Entity;
|
||||
import com.example.particlelab.entities.particles.attributes.attributeValues.Range;
|
||||
import com.example.particlelab.entities.particles.attributes.attributeValues.Timeline;
|
||||
import com.example.particlelab.entities.particles.attributes.attributeValues.TintTimeline;
|
||||
import com.example.particlelab.main.GameLog;
|
||||
import com.example.particlelab.rendering.Timer;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* Created by Julian on 02.08.2016.
|
||||
*/
|
||||
public class Particle extends Entity {
|
||||
|
||||
private Random random;
|
||||
private boolean active;
|
||||
private float maxLife;
|
||||
private float passedLifetime;
|
||||
|
||||
private Timeline scaleTimeline;
|
||||
private Range scale;
|
||||
private Timeline velocityTimeline;
|
||||
private Range velocity;
|
||||
private Timeline angleTimeline;
|
||||
private Range angle;
|
||||
private Timeline rotationTimeline;
|
||||
private Range rotation;
|
||||
private Timeline transparencyTimeline;
|
||||
private TintTimeline tintTimeline;
|
||||
|
||||
public Particle(Random random) {
|
||||
super(null, new Vector(), 1, 1);
|
||||
this.random = random;
|
||||
}
|
||||
|
||||
public void activate(Vector position, float liveValue, ParticleData particleData) {
|
||||
active = true;
|
||||
passedLifetime = 0;
|
||||
super.setPosition(position);
|
||||
maxLife = particleData.getLife().createValue(random, liveValue);
|
||||
scaleTimeline = particleData.getScaleTR().getTimeline();
|
||||
scale = particleData.getScaleTR().getRange().createNormalizedInstance(random);
|
||||
velocityTimeline = particleData.getVelocityTR().getTimeline();
|
||||
velocity = particleData.getVelocityTR().getRange().createNormalizedInstance(random);
|
||||
angleTimeline = particleData.getAngleTR().getTimeline();
|
||||
angle = particleData.getAngleTR().getRange().createNormalizedInstance(random);
|
||||
rotationTimeline = particleData.getRotationTR().getTimeline();
|
||||
rotation = particleData.getRotationTR().getRange().createNormalizedInstance(random);
|
||||
transparencyTimeline = particleData.getTransparencyT();
|
||||
tintTimeline = particleData.getTint();
|
||||
}
|
||||
|
||||
public void update(Timer timer, float windStrength, float gravityStrength) {
|
||||
if (active) {
|
||||
passedLifetime += timer.getFrameTime();
|
||||
if (passedLifetime >= maxLife)
|
||||
active = false;
|
||||
float lifetimePercent = passedLifetime / maxLife;
|
||||
setScale(scale.createValue(random, scaleTimeline.getValueAtTime(lifetimePercent)));
|
||||
setMovement(velocity.createValue(random, velocityTimeline.getValueAtTime(lifetimePercent)),
|
||||
angle.createValue(random, angleTimeline.getValueAtTime(lifetimePercent)), windStrength, gravityStrength);
|
||||
super.setRotation(-rotation.createValue(random, rotationTimeline.getValueAtTime(lifetimePercent)));
|
||||
super.setAlpha(transparencyTimeline.getValueAtTime(lifetimePercent));
|
||||
super.setColor(tintTimeline.getValueAtTime(lifetimePercent));
|
||||
}
|
||||
}
|
||||
|
||||
private void setScale(float scale) {
|
||||
super.setWidth(scale * ParticleSystem.TRANSFER_VALUE);
|
||||
super.setHeight(scale * ParticleSystem.TRANSFER_VALUE);
|
||||
}
|
||||
|
||||
private void setMovement(float velocity, float angle, float windStrength, float gravityStrength) {
|
||||
float radians = (float) Math.toRadians(angle);
|
||||
Vector normalMovement = new Vector();
|
||||
normalMovement.setX((float) Math.cos(radians));
|
||||
normalMovement.setY((float) Math.sin(radians));
|
||||
normalMovement.mul(velocity * ParticleSystem.TRANSFER_VALUE);
|
||||
normalMovement.translate(windStrength * ParticleSystem.TRANSFER_VALUE, gravityStrength * ParticleSystem.TRANSFER_VALUE);
|
||||
super.setMovement(normalMovement);
|
||||
}
|
||||
|
||||
public boolean isActive() {
|
||||
return active;
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
package com.example.particlelab.entities.particles;
|
||||
|
||||
import com.example.particlelab.entities.particles.attributes.attributeValues.Range;
|
||||
import com.example.particlelab.entities.particles.attributes.attributeValues.Timeline;
|
||||
import com.example.particlelab.entities.particles.attributes.attributeValues.TimelineRange;
|
||||
import com.example.particlelab.entities.particles.attributes.attributeValues.TintTimeline;
|
||||
import com.example.particlelab.entities.textures.Texture;
|
||||
|
||||
/**
|
||||
* Created by Julian on 03.08.2016.
|
||||
*/
|
||||
public class ParticleData {
|
||||
|
||||
private Range life;
|
||||
private TimelineRange scaleTR;
|
||||
private TimelineRange velocityTR;
|
||||
private TimelineRange angleTR;
|
||||
private TimelineRange rotationTR;
|
||||
private Timeline transparencyT;
|
||||
private TintTimeline tint;
|
||||
|
||||
public ParticleData(Range life, TimelineRange scaleTR, TimelineRange velocityTR, TimelineRange angleTR, TimelineRange rotationTR, Timeline transparencyT, TintTimeline tint) {
|
||||
this.life = life;
|
||||
this.scaleTR = scaleTR;
|
||||
this.velocityTR = velocityTR;
|
||||
this.angleTR = angleTR;
|
||||
this.rotationTR = rotationTR;
|
||||
this.transparencyT = transparencyT;
|
||||
this.tint = tint;
|
||||
}
|
||||
|
||||
public Range getLife() {
|
||||
return life;
|
||||
}
|
||||
|
||||
public TimelineRange getScaleTR() {
|
||||
return scaleTR;
|
||||
}
|
||||
|
||||
public TimelineRange getVelocityTR() {
|
||||
return velocityTR;
|
||||
}
|
||||
|
||||
public TimelineRange getAngleTR() {
|
||||
return angleTR;
|
||||
}
|
||||
|
||||
public TimelineRange getRotationTR() {
|
||||
return rotationTR;
|
||||
}
|
||||
|
||||
public Timeline getTransparencyT() {
|
||||
return transparencyT;
|
||||
}
|
||||
|
||||
public TintTimeline getTint() {
|
||||
return tint;
|
||||
}
|
||||
}
|
@ -0,0 +1,218 @@
|
||||
package com.example.particlelab.entities.particles;
|
||||
|
||||
import com.example.particlelab.entities.particles.attributes.attributeValues.Options;
|
||||
import com.example.particlelab.entities.particles.attributes.attributeValues.Range;
|
||||
import com.example.particlelab.entities.particles.attributes.attributeValues.SpawnShape;
|
||||
import com.example.particlelab.entities.particles.attributes.attributeValues.Timeline;
|
||||
import com.example.particlelab.entities.particles.attributes.attributeValues.TimelineRange;
|
||||
import com.example.particlelab.entities.particles.attributes.attributeValues.TintTimeline;
|
||||
import com.example.particlelab.entities.textures.Texture;
|
||||
import com.example.particlelab.rendering.Timer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* Created by Julian on 05.08.2016.
|
||||
*/
|
||||
public class ParticleEffect {
|
||||
|
||||
private TimelineRange life;
|
||||
//Particle Timeline
|
||||
private TimelineRange scale;
|
||||
private TimelineRange velocity;
|
||||
private TimelineRange angle;
|
||||
private TimelineRange rotation;
|
||||
private Timeline transparency;
|
||||
private TintTimeline tint;
|
||||
|
||||
//Source Timeline
|
||||
private Range delay;
|
||||
private Range duration;
|
||||
private TimelineRange emission;
|
||||
private Range xOffset;
|
||||
private Range yOffset;
|
||||
private SpawnShape.Shape spawnShape;
|
||||
private TimelineRange spawnWidth;
|
||||
private TimelineRange spawnHeight;
|
||||
private TimelineRange wind;
|
||||
private TimelineRange gravity;
|
||||
|
||||
private Options options;
|
||||
private Texture texture;
|
||||
private String textureName;
|
||||
|
||||
private Random random;
|
||||
private List<ParticleSource> sources = new ArrayList<>();
|
||||
|
||||
public ParticleEffect() {
|
||||
this.random = new Random();
|
||||
}
|
||||
|
||||
public void update(Timer timer) {
|
||||
for (ParticleSource source : sources)
|
||||
source.update(timer);
|
||||
}
|
||||
|
||||
public ParticleData createParticleData(){
|
||||
return new ParticleData(life.getRange(), scale, velocity, angle, rotation, transparency, tint);
|
||||
}
|
||||
|
||||
public Random getRandom() {
|
||||
return random;
|
||||
}
|
||||
|
||||
public void addSource(ParticleSource source) {
|
||||
sources.add(source);
|
||||
}
|
||||
|
||||
public void setDelay(Range delay) {
|
||||
this.delay = delay;
|
||||
}
|
||||
|
||||
public void setDuration(Range duration) {
|
||||
this.duration = duration;
|
||||
}
|
||||
|
||||
public void setEmission(TimelineRange emission) {
|
||||
this.emission = emission;
|
||||
}
|
||||
|
||||
public void setLife(TimelineRange life) {
|
||||
this.life = life;
|
||||
}
|
||||
|
||||
public void setxOffset(Range xOffset) {
|
||||
this.xOffset = xOffset;
|
||||
}
|
||||
|
||||
public void setyOffset(Range yOffset) {
|
||||
this.yOffset = yOffset;
|
||||
}
|
||||
|
||||
public void setSpawnShape(SpawnShape.Shape spawnShape) {
|
||||
this.spawnShape = spawnShape;
|
||||
}
|
||||
|
||||
public void setSpawnWidth(TimelineRange spawnWidth) {
|
||||
this.spawnWidth = spawnWidth;
|
||||
}
|
||||
|
||||
public void setSpawnHeight(TimelineRange spawnHeight) {
|
||||
this.spawnHeight = spawnHeight;
|
||||
}
|
||||
|
||||
public void setScale(TimelineRange scale) {
|
||||
this.scale = scale;
|
||||
}
|
||||
|
||||
public void setVelocity(TimelineRange velocity) {
|
||||
this.velocity = velocity;
|
||||
}
|
||||
|
||||
public void setAngle(TimelineRange angle) {
|
||||
this.angle = angle;
|
||||
}
|
||||
|
||||
public void setRotation(TimelineRange rotation) {
|
||||
this.rotation = rotation;
|
||||
}
|
||||
|
||||
public void setWind(TimelineRange wind) {
|
||||
this.wind = wind;
|
||||
}
|
||||
|
||||
public void setGravity(TimelineRange gravity) {
|
||||
this.gravity = gravity;
|
||||
}
|
||||
|
||||
public void setTint(TintTimeline tint) {
|
||||
this.tint = tint;
|
||||
}
|
||||
|
||||
public void setTransparency(Timeline transparency) {
|
||||
this.transparency = transparency;
|
||||
}
|
||||
|
||||
public Timeline getTransparency() {
|
||||
return transparency;
|
||||
}
|
||||
|
||||
public TintTimeline getTint() {
|
||||
return tint;
|
||||
}
|
||||
|
||||
public void setOptions(Options options) {
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
public void setTexture(Texture texture) {
|
||||
this.texture = texture;
|
||||
}
|
||||
|
||||
public void setTextureName(String textureName) {
|
||||
this.textureName = textureName;
|
||||
}
|
||||
|
||||
public String getTextureName() {
|
||||
return textureName;
|
||||
}
|
||||
|
||||
public Texture getTexture() {
|
||||
return texture;
|
||||
}
|
||||
|
||||
public Range getDelay() {
|
||||
return delay;
|
||||
}
|
||||
|
||||
public Range getDuration() {
|
||||
return duration;
|
||||
}
|
||||
|
||||
public TimelineRange getEmission() {
|
||||
return emission;
|
||||
}
|
||||
|
||||
public Options getOptions() {
|
||||
return options;
|
||||
}
|
||||
|
||||
public TimelineRange getWind() {
|
||||
return wind;
|
||||
}
|
||||
|
||||
public TimelineRange getGravity() {
|
||||
return gravity;
|
||||
}
|
||||
|
||||
public Range getxOffset() {
|
||||
return xOffset;
|
||||
}
|
||||
|
||||
public Range getyOffset() {
|
||||
return yOffset;
|
||||
}
|
||||
|
||||
public List<ParticleSource> getSources() {
|
||||
return sources;
|
||||
}
|
||||
|
||||
public TimelineRange getLife() {
|
||||
return life;
|
||||
}
|
||||
|
||||
public SpawnShape.Shape getSpawnShape() {
|
||||
return spawnShape;
|
||||
}
|
||||
|
||||
public TimelineRange getSpawnHeight() {
|
||||
return spawnHeight;
|
||||
}
|
||||
|
||||
public TimelineRange getSpawnWidth() {
|
||||
return spawnWidth;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,164 @@
|
||||
package com.example.particlelab.entities.particles;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.example.particlelab.entities.particles.attributes.Attribute;
|
||||
import com.example.particlelab.entities.particles.attributes.AttributeValueReader;
|
||||
import com.example.particlelab.entities.particles.attributes.ParticleAttributeType;
|
||||
import com.example.particlelab.entities.particles.attributes.attributeValues.ImagePath;
|
||||
import com.example.particlelab.entities.particles.attributes.attributeValues.Options;
|
||||
import com.example.particlelab.entities.particles.attributes.attributeValues.ParticleAttributeValueType;
|
||||
import com.example.particlelab.entities.particles.attributes.attributeValues.Range;
|
||||
import com.example.particlelab.entities.particles.attributes.attributeValues.SpawnShape;
|
||||
import com.example.particlelab.entities.particles.attributes.attributeValues.Timeline;
|
||||
import com.example.particlelab.entities.particles.attributes.attributeValues.TimelineRange;
|
||||
import com.example.particlelab.entities.particles.attributes.attributeValues.TintTimeline;
|
||||
import com.example.particlelab.main.GameLog;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Julian on 02.08.2016.
|
||||
*/
|
||||
public class ParticleReader {
|
||||
|
||||
private Context context;
|
||||
private AttributeValueReader attributeValueReader;
|
||||
|
||||
private List<Attribute> attributes;
|
||||
private Attribute currentAttribute;
|
||||
|
||||
public ParticleReader(Context context) {
|
||||
this.context = context;
|
||||
attributeValueReader = new AttributeValueReader();
|
||||
}
|
||||
|
||||
/**
|
||||
* reads ParticleEffect from *.pe files
|
||||
* !Ignores COUNT, LIFE_OFFSET!
|
||||
*/
|
||||
public ParticleEffect read(String filename) throws Exception {
|
||||
try {
|
||||
attributes = new ArrayList<>();
|
||||
currentAttribute = null;
|
||||
InputStream is = context.getAssets().open(filename);
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
line = line.trim();
|
||||
handleLine(line);
|
||||
}
|
||||
reader.close();
|
||||
return createParticleEffect();
|
||||
} catch (Exception e) {
|
||||
throw new Exception("Could not read particleFile: ", e);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleLine(String line) throws Exception {
|
||||
if (line.startsWith("- ")) {
|
||||
Attribute attrib = ParticleAttributeType.getByInFileTitle(line).createInstance();
|
||||
attributes.add(attrib);
|
||||
currentAttribute = attrib;
|
||||
} else if (currentAttribute != null)
|
||||
attributeValueReader.addValueForAttribute(currentAttribute, line);
|
||||
}
|
||||
|
||||
private ParticleEffect createParticleEffect() throws Exception {
|
||||
ParticleEffect effect = new ParticleEffect();
|
||||
Timeline timeline = null;
|
||||
Range range = null;
|
||||
for (Attribute attribute : attributes) {
|
||||
switch (attribute.getType()) {
|
||||
case DELAY:
|
||||
effect.setDelay((Range) attribute.get(ParticleAttributeValueType.RANGE));
|
||||
break;
|
||||
case DURATION:
|
||||
effect.setDuration((Range) attribute.get(ParticleAttributeValueType.RANGE));
|
||||
break;
|
||||
case COUNT:
|
||||
break;
|
||||
case EMISSION:
|
||||
timeline = (Timeline) attribute.get(ParticleAttributeValueType.TIMELINE);
|
||||
range = (Range) attribute.get(ParticleAttributeValueType.RANGE);
|
||||
effect.setEmission(new TimelineRange(timeline, range));
|
||||
break;
|
||||
case LIFE:
|
||||
timeline = (Timeline) attribute.get(ParticleAttributeValueType.TIMELINE);
|
||||
range = (Range) attribute.get(ParticleAttributeValueType.RANGE);
|
||||
effect.setLife(new TimelineRange(timeline, range));
|
||||
break;
|
||||
case LIFE_OFFSET:
|
||||
break;
|
||||
case X_OFFSET:
|
||||
effect.setxOffset((Range) attribute.get(ParticleAttributeValueType.RANGE));
|
||||
break;
|
||||
case Y_OFFSET:
|
||||
effect.setyOffset((Range) attribute.get(ParticleAttributeValueType.RANGE));
|
||||
break;
|
||||
case SPAWN_SHAPE:
|
||||
effect.setSpawnShape(((SpawnShape) attribute.get(ParticleAttributeValueType.SPAWN_SHAPE)).getShape());
|
||||
break;
|
||||
case SPAWN_WIDTH:
|
||||
timeline = (Timeline) attribute.get(ParticleAttributeValueType.TIMELINE);
|
||||
range = (Range) attribute.get(ParticleAttributeValueType.RANGE);
|
||||
effect.setSpawnWidth(new TimelineRange(timeline, range));
|
||||
break;
|
||||
case SPAWN_HEIGHT:
|
||||
timeline = (Timeline) attribute.get(ParticleAttributeValueType.TIMELINE);
|
||||
range = (Range) attribute.get(ParticleAttributeValueType.RANGE);
|
||||
effect.setSpawnHeight(new TimelineRange(timeline, range));
|
||||
break;
|
||||
case SCALE:
|
||||
timeline = (Timeline) attribute.get(ParticleAttributeValueType.TIMELINE);
|
||||
range = (Range) attribute.get(ParticleAttributeValueType.RANGE);
|
||||
effect.setScale(new TimelineRange(timeline, range));
|
||||
break;
|
||||
case VELOCITY:
|
||||
timeline = (Timeline) attribute.get(ParticleAttributeValueType.TIMELINE);
|
||||
range = (Range) attribute.get(ParticleAttributeValueType.RANGE);
|
||||
effect.setVelocity(new TimelineRange(timeline, range));
|
||||
break;
|
||||
case ANGLE:
|
||||
timeline = (Timeline) attribute.get(ParticleAttributeValueType.TIMELINE);
|
||||
range = (Range) attribute.get(ParticleAttributeValueType.RANGE);
|
||||
effect.setAngle(new TimelineRange(timeline, range));
|
||||
break;
|
||||
case ROTATION:
|
||||
timeline = (Timeline) attribute.get(ParticleAttributeValueType.TIMELINE);
|
||||
range = (Range) attribute.get(ParticleAttributeValueType.RANGE);
|
||||
effect.setRotation(new TimelineRange(timeline, range));
|
||||
break;
|
||||
case WIND:
|
||||
timeline = (Timeline) attribute.get(ParticleAttributeValueType.TIMELINE);
|
||||
range = (Range) attribute.get(ParticleAttributeValueType.RANGE);
|
||||
effect.setWind(new TimelineRange(timeline, range));
|
||||
break;
|
||||
case GRAVITY:
|
||||
timeline = (Timeline) attribute.get(ParticleAttributeValueType.TIMELINE);
|
||||
range = (Range) attribute.get(ParticleAttributeValueType.RANGE);
|
||||
effect.setGravity(new TimelineRange(timeline, range));
|
||||
break;
|
||||
case TINT:
|
||||
effect.setTint((TintTimeline) attribute.get(ParticleAttributeValueType.TINT_TIMELINE));
|
||||
break;
|
||||
case TRANSPARENCY:
|
||||
timeline = (Timeline) attribute.get(ParticleAttributeValueType.TIMELINE);
|
||||
effect.setTransparency(timeline);
|
||||
break;
|
||||
case OPTIONS:
|
||||
effect.setOptions((Options) attribute.get(ParticleAttributeValueType.OPTIONS));
|
||||
break;
|
||||
case IMAGE_PATH:
|
||||
String path = ((ImagePath) attribute.get(ParticleAttributeValueType.IMAGE_PATH)).getImagePath();
|
||||
effect.setTextureName(path);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return effect;
|
||||
}
|
||||
}
|
@ -0,0 +1,150 @@
|
||||
package com.example.particlelab.entities.particles;
|
||||
|
||||
import com.example.particlelab.data.Vector;
|
||||
import com.example.particlelab.entities.particles.attributes.attributeValues.SpawnShape;
|
||||
import com.example.particlelab.main.GameLog;
|
||||
import com.example.particlelab.rendering.Lock;
|
||||
import com.example.particlelab.rendering.Timer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* Created by Julian on 02.08.2016.
|
||||
*/
|
||||
public class ParticleSource {
|
||||
|
||||
private Vector position;
|
||||
private ParticleEffect effect;
|
||||
private Random random;
|
||||
|
||||
private boolean alife;
|
||||
private float currentDelay;
|
||||
private float lifePercent;
|
||||
private float maxTime = -1;
|
||||
private float passedTime;
|
||||
private float emittPause;
|
||||
private float passedEmittPause;
|
||||
private float passedSecond;
|
||||
private float windStrength;
|
||||
private float gravityStrength;
|
||||
private Vector spawnSize = null;
|
||||
|
||||
private ParticleData particleData;
|
||||
private List<Particle> activeParticles = new ArrayList<>();
|
||||
private List<Particle> inactiveParticles = new ArrayList<>();
|
||||
private Lock activeParticleLock = new Lock();
|
||||
|
||||
public ParticleSource(Vector position, ParticleEffect effect) {
|
||||
this.position = position;
|
||||
this.effect = effect;
|
||||
random = effect.getRandom();
|
||||
effect.addSource(this);
|
||||
}
|
||||
|
||||
public void start() {
|
||||
alife = true;
|
||||
currentDelay = effect.getDelay().createValue(random, 0);
|
||||
maxTime = effect.getDuration().createValue(random, 0) + currentDelay;
|
||||
passedTime = 0;
|
||||
emittPause = calcEmittPause();
|
||||
passedEmittPause = 0;
|
||||
passedSecond = 0;
|
||||
lifePercent = 0;
|
||||
}
|
||||
|
||||
public void update(Timer timer) {
|
||||
if (alife) {
|
||||
passedTime += timer.getFrameTime();
|
||||
lifePercent = passedTime / maxTime;
|
||||
|
||||
if (passedTime >= currentDelay) {
|
||||
passedEmittPause += timer.getFrameTime();
|
||||
calcWindAndGravity();
|
||||
while (passedEmittPause >= emittPause) {
|
||||
passedEmittPause -= emittPause;
|
||||
emitt();
|
||||
}
|
||||
|
||||
passedSecond += timer.getFrameTime();
|
||||
if (passedSecond >= 1000) {
|
||||
passedSecond -= 1000;
|
||||
calcEmittPause();
|
||||
}
|
||||
}
|
||||
if (passedTime >= maxTime)
|
||||
die();
|
||||
}
|
||||
updateParticles(timer);
|
||||
}
|
||||
|
||||
private void updateParticles(Timer timer) {
|
||||
activeParticleLock.lock();
|
||||
Iterator<Particle> iter = activeParticles.iterator();
|
||||
while (iter.hasNext()) {
|
||||
Particle particle = iter.next();
|
||||
particle.update(timer, windStrength, gravityStrength);
|
||||
if (!particle.isActive()) {
|
||||
inactiveParticles.add(particle);
|
||||
iter.remove();
|
||||
} else {
|
||||
particle.move(new Vector(particle.getMovement()).mul(timer.getFrameTime() / 1000));
|
||||
}
|
||||
}
|
||||
activeParticleLock.unlock();
|
||||
}
|
||||
|
||||
private void die() {
|
||||
alife = false;
|
||||
if (effect.getOptions().isContinuous())
|
||||
start();
|
||||
}
|
||||
|
||||
public void emitt() {
|
||||
if (particleData == null)
|
||||
particleData = effect.createParticleData();
|
||||
float xOff = effect.getxOffset().createValue(random, 0) * ParticleSystem.TRANSFER_VALUE;
|
||||
float yOff = effect.getyOffset().createValue(random, 0) * ParticleSystem.TRANSFER_VALUE;
|
||||
if (effect.getSpawnShape() == SpawnShape.Shape.SQUARE) {
|
||||
float width = effect.getSpawnWidth().getRange().createValue(random, effect.getSpawnWidth().getTimeline().getValueAtTime(lifePercent));
|
||||
float height = effect.getSpawnHeight().getRange().createValue(random, effect.getSpawnHeight().getTimeline().getValueAtTime(lifePercent));
|
||||
xOff += (random.nextFloat() * width - width * 0.5f)*ParticleSystem.TRANSFER_VALUE;
|
||||
yOff += (random.nextFloat() * height - height * 0.5f)*ParticleSystem.TRANSFER_VALUE;
|
||||
}
|
||||
setUpParticle(new Vector(position).translate(xOff, yOff));
|
||||
}
|
||||
|
||||
private Particle setUpParticle(Vector position) {
|
||||
Particle particle;
|
||||
if (inactiveParticles.size() > 0)
|
||||
particle = inactiveParticles.remove(0);
|
||||
else
|
||||
particle = new Particle(random);
|
||||
|
||||
particle.activate(position, effect.getLife().getTimeline().getValueAtTime(lifePercent), particleData);
|
||||
activeParticleLock.lock();
|
||||
activeParticles.add(particle);
|
||||
activeParticleLock.unlock();
|
||||
return particle;
|
||||
}
|
||||
|
||||
private void calcWindAndGravity() {
|
||||
windStrength = effect.getWind().getRange().createValue(random, effect.getWind().getTimeline().getValueAtTime(lifePercent));
|
||||
gravityStrength = effect.getGravity().getRange().createValue(random, effect.getGravity().getTimeline().getValueAtTime(lifePercent));
|
||||
}
|
||||
|
||||
private float calcEmittPause() {
|
||||
float emittedPerSecond = effect.getEmission().getRange().createValue(random, effect.getEmission().getTimeline().getValueAtTime(passedTime / maxTime));
|
||||
return 1000 / emittedPerSecond;
|
||||
}
|
||||
|
||||
public Lock getActiveParticleLock() {
|
||||
return activeParticleLock;
|
||||
}
|
||||
|
||||
public List<Particle> getActiveParticles() {
|
||||
return activeParticles;
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.example.particlelab.entities.particles;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.example.particlelab.entities.textures.TextureLoader;
|
||||
import com.example.particlelab.rendering.Timer;
|
||||
|
||||
/**
|
||||
* Created by Julian on 02.08.2016.
|
||||
*/
|
||||
public class ParticleSystem {
|
||||
|
||||
public static final float TRANSFER_VALUE = 0.002f;
|
||||
public final ParticleEffect explosion;
|
||||
private ParticleEffect[] effects;
|
||||
|
||||
private TextureLoader textureLoader;
|
||||
|
||||
public ParticleSystem(Context context) throws Exception {
|
||||
this.textureLoader = new TextureLoader(context);
|
||||
ParticleReader reader = new ParticleReader(context);
|
||||
explosion = reader.read("explosion.pe");
|
||||
|
||||
effects = new ParticleEffect[]{explosion};
|
||||
}
|
||||
|
||||
public void update(Timer timer) {
|
||||
for (ParticleEffect effect : effects)
|
||||
effect.update(timer);
|
||||
}
|
||||
|
||||
public void loadTextures() throws Exception {
|
||||
for (ParticleEffect effect : effects)
|
||||
effect.setTexture(textureLoader.loadTexture(effect.getTextureName()));
|
||||
}
|
||||
|
||||
public ParticleEffect[] getEffects() {
|
||||
return effects;
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package com.example.particlelab.entities.particles.attributes;
|
||||
|
||||
import com.example.particlelab.entities.particles.attributes.attributeValues.ParticleAttributeValue;
|
||||
import com.example.particlelab.entities.particles.attributes.attributeValues.ParticleAttributeValueType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Julian on 02.08.2016.
|
||||
*/
|
||||
public class Attribute {
|
||||
|
||||
private ParticleAttributeType type;
|
||||
private List<ParticleAttributeValue> values = new ArrayList<>();
|
||||
|
||||
public Attribute(ParticleAttributeType type, ParticleAttributeValueType... valueTypes) {
|
||||
this.type = type;
|
||||
for (ParticleAttributeValueType valueType : valueTypes)
|
||||
values.add(valueType.createInstance());
|
||||
}
|
||||
|
||||
public ParticleAttributeValue get(ParticleAttributeValueType valueType) throws Exception {
|
||||
for (ParticleAttributeValue v : values)
|
||||
if (v.getType() == valueType)
|
||||
return v;
|
||||
throw new Exception("ParticleAttributeValue with type: " + valueType + " does not exist in Attribute "+type);
|
||||
}
|
||||
|
||||
public ParticleAttributeType getType() {
|
||||
return type;
|
||||
}
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
package com.example.particlelab.entities.particles.attributes;
|
||||
|
||||
import com.example.particlelab.entities.particles.attributes.attributeValues.ImagePath;
|
||||
import com.example.particlelab.entities.particles.attributes.attributeValues.Options;
|
||||
import com.example.particlelab.entities.particles.attributes.attributeValues.ParticleAttributeValueType;
|
||||
import com.example.particlelab.entities.particles.attributes.attributeValues.Range;
|
||||
import com.example.particlelab.entities.particles.attributes.attributeValues.SpawnShape;
|
||||
import com.example.particlelab.entities.particles.attributes.attributeValues.Timeline;
|
||||
import com.example.particlelab.entities.particles.attributes.attributeValues.TintTimeline;
|
||||
|
||||
/**
|
||||
* Created by Julian on 02.08.2016.
|
||||
*/
|
||||
public class AttributeValueReader {
|
||||
|
||||
public void addValueForAttribute(Attribute attribute, String line) throws Exception {
|
||||
//RANGE
|
||||
if (line.startsWith("lowMin:") || line.startsWith("min:"))
|
||||
((Range) attribute.get(ParticleAttributeValueType.RANGE)).setLowMin(parseFloat(line));
|
||||
else if (line.startsWith("lowMax:") || line.startsWith("max:"))
|
||||
((Range) attribute.get(ParticleAttributeValueType.RANGE)).setLowMax(parseFloat(line));
|
||||
else if (line.startsWith("highMin:"))
|
||||
((Range) attribute.get(ParticleAttributeValueType.RANGE)).setHighMin(parseFloat(line));
|
||||
else if (line.startsWith("highMax:"))
|
||||
((Range) attribute.get(ParticleAttributeValueType.RANGE)).setHighMax(parseFloat(line));
|
||||
//TIMELINE
|
||||
else if (!line.startsWith("scalingCount") && line.startsWith("scaling"))
|
||||
((Timeline) attribute.get(ParticleAttributeValueType.TIMELINE)).setValueOfPoint(parseTimeLineIndex("scaling", line), parseFloat(line));
|
||||
else if (!line.startsWith("timelineCount") && line.startsWith("timeline") && attribute.getType() != ParticleAttributeType.TINT)
|
||||
((Timeline) attribute.get(ParticleAttributeValueType.TIMELINE)).setTimeOfPoint(parseTimeLineIndex("timeline", line), parseFloat(line));
|
||||
//TINT_TIMELINE
|
||||
else if (!line.startsWith("colorsCount") && line.startsWith("colors")) {
|
||||
int index = parseTimeLineIndex("colors", line);
|
||||
((TintTimeline) attribute.get(ParticleAttributeValueType.TINT_TIMELINE)).setValueOfPoint((int) (index / 3f), index % 3, parseFloat(line));
|
||||
} else if (!line.startsWith("timelineCount") && line.startsWith("timeline") && attribute.getType() == ParticleAttributeType.TINT)
|
||||
((TintTimeline) attribute.get(ParticleAttributeValueType.TINT_TIMELINE)).setTimeOfPoint(parseTimeLineIndex("timeline", line), parseFloat(line));
|
||||
//SPAWN_SHAPE
|
||||
else if (line.startsWith("shape:"))
|
||||
((SpawnShape) attribute.get(ParticleAttributeValueType.SPAWN_SHAPE)).setShape(SpawnShape.Shape.byName(parseString(line)));
|
||||
//OPTIONS
|
||||
else if (line.startsWith("attached:"))
|
||||
((Options) attribute.get(ParticleAttributeValueType.OPTIONS)).setAttached(parseBoolean(line));
|
||||
else if (line.startsWith("continuous:"))
|
||||
((Options) attribute.get(ParticleAttributeValueType.OPTIONS)).setContinuous(parseBoolean(line));
|
||||
else if (line.startsWith("aligned:"))
|
||||
((Options) attribute.get(ParticleAttributeValueType.OPTIONS)).setAligned(parseBoolean(line));
|
||||
else if (line.startsWith("additive:"))
|
||||
((Options) attribute.get(ParticleAttributeValueType.OPTIONS)).setAdditive(parseBoolean(line));
|
||||
else if (line.startsWith("behind:"))
|
||||
((Options) attribute.get(ParticleAttributeValueType.OPTIONS)).setBehind(parseBoolean(line));
|
||||
else if (line.startsWith("premultipliedAlpha:"))
|
||||
((Options) attribute.get(ParticleAttributeValueType.OPTIONS)).setPremultipliedAlpha(parseBoolean(line));
|
||||
//IMAGE PATH
|
||||
else if (attribute.getType() == ParticleAttributeType.IMAGE_PATH)
|
||||
((ImagePath) attribute.get(ParticleAttributeValueType.IMAGE_PATH)).setImagePath(line);
|
||||
}
|
||||
|
||||
private int parseTimeLineIndex(String start, String line) throws Exception {
|
||||
String asString = line.split(start)[1].split(":")[0];
|
||||
return Integer.parseInt(asString);
|
||||
}
|
||||
|
||||
private float parseFloat(String line) throws Exception {
|
||||
String asString = line.split(" ")[1];
|
||||
return Float.parseFloat(asString);
|
||||
}
|
||||
|
||||
private String parseString(String line) throws Exception {
|
||||
return line.split(" ")[1];
|
||||
}
|
||||
|
||||
private boolean parseBoolean(String line) throws Exception {
|
||||
String asString = line.split(" ")[1];
|
||||
return Boolean.parseBoolean(asString);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package com.example.particlelab.entities.particles.attributes;
|
||||
|
||||
import com.example.particlelab.entities.particles.attributes.attributeValues.ParticleAttributeValueType;
|
||||
|
||||
public enum ParticleAttributeType {
|
||||
NONE(""),
|
||||
DELAY("Delay", ParticleAttributeValueType.RANGE),
|
||||
DURATION("Duration", ParticleAttributeValueType.RANGE),
|
||||
COUNT("Count", ParticleAttributeValueType.RANGE),
|
||||
EMISSION("Emission", ParticleAttributeValueType.RANGE, ParticleAttributeValueType.TIMELINE),
|
||||
LIFE("Life", ParticleAttributeValueType.RANGE, ParticleAttributeValueType.TIMELINE),
|
||||
LIFE_OFFSET("Life Offset", ParticleAttributeValueType.RANGE, ParticleAttributeValueType.TIMELINE),
|
||||
X_OFFSET("X Offset", ParticleAttributeValueType.RANGE, ParticleAttributeValueType.TIMELINE),
|
||||
Y_OFFSET("Y Offset", ParticleAttributeValueType.RANGE, ParticleAttributeValueType.TIMELINE),
|
||||
SPAWN_SHAPE("Spawn Shape", ParticleAttributeValueType.SPAWN_SHAPE),
|
||||
SPAWN_WIDTH("Spawn Width", ParticleAttributeValueType.RANGE, ParticleAttributeValueType.TIMELINE),
|
||||
SPAWN_HEIGHT("Spawn Height", ParticleAttributeValueType.RANGE, ParticleAttributeValueType.TIMELINE),
|
||||
SCALE("Scale", ParticleAttributeValueType.RANGE, ParticleAttributeValueType.TIMELINE),
|
||||
VELOCITY("Velocity", ParticleAttributeValueType.RANGE, ParticleAttributeValueType.TIMELINE),
|
||||
ANGLE("Angle", ParticleAttributeValueType.RANGE, ParticleAttributeValueType.TIMELINE),
|
||||
ROTATION("Rotation", ParticleAttributeValueType.RANGE, ParticleAttributeValueType.TIMELINE),
|
||||
WIND("Wind", ParticleAttributeValueType.RANGE, ParticleAttributeValueType.TIMELINE),
|
||||
GRAVITY("Gravity", ParticleAttributeValueType.RANGE, ParticleAttributeValueType.TIMELINE),
|
||||
TINT("Tint", ParticleAttributeValueType.TINT_TIMELINE),
|
||||
TRANSPARENCY("Transparency", ParticleAttributeValueType.RANGE, ParticleAttributeValueType.TIMELINE),
|
||||
OPTIONS("Options", ParticleAttributeValueType.OPTIONS),
|
||||
IMAGE_PATH("Image Path", ParticleAttributeValueType.IMAGE_PATH);
|
||||
|
||||
private String name;
|
||||
private ParticleAttributeValueType[] valueTypes;
|
||||
|
||||
ParticleAttributeType(String name, ParticleAttributeValueType... valueTypes) {
|
||||
this.name = name;
|
||||
this.valueTypes = valueTypes;
|
||||
}
|
||||
|
||||
private String getInFileTitle() {
|
||||
return "- " + name + " -";
|
||||
}
|
||||
|
||||
public static ParticleAttributeType getByInFileTitle(String title) throws Exception {
|
||||
for (ParticleAttributeType setting : values()) {
|
||||
if (setting != NONE && setting.getInFileTitle().equals(title))
|
||||
return setting;
|
||||
}
|
||||
throw new Exception("Could not find ParticleAttributeType by title: " + title);
|
||||
}
|
||||
|
||||
public Attribute createInstance() throws Exception {
|
||||
if (this == NONE)
|
||||
throw new Exception("Cannot create Instance from Attribute NONE");
|
||||
return new Attribute(this, valueTypes);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.example.particlelab.entities.particles.attributes.attributeValues;
|
||||
|
||||
/**
|
||||
* Created by Julian on 02.08.2016.
|
||||
*/
|
||||
public class ImagePath extends ParticleAttributeValue {
|
||||
|
||||
private String imagePath;
|
||||
|
||||
public ImagePath() {
|
||||
super(ParticleAttributeValueType.IMAGE_PATH);
|
||||
}
|
||||
|
||||
public String getImagePath() {
|
||||
return imagePath;
|
||||
}
|
||||
|
||||
public void setImagePath(String imagePath) {
|
||||
this.imagePath = imagePath;
|
||||
}
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
package com.example.particlelab.entities.particles.attributes.attributeValues;
|
||||
|
||||
/**
|
||||
* Created by Julian on 02.08.2016.
|
||||
*/
|
||||
public class Options extends ParticleAttributeValue {
|
||||
|
||||
private boolean attached;
|
||||
private boolean continuous;
|
||||
private boolean aligned;
|
||||
private boolean additive;
|
||||
private boolean behind;
|
||||
private boolean premultipliedAlpha;
|
||||
|
||||
public Options() {
|
||||
super(ParticleAttributeValueType.OPTIONS);
|
||||
}
|
||||
|
||||
public boolean isAttached() {
|
||||
return attached;
|
||||
}
|
||||
|
||||
public void setAttached(boolean attached) {
|
||||
this.attached = attached;
|
||||
}
|
||||
|
||||
public boolean isContinuous() {
|
||||
return continuous;
|
||||
}
|
||||
|
||||
public void setContinuous(boolean continuous) {
|
||||
this.continuous = continuous;
|
||||
}
|
||||
|
||||
public boolean isAligned() {
|
||||
return aligned;
|
||||
}
|
||||
|
||||
public void setAligned(boolean aligned) {
|
||||
this.aligned = aligned;
|
||||
}
|
||||
|
||||
public boolean isAdditive() {
|
||||
return additive;
|
||||
}
|
||||
|
||||
public void setAdditive(boolean additive) {
|
||||
this.additive = additive;
|
||||
}
|
||||
|
||||
public boolean isBehind() {
|
||||
return behind;
|
||||
}
|
||||
|
||||
public void setBehind(boolean behind) {
|
||||
this.behind = behind;
|
||||
}
|
||||
|
||||
public boolean isPremultipliedAlpha() {
|
||||
return premultipliedAlpha;
|
||||
}
|
||||
|
||||
public void setPremultipliedAlpha(boolean premultipliedAlpha) {
|
||||
this.premultipliedAlpha = premultipliedAlpha;
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.example.particlelab.entities.particles.attributes.attributeValues;
|
||||
|
||||
/**
|
||||
* Created by Julian on 02.08.2016.
|
||||
*/
|
||||
public abstract class ParticleAttributeValue {
|
||||
|
||||
private ParticleAttributeValueType type;
|
||||
|
||||
public ParticleAttributeValue(ParticleAttributeValueType type){
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public ParticleAttributeValueType getType() {
|
||||
return type;
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package com.example.particlelab.entities.particles.attributes.attributeValues;
|
||||
|
||||
/**
|
||||
* Created by Julian on 02.08.2016.
|
||||
*/
|
||||
public enum ParticleAttributeValueType {
|
||||
|
||||
RANGE, TIMELINE, TINT_TIMELINE, SPAWN_SHAPE, OPTIONS, IMAGE_PATH;
|
||||
|
||||
public ParticleAttributeValue createInstance(){
|
||||
switch (this){
|
||||
case RANGE:
|
||||
return new Range();
|
||||
case TIMELINE:
|
||||
return new Timeline();
|
||||
case TINT_TIMELINE:
|
||||
return new TintTimeline();
|
||||
case SPAWN_SHAPE:
|
||||
return new SpawnShape();
|
||||
case OPTIONS:
|
||||
return new Options();
|
||||
case IMAGE_PATH:
|
||||
return new ImagePath();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
package com.example.particlelab.entities.particles.attributes.attributeValues;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* Created by Julian on 02.08.2016.
|
||||
*/
|
||||
public class Range extends ParticleAttributeValue {
|
||||
|
||||
private float lowMin;
|
||||
private float lowMax;
|
||||
private float highMin;
|
||||
private float highMax;
|
||||
|
||||
public Range() {
|
||||
super(ParticleAttributeValueType.RANGE);
|
||||
}
|
||||
|
||||
public Range createNormalizedInstance(Random random) {
|
||||
Range range = new Range();
|
||||
float high = createHighValue(random);
|
||||
range.setHighMax(high);
|
||||
range.setHighMin(high);
|
||||
float low = createLowValue(random);
|
||||
range.setLowMax(low);
|
||||
range.setLowMin(low);
|
||||
return range;
|
||||
}
|
||||
|
||||
public float createValue(Random random, float mix) {
|
||||
if (mix == 1)
|
||||
return createHighValue(random);
|
||||
else if (mix == 0)
|
||||
return createLowValue(random);
|
||||
else {
|
||||
float highValue = createHighValue(random);
|
||||
float lowValue = createLowValue(random);
|
||||
return mix * (highValue - lowValue) + lowValue;
|
||||
}
|
||||
}
|
||||
|
||||
private float createHighValue(Random random) {
|
||||
float min = highMin;
|
||||
float max = highMax;
|
||||
if (min == max)
|
||||
return min;
|
||||
return random.nextFloat() * (max - min) + min;
|
||||
}
|
||||
|
||||
private float createLowValue(Random random) {
|
||||
float min = lowMin;
|
||||
float max = lowMax;
|
||||
if (min == max)
|
||||
return min;
|
||||
return random.nextFloat() * (max - min) + min;
|
||||
}
|
||||
|
||||
public void setLowMin(float lowMin) {
|
||||
this.lowMin = lowMin;
|
||||
}
|
||||
|
||||
public void setLowMax(float lowMax) {
|
||||
this.lowMax = lowMax;
|
||||
}
|
||||
|
||||
public void setHighMin(float highMin) {
|
||||
this.highMin = highMin;
|
||||
}
|
||||
|
||||
public void setHighMax(float highMax) {
|
||||
this.highMax = highMax;
|
||||
}
|
||||
|
||||
private boolean isLowDifference() {
|
||||
return lowMin - lowMax != 0;
|
||||
}
|
||||
|
||||
private boolean isHighDifference() {
|
||||
return highMin - highMax != 0;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package com.example.particlelab.entities.particles.attributes.attributeValues;
|
||||
|
||||
/**
|
||||
* Created by Julian on 02.08.2016.
|
||||
*/
|
||||
public class SpawnShape extends ParticleAttributeValue {
|
||||
|
||||
public enum Shape {
|
||||
POINT("point"), SQUARE("square");
|
||||
|
||||
private String name;
|
||||
|
||||
Shape(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public static Shape byName(String text) throws Exception{
|
||||
for(Shape shape : values())
|
||||
if(shape.name.equals(text))
|
||||
return shape;
|
||||
throw new Exception("Shape with name \""+text+"\" does not exist");
|
||||
}
|
||||
}
|
||||
|
||||
private Shape shape;
|
||||
|
||||
public SpawnShape() {
|
||||
super(ParticleAttributeValueType.SPAWN_SHAPE);
|
||||
}
|
||||
|
||||
public Shape getShape() {
|
||||
return shape;
|
||||
}
|
||||
|
||||
public void setShape(Shape shape) {
|
||||
this.shape = shape;
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package com.example.particlelab.entities.particles.attributes.attributeValues;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Julian on 02.08.2016.
|
||||
*/
|
||||
public class Timeline extends ParticleAttributeValue {
|
||||
|
||||
private List<TimelinePoint> points = new ArrayList<>();
|
||||
|
||||
public Timeline() {
|
||||
super(ParticleAttributeValueType.TIMELINE);
|
||||
}
|
||||
|
||||
public void setValueOfPoint(int index, float value) {
|
||||
if (points.size() <= index) {
|
||||
points.add(new TimelinePoint());
|
||||
}
|
||||
points.get(index).setValue(value);
|
||||
}
|
||||
|
||||
public void setTimeOfPoint(int index, float time) {
|
||||
if (points.size() <= index) {
|
||||
points.add(new TimelinePoint());
|
||||
}
|
||||
points.get(index).setTime(time);
|
||||
}
|
||||
|
||||
public float getValueAtTime(float time) {
|
||||
TimelinePoint left = null, right = null;
|
||||
for (TimelinePoint point : points) {
|
||||
if (point.getTime() <= time) {
|
||||
if (left == null || left.getTime() < point.getTime())
|
||||
left = point;
|
||||
} else if (right == null || right.getTime() > point.getTime())
|
||||
right = point;
|
||||
}
|
||||
if (left != null) {
|
||||
if (right != null) {
|
||||
float leftDist = 1 - Math.abs(left.getTime() - time);
|
||||
float rightDist = 1 - Math.abs(right.getTime() - time);
|
||||
float totalDist = leftDist + rightDist;
|
||||
return left.getValue() * (leftDist / totalDist) + right.getValue() * (rightDist / totalDist);
|
||||
}
|
||||
return left.getValue();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.example.particlelab.entities.particles.attributes.attributeValues;
|
||||
|
||||
public class TimelinePoint {
|
||||
|
||||
private float time, value;
|
||||
|
||||
public float getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(float time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public float getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(float value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package com.example.particlelab.entities.particles.attributes.attributeValues;
|
||||
|
||||
import com.example.particlelab.entities.particles.attributes.attributeValues.Range;
|
||||
import com.example.particlelab.entities.particles.attributes.attributeValues.Timeline;
|
||||
|
||||
/**
|
||||
* Created by Julian on 02.08.2016.
|
||||
*/
|
||||
public class TimelineRange {
|
||||
|
||||
private Timeline timeline;
|
||||
private Range range;
|
||||
|
||||
public TimelineRange(Timeline timeline, Range range) {
|
||||
this.timeline = timeline;
|
||||
this.range = range;
|
||||
}
|
||||
|
||||
public Timeline getTimeline() {
|
||||
return timeline;
|
||||
}
|
||||
|
||||
public void setTimeline(Timeline timeline) {
|
||||
this.timeline = timeline;
|
||||
}
|
||||
|
||||
public Range getRange() {
|
||||
return range;
|
||||
}
|
||||
|
||||
public void setRange(Range range) {
|
||||
this.range = range;
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package com.example.particlelab.entities.particles.attributes.attributeValues;
|
||||
|
||||
import com.example.particlelab.data.Color;
|
||||
import com.example.particlelab.main.GameLog;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Julian on 02.08.2016.
|
||||
*/
|
||||
public class TintTimeline extends ParticleAttributeValue {
|
||||
|
||||
private List<TintTimelinePoint> points = new ArrayList<>();
|
||||
|
||||
public TintTimeline() {
|
||||
super(ParticleAttributeValueType.TINT_TIMELINE);
|
||||
}
|
||||
|
||||
public void setValueOfPoint(int index, int colorIndex, float value) {
|
||||
GameLog.i("Set value: index="+index+"; colorIndex="+colorIndex+"; value="+value);
|
||||
if (points.size() <= index) {
|
||||
points.add(new TintTimelinePoint());
|
||||
}
|
||||
points.get(index).setValue(colorIndex, value);
|
||||
}
|
||||
|
||||
public void setTimeOfPoint(int index, float time) {
|
||||
GameLog.i("Set time: index="+index+"; time="+time);
|
||||
if (points.size() <= index) {
|
||||
points.add(new TintTimelinePoint());
|
||||
}
|
||||
points.get(index).setTime(time);
|
||||
}
|
||||
|
||||
public Color getValueAtTime(float time) {
|
||||
TintTimelinePoint left = null, right = null;
|
||||
for (TintTimelinePoint point : points) {
|
||||
if (point.getTime() <= time) {
|
||||
if (left == null || left.getTime() < point.getTime())
|
||||
left = point;
|
||||
} else if (right == null || right.getTime() > point.getTime())
|
||||
right = point;
|
||||
}
|
||||
if (left != null) {
|
||||
if (right != null) {
|
||||
float leftDist = 1 - Math.abs(left.getTime() - time);
|
||||
float rightDist = 1 - Math.abs(right.getTime() - time);
|
||||
float totalDist = leftDist + rightDist;
|
||||
return left.getColor().mix((leftDist / totalDist), (rightDist / totalDist), right.getColor());
|
||||
}
|
||||
return left.getColor();
|
||||
}
|
||||
return new Color();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package com.example.particlelab.entities.particles.attributes.attributeValues;
|
||||
|
||||
import com.example.particlelab.data.Color;
|
||||
|
||||
public class TintTimelinePoint {
|
||||
|
||||
private float time;
|
||||
private Color color;
|
||||
|
||||
public float getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(float time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public Color getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
public void setValue(int colorIndex, float value) {
|
||||
if (color == null)
|
||||
color = new Color();
|
||||
if (colorIndex == 0)
|
||||
color.setR(value);
|
||||
else if (colorIndex == 1)
|
||||
color.setG(value);
|
||||
else if (colorIndex == 2)
|
||||
color.setB(value);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package com.example.particlelab.entities.textures;
|
||||
|
||||
/**
|
||||
* Created by Julian on 11.12.2015.
|
||||
*/
|
||||
public class Texture {
|
||||
|
||||
private int id;
|
||||
private int atlasWidth;
|
||||
private int atlasHeight;
|
||||
private int atlasIndex;
|
||||
|
||||
public Texture(int id, int atlasWidth, int atlasHeight) {
|
||||
this.id = id;
|
||||
this.atlasWidth = atlasWidth;
|
||||
this.atlasHeight = atlasHeight;
|
||||
}
|
||||
|
||||
public Texture(Texture other) {
|
||||
this.id = other.getId();
|
||||
this.atlasWidth = other.getAtlasWidth();
|
||||
this.atlasHeight = other.getAtlasHeight();
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getAtlasWidth() {
|
||||
return atlasWidth;
|
||||
}
|
||||
|
||||
public int getAtlasHeight() {
|
||||
return atlasHeight;
|
||||
}
|
||||
|
||||
public int getAtlasIndex() {
|
||||
return atlasIndex;
|
||||
}
|
||||
|
||||
public void setAtlasIndex(int atlasIndex) {
|
||||
this.atlasIndex = atlasIndex;
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package com.example.particlelab.entities.textures;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.opengl.GLES20;
|
||||
import android.opengl.GLUtils;
|
||||
|
||||
import com.example.particlelab.main.GameLog;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* Created by Julian on 26.11.2015.
|
||||
*/
|
||||
public class TextureLoader {
|
||||
|
||||
private Context context;
|
||||
|
||||
public TextureLoader(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public int loadTextureId(int texture, boolean isAtlas) {
|
||||
Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), texture);
|
||||
return loadTextureId(bitmap, isAtlas);
|
||||
}
|
||||
|
||||
public Texture loadTexture(String inAssetsLocation) throws Exception {
|
||||
InputStream is = context.getAssets().open(inAssetsLocation);
|
||||
BitmapFactory.Options options = new BitmapFactory.Options();
|
||||
options.inScaled = false;
|
||||
Bitmap bitmap = BitmapFactory.decodeStream(is, null, options);
|
||||
return new Texture(loadTextureId(bitmap, false), 1, 1);
|
||||
}
|
||||
|
||||
private int loadTextureId(Bitmap bitmap, boolean isAtlas) {
|
||||
int id = genTexture();
|
||||
|
||||
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, id);
|
||||
if (!isAtlas) {
|
||||
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_NEAREST);
|
||||
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
|
||||
} else {
|
||||
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_NEAREST);
|
||||
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
|
||||
}
|
||||
|
||||
GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, bitmap, 0);
|
||||
|
||||
bitmap.recycle();
|
||||
GameLog.d("Texture " + id + " successfully loaded");
|
||||
return id;
|
||||
}
|
||||
|
||||
private int genTexture() {
|
||||
int[] idField = new int[1];
|
||||
GLES20.glGenTextures(1, idField, 0);
|
||||
return idField[0];
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package com.example.particlelab.entities.textures;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.example.particlelab.R;
|
||||
|
||||
/**
|
||||
* Created by Julian on 05.12.2015.
|
||||
*/
|
||||
public class TexturePack {
|
||||
|
||||
private TextureLoader loader;
|
||||
|
||||
public final Texture star;
|
||||
public final Texture yellowParticle;
|
||||
public final Texture redParticle;
|
||||
|
||||
public TexturePack(Context context) {
|
||||
loader = new TextureLoader(context);
|
||||
star = loadTexture(R.drawable.star);
|
||||
|
||||
yellowParticle = loadTexture(R.drawable.yellowparticle);
|
||||
redParticle = loadTexture(R.drawable.redparticle);
|
||||
}
|
||||
|
||||
private Texture loadTexture(int id) {
|
||||
int texId = loader.loadTextureId(id, false);
|
||||
return new Texture(texId, 1, 1);
|
||||
}
|
||||
|
||||
public Texture loadAtlas(int id, int atlasWidth, int atlasHeight) {
|
||||
int texId = loader.loadTextureId(id, true);
|
||||
return new Texture(texId, atlasWidth, atlasHeight);
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package com.example.particlelab.main;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
* Created by Julian on 23.11.2015.
|
||||
*/
|
||||
public class GameLog {
|
||||
|
||||
private final static String TAG = "GameLog";
|
||||
public static boolean debugging = true;
|
||||
|
||||
public static void i(String message) {
|
||||
Log.i(TAG + getCallerInfo(), message);
|
||||
}
|
||||
|
||||
public static void d(String message) {
|
||||
if (debugging)
|
||||
Log.d(TAG + getCallerInfo(), message);
|
||||
}
|
||||
|
||||
public static void e(String message) {
|
||||
Log.e(TAG + getCallerInfo(), message);
|
||||
}
|
||||
|
||||
public static void e(Throwable error) {
|
||||
Log.e(TAG + getCallerInfo(), error.getMessage(), error);
|
||||
}
|
||||
|
||||
//Possible to get Method which called i, d, e
|
||||
//Method found at stack[4]
|
||||
public static void stack() {
|
||||
StackTraceElement[] stack = Thread.currentThread().getStackTrace();
|
||||
Log.i(TAG + "Stack", "StackSize: " + stack.length);
|
||||
for (int i = 0; i < stack.length; i++) {
|
||||
Log.i(TAG + "Stack", i + ": " + stack[i]);
|
||||
}
|
||||
}
|
||||
|
||||
private static String getCallerInfo() {
|
||||
StackTraceElement[] stack = Thread.currentThread().getStackTrace();
|
||||
return "(" + stack[4].getFileName() + ", " + stack[4].getMethodName() + ", " + stack[4].getLineNumber() + ")";
|
||||
}
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
package com.example.particlelab.main;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
import android.content.Context;
|
||||
import android.content.pm.ConfigurationInfo;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import com.example.particlelab.entities.particles.ParticleReader;
|
||||
import com.example.particlelab.entities.particles.ParticleSystem;
|
||||
import com.example.particlelab.rendering.GameRenderer;
|
||||
import com.example.particlelab.rendering.Rendering;
|
||||
|
||||
/**
|
||||
* Created by Julian on 02.08.2016.
|
||||
*/
|
||||
public class MainActivity extends Activity {
|
||||
|
||||
private MyGlSurfaceView glSurfaceView;
|
||||
private ParticleSystem particleSystem;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
try {
|
||||
GameLog.d("OnCreate");
|
||||
super.onCreate(savedInstanceState);
|
||||
super.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
super.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
||||
WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
if (!hasGLES20())
|
||||
throw new Exception("OpenGL ES 2.0 not supported");
|
||||
|
||||
particleSystem = new ParticleSystem(this);
|
||||
Rendering rendering = new Rendering(this, particleSystem);
|
||||
glSurfaceView = new MyGlSurfaceView(this, new GameRenderer(this,rendering));
|
||||
super.setContentView(glSurfaceView);
|
||||
} catch (Exception e) {
|
||||
onException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void onException(Exception e) {
|
||||
GameLog.e(e);
|
||||
super.finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
GameLog.d("OnPause");
|
||||
glSurfaceView.onPause();
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
GameLog.d("OnResume");
|
||||
glSurfaceView.onResume();
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
GameLog.d("OnDestroy");
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
}
|
||||
|
||||
private boolean hasGLES20() {
|
||||
ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
|
||||
ConfigurationInfo info = am.getDeviceConfigurationInfo();
|
||||
return info.reqGlEsVersion >= 0x20000;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package com.example.particlelab.main;
|
||||
|
||||
import android.content.Context;
|
||||
import android.opengl.GLSurfaceView;
|
||||
|
||||
import com.example.particlelab.rendering.GameRenderer;
|
||||
|
||||
/**
|
||||
* Created by Julian on 30.07.2016.
|
||||
*/
|
||||
public class MyGlSurfaceView extends GLSurfaceView {
|
||||
|
||||
private boolean rendererSet;
|
||||
|
||||
public MyGlSurfaceView(Context context, GameRenderer gameRenderer) throws Exception {
|
||||
super(context);
|
||||
super.setEGLContextClientVersion(2);
|
||||
super.setRenderer(gameRenderer);
|
||||
rendererSet = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
GameLog.i("SurfaceView: onResume");
|
||||
if (rendererSet)
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
GameLog.i("SurfaceView: onPause");
|
||||
if (rendererSet)
|
||||
super.onPause();
|
||||
}
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package com.example.particlelab.main;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.example.particlelab.data.Vector;
|
||||
import com.example.particlelab.entities.Entity;
|
||||
import com.example.particlelab.entities.particles.ParticleSource;
|
||||
import com.example.particlelab.entities.particles.ParticleSystem;
|
||||
import com.example.particlelab.entities.textures.TexturePack;
|
||||
import com.example.particlelab.rendering.Timer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* Created by Julian on 20.07.2016.
|
||||
*/
|
||||
public class Scene extends ArrayList<Entity> {
|
||||
|
||||
public float cameraX;
|
||||
|
||||
private Vector screenSize;
|
||||
|
||||
private ParticleSystem particleSystem;
|
||||
private TexturePack textures;
|
||||
|
||||
public Scene(Context context, TexturePack texturePack, ParticleSystem particleSystem) {
|
||||
this.particleSystem = particleSystem;
|
||||
setTexturePack(texturePack);
|
||||
new ParticleSource(new Vector(0, 0), particleSystem.explosion).start();
|
||||
}
|
||||
|
||||
public void setTexturePack(TexturePack texturePack) {
|
||||
this.textures = texturePack;
|
||||
|
||||
}
|
||||
|
||||
public void update(Timer timer) {
|
||||
Iterator<Entity> iterator = super.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = iterator.next();
|
||||
Vector movement = entity.getMovement();
|
||||
Vector finalMovement = new Vector(movement).mul(timer.getFrameTime());
|
||||
entity.move(finalMovement);
|
||||
if (entity.getRightEdge() - cameraX < -3f) {
|
||||
iterator.remove();
|
||||
super.remove(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Vector calcWorldFromScreenCoords(float screenX, float screenY) throws Exception {
|
||||
if (screenSize == null)
|
||||
throw new Exception("ScreenSize not set");
|
||||
float glCoordWidth = (2f * screenSize.x / screenSize.y);
|
||||
float x = ((screenX / screenSize.x) * 2f - 1f) * glCoordWidth / 2;
|
||||
x += cameraX;
|
||||
float y = -((screenY / screenSize.y) * 2f - 1f);
|
||||
return new Vector(x, y);
|
||||
}
|
||||
|
||||
public void setScreenSize(Vector screenSize) {
|
||||
this.screenSize = screenSize;
|
||||
}
|
||||
|
||||
public ParticleSystem getParticleSystem() {
|
||||
return particleSystem;
|
||||
}
|
||||
}
|
@ -0,0 +1,124 @@
|
||||
package com.example.particlelab.rendering;
|
||||
|
||||
import android.content.Context;
|
||||
import android.opengl.GLES20;
|
||||
import android.opengl.GLSurfaceView;
|
||||
|
||||
import com.example.particlelab.data.Color;
|
||||
import com.example.particlelab.entities.Entity;
|
||||
import com.example.particlelab.entities.particles.ParticleEffect;
|
||||
import com.example.particlelab.entities.particles.ParticleSource;
|
||||
import com.example.particlelab.entities.particles.ParticleSystem;
|
||||
import com.example.particlelab.entities.textures.TexturePack;
|
||||
import com.example.particlelab.main.GameLog;
|
||||
import com.example.particlelab.main.Scene;
|
||||
|
||||
import javax.microedition.khronos.egl.EGLConfig;
|
||||
import javax.microedition.khronos.opengles.GL10;
|
||||
|
||||
/**
|
||||
* Created by Julian on 22.11.2015.
|
||||
*/
|
||||
public class GameRenderer implements GLSurfaceView.Renderer {
|
||||
|
||||
private Rendering rendering;
|
||||
private MatrixCreator matrixCreator;
|
||||
private boolean additiveBlending;
|
||||
|
||||
private Color emptyColor;
|
||||
private Context context;
|
||||
private Quad quad;
|
||||
//GL Context
|
||||
private ShaderProgram shaderProgram;
|
||||
private TexturePack texturePack;
|
||||
private Timer timer;
|
||||
|
||||
public GameRenderer(Context context, Rendering rendering) {
|
||||
this.context = context;
|
||||
this.rendering = rendering;
|
||||
emptyColor = new Color(-1, -1, -1);
|
||||
matrixCreator = new MatrixCreator();
|
||||
quad = new Quad();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
|
||||
GameLog.d("onSurfaceCreated");
|
||||
GLES20.glClearColor(0, 0, 0, 1.0f);
|
||||
gl.glEnable(GL10.GL_BLEND);
|
||||
gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
|
||||
try {
|
||||
shaderProgram = new ShaderProgram(context);
|
||||
texturePack = new TexturePack(context);
|
||||
timer = new Timer();
|
||||
} catch (Exception e) {
|
||||
rendering.onException(e);
|
||||
}
|
||||
rendering.initiate(texturePack, timer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSurfaceChanged(GL10 gl, int width, int height) {
|
||||
GameLog.d("onSurfaceChanged: width=" + width + ", height=" + height);
|
||||
GLES20.glViewport(0, 0, width, height);
|
||||
matrixCreator.setMVPMSize(width, height);
|
||||
rendering.setScreenSize(width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDrawFrame(GL10 gl) {
|
||||
timer.update();
|
||||
rendering.update();
|
||||
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
|
||||
|
||||
Scene scene = rendering.getScene();
|
||||
ParticleSystem particleSystem = scene.getParticleSystem();
|
||||
|
||||
shaderProgram.start();
|
||||
shaderProgram.loadMVPMatrix(matrixCreator, scene.cameraX);
|
||||
for (ParticleEffect effect : particleSystem.getEffects()) {
|
||||
gl.glActiveTexture(GL10.GL_TEXTURE0);
|
||||
gl.glBindTexture(GL10.GL_TEXTURE_2D, effect.getTexture().getId());
|
||||
shaderProgram.loadTextureAtlasInfos(effect.getTexture());
|
||||
|
||||
if (effect.getOptions().isAdditive() && !additiveBlending)
|
||||
enableAdditiveBlending(gl);
|
||||
if (!effect.getOptions().isAdditive() && additiveBlending)
|
||||
disableAdditiveBlending(gl);
|
||||
for (ParticleSource source : effect.getSources()) {
|
||||
source.getActiveParticleLock().lock();
|
||||
for (Entity particle : source.getActiveParticles())
|
||||
renderParticle(gl, particle);
|
||||
source.getActiveParticleLock().unlock();
|
||||
}
|
||||
}
|
||||
shaderProgram.stop();
|
||||
}
|
||||
|
||||
private void renderEntity(GL10 gl, Entity entity) {
|
||||
gl.glActiveTexture(GL10.GL_TEXTURE0);
|
||||
gl.glBindTexture(GL10.GL_TEXTURE_2D, entity.getTexture().getId());
|
||||
shaderProgram.loadTransformationMatrix(matrixCreator, entity);
|
||||
shaderProgram.loadAlpha(entity.getAlpha());
|
||||
shaderProgram.loadTextureAtlasInfos(entity.getTexture());
|
||||
shaderProgram.loadColor(entity.getColor() != null ? entity.getColor() : emptyColor);
|
||||
quad.draw();
|
||||
}
|
||||
|
||||
private void renderParticle(GL10 gl, Entity entity) {
|
||||
shaderProgram.loadTransformationMatrix(matrixCreator, entity);
|
||||
shaderProgram.loadAlpha(entity.getAlpha());
|
||||
shaderProgram.loadColor(entity.getColor() != null ? entity.getColor() : emptyColor);
|
||||
quad.draw();
|
||||
}
|
||||
|
||||
private void enableAdditiveBlending(GL10 gl) {
|
||||
additiveBlending = true;
|
||||
gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE);
|
||||
}
|
||||
|
||||
private void disableAdditiveBlending(GL10 gl) {
|
||||
additiveBlending = false;
|
||||
gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.example.particlelab.rendering;
|
||||
|
||||
public class Lock {
|
||||
|
||||
private boolean isLocked = false;
|
||||
|
||||
public synchronized void lock() {
|
||||
while (isLocked) {
|
||||
try {
|
||||
wait();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
isLocked = true;
|
||||
}
|
||||
|
||||
public synchronized void unlock() {
|
||||
isLocked = false;
|
||||
notify();
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package com.example.particlelab.rendering;
|
||||
|
||||
import android.opengl.Matrix;
|
||||
|
||||
import com.example.particlelab.entities.Entity;
|
||||
import com.example.particlelab.data.Vector;
|
||||
|
||||
/**
|
||||
* Created by Julian on 23.11.2015.
|
||||
*/
|
||||
public class MatrixCreator {
|
||||
|
||||
private float width, height;
|
||||
|
||||
public void setMVPMSize(float width, float height) {
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public float[] createModelViewProjectionMatrix(float cameraX) {
|
||||
float[] mvpMatrix = new float[16];
|
||||
float[] projectionMatrix = new float[16];
|
||||
float[] viewMatrix = new float[16];
|
||||
|
||||
float ratio = width / height;
|
||||
Matrix.frustumM(projectionMatrix, 0, -ratio + cameraX, ratio + cameraX, -1, 1, 1, 2);
|
||||
Matrix.setLookAtM(viewMatrix, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0);
|
||||
Matrix.multiplyMM(mvpMatrix, 0, projectionMatrix, 0, viewMatrix, 0);
|
||||
return mvpMatrix;
|
||||
}
|
||||
|
||||
public float[] createTransformationMatrix(Entity entity) {
|
||||
float width = entity.getWidth();
|
||||
float height = entity.getHeight();
|
||||
float rotation = entity.getRotation();
|
||||
Vector position = entity.getPosition();
|
||||
return createTransformationMatrix(width, height, rotation, position);
|
||||
}
|
||||
|
||||
public float[] createTransformationMatrix(float width, float height, float rotation, Vector position) {
|
||||
float[] transformationMatrix = new float[16];
|
||||
Matrix.setIdentityM(transformationMatrix, 0);
|
||||
Matrix.translateM(transformationMatrix, 0, position.x, position.y, 0);
|
||||
Matrix.rotateM(transformationMatrix, 0, rotation, 0, 0, 1);
|
||||
Matrix.scaleM(transformationMatrix, 0, width * .5f, height * .5f, 0);
|
||||
return transformationMatrix;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package com.example.particlelab.rendering;
|
||||
|
||||
import android.opengl.GLES20;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.nio.FloatBuffer;
|
||||
|
||||
/**
|
||||
* Created by Julian on 26.11.2015.
|
||||
*/
|
||||
public class Quad {
|
||||
|
||||
private FloatBuffer vertexBuffer;
|
||||
private FloatBuffer textureBuffer;
|
||||
|
||||
private float vertices[] = {1.0f, 1.0f, -1.0f, -1.0f, 1.0f, -1.0f,
|
||||
1.0f, 1.0f, -1.0f, 1.0f, -1.0f, -1.0f};
|
||||
|
||||
private float textures[] = {1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
|
||||
|
||||
public Quad() {
|
||||
vertexBuffer = createEmptyFloatBuffer();
|
||||
vertexBuffer.put(vertices);
|
||||
vertexBuffer.position(0);
|
||||
|
||||
textureBuffer = createEmptyFloatBuffer();
|
||||
textureBuffer.put(textures);
|
||||
textureBuffer.position(0);
|
||||
}
|
||||
|
||||
private FloatBuffer createEmptyFloatBuffer() {
|
||||
ByteBuffer bb = ByteBuffer.allocateDirect(vertices.length * 4);
|
||||
bb.order(ByteOrder.nativeOrder());
|
||||
return bb.asFloatBuffer();
|
||||
}
|
||||
|
||||
public void draw() {
|
||||
GLES20.glEnableVertexAttribArray(0);
|
||||
GLES20.glEnableVertexAttribArray(1);
|
||||
GLES20.glVertexAttribPointer(0, 2, GLES20.GL_FLOAT, false, 0, vertexBuffer);
|
||||
GLES20.glVertexAttribPointer(1, 2, GLES20.GL_FLOAT, false, 0, textureBuffer);
|
||||
GLES20.glDrawArrays(GLES20.GL_TRIANGLES, 0, vertices.length / 2);
|
||||
GLES20.glDisableVertexAttribArray(1);
|
||||
GLES20.glDisableVertexAttribArray(0);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package com.example.particlelab.rendering;
|
||||
|
||||
import com.example.particlelab.entities.particles.ParticleSystem;
|
||||
import com.example.particlelab.entities.textures.TexturePack;
|
||||
import com.example.particlelab.main.MainActivity;
|
||||
import com.example.particlelab.main.Scene;
|
||||
import com.example.particlelab.data.Vector;
|
||||
|
||||
/**
|
||||
* Created by Julian on 26.11.2015.
|
||||
*/
|
||||
public class Rendering {
|
||||
|
||||
private MainActivity mainActivity;
|
||||
private ParticleSystem particleSystem;
|
||||
private Timer timer;
|
||||
private Scene scene;
|
||||
private boolean alreadyInitiated = false;
|
||||
|
||||
public Rendering(MainActivity mainActivity, ParticleSystem particleSystem) {
|
||||
this.mainActivity = mainActivity;
|
||||
this.particleSystem = particleSystem;
|
||||
}
|
||||
|
||||
public void initiate(TexturePack texturePack, Timer timer) {
|
||||
this.timer = timer;
|
||||
if(!alreadyInitiated)
|
||||
scene = new Scene(mainActivity, texturePack, particleSystem);
|
||||
else {
|
||||
scene.setTexturePack(texturePack);
|
||||
}
|
||||
try {
|
||||
particleSystem.loadTextures();
|
||||
}catch (Exception e){
|
||||
onException(e);
|
||||
}
|
||||
alreadyInitiated = true;
|
||||
}
|
||||
|
||||
public void update() {
|
||||
particleSystem.update(timer);
|
||||
scene.update(timer);
|
||||
}
|
||||
|
||||
public void setScreenSize(int width, int height) {
|
||||
if (scene != null)
|
||||
scene.setScreenSize(new Vector(width, height));
|
||||
}
|
||||
|
||||
public void onException(Exception e) {
|
||||
mainActivity.onException(e);
|
||||
}
|
||||
|
||||
public Scene getScene() {
|
||||
return scene;
|
||||
}
|
||||
}
|
@ -0,0 +1,138 @@
|
||||
package com.example.particlelab.rendering;
|
||||
|
||||
import android.content.Context;
|
||||
import android.opengl.GLES20;
|
||||
|
||||
import com.example.particlelab.entities.Entity;
|
||||
import com.example.particlelab.data.Color;
|
||||
import com.example.particlelab.entities.textures.Texture;
|
||||
import com.example.particlelab.main.GameLog;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
/**
|
||||
* Created by Julian on 23.11.2015.
|
||||
*/
|
||||
public class ShaderProgram {
|
||||
|
||||
private Context context;
|
||||
private int vertexShader, fragmentShader, program;
|
||||
private int location_mvpMatrix;
|
||||
private int location_transformationMatrix;
|
||||
private int location_alpha;
|
||||
private int location_texAtlasSize;
|
||||
private int location_texAtlasIndex;
|
||||
private int location_isTerrain;
|
||||
private int location_color;
|
||||
|
||||
public ShaderProgram(Context context) throws Exception {
|
||||
this.context = context;
|
||||
vertexShader = loadShader(GLES20.GL_VERTEX_SHADER, "vertexShader.glsl");
|
||||
fragmentShader = loadShader(GLES20.GL_FRAGMENT_SHADER, "fragmentShader.glsl");
|
||||
program = GLES20.glCreateProgram();
|
||||
GLES20.glAttachShader(program, vertexShader);
|
||||
GLES20.glAttachShader(program, fragmentShader);
|
||||
GLES20.glLinkProgram(program);
|
||||
int[] linkStatus = new int[1];
|
||||
GLES20.glGetProgramiv(program, GLES20.GL_LINK_STATUS, linkStatus, 0);
|
||||
if (linkStatus[0] == GLES20.GL_FALSE) {
|
||||
GLES20.glDeleteProgram(program);
|
||||
throw new Exception("Could not link program: "
|
||||
+ GLES20.glGetProgramInfoLog(program));
|
||||
}
|
||||
|
||||
bindAttribLocations();
|
||||
loadUniformLocations();
|
||||
GameLog.d("ShaderProgram successfully loaded");
|
||||
}
|
||||
|
||||
private void loadUniformLocations() {
|
||||
location_mvpMatrix = GLES20.glGetUniformLocation(program, "mvpMatrix");
|
||||
location_transformationMatrix = GLES20.glGetUniformLocation(program, "transformationMatrix");
|
||||
location_alpha = GLES20.glGetUniformLocation(program, "alpha");
|
||||
location_texAtlasSize = GLES20.glGetUniformLocation(program, "texAtlasSize");
|
||||
location_texAtlasIndex = GLES20.glGetUniformLocation(program, "texAtlasIndex");
|
||||
location_isTerrain = GLES20.glGetUniformLocation(program, "isTerrain");
|
||||
location_color = GLES20.glGetUniformLocation(program, "color");
|
||||
}
|
||||
|
||||
private void bindAttribLocations() {
|
||||
GLES20.glBindAttribLocation(program, 0, "position");
|
||||
GLES20.glBindAttribLocation(program, 1, "texCoords");
|
||||
}
|
||||
|
||||
public void start() {
|
||||
GLES20.glUseProgram(program);
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
GLES20.glUseProgram(0);
|
||||
}
|
||||
|
||||
public void loadMVPMatrix(MatrixCreator matrixCreator, float cameraX) {
|
||||
float[] mvpMatrix = matrixCreator.createModelViewProjectionMatrix(cameraX);
|
||||
GLES20.glUniformMatrix4fv(location_mvpMatrix, 1, false, mvpMatrix, 0);
|
||||
}
|
||||
|
||||
public void loadTransformationMatrix(MatrixCreator matrixCreator, Entity entity) {
|
||||
float[] transformationMatrix = matrixCreator.createTransformationMatrix(entity);
|
||||
GLES20.glUniformMatrix4fv(location_transformationMatrix, 1, false, transformationMatrix, 0);
|
||||
}
|
||||
|
||||
public void loadColor(Color color){
|
||||
GLES20.glUniform3f(location_color, color.getR(), color.getG(), color.getB());
|
||||
}
|
||||
|
||||
public void loadAlpha(float alpha) {
|
||||
GLES20.glUniform1f(location_alpha, alpha);
|
||||
}
|
||||
|
||||
public void loadTextureAtlasInfos(Texture texture) {
|
||||
GLES20.glUniform2f(location_texAtlasSize, texture.getAtlasWidth(), texture.getAtlasHeight());
|
||||
GLES20.glUniform1f(location_texAtlasIndex, texture.getAtlasIndex());
|
||||
}
|
||||
|
||||
public void loadIsTerrain(boolean isTerrain) {
|
||||
float fIsTerrain = isTerrain ? 1 : 0;
|
||||
GLES20.glUniform1f(location_isTerrain, fIsTerrain);
|
||||
}
|
||||
|
||||
public void cleanUp() {
|
||||
stop();
|
||||
GLES20.glDeleteShader(vertexShader);
|
||||
GLES20.glDeleteShader(fragmentShader);
|
||||
GLES20.glDeleteProgram(program);
|
||||
GameLog.d("Shader cleaned");
|
||||
}
|
||||
|
||||
private int loadShader(int type, String shaderName) throws Exception {
|
||||
try {
|
||||
InputStream is = context.getAssets().open(shaderName);
|
||||
InputStreamReader isReader = new InputStreamReader(is);
|
||||
BufferedReader reader = new BufferedReader(isReader);
|
||||
StringBuilder source = new StringBuilder();
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null)
|
||||
source.append(line);
|
||||
|
||||
int shader = GLES20.glCreateShader(type);
|
||||
GLES20.glShaderSource(shader, source.toString());
|
||||
GLES20.glCompileShader(shader);
|
||||
|
||||
int[] compiled = new int[1];
|
||||
GLES20.glGetShaderiv(shader, GLES20.GL_COMPILE_STATUS, compiled, 0);
|
||||
if (compiled[0] == GLES20.GL_FALSE) {
|
||||
GLES20.glDeleteShader(shader);
|
||||
throw new Exception("Could not compile shader \"" + shaderName + "\": "
|
||||
+ GLES20.glGetShaderInfoLog(shader));
|
||||
}
|
||||
GameLog.d("Shader \"" + shaderName + "\" successfully loaded");
|
||||
return shader;
|
||||
} catch (Exception e) {
|
||||
throw new Exception("Could not load Shader \"" + shaderName + "\"", e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package com.example.particlelab.rendering;
|
||||
|
||||
/**
|
||||
* Created by Julian on 22.11.2015.
|
||||
*/
|
||||
public class Timer {
|
||||
|
||||
private long lastFpsTime;
|
||||
private int fpsCounter;
|
||||
private int fps;
|
||||
|
||||
private long lastTime;
|
||||
private long delta;
|
||||
|
||||
|
||||
public Timer() {
|
||||
lastTime = System.currentTimeMillis();
|
||||
lastFpsTime = lastTime;
|
||||
}
|
||||
|
||||
public void update() {
|
||||
long currentTime = System.currentTimeMillis();
|
||||
delta = currentTime - lastTime;
|
||||
lastTime = currentTime;
|
||||
|
||||
fpsCounter++;
|
||||
if (currentTime - lastFpsTime > 1000) {
|
||||
fps = fpsCounter;
|
||||
lastFpsTime += 1000;
|
||||
fpsCounter = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public float getFrameTime() {
|
||||
return delta;
|
||||
}
|
||||
|
||||
public int getFps() {
|
||||
return fps;
|
||||
}
|
||||
|
||||
public long getCurrentTime() {
|
||||
return System.currentTimeMillis();
|
||||
}
|
||||
|
||||
}
|
BIN
particlelab/src/main/res/drawable/background.png
Normal file
After Width: | Height: | Size: 89 KiB |
BIN
particlelab/src/main/res/drawable/ball.png
Normal file
After Width: | Height: | Size: 8.7 KiB |
BIN
particlelab/src/main/res/drawable/blueparticle.png
Normal file
After Width: | Height: | Size: 701 B |
BIN
particlelab/src/main/res/drawable/bomb.png
Normal file
After Width: | Height: | Size: 132 KiB |
BIN
particlelab/src/main/res/drawable/bombbutton.png
Normal file
After Width: | Height: | Size: 38 KiB |
30
particlelab/src/main/res/drawable/custom_button.xml
Normal file
@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android" tools:context=".main.GameActivity">
|
||||
<item android:state_pressed="true" android:state_enabled="true">
|
||||
<shape>
|
||||
<corners android:radius="20dp" />
|
||||
<padding android:bottom="10dp" android:left="10dp" android:right="10dp" android:top="10dp" />
|
||||
<stroke android:width="1dp" android:color="#992f2f" />
|
||||
|
||||
<solid android:color="#ef4444" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:state_pressed="false" android:state_enabled="true">
|
||||
<shape>
|
||||
<corners android:radius="20dp" />
|
||||
<padding android:bottom="10dp" android:left="10dp" android:right="10dp" android:top="10dp" />
|
||||
<stroke android:width="1dp" android:color="#992f2f" />
|
||||
|
||||
<gradient android:angle="270" android:endColor="#992f2f" android:startColor="#ef4444" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:state_enabled="false">
|
||||
<shape>
|
||||
<corners android:radius="20dp" />
|
||||
<padding android:bottom="10dp" android:left="10dp" android:right="10dp" android:top="10dp" />
|
||||
<stroke android:width="1dp" android:color="#992f2f" />
|
||||
|
||||
<gradient android:angle="270" android:endColor="#a15d5d" android:startColor="#b73d3d" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
BIN
particlelab/src/main/res/drawable/emptybutton.png
Normal file
After Width: | Height: | Size: 9.5 KiB |
BIN
particlelab/src/main/res/drawable/goal.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
particlelab/src/main/res/drawable/grasslands_preview.png
Normal file
After Width: | Height: | Size: 89 KiB |
24
particlelab/src/main/res/drawable/levelbutton_background.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="47dp" />
|
||||
<gradient
|
||||
android:centerColor="#669dd4"
|
||||
android:centerX="50%"
|
||||
android:centerY="50%"
|
||||
android:endColor="#F7F9FF"
|
||||
android:gradientRadius="300"
|
||||
android:startColor="#a07bbc"
|
||||
android:type="radial" />
|
||||
<padding
|
||||
android:bottom="0dp"
|
||||
android:left="0dp"
|
||||
android:right="0dp"
|
||||
android:top="20dp" />
|
||||
<size
|
||||
android:width="200dp"
|
||||
android:height="150dp" />
|
||||
<stroke
|
||||
android:width="10dp"
|
||||
android:color="#b11a1a" />
|
||||
</shape>
|
BIN
particlelab/src/main/res/drawable/levelupbackground.png
Normal file
After Width: | Height: | Size: 899 B |
BIN
particlelab/src/main/res/drawable/lock.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
particlelab/src/main/res/drawable/lockedbutton.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
particlelab/src/main/res/drawable/magnet.png
Normal file
After Width: | Height: | Size: 46 KiB |
BIN
particlelab/src/main/res/drawable/magnetbutton.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
particlelab/src/main/res/drawable/menu_background.png
Normal file
After Width: | Height: | Size: 154 KiB |
BIN
particlelab/src/main/res/drawable/obstacle.png
Normal file
After Width: | Height: | Size: 54 KiB |
BIN
particlelab/src/main/res/drawable/pausebutton.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
particlelab/src/main/res/drawable/playerarrow.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
particlelab/src/main/res/drawable/purple.png
Normal file
After Width: | Height: | Size: 79 B |
BIN
particlelab/src/main/res/drawable/ramp.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
particlelab/src/main/res/drawable/rampbutton.png
Normal file
After Width: | Height: | Size: 48 KiB |
BIN
particlelab/src/main/res/drawable/redparticle.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
particlelab/src/main/res/drawable/shortmenubackground.png
Normal file
After Width: | Height: | Size: 923 B |
BIN
particlelab/src/main/res/drawable/sound_off.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
particlelab/src/main/res/drawable/sound_on.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
10
particlelab/src/main/res/drawable/sound_toggle.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:state_checked="false"
|
||||
android:drawable="@drawable/sound_off" />
|
||||
|
||||
<item android:state_checked="true"
|
||||
android:drawable="@drawable/sound_on" />
|
||||
|
||||
</selector>
|
BIN
particlelab/src/main/res/drawable/splitter.png
Normal file
After Width: | Height: | Size: 459 B |
BIN
particlelab/src/main/res/drawable/spring.png
Normal file
After Width: | Height: | Size: 61 KiB |
BIN
particlelab/src/main/res/drawable/springbutton.png
Normal file
After Width: | Height: | Size: 80 KiB |
BIN
particlelab/src/main/res/drawable/star.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
particlelab/src/main/res/drawable/stars_0.png
Normal file
After Width: | Height: | Size: 4.0 KiB |
BIN
particlelab/src/main/res/drawable/stars_1.png
Normal file
After Width: | Height: | Size: 5.0 KiB |
BIN
particlelab/src/main/res/drawable/stars_2.png
Normal file
After Width: | Height: | Size: 5.0 KiB |
BIN
particlelab/src/main/res/drawable/stars_3.png
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
particlelab/src/main/res/drawable/terrain.png
Normal file
After Width: | Height: | Size: 34 KiB |
BIN
particlelab/src/main/res/drawable/test.png
Normal file
After Width: | Height: | Size: 22 KiB |
15
particlelab/src/main/res/drawable/tool_slot_background.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="3dp" />
|
||||
<solid
|
||||
android:color="#715f5f"/>
|
||||
<padding
|
||||
android:bottom="2dp"
|
||||
android:left="2dp"
|
||||
android:right="2dp"
|
||||
android:top="2dp" />
|
||||
<stroke
|
||||
android:width="2dp"
|
||||
android:color="#635e5e" />
|
||||
</shape>
|