Skip to content

Commit

Permalink
Markers where to start with system xflow parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
Kristian Sons authored and ariyapour committed Nov 9, 2015
1 parent 712dfbe commit 31d05ab
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/data/adapter/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ var DataAdapter = function (factory, node) {
XML3D.createClass(DataAdapter, BaseDataAdapter);

DataAdapter.prototype.init = function () {
// TODO(ksons): Here, every data node is composed. Add the system's data node
// to every data node in a first appraoch

this.xflowDataNode = new DataNode(false);
this.xflowDataNode.addLoadListener(this.onXflowLoadEvent.bind(this));
this.xflowDataNode.userData = this.node;
Expand Down
2 changes: 2 additions & 0 deletions src/data/adapter/factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ var reg = {
'assetdata': Asset.AssetDataAdapter,
'assetmesh': Asset.AssetMeshAdapter,
'model': Asset.AssetAdapter
// TODO(ksons): Add an data adapter for the xml3d element that provides a container for system parameter (DataNode)
// including default values
};

/**
Expand Down
2 changes: 2 additions & 0 deletions src/data/adapter/values.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ var ValueDataAdapter = function (factory, node) {
};
XML3D.createClass(ValueDataAdapter, NodeAdapter);

// TODO(ksons): In a first step, name-mangle every value element that has the
// sys flag set
ValueDataAdapter.prototype.init = function()
{
var config = this.node._configured, value;
Expand Down
4 changes: 4 additions & 0 deletions src/renderer/webgl/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ var GLRenderer = function (element, canvasHandler) {
this.height = canvas.clientHeight;

this.context = new GLContext(canvas, this._canvasHandler.id);

// TODO(ksons): Get the data adapter for the element and pass it to the scene
// the scene implementation should fill the system DataNode with the relevant
// data (Scene: renderer-independent values, GLScene: renderer-dependent values)
this.scene = new GLScene(this.context);

var factory = xml3dFormatHandler.getFactory("webgl", this._canvasHandler.id);
Expand Down
44 changes: 44 additions & 0 deletions tests/scenes/system-parameters.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<!DOCTYPE html><html><head lang="en">
<meta charset="UTF-8">
<meta name="generator" content="xml3d-blender-exporter v0.4.0">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script type="text/javascript" src="../../build/output/xml3d.js"></script>
<title>Test System Parameteres</title>
</head>
<body>

<xml3d id="Scene" activeview="#v_pview" style="width: 512px; height: 512px; background-color:rgb(65,65,65);">
<defs>
<material id="Material-001" script="urn:xml3d:material:phong">
<float3 name="diffuseColor">0.8000000715255737 0.013141818344593048 0.02618921920657158</float3>
</material>
<material id="Material" script="urn:xml3d:material:phong">
<float3 name="diffuseColor">0.800000011920929 0.800000011920929 0.800000011920929</float3>
</material>
</defs>
<view id="v_pview" position="0 0 31" orientation="0 0 1 1.57"></view>
<group id="Spot" class="layer-0" style="transform:matrix3d(1.000000,0.000000,0.000000,0.000000,0.000000,1.000000,0.000000,0.000000,0.000000,0.000000,1.000000,0.000000,0.000000,0.000000,10.000000,1.000000);">
<light model="urn:xml3d:light:spot">
<float name="falloffAngle">0.3927</float>
<float name="softness">0.1500</float>
<float3 name="attenuation">1.0000 0.0000 0.0016</float3>
<float3 name="intensity">1.0000 1.0000 1.0000</float3>
</light>
</group>
<group id="Cube" style="transform:matrix3d(1.000000,0.000000,0.000000,0.000000,0.000000,1.000000,0.000000,0.000000,0.000000,0.000000,1.000000,0.000000,0.000000,0.000000,0.776252,1.000000);" material="#Material-001">
<mesh>
<float3 name="position">-1.0 1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 1.0 -1.0 1.0 1.0 -1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 -1.0 -1.0 1.0 -1.0 1.0 1.0 1.0 1.0 -1.0 1.0 1.0 -1.0 -1.0 1.0 1.0 -1.0 -1.0 -1.0 -1.0 1.0 -1.0 -1.0 1.0 -1.0 1.0 -1.0 -1.0 1.0 -1.0 -1.0 -1.0 -1.0 1.0 -1.0 1.0 1.0 -1.0 1.0 -1.0 -1.0 1.0 -1.0 1.0 1.0 1.0 1.0 -1.0 1.0 1.0 -1.0 -1.0 1.0</float3>
<float3 name="normal">-1.0 0.0 -0.0 -1.0 0.0 -0.0 -1.0 0.0 -0.0 -1.0 0.0 -0.0 0.0 1.0 -0.0 0.0 1.0 -0.0 0.0 1.0 -0.0 0.0 1.0 -0.0 1.0 0.0 -0.0 1.0 0.0 -0.0 1.0 0.0 -0.0 1.0 0.0 -0.0 0.0 -1.0 -0.0 0.0 -1.0 -0.0 0.0 -1.0 -0.0 0.0 -1.0 -0.0 -0.0 0.0 -1.0 -0.0 0.0 -1.0 -0.0 0.0 -1.0 -0.0 0.0 -1.0 -0.0 0.0 1.0 -0.0 0.0 1.0 -0.0 0.0 1.0 -0.0 0.0 1.0</float3>
<int name="index">0 1 2 2 3 0 4 5 6 6 7 4 8 9 10 10 11 8 12 13 14 14 15 12 16 17 18 18 19 16 20 21 22 22 23 20 </int>
<data compute="diffuseColor = xflow.animateColor(time)"><!-- TODO: Implement xflow.animateColor -->
<float name="time" sys></float>
</data>
</mesh>
</group>
<group id="Plane" material="#Material">
<model src="assets/plane2.xml#Plane"></model>
</group>
</xml3d>

</body>
</html>

0 comments on commit 31d05ab

Please sign in to comment.