Compare commits
2 Commits
00b8ccc689
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| c4291c2746 | |||
| a2349837be |
@@ -8,16 +8,24 @@
|
|||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
url = uri("https://repository.elex-project.com/repository/maven")
|
name = "Nexus 3 Repository"
|
||||||
|
url = uri(project.findProperty("repo.url") as String)
|
||||||
|
credentials {
|
||||||
|
username = project.findProperty("repo.username") as String
|
||||||
|
password = project.findProperty("repo.password") as String
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
base
|
base
|
||||||
id("com.github.ben-manes.versions") version "0.39.0"
|
id("com.github.ben-manes.versions") version "0.51.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
subprojects{
|
subprojects{
|
||||||
|
group = "com.elex-project"
|
||||||
|
version = "1.0-SNAPSHOT"
|
||||||
|
description = ""//todo
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id("elex-base")
|
id("elex-base")
|
||||||
application
|
application
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.jar {
|
tasks.jar {
|
||||||
@@ -13,3 +14,4 @@ tasks.jar {
|
|||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,21 +2,36 @@ plugins {
|
|||||||
java
|
java
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "com.elex-project"
|
dependencies {
|
||||||
version = "1.0-SNAPSHOT"
|
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
|
||||||
description = ""//todo
|
implementation("org.slf4j:slf4j-api:2.1.0-alpha1")
|
||||||
|
implementation("org.jetbrains:annotations:24.1.0")
|
||||||
|
|
||||||
|
compileOnly("org.projectlombok:lombok:1.18.32")
|
||||||
|
annotationProcessor("org.projectlombok:lombok:1.18.32")
|
||||||
|
testAnnotationProcessor("org.projectlombok:lombok:1.18.32")
|
||||||
|
|
||||||
|
testImplementation("ch.qos.logback:logback-classic:1.5.3")
|
||||||
|
testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
|
||||||
|
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.10.2")
|
||||||
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
url = uri("https://repository.elex-project.com/repository/maven")
|
name = "Nexus 3 Repository"
|
||||||
|
url = uri(project.findProperty("repo.url") as String)
|
||||||
|
credentials {
|
||||||
|
username = project.findProperty("repo.username") as String
|
||||||
|
password = project.findProperty("repo.password") as String
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
java {
|
java {
|
||||||
withSourcesJar()
|
withSourcesJar()
|
||||||
withJavadocJar()
|
withJavadocJar()
|
||||||
sourceCompatibility = org.gradle.api.JavaVersion.VERSION_11
|
sourceCompatibility = org.gradle.api.JavaVersion.VERSION_17
|
||||||
targetCompatibility = org.gradle.api.JavaVersion.VERSION_11
|
targetCompatibility = org.gradle.api.JavaVersion.VERSION_17
|
||||||
}
|
}
|
||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
@@ -51,16 +66,4 @@ tasks.javadoc {
|
|||||||
(options as StandardJavadocDocletOptions).docEncoding = "UTF-8"
|
(options as StandardJavadocDocletOptions).docEncoding = "UTF-8"
|
||||||
|
|
||||||
}
|
}
|
||||||
dependencies {
|
|
||||||
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
|
|
||||||
implementation("org.slf4j:slf4j-api:1.7.30")
|
|
||||||
implementation("org.jetbrains:annotations:22.0.0")
|
|
||||||
|
|
||||||
compileOnly("org.projectlombok:lombok:1.18.20")
|
|
||||||
annotationProcessor("org.projectlombok:lombok:1.18.20")
|
|
||||||
testAnnotationProcessor("org.projectlombok:lombok:1.18.20")
|
|
||||||
|
|
||||||
testImplementation("ch.qos.logback:logback-classic:1.2.3")
|
|
||||||
testImplementation("org.junit.jupiter:junit-jupiter:5.7.0")
|
|
||||||
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.7.0")
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ publishing {
|
|||||||
publications {
|
publications {
|
||||||
create<MavenPublication>("mavenJava") {
|
create<MavenPublication>("mavenJava") {
|
||||||
from(components["java"])
|
from(components["java"])
|
||||||
|
artifactId = rootProject.name
|
||||||
pom {
|
pom {
|
||||||
// todo
|
// todo
|
||||||
name.set("${rootProject.name} ${project.name}")
|
name.set("${rootProject.name} ${project.name}")
|
||||||
@@ -35,7 +36,7 @@ publishing {
|
|||||||
license {
|
license {
|
||||||
// todo
|
// todo
|
||||||
name.set("Apache License 2.0")
|
name.set("Apache License 2.0")
|
||||||
url.set("https://github.com/elex-project/${rootProject.name}/blob/main/LICENSE")
|
url.set("https://git.elex-project.com/elex/${rootProject.name}/blob/main/LICENSE")
|
||||||
comments.set("")
|
comments.set("")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -49,7 +50,7 @@ publishing {
|
|||||||
organizationUrl.set("https://www.elex-project.com/")
|
organizationUrl.set("https://www.elex-project.com/")
|
||||||
roles.set(arrayListOf("Developer", "CEO"))
|
roles.set(arrayListOf("Developer", "CEO"))
|
||||||
timezone.set("Asia/Seoul")
|
timezone.set("Asia/Seoul")
|
||||||
properties.set(mapOf("" to ""))
|
//properties.set(mapOf("" to ""))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
contributors {
|
contributors {
|
||||||
@@ -61,9 +62,9 @@ publishing {
|
|||||||
}
|
}
|
||||||
scm {
|
scm {
|
||||||
// todo
|
// todo
|
||||||
connection.set("scm:git:https://github.com/elex-project/${rootProject.name}.git")
|
connection.set("scm:git:https://git.elex-project.com/elex/${rootProject.name}.git")
|
||||||
developerConnection.set("scm:git:https://github.com/elex-project/${rootProject.name}.git")
|
developerConnection.set("scm:git:https://git.elex-project.com/elex/${rootProject.name}.git")
|
||||||
url.set("https://github.com/elex-project/${rootProject.name}/")
|
url.set("https://git.elex-project.com/elex/${rootProject.name}/")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -72,8 +73,8 @@ publishing {
|
|||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
name = "mavenElex"
|
name = "mavenElex"
|
||||||
val urlRelease = uri("https://repository.elex-project.com/repository/maven-releases")
|
val urlRelease = uri(project.findProperty("repo.release.url") as String)
|
||||||
val urlSnapshot = uri("https://repository.elex-project.com/repository/maven-snapshots")
|
val urlSnapshot = uri(project.findProperty("repo.snapshot.url") as String)
|
||||||
url = if (version.toString().endsWith("SNAPSHOT")) urlSnapshot else urlRelease
|
url = if (version.toString().endsWith("SNAPSHOT")) urlSnapshot else urlRelease
|
||||||
// Repository credential, Must be defined in ~/.gradle/gradle.properties
|
// Repository credential, Must be defined in ~/.gradle/gradle.properties
|
||||||
credentials {
|
credentials {
|
||||||
@@ -81,14 +82,7 @@ publishing {
|
|||||||
password = project.findProperty("repo.password") as String
|
password = project.findProperty("repo.password") as String
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
maven { //todo
|
|
||||||
name = "mavenGithub"
|
|
||||||
url = uri("https://maven.pkg.github.com/elex-project/${rootProject.name}")
|
|
||||||
credentials {
|
|
||||||
username = project.findProperty("github.username") as String
|
|
||||||
password = project.findProperty("github.token") as String
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
30
components/build.gradle.kts
Normal file
30
components/build.gradle.kts
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
|
||||||
|
plugins {
|
||||||
|
id("elex-application")
|
||||||
|
idea
|
||||||
|
id("org.openjfx.javafxplugin") version "0.1.0"
|
||||||
|
id("org.beryx.jlink") version "3.0.1"
|
||||||
|
}
|
||||||
|
application {
|
||||||
|
mainClass.set("kr.pe.elex.examples.components.HelloWorldApplication")
|
||||||
|
// mainModule.set("kr.pe.elex.examples.components")
|
||||||
|
}
|
||||||
|
javafx {
|
||||||
|
version = "23-ea+3"
|
||||||
|
modules = listOf("javafx.controls", "javafx.fxml")
|
||||||
|
}
|
||||||
|
jlink {
|
||||||
|
launcher {
|
||||||
|
name = project.name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
idea{
|
||||||
|
module {
|
||||||
|
isDownloadJavadoc=true
|
||||||
|
isDownloadSources=true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2024. Elex. All Rights Reesrved.
|
||||||
|
* https://www.elex-project.com/
|
||||||
|
*/
|
||||||
|
|
||||||
|
package kr.pe.elex.examples.components;
|
||||||
|
|
||||||
|
import javafx.application.Application;
|
||||||
|
import javafx.geometry.Insets;
|
||||||
|
import javafx.geometry.Pos;
|
||||||
|
import javafx.scene.Scene;
|
||||||
|
import javafx.scene.control.Button;
|
||||||
|
import javafx.scene.control.Label;
|
||||||
|
import javafx.scene.control.PasswordField;
|
||||||
|
import javafx.scene.control.TextField;
|
||||||
|
import javafx.scene.layout.BorderPane;
|
||||||
|
import javafx.scene.layout.GridPane;
|
||||||
|
import javafx.scene.layout.HBox;
|
||||||
|
import javafx.scene.layout.Pane;
|
||||||
|
import javafx.scene.text.Font;
|
||||||
|
import javafx.scene.text.FontWeight;
|
||||||
|
import javafx.scene.text.Text;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
|
public class FormApplication extends Application {
|
||||||
|
|
||||||
|
private Pane contentPane() {
|
||||||
|
|
||||||
|
|
||||||
|
final GridPane rootPanel = new GridPane();
|
||||||
|
|
||||||
|
final Text heading = new Text("Log In ");
|
||||||
|
heading.setFont(Font.font("Serif", FontWeight.BOLD, 16));
|
||||||
|
|
||||||
|
final Label lblId = new Label("User Name");
|
||||||
|
final TextField txtId = new TextField();
|
||||||
|
final Label lblPassword = new Label("Password");
|
||||||
|
final PasswordField txtPassword = new PasswordField();
|
||||||
|
final Button btn1 = new Button("Login");
|
||||||
|
final HBox hBox = new HBox();
|
||||||
|
hBox.setAlignment(Pos.CENTER_RIGHT);
|
||||||
|
hBox.setPadding(new Insets(4,4,4,4));
|
||||||
|
hBox.getChildren().add(btn1);
|
||||||
|
|
||||||
|
|
||||||
|
rootPanel.add(heading, 0,0,2,1);
|
||||||
|
rootPanel.add(lblId, 0,1);
|
||||||
|
rootPanel.add(txtId,1,1);
|
||||||
|
rootPanel.add(lblPassword, 0,2);
|
||||||
|
rootPanel.add(txtPassword,1,2);
|
||||||
|
rootPanel.add(hBox, 1,3,2,1);
|
||||||
|
|
||||||
|
rootPanel.setAlignment(Pos.CENTER);
|
||||||
|
rootPanel.setHgap(4);
|
||||||
|
rootPanel.setVgap(4);
|
||||||
|
rootPanel.setPadding(new Insets(16,16,16,16));
|
||||||
|
|
||||||
|
btn1.setOnAction(event -> {
|
||||||
|
System.out.println(txtId.getText());
|
||||||
|
System.out.println(txtPassword.getText());
|
||||||
|
});
|
||||||
|
|
||||||
|
return rootPanel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start(Stage primaryStage) throws Exception {
|
||||||
|
|
||||||
|
primaryStage.setTitle("Hello, World");
|
||||||
|
primaryStage.setScene(new Scene(contentPane(), 800, 600));
|
||||||
|
primaryStage.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String... args) {
|
||||||
|
launch(args);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2024. Elex. All Rights Reesrved.
|
||||||
|
* https://www.elex-project.com/
|
||||||
|
*/
|
||||||
|
|
||||||
|
package kr.pe.elex.examples.components;
|
||||||
|
|
||||||
|
import javafx.application.Application;
|
||||||
|
import javafx.scene.Scene;
|
||||||
|
import javafx.scene.control.Button;
|
||||||
|
import javafx.scene.layout.BorderPane;
|
||||||
|
import javafx.scene.layout.Pane;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
|
public class HelloWorldApplication extends Application {
|
||||||
|
|
||||||
|
private Pane contentPane() {
|
||||||
|
final Button btn1 = new Button("Click");
|
||||||
|
btn1.setOnAction(event -> {
|
||||||
|
System.out.println("Click!");
|
||||||
|
});
|
||||||
|
|
||||||
|
final BorderPane rootPanel = new BorderPane();
|
||||||
|
rootPanel.setCenter(btn1);
|
||||||
|
|
||||||
|
return rootPanel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start(Stage primaryStage) throws Exception {
|
||||||
|
|
||||||
|
primaryStage.setTitle("Hello, World");
|
||||||
|
primaryStage.setScene(new Scene(contentPane(), 800, 600));
|
||||||
|
primaryStage.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String... args) {
|
||||||
|
launch(args);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2024. Elex. All Rights Reesrved.
|
||||||
|
* https://www.elex-project.com/
|
||||||
|
*/
|
||||||
|
|
||||||
|
package kr.pe.elex.examples.components;
|
||||||
7
components/src/main/java/module-info.java
Normal file
7
components/src/main/java/module-info.java
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
module javafx.examples.components.main {
|
||||||
|
requires javafx.graphics;
|
||||||
|
requires javafx.controls;
|
||||||
|
requires javafx.fxml;
|
||||||
|
|
||||||
|
exports kr.pe.elex.examples.components;
|
||||||
|
}
|
||||||
10
doc/01_application.md
Normal file
10
doc/01_application.md
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# Application
|
||||||
|
|
||||||
|
|
||||||
|
1. j메인 클래스에서 javafx.application.Application를 상속하고, start()를 구현한다.
|
||||||
|
2. root 패널을 생성해서 레이아웃을 구현한다.
|
||||||
|
3. start()에서 전달받은 primaryStage에 setScene()을 사용해서 new Scene(root,w,h)을 넘겨준다.
|
||||||
|
4. start()메서드의 맨 뒤에 primaryStage.show()를 호출한다.
|
||||||
|
5. 메인 메서드에서 launch(args)를 호출하면 start()가 호출되고, GUI 창이 실행된다.
|
||||||
|
|
||||||
|
https://docs.oracle.com/javase/8/javase-clienttechnologies.htm
|
||||||
1
doc/02_pane.md
Normal file
1
doc/02_pane.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
# 패널
|
||||||
9
doc/03_controls.md
Normal file
9
doc/03_controls.md
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
# 컴포넌트
|
||||||
|
|
||||||
|
## Label
|
||||||
|
|
||||||
|
## Button
|
||||||
|
|
||||||
|
## TextField
|
||||||
|
### PasswordField
|
||||||
|
|
||||||
31
doc/04_3d.md
Normal file
31
doc/04_3d.md
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
# 3D
|
||||||
|
|
||||||
|
## Shape3D < Node
|
||||||
|
|
||||||
|
## MeshView < Shape3D
|
||||||
|
|
||||||
|
## Box < Shape3D
|
||||||
|
|
||||||
|
## Cylinder < Shape3D
|
||||||
|
|
||||||
|
## Sphere < Shape3D
|
||||||
|
|
||||||
|
## Mesh
|
||||||
|
|
||||||
|
## TriangleMesh
|
||||||
|
|
||||||
|
## PerspectiveCamera
|
||||||
|
|
||||||
|
## PointLight
|
||||||
|
|
||||||
|
## AmbientLight
|
||||||
|
|
||||||
|
## PhongMaterial < Material
|
||||||
|
* diffuse color
|
||||||
|
* diffuse map
|
||||||
|
* specular map
|
||||||
|
* specular color
|
||||||
|
* specular power
|
||||||
|
* bump map / normal map
|
||||||
|
* self-illumination map
|
||||||
|
|
||||||
0
doc/05_canvas.md
Normal file
0
doc/05_canvas.md
Normal file
@@ -7,17 +7,29 @@
|
|||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("elex-application")
|
id("elex-application")
|
||||||
id("org.openjfx.javafxplugin") version "0.0.10"
|
idea
|
||||||
id("org.beryx.jlink") version "2.23.1"
|
id("org.openjfx.javafxplugin") version "0.1.0"
|
||||||
|
id("org.beryx.jlink") version "3.0.1"
|
||||||
}
|
}
|
||||||
application {
|
application {
|
||||||
mainClass.set("kr.pe.elex.examples.fxml.FxmlApplication")
|
mainClass.set("kr.pe.elex.examples.fxml.FxmlApplication")
|
||||||
mainModule.set("kr.pe.elex.examples.fxml")
|
mainModule.set("kr.pe.elex.examples.fxml")
|
||||||
}
|
}
|
||||||
javafx {
|
javafx {
|
||||||
version = "11.0.2"
|
version = "23-ea+3"
|
||||||
modules = listOf("javafx.controls", "javafx.fxml")
|
modules = listOf("javafx.controls", "javafx.fxml")
|
||||||
}
|
}
|
||||||
|
jlink {
|
||||||
|
launcher {
|
||||||
|
name = project.name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
idea{
|
||||||
|
module {
|
||||||
|
isDownloadJavadoc=true
|
||||||
|
isDownloadSources=true
|
||||||
|
}
|
||||||
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* JavaFx Examples
|
* Copyright (c) 2021-2024. Elex. All Rights Reesrved.
|
||||||
*
|
|
||||||
* Copyright (c) 2021. Elex. All Rights Reserved.
|
|
||||||
* https://www.elex-project.com/
|
* https://www.elex-project.com/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -7,6 +7,6 @@
|
|||||||
|
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
@@ -7,3 +7,5 @@
|
|||||||
|
|
||||||
rootProject.name = "javafx-examples"
|
rootProject.name = "javafx-examples"
|
||||||
include("fxml")
|
include("fxml")
|
||||||
|
include("components")
|
||||||
|
include("three_d")
|
||||||
|
|||||||
30
three_d/build.gradle.kts
Normal file
30
three_d/build.gradle.kts
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
|
||||||
|
plugins {
|
||||||
|
id("elex-application")
|
||||||
|
idea
|
||||||
|
id("org.openjfx.javafxplugin") version "0.1.0"
|
||||||
|
id("org.beryx.jlink") version "3.0.1"
|
||||||
|
}
|
||||||
|
application {
|
||||||
|
mainClass.set("kr.pe.elex.examples.three_d.MyApplication")
|
||||||
|
// mainModule.set("kr.pe.elex.examples.components")
|
||||||
|
}
|
||||||
|
javafx {
|
||||||
|
version = "23-ea+3"
|
||||||
|
modules = listOf("javafx.controls", "javafx.fxml")
|
||||||
|
}
|
||||||
|
jlink {
|
||||||
|
launcher {
|
||||||
|
name = project.name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
idea{
|
||||||
|
module {
|
||||||
|
isDownloadJavadoc=true
|
||||||
|
isDownloadSources=true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2024. Elex. All Rights Reesrved.
|
||||||
|
* https://www.elex-project.com/
|
||||||
|
*/
|
||||||
|
|
||||||
|
package kr.pe.elex.examples.three_d;
|
||||||
|
|
||||||
|
import javafx.scene.Camera;
|
||||||
|
import javafx.scene.PerspectiveCamera;
|
||||||
|
|
||||||
|
public class Cameras {
|
||||||
|
|
||||||
|
public static Camera camera(){
|
||||||
|
final Camera camera = new PerspectiveCamera();
|
||||||
|
|
||||||
|
return camera;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2024. Elex. All Rights Reesrved.
|
||||||
|
* https://www.elex-project.com/
|
||||||
|
*/
|
||||||
|
|
||||||
|
package kr.pe.elex.examples.three_d;
|
||||||
|
|
||||||
|
import javafx.scene.AmbientLight;
|
||||||
|
import javafx.scene.PointLight;
|
||||||
|
import javafx.scene.paint.Color;
|
||||||
|
|
||||||
|
public class Lights {
|
||||||
|
public static PointLight pointLight() {
|
||||||
|
final PointLight light = new PointLight();
|
||||||
|
light.setColor(Color.YELLOW);
|
||||||
|
return light;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AmbientLight ambientLight() {
|
||||||
|
final AmbientLight light = new AmbientLight();
|
||||||
|
light.setColor(Color.GOLD);
|
||||||
|
return light;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2024. Elex. All Rights Reesrved.
|
||||||
|
* https://www.elex-project.com/
|
||||||
|
*/
|
||||||
|
|
||||||
|
package kr.pe.elex.examples.three_d;
|
||||||
|
|
||||||
|
public class Materials {
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2024. Elex. All Rights Reesrved.
|
||||||
|
* https://www.elex-project.com/
|
||||||
|
*/
|
||||||
|
|
||||||
|
package kr.pe.elex.examples.three_d;
|
||||||
|
|
||||||
|
import javafx.application.Application;
|
||||||
|
import javafx.scene.*;
|
||||||
|
import javafx.scene.paint.Color;
|
||||||
|
import javafx.scene.paint.PhongMaterial;
|
||||||
|
import javafx.scene.shape.Box;
|
||||||
|
import javafx.scene.shape.DrawMode;
|
||||||
|
import javafx.scene.transform.Rotate;
|
||||||
|
import javafx.scene.transform.Translate;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
|
public class MyApplication extends Application {
|
||||||
|
private Parent content(){
|
||||||
|
Box box = new Box(5,5,5);
|
||||||
|
box.setMaterial(new PhongMaterial(Color.RED));
|
||||||
|
box.setDrawMode(DrawMode.LINE);
|
||||||
|
|
||||||
|
Camera camera = new PerspectiveCamera(true);
|
||||||
|
camera.getTransforms().addAll(
|
||||||
|
new Rotate(-20, Rotate.Y_AXIS),
|
||||||
|
new Rotate(-20,Rotate.X_AXIS),
|
||||||
|
new Translate(0,0,-15)
|
||||||
|
);
|
||||||
|
|
||||||
|
Group root = new Group();
|
||||||
|
root.getChildren().add(box);
|
||||||
|
root.getChildren().add(camera);
|
||||||
|
|
||||||
|
SubScene subScene = new SubScene(root, 300, 300);
|
||||||
|
subScene.setFill(Color.ALICEBLUE);
|
||||||
|
subScene.setCamera(camera);
|
||||||
|
Group group = new Group();
|
||||||
|
group.getChildren().add(subScene);
|
||||||
|
return group;
|
||||||
|
}
|
||||||
|
public static void main(String... args){
|
||||||
|
launch(args);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void start(Stage primaryStage) throws Exception {
|
||||||
|
primaryStage.setTitle("3D Example");
|
||||||
|
primaryStage.setResizable(false);
|
||||||
|
primaryStage.setScene(new Scene(content()));
|
||||||
|
primaryStage.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2024. Elex. All Rights Reesrved.
|
||||||
|
* https://www.elex-project.com/
|
||||||
|
*/
|
||||||
|
|
||||||
|
package kr.pe.elex.examples.three_d;
|
||||||
|
|
||||||
|
import javafx.scene.paint.Color;
|
||||||
|
import javafx.scene.paint.PhongMaterial;
|
||||||
|
import javafx.scene.shape.Box;
|
||||||
|
import javafx.scene.shape.Cylinder;
|
||||||
|
import javafx.scene.shape.Sphere;
|
||||||
|
import javafx.scene.shape.TriangleMesh;
|
||||||
|
|
||||||
|
public class Shapes {
|
||||||
|
public static Box box(){
|
||||||
|
final Box shape = new Box(100, 100, 30);
|
||||||
|
final PhongMaterial material = new PhongMaterial();
|
||||||
|
material.setSpecularColor(Color.ORANGE);
|
||||||
|
material.setDiffuseColor(Color.RED);
|
||||||
|
shape.setMaterial(material);
|
||||||
|
return shape;
|
||||||
|
}
|
||||||
|
public static Cylinder cylinder(){
|
||||||
|
final Cylinder shape = new Cylinder(100, 100);
|
||||||
|
final PhongMaterial material = new PhongMaterial();
|
||||||
|
material.setSpecularColor(Color.BLUE);
|
||||||
|
material.setDiffuseColor(Color.LIGHTBLUE);
|
||||||
|
shape.setMaterial(material);
|
||||||
|
return shape;
|
||||||
|
}
|
||||||
|
public static Sphere sphere(){
|
||||||
|
final Sphere shape = new Sphere(100);
|
||||||
|
final PhongMaterial material = new PhongMaterial();
|
||||||
|
material.setSpecularColor(Color.BLUE);
|
||||||
|
material.setDiffuseColor(Color.LIGHTBLUE);
|
||||||
|
shape.setMaterial(material);
|
||||||
|
return shape;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TriangleMesh triangleMesh(){
|
||||||
|
final TriangleMesh shape = new TriangleMesh();
|
||||||
|
final float[] points = {};
|
||||||
|
shape.getPoints().addAll(points);
|
||||||
|
final float[] texCoords = {};
|
||||||
|
shape.getTexCoords().addAll(texCoords);
|
||||||
|
final int[] faces = {};
|
||||||
|
shape.getFaces().addAll(faces);
|
||||||
|
final int[] smoothingGroups = {};
|
||||||
|
shape.getFaceSmoothingGroups().addAll(smoothingGroups);
|
||||||
|
|
||||||
|
return shape;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2024. Elex. All Rights Reesrved.
|
||||||
|
* https://www.elex-project.com/
|
||||||
|
*/
|
||||||
|
|
||||||
|
package kr.pe.elex.examples.three_d;
|
||||||
7
three_d/src/main/java/module-info.java
Normal file
7
three_d/src/main/java/module-info.java
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
module javafx.examples.fxml.main {
|
||||||
|
requires javafx.graphics;
|
||||||
|
requires javafx.controls;
|
||||||
|
requires javafx.fxml;
|
||||||
|
|
||||||
|
exports kr.pe.elex.examples.three_d;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user