use of com.gempukku.libgdx.graph.data.GraphProperty in project gdx-graph by MarcinSc.
the class EndShadowShaderBoxProducer method createPipelineGraphBox.
@Override
public GraphBox createPipelineGraphBox(Skin skin, String id, JsonValue data) {
final ModelShaderPreviewBoxPart previewBoxPart = new ModelShaderPreviewBoxPart();
previewBoxPart.initialize(data);
GraphBoxImpl result = new GraphBoxImpl(id, getConfiguration()) {
@Override
public void graphChanged(GraphChangedEvent event, boolean hasErrors, Graph<? extends GraphNode, ? extends GraphConnection, ? extends GraphProperty> graph) {
if (event.isData() || event.isStructure()) {
previewBoxPart.graphChanged(hasErrors, graph);
}
}
};
SelectBoxPart positionType = new SelectBoxPart("Position", "positionType", "Object space", "World space");
positionType.initialize(data);
result.addGraphBoxPart(positionType);
addConfigurationInputsAndOutputs(result);
EnumSelectBoxPart cullingBox = new EnumSelectBoxPart("Culling", "culling", new StringifyEnum<BasicShader.Culling>(), BasicShader.Culling.values());
cullingBox.initialize(data);
result.addGraphBoxPart(cullingBox);
EnumSelectBoxPart depthTestBox = new EnumSelectBoxPart("DepthTest", "depthTest", new StringifyEnum<BasicShader.DepthTesting>(), BasicShader.DepthTesting.values());
depthTestBox.initialize(data);
result.addGraphBoxPart(depthTestBox);
CheckboxBoxPart writeDepthBox = new CheckboxBoxPart("Write depth", "depthWrite");
writeDepthBox.initialize(data);
result.addGraphBoxPart(writeDepthBox);
result.addGraphBoxPart(previewBoxPart);
return result;
}
use of com.gempukku.libgdx.graph.data.GraphProperty in project gdx-graph by MarcinSc.
the class EndModelShaderBoxProducer method createPipelineGraphBox.
@Override
public GraphBox createPipelineGraphBox(Skin skin, String id, JsonValue data) {
final ModelShaderPreviewBoxPart previewBoxPart = new ModelShaderPreviewBoxPart();
previewBoxPart.initialize(data);
GraphBoxImpl result = new GraphBoxImpl(id, getConfiguration()) {
@Override
public void graphChanged(GraphChangedEvent event, boolean hasErrors, Graph<? extends GraphNode, ? extends GraphConnection, ? extends GraphProperty> graph) {
if (event.isData() || event.isStructure()) {
previewBoxPart.graphChanged(hasErrors, graph);
}
}
};
SelectBoxPart positionType = new SelectBoxPart("Position", "positionType", "Object space", "World space");
positionType.initialize(data);
result.addGraphBoxPart(positionType);
addConfigurationInputsAndOutputs(result);
result.addGraphBoxPart(new SectionBoxPart("Rendering config"));
EnumSelectBoxPart cullingBox = new EnumSelectBoxPart("Culling", "culling", new StringifyEnum<BasicShader.Culling>(), BasicShader.Culling.values());
cullingBox.initialize(data);
result.addGraphBoxPart(cullingBox);
BlendingBoxPart blendingBox = new BlendingBoxPart();
blendingBox.initialize(data);
result.addGraphBoxPart(blendingBox);
EnumSelectBoxPart depthTestBox = new EnumSelectBoxPart("DepthTest", "depthTest", new StringifyEnum<BasicShader.DepthTesting>(), BasicShader.DepthTesting.values());
depthTestBox.initialize(data);
result.addGraphBoxPart(depthTestBox);
CheckboxBoxPart writeDepthBox = new CheckboxBoxPart("Write depth", "depthWrite");
writeDepthBox.initialize(data);
result.addGraphBoxPart(writeDepthBox);
result.addGraphBoxPart(new SectionBoxPart("Preview"));
result.addGraphBoxPart(previewBoxPart);
return result;
}
use of com.gempukku.libgdx.graph.data.GraphProperty in project gdx-graph by MarcinSc.
the class EndParticlesShaderBoxProducer method createPipelineGraphBox.
@Override
public GraphBox createPipelineGraphBox(Skin skin, String id, JsonValue data) {
final ParticlesShaderPreviewBoxPart previewBoxPart = new ParticlesShaderPreviewBoxPart();
previewBoxPart.initialize(data);
GraphBoxImpl result = new GraphBoxImpl(id, getConfiguration()) {
@Override
public void graphChanged(GraphChangedEvent event, boolean hasErrors, Graph<? extends GraphNode, ? extends GraphConnection, ? extends GraphProperty> graph) {
if (event.isData() || event.isStructure()) {
previewBoxPart.graphChanged(hasErrors, graph);
}
}
};
IntegerBoxPart particleCountBox = new IntegerBoxPart("Max particles ", "maxParticles", 100, new Validators.GreaterThanValidator(0, false));
particleCountBox.initialize(data);
result.addGraphBoxPart(particleCountBox);
addConfigurationInputsAndOutputs(result);
result.addGraphBoxPart(new SectionBoxPart("Rendering config"));
EnumSelectBoxPart cullingBox = new EnumSelectBoxPart("Culling", "culling", new StringifyEnum<BasicShader.Culling>(), BasicShader.Culling.values());
cullingBox.initialize(data);
result.addGraphBoxPart(cullingBox);
BlendingBoxPart blendingBox = new BlendingBoxPart();
blendingBox.initialize(data);
result.addGraphBoxPart(blendingBox);
EnumSelectBoxPart depthTestBox = new EnumSelectBoxPart("DepthTest", "depthTest", new StringifyEnum<BasicShader.DepthTesting>(), BasicShader.DepthTesting.values());
depthTestBox.initialize(data);
result.addGraphBoxPart(depthTestBox);
CheckboxBoxPart writeDepthBox = new CheckboxBoxPart("Write depth", "depthWrite");
writeDepthBox.initialize(data);
result.addGraphBoxPart(writeDepthBox);
result.addGraphBoxPart(new SectionBoxPart("Preview"));
result.addGraphBoxPart(previewBoxPart);
return result;
}
use of com.gempukku.libgdx.graph.data.GraphProperty in project gdx-graph by MarcinSc.
the class ParticlesShaderPreviewWidget method createShader.
private void createShader(final Graph<? extends GraphNode, ? extends GraphConnection, ? extends GraphProperty> graph) {
try {
timeKeeper = new DefaultTimeKeeper();
graphShader = GraphShaderBuilder.buildParticlesShader("Test", WhitePixel.sharedInstance.texture, graph, true);
frameBuffer = new FrameBuffer(Pixmap.Format.RGBA8888, width, height, false);
createModel();
shaderContext.setTimeProvider(timeKeeper);
shaderContext.setGlobalPropertyContainer(new PropertyContainer() {
@Override
public Object getValue(String name) {
for (GraphProperty property : graph.getProperties()) {
if (property.getName().equals(name) && property.getLocation() == PropertyLocation.Global_Uniform) {
ShaderFieldType propertyType = ShaderFieldTypeRegistry.findShaderFieldType(property.getType());
return propertyType.convertFromJson(property.getData());
}
}
return null;
}
});
shaderContext.setLocalPropertyContainer(new PropertyContainer() {
@Override
public Object getValue(String name) {
for (GraphProperty property : graph.getProperties()) {
if (property.getName().equals(name) && property.getLocation() != PropertyLocation.Global_Uniform) {
ShaderFieldType propertyType = ShaderFieldTypeRegistry.findShaderFieldType(property.getType());
Object value = propertyType.convertFromJson(property.getData());
if (propertyType.isTexture()) {
if (value != null) {
try {
Texture texture = new Texture(Gdx.files.absolute((String) value));
graphShader.addManagedResource(texture);
return new TextureRegion(texture);
} catch (Exception exp) {
}
}
return WhitePixel.sharedInstance.textureRegion;
} else {
return value;
}
}
}
return null;
}
});
shaderInitialized = true;
} catch (Exception exp) {
exp.printStackTrace();
if (graphShader != null)
graphShader.dispose();
}
}
use of com.gempukku.libgdx.graph.data.GraphProperty in project gdx-graph by MarcinSc.
the class ScreenShaderPreviewWidget method createShader.
private void createShader(final Graph<? extends GraphNode, ? extends GraphConnection, ? extends GraphProperty> graph) {
try {
timeKeeper = new DefaultTimeKeeper();
graphShader = GraphShaderBuilder.buildScreenShader("Test", WhitePixel.sharedInstance.texture, graph, true);
frameBuffer = new FrameBuffer(Pixmap.Format.RGBA8888, width, height, false);
shaderContext.setTimeProvider(timeKeeper);
shaderContext.setGlobalPropertyContainer(new PropertyContainer() {
@Override
public Object getValue(String name) {
for (GraphProperty property : graph.getProperties()) {
if (property.getName().equals(name)) {
ShaderFieldType propertyType = ShaderFieldTypeRegistry.findShaderFieldType(property.getType());
Object value = propertyType.convertFromJson(property.getData());
if (propertyType.isTexture()) {
if (value != null) {
try {
Texture texture = new Texture(Gdx.files.absolute((String) value));
graphShader.addManagedResource(texture);
return new TextureRegion(texture);
} catch (Exception exp) {
}
}
return WhitePixel.sharedInstance.textureRegion;
} else {
return value;
}
}
}
return null;
}
});
shaderInitialized = true;
} catch (Exception exp) {
exp.printStackTrace();
if (graphShader != null)
graphShader.dispose();
}
}
Aggregations